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 NeutronSecurityGroupResourceValidatorTest {
18 HeatResourceValidator baseValidator = new HeatResourceValidator();
19 NeutronSecurityGroupResourceValidator resourceValidator = new
20 NeutronSecurityGroupResourceValidator();
21 private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
24 public void testSecurityGroupBaseFileNoPorts() throws IOException {
25 Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
27 HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
28 PATH + "security_group_base_file_no_ports/input");
30 Assert.assertNotNull(messages);
31 Assert.assertEquals(messages.size(), 1);
33 Assert.assertEquals(messages.get("baseFile.yaml").getErrorMessageList().size(), 1);
34 Assert.assertEquals(messages.get("baseFile.yaml").getErrorMessageList().get(0).getMessage(),
35 "WARNING: [HSG1]: SecurityGroup not in use, Resource Id [jsa_security_group3]");
39 public void testSecurityGroupsCalledByPort() throws IOException {
40 Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
42 HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
43 PATH + "security_group_called_by_port/input");
45 Assert.assertNotNull(messages);
46 Assert.assertEquals(messages.size(), 1);
48 Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
50 messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
51 "WARNING: [HSG1]: SecurityGroup not in use, Resource Id [not_used_security_group]");