diff options
author | Chan, Mercy <merce.chan@att.com> | 2019-07-01 08:07:17 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-07-01 08:10:00 -0400 |
commit | 0d562688867a1b2e7a34ee6416cd54f7a9f6b89e (patch) | |
tree | 502d37dc8a666f8adbdf0b3ffc8c65d1c5f079ec /common/src/main/java/org | |
parent | cabd51660c3c8ec52e329027179f5c6cabb03aca (diff) |
support new query param format
- added format query parameter (optional), implemented logic to
populate requestStatus field based on whether or not format is present
moved request status constants to its own class visible globally.
- changed @requestParam to @QueryParam in GET endpoint
(OrchestrationRequests class. updated unit tests to call method being
tested directly rather than from another private function
- moved setting requestStatus to a separate method, also updated unit
tests to separate out each scenarion into its own method
- added unit test for when format=detail, corrected existing unit tests
to test result to be FAILED
- updated Status.java to include extra request status values; moved
Status class to common org.onap.so.constants package
Change-Id: Ic593de5fdfdcbc3121f481c86d1e261406082260
Issue-ID: SO-2080
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/main/java/org')
3 files changed, 98 insertions, 1 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/common/src/main/java/org/onap/so/constants/Status.java b/common/src/main/java/org/onap/so/constants/Status.java new file mode 100644 index 0000000000..b460418f0f --- /dev/null +++ b/common/src/main/java/org/onap/so/constants/Status.java @@ -0,0 +1,40 @@ +/*- + * ============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; + + +/* + * 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, + 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(); } } |