aboutsummaryrefslogtreecommitdiffstats
path: root/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'tutorials')
-rw-r--r--tutorials/pom.xml2
-rw-r--r--tutorials/tutorial-enforcement/pom.xml2
-rw-r--r--tutorials/tutorial-xacml-application/pom.xml2
-rw-r--r--tutorials/tutorial-xacml-application/src/test/java/org/onap/policy/tutorial/tutorial/TutorialApplicationTest.java41
4 files changed, 24 insertions, 23 deletions
diff --git a/tutorials/pom.xml b/tutorials/pom.xml
index de861381..7ca07970 100644
--- a/tutorials/pom.xml
+++ b/tutorials/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.xacml-pdp</groupId>
<artifactId>policy-xacml-pdp</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>xacml-tutorials</artifactId>
diff --git a/tutorials/tutorial-enforcement/pom.xml b/tutorials/tutorial-enforcement/pom.xml
index d33103dd..fa24f25a 100644
--- a/tutorials/tutorial-enforcement/pom.xml
+++ b/tutorials/tutorial-enforcement/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.xacml-pdp</groupId>
<artifactId>xacml-tutorials</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.tutorial</groupId>
diff --git a/tutorials/tutorial-xacml-application/pom.xml b/tutorials/tutorial-xacml-application/pom.xml
index 1d613c83..bf5f9396 100644
--- a/tutorials/tutorial-xacml-application/pom.xml
+++ b/tutorials/tutorial-xacml-application/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.xacml-pdp</groupId>
<artifactId>xacml-tutorials</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
diff --git a/tutorials/tutorial-xacml-application/src/test/java/org/onap/policy/tutorial/tutorial/TutorialApplicationTest.java b/tutorials/tutorial-xacml-application/src/test/java/org/onap/policy/tutorial/tutorial/TutorialApplicationTest.java
index ee089195..85cf999f 100644
--- a/tutorials/tutorial-xacml-application/src/test/java/org/onap/policy/tutorial/tutorial/TutorialApplicationTest.java
+++ b/tutorials/tutorial-xacml-application/src/test/java/org/onap/policy/tutorial/tutorial/TutorialApplicationTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,20 +20,20 @@
package org.onap.policy.tutorial.tutorial;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.att.research.xacml.api.Response;
import com.att.research.xacml.api.XACML3;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.Map;
import java.util.Properties;
import java.util.ServiceLoader;
import org.apache.commons.lang3.tuple.Pair;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.TextFileUtils;
@@ -44,33 +45,33 @@ import org.onap.policy.pdp.xacml.xacmltest.TestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TutorialApplicationTest {
+class TutorialApplicationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(TutorialApplicationTest.class);
private static final Properties properties = new Properties();
private static XacmlApplicationServiceProvider service;
private static final StandardCoder gson = new StandardCoder();
- @ClassRule
- public static final TemporaryFolder policyFolder = new TemporaryFolder();
+ @TempDir
+ static Path policyFolder;
/**
* set up the tests.
*
* @throws Exception Should not have exceptions thrown.
*/
- @BeforeClass
- public static void setup() throws Exception {
+ @BeforeAll
+ static void setup() throws Exception {
//
// Set up our temporary folder
//
- XacmlPolicyUtils.FileCreator myCreator = policyFolder::newFile;
+ XacmlPolicyUtils.FileCreator myCreator = (String filename) -> policyFolder.resolve(filename).toFile();
File propertiesFile = XacmlPolicyUtils
.copyXacmlPropertiesContents("src/test/resources/xacml.properties", properties, myCreator);
//
// Load XacmlApplicationServiceProvider service
//
ServiceLoader<XacmlApplicationServiceProvider> applicationLoader =
- ServiceLoader.load(XacmlApplicationServiceProvider.class);
+ ServiceLoader.load(XacmlApplicationServiceProvider.class);
//
// Look for our class instance and save it
//
@@ -94,13 +95,13 @@ public class TutorialApplicationTest {
}
@Test
- public void testSingleDecision() throws CoderException, IOException {
+ void testSingleDecision() throws CoderException, IOException {
//
// Load a Decision request
//
DecisionRequest decisionRequest =
- gson.decode(TextFileUtils.getTextFileAsString("src/test/resources/tutorial-decision-request.json"),
- DecisionRequest.class);
+ gson.decode(TextFileUtils.getTextFileAsString("src/test/resources/tutorial-decision-request.json"),
+ DecisionRequest.class);
LOGGER.info("{}", gson.encode(decisionRequest, true));
//
// Test a decision - should start with a permit
@@ -112,7 +113,7 @@ public class TutorialApplicationTest {
// Check that there are attributes
//
assertThat(decision.getLeft().getAttributes()).isNotNull().hasSize(1)
- .containsKey(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE.stringValue());
+ .containsKey(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE.stringValue());
//
// This should be a "deny"
//
@@ -125,18 +126,18 @@ public class TutorialApplicationTest {
// Check that there are attributes
//
assertThat(decision.getLeft().getAttributes()).isNotNull().hasSize(1)
- .containsKey(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE.stringValue());
+ .containsKey(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE.stringValue());
}
@Test
- public void testMultiDecision() throws CoderException, IOException {
+ void testMultiDecision() throws CoderException, IOException {
//
// Load a Decision request
//
DecisionRequest decisionRequest = gson.decode(
- TextFileUtils.getTextFileAsString("src/test/resources/tutorial-decision-multi-request.json"),
- DecisionRequest.class);
+ TextFileUtils.getTextFileAsString("src/test/resources/tutorial-decision-multi-request.json"),
+ DecisionRequest.class);
LOGGER.info("{}", gson.encode(decisionRequest, true));
//
// Test a decision - should start with a permit