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-21 18:29:34 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2017-11-21 14:34:14 +0000
commite077e4031a7b2aa76ec60237372f9014c27d6d78 (patch)
tree234546cac1c1d6b11acec35d25c217c15393c4f6 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
parented04775c4af26f795dcd2e35bbbfc891e0cde9e2 (diff)
Added error codes in ManifestValidator
This task is about updating error messages with error codes for ManifestValidator Change-Id: I17ec448a380604e6b554f33760a734fe93831616 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/ManifestValidatorTest.java60
1 files changed, 37 insertions, 23 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java
index 3d560934dd..391eb633ac 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java
@@ -34,13 +34,14 @@ import java.util.Map;
public class ManifestValidatorTest {
+ private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/manifestValidator";
private ManifestValidator validator = new ManifestValidator();
@Test
public void testValidManifest() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/manifestValidator/validFiles");
+ RESOURCE_PATH + "/validFiles");
Assert.assertNotNull(messages);
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
@@ -49,44 +50,54 @@ public class ManifestValidatorTest {
@Test
public void testManifestMissingFileInZip() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/missingFileInZip");
+ RESOURCE_PATH + "/missingFileInZip");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertTrue(messages.containsKey("singleVol.yaml"));
- ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.MISSING_FILE_IN_ZIP.getErrorMessage());
+ ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList()
+ .get(0).getMessage(),
+ "ERROR: " + "[MNF4]: " + Messages.MISSING_FILE_IN_ZIP.getErrorMessage());
}
@Test
public void testInvalidManifest() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/invalidManifest");
+ RESOURCE_PATH + "/invalidManifest");
Assert.assertNotNull(messages);
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertTrue(messages.containsKey(SdcCommon.MANIFEST_NAME));
ValidationTestUtil.validateErrorMessage(
messages.get(SdcCommon.MANIFEST_NAME).getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.INVALID_MANIFEST_FILE.getErrorMessage(), SdcCommon.MANIFEST_NAME);
+ "ERROR: " +"[MNF6]: " + Messages.INVALID_MANIFEST_FILE.getErrorMessage());
}
@Test
public void testMissingFileInManifest() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/missingFileInManifest");
+ RESOURCE_PATH + "/missingFileInManifest");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertTrue(messages.containsKey("extraFile.env"));
- ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList().get(0).getMessage(),
- "WARNING: " + Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage());
+ ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList()
+ .get(0).getMessage(),
+ "WARNING: " + "[MNF5]: " + Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage());
}
+ @Test
+ public void testMissingFileTypeInManifest() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ RESOURCE_PATH + "/missingFileTypeInManifest");
+ ValidationTestUtil.validateErrorMessage(
+ messages.get("MANIFEST.json").getErrorMessageList().get(0).getMessage(),
+ "ERROR: " + "[MNF7]: Missing file name in manifest");
+ }
@Test
public void testInvalidFileTypeInManifest() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/invalidFileTypeInManifest");
+ RESOURCE_PATH + "/invalidFileTypeInManifest");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 4);
Assert.assertTrue(messages.containsKey("single.env.illegalSuffix"));
@@ -95,18 +106,19 @@ public class ManifestValidatorTest {
Assert.assertTrue(messages.containsKey("singleVol.yaml.illegalSuffix"));
ValidationTestUtil.validateErrorMessage(
messages.get("single.env.illegalSuffix").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.WRONG_ENV_FILE_EXTENSION.getErrorMessage(),
+ "ERROR: "+"[MNF3]: " + Messages.WRONG_ENV_FILE_EXTENSION.getErrorMessage(),
"single.env.illegalSuffix");
ValidationTestUtil.validateErrorMessage(
messages.get("illegalTypeFile.yaml").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.INVALID_FILE_TYPE.getErrorMessage(), "illegalTypeFile.yaml");
+ "ERROR: "+"[MNF8]: " + Messages.INVALID_FILE_TYPE.getErrorMessage(),
+ "illegalTypeFile.yaml");
ValidationTestUtil.validateErrorMessage(
messages.get("single.yaml.illegalSuffix").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(),
+ "ERROR: "+"[MNF2]: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(),
"single.yaml.illegalSuffix");
ValidationTestUtil.validateErrorMessage(
messages.get("singleVol.yaml.illegalSuffix").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(),
+ "ERROR: "+"[MNF2]: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(),
"singleVol.yaml.illegalSuffix");
}
@@ -116,27 +128,29 @@ public class ManifestValidatorTest {
public void testMissingFileInManifestAndInZip() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/missingFileInManifestAndInZip");
+ RESOURCE_PATH + "/missingFileInManifestAndInZip");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 2);
Assert.assertTrue(messages.containsKey("extraFile.env"));
Assert.assertTrue(messages.containsKey("singleVol.yaml"));
- ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList().get(0).getMessage(),
- "WARNING: " + Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage());
- ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList().get(0).getMessage(),
- "ERROR: " + Messages.MISSING_FILE_IN_ZIP.getErrorMessage());
+ ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList()
+ .get(0).getMessage(), "WARNING: " + "[MNF5]: "+ Messages.MISSING_FILE_IN_MANIFEST
+ .getErrorMessage());
+ ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList()
+ .get(0).getMessage(), "ERROR: " + "[MNF4]: " + Messages.MISSING_FILE_IN_ZIP
+ .getErrorMessage());
}
-
@Test
public void testEnvInRoot() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
- "/org/openecomp/validation/validators/manifestValidator/envInRoot");
+ RESOURCE_PATH + "/envInRoot");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertTrue(messages.containsKey("second.env"));
- ValidationTestUtil.validateErrorMessage(messages.get("second.env").getErrorMessageList().get(0).getMessage(),
- "ERROR: ENV file must be associated to a HEAT file");
+ ValidationTestUtil.validateErrorMessage(messages.get("second.env").getErrorMessageList()
+ .get(0).getMessage(),
+ "ERROR: [MNF1]: ENV file must be associated to a HEAT file");
}
}