2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.aai.tasks;
23 import static org.junit.Assert.assertEquals;
24 import static org.mockito.Matchers.any;
25 import static org.mockito.Matchers.eq;
26 import static org.mockito.Mockito.doNothing;
27 import static org.mockito.Mockito.doReturn;
28 import static org.mockito.Mockito.doThrow;
29 import static org.mockito.Mockito.mock;
30 import static org.mockito.Mockito.spy;
31 import static org.mockito.Mockito.times;
32 import static org.mockito.Mockito.verify;
33 import static org.mockito.Mockito.when;
35 import java.util.HashMap;
37 import org.camunda.bpm.engine.delegate.BpmnError;
38 import org.hamcrest.Matchers;
39 import org.junit.Before;
40 import org.junit.Test;
41 import org.mockito.Mockito;
42 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
43 import org.onap.so.bpmn.BaseTaskTest;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
45 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
46 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
47 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
48 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
49 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
50 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
51 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
52 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
53 import org.onap.so.db.catalog.beans.OrchestrationStatus;
54 import org.springframework.beans.factory.annotation.Autowired;
56 public class AAIUpdateTasksTest extends BaseTaskTest{
58 private AAIUpdateTasks aaiUpdateTasks;
60 private L3Network network;
61 private ServiceInstance serviceInstance;
62 private VfModule vfModule;
63 private GenericVnf genericVnf;
64 private VolumeGroup volumeGroup;
65 private CloudRegion cloudRegion;
66 private Configuration configuration;
67 private Subnet subnet;
70 public void before() {
71 serviceInstance = setServiceInstance();
72 genericVnf = setGenericVnf();
73 vfModule = setVfModule();
74 volumeGroup = setVolumeGroup();
75 cloudRegion = setCloudRegion();
76 network = setL3Network();
77 configuration = setConfiguration();
78 subnet = buildSubnet();
82 public void updateOrchestrationStatusAssignedServiceTest() throws Exception {
83 doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
85 aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution);
87 verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
91 public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception {
92 expectedException.expect(BpmnError.class);
94 doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
96 aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution);
100 public void updateOrchestrationStatusActiveServiceTest() throws Exception {
101 doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
103 aaiUpdateTasks.updateOrchestrationStatusActiveService(execution);
105 verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
109 public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception {
110 expectedException.expect(BpmnError.class);
112 doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
114 aaiUpdateTasks.updateOrchestrationStatusActiveService(execution);
118 public void updateOrchestrationStatusAssignedVnfTest() throws Exception {
119 doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
121 aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution);
123 verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
127 public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception {
128 expectedException.expect(BpmnError.class);
130 doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
132 aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution);
136 public void updateOrchestrationStatusActiveVnfTest() throws Exception {
137 doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
139 aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution);
141 verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
145 public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception {
146 expectedException.expect(BpmnError.class);
148 doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
150 aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution);
154 public void updateOrchestrationStatusAssignVfModuleTest() throws Exception {
155 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
156 aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
157 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
158 assertEquals("", vfModule.getHeatStackId());
162 public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception {
163 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
165 expectedException.expect(BpmnError.class);
167 aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
171 public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
172 execution.setVariable("aLaCarte", true);
173 ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
174 modelInfoGenericVnf.setMultiStageDesign("false");
175 genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
176 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
177 aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
178 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
179 assertEquals("", vfModule.getHeatStackId());
183 public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest() throws Exception {
184 execution.setVariable("aLaCarte", false);
185 ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
186 modelInfoGenericVnf.setMultiStageDesign("true");
187 genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
188 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
189 aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
190 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
191 assertEquals("", vfModule.getHeatStackId());
195 public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
196 execution.setVariable("aLaCarte", true);
197 ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
198 modelInfoGenericVnf.setMultiStageDesign("true");
199 genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
200 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
201 aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
202 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
203 assertEquals("", vfModule.getHeatStackId());
207 public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
208 execution.setVariable("aLaCarte", true);
209 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
211 expectedException.expect(BpmnError.class);
213 aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
217 public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
218 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
219 aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution);
220 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
224 public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception {
225 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
227 expectedException.expect(BpmnError.class);
229 aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution);
233 public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception {
234 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
236 aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution);
238 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
242 public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception {
243 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
245 expectedException.expect(BpmnError.class);
247 aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution);
251 public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception {
252 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
254 aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
256 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
260 public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception {
261 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
263 expectedException.expect(BpmnError.class);
265 aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
269 public void updateHeatStackIdVfModuleTest() throws Exception {
270 execution.setVariable("heatStackId", "newHeatStackId");
271 doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
273 aaiUpdateTasks.updateHeatStackIdVfModule(execution);
275 verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
276 assertEquals("newHeatStackId", vfModule.getHeatStackId());
280 public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
281 doThrow(Exception.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
283 expectedException.expect(BpmnError.class);
285 aaiUpdateTasks.updateHeatStackIdVfModule(execution);
289 public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception {
290 doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
292 aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution);
294 verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
298 public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception {
299 expectedException.expect(BpmnError.class);
300 doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
301 aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution);
305 public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception {
306 doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
308 aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution);
310 verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
314 public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception {
315 expectedException.expect(BpmnError.class);
316 doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
317 aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution);
321 public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception {
322 doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
324 aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
326 verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
327 assertEquals("", volumeGroup.getHeatStackId());
331 public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception {
332 expectedException.expect(BpmnError.class);
333 doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
334 aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
337 public void updateHeatStackIdVolumeGroupTest() throws Exception {
338 execution.setVariable("heatStackId", "newHeatStackId");
339 doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
341 aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
343 verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
344 assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
348 public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
349 expectedException.expect(BpmnError.class);
350 doThrow(Exception.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
351 aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
355 public void updateNetworkExceptionTest() throws Exception {
356 expectedException.expect(BpmnError.class);
358 doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
360 aaiUpdateTasks.updateNetwork(execution, OrchestrationStatus.ACTIVE);
364 public void updateOstatusActivedNetworkCollectionTest() throws Exception {
365 doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
366 aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
367 verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection());
371 public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception {
372 expectedException.expect(BpmnError.class);
373 doThrow(Exception.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
374 aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
378 public void updateOrchestrationStatusActivateVfModuleTest() throws Exception {
379 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
381 aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution);
383 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
387 public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception {
388 doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
390 expectedException.expect(BpmnError.class);
392 aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution);
396 public void updateNetworkCreatedTest() throws Exception {
397 CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
398 createNetworkResponse.setNetworkFqdn("testNetworkFqdn");
399 createNetworkResponse.setNetworkStackId("testNetworkStackId");
400 HashMap<String, String> subnetMap = new HashMap<String, String>();
401 subnetMap.put("testSubnetId", "testNeutronSubnetId");
402 createNetworkResponse.setSubnetMap(subnetMap);
404 network.getSubnets().add(subnet);
406 execution.setVariable("createNetworkResponse", createNetworkResponse);
408 doNothing().when(aaiNetworkResources).updateNetwork(network);
409 doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
411 aaiUpdateTasks.updateNetworkCreated(execution);
412 verify(aaiNetworkResources, times(1)).updateNetwork(network);
413 verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
415 assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn());
416 assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus());
417 assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId());
418 assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId());
419 String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
420 assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
424 public void updateOrchestrationStatusNetworkTest() {
425 AAIUpdateTasks spy = Mockito.spy(new AAIUpdateTasks());
426 doNothing().when(spy).updateNetwork(eq(execution), any());
427 spy.updateOrchestrationStatusActiveNetwork(execution);
428 verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ACTIVE);
429 spy.updateOrchestrationStatusAssignedNetwork(execution);
430 verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ASSIGNED);
431 spy.updateOrchestrationStatusCreatedNetwork(execution);
432 verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.CREATED);
436 public void updateNetworkAAITest() {
438 L3Network spy = spy(new L3Network());
439 L3Network shallowCopy = mock(L3Network.class);
440 Subnet mockSubnet = mock(Subnet.class);
441 Subnet shallowCopySubnet = mock(Subnet.class);
442 when(mockSubnet.shallowCopyId()).thenReturn(shallowCopySubnet);
443 doReturn(shallowCopy).when(spy).shallowCopyId();
445 doNothing().when(aaiNetworkResources).updateNetwork(network);
446 doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
448 spy.getSubnets().add(mockSubnet);
449 aaiUpdateTasks.updateNetworkAAI(spy, OrchestrationStatus.CREATED);
451 verify(shallowCopy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
452 verify(spy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
453 verify(shallowCopySubnet, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
456 public void updateNetworkCreatedkExceptionTest() throws Exception {
457 expectedException.expect(BpmnError.class);
458 doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
459 aaiUpdateTasks.updateNetworkCreated(execution);
463 public void updateObjectNetworkTest() {
464 doNothing().when(aaiNetworkResources).updateNetwork(network);
466 aaiUpdateTasks.updateObjectNetwork(execution);
468 verify(aaiNetworkResources, times(1)).updateNetwork(network);
472 public void updateObjectNetworkExceptionText() {
473 expectedException.expect(BpmnError.class);
475 doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
477 aaiUpdateTasks.updateObjectNetwork(execution);
481 public void test_updateServiceInstance() {
482 doNothing().when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance);
483 aaiUpdateTasks.updateServiceInstance(execution);
484 verify(aaiServiceInstanceResources, times(1)).updateServiceInstance(serviceInstance);
488 public void test_updateServiceInstance_exception() {
489 expectedException.expect(BpmnError.class);
490 doThrow(Exception.class).when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance);
491 aaiUpdateTasks.updateServiceInstance(execution);
495 public void updateObjectVnfTest() {
496 doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
498 aaiUpdateTasks.updateObjectVnf(execution);
500 verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
504 public void updateObjectVnfExceptionTest() {
505 expectedException.expect(BpmnError.class);
506 doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(genericVnf);
507 aaiUpdateTasks.updateObjectVnf(execution);
511 public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception {
512 doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
514 aaiUpdateTasks.updateOrchestrationStatusDeleteVfModule(execution);
516 verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
517 assertEquals("", vfModule.getHeatStackId());
521 public void updateModelVfModuleTest() {
522 doNothing().when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
523 aaiUpdateTasks.updateModelVfModule(execution);
524 verify(aaiVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf);
528 public void updateModelVfModuleExceptionTest() {
529 expectedException.expect(BpmnError.class);
530 doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
531 aaiUpdateTasks.updateModelVfModule(execution);
535 public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
536 gBBInput = execution.getGeneralBuildingBlock();
537 doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
539 aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution);
541 verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
544 public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
545 gBBInput = execution.getGeneralBuildingBlock();
546 doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
548 aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution);
550 verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);