use of org.contextmapper.dsl.refactoring.ContextSplittingIntegrationType.ACL in project context-mapper-dsl by ContextMapper.
the class DeriveFrontendAndBackendSystemsFromFeatureTest method canDeriveFrontendAndBackendSystemContexts.
@ParameterizedTest
@ValueSource(strings = { "derive-frontend-backend-from-feature-test-6-input.cml" })
public void canDeriveFrontendAndBackendSystemContexts(String inputFile) throws IOException {
// given
CMLResource input = getResourceCopyOfTestCML(inputFile);
DeriveFrontendAndBackendSystemsFromFeature ar = new DeriveFrontendAndBackendSystemsFromFeature("TestSystem", ACL);
ar.setBackendName("TestBackend");
ar.setFrontendName("TestFrontend");
// when
ar.refactor(input);
ar.persistChanges(serializer);
// then
ContextMappingModel model = reloadResource(input).getContextMappingModel();
Set<String> bcNames = model.getBoundedContexts().stream().map(bc -> bc.getName()).collect(Collectors.toSet());
// model already contains two BCs
assertEquals(4, model.getBoundedContexts().size());
assertTrue(bcNames.contains("TestSystem"));
assertTrue(bcNames.contains("TestBackend"));
assertTrue(bcNames.contains("TestFrontend"));
BoundedContext frontend = model.getBoundedContexts().stream().filter(bc -> bc.getName().equals("TestFrontend")).findFirst().get();
assertEquals(BoundedContextType.SYSTEM, frontend.getType());
BoundedContext backend = model.getBoundedContexts().stream().filter(bc -> bc.getName().equals("TestBackend")).findFirst().get();
assertEquals(BoundedContextType.SYSTEM, backend.getType());
}
use of org.contextmapper.dsl.refactoring.ContextSplittingIntegrationType.ACL in project context-mapper-dsl by ContextMapper.
the class DeriveFrontendAndBackendSystemsFromFeatureTest method canAddExposedAggregatesToNewRelationship.
@Test
public void canAddExposedAggregatesToNewRelationship() throws IOException {
// given
CMLResource input = getResourceCopyOfTestCML("derive-frontend-backend-from-feature-test-5-input.cml");
DeriveFrontendAndBackendSystemsFromFeature ar = new DeriveFrontendAndBackendSystemsFromFeature("TestFeature", ACL);
// when
ar.refactor(input);
ar.persistChanges(serializer);
// then
UpstreamDownstreamRelationship relationship = (UpstreamDownstreamRelationship) reloadResource(input).getContextMappingModel().getMap().getRelationships().get(0);
assertNotNull(relationship);
assertEquals(2, relationship.getUpstreamExposedAggregates().size());
Set<String> exposedAggregateNames = relationship.getUpstreamExposedAggregates().stream().map(agg -> agg.getName()).collect(Collectors.toSet());
assertTrue(exposedAggregateNames.contains("TestAggregateBackend"));
assertTrue(exposedAggregateNames.contains("TestAggregateInModuleBackend_2"));
}
Aggregations