Search in sources :

Example 1 with RequestInfo

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");
}
Also used : Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 2 with RequestInfo

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");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 3 with RequestInfo

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");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 4 with RequestInfo

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");
}
Also used : Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 5 with RequestInfo

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");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Aggregations

RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)34 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)27 Test (org.junit.Test)20 Service (org.onap.so.db.catalog.beans.Service)17 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)15 HashMap (java.util.HashMap)12 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)12 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)11 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)11 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)11 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)9 ValidationException (org.onap.so.exceptions.ValidationException)6 File (java.io.File)5 RequestParameters (org.onap.so.serviceinstancebeans.RequestParameters)5 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)4 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)4 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)3 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)2 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)2 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)2