aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-07-05 10:23:16 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-07-05 10:23:22 -0400
commit0e2cda138f35ee6a7a8a54c29a6c4edf07d51745 (patch)
treebed0d4cdf6ad783a5a58a3f00f594d43e41902f7 /bpmn/so-bpmn-tasks/src/main
parent294a68f814de3820ae3d5fdcf976615ad233c11a (diff)
update bpmn to save extsystemerrorsource
Added ext error source to workflow exception Updated all lines that create this exception with source Added unit tests and updated existing ones Change-Id: Id9b3b1e6e24368224214a6370ea2d450ae667bfb Issue-ID: SO-2092 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java1
5 files changed, 52 insertions, 24 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index e5df3d3f35..f1fd23fe82 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,6 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -160,14 +161,15 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Call Sniro");
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage());
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
}
}
@@ -211,14 +213,16 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Process Solution");
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
+ "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
+ TargetEntity.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 859db11037..e9d33f46ab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,6 +38,7 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +94,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
@@ -138,7 +139,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
}
}
@@ -151,7 +152,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response");
+ "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -159,6 +160,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index fcc67d0ef7..9bbe94a077 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -29,8 +29,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.utils.TargetEntity;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +41,8 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCQueryTasks {
-
+ private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+ private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC.";
public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
@Autowired
private SDNCVnfResources sdncVnfResources;
@@ -63,8 +66,14 @@ public class SDNCQueryTasks {
}
String response = sdncVnfResources.queryVnf(genericVnf);
execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
@@ -88,6 +97,12 @@ public class SDNCQueryTasks {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
}
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -109,10 +124,16 @@ public class SDNCQueryTasks {
// If we see a bb object not found exception for something that is not a vf module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ }
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index cb761f4110..03714db943 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -37,6 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,17 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.");
+ "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.");
+ "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
+ TargetEntity.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
+ TargetEntity.SO);
}
}
@@ -120,16 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
} catch (Exception e) {
- logger.error("Error procesing SDNC callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ logger.error("Error processing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
+ TargetEntity.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response");
+ "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
@@ -149,5 +153,4 @@ public class SDNCRequestTasks {
}
return result;
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 44152fcaf4..a17556f091 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -312,7 +312,6 @@ public class WorkflowActionBBTasks {
}
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-
if (rollbackFlows.isEmpty())
execution.setVariable("isRollbackNeeded", false);
else