From 7e76d179c785b01558a92ffa1ee64b3ac4453b1f Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 6 Apr 2018 18:14:53 +0200 Subject: Fix the SDC controller Fix the Controller so that it can save the csar before checking that it has been installed, also fix the isCsarAlreadyDeployed method Issue-ID: CLAMP-151 Change-Id: I7d04ec4be3960b4c1673e4d8b656649c18cfcee1 Signed-off-by: Determe, Sebastien (sd378r) --- .../java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java | 2 +- .../onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') 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 2744ef7ae..a0449a32f 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 b7acbcc32..1b5b4257c 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 -- cgit 1.2.3-korg