2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.common;
23 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
25 import java.util.HashMap;
26 import java.util.List;
28 import java.util.UUID;
30 import org.camunda.bpm.engine.TaskService;
31 import org.camunda.bpm.engine.task.Task;
32 import org.camunda.bpm.engine.task.TaskQuery;
33 import org.junit.Assert;
34 import org.junit.Test;
35 import org.onap.so.BaseIntegrationTest;
36 import org.onap.so.logger.MsoLogger;
39 * Unit test for RainyDayHandler.bpmn.
41 public class ManualHandlingIT extends BaseIntegrationTest {
42 MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class);
45 public void TestManualHandlingSuccess() {
48 Map<String, Object> variables = new HashMap<>();
49 variables.put("isDebugLogEnabled","true");
50 variables.put("msoRequestId", "testRequestId");
51 variables.put("serviceType", "X");
52 variables.put("vnfType", "Y");
53 variables.put("currentActivity", "BB1");
54 variables.put("workStep", "1");
55 variables.put("failedActivity", "AAI");
56 variables.put("vnfName", "vSAMP12");
57 variables.put("errorCode", "123");
58 variables.put("errorText", "update failed");
59 variables.put("validResponses", "Rollback");
60 variables.put("vnfName", "vSAMP1");
63 String businessKey = UUID.randomUUID().toString();
64 invokeSubProcess("ManualHandling", businessKey, variables);
68 } catch (Exception e) {
72 TaskService taskService = processEngine.getTaskService();
74 TaskQuery q = taskService.createTaskQuery();
76 List<Task> tasks = q.orderByTaskCreateTime().asc().list();
78 for (Task task : tasks) {
79 logger.debug("TASK ID: " + task.getId());
80 logger.debug("TASK NAME: " + task.getName());
83 logger.debug("Completing the task");
84 Map<String,Object> completeVariables = new HashMap<>();
85 completeVariables.put("responseValue", "skip");
86 taskService.complete(task.getId(), completeVariables);
87 } catch(Exception e) {
88 logger.debug("GOT EXCEPTION: " + e.getMessage());
92 waitForProcessEnd(businessKey, 100000);
94 Assert.assertTrue(isProcessEnded(businessKey));