diff options
author | waqas.ikram <waqas.ikram@est.tech> | 2019-09-24 11:32:39 +0100 |
---|---|---|
committer | waqas.ikram <waqas.ikram@est.tech> | 2019-09-24 11:32:41 +0100 |
commit | 8343ef4ffe4280310d26c32fc6d172cc32e7aff4 (patch) | |
tree | 32c58ba0236871875a540a95e4a91e306306687c /plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test | |
parent | 3b94000a6b917857088571db40e86c178d867eae (diff) |
Adding service delete endpoint in aai simulator
Change-Id: Ib4e99dadd3937657c63ed508b68384ecd98bfc88
Issue-ID: SO-2342
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test')
-rw-r--r-- | plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java index 8c57db58..c08c51ec 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java @@ -335,8 +335,8 @@ public class BusinessControllerTest extends AbstractSpringBootTest { invokeServiceInstanceEndPointAndAssertResponse(); - final String relationShipUrl = - getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL, BI_DIRECTIONAL_RELATIONSHIP_LIST_URL); + final String relationShipUrl = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL, + BI_DIRECTIONAL_RELATIONSHIP_LIST_URL); final ResponseEntity<Relationship> responseEntity2 = testRestTemplateService.invokeHttpPut(relationShipUrl, TestUtils.getRelationShipJsonObject(), Relationship.class); @@ -360,6 +360,26 @@ public class BusinessControllerTest extends AbstractSpringBootTest { assertEquals(GENERIC_VNF_NAME, genericVnf.getVnfName()); } + @Test + public void test_DeleteSericeInstance_ServiceInstanceRemovedFromCache() throws Exception { + final String url = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL); + + invokeCustomerEndPointAndAssertResponse(); + + invokeServiceInstanceEndPointAndAssertResponse(); + + final Optional<ServiceInstance> optional = + cacheServiceProvider.getServiceInstance(GLOBAL_CUSTOMER_ID, SERVICE_TYPE, SERVICE_INSTANCE_ID); + assertTrue(optional.isPresent()); + final ServiceInstance serviceInstance = optional.get(); + + final ResponseEntity<Void> responseEntity = testRestTemplateService + .invokeHttpDelete(url + "?resource-version=" + serviceInstance.getResourceVersion(), Void.class); + assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode()); + assertFalse(cacheServiceProvider.getServiceInstance(GLOBAL_CUSTOMER_ID, SERVICE_TYPE, SERVICE_INSTANCE_ID) + .isPresent()); + } + private void invokeServiceInstanceEndPointAndAssertResponse() throws IOException { final String url = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL); final ResponseEntity<Void> responseEntity = |