diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 18:13:17 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 18:13:17 +0200 |
commit | 2e4c62864ee5eb926bdf5747c1e592afbbc2d5b8 (patch) | |
tree | c895e234e8ffdf7f31b547ebbe59dfc829cb00c7 /src/test/java/org/onap | |
parent | ecb70d4efc6e1d0d664cf5d8af8b4634be76ba6b (diff) |
Change CsarHandler behavior
Change the Csarhandler so it does not raise an exception when it
installs a file that already exist
Issue-ID: CLAMP-151
Change-Id: I4b260bee95d2651e64bf4318957680918396be4d
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java index 46bddaf4f..3a37f9457 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java +++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java @@ -135,4 +135,29 @@ public class CsarHandlerTest { Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME); Files.deleteIfExists(path); } + + @Test + public void testDoubleSave() + throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException { + CsarHandler csar = new CsarHandler(buildFakeSdcNotification(), "test-controller", "/tmp/csar-handler-tests"); + // Test the save + csar.save(buildFakeSdcResut()); + assertTrue((new File(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME)).exists()); + assertEquals(CSAR_ARTIFACT_NAME, csar.getArtifactElement().getArtifactName()); + assertNotNull(csar.getSdcCsarHelper()); + // Test dcaeBlueprint + String blueprint = csar.getDcaeBlueprint(); + assertNotNull(blueprint); + assertTrue(!blueprint.isEmpty()); + assertTrue(blueprint.contains("DCAE-VES-PM-EVENT-v1")); + // Test additional properties from Sdc notif + assertEquals(BLUEPRINT1_NAME, csar.getBlueprintArtifactName()); + assertEquals(RESOURCE1_UUID, csar.getBlueprintInvariantResourceUuid()); + assertEquals(SERVICE_UUID, csar.getBlueprintInvariantServiceUuid()); + Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME); + // A double save should simply overwrite the existing + csar.save(buildFakeSdcResut()); + // Do some cleanup + Files.deleteIfExists(path); + } } |