aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-05-23 11:40:17 -0400
committerElena Kuleshov <evn@att.com>2019-05-23 15:22:09 -0400
commit832539c87d7334ad68454c886c4b53d510bcd64d (patch)
treed0580b7b0dea6766629b1e33dafd8b68ead9eaf5 /asdc-controller/src
parentc87ff0e93628fb35fecb1a7798d4fc99ea7cac90 (diff)
Fix retrieval of mso.config.path
Fix retrieval of mso.config.path Issue-ID: SO-1925 Signed-off-by: Kuleshov, Elena <evn@att.com> Change-Id: I5eed704334de6335672624f9e9eca809856fb984
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;
+ }
}