Search in sources :

Example 71 with ServiceInstancesRequest

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

the class RequestHandlerUtilsTest method setServiceTypeTestNetwork.

@Test
public void setServiceTypeTestNetwork() throws JsonProcessingException {
    String requestScope = ModelType.network.toString();
    Boolean aLaCarteFlag = null;
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelName("networkModelName");
    requestInfo.setSource("VID");
    requestDetails.setModelInfo(modelInfo);
    requestDetails.setRequestInfo(requestInfo);
    sir.setRequestDetails(requestDetails);
    String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
    assertEquals(serviceType, "networkModelName");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 72 with ServiceInstancesRequest

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

the class RequestHandlerUtilsTest method test_mapJSONtoMSOStyleCustomWorkflowRequest.

@Test
public void test_mapJSONtoMSOStyleCustomWorkflowRequest() throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(Include.NON_NULL);
    String testRequest = inputStream("/CustomWorkflowRequest.json");
    String resultString = requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, true, Action.inPlaceSoftwareUpdate);
    ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class);
    assertEquals(sir.getRequestDetails().getCloudConfiguration().getTenantId(), "88a6ca3ee0394ade9403f075db23167e");
    assertNotEquals(sir.getRequestDetails().getRequestParameters().getUserParams().size(), 0);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 73 with ServiceInstancesRequest

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

the class RequestHandlerUtilsTest method setServiceInstanceIdInstanceGroupTest.

@Test
public void setServiceInstanceIdInstanceGroupTest() throws JsonParseException, JsonMappingException, IOException {
    String requestScope = "instanceGroup";
    ServiceInstancesRequest sir = mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
    assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc", requestHandlerUtils.setServiceInstanceId(requestScope, sir));
}
Also used : ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 74 with ServiceInstancesRequest

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

the class RequestHandlerUtilsTest method setServiceInstanceIdTest.

@Test
public void setServiceInstanceIdTest() {
    String requestScope = "vnf";
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    sir.setServiceInstanceId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
    assertEquals("f0a35706-efc4-4e27-80ea-a995d7a2a40f", requestHandlerUtils.setServiceInstanceId(requestScope, sir));
}
Also used : ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Example 75 with ServiceInstancesRequest

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

the class RequestHandlerUtilsTest method test_mapJSONtoMSOStyleUsePreload.

@Test
public void test_mapJSONtoMSOStyleUsePreload() throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(Include.NON_NULL);
    String testRequest = inputStream("/ServiceInstanceDefault.json");
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    RequestDetails rd = new RequestDetails();
    RequestParameters rp = new RequestParameters();
    rp.setUsePreload(true);
    rd.setRequestParameters(rp);
    sir.setRequestDetails(rd);
    String resultString = requestHandlerUtils.mapJSONtoMSOStyle(testRequest, sir, false, null);
    ServiceInstancesRequest sir1 = mapper.readValue(resultString, ServiceInstancesRequest.class);
    assertTrue(sir1.getRequestDetails().getRequestParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) RequestParameters(org.onap.so.serviceinstancebeans.RequestParameters) Test(org.junit.Test)

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