Search in sources :

Example 26 with ServiceInstancesRequest

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

the class BpmnRequestBuilderTest method test_buildVFModuleDeleteRequest.

@Test
public void test_buildVFModuleDeleteRequest() 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")));
    VfModule vfModule = provider.getMapper().readValue(new File(RESOURCE_PATH + "VfModule.json"), VfModule.class);
    doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModule("vfModuleId")));
    ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedVfModuleRequest.json"), ServiceInstancesRequest.class);
    ServiceInstancesRequest actualRequest = reqBuilder.buildVFModuleDeleteRequest("vnfId", "vfModuleId", ModelType.vfModule);
    assertThat(actualRequest, sameBeanAs(expectedRequest));
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) File(java.io.File) VfModule(org.onap.aai.domain.yang.VfModule) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 27 with ServiceInstancesRequest

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

the class NetworkRestHandlerTest 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.getNetworkName());
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 28 with ServiceInstancesRequest

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

the class NetworkRestHandlerTest 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)

Example 29 with ServiceInstancesRequest

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

the class VnfRestHandlerTest 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.getVnfName());
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 30 with ServiceInstancesRequest

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

the class VnfRestHandlerTest 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

ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)100 Test (org.junit.Test)58 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)36 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)33 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)17 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)15 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)15 IOException (java.io.IOException)11 BaseTest (org.onap.so.apihandlerinfra.BaseTest)11 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)11 ValidationException (org.onap.so.exceptions.ValidationException)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)8 CloudConfigurationNotFoundException (org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException)8 Service (org.onap.so.db.catalog.beans.Service)8 ArrayList (java.util.ArrayList)7 RequestClientParameter (org.onap.so.apihandler.common.RequestClientParameter)7 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)7 ServiceInstancesResponse (org.onap.so.serviceinstancebeans.ServiceInstancesResponse)7 GenericVnf (org.onap.aai.domain.yang.GenericVnf)6