From: Adam Krysiak Date: Tue, 4 Jun 2019 07:12:24 +0000 (+0000) Subject: Merge "Improve test coverage Improve test coverage in CsarInstallerImpl" X-Git-Tag: 4.1.0~46 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=cf5931fe32003961af254cfa69120930a713fcca;p=clamp.git Merge "Improve test coverage Improve test coverage in CsarInstallerImpl" --- cf5931fe32003961af254cfa69120930a713fcca diff --cc src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java index cd6db68d,26e8de20..ed912831 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java @@@ -205,19 -203,14 +206,27 @@@ public class CsarInstallerItCase assertThat(loop.getOperationalPolicies()).hasSize(1); assertThat(loop.getModelPropertiesJson().get("serviceDetails")).isNotNull(); assertThat(loop.getModelPropertiesJson().get("resourceDetails")).isNotNull(); + JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), + JsonUtils.GSON.toJson(loop.getModelPropertiesJson()), true); + assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty(); + + loop = loopsRepo + .findById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca_3.yaml")) + .get(); + assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty(); + + loop = loopsRepo + .findById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE2, "tca_2.yaml")) + .get(); + assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty(); } + @Test(expected = SdcArtifactInstallerException.class) + @Transactional + public void shouldThrowSdcArtifactInstallerException() throws SdcArtifactInstallerException, SdcToscaParserException, IOException, InterruptedException, PolicyModelException { + String generatedName = RandomStringUtils.randomAlphanumeric(5); + CsarHandler csarHandler = buildFakeCsarHandler(generatedName); + Mockito.when(csarHandler.getMapOfBlueprints()).thenThrow(IOException.class); + csarInstaller.installTheCsar(csarHandler); + } }