Search in sources :

Example 36 with State

use of org.yakindu.sct.model.sgraph.State in project statecharts by Yakindu.

the class SGraphJavaValidationTest method orthogonalSynchronizedTransition_Source.

@Test
public void orthogonalSynchronizedTransition_Source() {
    statechart = loadStatechart("NotOrthogonalRegion03.sct");
    State stateC = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "C");
    Synchronization sync = (Synchronization) stateC.getOutgoingTransitions().get(0).getTarget();
    assertFalse(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 2);
    assertError(diagnostics, ISSUE_SYNCHRONIZATION_SOURCE_TARGET_STATES_PARENT_REGION);
}
Also used : HashMap(java.util.HashMap) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Synchronization(org.yakindu.sct.model.sgraph.Synchronization) Test(org.junit.Test)

Example 37 with State

use of org.yakindu.sct.model.sgraph.State in project statecharts by Yakindu.

the class SGraphJavaValidationTest method orthogonalTransition_BetweenTopLevelRegions.

@Test
public void orthogonalTransition_BetweenTopLevelRegions() {
    statechart = loadStatechart("OrthogonalTransition.sct");
    State state = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "A");
    Transition trans = state.getOutgoingTransitions().get(0);
    assertFalse(validator.validate(trans, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 1);
    assertError(diagnostics, ISSUE_TRANSITION_ORTHOGONAL);
}
Also used : HashMap(java.util.HashMap) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Transition(org.yakindu.sct.model.sgraph.Transition) Test(org.junit.Test)

Example 38 with State

use of org.yakindu.sct.model.sgraph.State in project statecharts by Yakindu.

the class SGraphJavaValidationTest method validTransitionToInnerChoice.

@Test
public void validTransitionToInnerChoice() {
    statechart = AbstractTestModelsUtil.loadStatechart(VALIDATION_TESTMODEL_DIR + "ValidTransitionToInnerChoice.sct");
    Iterator<EObject> iter = statechart.eAllContents();
    while (iter.hasNext()) {
        EObject element = iter.next();
        if (element instanceof State) {
            validator.validate(element, diagnostics, new HashMap<Object, Object>());
        }
    }
    assertIssueCount(diagnostics, 0);
}
Also used : FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) Test(org.junit.Test)

Example 39 with State

use of org.yakindu.sct.model.sgraph.State in project statecharts by Yakindu.

the class SGraphJavaValidationTest method orthogonalSourceStates_StateInTopLevelRegion.

@Test
public void orthogonalSourceStates_StateInTopLevelRegion() {
    statechart = loadStatechart("NotOrthogonalRegion02.sct");
    State b = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "AA");
    Synchronization sync = (Synchronization) b.getOutgoingTransitions().get(0).getTarget();
    assertFalse(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 1);
    assertError(diagnostics, ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_ORTHOGONAL);
}
Also used : HashMap(java.util.HashMap) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Synchronization(org.yakindu.sct.model.sgraph.Synchronization) Test(org.junit.Test)

Example 40 with State

use of org.yakindu.sct.model.sgraph.State in project statecharts by Yakindu.

the class SGraphJavaValidationTest method orthogonalSynchronizedTransition.

@Test
public void orthogonalSynchronizedTransition() {
    statechart = loadStatechart("NotOrthogonalRegion03.sct");
    State stateB = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "B");
    Synchronization sync = (Synchronization) stateB.getOutgoingTransitions().get(0).getTarget();
    assertFalse(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 2);
    assertError(diagnostics, ISSUE_SYNCHRONIZATION_SOURCE_TARGET_STATES_PARENT_REGION);
}
Also used : HashMap(java.util.HashMap) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Synchronization(org.yakindu.sct.model.sgraph.Synchronization) Test(org.junit.Test)

Aggregations

State (org.yakindu.sct.model.sgraph.State)106 Test (org.junit.Test)77 Region (org.yakindu.sct.model.sgraph.Region)63 Statechart (org.yakindu.sct.model.sgraph.Statechart)59 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)51 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)51 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)51 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)50 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)46 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)46 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)46 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)46 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)39 Sequence (org.yakindu.sct.model.sexec.Sequence)36 FinalState (org.yakindu.sct.model.sgraph.FinalState)35 Entry (org.yakindu.sct.model.sgraph.Entry)30 SCTTestUtil.findState (org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState)29 SGraphTestFactory._createEntry (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry)28 Transition (org.yakindu.sct.model.sgraph.Transition)23 EnterState (org.yakindu.sct.model.sexec.EnterState)21