ac7d82cd519c2cd955cc4b5aee13ef92718b335f
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.workflow.tasks;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.mockito.ArgumentMatchers.anyObject;
25 import static org.mockito.ArgumentMatchers.anyString;
26 import static org.mockito.ArgumentMatchers.isA;
27 import static org.mockito.Mockito.doNothing;
28 import static org.mockito.Mockito.doReturn;
29 import static org.mockito.Mockito.when;
30 import java.util.ArrayList;
31 import java.util.List;
32 import org.camunda.bpm.engine.delegate.BpmnError;
33 import org.camunda.bpm.engine.delegate.DelegateExecution;
34 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
35 import org.junit.Before;
36 import org.junit.Rule;
37 import org.junit.Test;
38 import org.junit.rules.ExpectedException;
39 import org.mockito.InjectMocks;
40 import org.mockito.Mock;
41 import org.mockito.Mockito;
42 import org.mockito.Spy;
43 import org.onap.aai.domain.yang.GenericVnf;
44 import org.onap.so.bpmn.BaseTaskTest;
45 import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
46 import org.onap.so.bpmn.core.WorkflowException;
47 import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
48 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
49 import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
50 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
51 import org.onap.so.db.request.beans.InfraActiveRequests;
52 import org.onap.so.serviceinstancebeans.ModelInfo;
53 import org.onap.so.serviceinstancebeans.RequestDetails;
54 import org.springframework.core.env.Environment;
55
56 public class WorkflowActionBBTasksTest extends BaseTaskTest {
57
58     @Mock
59     protected WorkflowAction workflowAction;
60
61     @Mock
62     protected WorkflowActionBBFailure workflowActionBBFailure;
63
64     @InjectMocks
65     @Spy
66     protected WorkflowActionBBTasks workflowActionBBTasks;
67
68     @Mock
69     InfraActiveRequests reqMock;
70
71     private DelegateExecution execution;
72
73     @Mock
74     protected Environment environment;
75
76     @Mock
77     private FlowManipulatorListenerRunner flowManipulatorListenerRunner;
78
79     @Rule
80     public ExpectedException thrown = ExpectedException.none();
81
82     @Before
83     public void before() throws Exception {
84         execution = new DelegateExecutionFake();
85         org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance();
86         servInstance.setServiceInstanceId("TEST");
87         when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance);
88         workflowAction.setBbInputSetupUtils(bbSetupUtils);
89         workflowAction.setBbInputSetup(bbInputSetup);
90     }
91
92     @Test
93     public void selectBBTest() throws Exception {
94         String gAction = "Delete-Network-Collection";
95         execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
96         execution.setVariable("requestAction", gAction);
97         execution.setVariable("gCurrentSequence", 0);
98         execution.setVariable("homing", false);
99         execution.setVariable("calledHoming", false);
100         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
101         ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
102
103         String vnfCustomizationUUID = "1234567";
104         String modelUuid = "1234567";
105         BuildingBlock buildingBlock = new BuildingBlock();
106         buildingBlock.setBpmnFlowName("ConfigAssignVnfBB");
107         buildingBlock.setKey(vnfCustomizationUUID);
108         ebb.setBuildingBlock(buildingBlock);
109         RequestDetails rd = new RequestDetails();
110         ModelInfo mi = new ModelInfo();
111         mi.setModelUuid(modelUuid);
112         rd.setModelInfo(mi);
113         ebb.setRequestDetails(rd);
114         flowsToExecute.add(ebb);
115
116         List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
117         VnfResourceCustomization vrc = new VnfResourceCustomization();
118         vrc.setSkipPostInstConf(false);
119         vrc.setModelCustomizationUUID(vnfCustomizationUUID);
120         vnfResourceCustomizations.add(vrc);
121         GenericVnf genericVnf = new GenericVnf();
122         genericVnf.setModelCustomizationId(vnfCustomizationUUID);
123         doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid);
124         doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
125                 vnfResourceCustomizations);
126
127         execution.setVariable("flowsToExecute", flowsToExecute);
128         workflowActionBBTasks.selectBB(execution);
129         boolean success = (boolean) execution.getVariable("completed");
130         int currentSequence = (int) execution.getVariable("gCurrentSequence");
131         assertEquals(true, success);
132         assertEquals(1, currentSequence);
133     }
134
135     @Test
136     public void select2BBTest() throws Exception {
137         String gAction = "Delete-Network-Collection";
138         execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
139         execution.setVariable("requestAction", gAction);
140         execution.setVariable("gCurrentSequence", 0);
141         execution.setVariable("homing", false);
142         execution.setVariable("calledHoming", false);
143         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
144         ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
145         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
146
147         String vnfCustomizationUUID = "1234567";
148         String modelUuid = "1234567";
149         BuildingBlock buildingBlock = new BuildingBlock();
150         buildingBlock.setBpmnFlowName("ConfigDeployVnfBB");
151         buildingBlock.setKey(vnfCustomizationUUID);
152         ebb.setBuildingBlock(buildingBlock);
153         RequestDetails rd = new RequestDetails();
154         ModelInfo mi = new ModelInfo();
155         mi.setModelUuid(modelUuid);
156         rd.setModelInfo(mi);
157         ebb.setRequestDetails(rd);
158         flowsToExecute.add(ebb);
159
160         List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
161         VnfResourceCustomization vrc = new VnfResourceCustomization();
162         vrc.setSkipPostInstConf(false);
163         vrc.setModelCustomizationUUID(vnfCustomizationUUID);
164         vnfResourceCustomizations.add(vrc);
165         GenericVnf genericVnf = new GenericVnf();
166         genericVnf.setModelCustomizationId(vnfCustomizationUUID);
167         doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid);
168         doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
169                 vnfResourceCustomizations);
170
171         flowsToExecute.add(ebb2);
172         execution.setVariable("flowsToExecute", flowsToExecute);
173         workflowActionBBTasks.selectBB(execution);
174         boolean success = (boolean) execution.getVariable("completed");
175         int currentSequence = (int) execution.getVariable("gCurrentSequence");
176         assertEquals(false, success);
177         assertEquals(1, currentSequence);
178     }
179
180     @Test
181     public void updateRequestStatusToCompleteTest() throws Exception {
182         String reqId = "reqId123";
183         execution.setVariable("mso-request-id", reqId);
184         execution.setVariable("requestAction", "createInstance");
185         execution.setVariable("resourceName", "Service");
186         execution.setVariable("aLaCarte", true);
187         InfraActiveRequests req = new InfraActiveRequests();
188         doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
189         doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
190         workflowActionBBTasks.updateRequestStatusToComplete(execution);
191         assertEquals("ALaCarte-Service-createInstance request was executed correctly.",
192                 execution.getVariable("finalStatusMessage"));
193     }
194
195     @Test
196     public void rollbackExecutionPathTest() {
197         execution.setVariable("handlingCode", "Rollback");
198         execution.setVariable("isRollback", false);
199         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
200         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
201         BuildingBlock bb1 = new BuildingBlock();
202         bb1.setBpmnFlowName("AssignVfModuleBB");
203         ebb1.setBuildingBlock(bb1);
204         flowsToExecute.add(ebb1);
205         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
206         BuildingBlock bb2 = new BuildingBlock();
207         bb2.setBpmnFlowName("CreateVfModuleBB");
208         ebb2.setBuildingBlock(bb2);
209         flowsToExecute.add(ebb2);
210         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
211         BuildingBlock bb3 = new BuildingBlock();
212         bb3.setBpmnFlowName("ActivateVfModuleBB");
213         ebb3.setBuildingBlock(bb3);
214         flowsToExecute.add(ebb3);
215
216         execution.setVariable("flowsToExecute", flowsToExecute);
217         execution.setVariable("gCurrentSequence", 3);
218         doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
219
220         workflowActionBBTasks.rollbackExecutionPath(execution);
221         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
222         assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeactivateVfModuleBB");
223         assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "DeleteVfModuleBB");
224         assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(), "UnassignVfModuleBB");
225         assertEquals(0, execution.getVariable("gCurrentSequence"));
226     }
227
228     @Test
229     public void rollbackExecutionPathUnfinishedFlowTest() {
230         execution.setVariable("handlingCode", "Rollback");
231         execution.setVariable("isRollback", false);
232         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
233         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
234         BuildingBlock bb1 = new BuildingBlock();
235         bb1.setBpmnFlowName("AssignVfModuleBB");
236         ebb1.setBuildingBlock(bb1);
237         flowsToExecute.add(ebb1);
238         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
239         BuildingBlock bb2 = new BuildingBlock();
240         bb2.setBpmnFlowName("CreateVfModuleBB");
241         ebb2.setBuildingBlock(bb2);
242         flowsToExecute.add(ebb2);
243         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
244         BuildingBlock bb3 = new BuildingBlock();
245         bb3.setBpmnFlowName("ActivateVfModuleBB");
246         ebb3.setBuildingBlock(bb3);
247         flowsToExecute.add(ebb3);
248
249         execution.setVariable("flowsToExecute", flowsToExecute);
250         execution.setVariable("gCurrentSequence", 2);
251         doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
252
253         workflowActionBBTasks.rollbackExecutionPath(execution);
254         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
255         assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeleteVfModuleBB");
256         assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "UnassignVfModuleBB");
257         assertEquals(0, execution.getVariable("gCurrentSequence"));
258         assertEquals(0, execution.getVariable("retryCount"));
259     }
260
261     @Test
262     public void rollbackExecutionTest() {
263         execution.setVariable("handlingCode", "Rollback");
264         execution.setVariable("isRollback", false);
265         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
266         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
267         BuildingBlock bb1 = new BuildingBlock();
268         bb1.setBpmnFlowName("AssignServiceInstanceBB");
269         ebb1.setBuildingBlock(bb1);
270         flowsToExecute.add(ebb1);
271         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
272         BuildingBlock bb2 = new BuildingBlock();
273         bb2.setBpmnFlowName("CreateNetworkCollectionBB");
274         ebb2.setBuildingBlock(bb2);
275         flowsToExecute.add(ebb2);
276         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
277         BuildingBlock bb3 = new BuildingBlock();
278         bb3.setBpmnFlowName("AssignNetworkBB");
279         ebb3.setBuildingBlock(bb3);
280         flowsToExecute.add(ebb3);
281         ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
282         BuildingBlock bb4 = new BuildingBlock();
283         bb4.setBpmnFlowName("CreateNetworkBB");
284         ebb4.setBuildingBlock(bb4);
285         flowsToExecute.add(ebb4);
286
287         execution.setVariable("flowsToExecute", flowsToExecute);
288         execution.setVariable("gCurrentSequence", 3);
289         doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
290
291         workflowActionBBTasks.rollbackExecutionPath(execution);
292         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
293         assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "UnassignNetworkBB");
294         assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "DeleteNetworkCollectionBB");
295         assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(), "UnassignServiceInstanceBB");
296         assertEquals(0, execution.getVariable("gCurrentSequence"));
297     }
298
299     @Test
300     public void rollbackExecutionRollbackToAssignedTest() {
301         execution.setVariable("isRollback", false);
302         execution.setVariable("handlingCode", "RollbackToAssigned");
303         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
304         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
305         BuildingBlock bb1 = new BuildingBlock();
306         bb1.setBpmnFlowName("AssignVfModuleBB");
307         ebb1.setBuildingBlock(bb1);
308         flowsToExecute.add(ebb1);
309         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
310         BuildingBlock bb2 = new BuildingBlock();
311         bb2.setBpmnFlowName("CreateVfModuleBB");
312         ebb2.setBuildingBlock(bb2);
313         flowsToExecute.add(ebb2);
314         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
315         BuildingBlock bb3 = new BuildingBlock();
316         bb3.setBpmnFlowName("ActivateVfModuleBB");
317         ebb3.setBuildingBlock(bb3);
318         flowsToExecute.add(ebb3);
319
320         execution.setVariable("flowsToExecute", flowsToExecute);
321         execution.setVariable("gCurrentSequence", 2);
322
323         workflowActionBBTasks.rollbackExecutionPath(execution);
324         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
325         assertEquals("DeleteVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
326         assertEquals(0, execution.getVariable("gCurrentSequence"));
327         assertEquals(1, ebbs.size());
328     }
329
330     @Test
331     public void rollbackExecutionRollbackToAssignedWithFabricTest() {
332         execution.setVariable("isRollback", false);
333         execution.setVariable("handlingCode", "RollbackToAssigned");
334         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
335         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
336         BuildingBlock bb1 = new BuildingBlock();
337         bb1.setBpmnFlowName("AssignVfModuleBB");
338         ebb1.setBuildingBlock(bb1);
339         flowsToExecute.add(ebb1);
340         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
341         BuildingBlock bb2 = new BuildingBlock();
342         bb2.setBpmnFlowName("CreateVfModuleBB");
343         ebb2.setBuildingBlock(bb2);
344         flowsToExecute.add(ebb2);
345         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
346         BuildingBlock bb3 = new BuildingBlock();
347         bb3.setBpmnFlowName("ActivateVfModuleBB");
348         ebb3.setBuildingBlock(bb3);
349         flowsToExecute.add(ebb3);
350         ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
351         BuildingBlock bb4 = new BuildingBlock();
352         bb4.setBpmnFlowName("AssignFabricConfigurationBB");
353         ebb4.setBuildingBlock(bb4);
354         flowsToExecute.add(ebb4);
355         ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
356         BuildingBlock bb5 = new BuildingBlock();
357         bb5.setBpmnFlowName("ActivateFabricConfigurationBB");
358         ebb5.setBuildingBlock(bb5);
359         flowsToExecute.add(ebb5);
360
361         execution.setVariable("flowsToExecute", flowsToExecute);
362         execution.setVariable("gCurrentSequence", 5);
363
364         workflowActionBBTasks.rollbackExecutionPath(execution);
365         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
366         assertEquals(0, execution.getVariable("gCurrentSequence"));
367         assertEquals(4, ebbs.size());
368         assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
369         assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
370         assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
371         assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
372
373     }
374
375     @Test
376     public void rollbackExecutionRollbackToCreatedTest() {
377         execution.setVariable("isRollback", false);
378         execution.setVariable("handlingCode", "RollbackToCreated");
379         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
380         ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
381         BuildingBlock bb1 = new BuildingBlock();
382         bb1.setBpmnFlowName("AssignVfModuleBB");
383         ebb1.setBuildingBlock(bb1);
384         flowsToExecute.add(ebb1);
385         ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
386         BuildingBlock bb2 = new BuildingBlock();
387         bb2.setBpmnFlowName("CreateVfModuleBB");
388         ebb2.setBuildingBlock(bb2);
389         flowsToExecute.add(ebb2);
390         ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
391         BuildingBlock bb3 = new BuildingBlock();
392         bb3.setBpmnFlowName("ActivateVfModuleBB");
393         ebb3.setBuildingBlock(bb3);
394         flowsToExecute.add(ebb3);
395
396         execution.setVariable("flowsToExecute", flowsToExecute);
397         execution.setVariable("gCurrentSequence", 3);
398
399         workflowActionBBTasks.rollbackExecutionPath(execution);
400         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
401         assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
402         assertEquals(0, execution.getVariable("gCurrentSequence"));
403         assertEquals(1, ebbs.size());
404     }
405
406     @Test
407     public void checkRetryStatusTest() {
408         String reqId = "reqId123";
409         execution.setVariable("mso-request-id", reqId);
410         doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
411         doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
412         execution.setVariable("handlingCode", "Retry");
413         execution.setVariable("retryCount", 1);
414         execution.setVariable("gCurrentSequence", 1);
415         InfraActiveRequests req = new InfraActiveRequests();
416         doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
417         workflowActionBBTasks.checkRetryStatus(execution);
418         assertEquals(0, execution.getVariable("gCurrentSequence"));
419     }
420
421     @Test
422     public void checkRetryStatusTestExceededMaxRetries() {
423         String reqId = "reqId123";
424         execution.setVariable("mso-request-id", reqId);
425         doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
426         doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
427         execution.setVariable("handlingCode", "Retry");
428         execution.setVariable("retryCount", 6);
429         execution.setVariable("gCurrentSequence", 1);
430         InfraActiveRequests req = new InfraActiveRequests();
431         doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
432         try {
433             workflowActionBBTasks.checkRetryStatus(execution);
434         } catch (BpmnError e) {
435             WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
436             assertEquals("Exceeded maximum retries. Ending flow with status Abort", exception.getErrorMessage());
437         }
438     }
439
440     @Test
441     public void checkRetryStatusNoRetryTest() {
442         String reqId = "reqId123";
443         execution.setVariable("mso-request-id", reqId);
444         execution.setVariable("retryCount", 3);
445         execution.setVariable("handlingCode", "Success");
446         execution.setVariable("gCurrentSequence", 1);
447         InfraActiveRequests req = new InfraActiveRequests();
448         doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
449         workflowActionBBTasks.checkRetryStatus(execution);
450         assertEquals(0, execution.getVariable("retryCount"));
451     }
452
453     @Test
454     public void updateInstanceId() {
455         String reqId = "req123";
456         String instanceId = "123123123";
457         execution.setVariable("mso-request-id", reqId);
458         execution.setVariable("resourceId", instanceId);
459         execution.setVariable("resourceType", WorkflowType.SERVICE);
460         doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
461         doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
462         workflowActionBBTasks.updateInstanceId(execution);
463         Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
464     }
465
466     @Test
467     public void getConfigurationId() {
468         org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
469         vnfc.setModelInvariantId("modelInvariantId");
470         vnfc.setVnfcName("testVnfcName");
471         List<org.onap.aai.domain.yang.Configuration> configurations =
472                 new ArrayList<org.onap.aai.domain.yang.Configuration>();
473         org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
474         configuration.setConfigurationId("configurationId");
475         configuration.setModelCustomizationId("modelCustimizationId");
476         configuration.setConfigurationName("testConfigurationName");
477         configurations.add(configuration);
478         doReturn(configurations.get(0).getConfigurationId()).when(workflowActionBBTasks).getConfigurationId(vnfc);
479         assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
480     }
481
482
483 }