use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilderTest method test_mapCloudConfigurationVnf.
@Test
public void test_mapCloudConfigurationVnf() throws Exception {
String vnfId = "6fb01019-c3c4-41fe-b307-d1c56850b687";
Map<String, String[]> filters = new HashMap<>();
filters.put("vnfId", new String[] { "EQ", vnfId });
filters.put("requestStatus", new String[] { "EQ", Status.COMPLETE.toString() });
filters.put("action", new String[] { "EQ", "createInstance" });
ServiceInstancesRequest serviceRequest = new ServiceInstancesRequest();
CloudConfiguration cloudConfiguration = new CloudConfiguration();
RequestDetails requestDetails = new RequestDetails();
cloudConfiguration.setCloudOwner("cloudOwner");
cloudConfiguration.setTenantId("tenantId");
cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
requestDetails.setCloudConfiguration(cloudConfiguration);
serviceRequest.setRequestDetails(requestDetails);
doReturn(filters).when(reqBuilder).createQueryRequest("vnfId", vnfId);
doReturn(Optional.of(serviceRequest)).when(reqBuilder).findServiceInstanceRequest(filters);
CloudConfiguration result = reqBuilder.mapCloudConfigurationVnf(vnfId);
assertEquals("tenantId", result.getTenantId());
assertEquals("cloudOwner", result.getCloudOwner());
assertEquals("lcpCloudRegionId", result.getLcpCloudRegionId());
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilderTest method test_buildVnfDeleteRequest.
@Test
public void test_buildVnfDeleteRequest() throws Exception {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedVnfRequest.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest actualRequest = reqBuilder.buildVnfDeleteRequest("vnfId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilderTest method test_buildServiceInstanceDeleteRequest.
@Test
public void test_buildServiceInstanceDeleteRequest() throws Exception {
ServiceInstance service = provider.getMapper().readValue(new File(RESOURCE_PATH + "ServiceInstance.json"), ServiceInstance.class);
doReturn(service).when(aaiData).getServiceInstance("serviceId");
ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedServiceRequest.json"), ServiceInstancesRequest.class);
// bad getter/setter setting multiple
expectedRequest.getRequestDetails().getModelInfo().setModelId(null);
// fields
ServiceInstancesRequest actualRequest = reqBuilder.buildServiceDeleteRequest("serviceId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class VfModuleRestHandlerTest method test_saveInstanceName.
@Test
public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
ServiceInstancesRequest request = createTestRequest();
InfraActiveRequests dbRequest = createDatabaseRecord();
restHandler.saveInstanceName(request, dbRequest);
Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getVfModuleName());
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class ServiceInstanceRestHandlerTest method test_saveInstanceName.
@Test
public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
ServiceInstancesRequest request = createTestRequest();
InfraActiveRequests dbRequest = createDatabaseRecord();
restHandler.saveInstanceName(request, dbRequest);
Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getServiceInstanceName());
}
Aggregations