summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-16 15:23:45 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-16 15:28:56 +0200
commitfa2918d945c6fad84055caca8912d2efe242ed6f (patch)
treec810c6f09b228024c4620d591d8b2398e8be071e /vid-app-common/src/test/java/org
parent737ebabf3a0054c801d60af2b3ec59a08c24370f (diff)
Limit vfmodule tenant and region dictation to "create"
Other flows (e.g. Delete) are expected to have literal designation. Verified in API test "delete1VnfWithVfModulesAndCreate1VnfFromService". Issue-ID: VID-758 Change-Id: Ib543ff98ecf96e1df0e5741fbdbba2e64e602528 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt19
1 files changed, 17 insertions, 2 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt b/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
index 660abe4d2..977966271 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
@@ -37,6 +37,7 @@ import org.onap.vid.services.AsyncInstantiationBusinessLogic
import org.onap.vid.testUtils.TestUtils
import org.onap.vid.testUtils.TestUtils.initMockitoMocks
import org.testng.annotations.BeforeMethod
+import org.testng.annotations.DataProvider
import org.testng.annotations.Test
import org.togglz.core.manager.FeatureManager
import org.mockito.Mockito.`when` as _when
@@ -65,8 +66,22 @@ class VnfCommandTest {
@Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils::class)
fun `childVfModuleWithVnfRegionAndTenant -- given vfmodule -- tenant and region are copied from vnf`(featureToggleOn: Boolean) {
+ runChildVfModuleWithVnfRegionAndTenant(featureToggleOn, Action.Create, featureToggleOn)
+ }
+
+ @DataProvider
+ fun allPossibleActions(): Array<Array<out Any?>> {
+ return Action.values().map { arrayOf(it) }.toTypedArray()
+ }
+
+ @Test(dataProvider = "allPossibleActions")
+ fun `childVfModuleWithVnfRegionAndTenant -- given vfmodule in different actions -- only "action_Create" copies tenant and region from vnf`(vfModuleAction: Action) {
+ runChildVfModuleWithVnfRegionAndTenant(true, vfModuleAction, vfModuleAction == Action.Create)
+ }
+
+ private fun runChildVfModuleWithVnfRegionAndTenant(featureToggleOn: Boolean, vfModuleAction: Action, isCopyVnfToVfmoduleExpected: Boolean) {
- val vfModule = FakeResourceCreator.createVfModule(Action.Create)
+ val vfModule = FakeResourceCreator.createVfModule(vfModuleAction)
.cloneWith("vfmodule-lcp-cloud-region-id", "vfmodule-tenant-id")
_when(featureManager.isActive(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)).thenReturn(featureToggleOn)
@@ -77,7 +92,7 @@ class VnfCommandTest {
vnfCommand.init(jobSharedData, mapOf())
- val expectedSource = if (featureToggleOn) "vnf" else "vfmodule"
+ val expectedSource = if (isCopyVnfToVfmoduleExpected) "vnf" else "vfmodule"
assertThat(vnfCommand.childVfModuleWithVnfRegionAndTenant(vfModule),
allOf(