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();
23 public void testSecurityGroupBaseFileNoPorts() throws IOException {
24 Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
26 HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
27 "/org/openecomp/validation/validators/heat_validator/security_group_base_file_no_ports/input");
29 Assert.assertNotNull(messages);
30 Assert.assertEquals(messages.size(), 1);
32 Assert.assertEquals(messages.get("baseFile.yaml").getErrorMessageList().size(), 1);
33 Assert.assertEquals(messages.get("baseFile.yaml").getErrorMessageList().get(0).getMessage(),
34 "WARNING: SecurityGroup not in use, Resource Id [jsa_security_group3]");
38 public void testSecurityGroupsCalledByPort() throws IOException {
39 Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
41 HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(),
42 "/org/openecomp/validation/validators/heat_validator/security_group_called_by_port/input");
44 Assert.assertNotNull(messages);
45 Assert.assertEquals(messages.size(), 1);
47 Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
49 messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
50 "WARNING: SecurityGroup not in use, Resource Id [not_used_security_group]");