ソースを参照

Test update for EObject Features

benjamin.schwertfeger@gmail.com 14 年 前
コミット
4b4e0e1819

+ 8 - 5
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/Assert.java

@@ -12,6 +12,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.yakindu.base.base.NamedElement;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.Execution;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
@@ -26,12 +27,12 @@ import org.yakindu.sct.model.sexec.Step;
 import org.yakindu.sct.model.stext.stext.AssignmentExpression;
 import org.yakindu.sct.model.stext.stext.AssignmentOperator;
 import org.yakindu.sct.model.stext.stext.BoolLiteral;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.Expression;
 import org.yakindu.sct.model.stext.stext.FeatureCall;
 import org.yakindu.sct.model.stext.stext.IntLiteral;
 import org.yakindu.sct.model.stext.stext.Literal;
 import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
-import org.yakindu.sct.model.stext.stext.TypedElementReferenceExpression;
 
 public class Assert {
 
@@ -63,12 +64,14 @@ public class Assert {
 		assertEquals(operator, assignment.getOperator());
 
 		Expression varRef = assignment.getVarRef();
-		if (varRef instanceof TypedElementReferenceExpression) {
-			TypedElementReferenceExpression elementRef = (TypedElementReferenceExpression) varRef;
-			assertEquals(variableName, elementRef.getReference().getName());
+		if (varRef instanceof ElementReferenceExpression) {
+			ElementReferenceExpression elementRef = (ElementReferenceExpression) varRef;
+			assertEquals(variableName,
+					((NamedElement) elementRef.getReference()).getName());
 		} else if (varRef instanceof FeatureCall) {
 			FeatureCall call = (FeatureCall) varRef;
-			assertEquals(variableName, call.getFeature().getName());
+			assertEquals(variableName,
+					((NamedElement) call.getFeature()).getName());
 		}
 		assertExpressionEquals(value, assignment.getExpression());
 	}

+ 18 - 17
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateReactionTest.java

@@ -22,6 +22,7 @@ import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createVari
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition;
 
 import org.junit.Test;
+import org.yakindu.base.base.NamedElement;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sexec.If;
@@ -40,6 +41,7 @@ import org.yakindu.sct.model.sgraph.Transition;
 import org.yakindu.sct.model.stext.stext.AssignmentExpression;
 import org.yakindu.sct.model.stext.stext.AssignmentOperator;
 import org.yakindu.sct.model.stext.stext.BoolLiteral;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.EventDefinition;
 import org.yakindu.sct.model.stext.stext.IntLiteral;
 import org.yakindu.sct.model.stext.stext.Literal;
@@ -54,7 +56,6 @@ import org.yakindu.sct.model.stext.stext.ReactionTrigger;
 import org.yakindu.sct.model.stext.stext.StextFactory;
 import org.yakindu.sct.model.stext.stext.TimeEventType;
 import org.yakindu.sct.model.stext.stext.TimeUnit;
-import org.yakindu.sct.model.stext.stext.TypedElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
 
 public class ModelSequencerStateReactionTest extends ModelSequencerTest {
@@ -73,7 +74,7 @@ public class ModelSequencerStateReactionTest extends ModelSequencerTest {
 
 		Statement s = behaviorMapping.buildCondition(tr1);
 
-		assertClass(TypedElementReferenceExpression.class, s);
+		assertClass(ElementReferenceExpression.class, s);
 	}
 
 	/**
@@ -97,9 +98,9 @@ public class ModelSequencerStateReactionTest extends ModelSequencerTest {
 		Statement s = behaviorMapping.buildCondition(tr1);
 
 		assertTrue(s instanceof LogicalOrExpression);
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				((LogicalOrExpression) s).getLeftOperand());
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				((LogicalOrExpression) s).getRightOperand());
 	}
 
@@ -163,23 +164,23 @@ public class ModelSequencerStateReactionTest extends ModelSequencerTest {
 		Reaction reaction = behaviorMapping.mapTransition(t);
 
 		assertTrue(reaction.getCheck().getCondition() instanceof LogicalOrExpression);
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				((LogicalOrExpression) reaction.getCheck().getCondition())
 						.getLeftOperand());
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				((LogicalOrExpression) reaction.getCheck().getCondition())
 						.getRightOperand());
 
 		assertEquals(
 				e1.getName(),
-				((TypedElementReferenceExpression) ((LogicalOrExpression) reaction
+				((NamedElement) ((ElementReferenceExpression) ((LogicalOrExpression) reaction
 						.getCheck().getCondition()).getLeftOperand())
-						.getReference().getName());
+						.getReference()).getName());
 		assertEquals(
 				e2.getName(),
-				((TypedElementReferenceExpression) ((LogicalOrExpression) reaction
+				((NamedElement) ((ElementReferenceExpression) ((LogicalOrExpression) reaction
 						.getCheck().getCondition()).getRightOperand())
-						.getReference().getName());
+						.getReference()).getName());
 	}
 
 	@Test
@@ -211,16 +212,16 @@ public class ModelSequencerStateReactionTest extends ModelSequencerTest {
 		PrimitiveValueExpression guardCheck = (PrimitiveValueExpression) and
 				.getRightOperand();
 
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				triggerCheck.getLeftOperand());
-		assertClass(TypedElementReferenceExpression.class,
+		assertClass(ElementReferenceExpression.class,
 				triggerCheck.getRightOperand());
 		assertEquals(e1.getName(),
-				((TypedElementReferenceExpression) triggerCheck
-						.getLeftOperand()).getReference().getName());
+				((NamedElement) ((ElementReferenceExpression) triggerCheck
+						.getLeftOperand()).getReference()).getName());
 		assertEquals(e2.getName(),
-				((TypedElementReferenceExpression) triggerCheck
-						.getRightOperand()).getReference().getName());
+				((NamedElement) ((ElementReferenceExpression) triggerCheck
+						.getRightOperand()).getReference()).getName());
 
 		assertBoolLiteral(false, guardCheck.getValue());
 	}
@@ -283,7 +284,7 @@ public class ModelSequencerStateReactionTest extends ModelSequencerTest {
 		If _if = (If) SCTTestUtil.flattenSequenceStepsAsList(
 				flow.getStates().get(0).getReactSequence()).get(0);
 
-		TypedElementReferenceExpression _ere = (TypedElementReferenceExpression) _if
+		ElementReferenceExpression _ere = (ElementReferenceExpression) _if
 				.getCheck().getCondition();
 		assertSame(te, _ere.getReference());
 

+ 12 - 12
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateTest.java

@@ -64,7 +64,7 @@ import org.yakindu.sct.model.stext.stext.ReactionEffect;
 import org.yakindu.sct.model.stext.stext.ReactionTrigger;
 import org.yakindu.sct.model.stext.stext.RelationalOperator;
 import org.yakindu.sct.model.stext.stext.StextFactory;
-import org.yakindu.sct.model.stext.stext.TypedElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
 
 public class ModelSequencerStateTest extends ModelSequencerTest {
@@ -718,8 +718,8 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE
 				.createLogicalRelationExpression();
 		lr2_equals.setOperator(RelationalOperator.EQUALS);
-		TypedElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE
-				.createTypedElementReferenceExpression();
+		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE
+				.createElementReferenceExpression();
 		lr2_varRef.setReference(v1);
 		PrimitiveValueExpression lr2_value = _createValue(42);
 		lr2_equals.setLeftOperand(lr2_varRef);
@@ -734,8 +734,8 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE
 				.createLogicalRelationExpression();
 		lr3_equals.setOperator(RelationalOperator.EQUALS);
-		TypedElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE
-				.createTypedElementReferenceExpression();
+		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE
+				.createElementReferenceExpression();
 		lr3_varRef.setReference(v1);
 		PrimitiveValueExpression lr3_value = _createValue(0);
 		lr3_equals.setLeftOperand(lr3_varRef);
@@ -769,7 +769,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 
 		// check first local reaction
 		If _lr1 = (If) _seq.getSteps().get(0);
-		assertClass(TypedElementReferenceExpression.class, _lr1.getCheck()
+		assertClass(ElementReferenceExpression.class, _lr1.getCheck()
 				.getCondition());
 		assertSame(s1.getReactions().get(1).getCheck().getCondition(), _lr1
 				.getCheck().getCondition());
@@ -822,8 +822,8 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE
 				.createLogicalRelationExpression();
 		lr2_equals.setOperator(RelationalOperator.EQUALS);
-		TypedElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE
-				.createTypedElementReferenceExpression();
+		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE
+				.createElementReferenceExpression();
 		lr2_varRef.setReference(v1);
 		PrimitiveValueExpression lr2_value = _createValue(42);
 		lr2_equals.setLeftOperand(lr2_varRef);
@@ -838,8 +838,8 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE
 				.createLogicalRelationExpression();
 		lr3_equals.setOperator(RelationalOperator.EQUALS);
-		TypedElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE
-				.createTypedElementReferenceExpression();
+		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE
+				.createElementReferenceExpression();
 		lr3_varRef.setReference(v1);
 		PrimitiveValueExpression lr3_value = _createValue(0);
 		lr3_equals.setLeftOperand(lr3_varRef);
@@ -866,7 +866,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 
 		// check first local reaction
 		If _lr1 = (If) _seq.getSteps().get(0);
-		assertClass(TypedElementReferenceExpression.class, _lr1.getCheck()
+		assertClass(ElementReferenceExpression.class, _lr1.getCheck()
 				.getCondition());
 		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1
 				.getCheck().getCondition());
@@ -978,7 +978,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		If _lr1 = (If) assertedSequence(
 				assertedSequence(_seq.getSteps().get(0)).getSteps().get(0))
 				.getSteps().get(0);
-		assertClass(TypedElementReferenceExpression.class, _lr1.getCheck()
+		assertClass(ElementReferenceExpression.class, _lr1.getCheck()
 				.getCondition());
 		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1
 				.getCheck().getCondition());

+ 2 - 2
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencertDeclarationsTest.java

@@ -38,7 +38,7 @@ import org.yakindu.sct.model.stext.stext.InternalScope;
 import org.yakindu.sct.model.stext.stext.OperationDefinition;
 import org.yakindu.sct.model.stext.stext.ReactionEffect;
 import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.TypedElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
 
 public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
@@ -119,7 +119,7 @@ public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
 		If _if = (If) assertedSequence(assertedSequence(step).getSteps().get(0))
 				.getSteps().get(0);
 
-		TypedElementReferenceExpression _ere = (TypedElementReferenceExpression) _if
+		ElementReferenceExpression _ere = (ElementReferenceExpression) _if
 				.getCheck().getCondition();
 		assertSame(_e1, _ere.getReference());
 	}