Commit bbc90f3a authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ refined merging of SUT components


+ other minor refinements

Change-Id: I448601db82e9235999bd5d7875976d9a43f336ae
Signed-off-by: Philip Makedonski's avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent d58d20d6
......@@ -72,7 +72,7 @@ operation Any qualifiedName() : String {
operation Any getNamedParent() : Any {
if (self.eContainer.isDefined()) {
if (not self.eContainer.isKindOf(NamedElement)) {
if (not self.eContainer.isKindOf(TDL!NamedElement)) {
return self.eContainer.getNamedParent();
} else {
return self.eContainer;
......
......@@ -392,26 +392,21 @@ rule TC2FD
}
//merge ports of SUT components into sut
for (ci in tc.componentInstance.select(c|not simulateSUT and c.role.name = "SUT")) {
for (gi in ci.type.gateInstance) {
var pe = new TTCN!PortElement();
pe.name = gi.TTCNname()+"_SUT";
var d = new TTCN!ComponentDefList();
sut.structured.component.defs.add(d);
d.sc = ";";
d.element = new TTCN!ComponentElementDef();
d.element.port = new TTCN!PortInstance();
d.element.port.ref = gi.type.equivalent();
d.element.port.instances.add(pe);
if (not simulateSUT) {
for (c in tc.connection) {
if (c.endPoint.get(0).component.role.name = "SUT" and
c.endPoint.get(1).component.role.name = "Tester" ) {
c.endPoint.get(0).mergeIntoSUT(sut);
}
if (c.endPoint.get(1).component.role.name = "SUT" and
c.endPoint.get(0).component.role.name = "Tester" ) {
c.endPoint.get(1).mergeIntoSUT(sut);
}
}
}
}
//create connections
for (c in tc.connection) {
for (c in tc.connection) {
if (simulateSUT or
(c.endPoint.get(0).component.role.name = "Tester" and
c.endPoint.get(1).component.role.name = "Tester" )) {
......@@ -424,8 +419,10 @@ rule TC2FD
s.configuration.connect.spec.port2 = c.endPoint.get(1).equivalent();
sl.statements.add(s);
sl.sc.add(";");
} else if ((c.endPoint.get(0).component.role.name = "SUT" and
c.endPoint.get(1).component.role.name = "SUT" )) {
//skip
} else {
var s = new TTCN!FunctionStatement();
s.configuration = new TTCN!ConfigurationStatements();
s.configuration.map = new TTCN!MapStatement();
......@@ -571,9 +568,10 @@ rule TD2FD
rule GR2PR
transform gr : TDL!GateReference
to pr : TTCN!PortRef {
//guard : false
guard : simulateSUT or gr.checkGateReference()
var cr = new TTCN!ComponentRef();
pr.component = cr;
if (simulateSUT or gr.component.role.name = "Tester" ) {
cr.ref = new TTCN!ComponentOrDefaultReference();
......@@ -581,13 +579,14 @@ rule GR2PR
cr.ref.variable.ref = new TTCN!ReferencedValue();
cr.ref.variable.ref.head = new TTCN!Head();
cr.ref.variable.ref.head.target = gr.component.equivalent();
pr.port = gr.gate.equivalent();
} else {
cr.system = "system";
//TODO: is there a case for cr.mtc?
//will be replaced with system port in TC2FD
pr.port = gr.gate.equivalent();
//TODO: is there a case for cr.mtc?
}
pr.component = cr;
pr.port = gr.gate.equivalent();
}
......@@ -1233,6 +1232,39 @@ operation String getFunction() : TTCN!FunctionDef {
return TTCN!FunctionDef.allInstances().select(c|c.name = self).first();
}
operation TDL!GateReference checkGateReference() : Boolean {
var accepted = false;
if (self.component.role.name = "Tester") {
accepted = true;
}
if (self.component.role.name = "SUT") {
if (self.eContainer.isKindOf(TDL!Connection)) {
var opposite = self.eContainer.endPoint.select(e|e <> self).first();
if (opposite.component.role.name = "Tester") {
accepted = true;
}
}
}
return accepted;
}
operation TDL!GateReference mergeIntoSUT(sut : TTCN!TypeDefBody) {
var pe = new TTCN!PortElement();
pe.name = self.component.TTCNname()+"_"+self.gate.TTCNname();
var d = new TTCN!ComponentDefList();
sut.structured.component.defs.add(d);
d.sc = ";";
d.element = new TTCN!ComponentElementDef();
d.element.port = new TTCN!PortInstance();
d.element.port.ref = self.gate.type.equivalent();
d.element.port.instances.add(pe);
self.equivalent().port = pe;
}
operation TDL!DataInstanceUse getTemplateBody() : TTCN!TemplateBody {
var tb = new TTCN!TemplateBody();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment