Search in sources :

Example 46 with ServiceInstancesRequest

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

the class RequestParametersValidationTest method testVfModuleWithReqVersionBelow4.

@Test
public void testVfModuleWithReqVersionBelow4() throws IOException, ValidationException {
    String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
    ObjectMapper mapper = new ObjectMapper();
    ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
    sir.getRequestDetails().getRequestParameters().setUsePreload(null);
    ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 3, false, sir.getRequestDetails().getRequestParameters());
    info.setRequestScope("vfModule");
    sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
    RequestParametersValidation validation = new RequestParametersValidation();
    validation.validate(info);
    assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
    assertTrue(info.getReqParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) BaseTest(org.onap.so.apihandlerinfra.BaseTest) Test(org.junit.Test)

Example 47 with ServiceInstancesRequest

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

the class RequestParametersValidationTest method testServiceWithReqVersionBelow4.

@Test
public void testServiceWithReqVersionBelow4() throws IOException, ValidationException {
    String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
    ObjectMapper mapper = new ObjectMapper();
    ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
    sir.getRequestDetails().getRequestParameters().setUsePreload(null);
    ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 3, false, sir.getRequestDetails().getRequestParameters());
    sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
    info.setRequestScope("service");
    RequestParametersValidation validation = new RequestParametersValidation();
    validation.validate(info);
    assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
    assertTrue(info.getReqParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) BaseTest(org.onap.so.apihandlerinfra.BaseTest) Test(org.junit.Test)

Example 48 with ServiceInstancesRequest

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

the class RequestParametersValidationTest method testVfModuleWithFalseALaCarte.

@Test
public void testVfModuleWithFalseALaCarte() throws IOException, ValidationException {
    String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
    ObjectMapper mapper = new ObjectMapper();
    ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
    sir.getRequestDetails().getRequestParameters().setUsePreload(null);
    ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 6, false, sir.getRequestDetails().getRequestParameters());
    info.setRequestScope("vfModule");
    sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
    RequestParametersValidation validation = new RequestParametersValidation();
    validation.validate(info);
    assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
    assertFalse(info.getReqParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) BaseTest(org.onap.so.apihandlerinfra.BaseTest) Test(org.junit.Test)

Example 49 with ServiceInstancesRequest

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

the class RequestParametersValidationTest method testServiceWithFalseALaCarte.

@Test
public void testServiceWithFalseALaCarte() throws IOException, ValidationException {
    String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
    ObjectMapper mapper = new ObjectMapper();
    ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
    sir.getRequestDetails().getRequestParameters().setUsePreload(null);
    ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 6, false, sir.getRequestDetails().getRequestParameters());
    sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
    info.setRequestScope("service");
    RequestParametersValidation validation = new RequestParametersValidation();
    validation.validate(info);
    assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
    assertFalse(info.getReqParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) BaseTest(org.onap.so.apihandlerinfra.BaseTest) Test(org.junit.Test)

Example 50 with ServiceInstancesRequest

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

the class RequestParametersValidationTest method testServiceWithNoALaCarte.

@Test
public void testServiceWithNoALaCarte() throws IOException, ValidationException {
    String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json")));
    ObjectMapper mapper = new ObjectMapper();
    ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
    ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 6, false, sir.getRequestDetails().getRequestParameters());
    sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
    sir.getRequestDetails().getRequestParameters().setSubscriptionServiceType("subscriptionServiceType");
    info.setRequestScope("service");
    RequestParametersValidation validation = new RequestParametersValidation();
    validation.validate(info);
    assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
    assertFalse(info.getReqParameters().getUsePreload());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) BaseTest(org.onap.so.apihandlerinfra.BaseTest) 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