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-22 17:52:37 +0530
committermojahidi <mojahidul.islam@amdocs.com>2017-11-22 17:56:28 +0530
commitdd537b2c409c580efd98d887a61c50f7f53458c5 (patch)
treed8207b57fb889d0f8f9f46c92cbd8c97ff2b24b5 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
parentb110b94fe9ab62393b8c1ec64320668c7222bc6a (diff)
ForbiddenResourceGuideLine Validator
This task is about updating error messages with error codes for ForbiddenResourceGuideLine Change-Id: Id692b43e05443dc1313b51533e685dd3c7ad6ca6 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/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]");
}
}