Search in sources :

Example 31 with RequestInfo

use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.

the class BBInputSetupTest method testGetServiceInstanceHelperCreateScenarioExisting.

@Test
public void testGetServiceInstanceHelperCreateScenarioExisting() throws Exception {
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setInstanceName("SharansInstanceName");
    requestDetails.setRequestInfo(requestInfo);
    Customer customer = new Customer();
    String serviceInstanceId = "SharansInstanceId";
    boolean aLaCarte = true;
    Service service = new Service();
    service.setModelUUID("modelUUID");
    ServiceInstance expected = new ServiceInstance();
    org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance();
    serviceInstanceAAI.setModelVersionId("modelUUID");
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    String bbName = AssignFlows.SERVICE_INSTANCE.toString();
    doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer);
    doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
    ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Test(org.junit.Test)

Example 32 with RequestInfo

use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.

the class BBInputSetupTest method testGetServiceInstanceHelperCreateScenario.

@Test
public void testGetServiceInstanceHelperCreateScenario() throws Exception {
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setInstanceName("SharansInstanceName");
    requestDetails.setRequestInfo(requestInfo);
    Customer customer = new Customer();
    String serviceInstanceId = "SharansInstanceId";
    boolean aLaCarte = true;
    ServiceInstance expected = new ServiceInstance();
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    Service service = new Service();
    service.setModelUUID("modelUUID");
    String bbName = AssignFlows.SERVICE_INSTANCE.toString();
    doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer);
    doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId);
    doReturn(expected).when(SPY_bbInputSetup).createServiceInstance(requestDetails, null, null, lookupKeyMap, serviceInstanceId);
    ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Test(org.junit.Test)

Example 33 with RequestInfo

use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.

the class BBInputSetupTest method testGetAlaCarteServiceInstance.

@Test
public void testGetAlaCarteServiceInstance() throws Exception {
    ServiceInstance expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), ServiceInstance.class);
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setInstanceName("SharansInstanceName");
    requestDetails.setRequestInfo(requestInfo);
    Customer customer = new Customer();
    String serviceInstanceId = "SharansInstanceId";
    boolean aLaCarte = true;
    Service service = new Service();
    service.setModelUUID("modelUUID");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelUuid("modelUUID");
    expected.setModelInfoServiceInstance(modelInfoServiceInstance);
    org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance();
    serviceInstanceAAI.setModelVersionId("modelUUIDDifferent");
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    String bbName = AssignFlows.SERVICE_INSTANCE.toString();
    Service differentService = new Service();
    differentService.setModelUUID("modelUUIDDifferent");
    doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
    doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId);
    doReturn(differentService).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId());
    doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer).mapCatalogServiceIntoServiceInstance(differentService);
    ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) File(java.io.File) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 34 with RequestInfo

use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.

the class ServiceInstanceRestHandlerTest method createTestRequest.

private ServiceInstancesRequest createTestRequest() {
    ServiceInstancesRequest request = new ServiceInstancesRequest();
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setInstanceName("instanceName");
    requestDetails.setRequestInfo(requestInfo);
    request.setRequestDetails(requestDetails);
    return request;
}
Also used : RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Aggregations

RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)34 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)27 Test (org.junit.Test)20 Service (org.onap.so.db.catalog.beans.Service)17 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)15 HashMap (java.util.HashMap)12 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)12 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)11 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)11 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)11 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)9 ValidationException (org.onap.so.exceptions.ValidationException)6 File (java.io.File)5 RequestParameters (org.onap.so.serviceinstancebeans.RequestParameters)5 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)4 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)4 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)3 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)2 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)2 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)2