Browse Source

- Added support for exit points (#781, #718)
- reworked choice behavior (#837)
- removed warnings in sexec transformation (#679)

terfloth@itemis.de 12 years ago
parent
commit
475b1386ce

+ 28 - 15
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.xtend

@@ -282,6 +282,20 @@ class BehaviorMapping {
 		return r
 	}
 	
+	def dispatch Reaction mapTransition(Transition t, Choice source, Vertex target) {
+		val r = t.create 
+		if (t.trigger != null) {
+			r.check = mapToCheck(t.trigger) 
+		} else {
+			r.check = sexecFactory.createCheck
+			r.check.condition = true.expression
+		}
+		r.effect = mapToEffect(newArrayList(t), r)
+		
+		return r
+	}
+	
+
 	
 	/** Ignore transitions from pseudostates to synchronization nodes.
 	 * 
@@ -304,7 +318,6 @@ class BehaviorMapping {
 		
 		// build the condition
 		var Statement condition = r.check.condition
-//		if (t.trigger != null) condition = t.trigger.buildCondition
 		
 		val joinTransitions = target.incomingTransitions
 			.filter( jt | jt.source instanceof State)
@@ -336,14 +349,12 @@ class BehaviorMapping {
 	}
 	
 	
-	def dispatch Check mapToCheck(Trigger tr) { null }
-	  
-	def dispatch Check mapToCheck(ReactionTrigger tr) {
+	def Check mapToCheck(Trigger tr) { 
 		val check = tr.createCheck
 		check.condition = tr.buildCondition;
 		return check
-	}
-	
+	 }
+	  	
 	def ExecutionFlow mapLocalReactions(Statechart statechart, ExecutionFlow r){
 		r.reactions.addAll(statechart.localReactions
 				.filter( typeof( LocalReaction ))
@@ -353,7 +364,6 @@ class BehaviorMapping {
 					|| ! (lr.trigger as ReactionTrigger).triggers.filter( t | 
 						t instanceof RegularEventSpec 
 						|| t instanceof TimeEventSpec 
-//						|| t instanceof OnCycleEvent 
 						|| t instanceof AlwaysEvent
 					).empty
 				)
@@ -378,7 +388,6 @@ class BehaviorMapping {
 					|| ! (lr.trigger as ReactionTrigger).triggers.filter( t | 
 						t instanceof RegularEventSpec 
 						|| t instanceof TimeEventSpec 
-//						|| t instanceof OnCycleEvent 
 						|| t instanceof AlwaysEvent
 					).toList.empty
 				)
@@ -629,13 +638,17 @@ class BehaviorMapping {
 	def dispatch Statement buildCondition (Trigger t) { null }
 
 
-	def dispatch Statement buildCondition (DefaultTrigger t) { 
-		val r = stext.factory.createPrimitiveValueExpression
-		val BoolLiteral boolLit = stext.factory.createBoolLiteral
-		boolLit.value = true		
-		r.value = boolLit
-		return r
-	 }
+	def dispatch Statement buildCondition (DefaultTrigger t) { 
+		true.expression
+	 }
+
+	def Statement expression (boolean b) { 
+		val r = stext.factory.createPrimitiveValueExpression
+		val BoolLiteral boolLit = stext.factory.createBoolLiteral
+		boolLit.value = b		
+		r.value = boolLit
+		return r
+	 }
 	
 	def dispatch Statement buildCondition (ReactionTrigger t) {
 		val triggerCheck = if (! t.triggers.empty) t.triggers.reverseView.fold(null as Expression,

+ 42 - 7
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.xtend

@@ -20,6 +20,10 @@ import org.yakindu.sct.model.stext.stext.BoolLiteral
 import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression
 import org.yakindu.sct.model.sexec.ExecutionState
 import org.yakindu.sct.model.sgraph.Synchronization
+import org.yakindu.sct.model.sexec.Reaction
+import org.yakindu.sct.model.sgraph.Exit
+import org.yakindu.sct.model.sgraph.Vertex
+import org.yakindu.sct.model.stext.stext.DefaultTrigger
 
 
 class ReactionBuilder {
@@ -63,6 +67,7 @@ class ReactionBuilder {
 		
 		sc.allChoices().forEach( choice | choice.defineReaction() )
 		sc.allSynchronizations().forEach( sync | sync.defineReaction() )
+		sc.allExits().forEach( sync | sync.defineReaction() )
 	}
 	
 
@@ -71,8 +76,11 @@ class ReactionBuilder {
 		val execChoice = choice.create
 		
 		// move the default transition to the end of the reaction list
-		val _default_ = execChoice.reactions.filter([ r | r.check.alwaysTrue ]).toList.head
-		if ( _default_ != null ) execChoice.reactions.move(execChoice.reactions.size -1, _default_)
+		val defaultTransition = choice.outgoingTransitions.filter( t | t.trigger == null || t.trigger instanceof DefaultTrigger ).head
+		if ( defaultTransition != null ) {
+			val defaultReaction = defaultTransition.create		
+			execChoice.reactions.move(execChoice.reactions.size -1, defaultReaction)
+		}
 		// TODO: raise an error if no default exists 
 		
 		val stateReaction = execChoice.createReactionSequence(null)
@@ -86,9 +94,7 @@ class ReactionBuilder {
 		return execChoice.reactSequence
 	}	
 	
-	/**
-	 * TODO : support fork...
-	 */
+
 	def Sequence defineReaction(Synchronization sync) {
 	
 		val execSync = sync.create
@@ -107,6 +113,29 @@ class ReactionBuilder {
 	}	
 	
 
+	def Sequence defineReaction(Exit it) {
+	
+		val execExit = it.create
+		val realName = if (name.empty) 'default' else name 
+				
+		execExit.reactSequence.name = 'react'
+		execExit.reactSequence.comment = 'The reactions of exit ' + realName + '.'
+		
+		// find the transition that relates to the matching exit point
+		val outTransitions = (it.parentRegion.composite as Vertex).outgoingTransitions
+		var exitTrans = outTransitions.filter( t | t.trigger == null && t.exitPointName.equals(realName)).head
+		if (exitTrans == null) exitTrans = outTransitions.filter( t | t.trigger == null && t.exitPointName.equals('default')).head
+		
+		if (exitTrans != null) {
+			val exitReaction = exitTrans.create
+			execExit.reactSequence.steps.add(exitReaction.effect.newCall)
+		}
+		
+		if ( trace.addTraceSteps ) execExit.reactSequence.steps.add(0,it.create.newTraceNodeExecuted)
+		
+		return execExit.reactSequence
+	}	
+
 	def alwaysTrue(Check check) {
 		if (check != null && check.condition instanceof PrimitiveValueExpression) {
 			val pve = (check.condition as PrimitiveValueExpression)
@@ -115,6 +144,12 @@ class ReactionBuilder {
 		
 		return false
 	}
+	
+	
+	def unchecked(Reaction it) {
+		return (check == null || check.condition == null )
+	}
+
 
 	def Sequence defineCycle(RegularState state) {
 	
@@ -137,7 +172,7 @@ class ReactionBuilder {
 		val cycle = sexec.factory.createSequence
 		cycle.name = "react"
 		
-		val localReactions = state.reactions.filter(r | ! r.transition).toList
+		val localReactions = state.reactions.filter(r | ! r.transition ).toList
 		var localSteps = sexec.factory.createSequence
 		localSteps.steps.addAll(localReactions.map(lr | {
 				var ifStep = sexec.factory.createIf
@@ -149,7 +184,7 @@ class ReactionBuilder {
 		if (localSteps.steps.empty) localSteps = null
 				
 				
-		val transitionReactions = state.reactions.filter(r | r.transition).toList
+		val transitionReactions = state.reactions.filter(r | r.transition && ! r.unchecked ).toList
 		val transitionStep = transitionReactions.reverseView.fold(localSteps as Step, [s, reaction | {
 				var ifStep = sexec.factory.createIf
 				ifStep.check = reaction.check.newRef		

+ 30 - 3
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SexecElementMapping.xtend

@@ -45,12 +45,13 @@ import org.yakindu.sct.model.stext.stext.FeatureCall
 import org.yakindu.sct.model.stext.stext.InterfaceScope
 import org.yakindu.sct.model.stext.stext.LocalReaction
 import org.yakindu.sct.model.stext.stext.OperationDefinition
-import org.yakindu.sct.model.stext.stext.ReactionTrigger
 import org.yakindu.sct.model.stext.stext.RegularEventSpec
 import org.yakindu.sct.model.stext.stext.StextFactory
 import org.yakindu.sct.model.stext.stext.TimeEventSpec
 import org.yakindu.sct.model.stext.stext.TimeEventType
 import org.yakindu.sct.model.stext.stext.VariableDefinition
+import org.yakindu.sct.model.sgraph.Exit
+import org.yakindu.sct.model.sgraph.Trigger
  
 
 
@@ -151,6 +152,25 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 	}
 	
 	
+	def ExecutionEntry create r : sexecFactory.createExecutionEntry create(Exit exit){
+		if (exit != null) {
+			val region = exit.eContainer as Region
+			val regionName = region.name.toFirstUpper
+			val stateName = if(region.eContainer instanceof State) {(region.eContainer as State).name.toFirstUpper}
+			val exitName = {if (!exit.name?.empty) exit.name else "default"}
+			r.simpleName = {if (regionName!= null)regionName else ""}+"_"+{if (stateName!= null)stateName else ""}+"_"+exitName
+			r.name = exit.fullyQualifiedName.toString.replaceAll(" ", "")	
+			r.sourceElement = exit	
+			val seq = sexec.factory.createSequence
+			seq.name = "react"
+			seq.comment = "Default react sequence for exit " + exitName
+
+			r.reactSequence = seq
+			exit.outgoingTransitions.forEach(t | r.reactions+=t.create)
+		}
+	}
+	
+	
 	def ExecutionSynchronization create r : sexecFactory.createExecutionSynchronization create(Synchronization sync){
 		if (sync != null) {
 			val n = sync.parentRegion.vertices.filter( typeof ( Synchronization) ).toList.indexOf(sync)
@@ -177,9 +197,16 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 	}
 	
 	
-	def Check create r : sexecFactory.createCheck createCheck(ReactionTrigger tr){
+	def Check create r : sexecFactory.createCheck createCheck(Trigger tr){
 		r.name = tr.reaction.id
 	}
+
+//	def dispatch Check create r : sexecFactory.createCheck createCheck(DefaultTrigger tr){
+//		r.name = tr.reaction.id
+//	}
+//
+//	def dispatch Check createCheck(Trigger tr){
+//	}
 	
 	def Reaction create r : sexecFactory.createReaction create(Transition tr){
 		r.name = tr.id
@@ -266,7 +293,7 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 	def dispatch ExecutionNode mapped(FinalState s) { s.create }
 	def dispatch ExecutionNode mapped(Choice s) { s.create }
 	def dispatch ExecutionNode mapped(Entry s) { s.create }
-//	def dispatch ExecutionNode mapped(Exit s) { s.create }
+	def dispatch ExecutionNode mapped(Exit s) { s.create }
 	def dispatch ExecutionNode mapped(Synchronization s) { s.create }
 
 

+ 12 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SgraphExtensions.xtend

@@ -12,6 +12,7 @@ import java.util.ArrayList
 import org.yakindu.sct.model.sgraph.EntryKind
 import org.yakindu.sct.model.sgraph.Transition
 import org.yakindu.sct.model.stext.stext.EntryPointSpec
+import org.yakindu.sct.model.stext.stext.ExitPointSpec
 
 
 class SgraphExtensions {
@@ -63,6 +64,17 @@ class SgraphExtensions {
 		
 		if (eps == null) 'default' else eps.entrypoint	
 	}
+
+	/**
+	 * Returns the name of the specified entry point or 'default' if it does not exist
+	 */
+	def String exitPointName(Transition t) {
+		val eps = t.properties.filter(typeof(ExitPointSpec)).head
+		
+		if (eps == null) 'default' else eps.exitpoint	
+	}
+	
+
 	
 	/**
 	 * Retrieves the target from an entry.

+ 2 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.xtend

@@ -52,12 +52,12 @@ class StateVectorBuilder {
 	}
 
 	/** calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart */
-	def int defineStateVectors(Statechart sc, int offset) {
+	def dispatch int defineStateVectors(Statechart sc, int offset) {
 		sc.regions.fold(0, [o, r | r.maxOrthogonality + o])
 	}
 
 	/** calculates the maximum orthogonality (maximum number of possible active leaf states) of a region */
-	def int defineStateVectors(Region r, int offset) {
+	def dispatch int defineStateVectors(Region r, int offset) {
 		val maxOrthogonality = r.vertices.fold(0, [s, v | {
 			val mo = v.defineStateVectors(offset)
 			if (mo > s) mo else s }])

+ 27 - 19
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.xtend

@@ -22,6 +22,7 @@ import org.yakindu.sct.model.stext.stext.ReactionTrigger
 import org.yakindu.sct.model.stext.stext.StextFactory
 import org.yakindu.sct.model.stext.stext.TimeEventSpec
 import org.yakindu.sct.model.sgraph.Synchronization
+import org.yakindu.sct.model.sgraph.Exit
 
  
  
@@ -67,22 +68,6 @@ class StatechartExtensions {
 	}
 	
 	
-	/** 
-	 * Provides a list of all TimeEventSpecs that are defined in the context of 'statechart'.
-	 */
-	def List<TimeEventSpec> timeEventSpecs(Statechart state) { 
-		// TODO: also query local reactions
-		var tesList = new ArrayList<TimeEventSpec>()
-
-		state.localReactions.fold(tesList, 
-			[s, r | {
-				EcoreUtil2::eAllContentsAsList(r).filter(typeof (TimeEventSpec)).forEach(tes | s.add(tes))
-				s
-			}]
-		)
-				
-		return tesList
-	}
 	/** 
 	 * Provides a list of all TimeEventSpecs that are defined in the context of 'state'.
 	 */
@@ -124,6 +109,23 @@ class StatechartExtensions {
 		return tesList
 	}
 
+//	/** 
+//	 * Provides a list of all TimeEventSpecs that are defined in the context of 'statechart'.
+//	 */
+//	def List<TimeEventSpec> timeEventSpecs(Statechart state) { 
+//		// TODO: also query local reactions
+//		var tesList = new ArrayList<TimeEventSpec>()
+//
+//		state.localReactions.fold(tesList, 
+//			[s, r | {
+//				EcoreUtil2::eAllContentsAsList(r).filter(typeof (TimeEventSpec)).forEach(tes | s.add(tes))
+//				s
+//			}]
+//		)
+//				
+//		return tesList
+//	}
+
 	def dispatch ReactiveElement reactiveElement(Reaction r) {
 		r.scope.reactiveElement		
 	}
@@ -134,13 +136,15 @@ class StatechartExtensions {
 	}
 	
 	
+	def dispatch ReactiveElement reactiveElement(Scope s) {
+		if (s.eContainer instanceof ReactiveElement) s.eContainer as ReactiveElement
+	}	
+
+
 	def Scope scope(Reaction r) {
 		if (r.eContainer instanceof Scope) r.eContainer as Scope
 	} 
 
-	def ReactiveElement reactiveElement(Scope s) {
-		if (s.eContainer instanceof ReactiveElement) s.eContainer as ReactiveElement
-	}	
 	
 	def List<RegularState> allRegularStates(Statechart sc) {
 		var content = EcoreUtil2::eAllContentsAsList(sc)
@@ -169,6 +173,10 @@ class StatechartExtensions {
 		return sc.eAllContents.filter( typeof(Entry)).toIterable
 	}
 	
+	def Iterable<Exit> allExits(Statechart sc) {
+		return sc.eAllContents.filter( typeof(Exit)).toIterable
+	}
+	
 	def Iterable<Synchronization> allSynchronizations(Statechart sc) {
 		return sc.eAllContents.filter( typeof(Synchronization)).toIterable
 	}

+ 3 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StructureMapping.xtend

@@ -38,7 +38,7 @@ class StructureMapping {
 	 * This includes creating the scopes and adding all relevant declarations. Empty scopes wont be mapped.
 	 */
 	def ExecutionFlow mapScopes(Statechart sc, ExecutionFlow flow) {
-		flow.scopes.addAll(sc.scopes.map(scope | scope.map))
+		flow.scopes.addAll(sc.scopes.map(scope | scope.mapScope))
 		flow
 	}
 	
@@ -46,7 +46,7 @@ class StructureMapping {
 	/**
 	 *  
 	 */
-	def Scope map(Scope scope) {
+	def Scope mapScope(Scope scope) {
 		val _scope = scope.createScope
 		_scope.declarations.addAll(scope.declarations.map(decl | decl.map).filter(e | e != null))
 		return _scope
@@ -130,6 +130,7 @@ class StructureMapping {
 	def ExecutionFlow mapPseudoStates(Statechart statechart, ExecutionFlow r){
 		r.nodes.addAll( statechart.allChoices.map( choice | choice.create ) );
 		r.nodes.addAll( statechart.allEntries.map( entry | entry.create ) );
+		r.nodes.addAll( statechart.allExits.map( exit | exit.create ) );
 		r.nodes.addAll( statechart.allSynchronizations.map( sync | sync.create ) );
 		return r
 	}

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

@@ -22,6 +22,7 @@ import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createExit
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope;
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createLocalReaction;
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionEffect;
+import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionTrigger;
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createRegularEventSpec;
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createValue;
 import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableAssignment;
@@ -209,7 +210,11 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		LocalReaction entryAction = _createEntryAction(s1);
 		_createVariableAssignment(v1, AssignmentOperator.ASSIGN,
 				_createValue(42), (ReactionEffect) entryAction.getEffect());
-
+		
+		Entry e = _createEntry(EntryKind.INITIAL, null, r);
+		Transition t = _createTransition(e, s1);
+		
+		
 		ExecutionFlow flow = sequencer.transform(sc);
 
 		ExecutionState _s1 = flow.getStates().get(0);
@@ -255,8 +260,14 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 						_createTransition(e, s3);
 					}
 				}
+				
+				Entry e = _createEntry(EntryKind.INITIAL, null, r);
+				_createTransition(e, s1);
+
 			}
 		}
+		
+
 
 		ExecutionFlow flow = sequencer.transform(sc);
 
@@ -269,6 +280,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 		ExecutionState _s3 = flow.getStates().get(2);
 		assertEquals("s3", _s3.getSimpleName());
 
+
 		assertNotNull(_s1.getEntryAction());
 		assertNotNull(_s1.getEnterSequences().get(0));
 		assertEquals(3, _s1.getEnterSequences().get(0).getSteps().size());
@@ -1041,10 +1053,12 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 
 			Transition t_s4_s5 = _createTransition(findState(sc, "s4"),
 					findState(sc, "s5"));
+			_createReactionTrigger(t_s4_s5);
 			_createRegularEventSpec(e1, (ReactionTrigger) t_s4_s5.getTrigger());
 
 			Transition t_s3_s6 = _createTransition(findState(sc, "s3"),
 					findState(sc, "s6"));
+			_createReactionTrigger(t_s3_s6);
 			_createRegularEventSpec(e1, (ReactionTrigger) t_s3_s6.getTrigger());
 
 		}
@@ -1131,6 +1145,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 
 								Transition t_s4_fs = _createTransition(
 										findState(sc, "s4"), fs);
+								_createReactionTrigger(t_s4_fs);
 								_createRegularEventSpec(e1,
 										(ReactionTrigger) t_s4_fs.getTrigger());
 
@@ -1149,6 +1164,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 
 			Transition t_s3_s6 = _createTransition(findState(sc, "s3"),
 					findState(sc, "s6"));
+			_createReactionTrigger(t_s3_s6);
 			_createRegularEventSpec(e1, (ReactionTrigger) t_s3_s6.getTrigger());
 
 		}
@@ -1211,6 +1227,7 @@ public class ModelSequencerStateTest extends ModelSequencerTest {
 				FinalState fs = _createFinalState(r);
 
 				Transition t_s1_fs = _createTransition(s1, fs);
+				_createReactionTrigger(t_s1_fs);
 				_createRegularEventSpec(e1,
 						(ReactionTrigger) t_s1_fs.getTrigger());
 

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

@@ -9,15 +9,7 @@ import static org.yakindu.sct.model.sgraph.test.util.SgraphTestFactory._createRe
 import static org.yakindu.sct.model.sgraph.test.util.SgraphTestFactory._createState;
 import static org.yakindu.sct.model.sgraph.test.util.SgraphTestFactory._createStatechart;
 import static org.yakindu.sct.model.sgraph.test.util.SgraphTestFactory._createTransition;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createEventDefinition;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createInternalScope;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createOperation;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createOperationCall;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionEffect;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionTrigger;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createRegularEventSpec;
-import static org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition;
+import static org.yakindu.sct.model.stext.test.util.StextTestFactory.*;
 
 import org.junit.Test;
 import org.yakindu.sct.model.sexec.Call;
@@ -50,7 +42,7 @@ public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
 	public void testScopeName() {
 		InterfaceScope scope = _createInterfaceScope("abc", null);
 		assertEquals(scope.getName(),
-				((InterfaceScope) structureMapping.map(scope)).getName());
+				((InterfaceScope) structureMapping.mapScope(scope)).getName());
 	}
 
 	/**
@@ -59,7 +51,7 @@ public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
 	@Test
 	public void testMapEmptyInternalScope() {
 		InternalScope scope = _createInternalScope(null);
-		Scope _scope = structureMapping.map(scope);
+		Scope _scope = structureMapping.mapScope(scope);
 
 		assertTrue(_scope instanceof InternalScope);
 	}
@@ -73,7 +65,7 @@ public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
 		VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER,
 				scope);
 
-		Scope _scope = structureMapping.map(scope);
+		Scope _scope = structureMapping.mapScope(scope);
 
 		assertTrue(_scope instanceof InterfaceScope);
 		assertEquals(3, _scope.getDeclarations().size());
@@ -137,6 +129,8 @@ public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
 		State s1 = _createState("S1", r);
 		State s2 = _createState("S2", r);
 		Transition t = _createTransition(s1, s2);
+		ReactionTrigger tr = _createReactionTrigger(t);
+		tr.setGuardExpression(_createValue(true));
 		ReactionEffect tr1 = _createReactionEffect(t);
 		FeatureCall _operationCall = _createOperationCall(_operation);
 		tr1.getActions().add(_operationCall);