summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PDP/logging.properties2
-rw-r--r--ONAP-PDP/src/test/resources/logging.properties4
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java10
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java2
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java19
-rw-r--r--ONAP-XACML/src/test/resources/logging.properties4
6 files changed, 28 insertions, 13 deletions
diff --git a/ONAP-PDP/logging.properties b/ONAP-PDP/logging.properties
index e88d3726f..2b9a51d43 100644
--- a/ONAP-PDP/logging.properties
+++ b/ONAP-PDP/logging.properties
@@ -24,6 +24,6 @@ handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.FileHandler.level = INFO
-java.util.logging.FileHandler.pattern=${{POLICY_LOGS}}/policy/pdpx/%h/xacml_log%u.log
+java.util.logging.FileHandler.pattern=${{POLICY_LOGS}}/policy/pdpx/xacml_log%u.log
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
diff --git a/ONAP-PDP/src/test/resources/logging.properties b/ONAP-PDP/src/test/resources/logging.properties
index 699369639..b1879e7e1 100644
--- a/ONAP-PDP/src/test/resources/logging.properties
+++ b/ONAP-PDP/src/test/resources/logging.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# ONAP-PDP
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 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.
@@ -28,5 +28,5 @@ java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = SEVERE
-java.util.logging.FileHandler.pattern=%h/xacml_log%u.log
+java.util.logging.FileHandler.pattern=logs/xacml_log%u.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
index 500136fc0..2e0a0de17 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
@@ -21,10 +21,13 @@ package org.onap.policy.xacml.test.std.pap;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.util.Properties;
+
import org.junit.Test;
import org.onap.policy.xacml.std.pap.StdEngineFactory;
+
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.std.pap.StdEngine;
import com.att.research.xacml.util.FactoryException;
@@ -45,15 +48,16 @@ public class StdEngineFactoryTest {
}
@Test
- public void testNegativeCase() throws FactoryException, PAPException {
+ public void testNegativeCase() throws Exception {
// Setup test data
Properties props = new Properties();
- props.setProperty(StdEngine.PROP_PAP_REPO, "/tmp");
+ String tmpdir = System.getProperty("java.io.tmpdir");
+ props.setProperty(StdEngine.PROP_PAP_REPO, tmpdir);
// Set the system property temporarily
String systemKey = StdEngine.PROP_PAP_REPO;
String oldProperty = System.getProperty(systemKey);
- System.setProperty(systemKey, "/tmp");
+ System.setProperty(systemKey, tmpdir);
// Test factory failure cases
try {
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
index 684f48c17..f60645fef 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
@@ -30,12 +30,14 @@ import com.att.research.xacml.api.pip.PIPRequest;
import com.att.research.xacml.api.pip.PIPResponse;
import com.att.research.xacml.std.pip.StdPIPFinderFactory;
import com.att.research.xacml.std.pip.StdPIPRequest;
+import com.att.research.xacml.util.XACMLProperties;
import com.att.research.xacml.api.XACML3;
public class AAFEngineTest {
@Test
public void aafEngineTest(){
String testId = "testId";
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.properties");
AAFEngine aafEngine = new AAFEngine();
assertTrue(AAFEngine.DEFAULT_DESCRIPTION.equals("PIP for authenticating aaf attributes using the AAF REST interface"));
assertTrue(AAFEngine.DEFAULT_ISSUER.equals("aaf"));
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
index 0a3a5e095..446a87d1a 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
@@ -1,8 +1,8 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* ONAP-XACML
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -21,17 +21,19 @@ package org.onap.policy.xacml.test.util;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Path;
-import java.nio.file.Paths;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.xacml.util.XACMLPolicyWriter;
+
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
@@ -65,12 +67,19 @@ public class XACMLPolicyWriterTest {
}
@Test
- public void testWrites() {
+ public void testWrites() throws Exception {
// Set up test data
PolicyType policyType = new PolicyType();
OutputStream os = new ByteArrayOutputStream();
- Path filename = Paths.get("/tmp/foo");
+ File tmpfile = File.createTempFile("foo", null);
+ Path filename = tmpfile.toPath();
PolicySetType policySet = new PolicySetType();
+
+ // delete tmp file before running the test
+ tmpfile.delete();
+
+ // ensure its deleted after writePolicyFile() re-creates it
+ tmpfile.deleteOnExit();
// Test write combinations
assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policySet));
diff --git a/ONAP-XACML/src/test/resources/logging.properties b/ONAP-XACML/src/test/resources/logging.properties
index ff9840ff7..6818148c9 100644
--- a/ONAP-XACML/src/test/resources/logging.properties
+++ b/ONAP-XACML/src/test/resources/logging.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# ONAP-XACML
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 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.
@@ -28,5 +28,5 @@ java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = SEVERE
-java.util.logging.FileHandler.pattern=%h/xacml_log%u.log
+java.util.logging.FileHandler.pattern=logs/xacml_log%u.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter