edf131d538f7f45bc43a54becb3dae9bd0069ea1
[so.git] / bpmn / so-bpmn-building-blocks / src / test / java / org / onap / so / bpmn / infrastructure / bpmn / subprocess / ConfigurationScaleOutBBTest.java
1 package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
2
3 import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
4 import static org.mockito.Matchers.any;
5 import static org.mockito.Mockito.doThrow;
6
7 import java.io.IOException;
8
9 import org.camunda.bpm.engine.delegate.BpmnError;
10 import org.camunda.bpm.engine.runtime.ProcessInstance;
11
12 import org.junit.Test;
13 import org.onap.so.bpmn.BaseBPMNTest;
14 import org.onap.so.bpmn.common.BuildingBlockExecution;
15
16
17
18 public class ConfigurationScaleOutBBTest extends BaseBPMNTest {
19
20         @Test
21         public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException {
22                 ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
23                 assertThat(pi).isNotNull();
24                 assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", "GetConfigScaleOutParams",
25                                         "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
26                 assertThat(pi).isEnded();
27         }
28
29         @Test
30         public void configurationScaleOutBBExceptionTest() throws Exception {
31                 doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class));
32                 ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
33                 assertThat(pi).isNotNull();
34                 assertThat(pi).isStarted()
35                                 .hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule")
36                                 .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
37                 assertThat(pi).isEnded();
38         }
39 }