diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2022-01-20 10:33:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-01-20 10:33:37 +0000 |
commit | 941d6d8a4d1950cee0311e8ff80c8b6a8c2873e8 (patch) | |
tree | a4532a7ad3ad7487ab09fbd6104a1fba4ad303c1 /bpmn | |
parent | 0da0a72c8ea247aeca0f3afe280c9e6d8f87bdb6 (diff) | |
parent | 19e86ebd4799dcf35bb0dfd919572c2f6ee3670a (diff) |
Merge "delete redundant test dependency"
Diffstat (limited to 'bpmn')
10 files changed, 238 insertions, 104 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 28d2abc792..7d4267efbb 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -25,13 +25,16 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -42,7 +45,17 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIConfigurationResources; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIPnfResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.db.catalog.beans.OrchestrationStatus; import java.util.HashMap; import static org.junit.Assert.assertEquals; @@ -57,8 +70,29 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class AAIUpdateTasksTest extends BaseTaskTest { - +@RunWith(MockitoJUnitRunner.Silent.class) +public class AAIUpdateTasksTest extends TestDataSetup { + + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected AAIServiceInstanceResources aaiServiceInstanceResources; + @Mock + protected AAIPnfResources aaiPnfResources; + @Mock + protected AAIVnfResources aaiVnfResources; + @Mock + protected AAIVfModuleResources aaiVfModuleResources; + @Mock + protected AAIVolumeGroupResources aaiVolumeGroupResources; + @Mock + protected AAINetworkResources aaiNetworkResources; + @Mock + protected AAICollectionResources aaiCollectionResources; + @Mock + protected AAIConfigurationResources aaiConfigurationResources; @InjectMocks private AAIUpdateTasks aaiUpdateTasks = new AAIUpdateTasks(); @@ -99,7 +133,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedServiceTest() throws Exception { + public void updateOrchestrationStatusAssignedServiceTest() { doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); @@ -110,7 +144,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignedServiceExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiServiceInstanceResources) @@ -120,7 +154,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveServiceTest() throws Exception { + public void updateOrchestrationStatusActiveServiceTest() { doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); @@ -131,7 +165,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveServiceExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiServiceInstanceResources) @@ -221,7 +255,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedVnfTest() throws Exception { + public void updateOrchestrationStatusAssignedVnfTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); @@ -230,7 +264,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignedVnfExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, @@ -240,7 +274,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVnfTest() throws Exception { + public void updateOrchestrationStatusActiveVnfTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); @@ -249,7 +283,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveVnfExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, @@ -259,7 +293,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignVfModuleTest() throws Exception { + public void updateOrchestrationStatusAssignVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); @@ -269,7 +303,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); @@ -279,7 +313,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception { + public void updateOrchestrationStatusCreatedVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); @@ -288,7 +322,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusCreatedVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -298,7 +332,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception { + public void updateOrchestrationStatusPendingActivatefModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); @@ -309,7 +343,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); @@ -319,7 +353,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception { + public void updateOrchestrationStatusDectivateVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -330,7 +364,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusDectivateVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -340,7 +374,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVfModuleTest() throws Exception { + public void updateHeatStackIdVfModuleTest() { execution.setVariable("heatStackId", "newHeatStackId"); doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); @@ -351,18 +385,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVfModuleToNullTest() throws Exception { + public void updateHeatStackIdVfModuleToNullTest() { execution.setVariable("heatStackId", null); doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); aaiUpdateTasks.updateHeatStackIdVfModule(execution); verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); - assertEquals(vfModule.getHeatStackId(), ""); + assertEquals("", vfModule.getHeatStackId()); } @Test - public void updateHeatStackIdVfModuleExceptionTest() throws Exception { + public void updateHeatStackIdVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); expectedException.expect(BpmnError.class); @@ -371,7 +405,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception { + public void updateOrchestrationStatusActiveVolumeGroupTest() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -382,7 +416,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -390,7 +424,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception { + public void updateOrchestrationStatusCreatedVolumeGroupTest() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); @@ -401,7 +435,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception { + public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); @@ -409,7 +443,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception { + public void test_updateOrchestrationStatusAssignedVolumeGroup() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); @@ -421,7 +455,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception { + public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); @@ -429,7 +463,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVolumeGroupTest() throws Exception { + public void updateHeatStackIdVolumeGroupTest() { execution.setVariable("heatStackId", "newHeatStackId"); doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); @@ -440,18 +474,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVolumeGroupToNullTest() throws Exception { + public void updateHeatStackIdVolumeGroupToNullTest() { execution.setVariable("heatStackId", null); doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); - assertEquals(volumeGroup.getHeatStackId(), ""); + assertEquals("", volumeGroup.getHeatStackId()); } @Test - public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { + public void updateHeatStackIdVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); @@ -459,7 +493,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateNetworkExceptionTest() throws Exception { + public void updateNetworkExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiNetworkResources).updateNetwork(network); @@ -468,21 +502,21 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOstatusActivedNetworkCollectionTest() throws Exception { + public void updateOstatusActivedNetworkCollectionTest() { doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection()); } @Test - public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception { + public void updateOstatusActiveNetworkColectionExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); } @Test - public void updateOrchestrationStatusActivateVfModuleTest() throws Exception { + public void updateOrchestrationStatusActivateVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); @@ -493,7 +527,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusActivateVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); @@ -642,7 +676,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception { + public void updateOrchestrationStatusDeleteVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); @@ -668,7 +702,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusDeactivateFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); @@ -680,7 +714,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusActivateFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); @@ -692,7 +726,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusAssignedFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); @@ -704,7 +738,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { + public void updateContrailServiceInstanceFqdnVfModuleTest() { execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn"); doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); @@ -715,13 +749,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception { + public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() { aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution); verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); } @Test - public void updateIpv4OamAddressVnfTest() throws Exception { + public void updateIpv4OamAddressVnfTest() { execution.setVariable("oamManagementV4Address", "newIpv4OamAddress"); doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); @@ -732,13 +766,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception { + public void updateIpv4OamAddressVnfNoUpdateTest() { aaiUpdateTasks.updateIpv4OamAddressVnf(execution); verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); } @Test - public void updateManagementV6AddressVnfTest() throws Exception { + public void updateManagementV6AddressVnfTest() { execution.setVariable("oamManagementV6Address", "newManagementV6Address"); doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); @@ -749,13 +783,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateManagementV6AddressVnfNoUpdateTest() throws Exception { + public void updateManagementV6AddressVnfNoUpdateTest() { aaiUpdateTasks.updateManagementV6AddressVnf(execution); verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); } @Test - public void updateOrchestrationStatusVnfConfigureTest() throws Exception { + public void updateOrchestrationStatusVnfConfigureTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE); @@ -763,7 +797,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfiguredTest() throws Exception { + public void updateOrchestrationStatusVnfConfiguredTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED); @@ -777,7 +811,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfigAssignedTest() throws Exception { + public void updateOrchestrationStatusVnfConfigAssignedTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGASSIGNED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-assign"); @@ -786,7 +820,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfigDeployedTest() throws Exception { + public void updateOrchestrationStatusVnfConfigDeployedTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGDEPLOYED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-deploy"); @@ -795,7 +829,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVfModuleConfigDeployedTest() throws Exception { + public void updateOrchestrationStatusVfModuleConfigDeployedTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGDEPLOYED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-deploy"); @@ -804,7 +838,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVfModuleConfigAssignedTest() throws Exception { + public void updateOrchestrationStatusVfModuleConfigAssignedTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGASSIGNED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-assign"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java index 60bed17447..9e70a66b76 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java @@ -31,11 +31,14 @@ import java.util.Map; import java.util.Optional; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -43,9 +46,20 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.orchestration.NetworkAdapterResources; -public class NetworkAdapterCreateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterCreateTasksTest extends TestDataSetup { + + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; + @Mock + protected NetworkAdapterResources networkAdapterResources; @InjectMocks private NetworkAdapterCreateTasks networkAdapterCreateTasks = new NetworkAdapterCreateTasks(); @@ -77,7 +91,7 @@ public class NetworkAdapterCreateTasksTest extends BaseTaskTest { } @Test - public void createNetworkTest() throws Exception { + public void createNetworkTest() { String cloudRegionPo = "cloudRegionPo"; CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); execution.setVariable("cloudRegionPo", cloudRegionPo); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java index eb481651f0..6c9ec5932e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java @@ -27,27 +27,36 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.io.UnsupportedEncodingException; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterDeleteTasksTest extends TestDataSetup { -public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; @InjectMocks private NetworkAdapterDeleteTasks networkAdapterDeleteTasks = new NetworkAdapterDeleteTasks(); @@ -72,7 +81,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { } @Test - public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException { + public void test_deleteNetwork() { DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); doReturn(deleteNetworkRequest).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); @@ -83,7 +92,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { } @Test - public void test_deleteNetwork_exception() throws UnsupportedEncodingException, NetworkAdapterClientException { + public void test_deleteNetwork_exception() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(networkAdapterObjectMapper).deleteNetworkRequestMapper( diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java index 10cc09cdcc..cf97fa0b82 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java @@ -5,13 +5,20 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertNotNull; import javax.xml.bind.JAXBException; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.FileUtil; import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -public class NetworkAdapterImplTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterImplTest extends TestDataSetup { + @Mock + protected ExtractPojosForBB extractPojosForBB; @InjectMocks private NetworkAdapterImpl networkAdapterImpl = new NetworkAdapterImpl(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java index 64a315ad4d..082d410f96 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -21,28 +21,22 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.io.UnsupportedEncodingException; import java.util.Map; -import java.util.Optional; -import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; -import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; -import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -50,11 +44,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -public class NetworkAdapterUpdateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterUpdateTasksTest extends TestDataSetup { + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; @InjectMocks private NetworkAdapterUpdateTasks networkAdapterUpdateTasks = new NetworkAdapterUpdateTasks(); @@ -84,7 +83,7 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest { } @Test - public void updateNetworkTest() throws Exception { + public void updateNetworkTest() { String cloudRegionPo = "cloudRegionPo"; UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest(); execution.setVariable("cloudRegionPo", cloudRegionPo); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java index 13f2b81fd9..ef2e742795 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -30,12 +30,15 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -44,9 +47,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; import org.onap.so.db.catalog.beans.OrchestrationStatus; -public class VnfAdapterCreateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterCreateTasksTest extends TestDataSetup { + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + @Mock + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; @InjectMocks private VnfAdapterCreateTasks vnfAdapterCreateTasks = new VnfAdapterCreateTasks(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java index c680978953..e7b3d3e403 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java @@ -31,12 +31,15 @@ import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -45,8 +48,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; - -public class VnfAdapterDeleteTasksTest extends BaseTaskTest { +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterDeleteTasksTest extends TestDataSetup { + + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + @Mock + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; @InjectMocks private VnfAdapterDeleteTasks vnfAdapterDeleteTasks = new VnfAdapterDeleteTasks(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 16e8c2de7d..51bd77065b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -30,22 +30,30 @@ import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.FileUtil; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; - -public class VnfAdapterImplTest extends BaseTaskTest { - +import org.onap.so.client.exception.ExceptionBuilder; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterImplTest extends TestDataSetup { + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; @InjectMocks private VnfAdapterImpl vnfAdapterImpl = new VnfAdapterImpl(); @@ -159,12 +167,12 @@ public class VnfAdapterImplTest extends BaseTaskTest { execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); - assertEquals(vfModule.getContrailServiceInstanceFqdn(), ""); - assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), ""); - assertEquals(genericVnf.getIpv4OamAddress(), ""); - assertEquals(execution.getVariable("oamManagementV4Address"), ""); - assertEquals(genericVnf.getManagementV6Address(), ""); - assertEquals(execution.getVariable("oamManagementV6Address"), ""); + assertEquals("", vfModule.getContrailServiceInstanceFqdn()); + assertEquals("", execution.getVariable("contrailServiceInstanceFqdn")); + assertEquals("", genericVnf.getIpv4OamAddress()); + assertEquals("", execution.getVariable("oamManagementV4Address")); + assertEquals("", genericVnf.getManagementV6Address()); + assertEquals("", execution.getVariable("oamManagementV6Address")); assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList")); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java index d7d6da209e..ad965373dc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java @@ -34,13 +34,16 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Optional; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -48,14 +51,23 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.db.catalog.client.CatalogDbClient; -public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class AppcOrchestratorPreProcessorTest extends TestDataSetup { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected AAIVnfResources aaiVnfResources; + @Mock + protected CatalogDbClient catalogDbClient; @InjectMocks private AppcOrchestratorPreProcessor appcOrchestratorPreProcessor = new AppcOrchestratorPreProcessor(); @@ -111,7 +123,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { } @Test - public void addVmInfoToAppcTaskRequestTest() throws Exception { + public void addVmInfoToAppcTaskRequestTest() { ApplicationControllerTaskRequest appcTaskRequest = new ApplicationControllerTaskRequest(); ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf(); appcTaskRequest.setApplicationControllerVnf(applicationControllerVnf); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java index d2a38cb693..e386dff4a1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -37,25 +37,43 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.db.catalog.client.CatalogDbClient; -public class AppcRunTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class AppcRunTasksTest extends TestDataSetup { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected CatalogDbClient catalogDbClient; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ApplicationControllerAction appCClient; + @Mock + protected AAIVnfResources aaiVnfResources; @InjectMocks private AppcRunTasks appcRunTasks = new AppcRunTasks(); @@ -171,7 +189,7 @@ public class AppcRunTasksTest extends BaseTaskTest { } @Test - public void testUserParams() throws Exception { + public void testUserParams() { Map<String, Object> userParams = new HashMap<String, Object>(); userParams.put("existing_software_version", "3.1"); userParams.put("new_software_version", "3.2"); |