aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java35
3 files changed, 38 insertions, 36 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 d2d321f8f4..260a9420c8 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
@@ -46,7 +46,10 @@ public class ExtractPojosForBB {
private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
- public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
+ public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException {
+ return extractByKey(execution, key, execution.getLookupMap().get(key));
+ }
+ protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
throws BBObjectNotFoundException {
Optional<T> result = Optional.empty();
@@ -59,39 +62,39 @@ public class ExtractPojosForBB {
result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
break;
case GENERIC_VNF_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getVnfs(), value);
break;
case NETWORK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getNetworks(), value);
break;
case VOLUME_GROUP_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
result = lookupObjectInList(vnf.getVolumeGroups(), value);
break;
case VF_MODULE_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
result = lookupObjectInList(vnf.getVfModules(), value);
break;
case ALLOTTED_RESOURCE_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getAllottedResources(), value);
break;
case CONFIGURATION_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value);
break;
case INSTANCE_GROUP_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getInstanceGroups(), value);
break;
default:
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index d5b5cde99b..bf98648dbc 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -352,7 +352,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -370,7 +370,7 @@ public class BuildingBlockTestDataSetup{
Collection collection = null;
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
collection = serviceInstance.getCollection();
if (collection == null) {
@@ -445,7 +445,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -490,7 +490,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -525,7 +525,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -553,7 +553,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -617,7 +617,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -684,7 +684,7 @@ public class BuildingBlockTestDataSetup{
configurations.add(config);
ServiceInstance serviceInstance = new ServiceInstance();
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
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 bc41b168ef..5de0903d65 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
@@ -120,30 +120,29 @@ public class ExtractPojosForBBTest extends BaseTest{
customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
gBBInput.setCustomer(customer);
- ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc");
+ ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
- GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc");
+ GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId());
- L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc");
+ L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID);
assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId());
- VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc");
+ VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId());
AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution,
- ResourceKey.ALLOTTED_RESOURCE_ID, "abc");
+ ResourceKey.ALLOTTED_RESOURCE_ID);
assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId());
- Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID,
- "abc");
+ Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId());
- VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc");
+ VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId());
- VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc");
+ VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId());
- VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink");
+ VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
- InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, "test-instance-group-1");
+ InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
}
@@ -157,7 +156,7 @@ public class ExtractPojosForBBTest extends BaseTest{
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc");
+ extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
}
@Test
@@ -169,7 +168,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
}
@Test
@@ -181,7 +180,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
}
@Test
@@ -193,7 +192,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
}
@Test
public void allotedError() throws BBObjectNotFoundException {
@@ -204,7 +203,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID);
}
@Test
public void vpnBindingError() throws BBObjectNotFoundException {
@@ -214,7 +213,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
}
@Test
@@ -225,6 +224,6 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
}
}