use of org.contextmapper.dsl.contextMappingDSL.Flow in project context-mapper-dsl by ContextMapper.
the class SketchMinerModelCreatorTest method canUseActorIfAvailable.
@Test
public void canUseActorIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("actor-test-1.cml").getContextMappingModel();
Flow flow = EcoreUtil2.eAllOfType(model, Flow.class).get(0);
// when
String output = new SketchMinerModelCreator().createText(flow);
// then
assertEquals("(StartEvent)" + System.lineSeparator() + "Test User: // TestAggregate [STATE1, STATE2 -> STATE3 X STATE4]" + System.lineSeparator() + "Test User: service Command1" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator(), output);
}
use of org.contextmapper.dsl.contextMappingDSL.Flow in project context-mapper-dsl by ContextMapper.
the class SketchMinerModelCreatorTest method canGenerateStepsForLoopIfStartNameAlreadyGiven.
@Test
public void canGenerateStepsForLoopIfStartNameAlreadyGiven() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("loop-test-2.cml").getContextMappingModel();
Flow flow = EcoreUtil2.eAllOfType(model, Flow.class).get(0);
// when
String output = new SketchMinerModelCreator().createText(flow);
// then
assertEquals("TestContext Application:" + System.lineSeparator() + System.lineSeparator() + "(InitialEvent0)" + System.lineSeparator() + "service InitialEvent" + System.lineSeparator() + "(FirstEvent)" + System.lineSeparator() + "service MiddleCommand" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + "service InitialEvent" + System.lineSeparator() + "(FirstEvent)" + System.lineSeparator() + "service MiddleCommand" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator(), output);
}
use of org.contextmapper.dsl.contextMappingDSL.Flow in project context-mapper-dsl by ContextMapper.
the class SketchMinerModelCreatorTest method canGenerateParallelStep4EventProduction.
@Test
public void canGenerateParallelStep4EventProduction() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("simple-sequence-with-parallel-step-test-1.cml").getContextMappingModel();
Flow flow = EcoreUtil2.eAllOfType(model, Flow.class).get(0);
// when
String output = new SketchMinerModelCreator().createText(flow);
// then
assertEquals("TestContext Application:" + System.lineSeparator() + System.lineSeparator() + "service StartCommand" + System.lineSeparator() + "(FirstEvent)|(SecondEvent)" + System.lineSeparator() + "..." + System.lineSeparator() + System.lineSeparator() + "..." + System.lineSeparator() + "(FirstEvent)" + System.lineSeparator() + "service EndCommand" + System.lineSeparator() + System.lineSeparator() + "..." + System.lineSeparator() + "(SecondEvent)" + System.lineSeparator() + "service EndCommand" + System.lineSeparator() + System.lineSeparator(), output);
}
use of org.contextmapper.dsl.contextMappingDSL.Flow in project context-mapper-dsl by ContextMapper.
the class SketchMinerModelCreatorTest method canAddStateTransitionComment.
@Test
public void canAddStateTransitionComment() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("state-transition-comment-test-1.cml").getContextMappingModel();
Flow flow = EcoreUtil2.eAllOfType(model, Flow.class).get(0);
// when
String output = new SketchMinerModelCreator().createText(flow);
// then
assertEquals("TestContext Application:" + System.lineSeparator() + System.lineSeparator() + "(StartEvent)" + System.lineSeparator() + "// TestAggregate [STATE1 -> STATE2]" + System.lineSeparator() + "service Command1" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator(), output);
}
use of org.contextmapper.dsl.contextMappingDSL.Flow in project context-mapper-dsl by ContextMapper.
the class PlantUMLStateDiagramCreator4Flow method printDiagramContent.
@Override
protected void printDiagramContent(Flow flow) {
List<DomainEventProductionStep> eventProductionStepsWithStateTransitions = flow.getSteps().stream().filter(s -> s instanceof DomainEventProductionStep).map(s -> (DomainEventProductionStep) s).filter(s -> s.getStateTransition() != null).collect(Collectors.toList());
List<StateTransition> allStateTransitions = eventProductionStepsWithStateTransitions.stream().map(s -> s.getStateTransition()).collect(Collectors.toList());
for (String state : collectStates(allStateTransitions)) {
printState(state);
}
for (DomainEventProductionStep step : eventProductionStepsWithStateTransitions) printTransition(step.getStateTransition(), step.getAction().getCommand() != null ? step.getAction().getCommand().getName() : step.getAction().getOperation().getName());
linebreak(2);
sb.append("legend top center");
linebreak();
sb.append(" " + flow.getName() + " State Transitions");
linebreak();
sb.append("endlegend");
}
Aggregations