use of org.contextmapper.dsl.contextMappingDSL.SharedKernel in project context-mapper-dsl by ContextMapper.
the class PlantUMLComponentDiagramCreatorTest method canCreateSharedKernelRelationshipWithNameButNoTechnology.
@Test
public void canCreateSharedKernelRelationshipWithNameButNoTechnology() {
// given
ContextMap contextMap = ContextMappingDSLFactory.eINSTANCE.createContextMap();
BoundedContext boundedContext1 = ContextMappingDSLFactory.eINSTANCE.createBoundedContext();
boundedContext1.setName("myContext1");
BoundedContext boundedContext2 = ContextMappingDSLFactory.eINSTANCE.createBoundedContext();
boundedContext2.setName("myContext2");
contextMap.getBoundedContexts().add(boundedContext1);
contextMap.getBoundedContexts().add(boundedContext2);
SharedKernel sharedKernel = ContextMappingDSLFactory.eINSTANCE.createSharedKernel();
sharedKernel.setParticipant1(boundedContext1);
sharedKernel.setParticipant2(boundedContext2);
sharedKernel.setName("mySharedKernel");
contextMap.getRelationships().add(sharedKernel);
// when
String plantUML = this.creator.createDiagram(contextMap);
// then
assertTrue(plantUML.contains("component [myContext1]" + System.lineSeparator()));
assertTrue(plantUML.contains("component [myContext2]" + System.lineSeparator()));
assertTrue(plantUML.contains("[myContext1]<-->[myContext2] : mySharedKernel (Shared Kernel)" + System.lineSeparator()));
}
use of org.contextmapper.dsl.contextMappingDSL.SharedKernel in project context-mapper-dsl by ContextMapper.
the class PlantUMLComponentDiagramCreatorTest method canCreateSharedKernelRelationshipWithName.
@Test
public void canCreateSharedKernelRelationshipWithName() {
// given
ContextMap contextMap = ContextMappingDSLFactory.eINSTANCE.createContextMap();
BoundedContext boundedContext1 = ContextMappingDSLFactory.eINSTANCE.createBoundedContext();
boundedContext1.setName("myContext1");
BoundedContext boundedContext2 = ContextMappingDSLFactory.eINSTANCE.createBoundedContext();
boundedContext2.setName("myContext2");
contextMap.getBoundedContexts().add(boundedContext1);
contextMap.getBoundedContexts().add(boundedContext2);
SharedKernel sharedKernel = ContextMappingDSLFactory.eINSTANCE.createSharedKernel();
sharedKernel.setParticipant1(boundedContext1);
sharedKernel.setParticipant2(boundedContext2);
sharedKernel.setImplementationTechnology("ourTechnology");
sharedKernel.setName("mySharedKernel");
contextMap.getRelationships().add(sharedKernel);
// when
String plantUML = this.creator.createDiagram(contextMap);
// then
assertTrue(plantUML.contains("component [myContext1]" + System.lineSeparator()));
assertTrue(plantUML.contains("component [myContext2]" + System.lineSeparator()));
assertTrue(plantUML.contains("[myContext1]<-->[myContext2] : mySharedKernel (Shared Kernel implemented with ourTechnology)" + System.lineSeparator()));
}
use of org.contextmapper.dsl.contextMappingDSL.SharedKernel in project context-mapper-dsl by ContextMapper.
the class ExtractSharedKernelAction method getCommand.
@Override
public Command getCommand() {
List<Object> commandArguments = Lists.newLinkedList();
SharedKernel selectedSharedKernel = getSelectedSharedKernel();
commandArguments.add(cmlResource.getURI().toString());
commandArguments.add(selectedSharedKernel.getParticipant1().getName());
commandArguments.add(selectedSharedKernel.getParticipant2().getName());
return new Command("Extract Shared Kernel", "cml.ar.extractSharedKernel", commandArguments);
}
use of org.contextmapper.dsl.contextMappingDSL.SharedKernel in project context-mapper-dsl by ContextMapper.
the class ServiceCutterOutputToContextMappingModelConverter method createSharedKernelRelationship.
private SharedKernel createSharedKernelRelationship(BoundedContext context1, BoundedContext context2) {
SharedKernel sharedKernel = contextMappingFactory.createSharedKernel();
sharedKernel.setParticipant1(context1);
sharedKernel.setParticipant2(context2);
return sharedKernel;
}
use of org.contextmapper.dsl.contextMappingDSL.SharedKernel in project context-mapper-dsl by ContextMapper.
the class ExtractSharedKernelRefactoringHandler method executeRefactoring.
@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
SharedKernel sk = (SharedKernel) getSelectedElement();
SemanticCMLRefactoring ar = new ExtractSharedKernelRefactoring(sk.getParticipant1().getName(), sk.getParticipant2().getName());
ar.refactor(resource);
ar.persistChanges(serializer);
}
Aggregations