From 72aef3a6324c78a62d0eff65217d4861440841f5 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 31 Jan 2023 08:15:34 -0500 Subject: Fix Java 17 jUnit errors Add explicit lombok dependency to resolve compile error when compiling under java 17 Fixed code issues in jUnit tests due to restrictions on reflection in Java 17, which disallow jUnit from setting system properties or environment variables. Issue-ID: CCSDK-3813 Signed-off-by: Dan Timoney Change-Id: I278ee869d2ce0568b29ecc29c37d00d7fce757a8 --- plugins/properties-node/provider/pom.xml | 24 ++++++++++++---------- .../ccsdk/sli/plugins/prop/TestPropertiesNode.java | 10 ++------- 2 files changed, 15 insertions(+), 19 deletions(-) (limited to 'plugins/properties-node') diff --git a/plugins/properties-node/provider/pom.xml b/plugins/properties-node/provider/pom.xml index ddae8edca..66b79b14b 100755 --- a/plugins/properties-node/provider/pom.xml +++ b/plugins/properties-node/provider/pom.xml @@ -32,17 +32,6 @@ junit test - - com.github.stefanbirkner - system-rules - 1.19.0 - test - - - org.springframework - spring-test - test - org.onap.ccsdk.sli.core sli-common @@ -57,4 +46,17 @@ jettison + + + + org.apache.maven.plugins + maven-surefire-plugin + + + sdncp-123 + + + + + diff --git a/plugins/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java b/plugins/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java index 34ac4685f..f5259845d 100644 --- a/plugins/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java +++ b/plugins/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java @@ -1,13 +1,8 @@ package jtest.org.onap.ccsdk.sli.plugins.prop; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; - -import org.junit.Rule; import org.junit.Test; -import org.junit.contrib.java.lang.system.EnvironmentVariables; import static org.junit.Assert.assertEquals; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -18,8 +13,7 @@ import org.slf4j.LoggerFactory; public class TestPropertiesNode { private static final Logger log = LoggerFactory.getLogger(TestPropertiesNode.class); - @Rule - public EnvironmentVariables environmentVariables = new EnvironmentVariables(); + @Test public void testJSONFileParsing() throws SvcLogicException { @@ -134,7 +128,7 @@ public class TestPropertiesNode { @Test public void testTXTFileParsing() throws SvcLogicException { - environmentVariables.set("deployer_pass", "sdncp-123"); + assertEquals("sdncp-123", System.getenv("deployer_pass")); SvcLogicContext ctx = new SvcLogicContext(); -- cgit 1.2.3-korg