diff options
author | waqas.ikram <waqas.ikram@est.tech> | 2019-08-08 15:57:14 +0000 |
---|---|---|
committer | Waqas Ikram <waqas.ikram@est.tech> | 2019-08-08 15:57:30 +0000 |
commit | c44a753af3693cc67de62f8fea2c93cf17c070dc (patch) | |
tree | 355bf85f70c168633c6437c70346266208ed0b85 /plans/so/integration-etsi-testing/so-simulators/aai-simulator | |
parent | 1b878eb83fa02ce13c3391ba2ccdaba42111e667 (diff) |
Adding correct user in aai simulator
Plus Fixing belows issues
- NullpointerException in aai simulator
- Service Type update in catalogdb
- OutputRequest format in sdnc simulator
Change-Id: I87c8b814e93cf9bc83b62e90b868c603a15a5560
Issue-ID: SO-1953
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'plans/so/integration-etsi-testing/so-simulators/aai-simulator')
3 files changed, 41 insertions, 11 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java index 1d12a94d..5c022c95 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java @@ -101,16 +101,20 @@ public class CustomerCacheServiceProviderImpl extends AbstractCacheServiceProvid if (serviceSubscription.isPresent()) { LOGGER.info("Found service subscription ..."); - final List<ServiceInstance> serviceInstancesList = serviceSubscription.get().getServiceInstances() - .getServiceInstance().stream() - .filter(serviceInstance -> serviceInstanceName.equals(serviceInstance.getServiceInstanceName())) - .collect(Collectors.toList()); - if (serviceInstancesList != null && !serviceInstancesList.isEmpty()) { - LOGGER.info("Found {} service instances ", serviceInstancesList.size()); - final ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().addAll(serviceInstancesList); - return Optional.of(serviceInstances); - + final ServiceInstances serviceInstances = serviceSubscription.get().getServiceInstances(); + if (serviceInstances != null) { + final List<ServiceInstance> serviceInstancesList = + serviceInstances.getServiceInstance().stream() + .filter(serviceInstance -> serviceInstanceName + .equals(serviceInstance.getServiceInstanceName())) + .collect(Collectors.toList()); + if (serviceInstancesList != null && !serviceInstancesList.isEmpty()) { + LOGGER.info("Found {} service instances ", serviceInstancesList.size()); + final ServiceInstances result = new ServiceInstances(); + result.getServiceInstance().addAll(serviceInstancesList); + return Optional.of(result); + + } } } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml index 25be8dab..de819447 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml @@ -13,4 +13,8 @@ spring: - username: aai #password: aai.onap.org:demo123456! password: $2a$04$crRntT01fAF4kb48mxlvgu68/silcLg.czC1LxQsKTdWuDBPpO3YO + role: VID + - username: aai@aai.onap.org + #password: demo123456! + password: $2a$04$06VCpDvW5ztE7WOvhhvAtOx7JHLghECyZIzOShIbXLWpnshMva8T6 role: VID
\ No newline at end of file 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 ef49716a..e7d07859 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 @@ -192,7 +192,7 @@ public class BusinessControllerTest { invokeHttpPut(url, getServiceInstance()); final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL - + "?service-instance-name=" + SERVICE_NAME; + + "?depth=2&service-instance-name=" + SERVICE_NAME; final ResponseEntity<ServiceInstances> actual = restTemplate.exchange(serviceInstanceUrl, HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), ServiceInstances.class); @@ -208,6 +208,28 @@ public class BusinessControllerTest { } @Test + public void test_getSericeInstance_usingServiceInstanceName_returnRequestErrorIfnoServiceInstanceFound() + throws Exception { + + + final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer()); + + assertEquals(HttpStatus.ACCEPTED, response.getStatusCode()); + + final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL + + "?depth=2&service-instance-name=" + SERVICE_NAME; + + final ResponseEntity<RequestError> actual = restTemplate.exchange(serviceInstanceUrl, HttpMethod.GET, + new HttpEntity<>(getHttpHeaders()), RequestError.class); + + assertEquals(HttpStatus.NOT_FOUND, actual.getStatusCode()); + assertTrue(actual.hasBody()); + + assertNotNull(actual.getBody().getServiceException()); + + } + + @Test public void test_getSericeInstance_usingServiceInstanceId_ableToRetrieveServiceInstanceFromCache() throws Exception { |