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