aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-07-21 09:41:01 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-21 14:29:31 +0100
commit349b4ae7179173f9261d9a432094cb55dc433820 (patch)
tree4c13de684e11e7945ae52e178fd7d685601fff01 /utils/src
parentb902de16baecd36652db1208093030cedde813bb (diff)
Java 17 Upgrade
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'utils/src')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineException.java3
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java3
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java3
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java3
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java3
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java2
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/cmd/TestCommandLineArguments.java4
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java14
12 files changed, 29 insertions, 19 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java
index b9ba3fdd..970cebfe 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java
@@ -100,7 +100,7 @@ public class CommandLineArgumentsHandler {
*/
public CommandLineArgumentsHandler(String helpClassName, String component, Option... customOptions) {
this(helpClassName, component);
- if (customOptions != null && customOptions.length > 0) {
+ if (customOptions != null) {
for (Option option : customOptions) {
options.addOption(option);
}
@@ -108,7 +108,7 @@ public class CommandLineArgumentsHandler {
}
/**
- * Construct the options with brand new options for the CLI editor.
+ * Construct the options with brand-new options for the CLI editor.
*/
public CommandLineArgumentsHandler(String helpClassName, String component, Options options) {
this.options = options;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineException.java b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineException.java
index 95870f75..9cdf3d37 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineException.java
@@ -20,6 +20,8 @@
package org.onap.policy.common.utils.cmd;
+import java.io.Serial;
+
/**
* Exception used for CommandLineArguments class.
*
@@ -31,6 +33,7 @@ public class CommandLineException extends Exception {
/**
* Generated serialVersionUID.
*/
+ @Serial
private static final long serialVersionUID = -1200607308084606425L;
/**
diff --git a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java
index f975422e..f1798516 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import lombok.AllArgsConstructor;
import lombok.Getter;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java
index 8901277f..5f3a6ea8 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import lombok.AllArgsConstructor;
import lombok.Getter;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java
index bc5623b0..131e87a4 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityTransaction;
+import jakarta.persistence.EntityTransaction;
import lombok.Getter;
/**
diff --git a/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java b/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
index 3de6df39..a974f1e5 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +21,12 @@
package org.onap.policy.common.utils.security;
+import jakarta.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
index 67a588fe..08994912 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
@@ -213,7 +213,7 @@ public class ServiceManager implements Startable {
/*
* Cannot use a plain Runnable, because it can't throw exceptions. Could use a
- * Callable, instead, but then all of the lambda expressions become rather messy, thus
+ * Callable, instead, but then all the lambda expressions become rather messy, thus
* we'll stick with RunnableWithEx, and just disable the sonar warning.
*/
@FunctionalInterface
diff --git a/utils/src/test/java/org/onap/policy/common/utils/cmd/TestCommandLineArguments.java b/utils/src/test/java/org/onap/policy/common/utils/cmd/TestCommandLineArguments.java
index 1501e769..b45f107d 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/cmd/TestCommandLineArguments.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/cmd/TestCommandLineArguments.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021, 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ public class TestCommandLineArguments {
@Test
public void testParse_ShouldThrowExceptionWhenFileNameNull() {
String[] nullArgs = {"-c", null};
- assertThatThrownBy(() -> testCmd.parse(nullArgs)).hasMessage(ERR_MSG_INVALID_ARGS).hasRootCauseMessage(null);
+ assertThatThrownBy(() -> testCmd.parse(nullArgs)).hasMessage(ERR_MSG_INVALID_ARGS);
}
@Test
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
index b8730a65..17d7f7ff 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
index 3981e2af..0e8edca2 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
index 18b39d26..dc63c673 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
@@ -3,6 +3,7 @@
* Common Utils
* ================================================================================
* Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +28,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import javax.persistence.EntityTransaction;
+import jakarta.persistence.EntityTransaction;
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
index 54e17209..a39b4fc2 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021, 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,12 +77,12 @@ public class ResourceUtilsTest {
}
/**
- * Cleandown resource utils test.
+ * Clean resource utils test.
*/
@After
- public void cleandownResourceUtilsTest() {
- tmpEmptyFile.delete();
- tmpUsedFile.delete();
+ public void cleanDownResourceUtilsTest() {
+ assertTrue(tmpEmptyFile.delete());
+ assertTrue(tmpUsedFile.delete());
}
/**
@@ -312,8 +312,8 @@ public class ResourceUtilsTest {
normalizePath(resultD2.iterator().next()));
Set<String> resultJ0 = ResourceUtils.getDirectoryContents("com");
- assertTrue(resultJ0.contains("com/google/gson/"));
- assertEquals("com/google/", normalizePath(resultJ0.iterator().next()));
+ assertTrue(resultJ0.contains("com/worldturner/medeia/"));
+ assertEquals("com/worldturner/", normalizePath(resultJ0.iterator().next()));
Set<String> resultJ1 = ResourceUtils.getDirectoryContents("com/google/gson");
assertTrue(resultJ1.size() > 1);