aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/forwarding-plugins
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-08-21 14:35:56 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-22 16:01:50 +0100
commit08ec52b6ed5ef7159087d708bddfa40d9ac03717 (patch)
treee3272e724c86cba0b57d84d43b6acc51e2f5ab32 /plugins/forwarding-plugins
parentff1698142a22a4811895d2ac7047fbadbb36b396 (diff)
Upgrade Java 17
Issue-ID: POLICY-4803 Change-Id: Iad0d08ee6f8ab18eb177b458d8edbba4002bcc73 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'plugins/forwarding-plugins')
-rw-r--r--plugins/forwarding-plugins/pom.xml15
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarder.java6
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java8
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderParameterGroupTest.java16
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderTest.java58
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParametersTest.java20
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderTest.java31
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java22
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java39
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java12
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java14
11 files changed, 113 insertions, 128 deletions
diff --git a/plugins/forwarding-plugins/pom.xml b/plugins/forwarding-plugins/pom.xml
index 3b44f55b..a1741b88 100644
--- a/plugins/forwarding-plugins/pom.xml
+++ b/plugins/forwarding-plugins/pom.xml
@@ -19,12 +19,13 @@
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.distribution</groupId>
<artifactId>distribution-plugins</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>forwarding-plugins</artifactId>
@@ -42,15 +43,5 @@
<artifactId>distribution-main</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarder.java
index c9ca5003..5aabde78 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarder.java
@@ -20,14 +20,14 @@
package org.onap.policy.distribution.forwarding.lifecycle.api;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
index 9be6a0b2..df2e36ef 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
@@ -22,15 +22,15 @@
package org.onap.policy.distribution.forwarding.lifecycle.api;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderParameterGroupTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderParameterGroupTest.java
index d8ebb4ec..f160d1ba 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderParameterGroupTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderParameterGroupTest.java
@@ -22,20 +22,20 @@
package org.onap.policy.distribution.forwarding.file;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
/**
* Class to perform unit test of {@link FilePolicyForwarderParameterGroup}.
*/
-public class FilePolicyForwarderParameterGroupTest {
+class FilePolicyForwarderParameterGroupTest {
@Test
- public void testBuilderAndGetters() {
- final FilePolicyForwarderParameterGroup configurationParameters = new FilePolicyForwarderParameterGroup();
+ void testBuilderAndGetters() {
+ final var configurationParameters = new FilePolicyForwarderParameterGroup();
configurationParameters.setPath("/tmp");
configurationParameters.setVerbose(true);
configurationParameters.setName("myConfiguration");
@@ -47,8 +47,8 @@ public class FilePolicyForwarderParameterGroupTest {
}
@Test
- public void testInvalidPath() {
- final FilePolicyForwarderParameterGroup configurationParameters = new FilePolicyForwarderParameterGroup();
+ void testInvalidPath() {
+ final var configurationParameters = new FilePolicyForwarderParameterGroup();
configurationParameters.setPath("");
configurationParameters.setVerbose(false);
configurationParameters.setName("myConfiguration");
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderTest.java
index fb00dae1..dbc5804b 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarderTest.java
@@ -23,7 +23,7 @@
package org.onap.policy.distribution.forwarding.file;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
@@ -31,14 +31,11 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwardingException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
@@ -49,10 +46,9 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
* Class to perform unit test of {@link FilePolicyForwarder}.
*
*/
-@RunWith(MockitoJUnitRunner.class)
-public class FilePolicyForwarderTest {
- @ClassRule
- public static TemporaryFolder tempFolder = new TemporaryFolder();
+class FilePolicyForwarderTest {
+
+ private static Path tempFolder;
private static final boolean VERBOSE = true;
private static final String GROUP_NAME = "fileConfiguration";
@@ -60,10 +56,11 @@ public class FilePolicyForwarderTest {
/**
* Set up.
*/
- @BeforeClass
- public static void setUp() {
+ @BeforeAll
+ static void setUp(@TempDir Path tempDir) {
+ tempFolder = tempDir;
final FilePolicyForwarderParameterGroup configurationParameters = new FilePolicyForwarderParameterGroup();
- configurationParameters.setPath(tempFolder.getRoot().getAbsolutePath().toString());
+ configurationParameters.setPath(tempFolder.toFile().getAbsolutePath());
configurationParameters.setVerbose(VERBOSE);
configurationParameters.setName(GROUP_NAME);
ParameterService.register(configurationParameters);
@@ -72,36 +69,36 @@ public class FilePolicyForwarderTest {
/**
* Tear down.
*/
- @AfterClass
- public static void tearDown() {
+ @AfterAll
+ static void tearDown() {
ParameterService.deregister(GROUP_NAME);
}
@Test
- public void testForwardPolicy() throws PolicyForwardingException {
+ void testForwardPolicy() throws PolicyForwardingException {
final Collection<ToscaEntity> policies = new ArrayList<>();
- final ToscaPolicy policy = createPolicy(policies, "test", "test");
+ final var policy = createPolicy(policies);
- final FilePolicyForwarder forwarder = new FilePolicyForwarder();
+ final var forwarder = new FilePolicyForwarder();
forwarder.configure(GROUP_NAME);
forwarder.forward(policies);
- final Path path = Paths.get(tempFolder.getRoot().getAbsolutePath().toString(), policy.getName());
+ final var path = Paths.get(tempFolder.toFile().getAbsolutePath(), policy.getName());
assertTrue(Files.exists(path));
}
@Test
- public void testForwardPolicyError() {
+ void testForwardPolicyError() {
final Collection<ToscaEntity> policies = new ArrayList<>();
- final ToscaPolicy policy = createPolicy(policies, "test", "test");
+ final var policy = createPolicy(policies);
- final ToscaPolicy spy = Mockito.spy(policy);
+ final var spy = Mockito.spy(policy);
Mockito.when(spy.toString()).thenAnswer(invocation -> {
throw new IOException();
});
policies.add(spy);
- final FilePolicyForwarder forwarder = new FilePolicyForwarder();
+ final var forwarder = new FilePolicyForwarder();
forwarder.configure(GROUP_NAME);
assertThatThrownBy(() -> forwarder.forward(policies)).isInstanceOf(PolicyForwardingException.class)
@@ -109,19 +106,19 @@ public class FilePolicyForwarderTest {
}
@Test
- public void testForwardUnsupportedPolicy() {
+ void testForwardUnsupportedPolicy() {
final Collection<ToscaEntity> policies = new ArrayList<>();
- final FilePolicyForwarder forwarder = new FilePolicyForwarder();
+ final var forwarder = new FilePolicyForwarder();
forwarder.configure(GROUP_NAME);
- final ToscaEntity policy = new UnsupportedPolicy();
+ final var policy = new UnsupportedPolicy();
policies.add(policy);
assertThatThrownBy(() -> forwarder.forward(policies)).isInstanceOf(PolicyForwardingException.class)
.hasMessageContaining("Cannot forward policy");
}
- class UnsupportedPolicy extends ToscaEntity {
+ static class UnsupportedPolicy extends ToscaEntity {
@Override
public String getName() {
@@ -129,8 +126,7 @@ public class FilePolicyForwarderTest {
}
}
- private ToscaPolicy createPolicy(final Collection<ToscaEntity> policies, final String name,
- final String description) {
+ private ToscaPolicy createPolicy(final Collection<ToscaEntity> policies) {
final ToscaPolicy policy = new ToscaPolicy();
policy.setName("test");
policy.setDescription("test");
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParametersTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParametersTest.java
index 1904edc7..091b245c 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParametersTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParametersTest.java
@@ -22,10 +22,10 @@
package org.onap.policy.distribution.forwarding.lifecycle.api;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.distribution.forwarding.testclasses.CommonTestData;
@@ -34,7 +34,7 @@ import org.onap.policy.distribution.forwarding.testclasses.CommonTestData;
*
* @author Sirisha Manchikanti (sirisha.manchikanti@est.tech)
*/
-public class LifecycleApiAutomationCompositionForwarderParametersTest {
+class LifecycleApiAutomationCompositionForwarderParametersTest {
private static final String AUTOMATION_COMPOSITION_RUNTIME_HOST_NAME = "localhost";
private static final int AUTOMATION_COMPOSITION_RUNTIME_PORT = 6969;
@@ -43,8 +43,8 @@ public class LifecycleApiAutomationCompositionForwarderParametersTest {
@Test
- public void testValidParameters() {
- final LifecycleApiAutomationCompositionForwarderParameters configurationParameters =
+ void testValidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiAutomationCompositionForwarderParameters.json",
LifecycleApiAutomationCompositionForwarderParameters.class);
@@ -67,8 +67,8 @@ public class LifecycleApiAutomationCompositionForwarderParametersTest {
}
@Test
- public void testInvalidParameters() {
- final LifecycleApiForwarderParameters configurationParameters =
+ void testInvalidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json",
LifecycleApiForwarderParameters.class);
@@ -77,8 +77,8 @@ public class LifecycleApiAutomationCompositionForwarderParametersTest {
}
@Test
- public void testEmptyParameters() {
- final LifecycleApiForwarderParameters configurationParameters =
+ void testEmptyParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters("src/test/resources/parameters/EmptyParameters.json",
LifecycleApiForwarderParameters.class);
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderTest.java
index 0c9a8f6e..f28b52e5 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderTest.java
@@ -25,10 +25,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.ArrayList;
import java.util.Collection;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -45,7 +44,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*
* @author Sirisha Manchikanti (sirisha.manchikanti@est.tech)
*/
-public class LifecycleApiAutomationCompositionForwarderTest {
+class LifecycleApiAutomationCompositionForwarderTest {
private static final String AUTOMATION_COMPOSITION =
"src/test/resources/parameters/sample_automation_composition.json";
@@ -60,9 +59,9 @@ public class LifecycleApiAutomationCompositionForwarderTest {
* @throws PolicyForwardingException if any error occurs
* @throws InterruptedException if any error occurs
*/
- @BeforeClass
- public static void setUp() throws PolicyForwardingException, CoderException, InterruptedException {
- final ParameterGroup parameterGroup = CommonTestData.getPolicyForwarderParameters(
+ @BeforeAll
+ static void setUp() throws PolicyForwardingException, CoderException, InterruptedException {
+ final var parameterGroup = CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiAutomationCompositionForwarderParameters.json",
LifecycleApiAutomationCompositionForwarderParameters.class);
ParameterService.register(parameterGroup);
@@ -75,19 +74,19 @@ public class LifecycleApiAutomationCompositionForwarderTest {
/**
* Tear down.
*/
- @AfterClass
- public static void tearDown() {
+ @AfterAll
+ static void tearDown() {
ParameterService.deregister(LifecycleApiAutomationCompositionForwarderParameters.class.getSimpleName());
simulator.stopLifecycycleApiSimulator();
}
@Test
- public void testForwardAutomationCompositionUsingSimulator() throws Exception {
+ void testForwardAutomationCompositionUsingSimulator() throws Exception {
assertThatCode(() -> {
- final ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
+ final var toscaServiceTemplate = standardCoder.decode(
ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION), ToscaServiceTemplate.class);
- final LifecycleApiAutomationCompositionForwarder forwarder =
+ final var forwarder =
new LifecycleApiAutomationCompositionForwarder();
forwarder.configure(LifecycleApiAutomationCompositionForwarderParameters.class.getSimpleName());
@@ -100,12 +99,12 @@ public class LifecycleApiAutomationCompositionForwarderTest {
}
@Test
- public void testForwardAutomationCompositionFailureUsingSimulator() throws Exception {
+ void testForwardAutomationCompositionFailureUsingSimulator() throws Exception {
- final ToscaEntity toscaEntity = new ToscaEntity();
+ final var toscaEntity = new ToscaEntity();
toscaEntity.setName("FailureCase");
- final LifecycleApiAutomationCompositionForwarder forwarder = new LifecycleApiAutomationCompositionForwarder();
+ final var forwarder = new LifecycleApiAutomationCompositionForwarder();
forwarder.configure(LifecycleApiAutomationCompositionForwarderParameters.class.getSimpleName());
final Collection<ToscaEntity> automationCompositionList = new ArrayList<>();
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java
index 42602cf7..2cee6e6c 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java
@@ -22,11 +22,11 @@
package org.onap.policy.distribution.forwarding.lifecycle.api;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.distribution.forwarding.testclasses.CommonTestData;
@@ -35,7 +35,7 @@ import org.onap.policy.distribution.forwarding.testclasses.CommonTestData;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-public class LifecycleApiForwarderParametersTest {
+class LifecycleApiForwarderParametersTest {
private static final String POLICY_API_HOST_NAME = "localhost";
private static final int POLICY_API_PORT = 6969;
@@ -48,8 +48,8 @@ public class LifecycleApiForwarderParametersTest {
@Test
- public void testValidParameters() {
- final LifecycleApiForwarderParameters configurationParameters =
+ void testValidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json",
LifecycleApiForwarderParameters.class);
@@ -73,8 +73,8 @@ public class LifecycleApiForwarderParametersTest {
}
@Test
- public void testInvalidParameters() {
- final LifecycleApiForwarderParameters configurationParameters =
+ void testInvalidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json",
LifecycleApiForwarderParameters.class);
@@ -83,8 +83,8 @@ public class LifecycleApiForwarderParametersTest {
}
@Test
- public void testEmptyParameters() {
- final LifecycleApiForwarderParameters configurationParameters =
+ void testEmptyParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyForwarderParameters("src/test/resources/parameters/EmptyParameters.json",
LifecycleApiForwarderParameters.class);
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java
index 604445ed..ba85505d 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java
@@ -26,10 +26,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.ArrayList;
import java.util.Collection;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -46,7 +45,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-public class LifecycleApiPolicyForwarderTest {
+class LifecycleApiPolicyForwarderTest {
private static final String POLICY = "src/test/resources/parameters/sample_policy.json";
private static final String POLICY_ERROR = "src/test/resources/parameters/sample_policy_failure.json";
@@ -61,9 +60,9 @@ public class LifecycleApiPolicyForwarderTest {
* @throws PolicyForwardingException if any error occurs
* @throws InterruptedException if any error occurs
*/
- @BeforeClass
- public static void setUp() throws PolicyForwardingException, CoderException, InterruptedException {
- final ParameterGroup parameterGroup = CommonTestData.getPolicyForwarderParameters(
+ @BeforeAll
+ static void setUp() throws PolicyForwardingException, CoderException, InterruptedException {
+ final var parameterGroup = CommonTestData.getPolicyForwarderParameters(
"src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json",
LifecycleApiForwarderParameters.class);
ParameterService.register(parameterGroup);
@@ -76,21 +75,21 @@ public class LifecycleApiPolicyForwarderTest {
/**
* Tear down.
*/
- @AfterClass
- public static void tearDown() {
+ @AfterAll
+ static void tearDown() {
ParameterService.deregister(LifecycleApiForwarderParameters.class.getSimpleName());
simulator.stopLifecycycleApiSimulator();
}
@Test
- public void testForwardPolicyUsingSimulator() throws Exception {
+ void testForwardPolicyUsingSimulator() throws Exception {
assertThatCode(() -> {
- final ToscaServiceTemplate toscaServiceTemplate1 =
+ final var toscaServiceTemplate1 =
standardCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE), ToscaServiceTemplate.class);
- final ToscaServiceTemplate toscaServiceTemplate2 =
+ final var toscaServiceTemplate2 =
standardCoder.decode(ResourceUtils.getResourceAsString(POLICY), ToscaServiceTemplate.class);
- final LifecycleApiPolicyForwarder forwarder = new LifecycleApiPolicyForwarder();
+ final var forwarder = new LifecycleApiPolicyForwarder();
forwarder.configure(LifecycleApiForwarderParameters.class.getSimpleName());
final Collection<ToscaEntity> policies = new ArrayList<>();
@@ -103,17 +102,17 @@ public class LifecycleApiPolicyForwarderTest {
}
@Test
- public void testForwardPolicyFailureUsingSimulator() throws Exception {
+ void testForwardPolicyFailureUsingSimulator() throws Exception {
- final ToscaServiceTemplate toscaServiceTemplate1 =
+ final var toscaServiceTemplate1 =
standardCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE), ToscaServiceTemplate.class);
- final ToscaServiceTemplate toscaServiceTemplate2 =
+ final var toscaServiceTemplate2 =
standardCoder.decode(ResourceUtils.getResourceAsString(POLICY), ToscaServiceTemplate.class);
- final ToscaServiceTemplate toscaServiceTemplate3 =
+ final var toscaServiceTemplate3 =
standardCoder.decode(ResourceUtils.getResourceAsString(POLICY_ERROR), ToscaServiceTemplate.class);
- final ToscaEntity unsupportedPolicy = new UnsupportedPolicy();
+ final var unsupportedPolicy = new UnsupportedPolicy();
- final LifecycleApiPolicyForwarder forwarder = new LifecycleApiPolicyForwarder();
+ final var forwarder = new LifecycleApiPolicyForwarder();
forwarder.configure(LifecycleApiForwarderParameters.class.getSimpleName());
final Collection<ToscaEntity> policies = new ArrayList<>();
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java
index 00b017ba..c50bf222 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java
@@ -21,12 +21,12 @@
package org.onap.policy.distribution.forwarding.testclasses;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java
index 22aeff2f..810ac84d 100644
--- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java
+++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java
@@ -22,13 +22,13 @@
package org.onap.policy.distribution.forwarding.testclasses;
import io.swagger.annotations.ApiParam;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import org.onap.policy.models.pap.concepts.PdpDeployPolicies;
import org.onap.policy.models.pap.concepts.PdpGroupDeployResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;