diff options
author | a.sreekumar <ajith.sreekumar@est.tech> | 2019-11-19 17:00:59 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@est.tech> | 2019-11-21 17:35:04 +0000 |
commit | 7f0114721e5bc2f54cc49243ee8d1cf9c98dd451 (patch) | |
tree | fcf85c258792cb5958bf92b3efad9b79fad552b7 /services/services-onappf/src/test/java/org | |
parent | 96499223e328440c3623bcd3f8b9a648255a43ca (diff) |
Apex PDP change to add PDP group
Change-Id: I6cff921bdc65fe505c0b5e7dba94a6cf9aa3ba91
Issue-ID: POLICY-2234
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'services/services-onappf/src/test/java/org')
2 files changed, 29 insertions, 1 deletions
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java index c8d61f539..b26a1f1a2 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java @@ -42,6 +42,7 @@ public class CommonTestData { public static final String PDP_NAME = "apex-pdp"; public static final String VERSION = "0.0.1"; public static final String PDP_TYPE = "apex"; + public static final String PDP_GROUP = "defaultGroup"; public static final String DESCRIPTION = "Pdp status for HealthCheck"; public static final String POLICY_NAME = "onap.controllloop.operational.apex.BBS"; public static final String POLICY_VERSION = "0.0.1"; @@ -145,6 +146,7 @@ public class CommonTestData { public Map<String, Object> getPdpStatusParametersMap(final boolean isEmpty) { final Map<String, Object> map = new TreeMap<>(); if (!isEmpty) { + map.put("pdpGroup", PDP_GROUP); map.put("timeIntervalMs", TIME_INTERVAL); map.put("pdpName", PDP_NAME); map.put("version", VERSION); diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java index e8a3f7ee0..95cf35093 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java @@ -21,11 +21,12 @@ package org.onap.policy.apex.services.onappf.parameters; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import java.util.Map; import org.junit.Test; -import org.onap.policy.apex.services.onappf.parameters.PdpStatusParameters; import org.onap.policy.common.parameters.GroupValidationResult; /** @@ -46,6 +47,7 @@ public class TestPdpStatusParameters { assertEquals(CommonTestData.PDP_TYPE, pdpStatusParameters.getPdpType()); assertEquals(CommonTestData.DESCRIPTION, pdpStatusParameters.getDescription()); assertEquals(CommonTestData.SUPPORTED_POLICY_TYPES, pdpStatusParameters.getSupportedPolicyTypes()); + assertEquals(CommonTestData.PDP_GROUP, pdpStatusParameters.getPdpGroup()); } @Test @@ -56,4 +58,28 @@ public class TestPdpStatusParameters { assertNull(result.getResult()); assertTrue(result.isValid()); } + + @Test + public void testPdpStatusParameters_nullPdpGroup() throws Exception { + Map<String, Object> pdpStatusParametersMap = testData.getPdpStatusParametersMap(false); + pdpStatusParametersMap.remove("pdpGroup"); + final PdpStatusParameters pdpStatusParameters = + testData.toObject(pdpStatusParametersMap, PdpStatusParameters.class); + final GroupValidationResult validationResult = pdpStatusParameters.validate(); + assertFalse(validationResult.isValid()); + assertTrue(validationResult.getResult() + .contains("field \"pdpGroup\" type \"java.lang.String\" value \"null\" INVALID")); + } + + @Test + public void testPdpStatusParameters_emptyPdpGroup() throws Exception { + Map<String, Object> pdpStatusParametersMap = testData.getPdpStatusParametersMap(false); + pdpStatusParametersMap.put("pdpGroup", ""); + final PdpStatusParameters pdpStatusParameters = + testData.toObject(pdpStatusParametersMap, PdpStatusParameters.class); + final GroupValidationResult validationResult = pdpStatusParameters.validate(); + assertFalse(validationResult.isValid()); + assertTrue(validationResult.getResult() + .contains("field \"pdpGroup\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string")); + } } |