Search in sources :

Example 6 with Synchronization

use of org.yakindu.sct.model.sgraph.Synchronization 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 7 with Synchronization

use of org.yakindu.sct.model.sgraph.Synchronization 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)

Example 8 with Synchronization

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

the class SGraphJavaValidationTest method orthogonalTargetStates_StateInParentStateRegion.

@Test
public void orthogonalTargetStates_StateInParentStateRegion() {
    statechart = loadStatechart("NotOrthogonalRegion01.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 9 with Synchronization

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

the class SGraphJavaValidationTest method orthogonalTargetStates.

@Test
public void orthogonalTargetStates() {
    statechart = loadStatechart("OrthogonalRegion01.sct");
    State b = firstNamed(EcoreUtil2.eAllOfType(statechart, State.class), "B");
    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 10 with Synchronization

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

the class TransitionsWithNoTriggerTest method missingTriggerOnSyncSingleIncoming.

/**
 * If a sync node has multiple incoming transitions then the transitions can omit the trigger.
 */
@Test
public void missingTriggerOnSyncSingleIncoming() {
    statechart = loadStatechart("ValidEmptyTransitionFromSync.sct");
    Region validRegion = firstNamed(eAllOfType(statechart, Region.class), "warning");
    Synchronization sync = eAllOfType(validRegion, Synchronization.class).get(0);
    assertEquals(1, sync.getIncomingTransitions().size());
    assertTrue(validate(sync.getIncomingTransitions().get(0)));
    assertIssueCount(diagnostics, 1);
    assertWarning(diagnostics, ISSUE_TRANSITION_WITHOUT_TRIGGER);
}
Also used : Region(org.yakindu.sct.model.sgraph.Region) Synchronization(org.yakindu.sct.model.sgraph.Synchronization) Test(org.junit.Test)

Aggregations

Synchronization (org.yakindu.sct.model.sgraph.Synchronization)16 Test (org.junit.Test)14 HashMap (java.util.HashMap)11 FinalState (org.yakindu.sct.model.sgraph.FinalState)10 State (org.yakindu.sct.model.sgraph.State)10 Region (org.yakindu.sct.model.sgraph.Region)4 EObject (org.eclipse.emf.ecore.EObject)2 Transition (org.yakindu.sct.model.sgraph.Transition)2 LinkedList (java.util.LinkedList)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1 Check (org.eclipse.xtext.validation.Check)1 CompositeElement (org.yakindu.sct.model.sgraph.CompositeElement)1 Vertex (org.yakindu.sct.model.sgraph.Vertex)1