summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org/onap
diff options
context:
space:
mode:
authorKuleshov, Elena <evn@att.com>2020-01-24 16:33:39 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-01-24 16:33:40 -0500
commit2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 (patch)
tree4f4e5ad0aa89961c4b51eaf8fd32bc9f340b8c93 /bpmn/so-bpmn-tasks/src/test/java/org/onap
parent48cb43adc20ac10fa6f22c0e03fe2b6775d45b87 (diff)
add manual handling to rainy day handling for bbs
Initial Manual Handling addition to Rainy Day BB handling. Reenable task API, add task variable setup. TaskTimeout will come from the configuration settings. Update the base path for the APIH manual tasks junit. Additional JUNIT tests for manual handling Add Manual as a primary policy for Change Management BBs. Error handling changes and robot tests for manual handling. Correct failure data retrieval when serviceSubscription is unavailable. Correct failure data retrieval when serviceSubscription is unavailable. Keep WorkflowException when manual pause gets invoked; improved error reporting. Issue-ID: SO-2616 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I98a84c1a489bb7b24b68e567f604aeb074fd7bf9
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasksTest.java75
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java33
2 files changed, 101 insertions, 7 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasksTest.java
new file mode 100644
index 0000000000..f8ecf01579
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasksTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.manualhandling.tasks;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.ticket.ExternalTicket;
+
+public class ExternalTicketTasksTest extends BaseTaskTest {
+
+ @Mock
+ private BuildingBlockExecution buildingBlockExecution;
+
+ @Mock
+ private GeneralBuildingBlock generalBuildingBlock;
+
+ @Mock
+ private RequestContext requestContext;
+
+ @Mock
+ private ExternalTicket MOCK_externalTicket;
+
+ @Before
+ public void before() throws Exception {
+ delegateExecution = new DelegateExecutionFake();
+ buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
+ generalBuildingBlock = new GeneralBuildingBlock();
+ requestContext = new RequestContext();
+ requestContext.setRequestorId("someRequestorId");
+ generalBuildingBlock.setRequestContext(requestContext);
+ buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
+ buildingBlockExecution.setVariable("vnfType", "testVnfType");
+ buildingBlockExecution.setVariable("gBBInput", generalBuildingBlock);
+ buildingBlockExecution.setVariable("rainyDayVnfName", "someVnfName");
+ buildingBlockExecution.setVariable("workStep", "someWorkstep");
+ buildingBlockExecution.setVariable("taskTimeout", "PT5M");
+ }
+
+ @Test
+ public void createExternalTicket_Test() throws Exception {
+ ExternalTicketTasks externalTicketTasksSpy = spy(new ExternalTicketTasks());
+ when(externalTicketTasksSpy.getExternalTicket()).thenReturn(MOCK_externalTicket);
+ externalTicketTasksSpy.createExternalTicket(buildingBlockExecution);
+ verify(MOCK_externalTicket, times(1)).createTicket();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index b40195c07b..b6dcd96534 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -37,9 +37,13 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.ticket.ExternalTicket;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class ManualHandlingTasksTest extends BaseTaskTest {
@@ -61,14 +65,36 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Mock
private BuildingBlockExecution buildingBlockExecution;
+ @Mock
+ private GeneralBuildingBlock generalBuildingBlock;
+
+ @Mock
+ private RequestContext requestContext;
+
+ @Mock
+ private ExternalTicket MOCK_externalTicket;
+
@Before
public void before() throws Exception {
+ MockitoAnnotations.initMocks(this);
delegateExecution = new DelegateExecutionFake();
buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
+ generalBuildingBlock = new GeneralBuildingBlock();
+ requestContext = new RequestContext();
+ requestContext.setRequestorId("someRequestorId");
+ generalBuildingBlock.setRequestContext(requestContext);
+ buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
+ buildingBlockExecution.setVariable("vnfType", "testVnfType");
+ buildingBlockExecution.setVariable("gBBInput", generalBuildingBlock);
+ buildingBlockExecution.setVariable("rainyDayVnfName", "someVnfName");
+ buildingBlockExecution.setVariable("workStep", "someWorkstep");
+ buildingBlockExecution.setVariable("taskTimeout", "PT5M");
}
@Test
public void setFalloutTaskVariables_Test() {
+ when(mockExecution.getVariable("gBuildingBlockExecution")).thenReturn(buildingBlockExecution);
+ buildingBlockExecution.setVariable("gBBInput", generalBuildingBlock);
when(task.getId()).thenReturn("taskId");
when(task.getExecution()).thenReturn(mockExecution);
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
@@ -103,7 +129,6 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Test
public void updateRequestDbStatus_Test() throws Exception {
InfraActiveRequests mockedRequest = new InfraActiveRequests();
- buildingBlockExecution.setVariable("mso-request-id", "msoRequestId");
when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
manualHandlingTasks.updateRequestDbStatus(buildingBlockExecution, "IN_PROGRESS");
@@ -111,10 +136,4 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS");
}
- @Test
- public void createExternalTicket_Test() throws Exception {
- buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
- buildingBlockExecution.setVariable("vnfType", "testVnfType");
- manualHandlingTasks.createExternalTicket(buildingBlockExecution);
- }
}