From 01176bd6522e942175ce8429f74ef29e643142b8 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan (sk720x)" Date: Tue, 11 Dec 2018 12:12:32 -0500 Subject: Skip cloud regions and fix macro changed aai create tasks to use env instead of urn prop write serviceInstanceId from resource when exec is null Change-Id: I2c0acbeeded2b8a4b0afb0f27d65e24fa48b907b Issue-ID: SO-1329 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) --- .../src/test/java/org/onap/so/bpmn/BaseTaskTest.java | 16 ++++++---------- .../infrastructure/aai/tasks/AAICreateTasksTest.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/test/java/org') diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java index f83c968c93..7715de9672 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.buildingblock.SniroHomingV2; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; @@ -53,13 +51,9 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; -import org.onap.so.client.sdnc.SDNCClient; -import org.onap.so.client.sniro.SniroClient; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.client.RequestsDbClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.core.env.Environment; @RunWith(MockitoJUnitRunner.Silent.class) public abstract class BaseTaskTest extends TestDataSetup { @@ -150,7 +144,9 @@ public abstract class BaseTaskTest extends TestDataSetup { @Mock protected ExceptionBuilder exceptionUtil; - @Mock - protected WorkflowActionExtractResourcesAAI workflowActionUtils; - + @Mock + protected WorkflowActionExtractResourcesAAI workflowActionUtils; + + @Mock + protected Environment env; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index b2e46f6130..da7e727488 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -426,6 +426,18 @@ public class AAICreateTasksTest extends BaseTaskTest{ verify(aaiVnfResources, times(1)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); } + @Test + public void connectNoneToVnfToCloudRegionTest() throws Exception { + String[] arr = new String[1]; + arr[0] = "test25Region2"; + doReturn(arr).when(env).getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class); + gBBInput = execution.getGeneralBuildingBlock(); + gBBInput.getCloudRegion().setLcpCloudRegionId("test25Region2"); + doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + aaiCreateTasks.connectVnfToCloudRegion(execution); + verify(aaiVnfResources, times(0)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + } + @Test public void connectVnfTenantTest() throws Exception { gBBInput = execution.getGeneralBuildingBlock(); -- cgit 1.2.3-korg