Search in sources :

Example 91 with State

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

the class SGraphJavaValidationTest method orthogonalTransition_BetweenStateRegions.

@Test
public void orthogonalTransition_BetweenStateRegions() {
    statechart = loadStatechart("OrthogonalTransition.sct");
    State state = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "B1");
    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 92 with State

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

the class SGraphJavaValidationTest method orthogonalTargetStates_StateInTopLevelRegion.

@Test
public void orthogonalTargetStates_StateInTopLevelRegion() {
    statechart = loadStatechart("NotOrthogonalRegion02.sct");
    State b = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "B");
    Synchronization sync = (Synchronization) b.getOutgoingTransitions().get(0).getTarget();
    assertFalse(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 1);
    assertError(diagnostics, ISSUE_SYNCHRONIZATION_TARGET_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 93 with State

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

the class SGraphJavaValidationTest method orthogonalSourceStates.

@Test
public void orthogonalSourceStates() {
    statechart = loadStatechart("OrthogonalRegion01.sct");
    State b = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "AA");
    Synchronization sync = (Synchronization) b.getOutgoingTransitions().get(0).getTarget();
    assertTrue(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertNoIssues(diagnostics);
}
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 94 with State

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

the class SGraphJavaValidationTest method syncLocation_Issue58.

@Test
public void syncLocation_Issue58() {
    statechart = loadStatechart("SyncLocation_Issue58.sct");
    State state = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "AA");
    Synchronization sync = (Synchronization) state.getOutgoingTransitions().get(0).getTarget();
    assertTrue(validator.validate(sync, diagnostics, new HashMap<Object, Object>()));
    assertNoIssues(diagnostics);
}
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 95 with State

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

the class SGraphJavaValidationTest method choiceWithoutOutgoingTransition.

/**
 * A choice must have at least one outgoing transition
 */
@Test
public void choiceWithoutOutgoingTransition() {
    statechart = factory.createStatechart();
    Region region = factory.createRegion();
    statechart.getRegions().add(region);
    Choice choice = factory.createChoice();
    region.getVertices().add(choice);
    State state = factory.createState();
    region.getVertices().add(state);
    createTransition(state, choice);
    assertFalse(validator.validate(choice, diagnostics, new HashMap<Object, Object>()));
    assertIssueCount(diagnostics, 1);
    assertError(diagnostics, ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION);
}
Also used : Choice(org.yakindu.sct.model.sgraph.Choice) HashMap(java.util.HashMap) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Region(org.yakindu.sct.model.sgraph.Region) 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