summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-building-blocks/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src/test/java/org/onap')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java56
2 files changed, 60 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
index 8bd4aeb387..ac62af2e9d 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
@@ -63,6 +63,7 @@ import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCDeactivateTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCQueryTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCUnassignTasks;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.FlowCompletionTasks;
import org.onap.so.bpmn.infrastructure.workflow.tasks.OrchestrationStatusValidator;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks;
@@ -199,6 +200,9 @@ public abstract class BaseBPMNTest {
@MockBean
protected ConfigurationScaleOut configurationScaleOut;
+ @MockBean
+ protected FlowCompletionTasks flowCompletionTasks;
+
@LocalServerPort
private int port;
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java
new file mode 100644
index 0000000000..50184a535d
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class FlowCompleteActivity extends BaseBPMNTest{
+ @Test
+ public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start",
+ "TaskUpdateRequestDB",
+ "FlowCompleteActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayFlowCompleteActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks)
+ .updateRequestDbStatus(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start",
+ "TaskUpdateRequestDB").hasNotPassed(
+ "FlowCompleteActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}