diff options
author | romaingimbert <romain.gimbert@orange.com> | 2018-05-24 15:43:39 +0200 |
---|---|---|
committer | romaingimbert <romain.gimbert@orange.com> | 2018-05-24 15:43:39 +0200 |
commit | 7692c19e7f232b1f72fa6ee4149532a8b50740db (patch) | |
tree | 0498f6a595a147418c539c6641ed031cf998a667 /src/main/java/org | |
parent | 37c7ea1c6a422099572f0ce652430d943284df48 (diff) |
orderitem id ko when so returns 202
- fix code
- change test
- add log
Change-Id: I88830af9600e7356e9ffcba3273a1826ac3ef0ca
Issue-ID: EXTAPI-93
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java | 12 |
1 files changed, 11 insertions, 1 deletions
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 f453dc2..24e137b 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 @@ -213,19 +213,25 @@ public class SOTaskProcessor { nbRetries++; orderItem.setState(StateType.INPROGRESS); Thread.sleep(1000); + LOGGER.debug("orderitem id {} still in progress from so",orderItem.getId()); } else if (RequestState.COMPLETE != response.getRequest().getRequestStatus().getRequestState()) { orderItem.setState(StateType.FAILED); stopPolling = true; + LOGGER.debug("orderitem id {} failed, response from request status {}",orderItem.getId(),response.getRequest().getRequestStatus().getRequestState()); } else { orderItem.setState(StateType.COMPLETED); stopPolling = true; + LOGGER.debug("orderitem id {} completed"); } } else { orderItem.setState(StateType.INPROGRESS); stopPolling = true; + LOGGER.debug("orderitem id {} still in progress from so",orderItem.getId()); } if (nbRetries == 3) { stopPolling = true; + LOGGER.debug("orderitem id {} stop polling from getrequeststatus, 3 retries done",orderItem.getId()); + } } } @@ -310,9 +316,10 @@ public class SOTaskProcessor { orderItem.setRequestId(createServiceInstanceResponse.getRequestReferences().getRequestId()); } - if (response.getStatusCode() != HttpStatus.CREATED || response.getBody() == null + if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null || response.getBody().getRequestReferences() == null) { orderItem.setState(StateType.FAILED); + LOGGER.warn("order item {} failed , status {} , response {}",orderItem.getId(),response.getStatusCode(),response.getBody()); } else { orderItem.setState(StateType.INPROGRESS); } @@ -339,11 +346,14 @@ public class SOTaskProcessor { List<ExecutionTask> executionTasksToDelete = findExecutionTasksRecursively(executionTask); for (ExecutionTask taskId : executionTasksToDelete) { executionTaskRepository.delete(taskId); + LOGGER.warn("task {} with orderitem id {} deleted cause orderitem id {} failed ",taskId.getInternalId(),taskId.getOrderItemId(),executionTask.getOrderItemId()); } for (ServiceOrderItem item : serviceOrder.getOrderItem()) { for (ExecutionTask taskToDelete : executionTasksToDelete) { if (taskToDelete.getOrderItemId().equals(item.getId())) { item.setState(StateType.FAILED); + LOGGER.warn("task {} with orderitem id {} to failed cause orderitem id {} failed ",taskToDelete.getInternalId(),taskToDelete.getOrderItemId(),executionTask.getOrderItemId()); + } } } |