aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource
diff options
context:
space:
mode:
authorJulienBe <julien.bertozzi@intl.att.com>2020-10-28 11:50:25 -0400
committerJulienBe <julien.bertozzi@intl.att.com>2021-02-23 10:57:28 +0100
commitb485c37b36ddb3ab5e8085c009b26e97c8e62d74 (patch)
treedcea5bd91cf72076295d46f430c725d13b42f275 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource
parent72b29baac0c1f08b610fd4daf2078b43ee74b3d8 (diff)
Upgrade Vulnerable Direct Dependencies [snakeyaml]
Change-Id: I84417ab3d4f18634be519b837a34d1f1e774ceff Signed-off-by: amohamad <a.mohamad@queensu.ca> Issue-ID: SDC-3051 Updated MVN dependencies in the respective pom.xml files Updated the signature of some methods to match new version 1.26 Modified test cases to match the new wording of exceptions Still working on troublshooting other failing test cases Change-Id: Ifc796574e6d8d4e4fc707db04944d83427b5dbe6 Signed-off-by: amohamad <a.mohamad@queensu.ca> Signed-off-by: JulienBe <julien.bertozzi@intl.att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java242
8 files changed, 137 insertions, 143 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java
index 43041140a3..707848f1bd 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java
@@ -37,7 +37,7 @@ public class ContrailNetworkPolicyResourceValidatorTest {
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/network_policy_associated_with_attach_policy/";
@Test
public void testNetworkPolicyAssociatedWithAttachPolicy() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator
, HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE.getHeatResource(),
PATH + "positive");
@@ -52,7 +52,7 @@ public class ContrailNetworkPolicyResourceValidatorTest {
@Test
public void testNonNetworkPolicyResource() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator
, HeatResourcesTypes.CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource(),
PATH + "negative");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java
index b864a2d557..d8cecc9ca1 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java
@@ -38,7 +38,7 @@ public class NestedResourceValidatorTest {
@Test
public void testNoLoopsNesting() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "no_loops_nesting/negative_test/input");
@@ -74,7 +74,7 @@ public class NestedResourceValidatorTest {
@Test
public void testPropertiesMatchNestedParameters() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "properties_match_nested_parameters/negative_test/input");
@@ -89,7 +89,7 @@ public class NestedResourceValidatorTest {
@Test
public void testWrongValueTypeAssigned() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "properties_match_nested_parameters/wrong_value_type_assigned/input");
@@ -107,7 +107,7 @@ public class NestedResourceValidatorTest {
final Resource resource = new Resource();
resource.setType("nested-pps_v1.0.yaml");
- final GlobalValidationContext globalValidationContext = ValidationTestUtil.createGlobalContextFromPath(PATH + "missing_nested_file/input");
+ final GlobalValidationContext globalValidationContext = new ValidationTestUtil().createGlobalContextFromPath(PATH + "missing_nested_file/input");
NestedResourceValidator.validateAllPropertiesMatchNestedParameters(null, null, resource, Optional.empty(), globalValidationContext);
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java
index 10c70b64d4..0e02a1d6ee 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java
@@ -36,7 +36,7 @@ public class NeutronPortResourceValidatorTest {
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testMoreThanOneBindFromNovaToPort() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(),
PATH + "one_nova_points_to_one_port/negative_test/input");
@@ -51,7 +51,7 @@ public class NeutronPortResourceValidatorTest {
@Test
public void testPortNotBindToAnyNovaServerHPR1() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "no_neutron_port/input");
@@ -66,7 +66,7 @@ public class NeutronPortResourceValidatorTest {
@Test
public void testPortNotBindToAnyNovaServerHPR3() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "port_no_bind_to_any_nova_server/input");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java
index fabc833106..10de81350d 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java
@@ -37,7 +37,7 @@ public class NeutronSecurityGroupResourceValidatorTest {
@Test
public void testSecurityGroupBaseFileNoPorts() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator,
HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "security_group_base_file_no_ports/input");
@@ -52,7 +52,7 @@ public class NeutronSecurityGroupResourceValidatorTest {
@Test
public void testSecurityGroupsCalledByPort() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(baseValidator,
resourceValidator,
HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "security_group_called_by_port/input");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java
index e9c70b0251..b22dd4df4a 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java
@@ -35,7 +35,7 @@ public class NovaServerGroupResourceValidatorTest {
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testPolicyIsAffinityOrAntiAffinity() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "policy_is_affinity_or_anti_affinity/negative_test/input");
@@ -50,7 +50,7 @@ public class NovaServerGroupResourceValidatorTest {
@Test
public void testServerGroupCalledByServer() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "server_group_called_by_nova_server/input");
@@ -66,7 +66,7 @@ public class NovaServerGroupResourceValidatorTest {
@Test
public void testNonServerGroup() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "server_group_called_by_nova_server_negative/input");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java
index 63523329cc..d56a5eaf2b 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java
@@ -35,7 +35,7 @@ public class NovaServerResourceValidatorTest {
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testNovaPropertiesHasAssignedValue() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "nova_properties_has_assigned_value/negative_test/input");
@@ -50,7 +50,7 @@ public class NovaServerResourceValidatorTest {
@Test
public void testServerGroupsPointedByServersDefinedCorrectly() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "server_groups_defined_correctly/negative_test/input");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java
index 07cfaf7481..b80788a9c3 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java
@@ -35,7 +35,7 @@ public class ResourceGroupResourceValidatorTest {
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testResourceGroupWithInvalidIndexVar() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "resource_group_invalid_indexvar/negative_test/input");
@@ -89,7 +89,7 @@ public class ResourceGroupResourceValidatorTest {
@Test
public void testResourceGroupWithInvalidType() {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "resource_group_invalid_type/negative_test/input");
@@ -110,7 +110,7 @@ public class ResourceGroupResourceValidatorTest {
@Test
public void testResourcesGroupWithNested() {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "resources_group_with_nested/negative_test/input");
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java
index 9fcef284a9..4a8e7970b5 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java
@@ -17,6 +17,7 @@
package org.openecomp.sdc.validation.impl.validators.heatresource;
import java.util.Map;
+
import org.junit.Assert;
import org.junit.Test;
import org.openecomp.core.validation.types.MessageContainer;
@@ -30,128 +31,121 @@ import org.openecomp.sdc.validation.util.ValidationTestUtil;
*/
public class VirtualMachineInterfaceValidatorTest {
- private static final String PATH =
- "/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/";
-
-
- @Test
- public void hasSingleParentPortNegative() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/negative_test/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 1);
-
- Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1);
- Assert.assertEquals(
- messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
- "ERROR: [VLAN1]: More than one parent port found, " +
- "there should be only one parent port for a VLAN sub-interface ID [template_Vlan_2]");
- }
-
- @Test
- public void hasSingleParentPortNegativeWithGetResource() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/negative_get_resource/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 0);
- }
-
-
- @Test
- public void hasSingleParentPortPositive() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/positive_test/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 0);
-
-
- }
-
-
- @Test
- public void hasBothPropertiesNegativeMissingVlanTag() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_has_two_properties/negative_tag_missing/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 1);
-
- Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1);
- Assert.assertEquals(
- messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
- "WARNING: [VLAN2]: VLAN Tag property " +
- "virtual_machine_interface_properties_sub_interface_vlan_tag " +
- "is missing in VLAN Resource ID [template_Vlan_2]");
- }
-
- @Test
- public void hasBothPropertiesNegativeMissingRefs() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_has_two_properties/negative_refs_missing/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 1);
-
- Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1);
- Assert.assertEquals(
- messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
- "WARNING: [VLAN2]: Parent port property virtual_machine_interface_refs is " +
- "missing in VLAN Resource ID [template_Vlan_2]");
- }
-
- @Test
- public void hasBothPropertiesBothMissingWhichMeansPositive() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_has_two_properties/negative_both_missing/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 0);
-
- }
-
-
- @Test
- public void hasBothPropertiesPositive() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_has_two_properties/positive_test/input");
-
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 0);
-
-
- }
-
-
-
+ private static final String PATH =
+ "/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/";
+
+
+ @Test
+ public void hasSingleParentPortNegative() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_multiple_parent_ports/negative_test/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(1, messages.size());
+
+ Assert.assertEquals(1, messages.get("nested.yml").getErrorMessageList().size());
+ Assert.assertEquals(
+ messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
+ "ERROR: [VLAN1]: More than one parent port found, " +
+ "there should be only one parent port for a VLAN sub-interface ID [template_Vlan_2]");
+ }
+
+ @Test
+ public void hasSingleParentPortNegativeWithGetResource() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_multiple_parent_ports/negative_get_resource/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 0);
+ }
+
+
+ @Test
+ public void hasSingleParentPortPositive() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_multiple_parent_ports/positive_test/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(0, messages.size());
+ }
+
+
+ @Test
+ public void hasBothPropertiesNegativeMissingVlanTag() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_has_two_properties/negative_tag_missing/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 1);
+
+ Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(
+ messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [VLAN2]: VLAN Tag property " +
+ "virtual_machine_interface_properties_sub_interface_vlan_tag " +
+ "is missing in VLAN Resource ID [template_Vlan_2]");
+ }
+
+ @Test
+ public void hasBothPropertiesNegativeMissingRefs() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_has_two_properties/negative_refs_missing/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 1);
+
+ Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(
+ messages.get("nested.yml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [VLAN2]: Parent port property virtual_machine_interface_refs is " +
+ "missing in VLAN Resource ID [template_Vlan_2]");
+ }
+
+ @Test
+ public void hasBothPropertiesBothMissingWhichMeansPositive() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_has_two_properties/negative_both_missing/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 0);
+
+ }
+
+
+ @Test
+ public void hasBothPropertiesPositive() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
+ resourceValidator,
+ HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
+ PATH + "vlan_has_two_properties/positive_test/input");
+
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 0);
+ }
} \ No newline at end of file