summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
diff options
context:
space:
mode:
authoreleonorali <eleonoral@amdocs.com>2018-08-06 11:25:37 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-08-06 11:46:15 +0000
commitb503f5b618a0c14b91714bb32de69f0957ab1f03 (patch)
treedf9d751581d67645fc6f86fe4039c8ea43deab3a /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
parentaa8057fa429db6852a86ad217a641bb2bf12123c (diff)
Add HEAT validation for generated artifacts
Add heat validation for generated artifacts, like vendor-license-model.xml, vf-license-model.xml, HEAT.meta Change-Id: Ie256b19679b5aebea1290f6b3f67692dfad5e980 Issue-ID: SDC-1600 Signed-off-by: eleonorali <eleonoral@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/HeatValidatorTest.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java
index 2ec119e665..96b9ad613d 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java
@@ -22,12 +22,15 @@ package org.openecomp.sdc.validation.impl.validators;
import org.openecomp.core.validation.types.MessageContainer;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.validation.Validator;
import org.openecomp.sdc.validation.util.ValidationTestUtil;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.IOException;
+import java.util.List;
import java.util.Map;
@@ -159,7 +162,29 @@ public class HeatValidatorTest {
"WARNING: [HOT10]: Invalid HEAT format problem - " +
"[The heat file does not contain any resources]");
Assert.assertEquals(messages.get("mount_iso_script.sh").getErrorMessageList().get(0).
- getMessage(),"WARNING: [HOT11]: Artifact file is not referenced.");
+ getMessage(),
+ "WARNING: [HOT11]: Artifact file is not referenced.");
+ }
+
+ @Test
+ public void testGeneratedArtifactExistInHeat() throws IOException {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ RESOURCE_PATH + "/generated_artifact_exist/negative_test/input");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 3);
+ checkGeneratedArtifactMessage(HeatValidator.VENDOR_LICENSE_MODEL_XML, messages);
+ checkGeneratedArtifactMessage(HeatValidator.VF_LICENSE_MODEL_XML, messages);
+ checkGeneratedArtifactMessage(HeatValidator.HEAT_META, messages);
+ }
+
+
+ private void checkGeneratedArtifactMessage(String fileName, Map<String, MessageContainer> messages) {
+ List<ErrorMessage> errorMessages = messages.get(fileName).getErrorMessageList();
+ Assert.assertEquals(errorMessages.size(), 2);
+ Assert.assertEquals(errorMessages.get(0).getMessage(),
+ "WARNING: [HOT11]: Artifact file is not referenced.");
+ String message = String.format(Messages.GENERATED_ARTIFACT_IN_USE.getErrorMessage(), fileName);
+ Assert.assertTrue(errorMessages.get(1).getMessage().contains(message));
}
@Test