aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-08-21 14:35:56 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-08-22 09:05:59 +0000
commit182c1dbd18c9bb3c4696e8e74fb0ff8cd7a581e6 (patch)
treeb0621323bc8e8823f204607f4bde819e0d9373bc /plugins
parent7808675f394deacc75e89866159b24ae35f63919 (diff)
Upgrade Java 17
Issue-ID: POLICY-4803 Change-Id: Ic7852fffa2f5a2f407900e7caae9e70bd50b267f Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'plugins')
-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/testclasses/LifecycleApiAutomationCompositionSimulatorEndpoint.java12
-rw-r--r--plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycycleApiSimulatorEndpoint.java14
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java3
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java3
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java4
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java83
8 files changed, 58 insertions, 75 deletions
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/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/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..279bb976 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
@@ -30,8 +30,6 @@ 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.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
@@ -43,7 +41,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
*
* @author Sirisha Manchikanti (sirisha.manchikanti@est.tech)
*/
-@RunWith(MockitoJUnitRunner.class)
public class AutomationCompositionDecoderFileInCsarTest {
/**
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..640f4723 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
@@ -30,8 +30,6 @@ 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.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
@@ -43,7 +41,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-@RunWith(MockitoJUnitRunner.class)
public class PolicyDecoderFileInCsarToPolicyTest {
/**
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..fcad382f 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
@@ -36,9 +36,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
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,7 +46,6 @@ import org.slf4j.LoggerFactory;
/**
* Class to perform unit test of {@link FileSystemReceptionHandler}.
*/
-@RunWith(MockitoJUnitRunner.class)
public class TestFileSystemReceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(TestFileSystemReceptionHandler.class);
@@ -160,4 +157,3 @@ public class TestFileSystemReceptionHandler {
}
}
-
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..9eaf67b1 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
@@ -26,7 +26,10 @@ 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.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;
@@ -41,10 +44,6 @@ 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.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -68,23 +67,17 @@ import org.onap.sdc.utils.DistributionActionResultEnum;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-@RunWith(MockitoJUnitRunner.class)
public 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 IDistributionClientResult successfulClientInitResult = mock(IDistributionClientResult.class);
+ private IDistributionClientResult failureClientInitResult = mock(IDistributionClientResult.class);
+ private IDistributionClient distributionClient = mock(IDistributionClient.class);
+ private IDistributionClientDownloadResult successfulClientDownloadResult
+ = mock(IDistributionClientDownloadResult.class);
+ private INotificationData notificationData = mock(INotificationData.class);
+ private IArtifactInfo artifactInfo = mock(IArtifactInfo.class);
private SdcReceptionHandlerConfigurationParameterGroup pssdConfigParameters;
private SdcReceptionHandler sypHandler;
@@ -105,27 +98,27 @@ public class TestSdcReceptionHandler {
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())
+ 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);
}
@@ -144,7 +137,7 @@ public class TestSdcReceptionHandler {
@Test
public final void testInitializeSdcClient_Failure() {
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
+ when(successfulClientInitResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL).thenReturn(DistributionActionResultEnum.SUCCESS);
assertThatCode(() -> sypHandler.initializeReception(pssdConfigParameters.getName()))
.doesNotThrowAnyException();
@@ -153,7 +146,7 @@ public class TestSdcReceptionHandler {
@Test
public final void testStartSdcClient_Failure() {
assertThatCode(() -> {
- Mockito.when(distributionClient.start()).thenReturn(failureClientInitResult)
+ when(distributionClient.start()).thenReturn(failureClientInitResult)
.thenReturn(successfulClientInitResult);
sypHandler.initializeReception(pssdConfigParameters.getName());
}).doesNotThrowAnyException();
@@ -170,7 +163,7 @@ public class TestSdcReceptionHandler {
@Test
public 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();
}
@@ -211,7 +204,7 @@ public class TestSdcReceptionHandler {
public void testDownloadArtifactFailure() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
IllegalAccessException, PluginInitializationException {
- Mockito.when(successfulClientDownloadResult.getDistributionActionResult())
+ when(successfulClientDownloadResult.getDistributionActionResult())
.thenReturn(DistributionActionResultEnum.FAIL);
final DummyDecoder policyDecoder = new DummyDecoder();
@@ -240,11 +233,11 @@ public class TestSdcReceptionHandler {
public 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 Collection<PolicyDecoder<Csar, DummyPolicy>> policyDecoders = new ArrayList<>();