aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
authorMarcus Williams <marcus.williams@intel.com>2019-05-28 18:39:52 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-28 18:39:52 +0000
commit4b90d663e2128819f973f027f85f39d7deecfbce (patch)
tree1e0ab82346ec40c772116c4d1eb99845597665f5 /asdc-controller/src
parentea75e4a2b0156499da9f07908a13c8c96820103f (diff)
parent832539c87d7334ad68454c886c4b53d510bcd64d (diff)
Merge "Fix retrieval of mso.config.path" into dublin
Diffstat (limited to 'asdc-controller/src')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java17
1 files changed, 16 insertions, 1 deletions
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 7945ad0174..0379e2a423 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
@@ -34,6 +34,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@@ -45,6 +46,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
+import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -63,6 +65,9 @@ public class BpmnInstaller {
@Autowired
private Environment env;
+ @Autowired
+ private ASDCConfiguration asdcConfig;
+
public void installBpmn(String csarFilePath) {
logger.info("Deploying BPMN files from {}", csarFilePath);
try {
@@ -139,7 +144,7 @@ public class BpmnInstaller {
protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception {
FileInputStream bpmnFileStream = new FileInputStream(
- Paths.get(System.getProperty("mso.config.path"), "ASDC", version, bpmnFileName).normalize().toString());
+ Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString());
byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream);
HttpEntity requestEntity =
@@ -193,4 +198,14 @@ public class BpmnInstaller {
logger.error("Unable to open file.", e);
}
}
+
+ private String getMsoConfigPath() {
+ String msoConfigPath = System.getProperty("mso.config.path");
+ if (msoConfigPath == null) {
+ logger.info("Unable to find the system property mso.config.path, use the default configuration");
+ msoConfigPath = StringUtils.defaultString(asdcConfig.getPropertyOrNull("mso.config.defaultpath"));
+ }
+ logger.info("MSO config path is: {}", msoConfigPath);
+ return msoConfigPath;
+ }
}