diff options
author | Steve Smokowski <ss835w@att.com> | 2019-05-23 13:41:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-05-23 13:41:44 +0000 |
commit | 16c6cc1e5cdaad24b92114ebf6c5396453194778 (patch) | |
tree | f1cec5cfe8a8afaa89176859f4498b18d20a080c /bpmn/MSOCommonBPMN | |
parent | 864ce56c3daff6a6a1f4b9ae1ebcb24c2aa87f2a (diff) | |
parent | 8ef2ec86175055aba4158f7ae571e259c7ddeddf (diff) |
Merge "exception handling" into dublin
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r-- | bpmn/MSOCommonBPMN/pom.xml | 4 | ||||
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 20be69c006..e233e6a7c6 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -311,7 +311,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>${appc.client.version}</version> <exclusions> <exclusion> <groupId>org.mockito</groupId> @@ -330,7 +330,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>${appc.client.version}</version> <exclusions> <exclusion> <groupId>org.mockito</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java index 6bfa67502d..5498b5be31 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java @@ -34,6 +34,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu import org.onap.so.client.PreconditionFailedException; import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +59,12 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { private static final String FAILED = "Failed"; private static final String PROCESSING = "Processing"; + /** + * indicate exception thrown. + */ + private static final String EXCEPTION = "Exception"; + + private final AtomicReference<String> cdsResponse = new AtomicReference<>(); @Autowired @@ -132,7 +139,15 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { } if (cdsResponse != null) { - execution.setVariable("CDSStatus", cdsResponse.get()); + String cdsResponseStatus = cdsResponse.get(); + execution.setVariable("CDSStatus", cdsResponseStatus); + + /** + * throw CDS failed exception. + */ + if (cdsResponseStatus != SUCCESS) { + throw new BadResponseException("CDS call failed with status: " + cdsResponseStatus); + } } } catch (Exception ex) { @@ -177,6 +192,7 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { public void onError(Throwable t) { Status status = Status.fromThrowable(t); logger.error("Failed processing blueprint {}", status, t); + cdsResponse.set(EXCEPTION); } } |