summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-05-23 13:41:44 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-23 13:41:44 +0000
commit16c6cc1e5cdaad24b92114ebf6c5396453194778 (patch)
treef1cec5cfe8a8afaa89176859f4498b18d20a080c /bpmn
parent864ce56c3daff6a6a1f4b9ae1ebcb24c2aa87f2a (diff)
parent8ef2ec86175055aba4158f7ae571e259c7ddeddf (diff)
Merge "exception handling" into dublin
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java18
-rw-r--r--bpmn/pom.xml1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java70
5 files changed, 55 insertions, 42 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);
}
}
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index c4aad4ba69..fd070bb81b 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -25,6 +25,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sdnc.northbound.version>1.5.1</sdnc.northbound.version>
+ <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
</properties>
<modules>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
index f489a27052..9a1a7ed628 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
@@ -30,7 +30,7 @@
<bpmn:incoming>SequenceFlow_17llfxw</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p0aqtx</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:exclusiveGateway id="ExclusiveGateway_0vtv1wi">
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0vtv1wi" default="SequenceFlow_1w4p9f7">
<bpmn:incoming>SequenceFlow_0p0aqtx</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1owbpsy</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1w4p9f7</bpmn:outgoing>
@@ -49,7 +49,7 @@
<bpmn:incoming>SequenceFlow_0jfgn7n</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_08voj55</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:exclusiveGateway id="ExclusiveGateway_01jwwmc">
+ <bpmn:exclusiveGateway id="ExclusiveGateway_01jwwmc" default="SequenceFlow_0d24h26">
<bpmn:incoming>SequenceFlow_08voj55</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1n080up</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0d24h26</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index f51ea006d2..35f8f45999 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -33,10 +33,8 @@ import com.google.protobuf.Struct;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
-import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
@@ -52,12 +50,13 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
* Basic Integration test for createVcpeResCustService_Simplified.bpmn workflow.
*/
-@Ignore
public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
- private static final long WORKFLOW_WAIT_TIME = 1000L;
private Logger logger = LoggerFactory.getLogger(getClass());
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+ private static final int DMAAP_DELAY_TIME_MS = 2000;
+
private static final String TEST_PROCESSINSTANCE_KEY = "CreateVcpeResCustService_simplified";
private String testBusinessKey;
@@ -113,17 +112,9 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
ProcessInstance pi =
runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
- assertThat(pi).isNotNull();
-
- Thread.sleep(WORKFLOW_WAIT_TIME);
-
- Execution execution = runtimeService.createExecutionQuery().processInstanceBusinessKey(testBusinessKey)
- .messageEventSubscriptionName("WorkflowMessage").singleResult();
-
- assertThat(execution).isNotNull();
int waitCount = 10;
- while (!pi.isEnded() && waitCount >= 0) {
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
Thread.sleep(WORKFLOW_WAIT_TIME);
waitCount--;
}
@@ -145,6 +136,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
}
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
logger.info("Checking the configAssign request");
@@ -154,26 +150,26 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-assign");
- assertThat(actionIdentifiers.getMode()).matches("sync");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-assign");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
}
private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
@@ -185,32 +181,32 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-deploy");
- assertThat(actionIdentifiers.getMode()).matches("async");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-deploy");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
/**
* IP addresses match the OAM ip addresses from AAI.
*/
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).matches("1.1.1.1");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).matches("::/128");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
}
/**
@@ -223,8 +219,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Get the events from PNF topic
*/
- wireMockServer
- .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
+ wireMockServer.stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*"))
+ .willReturn(okJson(pnfResponse).withFixedDelay(DMAAP_DELAY_TIME_MS)));
}
private void mockAai() {