use of org.contextmapper.dsl.generator.servicecutter.input.userrepresentations.UserRepresentationsBuilder in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilderTest method canGenerateConsistencyCriticalityCompatibilitiesFromCML.
@Test
public void canGenerateConsistencyCriticalityCompatibilitiesFromCML() throws IOException {
// given
ContextMappingModel inputModel = getOriginalResourceOfTestCML("user-representations-builder-test-7.cml").getContextMappingModel();
// when
ServiceCutterUserRepresentationsModel scModel = new UserRepresentationsBuilder(inputModel).build();
// then
assertNotNull(scModel.getCompatibilities());
Compatibilities compatibilities = scModel.getCompatibilities();
assertFalse(compatibilities.getConsistencyCriticality().isEmpty());
assertEquals(3, compatibilities.getConsistencyCriticality().size());
ConsistencyCriticality normal = compatibilities.getConsistencyCriticality().stream().filter(sv -> sv.getCharacteristic().equals("Eventually")).findFirst().get();
ConsistencyCriticality high = compatibilities.getConsistencyCriticality().stream().filter(sv -> sv.getCharacteristic().equals("High")).findFirst().get();
ConsistencyCriticality low = compatibilities.getConsistencyCriticality().stream().filter(sv -> sv.getCharacteristic().equals("Weak")).findFirst().get();
assertNotNull(normal);
assertNotNull(high);
assertNotNull(low);
assertTrue(normal.getNanoentities().contains("Customer.testAttr1"));
assertTrue(high.getNanoentities().contains("Customer.testAttr2"));
assertTrue(low.getNanoentities().contains("Customer.testAttr3"));
}
use of org.contextmapper.dsl.generator.servicecutter.input.userrepresentations.UserRepresentationsBuilder in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilderTest method canGenerateSharedOwnerGroupsFromCML.
@Test
public void canGenerateSharedOwnerGroupsFromCML() throws IOException {
// given
ContextMappingModel inputModel = getOriginalResourceOfTestCML("user-representations-builder-test-3.cml").getContextMappingModel();
// when
UserRepresentationsBuilder builder = new UserRepresentationsBuilder(inputModel);
ServiceCutterUserRepresentationsModel scModel = builder.build();
// then
assertEquals(1, scModel.getSharedOwnerGroups().size());
SharedOwnerGroup ownerGroup = scModel.getSharedOwnerGroups().get(0);
assertEquals("TeamA", ownerGroup.getName());
assertEquals(1, ownerGroup.getNanoentities().size());
assertEquals("TestEntity.attribute1", ownerGroup.getNanoentities().get(0));
}
use of org.contextmapper.dsl.generator.servicecutter.input.userrepresentations.UserRepresentationsBuilder in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilderTest method canGenerateUseCasesFromCML.
@Test
public void canGenerateUseCasesFromCML() throws IOException {
// given
ContextMappingModel inputModel = getOriginalResourceOfTestCML("user-representations-builder-test-1.cml").getContextMappingModel();
// when
UserRepresentationsBuilder builder = new UserRepresentationsBuilder(inputModel);
ServiceCutterUserRepresentationsModel scModel = builder.build();
// then
assertEquals(1, scModel.getUseCases().size());
UseCase useCase = scModel.getUseCases().get(0);
assertEquals(10, useCase.getNanoentitiesRead().size());
assertEquals(10, useCase.getNanoentitiesWritten().size());
}
use of org.contextmapper.dsl.generator.servicecutter.input.userrepresentations.UserRepresentationsBuilder in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilderTest method canGeneratePredefinedServicesFromCML.
@Test
public void canGeneratePredefinedServicesFromCML() throws IOException {
// given
ContextMappingModel inputModel = getOriginalResourceOfTestCML("user-representations-builder-test-2.cml").getContextMappingModel();
// when
UserRepresentationsBuilder builder = new UserRepresentationsBuilder(inputModel);
ServiceCutterUserRepresentationsModel scModel = builder.build();
// then
assertEquals(1, scModel.getPredefinedServices().size());
PredefinedService predefinedService = scModel.getPredefinedServices().get(0);
assertEquals("TestContext", predefinedService.getName());
assertEquals(2, predefinedService.getNanoentities().size());
}
use of org.contextmapper.dsl.generator.servicecutter.input.userrepresentations.UserRepresentationsBuilder in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilderTest method canGenerateContentVolatilityCompatibilitiesFromCML.
@Test
public void canGenerateContentVolatilityCompatibilitiesFromCML() throws IOException {
// given
ContextMappingModel inputModel = getOriginalResourceOfTestCML("user-representations-builder-test-5.cml").getContextMappingModel();
// when
ServiceCutterUserRepresentationsModel scModel = new UserRepresentationsBuilder(inputModel).build();
// then
assertNotNull(scModel.getCompatibilities());
Compatibilities compatibilities = scModel.getCompatibilities();
assertFalse(compatibilities.getContentVolatility().isEmpty());
assertEquals(3, compatibilities.getContentVolatility().size());
ContentVolatility normal = compatibilities.getContentVolatility().stream().filter(sv -> sv.getCharacteristic().equals("Regularly")).findFirst().get();
ContentVolatility often = compatibilities.getContentVolatility().stream().filter(sv -> sv.getCharacteristic().equals("Often")).findFirst().get();
ContentVolatility rarely = compatibilities.getContentVolatility().stream().filter(sv -> sv.getCharacteristic().equals("Rarely")).findFirst().get();
assertNotNull(normal);
assertNotNull(often);
assertNotNull(rarely);
assertTrue(normal.getNanoentities().contains("Customer.testAttr1"));
assertTrue(often.getNanoentities().contains("Customer.testAttr2"));
assertTrue(rarely.getNanoentities().contains("Customer.testAttr3"));
}
Aggregations