use of org.onap.so.serviceinstancebeans.RequestInfo 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.RequestInfo in project so by onap.
the class RequestHandlerUtilsTest method setServiceTypeTestDefault.
@Test
public void setServiceTypeTestDefault() throws JsonProcessingException {
String requestScope = ModelType.service.toString();
Boolean aLaCarteFlag = false;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
requestInfo.setSource("VID");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
Service defaultService = new Service();
defaultService.setServiceType("testServiceType");
wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
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, "testServiceType");
}
use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.
the class RequestHandlerUtilsTest method setServiceTypeTest.
@Test
public void setServiceTypeTest() throws JsonProcessingException {
String requestScope = ModelType.service.toString();
Boolean aLaCarteFlag = false;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
requestInfo.setSource("VID");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
Service defaultService = new Service();
defaultService.setServiceType("testServiceType");
wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")).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, "testServiceType");
}
use of org.onap.so.serviceinstancebeans.RequestInfo in project so by onap.
the class ServiceInstancesTest 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.RequestInfo in project so by onap.
the class ServiceInstancesTest 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");
}
Aggregations