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));
}
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));
}
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));
}
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;
}
Aggregations