Search in sources :

Example 1 with RequestClientParameter

use of org.onap.so.apihandler.common.RequestClientParameter in project so by onap.

the class ResumeOrchestrationRequestTest method setRequestClientParameterVfModuleTest.

@Test
public void setRequestClientParameterVfModuleTest() throws ApiException, IOException {
    when(requestHandler.mapJSONtoMSOStyle(anyString(), any(ServiceInstancesRequest.class), anyBoolean(), any(Action.class))).thenReturn(requestBody);
    doReturn(ModelType.vfModule).when(requestHandler).getModelType(action, modelInfo);
    RequestClientParameter result = resumeReq.setRequestClientParameter(lookupResult, version, infraActiveRequestVfModule, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
    assertThat(requestClientParameterVfModule, sameBeanAs(result));
}
Also used : ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestClientParameter(org.onap.so.apihandler.common.RequestClientParameter) Test(org.junit.Test)

Example 2 with RequestClientParameter

use of org.onap.so.apihandler.common.RequestClientParameter in project so by onap.

the class ResumeOrchestrationRequestTest method resumeRequestTestALaCarteNull.

@Test
public void resumeRequestTestALaCarteNull() throws ApiException, IOException {
    Response response = null;
    doReturn(instanceIdMap).when(resumeReq).setInstanceIdMap(infraActiveRequest, ModelType.service.toString());
    doReturn(SERVICE_INSTANCE_NAME).when(resumeReq).getInstanceName(infraActiveRequest, ModelType.service.toString(), currentActiveRequest);
    when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(), anyString())).thenReturn(sirNullALaCarte);
    when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
    doReturn(false).when(msoRequest).getAlacarteFlag(sirNullALaCarte);
    doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false, currentActiveRequest);
    doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version, infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sirNullALaCarte);
    doReturn(false).when(resumeReq).setALaCarteFlagIfNull(SERVICE, action);
    doNothing().when(resumeReq).requestDbSave(currentActiveRequest);
    when(requestHandler.postBPELRequest(any(InfraActiveRequests.class), any(RequestClientParameter.class), anyString(), anyString())).thenReturn(response);
    doNothing().when(resumeReq).checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE, SERVICE_INSTANCE_NAME, action);
    resumeReq.resumeRequest(infraActiveRequest, currentActiveRequest, version, "/onap/so/infra/orchestrationRequests/v7/requests/00032ab7-na18-42e5-965d-8ea592502018/resume");
    verify(requestHandler).postBPELRequest(currentActiveRequest, requestClientParameter, lookupResult.getOrchestrationURI(), infraActiveRequest.getRequestScope());
}
Also used : Response(javax.ws.rs.core.Response) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestClientParameter(org.onap.so.apihandler.common.RequestClientParameter) Test(org.junit.Test)

Example 3 with RequestClientParameter

use of org.onap.so.apihandler.common.RequestClientParameter in project so by onap.

the class NetworkRestHandlerTest method test_buildRequestParams.

@Test
public void test_buildRequestParams() throws Exception {
    RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId").setServiceInstanceId("serviceInstanceId").setNetworkId("networkId").setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest())).setRequestAction(Action.deleteInstance.toString()).setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
    RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(), "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "networkId");
    assertThat(actual, sameBeanAs(expected));
}
Also used : RequestClientParameter(org.onap.so.apihandler.common.RequestClientParameter) Test(org.junit.Test)

Example 4 with RequestClientParameter

use of org.onap.so.apihandler.common.RequestClientParameter in project so by onap.

the class VnfRestHandlerTest method test_buildRequestParams.

@Test
public void test_buildRequestParams() throws Exception {
    RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId").setServiceInstanceId("serviceInstanceId").setVnfId("vnfId").setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest())).setRequestAction(Action.deleteInstance.toString()).setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
    RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(), "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "vnfId");
    assertThat(actual, sameBeanAs(expected));
}
Also used : RequestClientParameter(org.onap.so.apihandler.common.RequestClientParameter) Test(org.junit.Test)

Example 5 with RequestClientParameter

use of org.onap.so.apihandler.common.RequestClientParameter in project so by onap.

the class VolumeRestHandlerTest method test_buildRequestParams.

@Test
public void test_buildRequestParams() throws Exception {
    RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId").setServiceInstanceId("serviceInstanceId").setVnfId("vnfId").setVolumeGroupId("volumeGroupId").setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest())).setRequestAction(Action.deleteInstance.toString()).setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
    RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(), "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "vnfId", "volumeGroupId");
    assertThat(actual, sameBeanAs(expected));
}
Also used : RequestClientParameter(org.onap.so.apihandler.common.RequestClientParameter) Test(org.junit.Test)

Aggregations

RequestClientParameter (org.onap.so.apihandler.common.RequestClientParameter)26 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)16 IOException (java.io.IOException)15 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)14 Response (javax.ws.rs.core.Response)13 ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)11 CamundaResponse (org.onap.so.apihandler.camundabeans.CamundaResponse)11 BPMNFailureException (org.onap.so.apihandlerinfra.exceptions.BPMNFailureException)11 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)11 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)11 ErrorLoggerInfo (org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo)10 Test (org.junit.Test)9 ResponseBuilder (org.onap.so.apihandler.common.ResponseBuilder)8 RequestDbFailureException (org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException)8 GetE2EServiceInstanceResponse (org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse)6 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 JSONObject (org.json.JSONObject)4 ValidationException (org.onap.so.exceptions.ValidationException)4 AAIFluentTypeBuilder (org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder)3