summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
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.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java12
8 files changed, 38 insertions, 33 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 8cb5935634..dca2069cec 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
@@ -970,7 +970,7 @@ public class E2EServiceInstances {
HashMap<String, String> instanceIdMap) {
// BPMN accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_ACCEPTED) {
- String camundaJSONResponseBody = respHandler.getResponseBody();
+ String camundaJSONResponseBody = respHandler.getContent();
msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
msoLogger.recordAuditEvent(startTime,
MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
@@ -981,7 +981,7 @@ public class E2EServiceInstances {
} else {
List<String> variables = new ArrayList<>();
variables.add(bpelStatus + "");
- String camundaJSONResponseBody = respHandler.getResponseBody();
+ String camundaJSONResponseBody = respHandler.getContent();
if (camundaJSONResponseBody != null
&& !camundaJSONResponseBody.isEmpty()) {
Response resp = msoRequest.buildServiceErrorResponse(
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
index b809fc24c0..216a7ba43b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
@@ -37,6 +37,8 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.http.HttpStatus;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
import org.openecomp.mso.logger.MessageEnum;
@@ -300,7 +302,7 @@ public class OrchestrationRequests {
Request request = new Request();
ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
request.setRequestId(requestDB.getRequestId());
request.setRequestScope(requestDB.getRequestScope());
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 2070b2286c..581ad34939 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
@@ -782,7 +782,7 @@ public class ServiceInstances {
// BPEL accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_ACCEPTED) {
- String camundaJSONResponseBody = respHandler.getResponseBody ();
+ String camundaJSONResponseBody = respHandler.getContent();
msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
(RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (),
@@ -795,7 +795,7 @@ public class ServiceInstances {
} else {
List<String> variables = new ArrayList<>();
variables.add(bpelStatus + "");
- String camundaJSONResponseBody = respHandler.getResponseBody ();
+ String camundaJSONResponseBody = respHandler.getContent();
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
@@ -968,15 +968,15 @@ public class ServiceInstances {
RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters();
if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){
return null;
+ } else if (recipe==null) {
+ //aLaCarte wasn't sent, so we'll try the default
+ serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
+ if (serviceRecord == null) {
+ serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+ }
+ recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
}
- //aLaCarte wasn't sent, so we'll try the default
- serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
- if (serviceRecord == null) {
- serviceRecord = db.getServiceByModelName(defaultServiceModelName);
- }
-
- recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
if(modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(serviceRecord.getModelUUID());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
index 368807f9c9..9aac16aa4c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
@@ -176,7 +176,7 @@ public class TasksHandler {
msoLogger.debug ("Received good response from Camunda");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
- String respBody = respHandler.getResponseBody();
+ String respBody = respHandler.getContent();
if (respBody != null) {
JSONArray data = new JSONArray(respBody);
@@ -276,7 +276,7 @@ public class TasksHandler {
msoLogger.debug ("Received good response from Camunda");
msoLogger.recordAuditEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
- String respBody = respHandler.getResponseBody();
+ String respBody = respHandler.getContent();
if (respBody != null) {
taskList = buildTaskList(taskId, respBody);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java
index 4801811c41..ecbe97c637 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -281,10 +281,11 @@ public class CloudOrchestration {
private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime,
CloudOrchestrationRequest cor) throws Exception {
+ CloudOrchestrationRequest new_cor = null;
try{
msoLogger.debug("Converting incoming JSON request to Object");
ObjectMapper mapper = new ObjectMapper();
- cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
+ new_cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(Exception e){
msoLogger.debug ("Mapping of request to JSON object failed : ", e);
if (getTenantIsolationRequest().getRequestId () != null) {
@@ -295,7 +296,7 @@ public class CloudOrchestration {
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
throw new Exception(e);
}
- return cor;
+ return new_cor;
}
public TenantIsolationRequest getTenantIsolationRequest() {
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 5c4ddfb56e..901e03fc17 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
@@ -199,7 +199,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -258,7 +258,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -318,7 +318,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"\",\"message\":\"success\"}";
+ String body = "{\"content\":\"\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -609,7 +609,7 @@ public class E2EServiceInstancesTest {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -802,7 +802,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -863,7 +863,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -925,7 +925,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -992,7 +992,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1053,7 +1053,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1160,7 +1160,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"compareModelwithTargetVersion, test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1229,7 +1229,7 @@ public class E2EServiceInstancesTest {
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
index fa1cce462f..048efb1781 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
@@ -203,6 +203,7 @@ public class OrchestrationRequestsTest {
throws JsonParseException, JsonMappingException, IOException, ValidationException {
ObjectMapper mapper = new ObjectMapper();
String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
+ //String requestJSON = "{\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"Vfmodule_vLB-0514-1\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"80d62376-2d6d-4618-b666-bf00d0e58296\",\"modelVersionId\":\"578b52e5-4572-444d-8de7-2c140ec2e6e5\",\"modelName\":\"Vloadbalancer..base_vlb..module-0\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"bf87db73-2854-4cd1-adfd-8cd08e12befe\",\"modelCustomizationName\":\"Vloadbalancer..base_vlb..module-0\"},\"requestParameters\":{\"usePreload\":true},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"RegionOne\",\"tenantId\":\"ebb0ea7144004bacac1e39ff23105fa7\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"60e28eb9-2808-4a5a-830f-ec982f01dcfe\",\"modelInfo\":{\"modelType\":\"service\",\"modelName\":\"vLoadBalancer\",\"modelInvariantId\":\"3f95e3ed-394d-4301-8c9b-c5f39ff89cfd\",\"modelVersion\":\"1.0\",\"modelVersionId\":\"da1b5347-7bcb-4cc4-8c29-d18dafdb1a47\"}}},{\"relatedInstance\":{\"instanceId\":\"338811a1-f7cd-4093-9903-d0f69b7cb176\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelName\":\"vLoadBalancer\",\"modelInvariantId\":\"040740de-1ce8-4737-ad39-970684b0e3e8\",\"modelVersion\":\"1.0\",\"modelVersionId\":\"5fd1ce25-c414-4baf-903b-5042a60cfb02\",\"modelCustomizationId\":\"5801ace5-7cc7-4011-b677-165a0e8a2a27\",\"modelCustomizationName\":\"vLoadBalancer 0\"}}}]}}";
MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -222,6 +223,7 @@ public class OrchestrationRequestsTest {
infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
infraRequests.setRequestStatus(Status.IN_PROGRESS.name());
infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ infraRequests.setRequestBody(requestJSON);
return infraRequests;
}
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 a86a993fa6..938a1038a4 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
@@ -229,7 +229,7 @@ public class ServiceInstanceTest {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -295,7 +295,7 @@ public class ServiceInstanceTest {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -362,7 +362,7 @@ public class ServiceInstanceTest {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -912,7 +912,7 @@ public class ServiceInstanceTest {
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1077,7 +1077,7 @@ public class ServiceInstanceTest {
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1124,7 +1124,7 @@ public class ServiceInstanceTest {
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);