Search in sources :

Example 1 with ServiceSubscription

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));
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) RequestParameters(org.onap.so.serviceinstancebeans.RequestParameters) Test(org.junit.Test)

Example 2 with ServiceSubscription

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));
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) File(java.io.File) Test(org.junit.Test)

Example 3 with ServiceSubscription

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));
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) Test(org.junit.Test)

Example 4 with ServiceSubscription

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()));
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 5 with ServiceSubscription

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);
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ServiceInstances(org.onap.aai.domain.yang.ServiceInstances) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) AAIPluralResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)27 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)22 Test (org.junit.Test)21 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)14 HashMap (java.util.HashMap)13 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)13 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)9 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)7 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)7 File (java.io.File)6 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)6 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)5 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)4 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)4 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)4 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)4 Service (org.onap.so.db.catalog.beans.Service)4 GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)3