use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription in project so by onap.
the class BBInputSetupTest method testGetServiceSubscription.
@Test
public void testGetServiceSubscription() throws IOException {
ServiceSubscription expected = new ServiceSubscription();
RequestDetails requestDetails = new RequestDetails();
RequestParameters params = new RequestParameters();
params.setSubscriptionServiceType("subscriptionServiceType");
requestDetails.setRequestParameters(params);
org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = new org.onap.aai.domain.yang.ServiceSubscription();
Customer customer = new Customer();
customer.setGlobalCustomerId("globalCustomerId");
doReturn(aaiServiceSubscription).when(SPY_bbInputSetupUtils).getAAIServiceSubscription(customer.getGlobalCustomerId(), requestDetails.getRequestParameters().getSubscriptionServiceType());
doReturn(expected).when(bbInputSetupMapperLayer).mapAAIServiceSubscription(aaiServiceSubscription);
ServiceSubscription actual = SPY_bbInputSetup.getServiceSubscription(requestDetails, customer);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription in project so by onap.
the class BBInputSetupMapperLayerTest method testMapAAIServiceSubscription.
@Test
public void testMapAAIServiceSubscription() throws IOException {
ServiceSubscription expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"), ServiceSubscription.class);
org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI = mapper.readValue(new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"), org.onap.aai.domain.yang.ServiceSubscription.class);
ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription in project so by onap.
the class BBInputSetupUtilsTest method getAAIServiceInstanceByNameNullTest.
@Test
public void getAAIServiceInstanceByNameNullTest() throws Exception {
Customer customer = new Customer();
customer.setServiceSubscription(new ServiceSubscription());
assertNull(bbInputSetupUtils.getAAIServiceInstanceByName("", customer));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription in project so by onap.
the class BBInputSetupUtilsTest method getAAIServiceSubscriptionTest.
@Test
public void getAAIServiceSubscriptionTest() {
final String globalSubscriberId = "globalSubscriberId";
final String subscriptionServiceType = "subscriptionServiceType";
Optional<org.onap.aai.domain.yang.ServiceSubscription> expected = Optional.of(new org.onap.aai.domain.yang.ServiceSubscription());
expected.get().setServiceType(subscriptionServiceType);
doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType)));
assertThat(bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType), sameBeanAs(expected.get()));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription in project so by onap.
the class BBInputSetupUtilsTest method getAAIServiceInstanceByNameTest.
@Test
public void getAAIServiceInstanceByNameTest() throws Exception {
final String serviceInstanceName = "serviceInstanceName";
ServiceInstance expectedServiceInstance = new ServiceInstance();
expectedServiceInstance.setServiceInstanceId("serviceInstanceId");
ServiceSubscription serviceSubscription = new ServiceSubscription();
serviceSubscription.setServiceType("serviceType");
Customer customer = new Customer();
customer.setGlobalCustomerId("globalCustomerId");
customer.setServiceSubscription(serviceSubscription);
ServiceInstances serviceInstances = new ServiceInstances();
serviceInstances.getServiceInstance().add(expectedServiceInstance);
AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()).serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances()).queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO);
bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer);
verify(MOCK_aaiResourcesClient, times(1)).getOne(org.onap.aai.domain.yang.ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, expectedUri);
}
Aggregations