Search in sources :

Example 1 with PLATFORMS

use of org.opentosca.toscana.core.testdata.TestPlugins.PLATFORMS in project TOSCAna by StuPro-TOSCAna.

the class TransformerHealthIndicatorTest method testPlatformList.

@Test
public void testPlatformList() throws Exception {
    when(pluginService.getSupportedPlatforms()).thenReturn(PLATFORMS);
    String json = getHealthAsString();
    List<String> platforms = getPlatforms(json);
    assertEquals(PLATFORMS.size(), platforms.size());
    Map<String, Boolean> foundPlatforms = new HashMap<>();
    for (Platform platform : PLATFORMS) {
        foundPlatforms.put(platform.id, false);
        for (String p : platforms) {
            if (p.equals(platform.id)) {
                log.info("Found platform {}", p);
                foundPlatforms.put(p, true);
            }
        }
    }
    assertTrue("Could not find all platforms", foundPlatforms.values().stream().allMatch(e -> e));
}
Also used : Transformation(org.opentosca.toscana.core.transformation.Transformation) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) CsarDao(org.opentosca.toscana.core.csar.CsarDao) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) TransformationImpl(org.opentosca.toscana.core.transformation.TransformationImpl) HashSet(java.util.HashSet) Platform(org.opentosca.toscana.core.transformation.platform.Platform) Map(java.util.Map) CsarImpl(org.opentosca.toscana.core.csar.CsarImpl) Before(org.junit.Before) PLATFORMS(org.opentosca.toscana.core.testdata.TestPlugins.PLATFORMS) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TRANSFORMING(org.opentosca.toscana.core.transformation.TransformationState.TRANSFORMING) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) JsonPath(com.jayway.jsonpath.JsonPath) ERROR(org.opentosca.toscana.core.transformation.TransformationState.ERROR) File(java.io.File) Csar(org.opentosca.toscana.core.csar.Csar) List(java.util.List) PLATFORM2(org.opentosca.toscana.core.testdata.TestPlugins.PLATFORM2) PLATFORM1(org.opentosca.toscana.core.testdata.TestPlugins.PLATFORM1) TransformationState(org.opentosca.toscana.core.transformation.TransformationState) PluginService(org.opentosca.toscana.core.plugin.PluginService) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) Platform(org.opentosca.toscana.core.transformation.platform.Platform) HashMap(java.util.HashMap) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonPath (com.jayway.jsonpath.JsonPath)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.spy (org.mockito.Mockito.spy)1 Mockito.when (org.mockito.Mockito.when)1 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)1 Csar (org.opentosca.toscana.core.csar.Csar)1