use of org.contextmapper.dsl.cml.CMLResource in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4NoRelationshipAvailable.
@Test
void canCheck4NoRelationshipAvailable() throws IOException {
// given
String boundedContext1 = "TestContext1";
String boundedContext2 = "TestContext2";
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-no-rel-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.cml.CMLResource in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4NullBoundedContext1.
@Test
void canCheck4NullBoundedContext1() throws IOException {
// given
String boundedContext1 = "TestContext";
String boundedContext2 = null;
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.cml.CMLResource in project context-mapper-dsl by ContextMapper.
the class SwitchFromSharedKernelToPartnershipRefactoringTest method canCheck4MultipleSKRelationships.
@Test
void canCheck4MultipleSKRelationships() throws IOException {
// given
String boundedContext1 = "CustomerManagement";
String boundedContext2 = "AnotherContext";
CMLResource input = getResourceCopyOfTestCML("switch-from-sharedkernel-to-partnership-precondition-checks-multiple-rels-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromSharedKernelToPartnershipRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.cml.CMLResource in project context-mapper-dsl by ContextMapper.
the class SwitchFromSharedKernelToPartnershipRefactoringTest method canSwitchFromSharedKernelToPartnership.
@Test
public void canSwitchFromSharedKernelToPartnership() throws IOException {
// given
CMLResource input = getResourceCopyOfTestCML("switch-from-sharedkernel-to-partnership-test-1-input.cml");
// when
new SwitchFromSharedKernelToPartnershipRefactoring("CustomerManagement", "AnotherContext").refactor(input);
// then
ContextMappingModel model = input.getContextMappingModel();
ContextMap map = model.getMap();
assertEquals(2, model.getBoundedContexts().size());
assertEquals(2, map.getBoundedContexts().size());
assertEquals(1, map.getRelationships().size());
assertTrue(map.getRelationships().get(0) instanceof Partnership);
Partnership partnership = (Partnership) map.getRelationships().get(0);
assertEquals("CustomerManagement", partnership.getParticipant1().getName());
assertEquals("AnotherContext", partnership.getParticipant2().getName());
}
use of org.contextmapper.dsl.cml.CMLResource in project context-mapper-dsl by ContextMapper.
the class StandaloneAPITest method canGenerateIntoCustomDirectory.
@Test
public void canGenerateIntoCustomDirectory() {
// given
StandaloneContextMapperAPI contextMapper = ContextMapperStandaloneSetup.getStandaloneAPI();
CMLResource cml = contextMapper.loadCML("./integ-test-files/standalone/simple-context-map.cml");
File expectedOutput = new File("./out/simple-context-map_ContextMap.png");
ensureFileDoesNotExist(expectedOutput);
// when
ContextMapGenerator generator = new ContextMapGenerator();
generator.setContextMapFormats(ContextMapFormat.PNG);
contextMapper.callGenerator(cml, generator, "./out");
// then
assertTrue(expectedOutput.exists());
}
Aggregations