diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-01-10 15:49:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-01-10 15:49:34 +0000 |
commit | bb219dc0894bb60eaeb242f51b9a382228031081 (patch) | |
tree | bd2165853f7adecc727532ab88fbc2f3ed3cab6f /bpmn/MSOCommonBPMN/src | |
parent | 9d77758d706d13c1c2ea46ada1837d757adbf9ba (diff) | |
parent | 5ec955ce08cd3101eed327bbb6d1ceb3903f5bfc (diff) |
Merge "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"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java | 91 |
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); + } } |