Search in sources :

Example 1 with SharedKernel

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()));
}
Also used : SharedKernel(org.contextmapper.dsl.contextMappingDSL.SharedKernel) BoundedContext(org.contextmapper.dsl.contextMappingDSL.BoundedContext) ContextMap(org.contextmapper.dsl.contextMappingDSL.ContextMap) Test(org.junit.jupiter.api.Test)

Example 2 with SharedKernel

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()));
}
Also used : SharedKernel(org.contextmapper.dsl.contextMappingDSL.SharedKernel) BoundedContext(org.contextmapper.dsl.contextMappingDSL.BoundedContext) ContextMap(org.contextmapper.dsl.contextMappingDSL.ContextMap) Test(org.junit.jupiter.api.Test)

Example 3 with SharedKernel

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);
}
Also used : Command(org.eclipse.lsp4j.Command) SharedKernel(org.contextmapper.dsl.contextMappingDSL.SharedKernel) EObject(org.eclipse.emf.ecore.EObject)

Example 4 with SharedKernel

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;
}
Also used : SharedKernel(org.contextmapper.dsl.contextMappingDSL.SharedKernel)

Example 5 with 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);
}
Also used : SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) SharedKernel(org.contextmapper.dsl.contextMappingDSL.SharedKernel) ExtractSharedKernelRefactoring(org.contextmapper.dsl.refactoring.ExtractSharedKernelRefactoring)

Aggregations

SharedKernel (org.contextmapper.dsl.contextMappingDSL.SharedKernel)9 ContextMap (org.contextmapper.dsl.contextMappingDSL.ContextMap)4 Test (org.junit.jupiter.api.Test)4 BoundedContext (org.contextmapper.dsl.contextMappingDSL.BoundedContext)3 SemanticCMLRefactoring (org.contextmapper.dsl.refactoring.SemanticCMLRefactoring)2 EObject (org.eclipse.emf.ecore.EObject)2 Command (org.eclipse.lsp4j.Command)2 CMLResource (org.contextmapper.dsl.cml.CMLResource)1 ContextMappingModel (org.contextmapper.dsl.contextMappingDSL.ContextMappingModel)1 ExtractSharedKernelRefactoring (org.contextmapper.dsl.refactoring.ExtractSharedKernelRefactoring)1 SwitchFromPartnershipToSharedKernelRefactoring (org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring)1 SwitchFromSharedKernelToPartnershipRefactoring (org.contextmapper.dsl.refactoring.SwitchFromSharedKernelToPartnershipRefactoring)1