2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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.infrastructure.manualhandling.tasks;
23 import static org.mockito.Mockito.spy;
24 import static org.mockito.Mockito.times;
25 import static org.mockito.Mockito.verify;
26 import static org.mockito.Mockito.when;
27 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.mockito.Mock;
31 import org.onap.so.bpmn.BaseTaskTest;
32 import org.onap.so.bpmn.common.BuildingBlockExecution;
33 import org.onap.so.bpmn.common.DelegateExecutionImpl;
34 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
35 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
36 import org.onap.so.client.ticket.ExternalTicket;
38 public class ExternalTicketTasksTest extends BaseTaskTest {
41 private BuildingBlockExecution buildingBlockExecution;
44 private GeneralBuildingBlock generalBuildingBlock;
47 private RequestContext requestContext;
50 private ExternalTicket MOCK_externalTicket;
53 public void before() throws Exception {
54 delegateExecution = new DelegateExecutionFake();
55 buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
56 generalBuildingBlock = new GeneralBuildingBlock();
57 requestContext = new RequestContext();
58 requestContext.setRequestorId("someRequestorId");
59 generalBuildingBlock.setRequestContext(requestContext);
60 buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
61 buildingBlockExecution.setVariable("vnfType", "testVnfType");
62 buildingBlockExecution.setVariable("gBBInput", generalBuildingBlock);
63 buildingBlockExecution.setVariable("rainyDayVnfName", "someVnfName");
64 buildingBlockExecution.setVariable("workStep", "someWorkstep");
65 buildingBlockExecution.setVariable("taskTimeout", "PT5M");
69 public void createExternalTicket_Test() throws Exception {
70 ExternalTicketTasks externalTicketTasksSpy = spy(new ExternalTicketTasks());
71 when(externalTicketTasksSpy.getExternalTicket()).thenReturn(MOCK_externalTicket);
72 externalTicketTasksSpy.createExternalTicket(buildingBlockExecution);
73 verify(MOCK_externalTicket, times(1)).createTicket();