use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestHandlerUtilsTest method getServiceInstanceIdForValidationErrorTest.
@Test
public void getServiceInstanceIdForValidationErrorTest() {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
String requestScope = "vnf";
HashMap<String, String> instanceIdMap = new HashMap<String, String>();
instanceIdMap.put("serviceInstanceId", "testServiceInstanceId");
String serviceInstanceId = requestHandlerUtils.getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).get();
assertEquals("testServiceInstanceId", serviceInstanceId);
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestHandlerUtilsTest method test_mapJSONtoMSOStyle.
@Test
public void test_mapJSONtoMSOStyle() throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
String testRequest = inputStream("/ServiceInstanceDefault.json");
String resultString = requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, false, null);
ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class);
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
assertEquals("f7ce78bb-423b-11e7-93f8-0050569a796", modelInfo.getModelCustomizationUuid());
assertEquals("modelInstanceName", modelInfo.getModelInstanceName());
assertEquals("f7ce78bb-423b-11e7-93f8-0050569a7965", modelInfo.getModelInvariantUuid());
assertEquals("10", modelInfo.getModelUuid());
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestHandlerUtilsTest method setServiceInstanceIdReturnNullTest.
@Test
public void setServiceInstanceIdReturnNullTest() {
String requestScope = "vnf";
ServiceInstancesRequest sir = new ServiceInstancesRequest();
assertNull(requestHandlerUtils.setServiceInstanceId(requestScope, sir));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestHandlerUtilsTest method setServiceTypeTestALaCarte.
@Test
public void setServiceTypeTestALaCarte() throws JsonProcessingException {
String requestScope = ModelType.service.toString();
Boolean aLaCarteFlag = true;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
requestInfo.setSource("VID");
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
Service defaultService = new Service();
defaultService.setServiceType("testServiceTypeALaCarte");
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
assertEquals(serviceType, "testServiceTypeALaCarte");
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class RequestHandlerUtilsTest method getServiceInstanceIdForInstanceGroupTest.
@Test
public void getServiceInstanceIdForInstanceGroupTest() throws Exception {
ServiceInstancesRequest sir = mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
String requestScope = "instanceGroup";
String serviceInstanceId = requestHandlerUtils.getServiceInstanceIdForInstanceGroup(requestScope, sir).get();
assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc", serviceInstanceId);
}
Aggregations