Search in sources :

Example 96 with State

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

the class SGraphJavaValidationTest method orthogonalSourceStates_StateInParentStateRegion.

@Test
public void orthogonalSourceStates_StateInParentStateRegion() {
    statechart = loadStatechart("NotOrthogonalRegion01.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 97 with State

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

the class SGraphJavaValidationTest method exitWithOutgoingTransition.

/**
 * An exit node must have no outgoing transitions.
 */
@Test
public void exitWithOutgoingTransition() {
    prepareStateTest();
    Region subRegion = factory.createRegion();
    state.getRegions().add(subRegion);
    Exit exit = factory.createExit();
    subRegion.getVertices().add(exit);
    State s = factory.createState();
    subRegion.getVertices().add(s);
    Transition t = factory.createTransition();
    t.setSource(exit);
    t.setTarget(s);
    assertFalse(validate(exit));
    assertError(diagnostics, ISSUE_EXIT_WITH_OUT_TRANS);
}
Also used : FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Transition(org.yakindu.sct.model.sgraph.Transition) Region(org.yakindu.sct.model.sgraph.Region) Exit(org.yakindu.sct.model.sgraph.Exit) Test(org.junit.Test)

Example 98 with State

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

the class SGraphJavaValidationTest method vertexNotReachable_AcceptThroughSubentry.

/**
 * A transition to a sub entry is considered implies reachability.
 */
@Test
public void vertexNotReachable_AcceptThroughSubentry() {
    prepareStateTest();
    State stateA = factory.createState();
    Region subRegion = factory.createRegion();
    state.getRegions().add(subRegion);
    State stateC = factory.createState();
    subRegion.getVertices().add(stateC);
    Entry entry = factory.createEntry();
    subRegion.getVertices().add(entry);
    Transition t1 = factory.createTransition();
    t1.setSource(stateA);
    t1.setTarget(entry);
    Transition t2 = factory.createTransition();
    t2.setSource(entry);
    t2.setTarget(stateC);
    validate(state);
    assertNoIssues(diagnostics);
}
Also used : Entry(org.yakindu.sct.model.sgraph.Entry) FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Transition(org.yakindu.sct.model.sgraph.Transition) Region(org.yakindu.sct.model.sgraph.Region) Test(org.junit.Test)

Example 99 with State

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

the class SGraphJavaValidationTest method vertexNotReachable_AcceptThroughSubstate.

/**
 * A transition to a sub entry is considered implies reachability.
 */
@Test
public void vertexNotReachable_AcceptThroughSubstate() {
    prepareStateTest();
    State stateA = factory.createState();
    Region subRegion = factory.createRegion();
    state.getRegions().add(subRegion);
    State stateC = factory.createState();
    subRegion.getVertices().add(stateC);
    Transition t1 = factory.createTransition();
    t1.setSource(stateA);
    t1.setTarget(stateC);
    validate(state);
    assertNoIssues(diagnostics);
}
Also used : FinalState(org.yakindu.sct.model.sgraph.FinalState) State(org.yakindu.sct.model.sgraph.State) Transition(org.yakindu.sct.model.sgraph.Transition) Region(org.yakindu.sct.model.sgraph.Region) Test(org.junit.Test)

Example 100 with State

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

the class SGraphTestFactory method _createState.

public static State _createState(String name, Region r) {
    State state = SGraphFactory.eINSTANCE.createState();
    state.setName(name);
    if (r != null)
        r.getVertices().add(state);
    return state;
}
Also used : State(org.yakindu.sct.model.sgraph.State) FinalState(org.yakindu.sct.model.sgraph.FinalState)

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