diff options
author | eeginux <henry.xie@est.tech> | 2019-05-23 10:51:36 +0100 |
---|---|---|
committer | eeginux <henry.xie@est.tech> | 2019-05-23 12:22:54 +0100 |
commit | 8ef2ec86175055aba4158f7ae571e259c7ddeddf (patch) | |
tree | 75c0d00865e33c2d231181d03924d59221d8dd71 /bpmn/MSOCommonBPMN/src/main/java | |
parent | b533bd8b7626e28ee708734065b4462ae368f121 (diff) |
exception handling
Update the appc client jar version
Throw exception for non success cds call
Fix CreateVcpeResCustServiceSimplifiedTest IT
Issue-ID: SO-1857 SO-1779
Change-Id: Ifee080600051c92fd964a92d16efb67e4ab05d5d
Signed-off-by: eeginux <henry.xie@est.tech>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java | 18 |
1 files changed, 17 insertions, 1 deletions
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); } } |