summaryrefslogtreecommitdiffstats
path: root/northbound
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2023-01-31 08:15:34 -0500
committerDan Timoney <dtimoney@att.com>2023-02-07 10:24:42 -0500
commit72aef3a6324c78a62d0eff65217d4861440841f5 (patch)
tree7a208d5d4630a046e05768e004956c4c9cffa253 /northbound
parent8393d347d303d70e4ff4c7c91b7454467545cab3 (diff)
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 <dtimoney@att.com> Change-Id: I278ee869d2ce0568b29ecc29c37d00d7fce757a8
Diffstat (limited to 'northbound')
-rwxr-xr-xnorthbound/dmaap-listener/pom.xml1
-rw-r--r--northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java11
-rw-r--r--northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java21
-rw-r--r--northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java10
-rw-r--r--northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties3
-rw-r--r--northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties1
-rwxr-xr-xnorthbound/ueb-listener/pom.xml5
7 files changed, 10 insertions, 42 deletions
diff --git a/northbound/dmaap-listener/pom.xml b/northbound/dmaap-listener/pom.xml
index 17137bcd0..db426f73c 100755
--- a/northbound/dmaap-listener/pom.xml
+++ b/northbound/dmaap-listener/pom.xml
@@ -162,6 +162,7 @@
<DMAAP_AUTHKEY>ABC123</DMAAP_AUTHKEY>
<ODL_USER>admin</ODL_USER>
<ODL_PASSWORD>admin</ODL_PASSWORD>
+ <DMAAPLISTENERROOT>.</DMAAPLISTENERROOT>
</environmentVariables>
</configuration>
</plugin>
diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java
index 623c96426..cd198e1d3 100644
--- a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java
+++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java
@@ -117,16 +117,7 @@ public class TestSdncEsrDmaapReceiver {
e.printStackTrace();
}
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
+
Properties props = new Properties();
InputStream propStr = TestSdncEsrDmaapReceiver.class.getResourceAsStream("/dmaap-consumer-esrsysteminfo.properties");
diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java
index 620098cb7..bf7b4e236 100644
--- a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java
+++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java
@@ -52,16 +52,6 @@ public class TestSdncJsonDmaapConsumer {
e.printStackTrace();
}
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
String msg = "{\n" +
" \"input\" : { \n" +
@@ -99,17 +89,6 @@ public class TestSdncJsonDmaapConsumer {
e.printStackTrace();
}
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
-
String msg = "{\n" +
" \"input\" : { \n" +
" }\n" +
diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
index 11201265d..06876086d 100644
--- a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
+++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
@@ -118,16 +118,6 @@ public class TestSdncPserverDmaapReceiver {
e.printStackTrace();
}
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
Properties props = new Properties();
SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties
index 785d636bb..6492316fe 100644
--- a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties
+++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties
@@ -31,4 +31,5 @@ sessionstickinessrequired=NO
DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt
sdnc.odl.user=${ODL_USER}
sdnc.odl.password=${ODL_PASSWORD}
-sdnc.odl.url-base=http://localhost:8181/restconf/operations \ No newline at end of file
+sdnc.odl.url-base=http://localhost:8181/restconf/operations
+routeOffer=MR1 \ No newline at end of file
diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
index 2fb525e89..6492316fe 100644
--- a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
+++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
@@ -32,3 +32,4 @@ DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt
sdnc.odl.user=${ODL_USER}
sdnc.odl.password=${ODL_PASSWORD}
sdnc.odl.url-base=http://localhost:8181/restconf/operations
+routeOffer=MR1 \ No newline at end of file
diff --git a/northbound/ueb-listener/pom.xml b/northbound/ueb-listener/pom.xml
index db620937b..293c5ba49 100755
--- a/northbound/ueb-listener/pom.xml
+++ b/northbound/ueb-listener/pom.xml
@@ -93,6 +93,11 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.24</version>
+ </dependency>
</dependencies>
<build>