summaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-03-09 11:48:44 -0500
committerPamela Dragosh <pdragosh@research.att.com>2019-03-15 08:54:05 -0400
commitb909b14fe88c5fe8f096cf8b471a2aa799d84739 (patch)
tree19de65fff7618bfad91acb0b803210a93dbb86cd /main/src/test/java
parent4b2ef1a5a9bf92aeb7edc1512f7a6cd8e1be99d8 (diff)
Monitoring policy creation foundation
Upgrde to xacml v2.0.0 release artifact. Some re-arrangement of classes. New class to support a common dictionary among the monitoring applications. I may move it to a common under the main since some of the values are shareable. Created application service provider, so the XACML main knows what policy types are pre-loaded and can report them back to the PAP. struggled with cucumber, which does not create TemporaryFolder although the documentation says its supported. Added a new Policy Finder specific to ONAP which does quicker job to load policies. Issue-ID: POLICY-1273 Change-Id: I4af15a64da3b42d48f29809710421b1649625adc Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java2
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java11
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java9
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/startstop/TestMain.java11
4 files changed, 32 insertions, 1 deletions
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 3955031a..ef85a762 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
@@ -142,7 +142,7 @@ public class TestXacmlPdpParameterHandler {
final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
arguments.parse(xacmlPdpConfigParameters);
- final String expectedResult = new String(Files.readAllBytes(
+ new String(Files.readAllBytes(
Paths.get("src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt")));
assertThatThrownBy(() -> new XacmlPdpParameterHandler().getParameters(arguments))
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java
index 0f608e29..1ec649cb 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java
@@ -41,6 +41,7 @@ import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.junit.After;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.utils.network.NetworkUtil;
@@ -70,6 +71,16 @@ public class TestXacmlPdpRestServer {
private XacmlPdpRestServer restServer;
/**
+ * setup.
+ */
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
+ System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
+
+ }
+
+ /**
* Method for cleanup after each test.
*/
@After
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java
index ee05ff06..595301de 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java
@@ -21,6 +21,7 @@
package org.onap.policy.pdpx.main.rest;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -32,6 +33,7 @@ import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.pdpx.main.PolicyXacmlPdpException;
@@ -51,12 +53,19 @@ public class TestXacmlPdpStatistics {
private static final Logger LOGGER = LoggerFactory.getLogger(TestXacmlPdpStatistics.class);
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
+ System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
+ }
+
@Test
public void testXacmlPdpStatistics_200() throws PolicyXacmlPdpException, InterruptedException {
try {
final Main main = startXacmlPdpService();
StatisticsReport report = getXacmlPdpStatistics();
validateReport(report, 0, 200);
+ assertThat(report.getTotalPolicyTypesCount()).isGreaterThan(0);
updateXacmlPdpStatistics();
report = getXacmlPdpStatistics();
validateReport(report, 1, 200);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestMain.java
index bfc8a2a4..8c37acb7 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestMain.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.pdpx.main.PolicyXacmlPdpException;
import org.onap.policy.pdpx.main.parameters.CommonTestData;
@@ -35,6 +36,16 @@ import org.onap.policy.pdpx.main.parameters.CommonTestData;
*/
public class TestMain {
+ /**
+ * setup.
+ */
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
+ System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
+
+ }
+
@Test
public void testMain() throws PolicyXacmlPdpException {
final String[] xacmlPdpConfigParameters = {"-c", "parameters/XacmlPdpConfigParameters.json"};