use of org.contextmapper.dsl.contextMappingDSL.CustomerSupplierRelationship in project context-mapper-dsl by ContextMapper.
the class PlantUMLComponentDiagramCreatorTest method canCreateCustomerSupplierRelationshipWithName.
@Test
public void canCreateCustomerSupplierRelationshipWithName() {
// 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);
CustomerSupplierRelationship relationship = ContextMappingDSLFactory.eINSTANCE.createCustomerSupplierRelationship();
relationship.setUpstream(boundedContext1);
relationship.setDownstream(boundedContext2);
relationship.setImplementationTechnology("SOAP");
relationship.setName("MyCS");
relationship.getUpstreamRoles().add(UpstreamRole.OPEN_HOST_SERVICE);
relationship.getDownstreamRoles().add(DownstreamRole.CONFORMIST);
contextMap.getRelationships().add(relationship);
// 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("interface \"MyCS (SOAP)\" as MyCS" + System.lineSeparator()));
assertTrue(plantUML.contains("[myContext1] --> MyCS : Supplier of OPEN_HOST_SERVICE" + System.lineSeparator()));
assertTrue(plantUML.contains("MyCS <.. [myContext2] : Customer as CONFORMIST" + System.lineSeparator()));
}
use of org.contextmapper.dsl.contextMappingDSL.CustomerSupplierRelationship in project context-mapper-dsl by ContextMapper.
the class PlantUMLComponentDiagramCreatorTest method canCreateCustomerSupplierRelationship.
@Test
public void canCreateCustomerSupplierRelationship() {
// 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);
CustomerSupplierRelationship relationship = ContextMappingDSLFactory.eINSTANCE.createCustomerSupplierRelationship();
relationship.setUpstream(boundedContext1);
relationship.setDownstream(boundedContext2);
relationship.setImplementationTechnology("SOAP");
relationship.getUpstreamRoles().add(UpstreamRole.OPEN_HOST_SERVICE);
relationship.getDownstreamRoles().add(DownstreamRole.ANTICORRUPTION_LAYER);
contextMap.getRelationships().add(relationship);
// 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("interface \"Customer-Supplier (SOAP)\" as myContext2_to_myContext1" + System.lineSeparator()));
assertTrue(plantUML.contains("[myContext1] --> myContext2_to_myContext1 : Supplier of OPEN_HOST_SERVICE" + System.lineSeparator()));
assertTrue(plantUML.contains("myContext2_to_myContext1 <.. [myContext2] : Customer via ANTICORRUPTION_LAYER" + System.lineSeparator()));
}
use of org.contextmapper.dsl.contextMappingDSL.CustomerSupplierRelationship in project context-mapper-dsl by ContextMapper.
the class PlantUMLComponentDiagramCreator method printUpstreamDownstreamRelationship.
private void printUpstreamDownstreamRelationship(UpstreamDownstreamRelationship relationship) {
UpstreamDownstreamRelationship upDownRelationship = (UpstreamDownstreamRelationship) relationship;
String interfaceId = getUniqueInterfaceId(upDownRelationship.getName(), upDownRelationship.getUpstream().getName(), upDownRelationship.getDownstream().getName());
printInterface(getRelationshipLabel(relationship), interfaceId);
if (upDownRelationship instanceof CustomerSupplierRelationship)
printCustomerSupplierInterfaceExposure(upDownRelationship.getUpstream().getName(), interfaceId, upstreamRolesToArray(upDownRelationship.getUpstreamRoles()));
else
printUpstreamDownstreamInterfaceExposure(upDownRelationship.getUpstream().getName(), interfaceId, upstreamRolesToArray(upDownRelationship.getUpstreamRoles()));
printInterfaceUsage(interfaceId, upDownRelationship);
linebreak();
}
Aggregations