diff options
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src/test/java')
9 files changed, 475 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 e8891eeb53..8bd4aeb387 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 @@ -38,6 +38,7 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICommonTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICreateTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIDeleteTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIQueryTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks; import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterCreateTasks; @@ -46,6 +47,7 @@ import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterUpdat import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; +import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; @@ -105,6 +107,13 @@ public abstract class BaseBPMNTest { @MockBean protected AAIDeleteTasks aaiDeleteTasks; + + @MockBean + protected AAIFlagTasks aaiFlagTasks; + + + @MockBean + protected AppcRunTasks appcRunTasks; @MockBean protected SDNCActivateTasks sdncActivateTasks; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java new file mode 100644 index 0000000000..99e7f308f7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFHealthCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck", + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFHealthCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck").hasNotPassed( + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java new file mode 100644 index 0000000000..2305485bfc --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic", + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic").hasNotPassed( + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java new file mode 100644 index 0000000000..d3ff31eb9c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFResumeTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic", + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic").hasNotPassed( + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..b3b4d82c35 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.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 VNFSetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint", + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint").hasNotPassed( + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..1225da5829 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.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 VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint", + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint").hasNotPassed( + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java new file mode 100644 index 0000000000..288cf48778 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck", + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck").hasNotPassed( + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java new file mode 100644 index 0000000000..2b82197342 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck", + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck").hasNotPassed( + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java new file mode 100644 index 0000000000..93d20e9109 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware", + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware").hasNotPassed( + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + +} |