From 9ba85f78f2424f51933b1ae6fc28a51ed16f13f2 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Wed, 13 Mar 2019 13:26:54 -0400 Subject: Add APPC-related Activities for WFD Add APP-C related Activities for WFD with JUnits; corrected JUnits Change-Id: I1a7142f692945843e7942b43b6fe68e23ea21e96 Issue-ID: SO-1518 Signed-off-by: Kuleshov, Elena --- .../subprocess/Activity/VNFLockActivity.bpmn | 62 ++++++++++++++++++++++ .../subprocess/Activity/VNFSnapShotActivity.bpmn | 62 ++++++++++++++++++++++ .../subprocess/Activity/VNFStartActivity.bpmn | 62 ++++++++++++++++++++++ .../subprocess/Activity/VNFStopActivity.bpmn | 62 ++++++++++++++++++++++ .../subprocess/Activity/VNFUnlockActivity.bpmn | 62 ++++++++++++++++++++++ .../Activity/VNFUpgradeBackupActivity.bpmn | 62 ++++++++++++++++++++++ .../subprocess/VNFHealthCheckActivityTest.java | 3 +- .../bpmn/subprocess/VNFLockActivityTest.java | 57 ++++++++++++++++++++ .../subprocess/VNFQuiesceTrafficActivityTest.java | 3 +- .../subprocess/VNFResumeTrafficActivityTest.java | 3 +- .../bpmn/subprocess/VNFSnapShotActivityTest.java | 57 ++++++++++++++++++++ .../bpmn/subprocess/VNFStartActivityTest.java | 57 ++++++++++++++++++++ .../bpmn/subprocess/VNFStopActivityTest.java | 57 ++++++++++++++++++++ .../bpmn/subprocess/VNFUnlockActivityTest.java | 57 ++++++++++++++++++++ .../subprocess/VNFUpgradeBackupActivityTest.java | 60 +++++++++++++++++++++ .../VNFUpgradePostCheckActivityTest.java | 4 +- .../subprocess/VNFUpgradePreCheckActivityTest.java | 3 +- .../subprocess/VNFUpgradeSoftwareActivityTest.java | 3 +- 18 files changed, 724 insertions(+), 12 deletions(-) create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java (limited to 'bpmn/so-bpmn-building-blocks/src') diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn new file mode 100644 index 0000000000..1aaa920ef8 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn new file mode 100644 index 0000000000..8115f694c2 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn new file mode 100644 index 0000000000..f0490a9b61 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn new file mode 100644 index 0000000000..0e02295631 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn new file mode 100644 index 0000000000..6d1b68cb7b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn new file mode 100644 index 0000000000..dfcf9974ee --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn @@ -0,0 +1,62 @@ + + + + + SequenceFlow_06vhbci + + + SequenceFlow_01312aj + + + + + SequenceFlow_0cf0riu + SequenceFlow_01312aj + + + + SequenceFlow_06vhbci + SequenceFlow_0cf0riu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 index 9c745fd512..8e76f8f4d1 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -44,8 +43,8 @@ public class VNFHealthCheckActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFHealthCheckActivity_Test() throws Exception { + variables.put("actionHealthCheck", Action.HealthCheck); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java new file mode 100644 index 0000000000..f36a72fc01 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.ProcessEngineTests.assertThat; +import static org.mockito.ArgumentMatchers.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 VNFLockActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFLockActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start", + "TaskPreProcessActivity", + "TaskLock", + "VNFLockActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFLockActivity_Test() throws Exception { + variables.put("actionLock", Action.Lock); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFLockActivity_Start", + "TaskPreProcessActivity", + "TaskLock").hasNotPassed( + "VNFLockActivity_End"); + } + +} 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 index e8d603ea9a..2d9b952509 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -44,8 +43,8 @@ public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { + variables.put("actionQuiesceTraffic", Action.QuiesceTraffic); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); 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 index 75ff1eb32d..d541cdf834 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -44,8 +43,8 @@ public class VNFResumeTrafficActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { + variables.put("actionResumeTraffic", Action.ResumeTraffic); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java new file mode 100644 index 0000000000..f6bfd04d03 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 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.ProcessEngineTests.assertThat; +import static org.mockito.ArgumentMatchers.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 VNFSnapShotActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", + "TaskPreProcessActivity", + "TaskSnapShot", + "VNFSnapShotActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSnapShotActivity_Test() throws Exception { + variables.put("actionSnapshot", Action.Snapshot); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", + "TaskPreProcessActivity", + "TaskSnapShot").hasNotPassed( + "VNFSnapShotActivity_End"); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java new file mode 100644 index 0000000000..6e4be69a91 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.ProcessEngineTests.assertThat; +import static org.mockito.ArgumentMatchers.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 VNFStartActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFStartActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start", + "TaskPreProcessActivity", + "TaskStart", + "VNFStartActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFStartActivity_Test() throws Exception { + variables.put("actionStart", Action.Start); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStartActivity_Start", + "TaskPreProcessActivity", + "TaskStart").hasNotPassed( + "VNFStartActivity_End"); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java new file mode 100644 index 0000000000..3bc5940493 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.ProcessEngineTests.assertThat; +import static org.mockito.ArgumentMatchers.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 VNFStopActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFStopActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start", + "TaskPreProcessActivity", + "TaskStop", + "VNFStopActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFStopActivity_Test() throws Exception { + variables.put("actionStop", Action.Stop); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStopActivity_Start", + "TaskPreProcessActivity", + "TaskStop").hasNotPassed( + "VNFStopActivity_End"); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java new file mode 100644 index 0000000000..d0db70b2aa --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.ProcessEngineTests.assertThat; +import static org.mockito.ArgumentMatchers.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 VNFUnlockActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start", + "TaskPreProcessActivity", + "TaskUnlock", + "VNFUnlockActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnlockActivity_Test() throws Exception { + variables.put("actionUnlock", Action.Unlock); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUnlockActivity_Start", + "TaskPreProcessActivity", + "TaskUnlock").hasNotPassed( + "VNFUnlockActivity_End"); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java new file mode 100644 index 0000000000..c68196c3bf --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java @@ -0,0 +1,60 @@ +/*- + * ============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.ArgumentMatchers.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 VNFUpgradeBackupActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeBackup", + "VNFUpgradeBackupActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception { + variables.put("actionUpgradeBackup", Action.UpgradeBackup); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeBackup").hasNotPassed( + "VNFUpgradeBackupActivity_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 index b3976ade1f..5fa930712d 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -43,8 +42,9 @@ public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { + variables.put("actionUpgradePostCheck", Action.UpgradePostCheck); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); 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 index 15f314bd20..40f5df8dae 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -44,8 +43,8 @@ public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { + variables.put("actionUpgradePreCheck", Action.UpgradePreCheck); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); 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 index 11f88d29f7..91e6bf40be 100644 --- 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 @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; @@ -44,8 +43,8 @@ public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{ } @Test - @Ignore public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { + variables.put("actionUpgradeSoftware", Action.UpgradeSoftware); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); -- cgit 1.2.3-korg