aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java4
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java12
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java2
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java9
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java3
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java72
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java19
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java3
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java3
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java3
-rw-r--r--main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt2
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json3
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters.json3
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json1
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json30
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json3
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json3
17 files changed, 140 insertions, 35 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
index 03b0e9e3..77607197 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
@@ -56,7 +56,7 @@ public class XacmlState {
/**
* Constructs the object, initializing the state.
*/
- public XacmlState(XacmlPdpApplicationManager appManager) {
+ public XacmlState(XacmlPdpApplicationManager appManager, String pdpGroupName) {
this.appManager = appManager;
this.status = new PdpStatus();
@@ -65,6 +65,7 @@ public class XacmlState {
this.status.setState(PdpState.PASSIVE);
this.status.setSupportedPolicyTypes(appManager.getToscaPolicyTypeIdents());
this.status.setPolicies(Collections.emptyList());
+ this.status.setPdpGroup(pdpGroupName);
}
/**
@@ -124,7 +125,6 @@ public class XacmlState {
* @return a response to the message
*/
public PdpStatus updateInternalState(PdpUpdate message, String errMessage) {
- status.setPdpGroup(message.getPdpGroup());
status.setPdpSubgroup(message.getPdpSubgroup());
status.setPolicies(appManager.getToscaPolicyIdentifiers());
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
index 5731a7b2..cd8d22b2 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
@@ -44,6 +44,7 @@ public class XacmlPdpParameterGroup implements ParameterGroup {
@Setter
private String name;
+ private String pdpGroup;
private RestServerParameters restServerParameters;
private RestServerParameters policyApiParameters;
private TopicParameterGroup topicParameterGroup;
@@ -53,11 +54,13 @@ public class XacmlPdpParameterGroup implements ParameterGroup {
* Create the xacml pdp parameter group.
*
* @param name the parameter group name
+ * @param pdpGroup the pdp group name
*/
- public XacmlPdpParameterGroup(final String name, final RestServerParameters restServerParameters,
- final RestServerParameters policyApiParameters, final TopicParameterGroup topicParameterGroup,
- final String applicationPath) {
+ public XacmlPdpParameterGroup(final String name, final String pdpGroup,
+ final RestServerParameters restServerParameters, final RestServerParameters policyApiParameters,
+ final TopicParameterGroup topicParameterGroup, final String applicationPath) {
this.name = name;
+ this.pdpGroup = pdpGroup;
this.restServerParameters = restServerParameters;
this.policyApiParameters = policyApiParameters;
this.topicParameterGroup = topicParameterGroup;
@@ -75,6 +78,9 @@ public class XacmlPdpParameterGroup implements ParameterGroup {
if (!ParameterValidationUtils.validateStringParameter(name)) {
validationResult.setResult("name", ValidationStatus.INVALID, "must be a non-blank string");
}
+ if (!ParameterValidationUtils.validateStringParameter(pdpGroup)) {
+ validationResult.setResult("pdpGroup", ValidationStatus.INVALID, "must be a non-blank string");
+ }
if (restServerParameters == null) {
validationResult.setResult(PARAM_REST_SERVER, ValidationStatus.INVALID,
"must have restServerParameters to configure xacml pdp rest server");
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
index 396919dc..9dd7f8ea 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
@@ -98,7 +98,7 @@ public class XacmlPdpActivator extends ServiceManagerContainer {
stats.setTotalPolicyTypesCount(appmgr.getPolicyTypeCount());
stats.setTotalPolicyCount(appmgr.getPolicyCount());
- state = new XacmlState(appmgr);
+ state = new XacmlState(appmgr, xacmlPdpParameterGroup.getPdpGroup());
this.xacmlPdpParameterGroup = xacmlPdpParameterGroup;
this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
index 12d832ac..6d7b3c96 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
@@ -81,7 +81,7 @@ public class XacmlStateTest {
XacmlPdpActivator.setCurrent(act);
- state = new XacmlState(appmgr);
+ state = new XacmlState(appmgr, GROUP);
}
@AfterClass
@@ -104,6 +104,7 @@ public class XacmlStateTest {
PdpStatus status = state.genHeartbeat();
assertEquals(PdpHealthStatus.NOT_HEALTHY, status.getHealthy());
assertEquals(hostName, status.getName());
+ assertEquals(GROUP, status.getPdpGroup());
assertEquals(PDP_TYPE, status.getPdpType());
assertEquals(PdpState.PASSIVE, status.getState());
assertEquals("[ToscaPolicyTypeIdentifier(name=nameA, version=typeA), "
@@ -122,12 +123,13 @@ public class XacmlStateTest {
public void testUpdateInternalStatePdpStateChange() {
PdpStateChange req = new PdpStateChange();
req.setName(hostName);
- req.setPdpGroup(GROUP);
+ req.setPdpGroup("wrong-pdp-group");
req.setPdpSubgroup(SUBGROUP);
req.setState(STATE);
PdpStatus status = state.updateInternalState(req);
assertEquals(PdpState.SAFE, status.getState());
+ assertEquals(GROUP, status.getPdpGroup());
PdpResponseDetails resp = status.getResponse();
assertNotNull(resp);
@@ -152,7 +154,7 @@ public class XacmlStateTest {
@Test
public void testUpdateInternalStatePdpUpdate() {
PdpUpdate req = new PdpUpdate();
- req.setPdpGroup(GROUP);
+ req.setPdpGroup("wrong-pdp-group");
req.setPdpSubgroup(SUBGROUP);
PdpStatus status = state.updateInternalState(req, "");
@@ -171,6 +173,7 @@ public class XacmlStateTest {
status = state.updateInternalState(req, "Failed to load policy: failLoadPolicy1: null");
assertEquals(status.getResponse().getResponseMessage(), "Failed to load policy: failLoadPolicy1: null");
assertEquals(status.getResponse().getResponseStatus(), PdpResponseStatus.FAIL);
+ assertEquals(GROUP, status.getPdpGroup());
}
@Test
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java
index 76d07045..9b13a84f 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java
@@ -59,7 +59,8 @@ public class CommonTestData {
private static final boolean POLICY_API_HTTPS = false;
private static final boolean POLICY_API_AAF = false;
- public static final String PDPX_GROUP_NAME = "XacmlPdpGroup";
+ public static final String PDPX_PARAMETER_GROUP_NAME = "XacmlPdpParameters";
+ public static final String PDPX_GROUP = "XacmlPdpGroup";
public static final List<TopicParameters> TOPIC_PARAMS =
Collections.unmodifiableList(Arrays.asList(getTopicParams()));
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java
index c66af0ce..0eea10a1 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java
@@ -62,29 +62,30 @@ public class TestXacmlPdpParameterGroup {
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
- new XacmlPdpParameterGroup(CommonTestData.PDPX_GROUP_NAME, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME,
+ CommonTestData.PDPX_GROUP, restServerParameters, policyApiParameters,
+ topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), pdpxParameters.getRestServerParameters().getHost());
assertEquals(restServerParameters.getPort(), pdpxParameters.getRestServerParameters().getPort());
assertEquals(restServerParameters.getUserName(), pdpxParameters.getRestServerParameters().getUserName());
assertEquals(restServerParameters.getPassword(), pdpxParameters.getRestServerParameters().getPassword());
- assertEquals(CommonTestData.PDPX_GROUP_NAME, pdpxParameters.getName());
+ assertEquals(CommonTestData.PDPX_PARAMETER_GROUP_NAME, pdpxParameters.getName());
assertFalse(pdpxParameters.getRestServerParameters().isHttps());
assertFalse(pdpxParameters.getRestServerParameters().isAaf());
}
@Test
- public void testXacmlPdpParameterGroup_NullName() {
+ public void testXacmlPdpParameterGroup_NullParameterGroupName() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
final RestServerParameters policyApiParameters =
testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
- final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup(null, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup(null, CommonTestData.PDPX_GROUP,
+ restServerParameters, policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, pdpxParameters.getName());
@@ -93,15 +94,15 @@ public class TestXacmlPdpParameterGroup {
}
@Test
- public void testXacmlPdpParameterGroup_EmptyName() {
+ public void testXacmlPdpParameterGroup_EmptyParameterGroupName() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
final RestServerParameters policyApiParameters =
testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
- final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup("", restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup("", CommonTestData.PDPX_GROUP,
+ restServerParameters, policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", pdpxParameters.getName());
@@ -110,6 +111,44 @@ public class TestXacmlPdpParameterGroup {
}
@Test
+ public void testXacmlPdpParameterGroup_NullPdpGroup() {
+ final RestServerParameters restServerParameters =
+ testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
+ final RestServerParameters policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final TopicParameterGroup topicParameterGroup =
+ testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlPdpParameterGroup pdpxParameters =
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, null, restServerParameters,
+ policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ final GroupValidationResult validationResult = pdpxParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals(null, pdpxParameters.getPdpGroup());
+ assertTrue(validationResult.getResult()
+ .contains("field \"pdpGroup\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testXacmlPdpParameterGroup_EmptyPdpGroup() {
+ final RestServerParameters restServerParameters =
+ testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
+ final RestServerParameters policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final TopicParameterGroup topicParameterGroup =
+ testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlPdpParameterGroup pdpxParameters =
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, "", restServerParameters,
+ policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ final GroupValidationResult validationResult = pdpxParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals("", pdpxParameters.getPdpGroup());
+ assertTrue(validationResult.getResult()
+ .contains("field \"pdpGroup\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string"));
+ }
+
+ @Test
public void testXacmlPdpParameterGroup_EmptyRestServerParameters() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(true), RestServerParameters.class);
@@ -118,8 +157,9 @@ public class TestXacmlPdpParameterGroup {
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
- new XacmlPdpParameterGroup(CommonTestData.PDPX_GROUP_NAME, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
+ restServerParameters, policyApiParameters,
+ topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -135,8 +175,9 @@ public class TestXacmlPdpParameterGroup {
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
- new XacmlPdpParameterGroup(CommonTestData.PDPX_GROUP_NAME, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
+ restServerParameters, policyApiParameters,
+ topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -152,8 +193,9 @@ public class TestXacmlPdpParameterGroup {
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(true), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
- new XacmlPdpParameterGroup(CommonTestData.PDPX_GROUP_NAME, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
+ restServerParameters, policyApiParameters,
+ topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java
index de55282e..a59fee32 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java
@@ -99,6 +99,8 @@ public class TestXacmlPdpParameterHandler {
+ " INVALID, parameter group has status INVALID\n"
+ " field \"name\" type \"java.lang.String\" value \"null\" INVALID, "
+ "must be a non-blank string\n"
+ + " field \"pdpGroup\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string\n"
+ " field \"applicationPath\" type \"java.lang.String\" value \"null\" INVALID, "
+ "must have application path for applications to store policies and data.\n");
}
@@ -111,7 +113,8 @@ public class TestXacmlPdpParameterHandler {
minArguments.parse(minArgumentString);
final XacmlPdpParameterGroup parGroup = new XacmlPdpParameterHandler().getParameters(minArguments);
- assertEquals(CommonTestData.PDPX_GROUP_NAME, parGroup.getName());
+ assertEquals(CommonTestData.PDPX_PARAMETER_GROUP_NAME, parGroup.getName());
+ assertEquals(CommonTestData.PDPX_GROUP, parGroup.getPdpGroup());
}
@Test
@@ -123,7 +126,8 @@ public class TestXacmlPdpParameterHandler {
final XacmlPdpParameterGroup parGroup = new XacmlPdpParameterHandler().getParameters(arguments);
assertTrue(arguments.checkSetConfigurationFilePath());
- assertEquals(CommonTestData.PDPX_GROUP_NAME, parGroup.getName());
+ assertEquals(CommonTestData.PDPX_PARAMETER_GROUP_NAME, parGroup.getName());
+ assertEquals(CommonTestData.PDPX_GROUP, parGroup.getPdpGroup());
}
@Test
@@ -138,6 +142,17 @@ public class TestXacmlPdpParameterHandler {
}
@Test
+ public void testXacmlPdpParameterGroup_InvalidPdpGroup() throws PolicyXacmlPdpException {
+ final String[] xacmlPdpConfigParameters = {"-c", "parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json"};
+
+ final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
+ arguments.parse(xacmlPdpConfigParameters);
+
+ assertThatThrownBy(() -> new XacmlPdpParameterHandler().getParameters(arguments)).hasMessageContaining(
+ "field \"pdpGroup\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string");
+ }
+
+ @Test
public void testXacmlPdpParameterGroup_InvalidRestServerParameters() throws PolicyXacmlPdpException, IOException {
final String[] xacmlPdpConfigParameters =
{"-c", "parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json"};
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java
index d416cd3b..a4469a35 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java
@@ -120,7 +120,8 @@ public class TestAbbreviateDecisionResults {
policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false),
TopicParameterGroup.class);
- XacmlPdpParameterGroup params = new XacmlPdpParameterGroup("XacmlPdpGroup", rest, policyApiParameters,
+ XacmlPdpParameterGroup params =
+ new XacmlPdpParameterGroup("XacmlPdpParameters", "XacmlPdpGroup", rest, policyApiParameters,
topicParameterGroup, apps.getAbsolutePath());
StandardCoder gson = new StandardCoder();
File fileParams = appsFolder.newFile("params.json");
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java
index 6c6e35b9..e3ad7b67 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java
@@ -106,7 +106,8 @@ public class TestDecision {
testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
- XacmlPdpParameterGroup params = new XacmlPdpParameterGroup("XacmlPdpGroup", rest, policyApiParameters,
+ XacmlPdpParameterGroup params =
+ new XacmlPdpParameterGroup("XacmlPdpParameters", "XacmlPdpGroup", rest, policyApiParameters,
topicParameterGroup, apps.getAbsolutePath());
final Gson gson = new GsonBuilder().create();
File fileParams = appsFolder.newFile("params.json");
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java
index 5223bcd8..bb814d37 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java
@@ -80,7 +80,8 @@ public class TestXacmlPdpActivator extends CommonRest {
// XacmlPdp starts in PASSIVE state so the rest controller should not be alive
assertFalse(activator.isXacmlRestControllerAlive());
assertTrue(activator.getParameterGroup().isValid());
- assertEquals(CommonTestData.PDPX_GROUP_NAME, activator.getParameterGroup().getName());
+ assertEquals(CommonTestData.PDPX_PARAMETER_GROUP_NAME, activator.getParameterGroup().getName());
+ assertEquals(CommonTestData.PDPX_GROUP, activator.getParameterGroup().getPdpGroup());
activator.startXacmlRestController();
assertTrue(activator.isXacmlRestControllerAlive());
diff --git a/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt b/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt
index 957da6d6..1a5187b3 100644
--- a/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt
+++ b/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt
@@ -1,5 +1,5 @@
validation error(s) on parameters from "parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json"
-parameter group "XacmlPdpGroup" type "org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup" INVALID, parameter group has status INVALID
+parameter group "XacmlPdpParameters" type "org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup" INVALID, parameter group has status INVALID
parameter group "null" type "org.onap.policy.pdpx.main.parameters.RestServerParameters" INVALID, parameter group has status INVALID
field "host" type "java.lang.String" value "" INVALID, must be a non-blank string containing hostname/ipaddress of the xacml pdp rest server
field "port" type "int" value "-1" INVALID, must be a positive integer containing port of the xacml pdp rest server
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 42e54581..e547e7ee 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -1,5 +1,6 @@
{
- "name": "XacmlPdpGroup",
+ "name":"XacmlPdpParameters",
+ "pdpGroup": "XacmlPdpGroup",
"restServerParameters": {
"host": "0.0.0.0",
"port": 6969,
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
index 186a7b26..5d0a103c 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
@@ -1,5 +1,6 @@
{
- "name": "XacmlPdpGroup",
+ "name": "XacmlPdpParameters",
+ "pdpGroup": "XacmlPdpGroup",
"restServerParameters": {
"host": "0.0.0.0",
"port": 6969,
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
index 27e7ef46..dcc5cd93 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
@@ -1,5 +1,6 @@
{
"name": " ",
+ "pdpGroup": "XacmlPdpGroup",
"restServerParameters":{
"host":"0.0.0.0",
"port": 6969,
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json
new file mode 100644
index 00000000..18e486d5
--- /dev/null
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json
@@ -0,0 +1,30 @@
+{
+ "name": "XacmlPdpParameters",
+ "pdpGroup": " ",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port": 6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34",
+ "https":true
+ },
+ "policyApiParameters": {
+ "host": "0.0.0.0",
+ "port": 6970,
+ "userName": "healthcheck",
+ "password": "zb!XztG34"
+ },
+ "applicationPath": "src/test/resources/apps",
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "anyserver" ],
+ "topicCommInfrastructure" : "noop"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "anyserver" ],
+ "topicCommInfrastructure" : "noop"
+ }]
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
index d320b11d..4aad68b2 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
@@ -1,5 +1,6 @@
{
- "name": "XacmlPdpGroup",
+ "name":"XacmlPdpParameters",
+ "pdpGroup": "XacmlPdpGroup",
"restServerParameters": {
"host": "",
"port": -1,
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
index 1c17414b..3f9e6cb1 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
@@ -1,5 +1,6 @@
{
- "name":"XacmlPdpGroup",
+ "name":"XacmlPdpParameters",
+ "pdpGroup": "XacmlPdpGroup",
"restServerParameters":{
"host":"0.0.0.0",
"port":${port},