aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java25
-rw-r--r--common/src/main/java/org/onap/so/constants/Status.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java)15
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java34
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java130
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java108
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java2
30 files changed, 248 insertions, 105 deletions
diff --git a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
new file mode 100644
index 0000000000..ccfd2f4de6
--- /dev/null
+++ b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.constants;
+
+public enum OrchestrationRequestFormat {
+ DETAIL, STATUSDETAIL
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java b/common/src/main/java/org/onap/so/constants/Status.java
index b791bf147b..b460418f0f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
+++ b/common/src/main/java/org/onap/so/constants/Status.java
@@ -18,12 +18,23 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.constants;
/*
* Enum for Status values returned by API Handler to Tail-F
*/
public enum Status {
- PENDING, IN_PROGRESS, COMPLETE, COMPLETED, FAILED, TIMEOUT, UNLOCKED, PENDING_MANUAL_TASK
+ PENDING,
+ IN_PROGRESS,
+ COMPLETE,
+ COMPLETED,
+ FAILED,
+ TIMEOUT,
+ UNLOCKED,
+ PENDING_MANUAL_TASK,
+ ABORTED,
+ ROLLED_BACK,
+ ROLLED_BACK_TO_ASSIGNED,
+ ROLLED_BACK_TO_CREATED
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index e236003631..3ada984b58 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -40,6 +40,36 @@ public class RequestStatus {
protected String extSystemErrorSource;
@JsonProperty("rollbackExtSystemErrorSource")
protected String rollbackExtSystemErrorSource;
+ @JsonProperty("flowStatus")
+ protected String flowStatus;
+ @JsonProperty("retryStatusMessage")
+ protected String retryStatusMessage;
+ @JsonProperty("rollbackStatusMessage")
+ protected String rollbackStatusMessage;
+
+ public String getFlowStatus() {
+ return flowStatus;
+ }
+
+ public void setFlowStatus(String flowStatus) {
+ this.flowStatus = flowStatus;
+ }
+
+ public String getRetryStatusMessage() {
+ return retryStatusMessage;
+ }
+
+ public void setRetryStatusMessage(String retryStatusMessage) {
+ this.retryStatusMessage = retryStatusMessage;
+ }
+
+ public String getRollbackStatusMessage() {
+ return rollbackStatusMessage;
+ }
+
+ public void setRollbackStatusMessage(String rollbackStatusMessage) {
+ this.rollbackStatusMessage = rollbackStatusMessage;
+ }
public String getExtSystemErrorSource() {
return extSystemErrorSource;
@@ -94,6 +124,8 @@ public class RequestStatus {
return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
.append("percentProgress", percentProgress).append("timestamp", timeStamp)
.append("extSystemErrorSource", extSystemErrorSource)
- .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).toString();
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("flowStatus", flowStatus)
+ .append("retryStatusMessage", retryStatusMessage).append("rollbackStatusMessage", rollbackStatusMessage)
+ .toString();
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java
index eb52625bb6..119a0a560e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java
@@ -31,7 +31,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.Providers;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.apihandlerinfra.Status;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.RequestError;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index 835a24c4ce..fdc51ffe24 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -56,6 +56,7 @@ import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstance
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index c582e429ff..d8a7cb3f5d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -33,6 +33,7 @@ import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index 47f978a9e2..113baf96e6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -50,6 +50,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index cbfe927adf..4bcc0d4111 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -63,6 +63,7 @@ import org.onap.so.apihandlerinfra.validation.ValidationRule;
import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs;
import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index b63e3916f3..ba69355d5e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -48,6 +48,8 @@ import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.OrchestrationRequestFormat;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -72,6 +74,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+
@Path("onap/so/infra/orchestrationRequests")
@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests")
@Component
@@ -95,7 +98,7 @@ public class OrchestrationRequests {
@Transactional
public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
@PathParam("version") String version, @QueryParam("includeCloudRequest") boolean includeCloudRequest,
- @QueryParam("extSystemErrorSource") boolean extSystemErrorSource) throws ApiException {
+ @QueryParam(value = "format") String format) throws ApiException {
String apiVersion = version.substring(1);
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
@@ -142,7 +145,7 @@ public class OrchestrationRequests {
throw validateException;
}
- Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, extSystemErrorSource);
+ Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format);
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
@@ -159,8 +162,8 @@ public class OrchestrationRequests {
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version,
- @QueryParam("includeCloudRequest") boolean includeCloudRequest,
- @QueryParam("extSystemErrorSource") boolean extSystemErrorSource) throws ApiException {
+ @QueryParam("includeCloudRequest") boolean includeCloudRequest, @QueryParam(value = "format") String format)
+ throws ApiException {
long startTime = System.currentTimeMillis();
@@ -197,7 +200,7 @@ public class OrchestrationRequests {
List<RequestProcessingData> requestProcessingData =
requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
- Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, extSystemErrorSource);
+ Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format);
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
@@ -269,9 +272,10 @@ public class OrchestrationRequests {
} else {
String status = infraActiveRequest.getRequestStatus();
- if (status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING")
- || status.equalsIgnoreCase("PENDING_MANUAL_TASK")) {
- infraActiveRequest.setRequestStatus("UNLOCKED");
+ if (Status.IN_PROGRESS.toString().equalsIgnoreCase(status)
+ || Status.PENDING.toString().equalsIgnoreCase(status)
+ || Status.PENDING_MANUAL_TASK.toString().equalsIgnoreCase(status)) {
+ infraActiveRequest.setRequestStatus(Status.UNLOCKED.toString());
infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
infraActiveRequest.setRequestId(requestId);
requestsDbClient.save(infraActiveRequest);
@@ -294,7 +298,7 @@ public class OrchestrationRequests {
}
protected Request mapInfraActiveRequestToRequest(InfraActiveRequests iar, boolean includeCloudRequest,
- boolean extSystemErrorSource) throws ApiException {
+ String format) throws ApiException {
String requestBody = iar.getRequestBody();
Request request = new Request();
@@ -303,9 +307,6 @@ public class OrchestrationRequests {
request.setRequestId(iar.getRequestId());
request.setRequestScope(iar.getRequestScope());
request.setRequestType(iar.getRequestAction());
- String rollbackStatusMessage = iar.getRollbackStatusMessage();
- String flowStatusMessage = iar.getFlowStatus();
- String retryStatusMessage = iar.getRetryStatusMessage();
String originalRequestId = iar.getOriginalRequestId();
if (originalRequestId != null) {
@@ -376,43 +377,15 @@ public class OrchestrationRequests {
String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
request.setFinishTime(endTimeStamp);
}
- String statusMessages = null;
+
RequestStatus status = new RequestStatus();
- if (iar.getStatusMessage() != null) {
- statusMessages = "STATUS: " + iar.getStatusMessage();
- }
- if (flowStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "FLOW STATUS: " + flowStatusMessage;
- } else {
- statusMessages = "FLOW STATUS: " + flowStatusMessage;
- }
- }
- if (retryStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "RETRY STATUS: " + retryStatusMessage;
- } else {
- statusMessages = "RETRY STATUS: " + retryStatusMessage;
- }
- }
- if (rollbackStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "ROLLBACK STATUS: " + rollbackStatusMessage;
- } else {
- statusMessages = "ROLLBACK STATUS: " + rollbackStatusMessage;
- }
- }
- if (statusMessages != null) {
- status.setStatusMessage(statusMessages);
- }
+
if (iar.getModifyTime() != null) {
String timeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getModifyTime()) + " GMT";
status.setTimeStamp(timeStamp);
}
- if (iar.getRequestStatus() != null) {
- status.setRequestState(iar.getRequestStatus());
- }
+ status.setRequestState(mapRequestStatusToRequest(iar, format));
if (iar.getProgress() != null) {
status.setPercentProgress(iar.getProgress().intValue());
@@ -430,17 +403,80 @@ public class OrchestrationRequests {
});
}
- mapExtSystemErrorSourceToRequest(iar, status, extSystemErrorSource);
+ mapRequestStatusAndExtSysErrSrcToRequest(iar, status, format);
request.setRequestStatus(status);
return request;
}
- protected void mapExtSystemErrorSourceToRequest(InfraActiveRequests iar, RequestStatus status,
- boolean extSystemErrorSource) {
- if (extSystemErrorSource) {
+ protected String mapRequestStatusToRequest(InfraActiveRequests iar, String format) {
+ if (iar.getRequestStatus() != null) {
+ if (!StringUtils.isBlank(format) && OrchestrationRequestFormat.DETAIL.toString().equalsIgnoreCase(format)) {
+ return iar.getRequestStatus();
+ } else {
+ if (Status.ABORTED.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK_TO_ASSIGNED.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK_TO_CREATED.toString().equalsIgnoreCase(iar.getRequestStatus())) {
+ return Status.FAILED.toString();
+ } else {
+ return iar.getRequestStatus();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void mapRequestStatusAndExtSysErrSrcToRequest(InfraActiveRequests iar, RequestStatus status,
+ String format) {
+ String rollbackStatusMessage = iar.getRollbackStatusMessage();
+ String flowStatusMessage = iar.getFlowStatus();
+ String retryStatusMessage = iar.getRetryStatusMessage();
+
+ String statusMessages = null;
+ if (iar.getStatusMessage() != null) {
+ statusMessages = "STATUS: " + iar.getStatusMessage();
+ }
+
+ if (OrchestrationRequestFormat.STATUSDETAIL.toString().equalsIgnoreCase(format)) {
+ if (flowStatusMessage != null) {
+ status.setFlowStatus(flowStatusMessage);
+ }
+ if (retryStatusMessage != null) {
+ status.setRetryStatusMessage(retryStatusMessage);
+ }
+ if (rollbackStatusMessage != null) {
+ status.setRollbackStatusMessage(rollbackStatusMessage);
+ }
status.setExtSystemErrorSource(iar.getExtSystemErrorSource());
status.setRollbackExtSystemErrorSource(iar.getRollbackExtSystemErrorSource());
+ } else {
+
+ if (flowStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "FLOW STATUS: " + flowStatusMessage;
+ } else {
+ statusMessages = "FLOW STATUS: " + flowStatusMessage;
+ }
+ }
+ if (retryStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "RETRY STATUS: " + retryStatusMessage;
+ } else {
+ statusMessages = "RETRY STATUS: " + retryStatusMessage;
+ }
+ }
+ if (rollbackStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "ROLLBACK STATUS: " + rollbackStatusMessage;
+ } else {
+ statusMessages = "ROLLBACK STATUS: " + rollbackStatusMessage;
+ }
+ }
+ }
+
+ if (statusMessages != null) {
+ status.setStatusMessage(statusMessages);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 86e2f5ce93..c3f323459c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -62,6 +62,7 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index d82fd38e9f..ed300d95c2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -40,6 +40,7 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.ErrorCode;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index b290a796e2..5b827d9cf8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -52,6 +52,7 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Recipe;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
index 5b51d85e41..bb5b4edfe4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -30,7 +30,6 @@ import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
import org.onap.so.client.aai.AAIObjectType;
@@ -38,6 +37,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index 227506c60e..b5b548a266 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -35,13 +35,13 @@ import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.Constants;
import org.onap.so.apihandlerinfra.MsoRequest;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java
index ebb5d7e119..7b095fc9d0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java
@@ -25,9 +25,9 @@ import java.util.HashMap;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.NetworkRecipe;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java
index 7d3091e950..afadf36157 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java
@@ -26,9 +26,9 @@ import java.util.HashMap;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java
index efd8b12b9a..0762803488 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java
@@ -26,8 +26,8 @@ import java.util.HashMap;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
index d98625fe50..e157d926f3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
@@ -26,8 +26,8 @@ import java.util.HashMap;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java
index 52f7ee9ac4..48a8aa2cd8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java
@@ -26,7 +26,7 @@ import java.util.HashMap;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.logger.LogConstants;
import org.onap.so.serviceinstancebeans.ModelType;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index e8d00ed52b..d3fb7986ce 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -42,7 +42,6 @@ import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
@@ -51,6 +50,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestReferences;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
index 007ea938a2..efdc52b837 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -30,7 +30,6 @@ import java.util.Map.Entry;
import javax.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
@@ -42,6 +41,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ResourceType;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 99ff4ffe9e..fc548a715e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -23,16 +23,10 @@ package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
import javax.ws.rs.core.Response;
-import org.apache.http.HttpStatus;
+import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -40,11 +34,11 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.constants.OrchestrationRequestFormat;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.InstanceReferences;
@@ -64,7 +58,6 @@ public class OrchestrationRequestsUnitTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@InjectMocks
- @Spy
private OrchestrationRequests orchestrationRequests;
private static final String REQUEST_ID = "7cb9aa56-dd31-41e5-828e-d93027d4ebba";
@@ -72,14 +65,13 @@ public class OrchestrationRequestsUnitTest {
private static final String ORIGINAL_REQUEST_ID = "8f2d38a6-7c20-465a-bd7e-075645f1394b";
private static final String SERVICE = "service";
private static final String EXT_SYSTEM_ERROR_SOURCE = "external system error source";
- private static final String ROLLBACK_EXT_SYSTEM_ERROR_SOURCE = "SDNC";
+ private static final String FLOW_STATUS = "FlowStatus";
+ private static final String RETRY_STATUS_MESSAGE = "RetryStatusMessage";
+ private static final String ROLLBACK_STATUS_MESSAGE = "RollbackStatusMessage";
private InfraActiveRequests iar;
boolean includeCloudRequest = false;
- boolean extSystemErrorSource = false;
-
- private static final String VERSION = "v7";
+ private static final String ROLLBACK_EXT_SYSTEM_ERROR_SOURCE = "SDNC";
- List<org.onap.so.db.request.beans.RequestProcessingData> requestProcessingData = new ArrayList<>();
@Before
public void setup() {
@@ -87,12 +79,6 @@ public class OrchestrationRequestsUnitTest {
iar.setRequestScope(SERVICE);
iar.setRequestId(REQUEST_ID);
iar.setServiceInstanceId(SERVICE_INSTANCE_ID);
- when(requestDbClient.getInfraActiveRequestbyRequestId(Mockito.eq(REQUEST_ID))).thenReturn(iar);
- when(requestDbClient.getRequestProcessingDataBySoRequestId(Mockito.eq(REQUEST_ID)))
- .thenReturn(requestProcessingData);
-
- when(builder.buildResponse(Mockito.eq(HttpStatus.SC_OK), Mockito.eq(REQUEST_ID), any(Object.class),
- any(String.class))).thenReturn(response);
}
@Test
@@ -100,6 +86,7 @@ public class OrchestrationRequestsUnitTest {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setOriginalRequestId(ORIGINAL_REQUEST_ID);
@@ -109,8 +96,8 @@ public class OrchestrationRequestsUnitTest {
iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
- Request result =
- orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, extSystemErrorSource);
+ Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
assertThat(result, sameBeanAs(expected));
}
@@ -119,22 +106,24 @@ public class OrchestrationRequestsUnitTest {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
- Request result =
- orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, extSystemErrorSource);
+ Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
assertThat(result, sameBeanAs(expected));
}
@Test
- public void mapExtSystemErrorSourceToRequestFalseTest() throws ApiException {
+ public void mapRequestStatusAndExtSysErrSrcToRequestFalseTest() throws ApiException {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
@@ -142,21 +131,24 @@ public class OrchestrationRequestsUnitTest {
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
- extSystemErrorSource = false;
includeCloudRequest = false;
- Request actual =
- orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, extSystemErrorSource);
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
assertThat(actual, sameBeanAs(expected));
}
@Test
- public void mapExtSystemErrorSourceToRequestTrueTest() throws ApiException {
+ public void mapRequestStatusAndExtSysErrSrcToRequestStatusDetailTest() throws ApiException {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
requestStatus.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setFlowStatus(FLOW_STATUS);
+ requestStatus.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ requestStatus.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
@@ -164,24 +156,44 @@ public class OrchestrationRequestsUnitTest {
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
- extSystemErrorSource = true;
includeCloudRequest = false;
iar.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
iar.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(FLOW_STATUS);
+ iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
- Request actual =
- orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, extSystemErrorSource);
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.STATUSDETAIL.toString());
assertThat(actual, sameBeanAs(expected));
}
@Test
- public void mapExtSystemErrorSourceToRequestMethodInvokedTest() throws ApiException, IOException {
- extSystemErrorSource = true;
+ public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ FLOW_STATUS, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
includeCloudRequest = false;
- orchestrationRequests.getOrchestrationRequest(REQUEST_ID, VERSION, includeCloudRequest, extSystemErrorSource);
+ iar.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
+ iar.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(FLOW_STATUS);
+ iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
- verify(orchestrationRequests, times(1)).mapExtSystemErrorSourceToRequest(Mockito.eq(iar), Mockito.any(),
- Mockito.eq(extSystemErrorSource));
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertThat(actual, sameBeanAs(expected));
}
@Test
@@ -190,4 +202,22 @@ public class OrchestrationRequestsUnitTest {
requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
assertThat(requestStatus.getExtSystemErrorSource(), is(equalTo(EXT_SYSTEM_ERROR_SOURCE)));
}
+
+ @Test
+ public void mapRequestStatusToRequestForFormatDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result =
+ orchestrationRequests.mapRequestStatusToRequest(iar, OrchestrationRequestFormat.DETAIL.toString());
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
+
+ @Test
+ public void mapRequestStatusToRequestForFormatEmptyStringTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, StringUtils.EMPTY);
+
+ assertEquals(Status.FAILED.toString(), result);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
index 91ca756a51..d4b0c3aad1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
@@ -41,6 +41,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
index 398966b0b3..1e755419be 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
@@ -52,6 +52,7 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.ModelInfo;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
index 8ff7517da8..59308215ac 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
@@ -40,9 +40,9 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.handler.NetworkRestHandler;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
index 56d57aa2d5..c1e6347943 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
@@ -41,10 +41,10 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
import org.onap.so.apihandlerinfra.infra.rest.handler.ServiceInstanceRestHandler;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
index 280ae9c071..7d146791fe 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
@@ -41,9 +41,9 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
index 2ea537b6ad..03725ec85b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
@@ -40,9 +40,9 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.handler.VnfRestHandler;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
index 2721f8a14a..efa27743ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
@@ -40,9 +40,9 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
import org.onap.so.apihandlerinfra.infra.rest.handler.VolumeRestHandler;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
index 9ae1e5b232..a74c11c08b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
@@ -35,9 +35,9 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.apihandlerinfra.BaseTest;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantIsolationRequest;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;