diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2020-06-04 12:52:07 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-06-04 12:52:07 -0400 |
commit | a3b0c74345d2dbf981d49493ef498e28e867a144 (patch) | |
tree | f4f0dcf5c3055b65832057afb25a72e281179035 /mso-api-handlers/mso-api-handler-infra/src/test/java | |
parent | f239be089f523a016cf52f723638c060f899978f (diff) |
mso to add validation for vf module instantiation
Updated validator to accept action on validate
Added VnfInServiceValidator and unit tests
Issue-ID: SO-2975
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I5e1d7a40dab6a447588cac55edade5e2823e7dac
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java')
4 files changed, 12 insertions, 12 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java index 7780f0ee2b..20ec6d6708 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java @@ -58,7 +58,7 @@ public class NetworkDeleteValidatorTest { public void validateSuccessTest() { instanceIdMap.put("networkInstanceId", "1"); when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(false); - Optional<String> result = networkValidator.validate(instanceIdMap, null, null); + Optional<String> result = networkValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -66,7 +66,7 @@ public class NetworkDeleteValidatorTest { public void validateFailureTest() { instanceIdMap.put("networkInstanceId", "1"); when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(true); - Optional<String> result = networkValidator.validate(instanceIdMap, null, null); + Optional<String> result = networkValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java index f461df3720..c082c96074 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java @@ -76,7 +76,7 @@ public class ServiceInstanceDeleteValidatorTest { when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(false); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -84,7 +84,7 @@ public class ServiceInstanceDeleteValidatorTest { public void validateFailureVnfTest() { instanceIdMap.put("serviceInstanceId", "1"); when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -93,7 +93,7 @@ public class ServiceInstanceDeleteValidatorTest { instanceIdMap.put("serviceInstanceId", "1"); when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -103,7 +103,7 @@ public class ServiceInstanceDeleteValidatorTest { when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java index 65ce355ad1..6eb6fc95d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java @@ -53,7 +53,7 @@ public class VnfDeleteValidatorTest { public void validateFailureVfModuleVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.of("test")).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -61,7 +61,7 @@ public class VnfDeleteValidatorTest { public void validateSuccessVfModuleVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.empty()).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -69,7 +69,7 @@ public class VnfDeleteValidatorTest { public void validateFailureVolumeGroupVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.of("test")).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -77,7 +77,7 @@ public class VnfDeleteValidatorTest { public void validateSuccessVolumeGroupVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.empty()).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java index 3d81ee66c9..7aa12a61a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java @@ -54,7 +54,7 @@ public class VolumeGroupDeleteValidatorTest { public void validateSuccessTest() { instanceIdMap.put("volumeGroupInstanceId", "1"); when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false); - Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null); + Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -62,7 +62,7 @@ public class VolumeGroupDeleteValidatorTest { public void validateFailureVnfTest() { instanceIdMap.put("volumeGroupInstanceId", "1"); when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true); - Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null); + Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } |