summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-05-21 16:52:46 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-21 16:52:46 +0000
commite91f705e913d875426aeadde5a78cbca3d9a9504 (patch)
tree17aa59bfb895d2b544b7ca1b2f6a5098eb8aabca /bpmn/MSOCommonBPMN/src
parent3d4a7677036912b5745e4357576e2375a762ee8f (diff)
parente6e0c906bddeb9bb5b67b16b4b9530d6b0c1946c (diff)
Merge "Change serviceInstance CM retrieval" into dublin
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java12
2 files changed, 19 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index 86bbead9a4..b76316bf0e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -57,8 +57,13 @@ public class ExtractPojosForBB {
GenericVnf vnf;
switch (key) {
case SERVICE_INSTANCE_ID:
- result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(),
- value);
+ if (gBBInput.getCustomer().getServiceSubscription() == null
+ && gBBInput.getServiceInstance() != null) {
+ result = Optional.of((T) gBBInput.getServiceInstance());
+ } else {
+ result = lookupObjectInList(
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
+ }
break;
case GENERIC_VNF_ID:
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
index 8ab2c8e155..7bd2beeb92 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
@@ -227,4 +227,16 @@ public class ExtractPojosForBBTest extends BaseTest {
gBBInput.setCustomer(customer);
extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
}
+
+ @Test
+ public void getServiceInstanceWithNoCustomer() throws BBObjectNotFoundException {
+ ServiceInstance serviceInstancePend = new ServiceInstance();
+ serviceInstancePend.setServiceInstanceId("abc");
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstancePend.getServiceInstanceId());
+ Customer customer = new Customer();
+ gBBInput.setCustomer(customer);
+ gBBInput.setServiceInstance(serviceInstancePend);
+ ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
+ }
}