Search in sources :

Example 21 with Reaction

use of org.yakindu.sct.model.sexec.Reaction in project statecharts by Yakindu.

the class ModelSequencerHistoryTest method testFlowName.

@SuppressWarnings("unused")
@Test
public void testFlowName() {
    Statechart sc = _createStatechart("sc");
    {
        InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
        VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
        Region r = _createRegion("r", sc);
        {
            Entry r_entry = _createEntry(EntryKind.INITIAL, null, r);
            State s1 = _createState("s1", r);
            State s2 = _createState("s2", r);
            {
                Region r2 = _createRegion("r2", s2);
                {
                    Entry r2_entry1 = _createEntry(EntryKind.SHALLOW_HISTORY, null, r2);
                    Entry r2_entry2 = _createEntry(EntryKind.INITIAL, "Unused_Backup", r2);
                    State s3 = _createState("s3", r2);
                    State s4 = _createState("s4", r2);
                    _createTransition(r2_entry1, s3);
                    _createTransition(r2_entry2, s4);
                    _createTransition(s1, r2_entry1);
                }
            }
            _createTransition(s1, s2);
            Transition _t = _createTransition(s1, s2);
            _createTransition(r_entry, s1);
        }
    }
    ExecutionFlow flow = sequencer.transform(sc);
    ExecutionState _s1 = flow.getStates().get(0);
    assertEquals("sc.r.s1", _s1.getName());
    ExecutionState _s2 = flow.getStates().get(1);
    assertEquals("sc.r.s2", _s2.getName());
    ExecutionState _s3 = flow.getStates().get(2);
    assertEquals("sc.r.s2.r2.s3", _s3.getName());
    ExecutionState _s4 = flow.getStates().get(3);
    assertEquals("sc.r.s2.r2.s4", _s4.getName());
    ExecutionNode r2_history_entry = flow.getNodes().get(1);
    EList<Reaction> _t1 = _s1.getReactions();
    Sequence reactSequence_history = flow.getNodes().get(1).getReactSequence();
    HistoryEntry historyStep = (HistoryEntry) reactSequence_history.getSteps().get(0);
    assertFalse(historyStep.isDeep());
    assertCall(firstStep(firstStep(historyStep.getInitialStep())), _s3.getEnterSequences().get(0));
    Reaction reaction_history = _t1.get(0);
    assertCall(assertedSequence(reaction_history.getEffect()), 1, reactSequence_history);
    Sequence reactSequence_initial = flow.getNodes().get(2).getReactSequence();
    assertCall(((Sequence) firstStep(firstStep(reactSequence_initial))), 0, _s4.getEnterSequences().get(0));
    Reaction reaction = _t1.get(1);
    assertCall(assertedSequence(reaction.getEffect()), 1, _s2.getEnterSequences().get(0));
    assertCall(_s3.getSuperScope().getEnterSequences().get(0), 0, r2_history_entry.getReactSequence());
    Step saveStep = _s3.getEnterSequences().get(0).getSteps().get(1);
    assertTrue(saveStep.eClass().toString(), saveStep instanceof SaveHistory);
    saveStep = _s4.getEnterSequences().get(0).getSteps().get(1);
    assertTrue(saveStep.eClass().toString(), saveStep instanceof SaveHistory);
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) SaveHistory(org.yakindu.sct.model.sexec.SaveHistory) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) ExecutionNode(org.yakindu.sct.model.sexec.ExecutionNode) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) StextTestFactory._createInterfaceScope(org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope) Sequence(org.yakindu.sct.model.sexec.Sequence) Step(org.yakindu.sct.model.sexec.Step) Reaction(org.yakindu.sct.model.sexec.Reaction) Entry(org.yakindu.sct.model.sgraph.Entry) HistoryEntry(org.yakindu.sct.model.sexec.HistoryEntry) SGraphTestFactory._createEntry(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry) SGraphTestFactory._createState(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState) ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) State(org.yakindu.sct.model.sgraph.State) Transition(org.yakindu.sct.model.sgraph.Transition) SGraphTestFactory._createTransition(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createTransition) Statechart(org.yakindu.sct.model.sgraph.Statechart) SGraphTestFactory._createStatechart(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart) Region(org.yakindu.sct.model.sgraph.Region) SGraphTestFactory._createRegion(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion) ExecutionRegion(org.yakindu.sct.model.sexec.ExecutionRegion) HistoryEntry(org.yakindu.sct.model.sexec.HistoryEntry) Test(org.junit.Test)

Example 22 with Reaction

use of org.yakindu.sct.model.sexec.Reaction in project statecharts by Yakindu.

the class ModelSequencerStateTest method testStateReaction_WithTransitionAction.

/**
 * The transition action must be part of the reaction effect sequence
 */
@Test
public void testStateReaction_WithTransitionAction() {
    SimpleFlatTSC tsc = new SimpleFlatTSC();
    VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, tsc.s_scope);
    ReactionEffect effect = _createReactionEffect(tsc.t1);
    AssignmentExpression assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(42), effect);
    ExecutionFlow flow = sequencer.transform(tsc.sc);
    // test state with one outgoing transition
    ExecutionState s1 = flow.getStates().get(0);
    ExecutionState s2 = flow.getStates().get(1);
    assertEquals(tsc.s1.getName(), s1.getSimpleName());
    assertEquals(tsc.s2.getName(), s2.getSimpleName());
    assertEquals(1, s1.getReactions().size());
    Reaction reaction = s1.getReactions().get(0);
    assertNotNull(reaction.getCheck());
    assertNotNull(reaction.getEffect());
    Sequence seq = (Sequence) reaction.getEffect();
    assertCall(seq, 0, s1.getExitSequence());
    assertClass(Sequence.class, seq.getSteps().get(1));
    Execution _exec = (Execution) ((Sequence) seq.getSteps().get(1)).getSteps().get(0);
    AssignmentExpression _assign = (AssignmentExpression) _exec.getStatement();
    assertNotSame(_assign, assign);
    assertNotSame(_assign.getVarRef(), assign.getVarRef());
    assertNotSame(_assign.getVarRef(), v1);
    assertCall(seq, 2, s2.getEnterSequences().get(0));
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) SimpleFlatTSC(org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.SimpleFlatTSC) Execution(org.yakindu.sct.model.sexec.Execution) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) AssignmentExpression(org.yakindu.base.expressions.expressions.AssignmentExpression) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) StextTestFactory._createReactionEffect(org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionEffect) Sequence(org.yakindu.sct.model.sexec.Sequence) LocalReaction(org.yakindu.sct.model.stext.stext.LocalReaction) StextTestFactory._createLocalReaction(org.yakindu.sct.model.stext.test.util.StextTestFactory._createLocalReaction) Reaction(org.yakindu.sct.model.sexec.Reaction) Test(org.junit.Test)

Example 23 with Reaction

use of org.yakindu.sct.model.sexec.Reaction in project statecharts by Yakindu.

the class ModelSequencerOrthogonalityTest method testSiblingRegionExitOnComposite.

/**
 * For a transition all composite state with orthogonal siblings on the exit
 * path must invoke the exit sequence of the orthogonal sibling regions.
 */
@Test
public void testSiblingRegionExitOnComposite() {
    Statechart sc = _createStatechart("sc");
    {
        InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
        VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
        Region r = _createRegion("r", sc);
        {
            Entry r_entry = _createEntry(EntryKind.INITIAL, null, r);
            State s1 = _createState("s1", r);
            {
                Region r2 = _createRegion("r2", s1);
                {
                    Entry r2_entry = _createEntry(EntryKind.INITIAL, null, r2);
                    State s2 = _createState("s2", r2);
                    _createTransition(r2_entry, s2);
                }
                Region r3 = _createRegion("r3", s1);
                {
                    Entry r3_entry = _createEntry(EntryKind.INITIAL, null, r3);
                    State s3 = _createState("s3", r3);
                    {
                        Region r3a = _createRegion("r3a", s3);
                        {
                            Entry r3a_entry = _createEntry(EntryKind.INITIAL, null, r3a);
                            State s3a = _createState("s3a", r3a);
                            _createTransition(r3a_entry, s3a);
                        }
                        Region r3b = _createRegion("r3b", s3);
                        {
                            Entry r3b_entry = _createEntry(EntryKind.INITIAL, null, r3b);
                            State s3b = _createState("s3b", r3b);
                            _createTransition(r3b_entry, s3b);
                        }
                        Region r3c = _createRegion("r3c", s3);
                        {
                            Entry r3c_entry = _createEntry(EntryKind.INITIAL, null, r3c);
                            State s3c = _createState("s3c", r3c);
                            _createTransition(r3c_entry, s3c);
                        }
                    }
                    _createEntryAssignment(v1, s3, 42);
                    _createTransition(r3_entry, s3);
                }
                Region r4 = _createRegion("r4", s1);
                {
                    Entry r4_entry = _createEntry(EntryKind.INITIAL, null, r4);
                    State s4 = _createState("s4", r4);
                    _createTransition(r4_entry, s4);
                }
            }
            _createTransition(r_entry, s1);
            State s5 = _createState("s5", r);
            _createTransition(findState(sc, "s3b"), s5);
        }
    }
    ExecutionFlow flow = sequencer.transform(sc);
    ExecutionState _s2 = flow.getStates().get(1);
    assertEquals("sc.r.s1.r2.s2", _s2.getName());
    ExecutionState _s3 = flow.getStates().get(2);
    assertEquals("sc.r.s1.r3.s3", _s3.getName());
    ExecutionState _s3a = flow.getStates().get(3);
    assertEquals("sc.r.s1.r3.s3.r3a.s3a", _s3a.getName());
    ExecutionState _s3b = flow.getStates().get(4);
    assertEquals("sc.r.s1.r3.s3.r3b.s3b", _s3b.getName());
    ExecutionState _s3c = flow.getStates().get(5);
    assertEquals("sc.r.s1.r3.s3.r3c.s3c", _s3c.getName());
    ExecutionState _s4 = flow.getStates().get(6);
    assertEquals("sc.r.s1.r4.s4", _s4.getName());
    ExecutionState _s5 = flow.getStates().get(7);
    assertEquals("sc.r.s5", _s5.getName());
    Reaction _t = _s3b.getReactions().get(0);
    assertTrue(_t.isTransition());
    Sequence _effect = (Sequence) _t.getEffect();
    assertEquals(2, _effect.getSteps().size());
    assertedOrder(_effect, Lists.newArrayList(_s2, _s3a, _s3b, _s3c, _s4), Lists.newArrayList(new StepLeaf(_s2.getExitSequence()), new StepLeaf(_s3a.getExitSequence()), new StepLeaf(_s3b.getExitSequence()), new StepLeaf(_s3c.getExitSequence()), new StepLeaf(_s4.getExitSequence())));
    // Step _switch = _effect.getSteps().get(0);
    // assertStateSwitch(_switch, _s2);
    // assertCall(assertedSequence(assertedStateCase(_switch,
    // _s2).getStep()),
    // 0, _s2.getExitSequence());
    // 
    // _switch = _effect.getSteps().get(1);
    // assertStateSwitch(_switch, _s3a);
    // assertCall(
    // assertedSequence(assertedStateCase(_switch, _s3a).getStep()),
    // 0, _s3a.getExitSequence());
    // 
    // assertCall(_effect, 2, _s3b.getExitSequence());
    // 
    // _switch = _effect.getSteps().get(3);
    // assertStateSwitch(_switch, _s3c);
    // assertCall(
    // assertedSequence(assertedStateCase(_switch, _s3c).getStep()),
    // 0, _s3c.getExitSequence());
    // 
    // _switch = _effect.getSteps().get(4);
    // assertStateSwitch(_switch, _s4);
    // assertCall(assertedSequence(assertedStateCase(_switch,
    // _s4).getStep()),
    // 0, _s4.getExitSequence());
    assertCall(_effect, 1, _s5.getEnterSequences().get(0));
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) Entry(org.yakindu.sct.model.sgraph.Entry) SGraphTestFactory._createEntry(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) SGraphTestFactory._createState(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState) ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) EnterState(org.yakindu.sct.model.sexec.EnterState) SCTTestUtil.findState(org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState) State(org.yakindu.sct.model.sgraph.State) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) Statechart(org.yakindu.sct.model.sgraph.Statechart) SGraphTestFactory._createStatechart(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) StextTestFactory._createInterfaceScope(org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope) Region(org.yakindu.sct.model.sgraph.Region) SGraphTestFactory._createRegion(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion) Sequence(org.yakindu.sct.model.sexec.Sequence) Reaction(org.yakindu.sct.model.sexec.Reaction) Test(org.junit.Test)

Example 24 with Reaction

use of org.yakindu.sct.model.sexec.Reaction in project statecharts by Yakindu.

the class ModelSequencerOrthogonalityTest method testSourceSiblingEnterExclusion.

/**
 * A transition from a state with orthogonal siblings that dives into a non
 * orthogonal sibling state must exclude the source state sibling entry
 * behavior.
 */
@SuppressWarnings("unused")
@Test
public void testSourceSiblingEnterExclusion() {
    Statechart sc = _createStatechart("sc");
    {
        InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
        VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
        Region r = _createRegion("r", sc);
        {
            Entry r_entry = _createEntry(EntryKind.INITIAL, null, r);
            State s1 = _createState("s1", r);
            {
                Region r2 = _createRegion("r2", s1);
                {
                    Entry r2_entry = _createEntry(EntryKind.INITIAL, null, r2);
                    State s2 = _createState("s2", r2);
                    _createTransition(r2_entry, s2);
                }
                Region r3 = _createRegion("r3", s1);
                {
                    Entry r3_entry = _createEntry(EntryKind.INITIAL, null, r3);
                    State s3 = _createState("s3", r3);
                    {
                        Region r3a = _createRegion("r3a", s3);
                        {
                            Entry r3a_entry = _createEntry(EntryKind.INITIAL, null, r3a);
                            State s3a = _createState("s3a", r3a);
                            _createTransition(r3a_entry, s3a);
                        }
                        Region r3b = _createRegion("r3b", s3);
                        {
                            Entry r3b_entry = _createEntry(EntryKind.INITIAL, null, r3b);
                            State s3b = _createState("s3b", r3b);
                            State s3b2 = _createState("s3b2", r3b);
                            _createTransition(r3b_entry, s3b);
                        }
                        Region r3c = _createRegion("r3c", s3);
                        {
                            Entry r3c_entry = _createEntry(EntryKind.INITIAL, null, r3c);
                            State s3c = _createState("s3c", r3c);
                            _createTransition(r3c_entry, s3c);
                        }
                    }
                    State s3z = _createState("s3z", r3);
                    _createEntryAssignment(v1, s3, 42);
                    _createTransition(r3_entry, s3);
                }
                Region r4 = _createRegion("r4", s1);
                {
                    Entry r4_entry = _createEntry(EntryKind.INITIAL, null, r4);
                    State s4 = _createState("s4", r4);
                    _createTransition(r4_entry, s4);
                }
            }
            _createTransition(r_entry, s1);
            State s5 = _createState("s5", r);
            _createTransition(findState(sc, "s3z"), findState(sc, "s3b2"));
        }
    }
    ExecutionFlow flow = sequencer.transform(sc);
    ExecutionState _s2 = flow.getStates().get(1);
    assertEquals("sc.r.s1.r2.s2", _s2.getName());
    ExecutionState _s3 = flow.getStates().get(2);
    assertEquals("sc.r.s1.r3.s3", _s3.getName());
    ExecutionState _s3a = flow.getStates().get(3);
    assertEquals("sc.r.s1.r3.s3.r3a.s3a", _s3a.getName());
    ExecutionState _s3b = flow.getStates().get(4);
    assertEquals("sc.r.s1.r3.s3.r3b.s3b", _s3b.getName());
    ExecutionState _s3b2 = flow.getStates().get(5);
    assertEquals("sc.r.s1.r3.s3.r3b.s3b2", _s3b2.getName());
    ExecutionState _s3c = flow.getStates().get(6);
    assertEquals("sc.r.s1.r3.s3.r3c.s3c", _s3c.getName());
    ExecutionState _s3z = flow.getStates().get(7);
    assertEquals("sc.r.s1.r3.s3z", _s3z.getName());
    ExecutionState _s4 = flow.getStates().get(8);
    assertEquals("sc.r.s1.r4.s4", _s4.getName());
    ExecutionState _s5 = flow.getStates().get(9);
    assertEquals("sc.r.s5", _s5.getName());
    Reaction _t = _s3z.getReactions().get(0);
    assertTrue(_t.isTransition());
    Sequence _effect = (Sequence) _t.getEffect();
    assertEquals("wrong sequence: " + stepListAsString(_effect), 5, _effect.getSteps().size());
    assertCall(_effect, 0, _s3z.getExitSequence());
    assertCall(_effect, 1, _s3.getEntryAction());
    assertCall(_effect, 2, _s3a.getSuperScope().getEnterSequences().get(0));
    Sequence r3a_entryReactSequence = flow.getNodes().get(3).getReactSequence();
    assertCall(_s3a.getSuperScope().getEnterSequences().get(0), 0, r3a_entryReactSequence);
    assertCall(((Sequence) firstStep(firstStep(r3a_entryReactSequence))), 0, _s3a.getEnterSequences().get(0));
    assertCall(_effect, 3, _s3b2.getEnterSequences().get(0));
    assertCall(_effect, 4, _s3c.getSuperScope().getEnterSequences().get(0));
    Sequence r3c_entryReactSequence = flow.getNodes().get(5).getReactSequence();
    assertCall(_s3c.getSuperScope().getEnterSequences().get(0), 0, r3c_entryReactSequence);
    assertCall(((Sequence) firstStep(firstStep(r3c_entryReactSequence))), 0, _s3c.getEnterSequences().get(0));
    assertTrue(_s3c.getEnterSequences().get(0).getSteps().get(0).getClass().getSimpleName(), _s3c.getEnterSequences().get(0).getSteps().get(0) instanceof EnterState);
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) Entry(org.yakindu.sct.model.sgraph.Entry) SGraphTestFactory._createEntry(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) SGraphTestFactory._createState(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState) ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) EnterState(org.yakindu.sct.model.sexec.EnterState) SCTTestUtil.findState(org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState) State(org.yakindu.sct.model.sgraph.State) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) EnterState(org.yakindu.sct.model.sexec.EnterState) Statechart(org.yakindu.sct.model.sgraph.Statechart) SGraphTestFactory._createStatechart(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) StextTestFactory._createInterfaceScope(org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope) Region(org.yakindu.sct.model.sgraph.Region) SGraphTestFactory._createRegion(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion) Sequence(org.yakindu.sct.model.sexec.Sequence) Reaction(org.yakindu.sct.model.sexec.Reaction) Test(org.junit.Test)

Example 25 with Reaction

use of org.yakindu.sct.model.sexec.Reaction in project statecharts by Yakindu.

the class ModelSequencerOrthogonalityTest method testSiblingStateTransition.

/**
 * Local transition within a region with orthogonal siblings does not have
 * to invoke sibling region entries or exists.
 */
@SuppressWarnings("unused")
@Test
public void testSiblingStateTransition() {
    Statechart sc = _createStatechart("sc");
    {
        InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
        VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
        Region r = _createRegion("r", sc);
        {
            Entry r_entry = _createEntry(EntryKind.INITIAL, null, r);
            State s1 = _createState("s1", r);
            {
                Region r2 = _createRegion("r2", s1);
                {
                    Entry r2_entry = _createEntry(EntryKind.INITIAL, null, r2);
                    State s2 = _createState("s2", r2);
                    _createTransition(r2_entry, s2);
                }
                Region r3 = _createRegion("r3", s1);
                {
                    Entry r3_entry = _createEntry(EntryKind.INITIAL, null, r3);
                    State s3 = _createState("s3", r3);
                    {
                        Region r3a = _createRegion("r3a", s3);
                        {
                            Entry r3a_entry = _createEntry(EntryKind.INITIAL, null, r3a);
                            State s3a = _createState("s3a", r3a);
                            _createTransition(r3a_entry, s3a);
                        }
                        Region r3b = _createRegion("r3b", s3);
                        {
                            Entry r3b_entry = _createEntry(EntryKind.INITIAL, null, r3b);
                            State s3b = _createState("s3b", r3b);
                            State s3b2 = _createState("s3b2", r3b);
                            _createTransition(r3b_entry, s3b);
                        }
                        Region r3c = _createRegion("r3c", s3);
                        {
                            Entry r3c_entry = _createEntry(EntryKind.INITIAL, null, r3c);
                            State s3c = _createState("s3c", r3c);
                            _createTransition(r3c_entry, s3c);
                        }
                    }
                    _createEntryAssignment(v1, s3, 42);
                    _createTransition(r3_entry, s3);
                }
                Region r4 = _createRegion("r4", s1);
                {
                    Entry r4_entry = _createEntry(EntryKind.INITIAL, null, r4);
                    State s4 = _createState("s4", r4);
                    _createTransition(r4_entry, s4);
                }
            }
            _createTransition(r_entry, s1);
            State s5 = _createState("s5", r);
            _createTransition(findState(sc, "s3b"), findState(sc, "s3b2"));
        }
    }
    ExecutionFlow flow = sequencer.transform(sc);
    ExecutionState _s2 = flow.getStates().get(1);
    assertEquals("sc.r.s1.r2.s2", _s2.getName());
    ExecutionState _s3 = flow.getStates().get(2);
    assertEquals("sc.r.s1.r3.s3", _s3.getName());
    ExecutionState _s3a = flow.getStates().get(3);
    assertEquals("sc.r.s1.r3.s3.r3a.s3a", _s3a.getName());
    ExecutionState _s3b = flow.getStates().get(4);
    assertEquals("sc.r.s1.r3.s3.r3b.s3b", _s3b.getName());
    ExecutionState _s3b2 = flow.getStates().get(5);
    assertEquals("sc.r.s1.r3.s3.r3b.s3b2", _s3b2.getName());
    ExecutionState _s3c = flow.getStates().get(6);
    assertEquals("sc.r.s1.r3.s3.r3c.s3c", _s3c.getName());
    ExecutionState _s4 = flow.getStates().get(7);
    assertEquals("sc.r.s1.r4.s4", _s4.getName());
    ExecutionState _s5 = flow.getStates().get(8);
    assertEquals("sc.r.s5", _s5.getName());
    Reaction _t = _s3b.getReactions().get(0);
    assertTrue(_t.isTransition());
    Sequence _effect = (Sequence) _t.getEffect();
    assertEquals(2, _effect.getSteps().size());
    assertCall(_effect, 0, _s3b.getExitSequence());
    assertCall(_effect, 1, _s3b2.getEnterSequences().get(0));
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) Entry(org.yakindu.sct.model.sgraph.Entry) SGraphTestFactory._createEntry(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) SGraphTestFactory._createState(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState) ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) EnterState(org.yakindu.sct.model.sexec.EnterState) SCTTestUtil.findState(org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState) State(org.yakindu.sct.model.sgraph.State) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) Statechart(org.yakindu.sct.model.sgraph.Statechart) SGraphTestFactory._createStatechart(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) StextTestFactory._createInterfaceScope(org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope) Region(org.yakindu.sct.model.sgraph.Region) SGraphTestFactory._createRegion(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion) Sequence(org.yakindu.sct.model.sexec.Sequence) Reaction(org.yakindu.sct.model.sexec.Reaction) Test(org.junit.Test)

Aggregations

Reaction (org.yakindu.sct.model.sexec.Reaction)31 Test (org.junit.Test)29 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)26 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)26 Statechart (org.yakindu.sct.model.sgraph.Statechart)25 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)25 Sequence (org.yakindu.sct.model.sexec.Sequence)24 Region (org.yakindu.sct.model.sgraph.Region)22 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)22 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)22 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)22 State (org.yakindu.sct.model.sgraph.State)19 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)19 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)18 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)17 SCTTestUtil.findState (org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState)15 Entry (org.yakindu.sct.model.sgraph.Entry)10 SGraphTestFactory._createEntry (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry)10 LocalReaction (org.yakindu.sct.model.stext.stext.LocalReaction)9 StextTestFactory._createLocalReaction (org.yakindu.sct.model.stext.test.util.StextTestFactory._createLocalReaction)9