aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-01-30 13:47:36 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-30 13:47:36 +0000
commit8862df323bde6ceeb685281a70d22b0dc53b6eb0 (patch)
treeacea0996deb459026156b1ffaf14e6d5282205ee /bpmn/so-bpmn-tasks/src/test
parent74a3c19549a12db2e196a6141f6fc2dcda1c5826 (diff)
parent2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 (diff)
Merge "add manual handling to rainy day handling for bbs"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-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);
- }
}