use of org.eclipse.winery.model.tosca.extensions.OTPermutationMapping in project winery by eclipse.
the class PermutationHelper method addAllPermutationMappings.
static void addAllPermutationMappings(OTPatternRefinementModel refinementModel) {
addSomePermutationMappings(refinementModel);
OTPermutationMapping relation1to2_to_relation12to14 = new OTPermutationMapping.Builder("pm-1-2--14").setDetectorElement(refinementModel.getDetector().getRelationshipTemplate("con-1--2")).setRefinementElement(refinementModel.getRefinementStructure().getNodeTemplate("14")).build();
refinementModel.getPermutationMappings().add(relation1to2_to_relation12to14);
}
use of org.eclipse.winery.model.tosca.extensions.OTPermutationMapping in project winery by eclipse.
the class PermutationGeneratorTest method checkMutabilityOfPrmWithAutomaticallyDeterminableComplexRelationMapping.
@Test
void checkMutabilityOfPrmWithAutomaticallyDeterminableComplexRelationMapping() {
OTPatternRefinementModel refinementModel = generatePrmWithComplexRelationMaps();
PermutationGenerator permutationGenerator = new PermutationGenerator();
assertTrue(permutationGenerator.checkMutability(refinementModel));
assertEquals(2, refinementModel.getPermutationOptions().size());
List<OTPermutationMapping> mappings = refinementModel.getPermutationMappings();
assertEquals(5, mappings.size());
assertTrue(refinementModel.getPermutationMappings().removeIf(permutationMap -> permutationMap.getDetectorElement().getId().equals("1") && permutationMap.getRefinementElement().getId().equals("11")));
assertTrue(refinementModel.getPermutationMappings().removeIf(permutationMap -> permutationMap.getDetectorElement().getId().equals("1") && permutationMap.getRefinementElement().getId().equals("12")));
assertTrue(refinementModel.getPermutationMappings().removeIf(permutationMap -> permutationMap.getDetectorElement().getId().equals("2") && permutationMap.getRefinementElement().getId().equals("13")));
assertTrue(refinementModel.getPermutationMappings().removeIf(permutationMap -> permutationMap.getDetectorElement().getId().equals("2") && permutationMap.getRefinementElement().getId().equals("14")));
assertTrue(refinementModel.getPermutationMappings().removeIf(permutationMap -> permutationMap.getDetectorElement().getId().equals("con-1--2") && permutationMap.getRefinementElement().getId().equals("13")));
}
use of org.eclipse.winery.model.tosca.extensions.OTPermutationMapping in project winery by eclipse.
the class PermutationGeneratorTest method checkMutabilityOfPrmWithTwoPatternsHostedOnOne.
@Test
void checkMutabilityOfPrmWithTwoPatternsHostedOnOne() {
OTPatternRefinementModel refinementModel = generatePrmWithTwoPatternsHostedOnAThird();
PermutationGenerator permutationGenerator = new PermutationGenerator();
assertTrue(permutationGenerator.checkMutability(refinementModel));
List<OTPermutationMapping> permutationMappings = refinementModel.getPermutationMappings();
assertEquals(7, permutationMappings.size());
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("1") && mapping.getRefinementElement().getId().equals("11")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("3") && mapping.getRefinementElement().getId().equals("12")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("2") && mapping.getRefinementElement().getId().equals("13")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("2") && mapping.getRefinementElement().getId().equals("14")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("con-1--3") && mapping.getRefinementElement().getId().equals("12")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("con-1--2") && mapping.getRefinementElement().getId().equals("13")));
assertTrue(permutationMappings.removeIf(mapping -> mapping.getDetectorElement().getId().equals("con-3--2") && mapping.getRefinementElement().getId().equals("13")));
}
Aggregations