use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class UserParamsValidationTest method setupValidationInformation.
public ValidationInformation setupValidationInformation(String path) throws IOException {
String jsonInput = new String(Files.readAllBytes(Paths.get(path)));
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sir = mapper.readValue(jsonInput, ServiceInstancesRequest.class);
ValidationInformation info = new ValidationInformation(sir, null, Action.createInstance, 7, false, sir.getRequestDetails().getRequestParameters());
for (Map<String, Object> params : sir.getRequestDetails().getRequestParameters().getUserParams()) {
ObjectMapper obj = new ObjectMapper();
String input = obj.writeValueAsString(params.get("service"));
Service validate = obj.readValue(input, Service.class);
info.setUserParams(validate);
break;
}
info.setRequestInfo(sir.getRequestDetails().getRequestInfo());
return info;
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class CustomWorkflowValidationTest method testCustomWorkflowValidation.
@Test
public void testCustomWorkflowValidation() throws IOException, ValidationException {
String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/SuccessfulValidation/v1ExecuteCustomWorkflow.json")));
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.inPlaceSoftwareUpdate, 1, false, sir.getRequestDetails().getRequestParameters());
info.setRequestScope("vnf");
CustomWorkflowValidation validation = new CustomWorkflowValidation();
validation.validate(info);
assertEquals(info.getSir().getRequestDetails().getCloudConfiguration().getCloudOwner(), "att-aic");
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestParametersValidationTest method testVfModuleWithNoALaCarte.
@Test
public void testVfModuleWithNoALaCarte() 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());
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 testVfModuleWithTrueALaCarte.
@Test
public void testVfModuleWithTrueALaCarte() throws IOException, ValidationException {
String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.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, true, 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 testServiceWithTrueALaCarte.
@Test
public void testServiceWithTrueALaCarte() throws IOException, ValidationException {
String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.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, true, 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());
}
Aggregations