aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--forwarding/pom.xml5
-rw-r--r--forwarding/src/test/java/org/onap/policy/distribution/forwarding/TestExceptions.java6
-rw-r--r--main/pom.xml13
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java10
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java16
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java16
-rwxr-xr-x[-rw-r--r--]main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java45
-rwxr-xr-x[-rw-r--r--]main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java92
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java56
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java57
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java56
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java72
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java54
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java45
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java25
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java22
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java26
-rw-r--r--model/pom.xml5
-rw-r--r--model/src/test/java/org/onap/policy/distribution/model/TestModels.java9
-rw-r--r--packages/policy-distribution-docker/pom.xml10
-rw-r--r--packages/policy-distribution-docker/src/main/docker/Dockerfile2
-rw-r--r--packages/policy-distribution-tarball/pom.xml4
-rw-r--r--packages/pom.xml7
-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
-rw-r--r--plugins/pom.xml8
-rw-r--r--plugins/reception-plugins/pom.xml5
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java18
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java45
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java18
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java61
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java56
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java50
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestComponentDoneStatusMessage.java18
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestDistributionStatusMessage.java18
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java159
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java63
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/TestExceptions.java6
-rw-r--r--pom.xml21
-rw-r--r--reception/pom.xml5
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/decoding/TestExceptions.java6
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java72
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java21
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderConfigurationParametersJsonAdapter.java44
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java14
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerConfigurationParametersJsonAdapter.java46
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java44
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/statistics/TestDistributionStatisticsManager.java36
-rw-r--r--testsuites/performance/pom.xml5
-rw-r--r--testsuites/pom.xml7
-rw-r--r--testsuites/stability/pom.xml5
-rw-r--r--version.properties2
61 files changed, 853 insertions, 894 deletions
diff --git a/forwarding/pom.xml b/forwarding/pom.xml
index de9c7217..2ef6d752 100644
--- a/forwarding/pom.xml
+++ b/forwarding/pom.xml
@@ -17,12 +17,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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>forwarding</artifactId>
diff --git a/forwarding/src/test/java/org/onap/policy/distribution/forwarding/TestExceptions.java b/forwarding/src/test/java/org/onap/policy/distribution/forwarding/TestExceptions.java
index 66e16651..eaa74cfd 100644
--- a/forwarding/src/test/java/org/onap/policy/distribution/forwarding/TestExceptions.java
+++ b/forwarding/src/test/java/org/onap/policy/distribution/forwarding/TestExceptions.java
@@ -20,13 +20,13 @@
package org.onap.policy.distribution.forwarding;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
-public class TestExceptions {
+class TestExceptions {
@Test
- public void test() {
+ void test() {
new ExceptionsTester().test(PolicyForwardingException.class);
}
}
diff --git a/main/pom.xml b/main/pom.xml
index 37a889b1..1bb1b807 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -18,18 +18,20 @@
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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-main</artifactId>
<name>${project.artifactId}</name>
- <description>The main module of Policy Distribution that handles startup, lifecycle management, and parameters.</description>
+ <description>The main module of Policy Distribution that handles startup, lifecycle management, and parameters.
+ </description>
<dependencies>
<dependency>
@@ -51,6 +53,11 @@
<artifactId>gson</artifactId>
</dependency>
<dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.6.11</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils-test</artifactId>
<version>${policy.common.version}</version>
diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
index 702f8a2a..e9e4b04e 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
@@ -26,11 +26,11 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
-import javax.ws.rs.GET;
-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.GET;
+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.common.endpoints.report.HealthCheckReport;
/**
diff --git a/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java b/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
index 0f5e5023..4a15506e 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
@@ -20,19 +20,19 @@
package org.onap.policy.distribution.main;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestExceptions {
+class TestExceptions {
@Test
- public void test() {
- assertNotNull(new PolicyDistributionException("Message"));
- assertNotNull(new PolicyDistributionException("Message", new IOException()));
+ void test() {
+ assertDoesNotThrow(() -> new PolicyDistributionException("Message"));
+ assertDoesNotThrow(() -> new PolicyDistributionException("Message", new IOException()));
- assertNotNull(new PolicyDistributionRuntimeException("Message"));
- assertNotNull(new PolicyDistributionRuntimeException("Message", new IOException()));
+ assertDoesNotThrow(() -> new PolicyDistributionRuntimeException("Message"));
+ assertDoesNotThrow(() -> new PolicyDistributionRuntimeException("Message", new IOException()));
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
index 9f6fab5a..57fa97d1 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -133,6 +133,22 @@ public class CommonTestData {
/**
* Returns an instance of ReceptionHandlerParameters for test cases.
*
+ * @param port the port
+ * @return the restServerParameters object
+ */
+ public RestServerParameters getRestServerParameters(final int port) {
+ final var fileName = "src/test/resources/parameters/RestServerParameters.json";
+ try {
+ var json = Files.readString(new File(fileName).toPath());
+ return coder.decode(json.replace("6969", String.valueOf(port)), RestServerParameters.class);
+ } catch (final Exception exp) {
+ throw new RuntimeException("cannot read/decode " + fileName, exp);
+ }
+ }
+
+ /**
+ * Returns an instance of ReceptionHandlerParameters for test cases.
+ *
* @param isEmpty boolean value to represent that object created should be empty or not
* @return the receptionHandlerParameters object
*/
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
index 0b5bfcb8..a48b0bd7 100644..100755
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
@@ -23,12 +23,12 @@
package org.onap.policy.distribution.main.parameters;
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 java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
@@ -42,25 +42,24 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionParameterGroup {
+class TestDistributionParameterGroup {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testDistributionParameterGroup() {
- final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
- final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
- commonTestData.getReceptionHandlerParameters(false);
- final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
+ void testDistributionParameterGroup() {
+ final var restServerParameters = commonTestData.getRestServerParameters(false);
+ final var receptionHandlerParameters = commonTestData.getReceptionHandlerParameters(false);
+ final var receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
- final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
+ final var forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
- final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ final var decoderConfigurations =
commonTestData.getPolicyDecoderConfigurationParameters(false);
- final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ final var distributionParameters = new DistributionParameterGroup(
CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters,
receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
- final ValidationResult validationResult = distributionParameters.validate();
+ final var validationResult = distributionParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), distributionParameters.getRestServerParameters().getHost());
assertEquals(restServerParameters.getPort(), distributionParameters.getRestServerParameters().getPort());
@@ -100,9 +99,9 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullName() {
- final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
- final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ void testDistributionParameterGroup_NullName() {
+ final var restServerParameters = commonTestData.getRestServerParameters(false);
+ final var receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
@@ -116,7 +115,7 @@ public class TestDistributionParameterGroup {
receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final ValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
- assertEquals(null, distributionParameters.getName());
+ assertThat(distributionParameters.getName()).isNull();
assertEquals(
receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
@@ -134,7 +133,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyName() {
+ void testDistributionParameterGroup_EmptyName() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
@@ -168,7 +167,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullReceptionHandlerParameters() {
+ void testDistributionParameterGroup_NullReceptionHandlerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
@@ -184,7 +183,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
+ void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(true);
@@ -204,7 +203,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyRestServerParameters() {
+ void testDistributionParameterGroup_EmptyRestServerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(true);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
@@ -224,7 +223,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullRestServerParameters() {
+ void testDistributionParameterGroup_NullRestServerParameters() {
final RestServerParameters restServerParameters = null;
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
index b83b3fc9..697cdd64 100644..100755
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
@@ -23,13 +23,13 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
@@ -41,20 +41,20 @@ import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionParameterHandler {
+class TestDistributionParameterHandler {
@Test
- public void testParameterHandlerNoParameterFile() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerNoParameterFile() throws PolicyDistributionException, CommandLineException {
verifyFailure("NoParameterFile.json", PolicyDistributionException.class, "FileNotFoundException");
}
@Test
- public void testParameterHandlerEmptyParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerEmptyParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("EmptyParameters.json", PolicyDistributionException.class,
"no parameters found in \"parameters/EmptyParameters.json\"");
}
@Test
- public void testParameterHandlerBadParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerBadParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("BadParameters.json", PolicyDistributionException.class,
"error reading parameters from \"parameters/BadParameters.json\"\n"
+ "(JsonSyntaxException):java.lang.IllegalStateException: "
@@ -62,7 +62,7 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testParameterHandlerInvalidParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerInvalidParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("InvalidParameters.json", PolicyDistributionException.class,
"error reading parameters from \"parameters/InvalidParameters.json\"\n"
+ "(JsonSyntaxException):java.lang.IllegalStateException: "
@@ -70,30 +70,30 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testParameterHandlerNoParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerNoParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("NoParameters.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testParameterHandlerMinumumParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerMinumumParameters() throws PolicyDistributionException, CommandLineException {
final String[] minArgumentString = {"-c", "parameters/MinimumParameters.json"};
- final DistributionCommandLineArguments minArguments = new DistributionCommandLineArguments();
+ final var minArguments = new DistributionCommandLineArguments();
minArguments.parse(minArgumentString);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(minArguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(minArguments);
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, parGroup.getName());
}
@Test
- public void testDistributionParameterGroup() throws PolicyDistributionException, CommandLineException {
+ void testDistributionParameterGroup() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-c", "parameters/DistributionConfigParameters.json"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(arguments);
assertTrue(arguments.checkSetConfigurationFilePath());
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, parGroup.getName());
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, parGroup.getReceptionHandlerParameters()
@@ -118,14 +118,14 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidForwarderConfigurationClassName()
+ void testDistributionParameterGroup_InvalidForwarderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidForwarderConfigurationClassName.json",
PolicyDistributionException.class, "parameter \"parameterClassName\" value \"\" invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_UnknownForwarderConfigurationClassName()
+ void testDistributionParameterGroup_UnknownForwarderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_UnknownForwarderConfigurationClassName.json",
PolicyDistributionException.class,
@@ -133,58 +133,58 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException, CommandLineException {
+ void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidName.json", PolicyDistributionException.class,
"\"name\" value \" \" INVALID, is blank");
}
@Test
- public void testDistributionParameterGroup_NoReceptionHandler()
+ void testDistributionParameterGroup_NoReceptionHandler()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoReceptionHandler.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandler()
+ void testDistributionParameterGroup_EmptyReceptionHandler()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyReceptionHandler.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_NoPolicyDecoder()
+ void testDistributionParameterGroup_NoPolicyDecoder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoPolicyDecoder.json", PolicyDistributionException.class,
"\"policyDecoders\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_NoPolicyForwarder()
+ void testDistributionParameterGroup_NoPolicyForwarder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoPolicyForwarder.json", PolicyDistributionException.class,
"\"policyForwarderConfigurationParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_EmptyPolicyDecoder()
+ void testDistributionParameterGroup_EmptyPolicyDecoder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyPolicyDecoder.json", PolicyDistributionException.class,
"\"policyDecoders\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_EmptyPolicyForwarder()
+ void testDistributionParameterGroup_EmptyPolicyForwarder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyPolicyForwarder.json", PolicyDistributionException.class,
"\"policyForwarders\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
+ void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = Files
+ var resultString = Files
.readString(
Paths.get("src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt"))
.trim().replaceAll("\\r\\n", "\\\n");
@@ -194,77 +194,77 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
+ void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = new String(Files
+ var resultString = Files
.readString(Paths
.get("src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt"))
- .trim().replaceAll("\\r\\n", "\\\n"));
+ .trim().replaceAll("\\r\\n", "\\\n");
verifyFailure("DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json",
PolicyDistributionException.class, resultString);
}
@Test
- public void testDistributionParameterGroup_InvalidRestServerParameters()
+ void testDistributionParameterGroup_InvalidRestServerParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = new String(Files
+ var resultString = Files
.readString(Paths.get("src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt"))
- .trim().replaceAll("\\r\\n", "\\\n"));
+ .trim().replaceAll("\\r\\n", "\\\n");
verifyFailure("DistributionConfigParameters_InvalidRestServerParameters.json",
PolicyDistributionException.class, resultString);
}
@Test
- public void testDistributionVersion() throws PolicyDistributionException, CommandLineException {
+ void testDistributionVersion() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-v"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
- final String version = arguments.parse(distributionConfigParameters);
+ final var arguments = new DistributionCommandLineArguments();
+ final var version = arguments.parse(distributionConfigParameters);
assertTrue(version.startsWith("ONAP Policy Framework Distribution Service"));
}
@Test
- public void testDistributionHelp() throws PolicyDistributionException, CommandLineException {
+ void testDistributionHelp() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-h"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
- final String help = arguments.parse(distributionConfigParameters);
+ final var arguments = new DistributionCommandLineArguments();
+ final var help = arguments.parse(distributionConfigParameters);
assertTrue(help.startsWith("usage:"));
}
@Test
- public void testDistributionInvalidOption() throws PolicyDistributionException {
+ void testDistributionInvalidOption() throws PolicyDistributionException {
final String[] distributionConfigParameters = {"-d"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
assertThatThrownBy(() -> arguments.parse(distributionConfigParameters))
.hasMessageContaining("invalid command line arguments specified");
}
@Test
- public void testDistributionParameterGroup_InvalidReceptionHandlerClass()
+ void testDistributionParameterGroup_InvalidReceptionHandlerClass()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidReceptionHandlerClass.json",
PolicyDistributionException.class, "could not find class");
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandlerClass()
+ void testDistributionParameterGroup_EmptyReceptionHandlerClass()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyReceptionHandlerClass.json", PolicyDistributionException.class,
"invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_InvalidDecoderConfigurationClassName()
+ void testDistributionParameterGroup_InvalidDecoderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidDecoderConfigurationClassName.json",
PolicyDistributionException.class, "parameter \"parameterClassName\" value \"\" invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_UnknownDecoderConfigurationClassName()
+ void testDistributionParameterGroup_UnknownDecoderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_UnknownDecoderConfigurationClassName.json",
PolicyDistributionException.class,
@@ -275,10 +275,10 @@ public class TestDistributionParameterHandler {
throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-c", "parameters/" + fileName};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
- DistributionParameterHandler paramHandler = new DistributionParameterHandler();
+ var paramHandler = new DistributionParameterHandler();
assertThatThrownBy(() -> paramHandler.getParameters(arguments)).isInstanceOf(clazz)
.hasMessageContaining(expectedMessage);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
index 9def403d..e7a15902 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
@@ -23,31 +23,27 @@
package org.onap.policy.distribution.main.parameters;
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 java.util.Map;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
-import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
/**
* Class to perform unit test of PluginHandlerParameters.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPluginHandlerParameters {
+class TestPluginHandlerParameters {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testPluginHandlerParameters() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- final ValidationResult validationResult = pHParameters.validate();
+ void testPluginHandlerParameters() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ final var validationResult = pHParameters.validate();
assertEquals(policyDecoders.get(CommonTestData.DUMMY_DECODER_KEY),
pHParameters.getPolicyDecoders().get(CommonTestData.DUMMY_DECODER_KEY));
assertEquals(policyForwarders.get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY),
@@ -56,36 +52,36 @@ public class TestPluginHandlerParameters {
}
@Test
- public void testPluginHandlerParameters_NullPolicyDecoders() {
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(null, policyForwarders);
+ void testPluginHandlerParameters_NullPolicyDecoders() {
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(null, policyForwarders);
assertThat(pHParameters.validate().getResult()).contains("\"policyDecoders\" value \"null\" INVALID, is null");
}
@Test
- public void testPluginHandlerParameters_NullPolicyForwarders() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, null);
+ void testPluginHandlerParameters_NullPolicyForwarders() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, null);
assertThat(pHParameters.validate().getResult())
.contains("\"policyForwarders\" value \"null\" INVALID, is null");
}
@Test
- public void testPluginHandlerParameters_EmptyPolicyDecoders() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(true);
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- ValidationResult result = pHParameters.validate();
+ void testPluginHandlerParameters_EmptyPolicyDecoders() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(true);
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ var result = pHParameters.validate();
assertFalse(result.isValid());
assertThat(pHParameters.validate().getResult()).contains("\"policyDecoders\"", "minimum");
}
@Test
- public void testPluginHandlerParameters_EmptyPolicyForwarders() {
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(true);
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- ValidationResult result = pHParameters.validate();
+ void testPluginHandlerParameters_EmptyPolicyForwarders() {
+ final var policyForwarders = commonTestData.getPolicyForwarders(true);
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ var result = pHParameters.validate();
assertFalse(result.isValid());
assertThat(pHParameters.validate().getResult()).contains("\"policyForwarders\"", "minimum");
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
index 4195f1b6..74b8c213 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
@@ -22,15 +22,14 @@
package org.onap.policy.distribution.main.parameters;
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 static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CLASS_NAME;
import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CONFIGURATION_PARAMETERS;
import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_TYPE;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
/**
@@ -38,13 +37,13 @@ import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPolicyDecoderParameters {
+class TestPolicyDecoderParameters {
@Test
- public void testPolicyDecoderParameters() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertEquals(DECODER_CONFIGURATION_PARAMETERS, pDParameters.getDecoderConfigurationName());
@@ -52,10 +51,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderType() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderType() {
+ final var pDParameters =
new PolicyDecoderParameters("", DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -63,10 +62,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderClassName() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -74,10 +73,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
+ final var pDParameters =
new PolicyDecoderParameters("", "", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -86,32 +85,32 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_NullDecoderType() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_NullDecoderType() {
+ final var pDParameters =
new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
- assertEquals(null, pDParameters.getDecoderType());
+ final var validationResult = pDParameters.validate();
+ assertThat(pDParameters.getDecoderType()).isNull();
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"decoderType\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyDecoderParameters_NullDecoderClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_NullDecoderClassName() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
- assertEquals(null, pDParameters.getDecoderClassName());
+ assertThat(pDParameters.getDecoderClassName()).isNull();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"decoderClassName\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderClass() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE,
+ void testPolicyDecoderParameters_InvalidDecoderClass() {
+ final var pDParameters = new PolicyDecoderParameters(DECODER_TYPE,
DECODER_CLASS_NAME + "Invalid", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME + "Invalid", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
index 5dc1b448..b088194e 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
@@ -22,14 +22,14 @@
package org.onap.policy.distribution.main.parameters;
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 static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_CLASS_NAME;
import static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_CONFIGURATION_PARAMETERS;
import static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_TYPE;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -38,23 +38,23 @@ import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPolicyForwarderParameters {
+class TestPolicyForwarderParameters {
@Test
- public void testPolicyForwarderParameters() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertTrue(validationResult.isValid());
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderType() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderType() {
+ final var pFParameters =
new PolicyForwarderParameters("", FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals("", pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -62,10 +62,10 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderClassName() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, "", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(CommonTestData.FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals("", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -73,10 +73,10 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderTypeAndClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderTypeAndClassName() {
+ final var pFParameters =
new PolicyForwarderParameters("", "", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals("", pFParameters.getForwarderType());
assertEquals("", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -85,32 +85,32 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_NullForwarderType() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_NullForwarderType() {
+ final var pFParameters =
new PolicyForwarderParameters(null, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
- assertEquals(null, pFParameters.getForwarderType());
+ final var validationResult = pFParameters.validate();
+ assertThat(pFParameters.getForwarderType()).isNull();
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"forwarderType\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyForwarderParameters_NullForwarderClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_NullForwarderClassName() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, null, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
- assertEquals(null, pFParameters.getForwarderClassName());
+ assertThat(pFParameters.getForwarderClassName()).isNull();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"forwarderClassName\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderClass() {
- final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters(FORWARDER_TYPE,
+ void testPolicyForwarderParameters_InvalidForwarderClass() {
+ final var pFParameters = new PolicyForwarderParameters(FORWARDER_TYPE,
FORWARDER_CLASS_NAME + "Invalid", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME + "Invalid", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
index c02b96bc..41a82bca 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
@@ -22,13 +22,11 @@
package org.onap.policy.distribution.main.parameters;
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.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
/**
@@ -36,16 +34,16 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestReceptionHandlerParameters {
+class TestReceptionHandlerParameters {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testReceptionHandlerParameters() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ void testReceptionHandlerParameters() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
@@ -55,13 +53,13 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_NullReceptionHandlerType() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_NullReceptionHandlerType() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(null, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
- assertEquals(null, rHParameters.getReceptionHandlerType());
+ final var validationResult = rHParameters.validate();
+ assertThat(rHParameters.getReceptionHandlerType()).isNull();
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
rHParameters.getReceptionHandlerConfigurationName());
@@ -71,14 +69,14 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, null,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
- assertEquals(null, rHParameters.getReceptionHandlerClassName());
+ assertThat(rHParameters.getReceptionHandlerClassName()).isNull();
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
rHParameters.getReceptionHandlerConfigurationName());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
@@ -88,12 +86,12 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters("", CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals("", rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
@@ -102,12 +100,12 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, "",
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals("", rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
@@ -118,24 +116,24 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyPluginHandler() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(true);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ void testReceptionHandlerParameters_EmptyPluginHandler() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(true);
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- ValidationResult result = rHParameters.validate();
+ var result = rHParameters.validate();
assertFalse(result.isValid());
assertThat(result.getResult()).contains("\"policyForwarders\"", "minimum");
}
@Test
- public void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid",
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid",
rHParameters.getReceptionHandlerClassName());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
index ce4cda24..4673f383 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
@@ -25,22 +25,17 @@ package org.onap.policy.distribution.main.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
-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 jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.internal.util.reflection.Whitebox;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.http.server.RestServer;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.network.NetworkUtil;
@@ -53,7 +48,7 @@ import org.onap.policy.distribution.main.startstop.Main;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionRestServer {
+class TestDistributionRestServer {
private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
@@ -62,32 +57,31 @@ public class TestDistributionRestServer {
private int port;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testHealthCheckSuccess() throws IOException, InterruptedException {
- final String reportString =
+ void testHealthCheckSuccess() throws IOException, InterruptedException {
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive)";
- final Main main = startDistributionService();
- final HealthCheckReport report = performHealthCheck();
+ final var main = startDistributionService();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, true, 200, ALIVE, reportString, report);
assertThatCode(() -> stopDistributionService(main)).doesNotThrowAnyException();
}
@Test
- public void testHealthCheckFailure() throws IOException, InterruptedException {
+ void testHealthCheckFailure() throws IOException, InterruptedException {
port = NetworkUtil.allocPort();
- final String reportString =
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=false, code=500, message=not alive)";
- final RestServerParameters restServerParams = new CommonTestData().getRestServerParameters(false);
- Whitebox.setInternalState(restServerParams, "port", port);
+ final var restServerParams = new CommonTestData().getRestServerParameters(port);
restServerParams.setName(CommonTestData.DISTRIBUTION_GROUP_NAME);
- final RestServer restServer = new RestServer(restServerParams, null, DistributionRestController.class);
+ final var restServer = new RestServer(restServerParams, null, DistributionRestController.class);
restServer.start();
- final HealthCheckReport report = performHealthCheck();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, false, 500, NOT_ALIVE, reportString, report);
assertTrue(restServer.isAlive());
assertThat(restServer.toString()).startsWith("RestServer(servers=");
@@ -104,16 +98,16 @@ public class TestDistributionRestServer {
main.shutdown();
}
- private HealthCheckReport performHealthCheck() throws InterruptedException, IOException {
- final ClientConfig clientConfig = new ClientConfig();
+ private HealthCheckReport performHealthCheck() throws InterruptedException {
+ final var clientConfig = new ClientConfig();
- final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
+ final var feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
clientConfig.register(feature);
- final Client client = ClientBuilder.newClient(clientConfig);
- final WebTarget webTarget = client.target("http://localhost:" + port + "/healthcheck");
+ final var client = ClientBuilder.newClient(clientConfig);
+ final var webTarget = client.target("http://localhost:" + port + "/healthcheck");
- final Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ final var invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
CommonTestData.awaitServer(port);
return invocationBuilder.get(HealthCheckReport.class);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
index 82e40ccd..ffe0c8d5 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
@@ -23,21 +23,16 @@
package org.onap.policy.distribution.main.rest;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
import java.security.SecureRandom;
-import java.util.Properties;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.network.NetworkUtil;
@@ -51,7 +46,7 @@ import org.onap.policy.distribution.main.startstop.Main;
*
* @author Libo Zhu (libo.zhu@intel.com)
*/
-public class TestHttpsDistributionRestServer {
+class TestHttpsDistributionRestServer {
private static final String ALIVE = "alive";
private static final String SELF = NetworkUtil.getHostname();
@@ -59,23 +54,23 @@ public class TestHttpsDistributionRestServer {
private int port;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testHttpsHealthCheckSuccess() throws Exception {
- final String reportString =
+ void testHttpsHealthCheckSuccess() throws Exception {
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive)";
- final Main main = startDistributionService();
- final HealthCheckReport report = performHealthCheck();
+ final var main = startDistributionService();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, true, 200, ALIVE, reportString, report);
assertThatCode(() -> stopDistributionService(main)).doesNotThrowAnyException();
}
private Main startDistributionService() throws IOException, InterruptedException {
- final Properties systemProps = System.getProperties();
+ final var systemProps = System.getProperties();
systemProps.put("javax.net.ssl.keyStore", new SelfSignedKeyStore().getKeystoreName());
systemProps.put("javax.net.ssl.keyStorePassword", SelfSignedKeyStore.KEYSTORE_PASSWORD);
System.setProperties(systemProps);
@@ -91,19 +86,19 @@ public class TestHttpsDistributionRestServer {
private HealthCheckReport performHealthCheck() throws Exception {
- final TrustManager[] noopTrustManager = NetworkUtil.getAlwaysTrustingManager();
+ final var noopTrustManager = NetworkUtil.getAlwaysTrustingManager();
- final SSLContext sc = SSLContext.getInstance("TLSv1.2");
+ final var sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, noopTrustManager, new SecureRandom());
- final ClientBuilder clientBuilder =
+ final var clientBuilder =
ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
- final Client client = clientBuilder.build();
- final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
+ final var client = clientBuilder.build();
+ final var feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
client.register(feature);
- final WebTarget webTarget = client.target("https://localhost:" + port + "/healthcheck");
+ final var webTarget = client.target("https://localhost:" + port + "/healthcheck");
- final Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ final var invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
CommonTestData.awaitServer(port);
return invocationBuilder.get(HealthCheckReport.class);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
index dd498bfa..af0b58e1 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
@@ -22,17 +22,16 @@
package org.onap.policy.distribution.main.startstop;
-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 java.io.IOException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.parameters.CommonTestData;
-import org.onap.policy.distribution.main.parameters.DistributionParameterGroup;
import org.onap.policy.distribution.main.parameters.DistributionParameterHandler;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
@@ -41,24 +40,24 @@ import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionActivator {
+class TestDistributionActivator {
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testDistributionActivator() throws PolicyDistributionException, IOException {
+ void testDistributionActivator() throws PolicyDistributionException, IOException {
CommonTestData.makeConfigFile("parameters/DistributionConfigParameters.json");
final String[] distributionConfigParameters = { "-c", CommonTestData.CONFIG_FILE };
- final DistributionCommandLineArguments arguments =
+ final var arguments =
new DistributionCommandLineArguments(distributionConfigParameters);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(arguments);
- final DistributionActivator activator = new DistributionActivator(parGroup);
+ final var activator = new DistributionActivator(parGroup);
activator.initialize();
assertTrue(activator.getDistributionParameterGroup().isValid());
assertTrue(DistributionActivator.isAlive());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
index 0a0e5fa0..09ab1314 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
@@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertThrows;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.main.PolicyDistributionRuntimeException;
/**
@@ -33,49 +33,49 @@ import org.onap.policy.distribution.main.PolicyDistributionRuntimeException;
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestDistributionCommandLineArguments {
+class TestDistributionCommandLineArguments {
@Test
- public void testDistributionOnlyFileName() {
+ void testDistributionOnlyFileName() {
String[] testArgs = {"src/test/resources/parameters/DistributionConfigParameters.json"};
assertThrows(PolicyDistributionRuntimeException.class, () -> new DistributionCommandLineArguments(testArgs));
}
@Test
- public void testDistributionCommandLineArgumentsException() {
+ void testDistributionCommandLineArgumentsException() {
String[] wrongParams = {"arg1", "nothing", "{\"someJson\":1}"};
assertThrows(PolicyDistributionRuntimeException.class, () -> new DistributionCommandLineArguments(wrongParams));
}
@Test
- public void testValidateFileNameEmpty() {
+ void testValidateFileNameEmpty() {
String[] argsOnlyKeyNoValue = {"-c", ""};
assertValidate(argsOnlyKeyNoValue, "policy-distribution configuration file was not specified as an argument");
}
@Test
- public void testValidateFileNameDoesNotExist() {
+ void testValidateFileNameDoesNotExist() {
String[] fileNameNotExistentArgs = {"-c", "someFileName.json"};
assertValidate(fileNameNotExistentArgs,
"policy-distribution configuration file \"someFileName.json\" does not exist");
}
@Test
- public void testValidateFileNameIsNotFile() {
+ void testValidateFileNameIsNotFile() {
String[] folderAsFileNameArgs = {"-c", "src/test/resources/parameters"};
assertValidate(folderAsFileNameArgs,
"policy-distribution configuration file \"src/test/resources/parameters\" is not a normal file");
}
@Test
- public void testDistributionVersion() {
+ void testDistributionVersion() {
String[] testArgs = {"-v"};
- DistributionCommandLineArguments sutArgs = new DistributionCommandLineArguments(testArgs);
+ var sutArgs = new DistributionCommandLineArguments(testArgs);
assertThat(sutArgs.version()).startsWith("ONAP Policy Framework Distribution Service");
}
private void assertValidate(String[] testArgs, String expectedErrorMsg) {
- DistributionCommandLineArguments sutArgs = new DistributionCommandLineArguments(testArgs);
- assertThatThrownBy(() -> sutArgs.validate()).hasMessage(expectedErrorMsg);
+ var sutArgs = new DistributionCommandLineArguments(testArgs);
+ assertThatThrownBy(sutArgs::validate).hasMessage(expectedErrorMsg);
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
index bdb2ba7d..831b337b 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
@@ -25,12 +25,12 @@ package org.onap.policy.distribution.main.startstop;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.IOException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.resources.MessageConstants;
import org.onap.policy.distribution.main.PolicyDistributionException;
@@ -42,25 +42,25 @@ import org.onap.policy.distribution.main.parameters.CommonTestData;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestMain {
+class TestMain {
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testMain() throws PolicyDistributionException, IOException {
+ void testMain() throws PolicyDistributionException, IOException {
CommonTestData.makeConfigFile("parameters/DistributionConfigParameters.json");
final String[] distributionConfigParameters = { "-c", CommonTestData.CONFIG_FILE };
- final Main main = new Main(distributionConfigParameters);
+ final var main = new Main(distributionConfigParameters);
assertTrue(main.getDistributionParameterGroup().isValid());
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, main.getDistributionParameterGroup().getName());
main.shutdown();
}
@Test
- public void testMain_NoArguments() {
+ void testMain_NoArguments() {
final String[] distributionConfigParameters = {};
assertThatThrownBy(() -> new Main(distributionConfigParameters))
.isInstanceOf(PolicyDistributionRuntimeException.class)
@@ -68,7 +68,7 @@ public class TestMain {
}
@Test
- public void testMain_InvalidArguments() {
+ void testMain_InvalidArguments() {
final String[] distributionConfigParameters = {"parameters/DistributionConfigParameters.json"};
assertThatThrownBy(() -> new Main(distributionConfigParameters))
.isInstanceOf(PolicyDistributionRuntimeException.class)
@@ -76,7 +76,7 @@ public class TestMain {
}
@Test
- public void testMain_Help() {
+ void testMain_Help() {
assertThatCode(() -> {
final String[] distributionConfigParameters =
{ "-h" };
@@ -85,7 +85,7 @@ public class TestMain {
}
@Test
- public void testMain_InvalidParameters() {
+ void testMain_InvalidParameters() {
final String[] distributionConfigParameters =
{"-c", "parameters/DistributionConfigParameters_InvalidName.json"};
assertThatThrownBy(() -> new Main(distributionConfigParameters))
diff --git a/model/pom.xml b/model/pom.xml
index a9635de8..3a7f0c64 100644
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -18,12 +18,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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-model</artifactId>
diff --git a/model/src/test/java/org/onap/policy/distribution/model/TestModels.java b/model/src/test/java/org/onap/policy/distribution/model/TestModels.java
index e5733022..3aea3efe 100644
--- a/model/src/test/java/org/onap/policy/distribution/model/TestModels.java
+++ b/model/src/test/java/org/onap/policy/distribution/model/TestModels.java
@@ -21,22 +21,21 @@
package org.onap.policy.distribution.model;
import com.openpojo.reflection.filters.FilterPackageInfo;
-import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Class to perform unit testing of all policy models.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestModels {
+class TestModels {
@Test
- public void testAllModels() {
- final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build();
+ void testAllModels() {
+ final var validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build();
validator.validate(PolicyInput.class.getPackage().getName(), new FilterPackageInfo());
}
}
diff --git a/packages/policy-distribution-docker/pom.xml b/packages/policy-distribution-docker/pom.xml
index 0ebabfcd..55594550 100644
--- a/packages/policy-distribution-docker/pom.xml
+++ b/packages/policy-distribution-docker/pom.xml
@@ -22,14 +22,14 @@
-->
<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">
+ 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-packages</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
@@ -99,10 +99,12 @@
<dependencySets>
<dependencySet>
<includes>
- <include>org.onap.policy.distribution:policy-distribution-tarball</include>
+ <include>org.onap.policy.distribution:policy-distribution-tarball
+ </include>
</includes>
<outputDirectory>/lib</outputDirectory>
- <outputFileNameMapping>policy-distribution.tar.gz</outputFileNameMapping>
+ <outputFileNameMapping>policy-distribution.tar.gz
+ </outputFileNameMapping>
</dependencySet>
</dependencySets>
</inline>
diff --git a/packages/policy-distribution-docker/src/main/docker/Dockerfile b/packages/policy-distribution-docker/src/main/docker/Dockerfile
index 1d04c199..f6ba62eb 100644
--- a/packages/policy-distribution-docker/src/main/docker/Dockerfile
+++ b/packages/policy-distribution-docker/src/main/docker/Dockerfile
@@ -25,7 +25,7 @@ RUN mkdir /packages /extracted
COPY /maven/lib/policy-distribution.tar.gz /packages/
RUN tar xvzf /packages/policy-distribution.tar.gz --directory /extracted/
-FROM onap/policy-jre-alpine:3.0.0-SNAPSHOT
+FROM onap/policy-jre-alpine:3.0.1-SNAPSHOT
LABEL maintainer="Policy Team"
LABEL org.opencontainers.image.title="Policy SDC Service Distribution"
diff --git a/packages/policy-distribution-tarball/pom.xml b/packages/policy-distribution-tarball/pom.xml
index c5028a0c..9659e693 100644
--- a/packages/policy-distribution-tarball/pom.xml
+++ b/packages/policy-distribution-tarball/pom.xml
@@ -20,12 +20,12 @@
-->
<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">
+ 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-packages</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>policy-distribution-tarball</artifactId>
diff --git a/packages/pom.xml b/packages/pom.xml
index 79e4bcc4..24a79326 100644
--- a/packages/pom.xml
+++ b/packages/pom.xml
@@ -21,12 +21,13 @@
============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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-packages</artifactId>
@@ -34,7 +35,7 @@
<name>${project.artifactId}</name>
<properties>
- <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+ <!-- There is no code in this submodule, only holds interfaces. So skip sonar. -->
<sonar.skip>true</sonar.skip>
</properties>
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;
diff --git a/plugins/pom.xml b/plugins/pom.xml
index e48c5c2b..34f797d4 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -18,18 +18,20 @@
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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-plugins</artifactId>
<name>${project.artifactId}</name>
- <description>The module of Policy Distribution that holds plugins for custom policy reception and forwarding.</description>
+ <description>The module of Policy Distribution that holds plugins for custom policy reception and forwarding.
+ </description>
<packaging>pom</packaging>
<properties>
diff --git a/plugins/reception-plugins/pom.xml b/plugins/reception-plugins/pom.xml
index acb5d30c..09a6d259 100644
--- a/plugins/reception-plugins/pom.xml
+++ b/plugins/reception-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>reception-plugins</artifactId>
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java
index ea844e4e..201133f2 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java
@@ -21,9 +21,9 @@
package org.onap.policy.distribution.reception.decoding.policy.file;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
@@ -32,11 +32,11 @@ import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
*
* @author Sirisha Manchikanti (sirisha.manchikanti@est.tech)
*/
-public class AutomationCompositionDecoderFileInCsarParameterGroupTest {
+class AutomationCompositionDecoderFileInCsarParameterGroupTest {
@Test
- public void testValidParameters() {
- final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData
+ void testValidParameters() {
+ final var configurationParameters = CommonTestData
.getPolicyDecoderParameters(
"src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json",
AutomationCompositionDecoderFileInCsarParameterGroup.class);
@@ -48,8 +48,8 @@ public class AutomationCompositionDecoderFileInCsarParameterGroupTest {
}
@Test
- public void testInvalidParameters() {
- final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters =
+ void testInvalidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyDecoderParameters(
"src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParametersInvalid.json",
AutomationCompositionDecoderFileInCsarParameterGroup.class);
@@ -58,8 +58,8 @@ public class AutomationCompositionDecoderFileInCsarParameterGroupTest {
}
@Test
- public void testEmptyParameters() {
- final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters =
+ void testEmptyParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
AutomationCompositionDecoderFileInCsarParameterGroup.class);
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java
index ac8a75df..eca893dc 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java
@@ -22,36 +22,31 @@
package org.onap.policy.distribution.reception.decoding.policy.file;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.File;
-import java.util.Collection;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
+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.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to perform unit test of {@link AutomationCompositionDecoderFileInCsar}.
*
* @author Sirisha Manchikanti (sirisha.manchikanti@est.tech)
*/
-@RunWith(MockitoJUnitRunner.class)
-public class AutomationCompositionDecoderFileInCsarTest {
+class AutomationCompositionDecoderFileInCsarTest {
/**
* Set up.
*/
- @BeforeClass
- public static void setUp() {
- final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData
+ @BeforeAll
+ static void setUp() {
+ final var configurationParameters = CommonTestData
.getPolicyDecoderParameters(
"src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json",
AutomationCompositionDecoderFileInCsarParameterGroup.class);
@@ -62,33 +57,33 @@ public class AutomationCompositionDecoderFileInCsarTest {
/**
* Tear down.
*/
- @AfterClass
- public static void tearDown() {
+ @AfterAll
+ static void tearDown() {
ParameterService.deregister(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName());
}
@Test
- public void testDecodeAutomationComposition() throws PolicyDecodingException {
+ void testDecodeAutomationComposition() throws PolicyDecodingException {
- final AutomationCompositionDecoderFileInCsar decoder = new AutomationCompositionDecoderFileInCsar();
+ final var decoder = new AutomationCompositionDecoderFileInCsar();
decoder.configure(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName());
- final File file = new File("src/test/resources/service-Sampleservice-acm.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("src/test/resources/service-Sampleservice-acm.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
- final Collection<ToscaEntity> automationCompositionHolders = decoder.decode(csar);
+ final var automationCompositionHolders = decoder.decode(csar);
assertEquals(1, automationCompositionHolders.size());
}
@Test
- public void testDecodeAutomationCompositionZipError() {
+ void testDecodeAutomationCompositionZipError() {
- final AutomationCompositionDecoderFileInCsar decoder = new AutomationCompositionDecoderFileInCsar();
+ final var decoder = new AutomationCompositionDecoderFileInCsar();
decoder.configure(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName());
- final File file = new File("unknown.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("unknown.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
assertThatThrownBy(() -> decoder.decode(csar)).isInstanceOf(PolicyDecodingException.class)
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
index c3cf3f5b..0164fe57 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
@@ -21,9 +21,9 @@
package org.onap.policy.distribution.reception.decoding.policy.file;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
@@ -32,11 +32,11 @@ import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class PolicyDecoderFileInCsarToPolicyParameterGroupTest {
+class PolicyDecoderFileInCsarToPolicyParameterGroupTest {
@Test
- public void testValidParameters() {
- final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters = CommonTestData
+ void testValidParameters() {
+ final var configurationParameters = CommonTestData
.getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json",
PolicyDecoderFileInCsarToPolicyParameterGroup.class);
@@ -48,8 +48,8 @@ public class PolicyDecoderFileInCsarToPolicyParameterGroupTest {
}
@Test
- public void testInvalidParameters() {
- final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
+ void testInvalidParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyDecoderParameters(
"src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json",
PolicyDecoderFileInCsarToPolicyParameterGroup.class);
@@ -58,8 +58,8 @@ public class PolicyDecoderFileInCsarToPolicyParameterGroupTest {
}
@Test
- public void testEmptyParameters() {
- final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
+ void testEmptyParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
PolicyDecoderFileInCsarToPolicyParameterGroup.class);
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
index 45dd167c..88b4c863 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
@@ -22,35 +22,30 @@
package org.onap.policy.distribution.reception.decoding.policy.file;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.File;
-import java.util.Collection;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
+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.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to perform unit test of {@link PolicyDecoderFileInCsarToPolicy}.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-@RunWith(MockitoJUnitRunner.class)
-public class PolicyDecoderFileInCsarToPolicyTest {
+class PolicyDecoderFileInCsarToPolicyTest {
/**
* Set up.
*/
- @BeforeClass
- public static void setUp() {
+ @BeforeAll
+ static void setUp() {
final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters = CommonTestData
.getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json",
PolicyDecoderFileInCsarToPolicyParameterGroup.class);
@@ -61,47 +56,47 @@ public class PolicyDecoderFileInCsarToPolicyTest {
/**
* Tear down.
*/
- @AfterClass
- public static void tearDown() {
+ @AfterAll
+ static void tearDown() {
ParameterService.deregister(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
}
@Test
- public void testDecodePolicy() throws PolicyDecodingException {
+ void testDecodePolicy() throws PolicyDecodingException {
- final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
+ final var decoder = new PolicyDecoderFileInCsarToPolicy();
decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
- final File file = new File("src/test/resources/service-Sampleservice.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("src/test/resources/service-Sampleservice.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
- final Collection<ToscaEntity> policyHolders = decoder.decode(csar);
+ final var policyHolders = decoder.decode(csar);
assertEquals(2, policyHolders.size());
}
@Test
- public void testDecodeYamlPolicy() throws PolicyDecodingException {
+ void testDecodeYamlPolicy() throws PolicyDecodingException {
- final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
+ final var decoder = new PolicyDecoderFileInCsarToPolicy();
decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
- final File file = new File("src/test/resources/service-Sampleservice-yaml.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("src/test/resources/service-Sampleservice-yaml.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
- final Collection<ToscaEntity> policyHolders = decoder.decode(csar);
+ final var policyHolders = decoder.decode(csar);
assertEquals(2, policyHolders.size());
}
@Test
- public void testDecodePolicyZipError() {
+ void testDecodePolicyZipError() {
- final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
+ final var decoder = new PolicyDecoderFileInCsarToPolicy();
decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
- final File file = new File("unknown.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("unknown.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
assertThatThrownBy(() -> decoder.decode(csar)).isInstanceOf(PolicyDecodingException.class)
@@ -110,13 +105,13 @@ public class PolicyDecoderFileInCsarToPolicyTest {
@Test
- public void testDecodePolicyCoderError() {
+ void testDecodePolicyCoderError() {
- final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
+ final var decoder = new PolicyDecoderFileInCsarToPolicy();
decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
- final File file = new File("src/test/resources/service-Sampleservice-test.csar");
- final Csar csar = new Csar(file.getAbsolutePath());
+ final var file = new File("src/test/resources/service-Sampleservice-test.csar");
+ final var csar = new Csar(file.getAbsolutePath());
assertTrue(decoder.canHandle(csar));
assertThatThrownBy(() -> decoder.decode(csar)).isInstanceOf(PolicyDecodingException.class)
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
index 7308018d..c36cd363 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
@@ -22,8 +22,9 @@
package org.onap.policy.distribution.reception.handling.file;
import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
-import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
import java.io.FileReader;
@@ -31,14 +32,11 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.reception.statistics.DistributionStatisticsManager;
@@ -48,13 +46,12 @@ import org.slf4j.LoggerFactory;
/**
* Class to perform unit test of {@link FileSystemReceptionHandler}.
*/
-@RunWith(MockitoJUnitRunner.class)
-public class TestFileSystemReceptionHandler {
+class TestFileSystemReceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(TestFileSystemReceptionHandler.class);
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
+ @TempDir
+ public File tempFolder;
private FileSystemReceptionHandlerConfigurationParameterGroup pssdConfigParameters;
private FileSystemReceptionHandler fileSystemHandler;
@@ -67,25 +64,25 @@ public class TestFileSystemReceptionHandler {
* @throws SecurityException if it occurs
* @throws IllegalArgumentException if it occurs
*/
- @Before
- public final void init() throws IOException, SecurityException, IllegalArgumentException {
+ @BeforeEach
+ final void init() throws IOException, SecurityException, IllegalArgumentException {
DistributionStatisticsManager.resetAllStatistics();
- final Gson gson = new GsonBuilder().create();
+ final var gson = new GsonBuilder().create();
pssdConfigParameters = gson.fromJson(new FileReader("src/test/resources/handling-filesystem.json"),
FileSystemReceptionHandlerConfigurationParameterGroup.class);
ParameterService.register(pssdConfigParameters);
fileSystemHandler = new FileSystemReceptionHandler();
}
- @After
- public void teardown() {
+ @AfterEach
+ void teardown() {
ParameterService.deregister(pssdConfigParameters);
}
@Test
- public final void testInit() throws IOException {
- FileSystemReceptionHandler sypHandler = Mockito.spy(fileSystemHandler);
+ final void testInit() throws IOException {
+ var sypHandler = spy(fileSystemHandler);
Mockito.doNothing().when(sypHandler).initFileWatcher(Mockito.isA(String.class),
Mockito.anyInt());
assertThatCode(() -> sypHandler.initializeReception(pssdConfigParameters.getName()))
@@ -93,8 +90,8 @@ public class TestFileSystemReceptionHandler {
}
@Test
- public final void testDestroy() throws IOException {
- final FileSystemReceptionHandler sypHandler = Mockito.spy(fileSystemHandler);
+ final void testDestroy() throws IOException {
+ final var sypHandler = spy(fileSystemHandler);
Mockito.doNothing().when(sypHandler).initFileWatcher(Mockito.isA(String.class),
Mockito.anyInt());
assertThatCode(() -> {
@@ -104,17 +101,17 @@ public class TestFileSystemReceptionHandler {
}
@Test
- public void testMain() throws IOException {
- final Object lock = new Object();
- final String watchPath = tempFolder.getRoot().getAbsolutePath();
+ void testMain() throws IOException {
+ final var lock = new Object();
+ final var watchPath = tempFolder.getAbsolutePath();
class Processed {
public boolean processed = false;
}
- final Processed cond = new Processed();
+ final var cond = new Processed();
- final FileSystemReceptionHandler sypHandler = Mockito.spy(fileSystemHandler);
+ final var sypHandler = Mockito.spy(fileSystemHandler);
Mockito.doAnswer((Answer<Object>) invocation -> {
synchronized (lock) {
cond.processed = true;
@@ -123,7 +120,7 @@ public class TestFileSystemReceptionHandler {
return null;
}).when(sypHandler).createPolicyInputAndCallHandler(Mockito.isA(String.class));
- final Thread th = new Thread(() -> {
+ final var th = new Thread(() -> {
try {
sypHandler.initFileWatcher(watchPath, 2);
} catch (final IOException ex) {
@@ -134,7 +131,7 @@ public class TestFileSystemReceptionHandler {
th.start();
try {
// wait until internal watch service started or counter reached
- final AtomicInteger counter = new AtomicInteger();
+ final var counter = new AtomicInteger();
counter.set(0);
synchronized (lock) {
while (!sypHandler.isRunning() && counter.getAndIncrement() < 10) {
@@ -156,8 +153,7 @@ public class TestFileSystemReceptionHandler {
} catch (final InterruptedException ex) {
LOGGER.error("testMain failed", ex);
}
- Mockito.verify(sypHandler, Mockito.times(1)).createPolicyInputAndCallHandler(Mockito.isA(String.class));
+ verify(sypHandler, Mockito.times(1)).createPolicyInputAndCallHandler(Mockito.isA(String.class));
}
}
-
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
index c8bcc7bd..46d7f27e 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
@@ -24,64 +24,58 @@
package org.onap.policy.distribution.reception.handling.file;
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 com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.onap.policy.common.parameters.ValidationResult;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
/**
* Class to perform unit test of {@link FileSystemReceptionHandlerConfigurationParameterGroup}.
*
*/
-public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
+class TestFileSystemReceptionHandlerConfigurationParameterGroup {
- @Test
- public void testFileSystemConfiguration() throws IOException {
- FileSystemReceptionHandlerConfigurationParameterGroup configParameters = null;
- String validPath = null;
+ @TempDir
+ private File tempFolder;
- validPath = tempFolder.getRoot().getAbsolutePath();
+ @Test
+ void testFileSystemConfiguration() throws IOException {
+ String validPath = tempFolder.getPath();
- configParameters = new FileSystemReceptionHandlerConfigurationParameterGroup();
+ var configParameters = new FileSystemReceptionHandlerConfigurationParameterGroup();
configParameters.setWatchPath(validPath);
configParameters.setMaxThread(2);
- final ValidationResult validationResult = configParameters.validate();
+ final var validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(validPath, configParameters.getWatchPath());
assertEquals(2, configParameters.getMaxThread());
}
@Test
- public void testInvalidFileSystemConfiguration() throws IOException {
- FileSystemReceptionHandlerConfigurationParameterGroup configParameters = null;
- final Gson gson = new GsonBuilder().create();
- configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
+ void testInvalidFileSystemConfiguration() throws IOException {
+ final var gson = new GsonBuilder().create();
+ var configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
FileSystemReceptionHandlerConfigurationParameterGroup.class);
- final ValidationResult validationResult = configParameters.validate();
+ final var validationResult = configParameters.validate();
assertFalse(validationResult.isValid());
}
@Test
- public void testFileSystemReceptionHandlerConfigurationParameterBuilderWithInvalidPath() throws IOException {
- final String invalidPath = tempFolder.newFile("foobar").getAbsolutePath();
+ void testFileSystemReceptionHandlerConfigurationParameterBuilderWithInvalidPath() throws IOException {
+ final var invalidPath = new File(tempFolder, "foobar").getAbsolutePath();
- final FileSystemReceptionHandlerConfigurationParameterGroup configParameters =
- new FileSystemReceptionHandlerConfigurationParameterGroup();
+ final var configParameters = new FileSystemReceptionHandlerConfigurationParameterGroup();
configParameters.setWatchPath(invalidPath);
- final ValidationResult validateResult = configParameters.validate();
+ final var validateResult = configParameters.validate();
assertFalse(validateResult.isValid());
assertThat(validateResult.getResult()).contains("is not a valid directory");
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestComponentDoneStatusMessage.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestComponentDoneStatusMessage.java
index c5935822..d3f7ee00 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestComponentDoneStatusMessage.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestComponentDoneStatusMessage.java
@@ -21,20 +21,20 @@
package org.onap.policy.distribution.reception.handling.sdc;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.utils.DistributionStatusEnum;
-public class TestComponentDoneStatusMessage {
+class TestComponentDoneStatusMessage {
private static final String CONSUMER_ID = "dummyId";
private static final String DISTRIBUTION_ID = "dummyDistribution";
@Test
- public void testComponentDoneStatusMessage_Success() {
- final long timestamp = System.currentTimeMillis();
- final ComponentDoneStatusMessage message = ComponentDoneStatusMessage.builder().consumerId(CONSUMER_ID)
+ void testComponentDoneStatusMessage_Success() {
+ final var timestamp = System.currentTimeMillis();
+ final var message = ComponentDoneStatusMessage.builder().consumerId(CONSUMER_ID)
.distributionId(DISTRIBUTION_ID).distributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK)
.timestamp(timestamp).build();
assertEquals("POLICY", message.getComponentName());
@@ -45,9 +45,9 @@ public class TestComponentDoneStatusMessage {
}
@Test
- public void testComponentDoneStatusMessage_Failure() {
- final long timestamp = System.currentTimeMillis();
- final ComponentDoneStatusMessage message = ComponentDoneStatusMessage.builder().consumerId(CONSUMER_ID)
+ void testComponentDoneStatusMessage_Failure() {
+ final var timestamp = System.currentTimeMillis();
+ final var message = ComponentDoneStatusMessage.builder().consumerId(CONSUMER_ID)
.distributionId(DISTRIBUTION_ID).distributionStatus(DistributionStatusEnum.COMPONENT_DONE_ERROR)
.timestamp(timestamp).build();
assertEquals("POLICY", message.getComponentName());
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestDistributionStatusMessage.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestDistributionStatusMessage.java
index 62cf0f3d..86d4bdeb 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestDistributionStatusMessage.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestDistributionStatusMessage.java
@@ -21,22 +21,22 @@
package org.onap.policy.distribution.reception.handling.sdc;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.utils.DistributionStatusEnum;
-public class TestDistributionStatusMessage {
+class TestDistributionStatusMessage {
private static final String ARTIFACT_URL = "http://dummyurl";
private static final String CONSUMER_ID = "dummyId";
private static final String DISTRIBUTION_ID = "dummyDistribution";
@Test
- public void testDistributionStatusMessage_Download() {
- final long timestamp = System.currentTimeMillis();
+ void testDistributionStatusMessage_Download() {
+ final var timestamp = System.currentTimeMillis();
- final DistributionStatusMessage message = DistributionStatusMessage.builder().artifactUrl(ARTIFACT_URL)
+ final var message = DistributionStatusMessage.builder().artifactUrl(ARTIFACT_URL)
.consumerId(CONSUMER_ID).distributionId(DISTRIBUTION_ID)
.distributionStatus(DistributionStatusEnum.DOWNLOAD_OK).timestamp(timestamp).build();
assertEquals(ARTIFACT_URL, message.getArtifactURL());
@@ -47,10 +47,10 @@ public class TestDistributionStatusMessage {
}
@Test
- public void testDistributionStatusMessage_Deploy() {
- final long timestamp = System.currentTimeMillis();
+ void testDistributionStatusMessage_Deploy() {
+ final var timestamp = System.currentTimeMillis();
- final DistributionStatusMessage message = DistributionStatusMessage.builder().artifactUrl(ARTIFACT_URL)
+ final var message = DistributionStatusMessage.builder().artifactUrl(ARTIFACT_URL)
.consumerId(CONSUMER_ID).distributionId(DISTRIBUTION_ID)
.distributionStatus(DistributionStatusEnum.DEPLOY_OK).timestamp(timestamp).build();
assertEquals(ARTIFACT_URL, message.getArtifactURL());
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
index 3e8f4a63..9a993c6c 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
@@ -23,28 +23,25 @@
package org.onap.policy.distribution.reception.handling.sdc;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
-import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.FileReader;
import java.io.IOException;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -68,23 +65,17 @@ import org.onap.sdc.utils.DistributionActionResultEnum;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-@RunWith(MockitoJUnitRunner.class)
-public class TestSdcReceptionHandler {
+class TestSdcReceptionHandler {
private static final String DUMMY_SERVICE_CSAR = "dummyService.csar";
- @Mock
- private IDistributionClientResult successfulClientInitResult;
- @Mock
- private IDistributionClientResult failureClientInitResult;
- @Mock
- private IDistributionClient distributionClient;
- @Mock
- private IDistributionClientDownloadResult successfulClientDownloadResult;
- @Mock
- private INotificationData notificationData;
- @Mock
- private IArtifactInfo artifactInfo;
+ private final IDistributionClientResult successfulClientInitResult = mock(IDistributionClientResult.class);
+ private final IDistributionClientResult failureClientInitResult = mock(IDistributionClientResult.class);
+ private final IDistributionClient distributionClient = mock(IDistributionClient.class);
+ private final IDistributionClientDownloadResult successfulClientDownloadResult
+ = mock(IDistributionClientDownloadResult.class);
+ private final INotificationData notificationData = mock(INotificationData.class);
+ private final IArtifactInfo artifactInfo = mock(IArtifactInfo.class);
private SdcReceptionHandlerConfigurationParameterGroup pssdConfigParameters;
private SdcReceptionHandler sypHandler;
@@ -97,70 +88,70 @@ public class TestSdcReceptionHandler {
* @throws SecurityException if it occurs
* @throws IllegalArgumentException if it occurs
*/
- @Before
- public final void init() throws IOException, SecurityException, IllegalArgumentException {
+ @BeforeEach
+ final void init() throws IOException, SecurityException, IllegalArgumentException {
DistributionStatisticsManager.resetAllStatistics();
- final Gson gson = new GsonBuilder().create();
+ final var gson = new GsonBuilder().create();
pssdConfigParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
ParameterService.register(pssdConfigParameters);
- final SdcReceptionHandler sdcHandler = new SdcReceptionHandler();
- sypHandler = Mockito.spy(sdcHandler);
-
- Mockito.when(sypHandler.createSdcDistributionClient()).thenReturn(distributionClient);
- Mockito.when(distributionClient.init(any(), any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.stop()).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendComponentDoneStatus(any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendComponentDoneStatus(any(), any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendDownloadStatus(any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendDownloadStatus(any(), any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendDeploymentStatus(any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.sendDeploymentStatus(any(), any())).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.download(any())).thenReturn(successfulClientDownloadResult);
- Mockito.when(notificationData.getServiceArtifacts()).thenReturn(List.of(artifactInfo));
- Mockito.when(artifactInfo.getArtifactName()).thenReturn(DUMMY_SERVICE_CSAR);
- Mockito.when(successfulClientDownloadResult.getArtifactPayload()).thenReturn(new byte[1]);
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
+ final var sdcHandler = new SdcReceptionHandler();
+ sypHandler = spy(sdcHandler);
+
+ when(sypHandler.createSdcDistributionClient()).thenReturn(distributionClient);
+ when(distributionClient.init(any(), any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.start()).thenReturn(successfulClientInitResult);
+ when(distributionClient.stop()).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendComponentDoneStatus(any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendComponentDoneStatus(any(), any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendDownloadStatus(any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendDownloadStatus(any(), any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendDeploymentStatus(any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.sendDeploymentStatus(any(), any())).thenReturn(successfulClientInitResult);
+ when(distributionClient.download(any())).thenReturn(successfulClientDownloadResult);
+ when(notificationData.getServiceArtifacts()).thenReturn(List.of(artifactInfo));
+ when(artifactInfo.getArtifactName()).thenReturn(DUMMY_SERVICE_CSAR);
+ when(successfulClientDownloadResult.getArtifactPayload()).thenReturn(new byte[1]);
+ when(successfulClientInitResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(successfulClientDownloadResult.getDistributionActionResult())
+ when(successfulClientDownloadResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(failureClientInitResult.getDistributionActionResult())
+ when(failureClientInitResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL);
}
- @After
- public void teardown() {
+ @AfterEach
+ void teardown() {
ParameterService.deregister(pssdConfigParameters);
}
@Test
- public final void testInitializeSdcClient() {
+ final void testInitializeSdcClient() {
assertThatCode(() -> sypHandler.initializeReception(pssdConfigParameters.getName()))
.doesNotThrowAnyException();
}
@Test
- public final void testInitializeSdcClient_Failure() {
+ final void testInitializeSdcClient_Failure() {
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
+ when(successfulClientInitResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL).thenReturn(DistributionActionResultEnum.SUCCESS);
assertThatCode(() -> sypHandler.initializeReception(pssdConfigParameters.getName()))
.doesNotThrowAnyException();
}
@Test
- public final void testStartSdcClient_Failure() {
+ final void testStartSdcClient_Failure() {
assertThatCode(() -> {
- Mockito.when(distributionClient.start()).thenReturn(failureClientInitResult)
+ when(distributionClient.start()).thenReturn(failureClientInitResult)
.thenReturn(successfulClientInitResult);
sypHandler.initializeReception(pssdConfigParameters.getName());
}).doesNotThrowAnyException();
}
@Test
- public final void testStopSdcClient() {
+ final void testStopSdcClient() {
assertThatCode(() -> {
sypHandler.initializeReception(pssdConfigParameters.getName());
sypHandler.destroy();
@@ -168,27 +159,27 @@ public class TestSdcReceptionHandler {
}
@Test
- public final void testStopSdcClient_Failure() {
+ final void testStopSdcClient_Failure() {
sypHandler.initializeReception(pssdConfigParameters.getName());
- Mockito.when(distributionClient.stop()).thenReturn(failureClientInitResult)
+ when(distributionClient.stop()).thenReturn(failureClientInitResult)
.thenReturn(successfulClientInitResult);
assertThatCode(() -> sypHandler.destroy()).doesNotThrowAnyException();
}
@Test
- public final void testStopSdcClientWithoutStart() {
+ final void testStopSdcClientWithoutStart() {
assertThatCode(() -> sypHandler.destroy()).doesNotThrowAnyException();
}
@Test
- public void testNotificationCallBack() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
+ void testNotificationCallBack() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
IllegalAccessException, PluginInitializationException {
- final DummyDecoder policyDecoder = new DummyDecoder();
+ final var policyDecoder = new DummyDecoder();
final Collection<PolicyDecoder<Csar, DummyPolicy>> policyDecoders = new ArrayList<>();
policyDecoders.add(policyDecoder);
- final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
+ final var policyForwarder = new DummyPolicyForwarder();
final Collection<PolicyForwarder> policyForwarders = new ArrayList<>();
policyForwarders.add(policyForwarder);
@@ -208,17 +199,17 @@ public class TestSdcReceptionHandler {
}
@Test
- public void testDownloadArtifactFailure() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
+ void testDownloadArtifactFailure() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
IllegalAccessException, PluginInitializationException {
- Mockito.when(successfulClientDownloadResult.getDistributionActionResult())
+ when(successfulClientDownloadResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL);
- final DummyDecoder policyDecoder = new DummyDecoder();
+ final var policyDecoder = new DummyDecoder();
final Collection<PolicyDecoder<Csar, DummyPolicy>> policyDecoders = new ArrayList<>();
policyDecoders.add(policyDecoder);
- final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
+ final var policyForwarder = new DummyPolicyForwarder();
final Collection<PolicyForwarder> policyForwarders = new ArrayList<>();
policyForwarders.add(policyForwarder);
@@ -237,20 +228,20 @@ public class TestSdcReceptionHandler {
}
@Test
- public void testSendDistributionStatusFailure() throws NoSuchFieldException, SecurityException,
+ void testSendDistributionStatusFailure() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException, PluginInitializationException {
- Mockito.when(successfulClientDownloadResult.getDistributionActionResult())
+ when(successfulClientDownloadResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL);
- Mockito.when(distributionClient.sendDownloadStatus(any(), any())).thenReturn(failureClientInitResult);
- Mockito.when(distributionClient.sendDeploymentStatus(any(), any())).thenReturn(failureClientInitResult);
- Mockito.when(distributionClient.sendComponentDoneStatus(any(), any())).thenReturn(failureClientInitResult);
+ when(distributionClient.sendDownloadStatus(any(), any())).thenReturn(failureClientInitResult);
+ when(distributionClient.sendDeploymentStatus(any(), any())).thenReturn(failureClientInitResult);
+ when(distributionClient.sendComponentDoneStatus(any(), any())).thenReturn(failureClientInitResult);
- final DummyDecoder policyDecoder = new DummyDecoder();
+ final var policyDecoder = new DummyDecoder();
final Collection<PolicyDecoder<Csar, DummyPolicy>> policyDecoders = new ArrayList<>();
policyDecoders.add(policyDecoder);
- final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
+ final var policyForwarder = new DummyPolicyForwarder();
final Collection<PolicyForwarder> policyForwarders = new ArrayList<>();
policyForwarders.add(policyForwarder);
@@ -267,34 +258,34 @@ public class TestSdcReceptionHandler {
final Collection<PolicyForwarder> forwarders)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException,
PluginInitializationException {
- final PluginHandlerParameters pluginParameters = getPluginHandlerParameters();
+ final var pluginParameters = getPluginHandlerParameters();
pluginParameters.setName("DummyDistributionGroup");
ParameterService.register(pluginParameters);
- final PluginHandler pluginHandler = new PluginHandler(pluginParameters.getName());
+ final var pluginHandler = new PluginHandler(pluginParameters.getName());
- final Field decodersField = pluginHandler.getClass().getDeclaredField("policyDecoders");
+ final var decodersField = pluginHandler.getClass().getDeclaredField("policyDecoders");
decodersField.setAccessible(true);
decodersField.set(pluginHandler, decoders);
- final Field forwardersField = pluginHandler.getClass().getDeclaredField("policyForwarders");
+ final var forwardersField = pluginHandler.getClass().getDeclaredField("policyForwarders");
forwardersField.setAccessible(true);
forwardersField.set(pluginHandler, forwarders);
- final Field pluginHandlerField = AbstractReceptionHandler.class.getDeclaredField("pluginHandler");
+ final var pluginHandlerField = AbstractReceptionHandler.class.getDeclaredField("pluginHandler");
pluginHandlerField.setAccessible(true);
pluginHandlerField.set(receptionHandler, pluginHandler);
ParameterService.deregister(pluginParameters.getName());
}
private PluginHandlerParameters getPluginHandlerParameters() {
- final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders();
- final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders();
+ final var policyDecoders = getPolicyDecoders();
+ final var policyForwarders = getPolicyForwarders();
return new PluginHandlerParameters(policyDecoders, policyForwarders);
}
private Map<String, PolicyDecoderParameters> getPolicyDecoders() {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters("DummyDecoder",
+ final var pDParameters = new PolicyDecoderParameters("DummyDecoder",
"org.onap.policy.distribution.reception.handling.sdc.DummyDecoder", "DummyDecoderConfiguration");
policyDecoders.put("DummyDecoderKey", pDParameters);
return policyDecoders;
@@ -302,7 +293,7 @@ public class TestSdcReceptionHandler {
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
- final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters("DummyForwarder",
+ final var pFParameters = new PolicyForwarderParameters("DummyForwarder",
"org.onap.policy.distribution.reception.handling.sdc.DummyPolicyForwarder", "DummyConfiguration");
policyForwarders.put("DummyForwarderKey", pFParameters);
return policyForwarders;
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
index 717f635d..0bf85681 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
@@ -22,35 +22,33 @@
package org.onap.policy.distribution.reception.handling.sdc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+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 com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationStatus;
/**
* Class to perform unit test of {@link SdcConfiguration}.
*
*/
-public class TestSdcReceptionHandlerConfigurationParameterGroup {
+class TestSdcReceptionHandlerConfigurationParameterGroup {
@Test
- public void testSdcConfiguration() throws IOException {
- SdcReceptionHandlerConfigurationParameterGroup configParameters = null;
- final Gson gson = new GsonBuilder().create();
- configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"),
+ void testSdcConfiguration() throws IOException {
+ final var gson = new GsonBuilder().create();
+ var configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
- final ValidationResult validationResult = configParameters.validate();
+ final var validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
- final SdcConfiguration config = new SdcConfiguration(configParameters);
+ final var config = new SdcConfiguration(configParameters);
assertEquals(Arrays.asList("TOSCA_CSAR", "HEAT"), config.getRelevantArtifactTypes());
assertEquals("localhost", config.getSdcAddress());
assertEquals("policy", config.getUser());
@@ -62,44 +60,41 @@ public class TestSdcReceptionHandlerConfigurationParameterGroup {
assertEquals("TEST", config.getEnvironmentName());
assertEquals("null", config.getKeyStorePath());
assertEquals("null", config.getKeyStorePassword());
- assertEquals(false, config.activateServerTLSAuth());
- assertEquals(true, config.isFilterInEmptyResources());
- assertEquals(false, config.isUseHttpsWithSDC());
+ assertFalse(config.activateServerTLSAuth());
+ assertTrue(config.isFilterInEmptyResources());
+ assertFalse(config.isUseHttpsWithSDC());
}
@Test
- public void testSdcConfigurationNullParameters() throws IOException {
- SdcReceptionHandlerConfigurationParameterGroup configParameters = null;
- final Gson gson = new GsonBuilder().create();
- configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc-null-parameters.json"),
+ void testSdcConfigurationNullParameters() throws IOException {
+ final var gson = new GsonBuilder().create();
+ var configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc-null-parameters.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
- final ValidationResult validationResult = configParameters.validate();
+ final var validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
- final SdcConfiguration config = new SdcConfiguration(configParameters);
- assertEquals(null, config.getKeyStorePath());
- assertEquals(null, config.getKeyStorePassword());
+ final var config = new SdcConfiguration(configParameters);
+ assertThat(config.getKeyStorePath()).isNull();
+ assertThat(config.getKeyStorePassword()).isNull();
//if boolean parameters are null they are set to false
- assertEquals(false, config.activateServerTLSAuth());
- assertEquals(false, config.isFilterInEmptyResources());
+ assertFalse(config.activateServerTLSAuth());
+ assertFalse(config.isFilterInEmptyResources());
}
@Test
- public void testInvalidSdcConfiguration() throws IOException {
- SdcReceptionHandlerConfigurationParameterGroup configParameters = null;
-
- final Gson gson = new GsonBuilder().create();
- configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
+ void testInvalidSdcConfiguration() throws IOException {
+ final var gson = new GsonBuilder().create();
+ var configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
- final ValidationResult validationResult = configParameters.validate();
+ final var validationResult = configParameters.validate();
assertFalse(validationResult.isValid());
}
@Test
- public void testEmptyParameters() {
- final SdcReceptionHandlerConfigurationParameterGroup configurationParameters =
+ void testEmptyParameters() {
+ final var configurationParameters =
CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
SdcReceptionHandlerConfigurationParameterGroup.class);
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/TestExceptions.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/TestExceptions.java
index 2b6c98dc..3d409575 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/TestExceptions.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/TestExceptions.java
@@ -20,13 +20,13 @@
package org.onap.policy.distribution.reception.handling.sdc.exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
-public class TestExceptions {
+class TestExceptions {
@Test
- public void test() {
+ void test() {
new ExceptionsTester().test(ArtifactDownloadException.class);
}
}
diff --git a/pom.xml b/pom.xml
index 6f7a2c33..84473721 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,19 +22,19 @@
-->
<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/maven-v4_0_0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.parent</groupId>
<artifactId>integration</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath />
+ <version>4.0.1-SNAPSHOT</version>
+ <relativePath/>
</parent>
<groupId>org.onap.policy.distribution</groupId>
<artifactId>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
@@ -45,8 +45,11 @@
<!-- Default Sonar configuration -->
<jacoco.dataFile>${project.basedir}/../target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
- <policy.common.version>2.0.0-SNAPSHOT</policy.common.version>
- <policy.models.version>3.0.0-SNAPSHOT</policy.models.version>
+ <policy.common.version>2.0.1-SNAPSHOT</policy.common.version>
+ <policy.models.version>3.0.1-SNAPSHOT</policy.models.version>
+ <surefireArgLine>
+ --add-opens java.base/java.lang=ALL-UNNAMED
+ </surefireArgLine>
</properties>
<modules>
@@ -61,8 +64,8 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -72,7 +75,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/reception/pom.xml b/reception/pom.xml
index 935e016f..994c9858 100644
--- a/reception/pom.xml
+++ b/reception/pom.xml
@@ -18,12 +18,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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>reception</artifactId>
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/decoding/TestExceptions.java b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/TestExceptions.java
index 2b52eb27..7b70bb5d 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/decoding/TestExceptions.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/TestExceptions.java
@@ -20,13 +20,13 @@
package org.onap.policy.distribution.reception.decoding;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
-public class TestExceptions {
+class TestExceptions {
@Test
- public void test() {
+ void test() {
new ExceptionsTester().test(PluginInitializationException.class);
new ExceptionsTester().test(PluginTerminationException.class);
new ExceptionsTester().test(PolicyDecodingException.class);
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
index 1dc4bfe0..cde5eb79 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
@@ -21,16 +21,16 @@
package org.onap.policy.distribution.reception.handling;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -47,7 +47,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class AbstractReceptionHandlerTest {
+class AbstractReceptionHandlerTest {
private static final String DISTRIBUTION_GROUP = "DummyDistributionGroup";
private static final String DECODER_TYPE = "DummyDecoder";
@@ -61,24 +61,24 @@ public class AbstractReceptionHandlerTest {
private static final String DECODER_CONFIGURATION_PARAMETERS = "DummyDecoderConfiguration";
@Test
- public void testInputReceived() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
+ void testInputReceived() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException, PluginInitializationException {
- final AbstractReceptionHandler handler = new DummyReceptionHandler();
+ final var handler = new DummyReceptionHandler();
- final ToscaEntity generatedPolicy1 = new DummyPolicy1();
- final ToscaEntity generatedPolicy2 = new DummyPolicy2();
+ final var generatedPolicy1 = new DummyPolicy1();
+ final var generatedPolicy2 = new DummyPolicy2();
- final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder1 =
+ final var policyDecoder1 =
new DummyDecoder(true, Collections.singletonList(generatedPolicy1));
- final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder2 =
+ final var policyDecoder2 =
new DummyDecoder(true, Collections.singletonList(generatedPolicy2));
final Collection<PolicyDecoder<PolicyInput, ToscaEntity>> policyDecoders = new ArrayList<>();
policyDecoders.add(policyDecoder1);
policyDecoders.add(policyDecoder2);
- final DummyPolicyForwarder policyForwarder1 = new DummyPolicyForwarder();
- final DummyPolicyForwarder policyForwarder2 = new DummyPolicyForwarder();
+ final var policyForwarder1 = new DummyPolicyForwarder();
+ final var policyForwarder2 = new DummyPolicyForwarder();
final Collection<PolicyForwarder> policyForwarders = new ArrayList<>();
policyForwarders.add(policyForwarder1);
@@ -96,27 +96,28 @@ public class AbstractReceptionHandlerTest {
assertTrue(policyForwarder2.receivedPolicy(generatedPolicy2));
}
- @Test(expected = PolicyDecodingException.class)
- public void testInputReceivedNoSupportingDecoder() throws PolicyDecodingException, NoSuchFieldException,
+ @Test
+ void testInputReceivedNoSupportingDecoder() throws NoSuchFieldException,
SecurityException, IllegalArgumentException, IllegalAccessException, PluginInitializationException {
- final AbstractReceptionHandler handler = new DummyReceptionHandler();
+ final var handler = new DummyReceptionHandler();
- final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder = new DummyDecoder(false, Collections.emptyList());
- final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
+ final var policyDecoder = new DummyDecoder(false, Collections.emptyList());
+ final var policyForwarder = new DummyPolicyForwarder();
setUpPlugins(handler, Collections.singleton(policyDecoder), Collections.singleton(policyForwarder));
-
- handler.inputReceived(new DummyPolicyInput());
+ var policyInput = new DummyPolicyInput();
+ assertThrows(PolicyDecodingException.class, () -> handler.inputReceived(policyInput));
}
- @Test(expected = PolicyDecodingException.class)
- public void testInputReceivedNoDecoder() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
+ @Test
+ void testInputReceivedNoDecoder() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException, PluginInitializationException {
- final AbstractReceptionHandler handler = new DummyReceptionHandler();
+ final var handler = new DummyReceptionHandler();
- final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
+ final var policyForwarder = new DummyPolicyForwarder();
setUpPlugins(handler, Collections.emptySet(), Collections.singleton(policyForwarder));
- handler.inputReceived(new DummyPolicyInput());
+ var policyInput = new DummyPolicyInput();
+ assertThrows(PolicyDecodingException.class, () -> handler.inputReceived(policyInput));
}
static class DummyPolicyInput implements PolicyInput {
@@ -142,20 +143,20 @@ public class AbstractReceptionHandlerTest {
final Collection<PolicyDecoder<PolicyInput, ToscaEntity>> decoders,
final Collection<PolicyForwarder> forwarders) throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException, PluginInitializationException {
- final PluginHandlerParameters pluginParameters = getPluginHandlerParameters();
+ final var pluginParameters = getPluginHandlerParameters();
pluginParameters.setName(DISTRIBUTION_GROUP);
ParameterService.register(pluginParameters);
- final PluginHandler pluginHandler = new PluginHandler(pluginParameters.getName());
+ final var pluginHandler = new PluginHandler(pluginParameters.getName());
- final Field decodersField = pluginHandler.getClass().getDeclaredField("policyDecoders");
+ final var decodersField = pluginHandler.getClass().getDeclaredField("policyDecoders");
decodersField.setAccessible(true);
decodersField.set(pluginHandler, decoders);
- final Field forwardersField = pluginHandler.getClass().getDeclaredField("policyForwarders");
+ final var forwardersField = pluginHandler.getClass().getDeclaredField("policyForwarders");
forwardersField.setAccessible(true);
forwardersField.set(pluginHandler, forwarders);
- final Field pluginHandlerField = AbstractReceptionHandler.class.getDeclaredField("pluginHandler");
+ final var pluginHandlerField = AbstractReceptionHandler.class.getDeclaredField("pluginHandler");
pluginHandlerField.setAccessible(true);
pluginHandlerField.set(receptionHandler, pluginHandler);
ParameterService.deregister(pluginParameters.getName());
@@ -163,24 +164,23 @@ public class AbstractReceptionHandlerTest {
private Map<String, PolicyDecoderParameters> getPolicyDecoders() {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
- final PolicyDecoderParameters pDParameters =
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
policyDecoders.put(DECODER_KEY, pDParameters);
return policyDecoders;
}
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
- final Map<String, PolicyForwarderParameters> policyForwarders =
- new HashMap<>();
- final PolicyForwarderParameters pFParameters =
+ final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
policyForwarders.put(FORWARDER_KEY, pFParameters);
return policyForwarders;
}
private PluginHandlerParameters getPluginHandlerParameters() {
- final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders();
- final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders();
+ final var policyDecoders = getPolicyDecoders();
+ final var policyForwarders = getPolicyForwarders();
return new PluginHandlerParameters(policyDecoders, policyForwarders);
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java
index 9a0ac316..68dc6b56 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java
@@ -25,8 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
/**
@@ -35,29 +34,29 @@ import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParamet
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestPluginHandlerParameters {
+class TestPluginHandlerParameters {
@Test
- public void testValidate_PolicyDecodersEmpty() {
- PluginHandlerParameters emptyDecoder = new PluginHandlerParameters(new HashMap<>(), getPolicyForwarders());
+ void testValidate_PolicyDecodersEmpty() {
+ var emptyDecoder = new PluginHandlerParameters(new HashMap<>(), getPolicyForwarders());
- ValidationResult result = emptyDecoder.validate();
+ var result = emptyDecoder.validate();
assertThat(result.getResult()).contains("\"policyDecoders\"", "minimum").doesNotContain("\"policyForwarders\"");
}
@Test
- public void testValidate_PolicyForwardersNullEmpty() {
- PluginHandlerParameters emptyDecoder = new PluginHandlerParameters(getPolicyDecoders(), new HashMap<>());
+ void testValidate_PolicyForwardersNullEmpty() {
+ var emptyDecoder = new PluginHandlerParameters(getPolicyDecoders(), new HashMap<>());
- ValidationResult result = emptyDecoder.validate();
+ var result = emptyDecoder.validate();
assertThat(result.getResult()).contains("\"policyForwarders\"", "minimum").doesNotContain("\"policyDecoders\"");
}
private Map<String, PolicyDecoderParameters> getPolicyDecoders() {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
- final PolicyDecoderParameters pDParameters =
+ final var pDParameters =
new PolicyDecoderParameters("DummyDecoder", getClass().getName(), "dummyDecoderConfiguration");
policyDecoders.put("DummyDecoder", pDParameters);
@@ -66,7 +65,7 @@ public class TestPluginHandlerParameters {
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
- final PolicyForwarderParameters pFParameters =
+ final var pFParameters =
new PolicyForwarderParameters("DummyForwarder", getClass().getName(), "dummyForwarderConfiguration");
policyForwarders.put("DummyForwarder", pFParameters);
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderConfigurationParametersJsonAdapter.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderConfigurationParametersJsonAdapter.java
index 127f1223..d3a0e3d4 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderConfigurationParametersJsonAdapter.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderConfigurationParametersJsonAdapter.java
@@ -21,19 +21,16 @@
package org.onap.policy.distribution.reception.parameters;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
-import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import java.io.File;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.testclasses.DummyPolicyDecoderParameterGroup;
/**
@@ -45,49 +42,48 @@ import org.onap.policy.distribution.reception.testclasses.DummyPolicyDecoderPara
public class TestPolicyDecoderConfigurationParametersJsonAdapter {
@Test
- public void testDeserialize() throws JsonSyntaxException, IOException {
- final String validJsonFile = "src/test/resources/PolicyDecoderConfiguration.json";
- final JsonElement mockJsonElement = JsonParser.parseString(getJsonValues(validJsonFile));
+ void testDeserialize() throws JsonSyntaxException, IOException {
+ final var validJsonFile = "src/test/resources/PolicyDecoderConfiguration.json";
+ final var mockJsonElement = JsonParser.parseString(getJsonValues(validJsonFile));
- Gson gson = new GsonBuilder().registerTypeAdapter(PolicyDecoderConfigurationParameterGroup.class,
+ var gson = new GsonBuilder().registerTypeAdapter(PolicyDecoderConfigurationParameterGroup.class,
new PolicyDecoderConfigurationParametersJsonAdapter()).create();
- PolicyDecoderConfigurationParameterGroup result =
- gson.fromJson(mockJsonElement, PolicyDecoderConfigurationParameterGroup.class);
+ var result = gson.fromJson(mockJsonElement, PolicyDecoderConfigurationParameterGroup.class);
assertNotNull(result);
assertEquals(result.getClass(), DummyPolicyDecoderParameterGroup.class);
}
@Test
- public void testDeserialize_shouldThrowExceptionEmptyClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/EmptyClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value \"\" invalid in JSON file";
+ void testDeserialize_shouldThrowExceptionEmptyClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/EmptyClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value \"\" invalid in JSON file";
validateParsing(jsonFile, expectedErrorMsg);
}
@Test
- public void testDeserialize_shouldThrowExceptionNullClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/NullClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value \"null\" invalid in JSON file";
+ void testDeserialize_shouldThrowExceptionNullClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/NullClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value \"null\" invalid in JSON file";
validateParsing(jsonFile, expectedErrorMsg);
}
@Test
- public void testDeserialize_shouldThrowExceptionWrongClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/WrongClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value "
+ void testDeserialize_shouldThrowExceptionWrongClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/WrongClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value "
+ "\"org.onap.policy.distribution.reception.testclasses.NotExistentClass\", could not find class";
validateParsing(jsonFile, expectedErrorMsg);
}
private void validateParsing(final String jsonFile, String expectedErrorMsg) throws IOException {
- final JsonElement mockJsonElement = JsonParser.parseString(getJsonValues(jsonFile));
+ final var mockJsonElement = JsonParser.parseString(getJsonValues(jsonFile));
- Gson gson = new GsonBuilder().registerTypeAdapter(PolicyDecoderConfigurationParameterGroup.class,
+ var gson = new GsonBuilder().registerTypeAdapter(PolicyDecoderConfigurationParameterGroup.class,
new PolicyDecoderConfigurationParametersJsonAdapter()).create();
assertThatThrownBy(() -> gson.fromJson(mockJsonElement, PolicyDecoderConfigurationParameterGroup.class))
@@ -95,7 +91,7 @@ public class TestPolicyDecoderConfigurationParametersJsonAdapter {
}
private String getJsonValues(String path) throws IOException {
- return new String(Files.readAllBytes(new File(path).toPath()), StandardCharsets.UTF_8);
+ return Files.readString(new File(path).toPath());
}
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java
index dae91abf..d18c64d9 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java
@@ -23,7 +23,7 @@ package org.onap.policy.distribution.reception.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.handling.DummyDecoder;
/**
@@ -32,15 +32,15 @@ import org.onap.policy.distribution.reception.handling.DummyDecoder;
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestPolicyDecoderParameters {
+class TestPolicyDecoderParameters {
static final String DECODER_CLASS_NAME = DummyDecoder.class.getName();
static final String DECODER_CONFIG = "decoderConfigName";
static final String DECODER_TYPE = "DummyDecoder";
@Test
- public void testValidate_DecoderTypeEmptyNull() {
- PolicyDecoderParameters sutParams = new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIG);
+ void testValidate_DecoderTypeEmptyNull() {
+ var sutParams = new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIG);
assertThat(sutParams.validate().getResult()).contains("\"decoderType\" value \"null\" INVALID, is null");
@@ -51,13 +51,13 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testValidate_ClassNameEmptyNull() {
- PolicyDecoderParameters nullClassName = new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIG);
+ void testValidate_ClassNameEmptyNull() {
+ var nullClassName = new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIG);
assertThat(nullClassName.validate().getResult())
.contains("\"decoderClassName\" value \"null\" INVALID, is null");
- PolicyDecoderParameters emptyClassName = new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIG);
+ var emptyClassName = new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIG);
assertThat(emptyClassName.validate().getResult()).contains("\"decoderClassName\" value \"\" INVALID, is blank");
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerConfigurationParametersJsonAdapter.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerConfigurationParametersJsonAdapter.java
index ae85e0dc..40e29f64 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerConfigurationParametersJsonAdapter.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerConfigurationParametersJsonAdapter.java
@@ -21,19 +21,16 @@
package org.onap.policy.distribution.reception.parameters;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
-import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import java.io.File;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.testclasses.DummyReceptionHandlerParameterGroup;
/**
@@ -42,17 +39,17 @@ import org.onap.policy.distribution.reception.testclasses.DummyReceptionHandlerP
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestReceptionHandlerConfigurationParametersJsonAdapter {
+class TestReceptionHandlerConfigurationParametersJsonAdapter {
@Test
- public void testDeserialize() throws JsonSyntaxException, IOException {
- final String validJsonFile = "src/test/resources/ReceptionHandlerConfiguration.json";
- final JsonElement mockJsonElement = JsonParser.parseString(getJsonValues(validJsonFile));
+ void testDeserialize() throws JsonSyntaxException, IOException {
+ final var validJsonFile = "src/test/resources/ReceptionHandlerConfiguration.json";
+ final var mockJsonElement = JsonParser.parseString(getJsonValues(validJsonFile));
- Gson gson = new GsonBuilder().registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class,
+ var gson = new GsonBuilder().registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class,
new ReceptionHandlerConfigurationParametersJsonAdapter()).create();
- ReceptionHandlerConfigurationParameterGroup result =
+ var result =
gson.fromJson(mockJsonElement, ReceptionHandlerConfigurationParameterGroup.class);
assertNotNull(result);
@@ -60,34 +57,34 @@ public class TestReceptionHandlerConfigurationParametersJsonAdapter {
}
@Test
- public void testDeserialize_shouldThrowExceptionEmptyClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/EmptyClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value \"\" invalid in JSON file";
+ void testDeserialize_shouldThrowExceptionEmptyClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/EmptyClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value \"\" invalid in JSON file";
validateParsing(jsonFile, expectedErrorMsg);
}
@Test
- public void testDeserialize_shouldThrowExceptionNullClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/NullClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value \"null\" invalid in JSON file";
+ void testDeserialize_shouldThrowExceptionNullClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/NullClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value \"null\" invalid in JSON file";
validateParsing(jsonFile, expectedErrorMsg);
}
@Test
- public void testDeserialize_shouldThrowExceptionWrongClassName() throws JsonSyntaxException, IOException {
- final String jsonFile = "src/test/resources/WrongClassName.json";
- String expectedErrorMsg = "parameter \"parameterClassName\" value "
+ void testDeserialize_shouldThrowExceptionWrongClassName() throws JsonSyntaxException, IOException {
+ final var jsonFile = "src/test/resources/WrongClassName.json";
+ var expectedErrorMsg = "parameter \"parameterClassName\" value "
+ "\"org.onap.policy.distribution.reception.testclasses.NotExistentClass\", could not find class";
validateParsing(jsonFile, expectedErrorMsg);
}
private void validateParsing(final String jsonFile, String expectedErrorMsg) throws IOException {
- final JsonElement mockJsonElement = JsonParser.parseString(getJsonValues(jsonFile));
+ final var mockJsonElement = JsonParser.parseString(getJsonValues(jsonFile));
- Gson gson = new GsonBuilder().registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class,
+ var gson = new GsonBuilder().registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class,
new ReceptionHandlerConfigurationParametersJsonAdapter()).create();
assertThatThrownBy(() -> gson.fromJson(mockJsonElement, ReceptionHandlerConfigurationParameterGroup.class))
@@ -95,7 +92,6 @@ public class TestReceptionHandlerConfigurationParametersJsonAdapter {
}
private String getJsonValues(String path) throws IOException {
- return new String(Files.readAllBytes(new File(path).toPath()), StandardCharsets.UTF_8);
+ return Files.readString(new File(path).toPath());
}
-
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java
index b12af003..1cfd65d6 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
import org.onap.policy.distribution.reception.handling.DummyDecoder;
@@ -35,47 +35,47 @@ import org.onap.policy.distribution.reception.handling.DummyDecoder;
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestReceptionHandlerParameters {
+class TestReceptionHandlerParameters {
@Test
- public void testValidate_ClassNotFound() {
- final String className = "org.onap.policy.distribution.reception.testclasses.NotExistent";
+ void testValidate_ClassNotFound() {
+ final var className = "org.onap.policy.distribution.reception.testclasses.NotExistent";
- ReceptionHandlerParameters sutParams = getReceptionHandlerParameters(className);
+ var sutParams = getReceptionHandlerParameters(className);
sutParams.setName(className);
assertThat(sutParams.validate().getResult()).contains("class is not in the classpath");
}
@Test
- public void testValidate_ReceptionHandlerTypeNullEmpty() {
- final String className = DummyDecoder.class.getName();
- final PluginHandlerParameters pHParameters =
+ void testValidate_ReceptionHandlerTypeNullEmpty() {
+ final var className = DummyDecoder.class.getName();
+ final var pHParameters =
new PluginHandlerParameters(getPolicyDecoders(), getPolicyForwarders());
- ReceptionHandlerParameters nullType = new ReceptionHandlerParameters(null, className, className, pHParameters);
+ var nullType = new ReceptionHandlerParameters(null, className, className, pHParameters);
assertThat(nullType.validate().getResult())
.contains("\"receptionHandlerType\" value \"null\" INVALID, is null");
- ReceptionHandlerParameters emptyType = new ReceptionHandlerParameters("", className, className, pHParameters);
+ var emptyType = new ReceptionHandlerParameters("", className, className, pHParameters);
assertThat(emptyType.validate().getResult()).contains("\"receptionHandlerType\" value \"\" INVALID, is blank")
.doesNotContain("classpath");
}
@Test
- public void testValidate_ReceptionHandlerClassNameNullEmpty() {
+ void testValidate_ReceptionHandlerClassNameNullEmpty() {
final PluginHandlerParameters pHParameters =
new PluginHandlerParameters(getPolicyDecoders(), getPolicyForwarders());
- ReceptionHandlerParameters nullType = new ReceptionHandlerParameters("DummyReceptionHandler", null,
+ var nullType = new ReceptionHandlerParameters("DummyReceptionHandler", null,
"dummyReceptionHandlerConfiguration", pHParameters);
assertThat(nullType.validate().getResult())
.contains("\"receptionHandlerClassName\" value \"null\" INVALID, is null");
- ReceptionHandlerParameters emptyType = new ReceptionHandlerParameters("DummyReceptionHandler", "",
+ var emptyType = new ReceptionHandlerParameters("DummyReceptionHandler", "",
"dummyReceptionHandlerConfiguration", pHParameters);
assertThat(emptyType.validate().getResult())
@@ -83,10 +83,10 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testValidate_PluginHandlerParametersNull() {
- final String className = "org.onap.policy.distribution.reception.testclasses.DummyReceptionHandler";
+ void testValidate_PluginHandlerParametersNull() {
+ final var className = "org.onap.policy.distribution.reception.testclasses.DummyReceptionHandler";
- ReceptionHandlerParameters sutParams = new ReceptionHandlerParameters("DummyReceptionHandler", className,
+ var sutParams = new ReceptionHandlerParameters("DummyReceptionHandler", className,
"dummyReceptionHandlerConfiguration", null);
assertThat(sutParams.validate().getResult())
@@ -94,10 +94,10 @@ public class TestReceptionHandlerParameters {
}
private ReceptionHandlerParameters getReceptionHandlerParameters(String className) {
- final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders();
- final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders();
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- final ReceptionHandlerParameters rhParameters = new ReceptionHandlerParameters("DummyReceptionHandler",
+ final var policyDecoders = getPolicyDecoders();
+ final var policyForwarders = getPolicyForwarders();
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ final var rhParameters = new ReceptionHandlerParameters("DummyReceptionHandler",
className, "dummyReceptionHandlerConfiguration", pHParameters);
return rhParameters;
}
@@ -105,7 +105,7 @@ public class TestReceptionHandlerParameters {
private Map<String, PolicyDecoderParameters> getPolicyDecoders() {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
- final PolicyDecoderParameters pDParameters =
+ final var pDParameters =
new PolicyDecoderParameters("DummyDecoder", DummyDecoder.class.getName(), "dummyDecoderConfiguration");
policyDecoders.put("DummyDecoder", pDParameters);
@@ -115,7 +115,7 @@ public class TestReceptionHandlerParameters {
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
- final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters("DummyForwarder",
+ final var pFParameters = new PolicyForwarderParameters("DummyForwarder",
DummyDecoder.class.getName(), "dummyForwarderConfiguration");
policyForwarders.put("DummyForwarder", pFParameters);
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/statistics/TestDistributionStatisticsManager.java b/reception/src/test/java/org/onap/policy/distribution/reception/statistics/TestDistributionStatisticsManager.java
index 3c14da33..c3ea7bbc 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/statistics/TestDistributionStatisticsManager.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/statistics/TestDistributionStatisticsManager.java
@@ -20,87 +20,87 @@
package org.onap.policy.distribution.reception.statistics;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Class to perform unit test of DistributionStatisticsManager.
*
* @author Adheli Tavares (adheli.tavares@est.tech)
* */
-public class TestDistributionStatisticsManager {
+class TestDistributionStatisticsManager {
- @Before
- public void reset() {
+ @BeforeEach
+ void reset() {
DistributionStatisticsManager.resetAllStatistics();
}
@Test
- public void testUpdateTotalDistributionCount() {
+ void testUpdateTotalDistributionCount() {
DistributionStatisticsManager.updateTotalDistributionCount();
assertEquals(1L, DistributionStatisticsManager.getTotalDistributionCount());
}
@Test
- public void testUpdateDistributionSuccessCount() {
+ void testUpdateDistributionSuccessCount() {
DistributionStatisticsManager.updateDistributionSuccessCount();
assertEquals(1L, DistributionStatisticsManager.getDistributionSuccessCount());
}
@Test
- public void testUpdateDistributionFailureCount() {
+ void testUpdateDistributionFailureCount() {
DistributionStatisticsManager.updateDistributionFailureCount();
assertEquals(1L, DistributionStatisticsManager.getDistributionFailureCount());
}
@Test
- public void testUpdateTotalDownloadCount() {
+ void testUpdateTotalDownloadCount() {
DistributionStatisticsManager.updateTotalDownloadCount();
assertEquals(1L, DistributionStatisticsManager.getTotalDownloadCount());
}
@Test
- public void testUpdateDownloadSuccessCount() {
+ void testUpdateDownloadSuccessCount() {
DistributionStatisticsManager.updateDownloadSuccessCount();
assertEquals(1L, DistributionStatisticsManager.getDownloadSuccessCount());
}
@Test
- public void testUpdateDownloadFailureCount() {
+ void testUpdateDownloadFailureCount() {
DistributionStatisticsManager.updateDownloadFailureCount();
assertEquals(1L, DistributionStatisticsManager.getDownloadFailureCount());
}
@Test
- public void testGetTotalDistributionCount() {
+ void testGetTotalDistributionCount() {
assertEquals(0L, DistributionStatisticsManager.getTotalDistributionCount());
}
@Test
- public void testGetDistributionSuccessCount() {
+ void testGetDistributionSuccessCount() {
assertEquals(0L, DistributionStatisticsManager.getDistributionSuccessCount());
}
@Test
- public void testGetDistributionFailureCount() {
+ void testGetDistributionFailureCount() {
assertEquals(0L, DistributionStatisticsManager.getDistributionFailureCount());
}
@Test
- public void testGetTotalDownloadCount() {
+ void testGetTotalDownloadCount() {
assertEquals(0L, DistributionStatisticsManager.getTotalDownloadCount());
}
@Test
- public void testGetDownloadSuccessCount() {
+ void testGetDownloadSuccessCount() {
assertEquals(0L, DistributionStatisticsManager.getDownloadSuccessCount());
}
@Test
- public void testGetDownloadFailureCount() {
+ void testGetDownloadFailureCount() {
assertEquals(0L, DistributionStatisticsManager.getDownloadFailureCount());
}
}
diff --git a/testsuites/performance/pom.xml b/testsuites/performance/pom.xml
index a9f32257..3e3bd54f 100644
--- a/testsuites/performance/pom.xml
+++ b/testsuites/performance/pom.xml
@@ -18,12 +18,13 @@
limitations under the License.
============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-testsuites</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-performance</artifactId>
<build>
diff --git a/testsuites/pom.xml b/testsuites/pom.xml
index dc693334..5c152fa1 100644
--- a/testsuites/pom.xml
+++ b/testsuites/pom.xml
@@ -18,18 +18,19 @@
limitations under the License.
============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>policy-distribution</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-testsuites</artifactId>
<packaging>pom</packaging>
<properties>
- <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+ <!-- There is no code in this submodule, only holds interfaces. So skip sonar. -->
<sonar.skip>true</sonar.skip>
</properties>
diff --git a/testsuites/stability/pom.xml b/testsuites/stability/pom.xml
index c59f48e1..c0444f0b 100644
--- a/testsuites/stability/pom.xml
+++ b/testsuites/stability/pom.xml
@@ -18,12 +18,13 @@
limitations under the License.
============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-testsuites</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>distribution-stability</artifactId>
<build>
diff --git a/version.properties b/version.properties
index 4ba0a9a8..3288dcdc 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
minor=3
minor=0
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}