diff options
author | mojahidi <mojahidul.islam@amdocs.com> | 2017-11-20 18:40:53 +0530 |
---|---|---|
committer | mojahidi <mojahidul.islam@amdocs.com> | 2017-11-20 18:41:06 +0530 |
commit | b6843f237e6ef2dfa25d0d9b4ca58a18634966a0 (patch) | |
tree | 04242bc3648d46623003ea470189cc04c286b416 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java | |
parent | 9b2e29efa7cc069a119ef2e4894a93a7fc31b6f5 (diff) |
NeutronPort validator
This task is about updating error messages with error codes for NeutronPortNamingConventionValidator
Change-Id: I045415f026f947661632262676123ff848e582b0
Issue-ID:SDC-572
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java')
1 files changed, 28 insertions, 14 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index 8ba5a27c36..1a7b6081d1 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -18,46 +18,60 @@ public class NeutronPortNamingConventionValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); NeutronPortNamingConventionValidator resourceValidator = new NeutronPortNamingConventionValidator(); - + private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/"; @Test public void testHeatPortNetworkNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/"); + resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + PATH + "positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/"); + resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + PATH + "negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: Port 'Network' Parameter Name not aligned with Guidelines, Parameter Name [not_valid_network_name], Resource ID [port_resource]. As a result, VF/VFC Profile may miss this information"); + "WARNING: [NNP3]: Port 'Network' Parameter Name not aligned with Guidelines, Parameter Name [not_valid_network_name], Resource ID [port_resource]. As a result, VF/VFC Profile may miss this information"); } @Test public void testNeutronFixedIpName() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive"); + resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + PATH + "positiveFixedIP"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/"); + resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + PATH + "negativeFixedIP/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v6_ip_a], Resource ID [port_resource_0]. As a result, VF/VFC Profile may miss this information"); + "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v6_ip_a], Resource ID [port_resource_0]. As a result, VF/VFC Profile may miss this information"); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(), - "WARNING: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [indx], Resource ID [port_resource_1]. As a result, VF/VFC Profile may miss this information"); + "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [indx], Resource ID [port_resource_1]. As a result, VF/VFC Profile may miss this information"); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(), - "WARNING: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_ipz], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); + "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_ipz], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(), - "WARNING: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v0_ip_3], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); + "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v0_ip_3], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); + } + + @Test + public void testMissingParam() { + Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, + resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + PATH + "missingparam/"); + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 1); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + "WARNING: [NNP2]: Missing get_param in network or network_id, Resource Id [port_resource_2]"); } } |