diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
3 files changed, 44 insertions, 24 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java new file mode 100644 index 0000000000..57e463c0f8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java @@ -0,0 +1,24 @@ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; + +public class ActivateVfModuleTest extends BaseTaskTest { + + @InjectMocks + private ActivateVfModule activateVfModule = new ActivateVfModule(); + + @Test + public void setWaitBeforeDurationTest() throws Exception { + when(env.getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION)).thenReturn("PT300S"); + activateVfModule.setTimerDuration(execution); + verify(env, times(1)).getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION); + assertEquals("PT300S", (String) execution.getVariable("vfModuleActivateTimerDuration")); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 7da4e87d3b..4bdbd1a846 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -30,6 +30,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -99,24 +100,6 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ } @Test - public void testSetNetworkTechnology() { - String networkTechnology = "Contrail"; - NetworkTechnology expectedNetworkTechnology = NetworkTechnology.CONTRAIL; - NetworkTechnology actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Neutron"; - expectedNetworkTechnology = NetworkTechnology.NEUTRON; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Vmware"; - expectedNetworkTechnology = NetworkTechnology.VMWARE; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - } - @Test public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { String cloudRegionPo = "cloudRegionPo"; @@ -129,12 +112,17 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); expectedCreateNetworkRequest.setBackout(false); expectedCreateNetworkRequest.setFailIfExists(true); - expectedCreateNetworkRequest.setNetworkTechnology(NetworkTechnology.CONTRAIL); + expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL"); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId(requestContext.getMsoRequestId()); msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); expectedCreateNetworkRequest.setMsoRequest(msoRequest); expectedCreateNetworkRequest.setSkipAAI(true); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); + expectedCreateNetworkRequest.setNetworkParams(networkParams); expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId"); @@ -148,13 +136,15 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); l3Network.setNetworkTechnology("Contrail"); + l3Network.setIsSharedNetwork(true); + l3Network.setIsExternalNetwork(false); doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint(); doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid(); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); - assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("messageId")); } @Test @@ -243,6 +233,12 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ l3Network.getSubnets().add(actualSubnet); l3Network.getNetworkPolicies().add(networkPolicy); l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference); + l3Network.setIsSharedNetwork(false); + l3Network.setIsExternalNetwork(false); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "false"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest(); expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); @@ -256,7 +252,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedUpdateNetworkRequest.setSubnets(subnets); expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork); - expectedUpdateNetworkRequest.setNetworkParams(userInput); + expectedUpdateNetworkRequest.setNetworkParams(networkParams); expectedUpdateNetworkRequest.setMsoRequest(msoRequest); expectedUpdateNetworkRequest.setSkipAAI(true); expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index f5ce1d3871..82ffdf9559 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -159,7 +159,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<VpnBinding> oVpnBinding = Optional.empty(); - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID", "serviceModelVersionId"); + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID"); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri); @@ -176,7 +176,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<NetworkPolicy> oNetPolicy = Optional.empty(); - AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID", "serviceModelVersionId"); + AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID"); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); @@ -193,7 +193,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<RouteTableReference> oRtref = Optional.empty(); - AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID", "serviceModelVersionId"); + AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID"); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oRtref = aaiNetworkResources.getRouteTable(rTRefUri); |