aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2021-07-13 10:12:14 -0400
committerPamela Dragosh <pd1248@att.com>2021-07-13 10:29:14 -0400
commit6803c3b370560217215be30514396f75be780a0f (patch)
tree9752d4f298d41d1914ef31843fb1c2b76098844e /main
parentab0c6ca485c20fea9bcf894d27e0935afda17042 (diff)
Change config to add Application group
First step for configuration which applications should be loaded and mapped to actions is to add a new parameter group for application parameters. Issue-ID: POLICY-3326 Change-Id: I3867b4e927d57e1e81519dee32d10eed3dabc667 Signed-off-by: Pamela Dragosh <pd1248@att.com>
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlApplicationParameters.java39
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java7
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java9
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java3
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java15
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java61
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java6
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java6
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java15
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpType.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json4
-rw-r--r--main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json4
16 files changed, 160 insertions, 29 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlApplicationParameters.java b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlApplicationParameters.java
new file mode 100644
index 00000000..f1ec19d3
--- /dev/null
+++ b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlApplicationParameters.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.pdpx.main.parameters;
+
+import lombok.Getter;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
+
+@NotBlank
+@Getter
+public class XacmlApplicationParameters extends ParameterGroupImpl {
+
+ @NotNull
+ private String applicationPath;
+
+ public XacmlApplicationParameters() {
+ super(XacmlApplicationParameters.class.getSimpleName());
+ }
+
+}
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 7afa480a..7fde514a 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
@@ -52,7 +52,8 @@ public class XacmlPdpParameterGroup extends ParameterGroupImpl {
private BusTopicParams policyApiParameters;
@Valid
private TopicParameterGroup topicParameterGroup;
- private String applicationPath;
+ @Valid
+ private XacmlApplicationParameters applicationParameters;
/**
* Create the xacml pdp parameter group.
@@ -62,14 +63,14 @@ public class XacmlPdpParameterGroup extends ParameterGroupImpl {
*/
public XacmlPdpParameterGroup(final String name, final String pdpGroup, final String pdpType,
final RestServerParameters restServerParameters, final BusTopicParams policyApiParameters,
- final TopicParameterGroup topicParameterGroup, final String applicationPath) {
+ final TopicParameterGroup topicParameterGroup, final XacmlApplicationParameters applicationParameters) {
super(name);
this.pdpGroup = pdpGroup;
this.pdpType = pdpType;
this.restServerParameters = restServerParameters;
this.policyApiParameters = policyApiParameters;
this.topicParameterGroup = topicParameterGroup;
- this.applicationPath = applicationPath;
+ this.applicationParameters = applicationParameters;
}
/**
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
index e144ba3e..5ecf1aa5 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
@@ -39,6 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider;
+import org.onap.policy.pdpx.main.parameters.XacmlApplicationParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,9 +59,10 @@ public class XacmlPdpApplicationManager {
/**
* One time to initialize the applications upon startup.
*/
- public XacmlPdpApplicationManager(Path applicationPath, BusTopicParams policyApiParameters) {
+ public XacmlPdpApplicationManager(XacmlApplicationParameters applicationParameters,
+ BusTopicParams policyApiParameters) {
if (LOGGER.isInfoEnabled()) {
- LOGGER.info("Initialization applications {} {}", applicationPath.toAbsolutePath(), policyApiParameters);
+ LOGGER.info("Initialization applications {} {}", applicationParameters, policyApiParameters);
}
//
// Load service
@@ -83,7 +85,8 @@ public class XacmlPdpApplicationManager {
// Have it initialize at a path
//
try {
- initializeApplicationPath(applicationPath, application, policyApiParameters);
+ initializeApplicationPath(Paths.get(applicationParameters.getApplicationPath()), application,
+ policyApiParameters);
//
// We are initialized
//
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 e17cecf7..d3b59c4a 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
@@ -20,7 +20,6 @@
package org.onap.policy.pdpx.main.startstop;
-import java.nio.file.Paths;
import java.util.Arrays;
import lombok.Getter;
import lombok.Setter;
@@ -88,7 +87,7 @@ public class XacmlPdpActivator extends ServiceManagerContainer {
try {
var appmgr =
- new XacmlPdpApplicationManager(Paths.get(xacmlPdpParameterGroup.getApplicationPath()),
+ new XacmlPdpApplicationManager(xacmlPdpParameterGroup.getApplicationParameters(),
xacmlPdpParameterGroup.getPolicyApiParameters());
XacmlPdpApplicationManager.setCurrent(appmgr);
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 ca8b763d..8b79ae9b 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
@@ -170,4 +170,19 @@ public class CommonTestData {
}
return map;
}
+
+ /**
+ * Returns a property map for a XacmlApplicationParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @param tempPath Application Path string
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getXacmlapplicationParametersMap(boolean isEmpty, String tempPath) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("applicationPath", tempPath);
+ }
+ return map;
+ }
}
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 b2d1cbe3..f71c99c2 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
@@ -63,10 +63,13 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME,
CommonTestData.PDPX_GROUP, "flavor", restServerParameters, policyApiParameters,
- topicParameterGroup, applicationPath.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertThat(validationResult.getResult()).isNull();
assertTrue(validationResult.isValid());
@@ -88,9 +91,11 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup(null, CommonTestData.PDPX_GROUP,
- null, restServerParameters, policyApiParameters, topicParameterGroup,
- applicationPath.getAbsolutePath());
+ null, restServerParameters, policyApiParameters, topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, pdpxParameters.getName());
@@ -105,9 +110,12 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup("", CommonTestData.PDPX_GROUP,
CommonTestData.PDPX_TYPE, restServerParameters, policyApiParameters, topicParameterGroup,
- applicationPath.getAbsolutePath());
+ xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", pdpxParameters.getName());
@@ -122,9 +130,12 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, null, null, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ policyApiParameters, topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, pdpxParameters.getPdpGroup());
@@ -139,9 +150,12 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, "", null, restServerParameters,
- policyApiParameters, topicParameterGroup, applicationPath.getAbsolutePath());
+ policyApiParameters, topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", pdpxParameters.getPdpGroup());
@@ -156,10 +170,13 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
null, restServerParameters, policyApiParameters,
- topicParameterGroup, applicationPath.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"RestServerParameters\"");
@@ -173,10 +190,13 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(true), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
null, restServerParameters, policyApiParameters,
- topicParameterGroup, applicationPath.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"policyApiParameters\"");
@@ -190,12 +210,35 @@ public class TestXacmlPdpParameterGroup {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(true), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
final XacmlPdpParameterGroup pdpxParameters =
new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
null, restServerParameters, policyApiParameters,
- topicParameterGroup, applicationPath.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
final ValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"TopicParameterGroup\"");
}
+
+ @Test
+ public void testXacmlPdpParameterGroup_EmptyApplicationParameterGroup() {
+ final RestServerParameters restServerParameters =
+ testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
+ final TopicParameterGroup topicParameterGroup =
+ testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(true,
+ applicationPath.getAbsolutePath().toString()), XacmlApplicationParameters.class);
+ final XacmlPdpParameterGroup pdpxParameters =
+ new XacmlPdpParameterGroup(CommonTestData.PDPX_PARAMETER_GROUP_NAME, CommonTestData.PDPX_GROUP,
+ null, restServerParameters, policyApiParameters,
+ topicParameterGroup, xacmlApplicationParameters);
+ final ValidationResult validationResult = pdpxParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertThat(validationResult.getResult()).contains("\"XacmlApplicationParameters\"");
+ }
}
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 93e541de..54d7432f 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
@@ -64,6 +64,7 @@ import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
import org.onap.policy.pdp.xacml.xacmltest.TestUtils;
import org.onap.policy.pdpx.main.PolicyXacmlPdpException;
import org.onap.policy.pdpx.main.parameters.CommonTestData;
+import org.onap.policy.pdpx.main.parameters.XacmlApplicationParameters;
import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup;
import org.onap.policy.pdpx.main.startstop.Main;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
@@ -119,9 +120,12 @@ public class TestAbbreviateDecisionResults {
policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false),
TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ apps.getAbsolutePath().toString()), XacmlApplicationParameters.class);
XacmlPdpParameterGroup params =
new XacmlPdpParameterGroup("XacmlPdpParameters", "XacmlPdpGroup", "xacml", rest, policyApiParameters,
- topicParameterGroup, apps.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
StandardCoder gson = new StandardCoder();
File fileParams = appsFolder.newFile("params.json");
String jsonParams = gson.encode(params);
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 7fa552f4..5f6a2796 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
@@ -59,6 +59,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.errors.concepts.ErrorResponse;
import org.onap.policy.pdpx.main.PolicyXacmlPdpException;
import org.onap.policy.pdpx.main.parameters.CommonTestData;
+import org.onap.policy.pdpx.main.parameters.XacmlApplicationParameters;
import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup;
import org.onap.policy.pdpx.main.startstop.Main;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
@@ -108,9 +109,12 @@ public class TestDecision {
testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ apps.getAbsolutePath().toString()), XacmlApplicationParameters.class);
XacmlPdpParameterGroup params =
new XacmlPdpParameterGroup("XacmlPdpParameters", "XacmlPdpGroup", "xacml", rest, policyApiParameters,
- topicParameterGroup, apps.getAbsolutePath());
+ topicParameterGroup, xacmlApplicationParameters);
final Gson gson = new GsonBuilder().create();
File fileParams = appsFolder.newFile("params.json");
String jsonParams = gson.toJson(params);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
index 1673c043..4619b2ae 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
@@ -44,6 +44,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
+import org.onap.policy.pdpx.main.parameters.CommonTestData;
+import org.onap.policy.pdpx.main.parameters.XacmlApplicationParameters;
import org.onap.policy.xacml.pdp.application.guard.GuardPdpApplication;
import org.onap.policy.xacml.pdp.application.nativ.NativePdpApplication;
import org.onap.policy.xacml.pdp.application.optimization.OptimizationPdpApplication;
@@ -56,6 +58,7 @@ public class XacmlPdpApplicationManagerTest {
private static final BusTopicParams params = new BusTopicParams();
private static Path appsDirectory;
private static ToscaServiceTemplate completedJtst;
+ private static CommonTestData testData = new CommonTestData();
@ClassRule
public static final TemporaryFolder appsFolder = new TemporaryFolder();
@@ -113,10 +116,13 @@ public class XacmlPdpApplicationManagerTest {
// Make up a non existent directory to initialize from
//
Path nonExistentPath = Paths.get(appsFolder.getRoot().getAbsolutePath(), "nonexistent");
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ nonExistentPath.toString()), XacmlApplicationParameters.class);
//
// Create our app manager
//
- XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(nonExistentPath, params);
+ XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params);
//
// Still creates the manager, but the apps were not able to initialize
//
@@ -126,7 +132,7 @@ public class XacmlPdpApplicationManagerTest {
// Now create the directory
//
Files.createDirectory(nonExistentPath);
- manager = new XacmlPdpApplicationManager(nonExistentPath, params);
+ manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params);
//
// Now it should have initialized the apps
//
@@ -136,7 +142,10 @@ public class XacmlPdpApplicationManagerTest {
@Test
public void testXacmlPdpApplicationManagerSimple() {
- XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(appsDirectory, params);
+ final XacmlApplicationParameters xacmlApplicationParameters =
+ testData.toObject(testData.getXacmlapplicationParametersMap(false,
+ appsDirectory.toString()), XacmlApplicationParameters.class);
+ XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params);
//
// Test the basics from the startup
//
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 48706b85..81e83522 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -14,7 +14,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "apps.test",
+ "applicationParameters": {
+ "applicationPath": "apps.test"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
index 9ccd732b..a1b9be9d 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters.json
@@ -14,7 +14,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
index ca779723..c78dbed7 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidName.json
@@ -14,7 +14,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json
index 3e1d4f57..2a249f0d 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json
@@ -14,7 +14,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpType.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpType.json
index d0c429c2..75111f71 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpType.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidPdpType.json
@@ -15,7 +15,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
index 8211c8e6..9e05b14f 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_InvalidRestServerParameters.json
@@ -13,7 +13,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",
diff --git a/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json b/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
index 33885b50..a0608862 100644
--- a/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
+++ b/main/src/test/resources/parameters/XacmlPdpConfigParameters_Std.json
@@ -15,7 +15,9 @@
"userName": "healthcheck",
"password": "zb!XztG34"
},
- "applicationPath": "src/test/resources/apps",
+ "applicationParameters": {
+ "applicationPath": "src/test/resources/apps"
+ },
"topicParameterGroup": {
"topicSources" : [{
"topic" : "POLICY-PDP-PAP",