[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 / ContrailNetworkPolicyResourceValidatorTest.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 ContrailNetworkPolicyResourceValidatorTest {
17
18   HeatResourceValidator baseValidator = new HeatResourceValidator();
19   ContrailNetworkPolicyResourceValidator resourceValidator = new
20       ContrailNetworkPolicyResourceValidator();
21
22   @Test
23   public void testNetworkPolicyAssociatedWithAttachPolicy() throws IOException {
24     Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
25         , HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE.getHeatResource(),
26         "/org/openecomp/validation/validators/heat_validator/network_policy_associated_with_attach_policy/input");
27
28     Assert.assertNotNull(messages);
29     Assert.assertEquals(messages.size(), 1);
30
31     Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
32     Assert.assertEquals(
33         messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
34         "WARNING: NetworkPolicy not in use, Resource Id [not_used_server_pcrf_policy]");
35   }
36 }