aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2018-05-24 11:32:30 +0200
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2018-05-24 11:49:26 +0200
commit155f10aee25fc1f89929e13a4a62a8335ee33279 (patch)
tree8c7a34799293f1497c3bd68387415743e061aa48 /mso-api-handlers/mso-api-handler-infra
parent3ad1f7e9fd56d2d0eb9f0bde46b5b48cea9ed97a (diff)
Revert correlationId impl
This reverts commit c40b51651eff7997eb1bc823644a059b5406868c. Change-Id: I99e03cf9be05110ca7b4609a35ce7106f3c30b3b Issue-ID: SO-640 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java81
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java88
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java102
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java78
5 files changed, 251 insertions, 103 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index dca2069cec..23adafd08e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -43,7 +43,6 @@ import org.json.JSONObject;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
-import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.apihandler.common.ResponseHandler;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
@@ -83,6 +82,8 @@ public class E2EServiceInstances {
private ServiceInstancesRequest sir = null;
public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+ public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
+ public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
/**
* POST Requests for E2E Service create Instance on a version provided
@@ -227,6 +228,7 @@ public class E2EServiceInstances {
// Define RecipeLookupResult info here instead of query DB for efficiency
String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance";
+ int recipeTimeout = 180;
RequestClient requestClient = null;
HttpResponse response = null;
@@ -237,15 +239,14 @@ public class E2EServiceInstances {
requestClient = RequestClientFactory.getRequestClient(workflowUrl, MsoPropertiesUtils.loadMsoProperties());
JSONObject jjo = new JSONObject(requestJSON);
+ String bpmnRequest = jjo.toString();
// Capture audit event
msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
- setBaseVfModule(false).setRecipeTimeout(180).setRequestAction(action.name()).
- setServiceInstanceId(instanceIdMap.get("serviceId")).setServiceType(e2eCompareModelReq.getServiceType()).
- setRequestDetails(jjo.toString()).build();
-
- response = requestClient.post(requestClientParamater);
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceType = e2eCompareModelReq.getServiceType();
+ response = requestClient.post(requestId, false, recipeTimeout, action.name(), serviceId, null, null, null,
+ null, null, serviceType, null, null, null, bpmnRequest, null);
msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"Successfully received response from BPMN engine", "BPMN", workflowUrl, null);
@@ -439,6 +440,8 @@ public class E2EServiceInstances {
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
try {
requestClient = RequestClientFactory.getRequestClient(
recipeLookupResult.getOrchestrationURI(),
@@ -446,16 +449,19 @@ public class E2EServiceInstances {
JSONObject jjo = new JSONObject(requestJSON);
jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+ String bpmnRequest = jjo.toString();
+
// Capture audit event
msoLogger
.debug("MSO API Handler Posting call to BPEL engine for url: "
+ requestClient.getUrl());
-
- RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
- setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).
- setRequestAction(action.name()).setServiceType(e2eDelReq.getServiceType()).
- setRequestDetails(jjo.toString()).setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
- response = requestClient.post(requestClientParamater);
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eDelReq.getServiceType();
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, null, serviceInstanceType,
+ null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime,
MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
@@ -558,6 +564,12 @@ public class E2EServiceInstances {
return response;
}
+ //check for the current operation status
+// Response resp = checkE2ESvcInstStatus(action, serviceId, startTime, msoRequest);
+// if(resp != null && resp.getStatus() != 200) {
+// return resp;
+// }
+
CatalogDatabase db = null;
RecipeLookupResult recipeLookupResult = null;
try {
@@ -603,19 +615,18 @@ public class E2EServiceInstances {
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
try {
requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
MsoPropertiesUtils.loadMsoProperties());
// Capture audit event
msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
- setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
- setServiceInstanceId(serviceId).setServiceType(serviceInstanceType).
- setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)).
- setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
- response = requestClient.post(requestClientParamater);
+ response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
+ recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
@@ -741,23 +752,25 @@ public class E2EServiceInstances {
return response;
}
+ String serviceInstanceType = e2eSir.getService().getServiceType();
+
+ String serviceId = "";
RequestClient requestClient = null;
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
try {
requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
MsoPropertiesUtils.loadMsoProperties());
// Capture audit event
msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
- setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
- setServiceInstanceId("").setServiceType(e2eSir.getService().getServiceType()).
- setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)).
- setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
- response = requestClient.post(requestClientParamater);
+ response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
+ recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
@@ -884,6 +897,8 @@ public class E2EServiceInstances {
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
try {
requestClient = RequestClientFactory.getRequestClient(
recipeLookupResult.getOrchestrationURI(),
@@ -892,18 +907,18 @@ public class E2EServiceInstances {
JSONObject jjo = new JSONObject(requestJSON);
jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+ String bpmnRequest = jjo.toString();
+
// Capture audit event
msoLogger
.debug("MSO API Handler Posting call to BPEL engine for url: "
+ requestClient.getUrl());
- RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
- setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
- setServiceInstanceId(instanceIdMap.get("serviceId")).
- setServiceType(e2eScaleReq.getService().getServiceType()).
- setRequestDetails(jjo.toString()).
- setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
-
- response = requestClient.post(requestClientParamater);
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eScaleReq.getService().getServiceType();
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, null, serviceInstanceType,
+ null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime,
MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 3f6cc35432..2f2ef313f4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -85,6 +85,7 @@ public class MsoRequest {
private String requestId;
private String requestXML;
+ private String requestJSON;
private String requestUri;
private VnfRequest vnfReq;
private RequestInfo requestInfo;
@@ -117,6 +118,8 @@ public class MsoRequest {
private OwningEntity owningEntity;
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String NOT_PROVIDED = "not provided";
+
protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
MsoRequest (String requestId) {
@@ -1150,7 +1153,7 @@ public class MsoRequest {
mapper.setSerializationInclusion(Include.NON_NULL);
//mapper.configure(Feature.WRAP_ROOT_VALUE, true);
msoLogger.debug ("building sir from object " + sir);
- String requestJSON = mapper.writeValueAsString(sir);
+ requestJSON = mapper.writeValueAsString(sir);
// Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
index 581ad34939..e16963db3b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -20,7 +20,6 @@
*/
package org.openecomp.mso.apihandlerinfra;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -43,7 +42,6 @@ import org.openecomp.mso.apihandler.common.CommonConstants;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
-import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.apihandler.common.ResponseHandler;
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.serviceinstancebeans.ModelInfo;
@@ -692,7 +690,37 @@ public class ServiceInstances {
}
db.close();
- msoLogger.debug ("requestId is: " + msoRequest.getRequestId());
+
+ String serviceInstanceId = "";
+ String vnfId = "";
+ String vfModuleId = "";
+ String volumeGroupId = "";
+ String networkId = "";
+ ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
+
+ if(siReq.getServiceInstanceId () != null){
+ serviceInstanceId = siReq.getServiceInstanceId ();
+ }
+
+ if(siReq.getVnfInstanceId () != null){
+ vnfId = siReq.getVnfInstanceId ();
+ }
+
+ if(siReq.getVfModuleInstanceId () != null){
+ vfModuleId = siReq.getVfModuleInstanceId ();
+ }
+
+ if(siReq.getVolumeGroupInstanceId () != null){
+ volumeGroupId = siReq.getVolumeGroupInstanceId ();
+ }
+
+ if(siReq.getNetworkInstanceId () != null){
+ networkId = siReq.getNetworkInstanceId ();
+ }
+
+
+ requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
msoLogger.debug ("About to insert a record");
try {
@@ -708,32 +736,15 @@ public class ServiceInstances {
return response;
}
- return postBPELRequest(action, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(),
- recipeLookupResult.getRecipeTimeout(), isBaseVfModule);
+ return postBPELRequest(action, requestId, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(),
+ isBaseVfModule, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, null,
+ msoRequest.getServiceInstanceType(), msoRequest.getVnfType(), msoRequest.getVfModuleType(), msoRequest.getNetworkType());
}
- private RequestClientParamater buildRequestClientParameter(MsoRequest msoRequest, boolean isBaseVfModule,
- int timeOut, String requestAction) throws IOException {
- return new RequestClientParamater.Builder().
- setRequestId(msoRequest.getRequestId()).
- setBaseVfModule(isBaseVfModule).setRecipeTimeout(timeOut).
- setRequestAction(requestAction).
- setServiceInstanceId(msoRequest.getServiceInstancesRequest().getServiceInstanceId()).
- setCorrelationId(msoRequest.getServiceInstancesRequest().getCorrelationId()).
- setVnfId(msoRequest.getServiceInstancesRequest().getVnfInstanceId()).
- setVfModuleId(msoRequest.getServiceInstancesRequest().getVfModuleInstanceId()).
- setVolumeGroupId(msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId()).
- setNetworkId(msoRequest.getServiceInstancesRequest().getNetworkInstanceId()).
- setConfigurationId(msoRequest.getServiceInstancesRequest().getConfigurationId()).
- setServiceType(msoRequest.getServiceInstanceType()).
- setVnfType(msoRequest.getVnfType()).
- setVfModuleType(msoRequest.getVfModuleType()).
- setNetworkType(msoRequest.getNetworkType()).
- setRequestDetails(msoRequest.getRequestJSON()).build();
- }
-
- private Response postBPELRequest(Action action, long startTime, MsoRequest msoRequest,
- String orchestrationUri, int timeOut, Boolean isBaseVfModule) {
+ private Response postBPELRequest(Action action, String requestId, long startTime, MsoRequest msoRequest,
+ String orchestrationUri, int timeOut, Boolean isBaseVfModule,
+ String serviceInstanceId, String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType) {
RequestClient requestClient = null;
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
@@ -743,7 +754,12 @@ public class ServiceInstances {
System.out.println("URL : " + requestClient.getUrl ());
- response = requestClient.post(buildRequestClientParameter(msoRequest, isBaseVfModule, timeOut, action.name()));
+ response = requestClient.post(requestId, isBaseVfModule, timeOut, action.name (),
+ serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
+ msoRequest.getServiceInstanceType (),
+ msoRequest.getVnfType (), msoRequest.getVfModuleType (),
+ msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null);
+
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null);
} catch (Exception e) {
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null);
@@ -1175,6 +1191,7 @@ public class ServiceInstances {
return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
}
+
private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
@@ -1282,6 +1299,18 @@ public class ServiceInstances {
return response;
}
+
+ String serviceInstanceId = "";
+ String configurationId = "";
+ ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
+
+ if(siReq.getServiceInstanceId () != null){
+ serviceInstanceId = siReq.getServiceInstanceId ();
+ }
+
+ if(siReq.getConfigurationId() != null){
+ configurationId = siReq.getConfigurationId();
+ }
requestId = msoRequest.getRequestId ();
msoLogger.debug ("requestId is: " + requestId);
@@ -1299,6 +1328,7 @@ public class ServiceInstances {
return response;
}
- return postBPELRequest(action, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false);
+ return postBPELRequest(action, requestId, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false,
+ serviceInstanceId, null, null, null, null, configurationId, null, null, null, null);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
index 901e03fc17..60ac6b98c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -40,12 +40,12 @@ import org.junit.Test;
import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
-import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.Service;
import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.properties.MsoDatabaseException;
import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.OperationStatus;
@@ -194,7 +194,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -253,7 +258,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
@@ -313,7 +323,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
@@ -373,7 +388,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
HttpResponse resp = null;
return resp;
}
@@ -605,7 +625,12 @@ public class E2EServiceInstancesTest {
final MockUp<CamundaClient> mockCmaundaClient = new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd)
+ throws ClientProtocolException, IOException {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -797,7 +822,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -858,7 +888,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -920,7 +955,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -987,7 +1027,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -1048,7 +1093,12 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -1110,7 +1160,12 @@ public class E2EServiceInstancesTest {
MockUp<CamundaClient> client = new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) throws Exception {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) throws Exception {
throw new Exception();
}
};
@@ -1137,7 +1192,13 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) throws IOException {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd)
+ throws ClientProtocolException, IOException {
+
throw new ClientProtocolException();
}
};
@@ -1155,7 +1216,13 @@ public class E2EServiceInstancesTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd)
+ throws ClientProtocolException, IOException {
+
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"compareModelwithTargetVersion, test response");
@@ -1224,7 +1291,12 @@ public class E2EServiceInstancesTest {
final MockUp<CamundaClient> mockCamundaClient = new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String configurationId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
index 938a1038a4..50f00ef6a4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -21,16 +21,6 @@
package org.openecomp.mso.apihandlerinfra;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import javax.ws.rs.core.Response;
-import mockit.Mock;
-import mockit.MockUp;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.entity.BasicHttpEntity;
@@ -40,23 +30,33 @@ import org.hibernate.criterion.Order;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
-import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.*;
import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
+import mockit.Mock;
+import mockit.MockUp;
+
public class ServiceInstanceTest {
/*** Create Service Instance Test Cases ***/
@@ -225,7 +225,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -291,7 +295,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -358,7 +366,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -425,7 +437,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater){
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
return null;
}
};
@@ -907,7 +923,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -1072,7 +1092,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater){
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -1119,7 +1143,11 @@ public class ServiceInstanceTest {
new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(RequestClientParamater requestClientParamater) {
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();