Search in sources :

Example 1 with SketchMinerModelCreator

use of org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator in project context-mapper-dsl by ContextMapper.

the class SketchMinerModelCreatorTest method ignoreAggregateRefWithoutStateTransition.

@Test
public void ignoreAggregateRefWithoutStateTransition() throws IOException {
    // given
    ContextMappingModel model = getOriginalResourceOfTestCML("aggregate-without-state-transition-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() + "service Command1" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator(), output);
}
Also used : ContextMappingModel(org.contextmapper.dsl.contextMappingDSL.ContextMappingModel) SketchMinerModelCreator(org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator) Flow(org.contextmapper.dsl.contextMappingDSL.Flow) Test(org.junit.jupiter.api.Test) AbstractCMLInputFileTest(org.contextmapper.dsl.AbstractCMLInputFileTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with SketchMinerModelCreator

use of org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator in project context-mapper-dsl by ContextMapper.

the class SketchMinerModelCreatorTest method canUseFallbackAppName.

@Test
public void canUseFallbackAppName() throws IOException {
    // given
    ContextMappingModel model = getOriginalResourceOfTestCML("app-layer-name-test-1.cml").getContextMappingModel();
    Flow flow = EcoreUtil.copy(EcoreUtil2.eAllOfType(model, Flow.class).get(0));
    // when
    String output = new SketchMinerModelCreator().createText(flow);
    // then
    assertEquals("Application:" + System.lineSeparator() + System.lineSeparator() + "service StartCommand" + System.lineSeparator() + "(FirstEvent)" + System.lineSeparator() + "service EndCommand" + System.lineSeparator() + System.lineSeparator(), output);
}
Also used : ContextMappingModel(org.contextmapper.dsl.contextMappingDSL.ContextMappingModel) SketchMinerModelCreator(org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator) Flow(org.contextmapper.dsl.contextMappingDSL.Flow) Test(org.junit.jupiter.api.Test) AbstractCMLInputFileTest(org.contextmapper.dsl.AbstractCMLInputFileTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with SketchMinerModelCreator

use of org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator in project context-mapper-dsl by ContextMapper.

the class SketchMinerModelCreatorTest method canGenerateExclusiveAlternativeGate4EventProductionSteps.

@ParameterizedTest
@ValueSource(strings = { "exclusive-gate-event-test-1", "exclusive-gate-event-test-2", "exclusive-gate-event-test-3" })
public void canGenerateExclusiveAlternativeGate4EventProductionSteps(String inputFileName) throws IOException {
    // given
    ContextMappingModel model = getOriginalResourceOfTestCML(inputFileName + ".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)" + System.lineSeparator() + "service EndCommand" + System.lineSeparator() + System.lineSeparator() + "service StartCommand" + System.lineSeparator() + "(SecondEvent)" + System.lineSeparator() + "service EndCommand" + System.lineSeparator() + System.lineSeparator(), output);
}
Also used : ContextMappingModel(org.contextmapper.dsl.contextMappingDSL.ContextMappingModel) SketchMinerModelCreator(org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator) Flow(org.contextmapper.dsl.contextMappingDSL.Flow) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with SketchMinerModelCreator

use of org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator in project context-mapper-dsl by ContextMapper.

the class SketchMinerModelCreatorTest method canHandleLoopsWithMultipleEnds.

@Test
public void canHandleLoopsWithMultipleEnds() throws IOException {
    // given
    ContextMappingModel model = getOriginalResourceOfTestCML("loop-test-3.cml").getContextMappingModel();
    Flow flow = EcoreUtil2.eAllOfType(model, Flow.class).get(0);
    // when
    String output = new SketchMinerModelCreator().createText(flow);
    // then
    assertEquals("A1:" + System.lineSeparator() + System.lineSeparator() + "(InitialEvent)" + System.lineSeparator() + "(DE1)" + System.lineSeparator() + "service C1" + System.lineSeparator() + "(DE2)|(DE1)" + System.lineSeparator() + "..." + System.lineSeparator() + System.lineSeparator() + "..." + System.lineSeparator() + "(DE2)" + System.lineSeparator() + System.lineSeparator(), output);
}
Also used : ContextMappingModel(org.contextmapper.dsl.contextMappingDSL.ContextMappingModel) SketchMinerModelCreator(org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator) Flow(org.contextmapper.dsl.contextMappingDSL.Flow) Test(org.junit.jupiter.api.Test) AbstractCMLInputFileTest(org.contextmapper.dsl.AbstractCMLInputFileTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with SketchMinerModelCreator

use of org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator in project context-mapper-dsl by ContextMapper.

the class SketchMinerModelCreatorTest method canGenerateExclusiveAlternativeGate4CommandInvokationSteps.

@ParameterizedTest
@ValueSource(strings = { "exclusive-gate-command-test-1", "exclusive-gate-command-test-2", "exclusive-gate-command-test-3" })
public void canGenerateExclusiveAlternativeGate4CommandInvokationSteps(String inputFileName) throws IOException {
    // given
    ContextMappingModel model = getOriginalResourceOfTestCML(inputFileName + ".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)" + System.lineSeparator() + "service MiddleCommand1" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator() + "service StartCommand" + System.lineSeparator() + "(FirstEvent)" + System.lineSeparator() + "service MiddleCommand2" + System.lineSeparator() + "(EndEvent)" + System.lineSeparator() + System.lineSeparator(), output);
}
Also used : ContextMappingModel(org.contextmapper.dsl.contextMappingDSL.ContextMappingModel) SketchMinerModelCreator(org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator) Flow(org.contextmapper.dsl.contextMappingDSL.Flow) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Flow (org.contextmapper.dsl.contextMappingDSL.Flow)21 SketchMinerModelCreator (org.contextmapper.dsl.generator.sketchminer.SketchMinerModelCreator)21 ContextMappingModel (org.contextmapper.dsl.contextMappingDSL.ContextMappingModel)20 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 AbstractCMLInputFileTest (org.contextmapper.dsl.AbstractCMLInputFileTest)16 Test (org.junit.jupiter.api.Test)16 ValueSource (org.junit.jupiter.params.provider.ValueSource)4 BoundedContext (org.contextmapper.dsl.contextMappingDSL.BoundedContext)1