use of org.contextmapper.dsl.refactoring.ContextSplittingIntegrationType.CONFORMIST in project context-mapper-dsl by ContextMapper.
the class DeriveFrontendAndBackendSystemsFromFeatureTest method canDeriveUpstreamDownstreamRelationship.
@Test
public void canDeriveUpstreamDownstreamRelationship() throws IOException {
// given
CMLResource input = getResourceCopyOfTestCML("derive-frontend-backend-from-feature-test-1-input.cml");
DeriveFrontendAndBackendSystemsFromFeature ar = new DeriveFrontendAndBackendSystemsFromFeature("TestFeature", CONFORMIST);
// when
ar.refactor(input);
ar.persistChanges(serializer);
// then
ContextMappingModel model = reloadResource(input).getContextMappingModel();
assertNotNull(model.getMap());
ContextMap map = model.getMap();
assertEquals(1, map.getRelationships().size());
UpstreamDownstreamRelationship relationship = (UpstreamDownstreamRelationship) map.getRelationships().get(0);
assertEquals("TestFeatureFrontend", relationship.getDownstream().getName());
assertEquals("TestFeatureBackend", relationship.getUpstream().getName());
assertTrue(relationship.getUpstreamRoles().contains(UpstreamRole.PUBLISHED_LANGUAGE));
assertTrue(relationship.getDownstreamRoles().contains(DownstreamRole.CONFORMIST));
assertFalse(relationship.getDownstreamRoles().contains(DownstreamRole.ANTICORRUPTION_LAYER));
Set<String> boundedContextsRegisteredOnContextMap = map.getBoundedContexts().stream().map(bc -> bc.getName()).collect(Collectors.toSet());
assertTrue(boundedContextsRegisteredOnContextMap.contains("TestFeatureFrontend"));
assertTrue(boundedContextsRegisteredOnContextMap.contains("TestFeatureBackend"));
}
Aggregations