summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-01-09 12:23:18 +0100
committerRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-01-10 16:01:26 +0100
commit5ec955ce08cd3101eed327bbb6d1ceb3903f5bfc (patch)
tree44045e7f8ae18d8582aacfa71ed329d8be513ef6 /bpmn/MSOCommonBPMN/src
parent8f37667d999101c2e4e395d810376173a5714794 (diff)
Align AssignPnfBB with Service Macro Create
-move and align logic of BB delegates with tests -remove unnecessary classes -add tests cases for Pnfs in ExtractPojosForBBTests Issue-ID: SO-2568 Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com> Change-Id: Ic48e2c1c6ab852c33837091da3e7916b71c26466
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java91
1 files changed, 36 insertions, 55 deletions
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 7bd2beeb92..dbd5000387 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
@@ -115,6 +115,12 @@ public class ExtractPojosForBBTest extends BaseTest {
instanceGroupsPend.add(instanceGroupPend);
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupPend.getId());
+ List<Pnf> pnfsPend = serviceInstancePend.getPnfs();
+ Pnf pnfPend = new Pnf();
+ pnfPend.setPnfId("abc");
+ pnfsPend.add(pnfPend);
+ lookupKeyMap.put(ResourceKey.PNF, pnfPend.getPnfId());
+
customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
gBBInput.setCustomer(customer);
@@ -143,89 +149,49 @@ public class ExtractPojosForBBTest extends BaseTest {
InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
+
+ Pnf extractPnfPend = extractPojos.extractByKey(execution, ResourceKey.PNF);
+ assertEquals(extractPnfPend.getPnfId(), pnfPend.getPnfId());
}
@Test
public void siError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
-
- extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.SERVICE_INSTANCE_ID);
}
@Test
public void vnfError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.GENERIC_VNF_ID);
}
@Test
public void vfModuleError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VF_MODULE_ID);
}
@Test
public void configurationError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.CONFIGURATION_ID);
}
@Test
public void allotedError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.ALLOTTED_RESOURCE_ID);
}
@Test
public void vpnBindingError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VPN_ID);
}
@Test
public void vpnBondingLinkError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VPN_BONDING_LINK_ID);
+ }
+
+ @Test
+ public void pnfError() throws BBObjectNotFoundException {
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.PNF);
}
@Test
@@ -239,4 +205,19 @@ public class ExtractPojosForBBTest extends BaseTest {
ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
}
+
+ private void assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey key)
+ throws BBObjectNotFoundException {
+ expectedException.expect(BBObjectNotFoundException.class);
+ setCustomerWithEmptyServiceInstance();
+ extractPojos.extractByKey(execution, key);
+ }
+
+ private void setCustomerWithEmptyServiceInstance() {
+ Customer customer = new Customer();
+ customer.setServiceSubscription(new ServiceSubscription());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ gBBInput.setCustomer(customer);
+ }
}