summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java18
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java10
3 files changed, 41 insertions, 18 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 9a39334af1..433aa0c11a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -1388,8 +1388,10 @@ public class BBInputSetup implements JavaDelegate {
vnfs.getInstanceParams(), productFamilyId);
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
- vfModules = vnfsAndVfModules.getValue1();
- vnfs = vnfsAndVfModules.getValue0();
+ if (vnfsAndVfModules != null) {
+ vfModules = vnfsAndVfModules.getValue1();
+ vnfs = vnfsAndVfModules.getValue0();
+ }
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
if (vnfs == null) {
throw new Exception("Could not find Vnf to orchestrate VfModule");
@@ -1410,8 +1412,10 @@ public class BBInputSetup implements JavaDelegate {
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
- this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
- serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ if (networks != null) {
+ this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
+ serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ }
} else if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
@@ -1608,8 +1612,10 @@ public class BBInputSetup implements JavaDelegate {
protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) {
CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key);
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
- collectionCust.getCollectionResource().getInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = null;
+ if (collectionCust != null) {
+ catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup();
+ }
instanceGroup.setModelInfoInstanceGroup(
mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup));
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
index 2e66493a25..1442099286 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
@@ -86,8 +86,13 @@ public class BaseTask implements JavaDelegate {
}
return variable;
} else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "expected a variable name string, got object of type " + o.getClass().getName());
+ } else {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "expected a variable name string, got null object");
+ }
}
}
@@ -114,7 +119,7 @@ public class BaseTask implements JavaDelegate {
return null;
} else {
throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
+ "expected a variable name string, got object of type " + o.getClass().getName());
}
}
@@ -133,9 +138,11 @@ public class BaseTask implements JavaDelegate {
Object o = getFieldImpl(expression, execution, fieldName, false);
if (o instanceof String) {
return (String) o;
- } else {
+ } else if (o != null) {
throw new BadInjectedFieldException(fieldName, getTaskName(),
"cannot convert '" + o.toString() + "' to Integer");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
}
}
@@ -189,8 +196,12 @@ public class BaseTask implements JavaDelegate {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "cannot convert '" + o.toString() + "' to Integer");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
+ }
}
}
}
@@ -289,8 +300,12 @@ public class BaseTask implements JavaDelegate {
try {
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "cannot convert '" + o.toString() + "' to Long");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
+ }
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 389f931901..e71404a2ff 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -350,10 +350,12 @@ public abstract class WorkflowTest {
*/
try {
- msoRequestId = (String) injectedVariables.get("requestId");
- variables.put("mso-request-id", msoRequestId);
- msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
- variables.put("mso-service-instance-id", msoServiceInstanceId);
+ if (injectedVariables != null) {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
} catch (Exception e) {
}
if (msoRequestId == null || msoRequestId.trim().equals("")) {