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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations