1 package org.openecomp.sdc.validation.impl.validators.heatresource;
3 import org.openecomp.core.validation.types.MessageContainer;
4 import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
5 import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator;
6 import org.openecomp.sdc.validation.util.ValidationTestUtil;
7 import org.testng.Assert;
8 import org.testng.annotations.Test;
10 import java.io.IOException;
14 * Created by TALIO on 2/28/2017.
16 public class NovaServerGroupResourceValidatorTest {
18 HeatResourceValidator baseValidator = new HeatResourceValidator();
19 NovaServerGroupResourceValidator resourceValidator = new NovaServerGroupResourceValidator();
22 public void testPolicyIsAffinityOrAntiAffinity() throws IOException {
23 Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
24 resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(),
25 "/org/openecomp/validation/validators/heat_validator/policy_is_affinity_or_anti_affinity/negative_test/input");
27 Assert.assertNotNull(messages);
28 Assert.assertEquals(messages.size(), 1);
30 Assert.assertEquals(messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().size(), 1);
32 messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
33 "ERROR: Wrong policy in server group - pcrf_server_policies_1");
37 public void testServerGroupCalledByServer() throws IOException {
38 Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
39 resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(),
40 "/org/openecomp/validation/validators/heat_validator/server_group_called_by_nova_server/input");
42 Assert.assertNotNull(messages);
43 Assert.assertEquals(messages.size(), 1);
45 Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
47 messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
48 "WARNING: ServerGroup not in use, Resource Id [not_used_server_group]");