Loading plugins/org.etsi.mts.tdl.execution.java.codegen/src/org/etsi/mts/tdl/execution/java/codegen/JUnitTestGenerator.java +3 −1 Original line number Diff line number Diff line Loading @@ -528,7 +528,9 @@ public class JUnitTestGenerator extends Renderer { first = false; append(cn); } line("});"); append("}, "); writeElement(tester); line(");"); blockClose(); newLine(); Loading plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/ElementImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,18 @@ public class ElementImpl implements Element { this.getAnnotations().add(new ElementAnnotationImpl(key, value)); return this; } @Override public boolean equals(Object obj) { if (obj instanceof ElementImpl && name != null) return name.equals(((ElementImpl)obj).name); return super.equals(obj); } @Override public int hashCode() { if (name != null) return name.hashCode(); return super.hashCode(); } } plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/NamedElementImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,18 @@ public class NamedElementImpl extends ElementImpl implements NamedElement { protected void setQualifiedName(String qualifiedName) { this.qualifiedName = qualifiedName; } @Override public boolean equals(Object obj) { if (obj instanceof NamedElementImpl && qualifiedName != null) return qualifiedName.equals(((NamedElementImpl)obj).qualifiedName); return super.equals(obj); } @Override public int hashCode() { if (qualifiedName != null) return qualifiedName.hashCode(); return super.hashCode(); } } plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/ReceiverHub.java +5 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import java.util.List; import org.etsi.mts.tdl.execution.java.tri.Argument; import org.etsi.mts.tdl.execution.java.tri.Connection; import org.etsi.mts.tdl.execution.java.tri.Data; import org.etsi.mts.tdl.execution.java.tri.StopException; import org.etsi.mts.tdl.execution.java.tri.NamedElement; import org.etsi.mts.tdl.execution.java.tri.SystemAdapter; public class ReceiverHub { Loading @@ -17,13 +17,15 @@ public class ReceiverHub { private SystemAdapter systemAdapter; private Connection connection; private NamedElement testerComponent; private List<Expectable> expecting = Collections.synchronizedList(new ArrayList<>()); private ExceptionalBehaviour anyReceiver; public ReceiverHub(SystemAdapter systemAdapter, Connection connection) { public ReceiverHub(SystemAdapter systemAdapter, Connection connection, NamedElement testerComponent) { this.systemAdapter = systemAdapter; this.connection = connection; this.testerComponent = testerComponent; this.thread = new Thread(() -> run(), "Receive from SystemAdapter on " + connection.getName()); this.thread.setDaemon(true); Loading Loading @@ -53,7 +55,7 @@ public class ReceiverHub { currentlyExpectingIndex++; } try { Data data = systemAdapter.receive(currentlyExpecting.expected, connection); Data data = systemAdapter.receive(currentlyExpecting.expected, connection, testerComponent); if (data != null) { currentlyExpectingIndex = 0; if (currentlyExpecting.anyReceiver) { Loading plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/TestControl.java +19 −2 Original line number Diff line number Diff line Loading @@ -14,9 +14,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.etsi.mts.tdl.execution.java.tri.Argument; import org.etsi.mts.tdl.execution.java.tri.ComponentInstanceRole; import org.etsi.mts.tdl.execution.java.tri.Connection; import org.etsi.mts.tdl.execution.java.tri.Data; import org.etsi.mts.tdl.execution.java.tri.Element; import org.etsi.mts.tdl.execution.java.tri.GateReference; import org.etsi.mts.tdl.execution.java.tri.NamedElement; import org.etsi.mts.tdl.execution.java.tri.PredefinedFunctions; import org.etsi.mts.tdl.execution.java.tri.Reporter; import org.etsi.mts.tdl.execution.java.tri.SystemAdapter; Loading @@ -34,6 +37,7 @@ public class TestControl { public PredefinedFunctions functions; private Connection[] connections; private NamedElement testerComponent; private Map<Connection, ReceiverHub> receiverHubs = Collections .synchronizedMap(new Hashtable<Connection, ReceiverHub>()); Loading Loading @@ -72,14 +76,27 @@ public class TestControl { return hub; } public void configure(Connection[] connections) { public void configure(Connection[] connections, NamedElement testerComponent) { this.systemAdapter.configure(connections); this.connections = connections; this.testerComponent = testerComponent; this.receiverHubs.values().forEach(r -> r.stop()); this.receiverHubs.clear(); for (Connection c : connections) { ReceiverHub hub = new ReceiverHub(this.systemAdapter, c); boolean isMyTester = false; for (GateReference gr: c.getEndPoints()) { if (gr.getComponentRole() != ComponentInstanceRole.Tester) continue; if (this.testerComponent.equals(gr.getComponent())) { isMyTester = true; break; } } if (!isMyTester) continue; ReceiverHub hub = new ReceiverHub(this.systemAdapter, c, testerComponent); receiverHubs.put(c, hub); ExceptionalBehaviour anyReceiver = new ExceptionalBehaviour(false); Loading Loading
plugins/org.etsi.mts.tdl.execution.java.codegen/src/org/etsi/mts/tdl/execution/java/codegen/JUnitTestGenerator.java +3 −1 Original line number Diff line number Diff line Loading @@ -528,7 +528,9 @@ public class JUnitTestGenerator extends Renderer { first = false; append(cn); } line("});"); append("}, "); writeElement(tester); line(");"); blockClose(); newLine(); Loading
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/ElementImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,18 @@ public class ElementImpl implements Element { this.getAnnotations().add(new ElementAnnotationImpl(key, value)); return this; } @Override public boolean equals(Object obj) { if (obj instanceof ElementImpl && name != null) return name.equals(((ElementImpl)obj).name); return super.equals(obj); } @Override public int hashCode() { if (name != null) return name.hashCode(); return super.hashCode(); } }
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/NamedElementImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,18 @@ public class NamedElementImpl extends ElementImpl implements NamedElement { protected void setQualifiedName(String qualifiedName) { this.qualifiedName = qualifiedName; } @Override public boolean equals(Object obj) { if (obj instanceof NamedElementImpl && qualifiedName != null) return qualifiedName.equals(((NamedElementImpl)obj).qualifiedName); return super.equals(obj); } @Override public int hashCode() { if (qualifiedName != null) return qualifiedName.hashCode(); return super.hashCode(); } }
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/ReceiverHub.java +5 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import java.util.List; import org.etsi.mts.tdl.execution.java.tri.Argument; import org.etsi.mts.tdl.execution.java.tri.Connection; import org.etsi.mts.tdl.execution.java.tri.Data; import org.etsi.mts.tdl.execution.java.tri.StopException; import org.etsi.mts.tdl.execution.java.tri.NamedElement; import org.etsi.mts.tdl.execution.java.tri.SystemAdapter; public class ReceiverHub { Loading @@ -17,13 +17,15 @@ public class ReceiverHub { private SystemAdapter systemAdapter; private Connection connection; private NamedElement testerComponent; private List<Expectable> expecting = Collections.synchronizedList(new ArrayList<>()); private ExceptionalBehaviour anyReceiver; public ReceiverHub(SystemAdapter systemAdapter, Connection connection) { public ReceiverHub(SystemAdapter systemAdapter, Connection connection, NamedElement testerComponent) { this.systemAdapter = systemAdapter; this.connection = connection; this.testerComponent = testerComponent; this.thread = new Thread(() -> run(), "Receive from SystemAdapter on " + connection.getName()); this.thread.setDaemon(true); Loading Loading @@ -53,7 +55,7 @@ public class ReceiverHub { currentlyExpectingIndex++; } try { Data data = systemAdapter.receive(currentlyExpecting.expected, connection); Data data = systemAdapter.receive(currentlyExpecting.expected, connection, testerComponent); if (data != null) { currentlyExpectingIndex = 0; if (currentlyExpecting.anyReceiver) { Loading
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/TestControl.java +19 −2 Original line number Diff line number Diff line Loading @@ -14,9 +14,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.etsi.mts.tdl.execution.java.tri.Argument; import org.etsi.mts.tdl.execution.java.tri.ComponentInstanceRole; import org.etsi.mts.tdl.execution.java.tri.Connection; import org.etsi.mts.tdl.execution.java.tri.Data; import org.etsi.mts.tdl.execution.java.tri.Element; import org.etsi.mts.tdl.execution.java.tri.GateReference; import org.etsi.mts.tdl.execution.java.tri.NamedElement; import org.etsi.mts.tdl.execution.java.tri.PredefinedFunctions; import org.etsi.mts.tdl.execution.java.tri.Reporter; import org.etsi.mts.tdl.execution.java.tri.SystemAdapter; Loading @@ -34,6 +37,7 @@ public class TestControl { public PredefinedFunctions functions; private Connection[] connections; private NamedElement testerComponent; private Map<Connection, ReceiverHub> receiverHubs = Collections .synchronizedMap(new Hashtable<Connection, ReceiverHub>()); Loading Loading @@ -72,14 +76,27 @@ public class TestControl { return hub; } public void configure(Connection[] connections) { public void configure(Connection[] connections, NamedElement testerComponent) { this.systemAdapter.configure(connections); this.connections = connections; this.testerComponent = testerComponent; this.receiverHubs.values().forEach(r -> r.stop()); this.receiverHubs.clear(); for (Connection c : connections) { ReceiverHub hub = new ReceiverHub(this.systemAdapter, c); boolean isMyTester = false; for (GateReference gr: c.getEndPoints()) { if (gr.getComponentRole() != ComponentInstanceRole.Tester) continue; if (this.testerComponent.equals(gr.getComponent())) { isMyTester = true; break; } } if (!isMyTester) continue; ReceiverHub hub = new ReceiverHub(this.systemAdapter, c, testerComponent); receiverHubs.put(c, hub); ExceptionalBehaviour anyReceiver = new ExceptionalBehaviour(false); Loading