Config Deploy
[so.git] / bpmn / so-bpmn-tasks / src / test / java / org / onap / so / bpmn / infrastructure / flowspecific / tasks / ConfigDeployVnfTest.java
1
2 /*
3 * ============LICENSE_START=======================================================
4 * ONAP : SO
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
11 *
12 *     http://www.apache.org/licenses/LICENSE-2.0
13 *
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=========================================================
20 */
21
22 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
23
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;
29
30 import java.util.UUID;
31
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;
46
47 public class ConfigDeployVnfTest extends BaseTaskTest {
48
49         @InjectMocks
50         private ConfigDeployVnf configDeployVnf = new ConfigDeployVnf();
51         @Mock 
52         AAIUpdateTasks aAIUpdateTasks = new AAIUpdateTasks();
53         
54         
55         private GenericVnf genericVnf;
56         private ServiceInstance serviceInstance;
57         private RequestContext requestContext;
58         private String msoRequestId;
59
60         @Before
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);
68
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);
72         }
73
74
75
76         @Test
77         public void preProcessAbstractCDSProcessingTest() throws Exception {
78
79                 configDeployVnf.preProcessAbstractCDSProcessing(execution);
80
81                 assertTrue(true);
82         }
83
84         @Test
85         public void updateAAIConfigureTaskTest() throws Exception {
86                 
87                 configDeployVnf.updateAAIConfigure(execution);
88                 assertTrue(true);
89         }
90         
91         @Test
92         public void updateAAIConfiguredTaskTest() throws Exception {
93                 configDeployVnf.updateAAIConfigured(execution);
94                 assertTrue(true);
95         }
96
97 }