[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / lib / openecomp-sdc-validation-lib / openecomp-sdc-validation-impl / src / test / java / org / openecomp / sdc / validation / impl / validators / heatresource / NeutronPortResourceValidatorTest.java
1 package org.openecomp.sdc.validation.impl.validators.heatresource;
2
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;
9
10 import java.io.IOException;
11 import java.util.Map;
12
13 /**
14  * Created by TALIO on 2/28/2017.
15  */
16 public class NeutronPortResourceValidatorTest {
17
18   HeatResourceValidator baseValidator = new HeatResourceValidator();
19   NeutronPortResourceValidator resourceValidator = new NeutronPortResourceValidator();
20
21   @Test
22   public void testOnlyOneNovaPointsToOnePort() throws IOException {
23     Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
24         resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(),
25         "/org/openecomp/validation/validators/heat_validator/one_nova_points_to_one_port/negative_test/input");
26
27     Assert.assertNotNull(messages);
28     Assert.assertEquals(messages.size(), 1);
29
30     Assert.assertEquals(messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().size(), 1);
31     Assert.assertEquals(
32         messages.get("hot-nimbus-psm_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
33         "ERROR: Resource Port oam1_int_port exceed allowed relations from NovaServer");
34   }
35 }