From 2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 Mon Sep 17 00:00:00 2001 From: "Kuleshov, Elena" Date: Fri, 24 Jan 2020 16:33:39 -0500 Subject: 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) Change-Id: I98a84c1a489bb7b24b68e567f604aeb074fd7bf9 --- .../BuildingBlock/ExecuteBuildingBlock.bpmn | 186 +++++++++++++++------ .../BuildingBlock/PauseForManualTaskRainyDay.bpmn | 164 ++++++++++++++++++ .../subprocess/PauseForManualTaskRainyDayTest.java | 97 +++++++++++ 3 files changed, 397 insertions(+), 50 deletions(-) create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/PauseForManualTaskRainyDay.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java (limited to 'bpmn/so-bpmn-building-blocks') diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index e64c44eb94..443a571312 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0rq4c5r @@ -44,8 +44,12 @@ SequenceFlow_0a62t4c + SequenceFlow_05le7o3 SequenceFlow_0fwsjva SequenceFlow_0h8v45y + SequenceFlow_1xh5ngw + SequenceFlow_0xyd2zl + SequenceFlow_1g7oq3t SequenceFlow_0ndt8ft @@ -87,6 +91,7 @@ SequenceFlow_0541bid + SequenceFlow_1g7oq3t SequenceFlow_12ps9at @@ -99,6 +104,36 @@ SequenceFlow_09synl9 SequenceFlow_0vdeqxv + + + + + + + + + SequenceFlow_0xyd2zl + SequenceFlow_1ynai9j + + + + + + + + + + + SequenceFlow_1xh5ngw + SequenceFlow_05le7o3 + + + SequenceFlow_1ynai9j + + + + + @@ -169,63 +204,63 @@ - + - + - + - + - + - + - - + + - + - - + + - + - - + + - + - + - - + + - + - - + + - + - + @@ -251,25 +286,25 @@ - - + + - + - + - + - + - + - + @@ -312,51 +347,102 @@ - - + + - + - - + + - + - + - + - + - - + + - + - + - + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/PauseForManualTaskRainyDay.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/PauseForManualTaskRainyDay.bpmn new file mode 100644 index 0000000000..29657e17af --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/PauseForManualTaskRainyDay.bpmn @@ -0,0 +1,164 @@ + + + + + SequenceFlow_0jav6cu + + + SequenceFlow_14cyk9v + + + + + + + + + + + + SequenceFlow_0igra4l + SequenceFlow_192yimz + + + + + SequenceFlow_1idwudp + SequenceFlow_0b84ki5 + + + SequenceFlow_192yimz + SequenceFlow_14cyk9v + + + + SequenceFlow_01k6zgt + + + + + + SequenceFlow_0b84ki5 + SequenceFlow_0igra4l + + + + SequenceFlow_01k6zgt + SequenceFlow_16bjdgj + + + + SequenceFlow_16bjdgj + + + + SequenceFlow_0jav6cu + SequenceFlow_1idwudp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java new file mode 100644 index 0000000000..576f9c4f01 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java @@ -0,0 +1,97 @@ +/*- + * ============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.junit.Assert.assertNotNull; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; +import org.camunda.bpm.engine.ManagementService; +import org.camunda.bpm.engine.TaskService; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + + +public class PauseForManualTaskRainyDayTest extends BaseBPMNTest { + private static final String TIMEOUT_10_S = "PT10S"; + + @Autowired + protected ManagementService managementService; + + @Autowired + protected TaskService taskService; + + @Test + public void sunnyDayPauseForManualTaskRainyDayTimeout_Test() throws InterruptedException { + variables.put("taskTimeout", TIMEOUT_10_S); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); + assertThat(pi).isNotNull(); + BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + Task task = taskService.createTaskQuery().active().list().get(0); + assertThat(pi).task().isNotNull(); + assertNotNull(task); + + Job job = managementService.createJobQuery().activityId("ManualTaskTimer").singleResult(); + assertNotNull(job); + managementService.executeJob(job.getId()); + + assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskRainyDay_Start", "InitRainyDayManualHandling", + "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualTaskTimer", + "UpdateDBStatusToTimeout", "PauseForManualTaskRainyDay_Timeout"); + } + + @Test + public void sunnyDayPauseForManualTaskCompleted_Test() throws InterruptedException { + variables.put("taskTimeout", TIMEOUT_10_S); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); + assertThat(pi).isNotNull(); + BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).task().isNotNull(); + Task task = taskService.createTaskQuery().active().list().get(0); + assertNotNull(task); + taskService.complete(task.getId()); + + assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskRainyDay_Start", "InitRainyDayManualHandling", + "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualUserTask", + "UpdateDbStatusToInProgress", "PauseForManualTaskRainyDay_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayPauseForManualTask_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks) + .createExternalTicket((any(BuildingBlockExecution.class))); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("PauseForManualTaskRainyDay_Start", "InitRainyDayManualHandling", + "UpdateDbStatusToPendingManualTask", "CreateExternalTicket") + .hasNotPassed("ManualUserTask", "UpdateDbStatusToInProgress", "PauseForManualTaskRainyDay_End"); + } + +} -- cgit 1.2.3-korg