From 05045cd36ad264b5d7b674155699b2cccee71165 Mon Sep 17 00:00:00 2001 From: jh7358 Date: Thu, 25 Apr 2019 20:15:28 -0400 Subject: Refactor xacml-pdp to remove various statics Refactored xacml-pdp to eliminate a number of static fields. Modified junit tests to allocate new ports for each test. Also modified XacmlPolicyUtilsTest to convert path names to match the file system so that the junit will work in OSs other than linux. Replaced logback.xml with a copy of the one from PAP to resolve some issues. Don't print entire message when discarding, as each PDP receives messages for ALL PDPs. Remove shutdown class from Main - just invoke this.shutdown() directly. Added additional comments to CommonRest. Also modified port test parameters. Change-Id: Id8bf7216cdcb59a1a2cb4cb957fa44f640315cfe Issue-ID: POLICY-1645 Signed-off-by: Jim Hahn --- .../pdp/xacml/application/common/XacmlPolicyUtilsTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'applications') diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java index ed63bb9c..318d9f9f 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java @@ -37,8 +37,9 @@ import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.List; import java.util.Properties; - +import java.util.stream.Collectors; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; @@ -109,6 +110,16 @@ public class XacmlPolicyUtilsTest { properties.load(is); } // + // Change "/" to file separator in file names + // + if (!"/".equals(File.separator)) { + List fileProps = properties.keySet().stream().map(Object::toString) + .filter(key -> key.endsWith(".file")).collect(Collectors.toList()); + for (String fileProp : fileProps) { + properties.setProperty(fileProp, properties.getProperty(fileProp).replace("/", File.separator)); + } + } + // // Save root policy // File rootFile = policyFolder.newFile("root.xml"); -- cgit 1.2.3-korg