aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Geerebaert <matthieu.geerebaert@orange.com>2018-04-23 13:33:57 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-23 13:33:57 +0000
commitd4448d2d7a388ceefee8371e5d652f18f5000d81 (patch)
tree5d5786b3eaca68d9a0c94c96258245b045d94a94
parent9fcb9f78249de1e8d0bbe47044b8706faa0970d0 (diff)
parent960fda8db5fee3c75c260a5e791daff662d7e7d6 (diff)
Merge "Fix Missing requestDetails wrapper in SO payload"
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java20
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java40
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java25
3 files changed, 55 insertions, 30 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
index c3e41f4..5f10d63 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
@@ -18,17 +18,13 @@ package org.onap.nbi.apis.serviceorder;
import org.onap.nbi.OnapComponentsUrlPaths;
import org.onap.nbi.apis.serviceorder.model.consumer.CreateServiceInstanceResponse;
import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
-import org.onap.nbi.apis.serviceorder.model.consumer.RequestDetails;
+import org.onap.nbi.apis.serviceorder.model.consumer.MSOPayload;
import org.onap.nbi.exceptions.BackendFunctionalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@@ -57,15 +53,15 @@ public class SoClient {
private static final Logger LOGGER = LoggerFactory.getLogger(SoClient.class);
- public ResponseEntity<CreateServiceInstanceResponse> callCreateServiceInstance(RequestDetails requestDetails) {
+ public ResponseEntity<CreateServiceInstanceResponse> callCreateServiceInstance(MSOPayload msoPayload) {
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO CreateServiceInstance with requestDetails : " + requestDetails.toString());
+ LOGGER.debug("Calling SO CreateServiceInstance with msoPayload : " + msoPayload.toString());
}
String url = soHostname + OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH;
- HttpEntity<RequestDetails> requestDetailEntity = new HttpEntity<>(requestDetails, buildRequestHeader());
+ HttpEntity<MSOPayload> requestDetailEntity = new HttpEntity<>(msoPayload, buildRequestHeader());
try {
ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url, HttpMethod.POST,
@@ -80,16 +76,16 @@ public class SoClient {
}
}
- public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(RequestDetails requestDetails,
+ public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(MSOPayload msoPayload,
String serviceId) {
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO DeleteServiceInstance with requestDetails : " + requestDetails.toString());
+ LOGGER.debug("Calling SO DeleteServiceInstance with msoPayload : " + msoPayload.toString());
}
String url = soHostname + OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH + serviceId;
- HttpEntity<RequestDetails> requestDetailEntity = new HttpEntity<>(requestDetails, buildRequestHeader());
+ HttpEntity<MSOPayload> requestDetailEntity = new HttpEntity<>(msoPayload, buildRequestHeader());
try {
ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url, HttpMethod.DELETE,
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java
new file mode 100644
index 0000000..76415c3
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2018 Orange
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class MSOPayload {
+
+ private RequestDetails requestDetails;
+
+ public MSOPayload(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ @Override
+ public String toString() {
+ return "MSOPayload{" +
+ "requestDetails=" + requestDetails +
+ '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
index 84a198c..71f1320 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -13,27 +13,12 @@
*/
package org.onap.nbi.apis.serviceorder.workflow;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
import org.onap.nbi.apis.serviceorder.SoClient;
import org.onap.nbi.apis.serviceorder.model.ServiceCharacteristic;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
import org.onap.nbi.apis.serviceorder.model.StateType;
-import org.onap.nbi.apis.serviceorder.model.consumer.CloudConfiguration;
-import org.onap.nbi.apis.serviceorder.model.consumer.CreateServiceInstanceResponse;
-import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
-import org.onap.nbi.apis.serviceorder.model.consumer.ModelInfo;
-import org.onap.nbi.apis.serviceorder.model.consumer.RequestDetails;
-import org.onap.nbi.apis.serviceorder.model.consumer.RequestInfo;
-import org.onap.nbi.apis.serviceorder.model.consumer.RequestParameters;
-import org.onap.nbi.apis.serviceorder.model.consumer.RequestState;
-import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
-import org.onap.nbi.apis.serviceorder.model.consumer.UserParams;
+import org.onap.nbi.apis.serviceorder.model.consumer.*;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfoJson;
@@ -49,6 +34,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.io.IOException;
+import java.util.*;
+
@Service
public class SOTaskProcessor {
@@ -147,14 +135,15 @@ public class SOTaskProcessor {
RequestDetails requestDetails = buildSoRequest(serviceOrderItem,
serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()).getCatalogResponse(),
serviceOrderInfo.getSubscriberInfo());
+ MSOPayload msoPayload = new MSOPayload(requestDetails);
ResponseEntity<CreateServiceInstanceResponse> response = null;
switch (serviceOrderItem.getAction()) {
case ADD:
- response = soClient.callCreateServiceInstance(requestDetails);
+ response = soClient.callCreateServiceInstance(msoPayload);
break;
case DELETE:
- response = soClient.callDeleteServiceInstance(requestDetails, serviceOrderItem.getService().getId());
+ response = soClient.callDeleteServiceInstance(msoPayload, serviceOrderItem.getService().getId());
break;
default:
break;