aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json22
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java1
9 files changed, 133 insertions, 45 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
index dc2b3be073..5c0406cc9e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
@@ -24,6 +24,7 @@
package org.onap.so.bpmn.common.util;
import java.io.IOException;
+import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.util.Properties;
import org.onap.so.utils.CryptoUtils;
@@ -40,7 +41,10 @@ public class CryptoHandler implements ICryptoHandler {
public String getMsoAaiPassword() {
Properties keyProp = new Properties();
try {
- keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties"));
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream rs = cl.getResourceAsStream("urn.properties");
+ keyProp.load(rs);
+ rs.close();
return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY);
} catch (GeneralSecurityException | IOException e) {
logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index 9828d11186..c05557a317 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -78,8 +78,24 @@ public class ApplicationControllerAction {
appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
case Snapshot:
+ if (vmIdList.isEmpty()) {
+ logger.warn("vmIdList is Empty in AppCClient");
+ break;
+ }
String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds");
+ if (vmIds == null) {
+ logger.warn("vmIds null in AppCClient");
+ break;
+ }
+ if (vserverIdList.isEmpty()) {
+ logger.warn("vserverIdList is empty in AppCClient");
+ break;
+ }
String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds");
+ if (vserverIds == null) {
+ logger.warn("vserverIds null in AppCClient");
+ break;
+ }
String vmId = "";
String vserverId = "";
ObjectMapper mapper = new ObjectMapper();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
index 32db3a7bf6..48c6995715 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
@@ -481,4 +481,100 @@ public class ApplicationControllerActionTest extends BaseTest {
assertEquals(expectedErrorCode, appCAction.getErrorCode());
}
+ @Test
+ public void runAppCCommand_Snapshot_vmIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", "identityUrl");
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vmId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+
+ JSONObject vmIdListJson = new JSONObject();
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId1";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ JSONObject vserverIdListJson = new JSONObject();
+ payloadInfo.put("vserverIdList", vserverIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
deleted file mode 100644
index f5ffe38285..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "transactions" : [ {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
- }
- }, {
- "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test4"
- }
- } ]
- }, {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test6"
- }
- } ]
- } ]
-} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 7d5bb0dcf1..21847e1c4e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -33,7 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
- private TargetEntities extSystemErrorSource;
+ private transient TargetEntities extSystemErrorSource;
/**
* Constructor
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
index b0b837b3b9..fad6490df2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance data of services aka ServiceDecomposition
@@ -46,7 +44,7 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
private ModelInfo modelInfo;
private String environmentContext;
private String workloadContext;
- private Map serviceParams;
+ private transient Map serviceParams;
private Customer customer = new Customer();
private String e2eVpnKey;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index d3d07f9014..3f10df36ab 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -323,7 +323,7 @@ public class JsonUtils {
logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -352,7 +352,7 @@ public class JsonUtils {
logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -380,11 +380,10 @@ public class JsonUtils {
return 0;
} else {
if (rawValue instanceof Integer) {
- logger.debug("getJsonIntValue(): the raw value is an Integer Object={}",
- ((String) rawValue).toString());
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", rawValue);
return (Integer) rawValue;
} else {
- logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue);
return 0;
}
}
@@ -412,8 +411,7 @@ public class JsonUtils {
logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
return (Boolean) rawValue;
} else {
- logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}",
- rawValue.toString());
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue);
return false;
}
}
@@ -455,7 +453,7 @@ public class JsonUtils {
return null;
} else {
if (rawValue instanceof JSONArray) {
- logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue);
int arrayLen = ((JSONArray) rawValue).length();
if (index < 0 || arrayLen < index + 1) {
logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index,
@@ -464,8 +462,7 @@ public class JsonUtils {
}
int foundCnt = 0;
for (int i = 0; i < arrayLen; i++) {
- logger.debug("getJsonParamValue(): index: {}, value: {}", i,
- ((JSONArray) rawValue).get(i).toString());
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i));
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
@@ -482,16 +479,14 @@ public class JsonUtils {
continue;
}
} else {
- logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue);
return null;
}
}
logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
return null;
} else {
- logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue);
return null;
}
}
@@ -1057,13 +1052,13 @@ public class JsonUtils {
JsonValidator validator = factory.getValidator();
ProcessingReport report = validator.validate(schema, document);
- logger.debug("JSON schema validation report: {}", report.toString());
+ logger.debug("JSON schema validation report: {}", report);
return report.toString();
} catch (IOException e) {
- logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("IOException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
} catch (ProcessingException e) {
- logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("ProcessingException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 1516f289fe..1abe1ccc73 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -434,7 +434,7 @@ public class ServicePluginFactory {
}
}
- logger.error("There is no matching logical link for allowed list :" + allowedList.toString());
+ logger.error("There is no matching logical link for allowed list :" + Arrays.toString(allowedList));
return null;
} else {
logger.info("link customization is not required");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 638ecefa49..a436f7b5c2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -99,6 +99,7 @@ public class ExecuteActivity implements JavaDelegate {
variables.put(G_REQUEST_ID, requestId);
variables.put("retryCount", 1);
variables.put("aLaCarte", true);
+ variables.put("suppressRollback", true);
execution.getVariables().forEach((key, value) -> {
if (value instanceof Serializable) {