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;
26 import java.util.HashMap;
27 import java.util.List;
29 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.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
40 * Unit test for RainyDayHandler.bpmn.
42 public class ManualHandlingIT extends BaseIntegrationTest {
43 Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
46 public void TestManualHandlingSuccess() {
47 MockPostRequestDB(wireMockServer);
49 Map<String, Object> variables = new HashMap<>();
50 variables.put("isDebugLogEnabled", "true");
51 variables.put("msoRequestId", "testRequestId");
52 variables.put("serviceType", "X");
53 variables.put("vnfType", "Y");
54 variables.put("currentActivity", "BB1");
55 variables.put("workStep", "1");
56 variables.put("failedActivity", "AAI");
57 variables.put("vnfName", "vSAMP12");
58 variables.put("errorCode", "123");
59 variables.put("errorText", "update failed");
60 variables.put("validResponses", "Rollback");
61 variables.put("vnfName", "vSAMP1");
64 String businessKey = UUID.randomUUID().toString();
65 invokeSubProcess("ManualHandling", businessKey, variables);
69 } catch (Exception e) {
73 TaskService taskService = processEngine.getTaskService();
75 TaskQuery q = taskService.createTaskQuery();
77 List<Task> tasks = q.orderByTaskCreateTime().asc().list();
79 for (Task task : tasks) {
80 logger.debug("TASK ID: {}", task.getId());
81 logger.debug("TASK NAME: {}", task.getName());
84 logger.debug("Completing the task");
85 Map<String, Object> completeVariables = new HashMap<>();
86 completeVariables.put("responseValue", "skip");
87 taskService.complete(task.getId(), completeVariables);
88 } catch (Exception e) {
89 logger.debug("GOT EXCEPTION: {}", e.getMessage());
93 waitForProcessEnd(businessKey, 100000);
95 Assert.assertTrue(isProcessEnded(businessKey));