use of org.opentosca.toscana.core.transformation.platform.PlatformService in project TOSCAna by StuPro-TOSCAna.
the class TransformationControllerTest method mockPlatformService.
private void mockPlatformService() {
platformService = mock(PlatformService.class);
Set<Platform> platforms = new HashSet<>();
for (int i = 0; i < 5; i++) {
HashSet<PlatformInput> inputs = new HashSet<>();
for (PropertyType type : PropertyType.values()) {
inputs.add(new PlatformInput(type.getTypeName() + "_input", type));
}
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
if (i == 0) {
inputs.add(new PlatformInput(PROPERTY_TEST_DEFAULT_VALUE_KEY, PropertyType.TEXT, "", false, INPUT_TEST_DEFAULT_VALUE));
}
platforms.add(new Platform("p-" + chars[i], "platform-" + (i + 1), inputs));
}
when(platformService.getSupportedPlatforms()).thenReturn(platforms);
when(platformService.isSupported(any(Platform.class))).thenReturn(false);
when(platformService.findPlatformById(anyString())).thenReturn(Optional.empty());
for (Platform platform : platforms) {
when(platformService.findPlatformById(platform.id)).thenReturn(Optional.of(platform));
when(platformService.isSupported(platform)).thenReturn(true);
}
}
Aggregations