use of org.yakindu.sct.model.sgraph.Entry in project statecharts by Yakindu.
the class SGraphJavaValidationTest method regionCantBeEnteredUsingShallowHistory.
@Test
public void regionCantBeEnteredUsingShallowHistory() {
statechart = AbstractTestModelsUtil.loadStatechart(VALIDATION_TESTMODEL_DIR + "RegionCantBeEnteredUsingShallowHistory.sct");
Iterator<EObject> iter = statechart.eAllContents();
while (iter.hasNext()) {
EObject element = iter.next();
if (element instanceof Entry) {
validator.validate(element, diagnostics, new HashMap<Object, Object>());
}
}
assertIssueCount(diagnostics, 2);
Diagnostic issue = issueByName(diagnostics, ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NO_DEFAULT_ENTRY);
assertTrue(issue.getSeverity() == Diagnostic.ERROR);
assertEquals("r_a", ((NamedElement) issue.getData().get(0)).getName());
issue = issueByName(diagnostics, ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NON_CONNECTED_DEFAULT_ENTRY);
assertTrue(issue.getSeverity() == Diagnostic.ERROR);
assertEquals("r_c", ((NamedElement) issue.getData().get(0)).getName());
}
use of org.yakindu.sct.model.sgraph.Entry in project statecharts by Yakindu.
the class SGraphJavaValidationTest method disallowTrigger.
@Test
public void disallowTrigger() {
prepareStateTest();
Entry entry = factory.createEntry();
region.getVertices().add(entry);
Transition trans = createTransition(entry, state);
trans.setTrigger(sTextFactory.createReactionTrigger());
diagnostics = new BasicDiagnostic();
assertFalse(validator.validate(entry, diagnostics, new HashMap<Object, Object>()));
assertError(diagnostics, ISSUE_ENTRY_WITH_TRIGGER);
}
use of org.yakindu.sct.model.sgraph.Entry in project statecharts by Yakindu.
the class SGraphJavaValidationTest method initialEntryWithoutOutgoingTransition.
/**
* An initial entry should have an outgoing transition
*/
@Test
public void initialEntryWithoutOutgoingTransition() {
prepareStateTest();
Entry entry = factory.createEntry();
region.getVertices().add(entry);
assertEquals(EntryKind.INITIAL, entry.getKind());
validator.validate(entry, diagnostics, new HashMap<Object, Object>());
assertWarning(diagnostics, ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS);
}
use of org.yakindu.sct.model.sgraph.Entry 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);
}
use of org.yakindu.sct.model.sgraph.Entry in project statecharts by Yakindu.
the class SGraphTestFactory method _createEntry.
public static Entry _createEntry(EntryKind kind, String name, Region r) {
Entry entry = SGraphFactory.eINSTANCE.createEntry();
if (kind != null)
entry.setKind(kind);
else
entry.setKind(EntryKind.INITIAL);
entry.setName(name);
if (r != null)
r.getVertices().add(entry);
return entry;
}
Aggregations