소스 검색

Removed default trigger check on transitions with exit point spec. Testcase refactoring.

markus.muehlbrandt@gmail.com 11 년 전
부모
커밋
86e76be16e

+ 10 - 3
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -172,6 +172,12 @@ public class STextJavaValidator extends AbstractSTextJavaValidator {
 				}
 			}
 		}
+		
+		if (!STextValidationModelUtils.getExitPointSpecs(trans.getProperties())
+				.isEmpty()) {
+			return;
+		}
+		
 		if (trans.getTrigger() == null) {
 			warning(ISSUE_TRANSITION_WITHOUT_TRIGGER, trans, null, -1);
 		}
@@ -645,9 +651,10 @@ public class STextJavaValidator extends AbstractSTextJavaValidator {
 
 	@Check(CheckType.FAST)
 	public void checkExitPointSpecWithTrigger(Transition t) {
-		if (!STextValidationModelUtils.getExitPointSpecs(
-				t.getProperties()).isEmpty()
-				&& t.getTrigger() != null && t.getSource() instanceof org.yakindu.sct.model.sgraph.State) {
+		if (!STextValidationModelUtils.getExitPointSpecs(t.getProperties())
+				.isEmpty()
+				&& t.getTrigger() != null
+				&& t.getSource() instanceof org.yakindu.sct.model.sgraph.State) {
 			error(EXITPOINTSPEC_WITH_TRIGGER, t, null, -1);
 		}
 	}

+ 0 - 8
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextJavaValidatorTest.java

@@ -468,15 +468,9 @@ public class STextJavaValidatorTest extends AbstractSTextTest {
 				+ "TransitionExitSpecNotComposite.sct");
 		iter = statechart.eAllContents();
 
-		// create and add triggers to all transitions to prevent to trigger
-		// additional warnings
-		// (see Check in SGrapJavaValidator transitionsWithNoGuard)
-		Trigger trigger = StextFactoryImpl.init().createDefaultTrigger();
-
 		while (iter.hasNext()) {
 			EObject element = iter.next();
 			if (element instanceof Transition) {
-				((Transition) element).setTrigger(trigger);
 				assertTrue(validator.validate(element, diagnostics, new HashMap<Object, Object>()));
 			}
 		}
@@ -492,7 +486,6 @@ public class STextJavaValidatorTest extends AbstractSTextTest {
 		while (iter.hasNext()) {
 			EObject element = iter.next();
 			if (element instanceof Transition) {
-				((Transition) element).setTrigger(trigger);
 				assertTrue(validator.validate(element, diagnostics, new HashMap<Object, Object>()));
 			}
 		}
@@ -508,7 +501,6 @@ public class STextJavaValidatorTest extends AbstractSTextTest {
 		while (iter.hasNext()) {
 			EObject element = iter.next();
 			if (element instanceof Transition) {
-				((Transition) element).setTrigger(trigger);
 				validator.validate(element, diagnostics, new HashMap<Object, Object>());
 			}
 		}

+ 7 - 7
test-plugins/org.yakindu.sct.test.models/testmodels/validation/TransitionExitSpecOnMultipleSiblings.sct

@@ -1,6 +1,6 @@
 <?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="_RxPu8LCkEeKusf4xiRlf2w" specification="" name="TransitionExitSpecOnMultipleSiblings">
+  <sgraph:Statechart xmi:id="_RxPu8LCkEeKusf4xiRlf2w" specification="internal:&#xA;event e1&#xA;event e2" name="TransitionExitSpecOnMultipleSiblings">
     <regions xmi:id="_RxQ9ErCkEeKusf4xiRlf2w" name="main region">
       <vertices xsi:type="sgraph:Entry" xmi:id="_RxWcobCkEeKusf4xiRlf2w">
         <outgoingTransitions xmi:id="_RxY44bCkEeKusf4xiRlf2w" target="_RxXDt7CkEeKusf4xiRlf2w"/>
@@ -12,8 +12,8 @@
         <outgoingTransitions xmi:id="_GyNHULDMEeK984OEcGAtPQ" specification="# myExit2 >" target="_FzSA8LDMEeK984OEcGAtPQ"/>
         <regions xmi:id="_ZNA88LCkEeKusf4xiRlf2w">
           <vertices xsi:type="sgraph:State" xmi:id="_bY_sULCkEeKusf4xiRlf2w" name="A" incomingTransitions="_dB48wLCkEeKusf4xiRlf2w">
-            <outgoingTransitions xmi:id="_aiVToLCwEeKaBsfbNfeK4Q" specification="" target="_aFPvALCwEeKaBsfbNfeK4Q"/>
-            <outgoingTransitions xmi:id="_MQwasLDMEeK984OEcGAtPQ" specification="" target="_LmptwLDMEeK984OEcGAtPQ"/>
+            <outgoingTransitions xmi:id="_aiVToLCwEeKaBsfbNfeK4Q" specification="e2" target="_aFPvALCwEeKaBsfbNfeK4Q"/>
+            <outgoingTransitions xmi:id="_MQwasLDMEeK984OEcGAtPQ" specification="e1" target="_LmptwLDMEeK984OEcGAtPQ"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_cDFLILCkEeKusf4xiRlf2w">
             <outgoingTransitions xmi:id="_dB48wLCkEeKusf4xiRlf2w" specification="" target="_bY_sULCkEeKusf4xiRlf2w"/>
@@ -45,7 +45,7 @@
             <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RxXDsrCkEeKusf4xiRlf2w"/>
           </children>
           <styles xsi:type="notation:ShapeStyle" xmi:id="_RxWco7CkEeKusf4xiRlf2w" fontName="Verdana" lineColor="4210752"/>
-          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RxXDtrCkEeKusf4xiRlf2w" x="70" y="20" width="15" height="15"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RxXDtrCkEeKusf4xiRlf2w" x="127" y="31" width="15" height="15"/>
         </children>
         <children xmi:id="_RxXqwbCkEeKusf4xiRlf2w" type="State" element="_RxXDt7CkEeKusf4xiRlf2w">
           <children xsi:type="notation:DecorationNode" xmi:id="_RxYR0LCkEeKusf4xiRlf2w" type="StateName">
@@ -99,7 +99,7 @@
                       <layoutConstraint xsi:type="notation:Location" xmi:id="_aFVOkrCwEeKaBsfbNfeK4Q"/>
                     </children>
                     <styles xsi:type="notation:ShapeStyle" xmi:id="_aFUngbCwEeKaBsfbNfeK4Q" fontName="Verdana" lineColor="4210752"/>
-                    <layoutConstraint xsi:type="notation:Bounds" xmi:id="_aFUngrCwEeKaBsfbNfeK4Q"/>
+                    <layoutConstraint xsi:type="notation:Bounds" xmi:id="_aFUngrCwEeKaBsfbNfeK4Q" x="-4" y="19"/>
                   </children>
                   <styles xsi:type="notation:ShapeStyle" xmi:id="_aFTZYbCwEeKaBsfbNfeK4Q" fontName="Verdana" lineColor="4210752"/>
                   <layoutConstraint xsi:type="notation:Bounds" xmi:id="_aFTZYrCwEeKaBsfbNfeK4Q" x="137" y="32"/>
@@ -111,7 +111,7 @@
                       <layoutConstraint xsi:type="notation:Location" xmi:id="_LmwbdbDMEeK984OEcGAtPQ"/>
                     </children>
                     <styles xsi:type="notation:ShapeStyle" xmi:id="_LmwbcbDMEeK984OEcGAtPQ" fontName="Verdana" lineColor="4210752"/>
-                    <layoutConstraint xsi:type="notation:Bounds" xmi:id="_LmwbcrDMEeK984OEcGAtPQ"/>
+                    <layoutConstraint xsi:type="notation:Bounds" xmi:id="_LmwbcrDMEeK984OEcGAtPQ" x="-83" y="-4"/>
                   </children>
                   <styles xsi:type="notation:ShapeStyle" xmi:id="_LmumQbDMEeK984OEcGAtPQ" fontName="Verdana" lineColor="4210752"/>
                   <layoutConstraint xsi:type="notation:Bounds" xmi:id="_LmumQrDMEeK984OEcGAtPQ" x="55" y="111"/>
@@ -125,7 +125,7 @@
           <styles xsi:type="notation:ShapeStyle" xmi:id="_RxXqwrCkEeKusf4xiRlf2w" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
           <styles xsi:type="notation:FontStyle" xmi:id="_RxXqw7CkEeKusf4xiRlf2w"/>
           <styles xsi:type="notation:BooleanValueStyle" xmi:id="_RxYR17CkEeKusf4xiRlf2w" name="isHorizontal" booleanValue="true"/>
-          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RxY44LCkEeKusf4xiRlf2w" x="35" y="77" width="205" height="236"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_RxY44LCkEeKusf4xiRlf2w" x="19" y="77" width="221" height="236"/>
         </children>
         <children xmi:id="_dxtQILCkEeKusf4xiRlf2w" type="State" element="_dxqM0LCkEeKusf4xiRlf2w">
           <children xsi:type="notation:DecorationNode" xmi:id="_dxtQJLCkEeKusf4xiRlf2w" type="StateName">

+ 3 - 3
test-plugins/org.yakindu.sct.test.models/testmodels/validation/UnusedDefaultExitPoint.sct

@@ -9,7 +9,7 @@
         <outgoingTransitions xmi:id="_Sb04IKziEeK3BbA-xenOSw" specification="# exit1 > exit2 >" target="_ME3wcKwOEeKDK5u47htxww"/>
         <regions xmi:id="_Ixvy0KwOEeKDK5u47htxww">
           <vertices xsi:type="sgraph:State" xmi:id="_3okGgKwcEeKcBsi8YLfGGg" name="A" incomingTransitions="_6Bj-MKwcEeKcBsi8YLfGGg">
-            <outgoingTransitions xmi:id="_bYaYoKziEeK3BbA-xenOSw" specification="" target="_adr1wKziEeK3BbA-xenOSw"/>
+            <outgoingTransitions xmi:id="_bYaYoKziEeK3BbA-xenOSw" specification="oncycle" target="_adr1wKziEeK3BbA-xenOSw"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_5dlHYKwcEeKcBsi8YLfGGg">
             <outgoingTransitions xmi:id="_6Bj-MKwcEeKcBsi8YLfGGg" specification="" target="_3okGgKwcEeKcBsi8YLfGGg"/>
@@ -18,7 +18,7 @@
         </regions>
         <regions xmi:id="_JE2VAKwOEeKDK5u47htxww">
           <vertices xsi:type="sgraph:State" xmi:id="_RtFC8Ky6EeKrnKvtzsUbpw" name="B" incomingTransitions="_SnpNwKy6EeKrnKvtzsUbpw">
-            <outgoingTransitions xmi:id="_fINEIKziEeK3BbA-xenOSw" specification="" target="_de_qoKziEeK3BbA-xenOSw"/>
+            <outgoingTransitions xmi:id="_fINEIKziEeK3BbA-xenOSw" specification="oncycle" target="_de_qoKziEeK3BbA-xenOSw"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_SPZF0Ky6EeKrnKvtzsUbpw" name="">
             <outgoingTransitions xmi:id="_SnpNwKy6EeKrnKvtzsUbpw" specification="" target="_RtFC8Ky6EeKrnKvtzsUbpw"/>
@@ -27,7 +27,7 @@
         </regions>
         <regions xmi:id="_qYhFIKy-EeKDTYVyKywyGw">
           <vertices xsi:type="sgraph:State" xmi:id="_tc600Ky_EeKDTYVyKywyGw" name="C" incomingTransitions="_v0lPwKy_EeKDTYVyKywyGw">
-            <outgoingTransitions xmi:id="_fpFjoKziEeK3BbA-xenOSw" specification="" target="_eK7jkKziEeK3BbA-xenOSw"/>
+            <outgoingTransitions xmi:id="_fpFjoKziEeK3BbA-xenOSw" specification="oncycle" target="_eK7jkKziEeK3BbA-xenOSw"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_u47f0Ky_EeKDTYVyKywyGw" name="">
             <outgoingTransitions xmi:id="_v0lPwKy_EeKDTYVyKywyGw" target="_tc600Ky_EeKDTYVyKywyGw"/>

+ 3 - 3
test-plugins/org.yakindu.sct.test.models/testmodels/validation/UnusedExitPoint.sct

@@ -1,6 +1,6 @@
 <?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="_KY5PIK10EeKDu_-BQi0Wmg" name="UnusedExitPoint">
+  <sgraph:Statechart xmi:id="_KY5PIK10EeKDu_-BQi0Wmg" specification="internal:&#xA;event e1&#xA;event e2" name="UnusedExitPoint">
     <regions xmi:id="_KY6dQq10EeKDu_-BQi0Wmg" name="main region">
       <vertices xsi:type="sgraph:Entry" xmi:id="_KY_Vwa10EeKDu_-BQi0Wmg">
         <outgoingTransitions xmi:id="_KZByA610EeKDu_-BQi0Wmg" target="_KY_81a10EeKDu_-BQi0Wmg"/>
@@ -12,13 +12,13 @@
             <outgoingTransitions xmi:id="_WI7bwK2BEeK1webgUiVXVA" specification="" target="_U9Y1sK2BEeK1webgUiVXVA"/>
           </vertices>
           <vertices xsi:type="sgraph:State" xmi:id="_U9Y1sK2BEeK1webgUiVXVA" name="A" incomingTransitions="_WI7bwK2BEeK1webgUiVXVA">
-            <outgoingTransitions xmi:id="_jPrW4LCzEeKkd8C7aZWapg" specification="" target="_i044ULCzEeKkd8C7aZWapg"/>
+            <outgoingTransitions xmi:id="_jPrW4LCzEeKkd8C7aZWapg" specification="e1" target="_i044ULCzEeKkd8C7aZWapg"/>
           </vertices>
           <vertices xsi:type="sgraph:Exit" xmi:id="_i044ULCzEeKkd8C7aZWapg" name="exitA" incomingTransitions="_jPrW4LCzEeKkd8C7aZWapg"/>
         </regions>
         <regions xmi:id="_Oh0MUK10EeKDu_-BQi0Wmg">
           <vertices xsi:type="sgraph:State" xmi:id="_yQy0cK14EeKDu_-BQi0Wmg" name="B" incomingTransitions="_l-xdoK2CEeK1webgUiVXVA">
-            <outgoingTransitions xmi:id="_GvjWoK2EEeK6f61rDSOHrA" specification="" target="_GCA7MK2EEeK6f61rDSOHrA"/>
+            <outgoingTransitions xmi:id="_GvjWoK2EEeK6f61rDSOHrA" specification="e2" target="_GCA7MK2EEeK6f61rDSOHrA"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_lhmZcK2CEeK1webgUiVXVA">
             <outgoingTransitions xmi:id="_l-xdoK2CEeK1webgUiVXVA" specification="" target="_yQy0cK14EeKDu_-BQi0Wmg"/>