aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-20 13:33:58 -0500
committerRob Daugherty <rd472p@att.com>2018-11-20 13:37:34 -0500
commit099116d1f1c9e56b9fd9f02ff0c0f6d1ea817e72 (patch)
tree4dc36cde36e52759d81c2a36830819eaa0dac84b /asdc-controller
parent72a833193094c1c52be0532eb266013596d12bb1 (diff)
Not invoking automatic BPMN deployment
SO's SDC Controller is not invoking automatic BPMN deployment on Workflow distribution. Submitting this change on behalf of Elena Kuleshov. Change-Id: Ice68f15d505a88099da61c992a20b943dd40d756 Issue-ID: SO-1214 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java27
2 files changed, 34 insertions, 0 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 503de0429e..bcc2e15a7d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -686,6 +686,13 @@ public class ASDCController {
try {
this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
+ IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact();
+ String filePath = System.getProperty("mso.config.path") + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName();
+ File csarFile = new File(filePath);
+ String csarFilePath = csarFile.getAbsolutePath();
+ if (bpmnInstaller.containsWorkflows(csarFilePath)) {
+ bpmnInstaller.installBpmn(csarFilePath);
+ }
for (IResourceInstance resource : iNotif.getResources()){
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index f131b73175..0fde1332d6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -23,6 +23,7 @@ package org.onap.so.asdc.installer.bpmn;
import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Enumeration;
import java.util.zip.*;
import org.apache.commons.io.IOUtils;
@@ -105,6 +106,30 @@ public class BpmnInstaller {
}
return;
}
+
+ public boolean containsWorkflows(String csarFilePath) {
+ boolean workflowsInCsar = false;
+ try {
+ ZipFile zipFile = new ZipFile(csarFilePath);
+ Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
+ while (zipEntries.hasMoreElements()) {
+ String fileName = ((ZipEntry) zipEntries.nextElement()).getName();
+ if (fileName.endsWith(BPMN_SUFFIX)) {
+ workflowsInCsar = true;
+ break;
+ }
+ }
+ }
+ catch (Exception e) {
+ LOGGER.debug("Exception :",e);
+ LOGGER.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC,
+ csarFilePath,
+ "",
+ "",
+ e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC Unable to check CSAR entries");
+ }
+ return workflowsInCsar;
+ }
protected HttpResponse sendDeploymentRequest(String bpmnFileName) throws Exception {
HttpClient client = HttpClientBuilder.create().build();
@@ -149,6 +174,8 @@ public class BpmnInstaller {
.setField("Content-Disposition", String.format("form-data; name=\"%s\"; filename=\"%s\"; size=%d", bpmnFileName, bpmnFileName, bytesToSend.length))
.build())
.build();
+
+ IOUtils.closeQuietly(bpmnFileStream);
return requestEntity;
}