diff options
author | mojahidi <mojahidul.islam@amdocs.com> | 2017-11-22 18:46:42 +0530 |
---|---|---|
committer | mojahidi <mojahidul.islam@amdocs.com> | 2017-11-22 18:46:52 +0530 |
commit | 7bc86774af4b54478aa00e3554b1a6c868d983dc (patch) | |
tree | 0606c7160472b7892c61825fb56939a7d7f17bc5 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java | |
parent | 49817938ed3fcfb62b43954eaa361ff2289f1715 (diff) |
NovaServerGroupResourceValidator
This task is about updating error messages with error codes for NovaServerGroupResourceValidator
Change-Id: I72efa7954e846a094268dbda4399bea9c841305d
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')
1 files changed, 26 insertions, 10 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java index b0e6ebf631..af43dd1d78 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java @@ -17,35 +17,51 @@ public class NovaServerGroupResourceValidatorTest { HeatResourceValidator baseValidator = new HeatResourceValidator(); NovaServerGroupResourceValidator resourceValidator = new NovaServerGroupResourceValidator(); - + private static final String PATH = "/org/openecomp/validation/validators/heat_validator/"; @Test public void testPolicyIsAffinityOrAntiAffinity() throws IOException { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/heat_validator/policy_is_affinity_or_anti_affinity/negative_test/input"); + resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), + PATH + "policy_is_affinity_or_anti_affinity/negative_test/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().size(), 1); Assert.assertEquals( - messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().get(0).getMessage(), - "ERROR: Wrong policy in server group - pcrf_server_policies_1"); + messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().get(0).getMessage(), + "ERROR: [HNG1]: Wrong policy in server group - pcrf_server_policies_1"); } @Test public void testServerGroupCalledByServer() throws IOException { - Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/heat_validator/server_group_called_by_nova_server/input"); + Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, + resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), + PATH + "server_group_called_by_nova_server/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 1); + + Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1); + Assert.assertEquals( + messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(), + "WARNING: [HNG3]: ServerGroup not in use, Resource Id [not_used_server_group]"); + + } + + @Test + public void testNonServerGroup() throws IOException { + Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, + resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), + PATH + "server_group_called_by_nova_server_negative/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1); Assert.assertEquals( - messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: ServerGroup not in use, Resource Id [not_used_server_group]"); + messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(), + "WARNING: [HNG2]: ServerGroup not in use, Resource Id [nova_server]"); } } |