aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-08-16 13:05:39 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-16 13:05:39 +0000
commit1dd013480975fdfbae36fe71d37e845679d5690c (patch)
tree5ded54e21d150730086effea8b2430489e86505d /mso-api-handlers
parent07f92a81e5dfe76ad801ff321195d4b938498ab4 (diff)
parent5de97ac3cb0e91b0717e5379d26c7360f1c64993 (diff)
Merge "apih format statusdetail to return granular"
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java8
2 files changed, 14 insertions, 1 deletions
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 6f36fb2aff..a5ccb1b29b 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
@@ -42,6 +42,7 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.EnumUtils;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
@@ -411,7 +412,11 @@ public class OrchestrationRequests {
protected String mapRequestStatusToRequest(InfraActiveRequests iar, String format) {
if (iar.getRequestStatus() != null) {
- if (!StringUtils.isBlank(format) && OrchestrationRequestFormat.DETAIL.toString().equalsIgnoreCase(format)) {
+ boolean requestFormat = false;
+ if (format != null) {
+ requestFormat = EnumUtils.isValidEnum(OrchestrationRequestFormat.class, format.toUpperCase());
+ }
+ if (requestFormat) {
return iar.getRequestStatus();
} else {
if (Status.ABORTED.toString().equalsIgnoreCase(iar.getRequestStatus())
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 5023155768..f672648a6b 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
@@ -295,6 +295,14 @@ public class OrchestrationRequestsUnitTest {
assertEquals(Status.ABORTED.toString(), result);
}
+ @Test
+ public void mapRequestStatusToRequestForFormatStatusDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, "statusDetail");
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
@Test
public void mapRequestStatusToRequestForFormatEmptyStringTest() throws ApiException {