3 * ============LICENSE_START=======================================================
5 * ================================================================================
6 * Copyright 2019 TechMahindra
7 *=================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
24 import static org.junit.Assert.assertTrue;
25 import static org.mockito.ArgumentMatchers.any;
26 import static org.mockito.ArgumentMatchers.eq;
27 import static org.mockito.Mockito.doThrow;
28 import static org.mockito.Mockito.when;
30 import java.util.UUID;
32 import org.camunda.bpm.engine.delegate.BpmnError;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.mockito.ArgumentMatchers;
36 import org.mockito.InjectMocks;
37 import org.mockito.Mock;
38 import org.onap.so.bpmn.BaseTaskTest;
39 import org.onap.so.bpmn.common.BuildingBlockExecution;
40 import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
43 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
44 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
45 import org.onap.so.client.exception.BBObjectNotFoundException;
47 public class ConfigDeployVnfTest extends BaseTaskTest {
50 private ConfigDeployVnf configDeployVnf = new ConfigDeployVnf();
52 AAIUpdateTasks aAIUpdateTasks = new AAIUpdateTasks();
55 private GenericVnf genericVnf;
56 private ServiceInstance serviceInstance;
57 private RequestContext requestContext;
58 private String msoRequestId;
61 public void before() throws BBObjectNotFoundException {
62 genericVnf = setGenericVnf();
63 serviceInstance = setServiceInstance();
64 msoRequestId = UUID.randomUUID().toString();
65 requestContext = setRequestContext();
66 requestContext.setMsoRequestId(msoRequestId);
67 gBBInput.setRequestContext(requestContext);
69 doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
70 when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
71 when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
77 public void preProcessAbstractCDSProcessingTest() throws Exception {
79 configDeployVnf.preProcessAbstractCDSProcessing(execution);
85 public void updateAAIConfigureTaskTest() throws Exception {
87 configDeployVnf.updateAAIConfigure(execution);
92 public void updateAAIConfiguredTaskTest() throws Exception {
93 configDeployVnf.updateAAIConfigured(execution);