summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-11-20 18:24:20 +0530
committermojahidi <mojahidul.islam@amdocs.com>2017-11-20 18:24:30 +0530
commit9b2e29efa7cc069a119ef2e4894a93a7fc31b6f5 (patch)
tree08aa50cae02c46f21553a36ea2c76d992fcd6136 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
parent56d40d922c89b9837560c4ca739cafeef566287c (diff)
ContrailServiceTemplate validator
This task is about updating error messages with error codes for ContrailServiceTemplateNamingConventionValidator validator Change-Id: I7d06d0cae2cd3c1ecc10d971db3e7c89bca585a9 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')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java35
1 files changed, 25 insertions, 10 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/ContrailServiceTemplateNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java
index 1a04d94748..681c54b12e 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java
@@ -18,40 +18,55 @@ public class ContrailServiceTemplateNamingConventionValidatorTest {
HeatResourceValidator baseValidator = new HeatResourceValidator();
ContrailServiceTemplateNamingConventionValidator resourceValidator = new
ContrailServiceTemplateNamingConventionValidator();
+ private static final String PATH="/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/";
@Test
public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConventionButDifferentVmType() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype");
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
+ PATH + "imageandflavordifferentvmtype");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(
- messages.get(messages.keySet().iterator().next()).getErrorMessageList().size(), 1);
+ messages.get(messages.keySet().iterator().next()).getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Service Template naming convention in Image and Flavor properties is not consistent in Resource, Resource ID service_template");
+ "WARNING: [NST1]: Service Template naming convention in Image and Flavor properties is not consistent in Resource, Resource ID service_template");
}
@Test
public void testContrailServiceTemplateImageAndFlavorNamesNotAlignedWithNamingConvention() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned");
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
+ PATH + "/notaligned");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Service Template 'image_name' Parameter Name not aligned with Guidelines, Parameter Name [st_imaage_name], Resource ID [service_template]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NST3]: Service Template 'image_name' Parameter Name not aligned with Guidelines, Parameter Name [st_imaage_name], Resource ID [service_template]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Service Template 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [st_flavaor_name], Resource ID [service_template]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NST3]: Service Template 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [st_flavaor_name], Resource ID [service_template]. As a result, VF/VFC Profile may miss this information");
}
@Test
public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConvention() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned");
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
+ PATH + "aligned");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
}
+
+ @Test
+ public void testContrailServiceTemplateMissingParam() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
+ PATH + "missingparam");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 1);
+ Assert.assertEquals(
+ messages.get(messages.keySet().iterator().next()).getErrorMessageList().size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NST2]: Missing get_param in image_name, Resource Id [service_template]");
+ }
+
}