aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@ericsson.com>2018-11-20 20:01:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-20 20:01:26 +0000
commit959a0f87d18a4cc5d9da60de8cbfaa754302dfaa (patch)
tree10c56906ce4b843e3aa5d85ce986ed593dffa663
parenta8c9cca7c94c327015b95b4c59efc5b56ba49109 (diff)
parent099116d1f1c9e56b9fd9f02ff0c0f6d1ea817e72 (diff)
Merge "Not invoking automatic BPMN deployment" into casablanca
-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;
}