summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
diff options
context:
space:
mode:
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/ForbiddenResourceGuideLineValidatorTest.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java
index 90f9a759a6..e5240a3147 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java
@@ -14,6 +14,8 @@ import java.util.Map;
*/
public class ForbiddenResourceGuideLineValidatorTest {
+ private static final String RESOURCE_PATH = "/org/openecomp/validation/validators" +
+ "/guideLineValidator/heatFloatingIpResourceType";
private static String mockConfigFileName =
"/org/openecomp/validation/configuration/mock_resource_validator_configuration.json";
@@ -36,18 +38,41 @@ public class ForbiddenResourceGuideLineValidatorTest {
@Test
public void testFloatingIpResourceType() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(forbiddenResourceGuideLineValidator,
- "/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive");
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/positive");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(forbiddenResourceGuideLineValidator,
- "/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative");
+ RESOURCE_PATH + "/negative");
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: OS::Neutron::FloatingIP is in use, Resource ID [FSB2]");
+ "WARNING: [FRG2]: OS::Neutron::FloatingIP is in use, Resource ID [FSB2]");
+ }
+ @Test
+ public void testParseException(){
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/parseException");
+ Assert.assertEquals(messages.size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "ERROR: [FRG3]: Invalid HEAT format problem - [while scanning for the next token\n" +
+ "found character '\\t(TAB)' that cannot start any token. (Do not use \\t(TAB) " +
+ "for indentation)\n" + " in 'reader', line 5, column 1:\n" +
+ " \t\t\tresources:\n" +
+ " ^\n" +
+ "]");
+ }
+
+ @Test
+ public void testInvalidResourceType(){
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/TestInvalidResourceType");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [FRG1]: A resource has an invalid or unsupported type - null, " +
+ "Resource ID [FSB2]");
}
}