Quellcode durchsuchen

Added Guard TestModel

Andreas Mülder vor 13 Jahren
Ursprung
Commit
81f3741605

BIN
test-plugins/org.yakindu.sct.model.sexec.interpreter.test/images/Guard.png


BIN
test-plugins/org.yakindu.sct.model.sexec.interpreter.test/images/Simple.png


+ 11 - 2
test-plugins/org.yakindu.sct.model.sexec.interpreter.test/src/org/yakindu/sct/model/sexec/interpreter/test/ExecutionFlowInterpreterTest.java

@@ -26,13 +26,22 @@ public class ExecutionFlowInterpreterTest extends AbstractExecutionFlowTest {
 
 	@Test
 	public void testSimpleTransition() throws Exception {
-		loadAndconfigureInterpreter(models.createSimpleModel());
+		loadAndconfigureInterpreter(models.createGuardModel());
 		assertIsActive("A");
 		assertVarValue("MyVar", 0);
 		context().raiseEvent("Event1", null);
 		interpreter.runCycle();
-		assertIsActive("B");
+		assertIsActive("A");
+		context().raiseEvent("Event2", null);
+		interpreter.runCycle();
 		assertVarValue("MyVar", 10);
+		assertIsActive("B");
+		context().raiseEvent("Return", null);
+		interpreter.runCycle();
+		assertIsActive("A");
+		context().raiseEvent("Event1", null);
+		interpreter.runCycle();
+		assertIsActive("B");
 	}
 	@Test
 	public void testsimpleHierachy() throws IOException{

+ 4 - 4
test-plugins/org.yakindu.sct.model.sexec.interpreter.test/src/util/TestModels.java

@@ -34,20 +34,20 @@ public class TestModels {
 
 	private static final String TESTMODEL_DIR = "org.yakindu.sct.model.sexec.interpreter.test/testmodels/";
 
-	private static final String SIMPLE = "Simple.sct";
+	private static final String GUARD = "Guard.sct";
 	private static final String SIMPLE_HIERACHY = "SimpleHierachy.sct";
 
 	@Inject
 	private ModelSequencer sequencer;
 
 	/**
-	 * <img src="../../images/Simple.png" /> <br />
+	 * <img src="../../images/Guard.png" /> <br />
 	 * Creates a simple {@link Statechart} with two States and one Transition
 	 * @return the {@link ExecutionFlow}
 	 * @throws IOException
 	 */
-	public ExecutionFlow createSimpleModel() throws IOException {
-		return loadFromResource(SIMPLE);
+	public ExecutionFlow createGuardModel() throws IOException {
+		return loadFromResource(GUARD);
 	}
 	
 	/**

+ 33 - 7
test-plugins/org.yakindu.sct.model.sexec.interpreter.test/testmodels/Simple.sct

@@ -1,14 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
-  <sgraph:Statechart xmi:id="_RHEiAHNtEeGtAMDjlTj9eQ" specification="internal:&#xD;&#xA;event Event1&#xD;&#xA;var MyVar : integer = 0" name="Simple">
+  <sgraph:Statechart xmi:id="_RHEiAHNtEeGtAMDjlTj9eQ" specification="internal:&#xD;&#xA;event Event1&#xD;&#xA;event Event2&#xD;&#xA;event Return&#xD;&#xA;var MyVar : integer = 0" name="Simple">
     <regions xmi:id="_RHIMYnNtEeGtAMDjlTj9eQ" name="main region">
       <vertices xsi:type="sgraph:Entry" xmi:id="_RHZSIXNtEeGtAMDjlTj9eQ">
         <outgoingTransitions xmi:id="_RHjDIXNtEeGtAMDjlTj9eQ" target="_RHc8gXNtEeGtAMDjlTj9eQ"/>
       </vertices>
-      <vertices xsi:type="sgraph:State" xmi:id="_RHc8gXNtEeGtAMDjlTj9eQ" name="A" incomingTransitions="_RHjDIXNtEeGtAMDjlTj9eQ">
-        <outgoingTransitions xmi:id="_Wl3F8HNtEeGtAMDjlTj9eQ" specification="Event1" target="_V-iAMHNtEeGtAMDjlTj9eQ"/>
+      <vertices xsi:type="sgraph:State" xmi:id="_RHc8gXNtEeGtAMDjlTj9eQ" name="A" incomingTransitions="_RHjDIXNtEeGtAMDjlTj9eQ _a5PQkHN2EeGvE6zPcInM6Q">
+        <outgoingTransitions xmi:id="_Wl3F8HNtEeGtAMDjlTj9eQ" specification="Event1 [MyVar == 10]" target="_V-iAMHNtEeGtAMDjlTj9eQ"/>
+        <outgoingTransitions xmi:id="_WXQTIHN2EeGvE6zPcInM6Q" specification="Event2" target="_V-iAMHNtEeGtAMDjlTj9eQ"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_V-iAMHNtEeGtAMDjlTj9eQ" specification="entry / MyVar = 10" name="B" incomingTransitions="_Wl3F8HNtEeGtAMDjlTj9eQ _WXQTIHN2EeGvE6zPcInM6Q">
+        <outgoingTransitions xmi:id="_a5PQkHN2EeGvE6zPcInM6Q" specification="Return" target="_RHc8gXNtEeGtAMDjlTj9eQ"/>
       </vertices>
-      <vertices xsi:type="sgraph:State" xmi:id="_V-iAMHNtEeGtAMDjlTj9eQ" specification="entry / MyVar = 10" name="B" incomingTransitions="_Wl3F8HNtEeGtAMDjlTj9eQ"/>
     </regions>
   </sgraph:Statechart>
   <notation:Diagram xmi:id="_RHIMYHNtEeGtAMDjlTj9eQ" type="org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor" element="_RHEiAHNtEeGtAMDjlTj9eQ" measurementUnit="Pixel">
@@ -60,12 +63,12 @@
           <styles xsi:type="notation:ShapeStyle" xmi:id="_V-m4sXNtEeGtAMDjlTj9eQ" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
           <styles xsi:type="notation:FontStyle" xmi:id="_V-m4snNtEeGtAMDjlTj9eQ"/>
           <styles xsi:type="notation:BooleanValueStyle" xmi:id="_V-p8AXNtEeGtAMDjlTj9eQ"/>
-          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_V-m4s3NtEeGtAMDjlTj9eQ" x="189" y="78" width="151"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_V-m4s3NtEeGtAMDjlTj9eQ" x="234" y="78" width="151"/>
         </children>
         <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RHXc8XNtEeGtAMDjlTj9eQ"/>
       </children>
       <styles xsi:type="notation:ShapeStyle" xmi:id="_RHRWUXNtEeGtAMDjlTj9eQ" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
-      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RHZSIHNtEeGtAMDjlTj9eQ" x="220" y="10" width="400" height="191"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RHZSIHNtEeGtAMDjlTj9eQ" x="220" y="10" width="446" height="336"/>
     </children>
     <children xsi:type="notation:Shape" xmi:id="_RHn7oHNtEeGtAMDjlTj9eQ" type="StatechartText" fontName="Verdana" lineColor="4210752">
       <children xsi:type="notation:DecorationNode" xmi:id="_RHpJwHNtEeGtAMDjlTj9eQ" type="StatechartName">
@@ -90,11 +93,34 @@
     <edges xmi:id="_Wl6wUHNtEeGtAMDjlTj9eQ" type="Transition" element="_Wl3F8HNtEeGtAMDjlTj9eQ" source="_RHeKoHNtEeGtAMDjlTj9eQ" target="_V-m4sHNtEeGtAMDjlTj9eQ">
       <children xsi:type="notation:DecorationNode" xmi:id="_Wl7XYXNtEeGtAMDjlTj9eQ" type="TransitionExpression">
         <styles xsi:type="notation:ShapeStyle" xmi:id="_Wl7-cHNtEeGtAMDjlTj9eQ"/>
-        <layoutConstraint xsi:type="notation:Location" xmi:id="_Wl7-cXNtEeGtAMDjlTj9eQ" y="10"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_Wl7-cXNtEeGtAMDjlTj9eQ" x="-2" y="-12"/>
       </children>
       <styles xsi:type="notation:ConnectorStyle" xmi:id="_Wl6wUXNtEeGtAMDjlTj9eQ" lineColor="4210752"/>
       <styles xsi:type="notation:FontStyle" xmi:id="_Wl7XYHNtEeGtAMDjlTj9eQ" fontName="Verdana"/>
       <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_Wl6wUnNtEeGtAMDjlTj9eQ" points="[18, 4, -191, -4]$[207, -17, -2, -25]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_U7k_UHN2EeGvE6zPcInM6Q" id="(0.825,0.14285714285714285)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_Vek-sHN2EeGvE6zPcInM6Q" id="(0.039735099337748346,0.13114754098360656)"/>
+    </edges>
+    <edges xmi:id="_WXTWcHN2EeGvE6zPcInM6Q" type="Transition" element="_WXQTIHN2EeGvE6zPcInM6Q" source="_RHeKoHNtEeGtAMDjlTj9eQ" target="_V-m4sHNtEeGtAMDjlTj9eQ">
+      <children xsi:type="notation:DecorationNode" xmi:id="_WXUkkHN2EeGvE6zPcInM6Q" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_WXUkkXN2EeGvE6zPcInM6Q"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_WXUkknN2EeGvE6zPcInM6Q" x="1" y="-7"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_WXTWcXN2EeGvE6zPcInM6Q" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_WXT9gHN2EeGvE6zPcInM6Q" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_WXTWcnN2EeGvE6zPcInM6Q" points="[18, 1, -156, -6]$[175, 29, 1, 22]"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_WXarMHN2EeGvE6zPcInM6Q" id="(0.052980132450331126,0.6229508196721312)"/>
+    </edges>
+    <edges xmi:id="_a5XMYHN2EeGvE6zPcInM6Q" type="Transition" element="_a5PQkHN2EeGvE6zPcInM6Q" source="_V-m4sHNtEeGtAMDjlTj9eQ" target="_RHeKoHNtEeGtAMDjlTj9eQ">
+      <children xsi:type="notation:DecorationNode" xmi:id="_a5YagHN2EeGvE6zPcInM6Q" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_a5YagXN2EeGvE6zPcInM6Q"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_a5YagnN2EeGvE6zPcInM6Q" x="14" y="13"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_a5XMYXN2EeGvE6zPcInM6Q" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_a5XzcHN2EeGvE6zPcInM6Q" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_a5XMYnN2EeGvE6zPcInM6Q" points="[8, 49, 225, 45]$[8, 79, 225, 75]$[-209, 79, 8, 75]$[-209, 46, 8, 42]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_a5ehIHN2EeGvE6zPcInM6Q" id="(0.2913907284768212,0.13114754098360656)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_a5ehIXN2EeGvE6zPcInM6Q" id="(0.275,0.17857142857142858)"/>
     </edges>
   </notation:Diagram>
 </xmi:XMI>