aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-05-24 15:43:39 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-05-24 15:43:39 +0200
commit7692c19e7f232b1f72fa6ee4149532a8b50740db (patch)
tree0498f6a595a147418c539c6641ed031cf998a667
parent37c7ea1c6a422099572f0ce652430d943284df48 (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>
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java12
-rw-r--r--src/test/resources/mappings/so_delete_service_instance.json2
2 files changed, 12 insertions, 2 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());
+
}
}
}
diff --git a/src/test/resources/mappings/so_delete_service_instance.json b/src/test/resources/mappings/so_delete_service_instance.json
index d89c184..b294d0b 100644
--- a/src/test/resources/mappings/so_delete_service_instance.json
+++ b/src/test/resources/mappings/so_delete_service_instance.json
@@ -4,7 +4,7 @@
"url": "/ecomp/mso/infra/serviceInstances/v4/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
},
"response": {
- "status": 201,
+ "status": 202,
"headers": {
"Content-Type": "application/json"
},