summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Hautot <eh552t@intl.att.com>2018-04-06 16:28:30 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-06 16:28:30 +0000
commitf464b2f9935a83f79b58a754360d9315d9f1a7c6 (patch)
tree058b82cb23c4a6aa6fbdd5f389895f6b87db44dd
parent65ed508ad0db466f02c3db0fe9ed6b659ca46a53 (diff)
parent7e76d179c785b01558a92ffa1ee64b3ac4453b1f (diff)
Merge "Fix the SDC controller"
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
index 2744ef7a..a0449a32 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
@@ -204,8 +204,8 @@ public class SdcSingleController {
this.changeControllerStatus(SdcSingleControllerStatus.BUSY);
csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(),
refProp.getStringValue(CONFIG_SDC_FOLDER));
+ csar.save(downloadTheArtifact(csar.getArtifactElement()));
if (csarInstaller.isCsarAlreadyDeployed(csar)) {
- csar.save(downloadTheArtifact(csar.getArtifactElement()));
this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_OK, null,
System.currentTimeMillis());
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
index b7acbcc3..1b5b4257 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
@@ -84,8 +84,8 @@ public class CsarInstallerImpl implements CsarInstaller {
@Override
public boolean isCsarAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException {
- return (CldsModel.retrieve(cldsDao, csar.getSdcCsarHelper().getServiceMetadata().getValue("name"),
- false) != null) ? true : false;
+ return (CldsModel.retrieve(cldsDao, csar.getSdcCsarHelper().getServiceMetadata().getValue("name"), true)
+ .getId() != null) ? true : false;
}
@Override
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
index b0035a64..c0300eff 100644
--- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
@@ -24,6 +24,7 @@
package org.onap.clamp.clds.it.sdc.controller.installer;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -94,6 +95,7 @@ public class CsarInstallerItCase {
throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
CsarHandler csarHandler = buildFakeCsarHandler(generatedName);
+ assertFalse(csarInstaller.isCsarAlreadyDeployed(csarHandler));
csarInstaller.installTheCsar(csarHandler);
assertTrue(csarInstaller.isCsarAlreadyDeployed(csarHandler));
}