summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test')
-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
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/MANIFEST.json23
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/illegalTypeFile.yaml0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.env.illegalSuffix0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.yaml.illegalSuffix0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/singleVol.yaml.illegalSuffix0
6 files changed, 60 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");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/MANIFEST.json
new file mode 100644
index 0000000000..ce7f17dbae
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/MANIFEST.json
@@ -0,0 +1,23 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "type": "HEAT",
+ "data": [
+ {
+ "file": "single.env.illegalSuffix",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "singleVol.yaml.illegalSuffix",
+ "type": "HEAT_VOL"
+ }
+ ]
+ },{
+ "file": "illegalTypeFile.yaml",
+ "type": "ILLEGAL_TYPE"
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/illegalTypeFile.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/illegalTypeFile.yaml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/illegalTypeFile.yaml
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.env.illegalSuffix b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.env.illegalSuffix
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.env.illegalSuffix
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.yaml.illegalSuffix b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.yaml.illegalSuffix
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/single.yaml.illegalSuffix
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/singleVol.yaml.illegalSuffix b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/singleVol.yaml.illegalSuffix
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/manifestValidator/missingFileTypeInManifest/singleVol.yaml.illegalSuffix