From 6b6738c5b1e3c538678a2f17e2b2210afb4e68ec Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Mon, 21 Jul 2025 12:03:52 +0100 Subject: [PATCH] Fix sonar issues Issue-ID: POLICY-5421 Change-Id: I928d5bf93e6cdee209389b2e77e6c868af99fd79 Signed-off-by: adheli.tavares --- .../org/onap/policy/pap/main/comm/msgdata/UpdateReq.java | 12 ++++++------ .../policy/pap/main/comm/PdpStatusMessageHandlerTest.java | 4 ++-- .../java/org/onap/policy/pap/main/comm/PublisherTest.java | 8 ++++---- .../policy/pap/main/notification/DeploymentStatusTest.java | 10 +++++----- .../policy/pap/main/notification/DeploymentTrackerTest.java | 4 ++-- .../policy/pap/main/notification/PolicyNotifierTest.java | 4 ++-- .../pap/main/parameters/TestPdpModifyRequestMapParams.java | 4 ++-- .../onap/policy/pap/main/parameters/TestRequestParams.java | 4 ++-- .../onap/policy/pap/main/rest/PapRestControllerV1Test.java | 6 +++--- .../java/org/onap/policy/pap/main/rest/ProviderSuper.java | 6 +++--- .../org/onap/policy/pap/main/rest/TestActuatorEndpoints.java | 6 +++--- .../java/org/onap/policy/pap/main/rest/TestGroupData.java | 4 ++-- .../pap/main/rest/TestHealthCheckRestControllerV1.java | 6 +++--- .../pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java | 6 +++--- .../policy/pap/main/rest/TestPdpGroupDeleteProvider.java | 6 +++--- .../policy/pap/main/rest/TestPdpGroupDeployProvider.java | 6 +++--- .../pap/main/rest/TestPdpGroupHealthCheckProvider.java | 6 +++--- .../onap/policy/pap/main/rest/TestPolicyAuditManager.java | 6 +++--- .../main/rest/TestPolicyComponentsHealthCheckProvider.java | 6 +++--- .../onap/policy/pap/main/rest/TestPolicyStatusProvider.java | 7 +++---- .../onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java | 6 +++--- .../java/org/onap/policy/pap/main/rest/TestProviderBase.java | 6 +++--- .../pap/main/service/ToscaNodeTemplateServiceTest.java | 6 +++--- .../pap/main/service/ToscaServiceTemplateServiceTest.java | 6 +++--- .../org/onap/policy/pap/main/startstop/TestPapActivator.java | 12 ++++++------ 25 files changed, 78 insertions(+), 79 deletions(-) diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java index 98c8e3b6..cfdbe01c 100644 --- a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java +++ b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2024-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import lombok.Getter; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.onap.policy.models.pdp.concepts.PdpMessage; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -85,11 +85,11 @@ public class UpdateReq extends RequestImpl { PdpUpdate message = getMessage(); - if (!StringUtils.equals(message.getPdpGroup(), response.getPdpGroup())) { + if (!Strings.CS.equals(message.getPdpGroup(), response.getPdpGroup())) { return "group does not match"; } - if (!StringUtils.equals(message.getPdpSubgroup(), response.getPdpSubgroup())) { + if (!Strings.CS.equals(message.getPdpSubgroup(), response.getPdpSubgroup())) { return "subgroup does not match"; } @@ -169,11 +169,11 @@ public class UpdateReq extends RequestImpl { protected final boolean isSameContent(PdpUpdate second) { PdpUpdate first = getMessage(); - if (!StringUtils.equals(first.getPdpGroup(), second.getPdpGroup())) { + if (!Strings.CS.equals(first.getPdpGroup(), second.getPdpGroup())) { return false; } - if (!StringUtils.equals(first.getPdpSubgroup(), second.getPdpSubgroup())) { + if (!Strings.CS.equals(first.getPdpSubgroup(), second.getPdpSubgroup())) { return false; } diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandlerTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandlerTest.java index 5a889125..8c8e8e69 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandlerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandlerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ import org.springframework.test.context.ActiveProfiles; class PdpStatusMessageHandlerTest { @BeforeAll - public static void setupClass() { + static void setupClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PublisherTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PublisherTest.java index 6189b0b5..1c71ffa5 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PublisherTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PublisherTest.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2022-2024 Nordix Foundation. + * Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ import org.onap.policy.pap.main.PolicyPapException; import org.onap.policy.pap.main.parameters.CommonTestData; import org.onap.policy.pap.main.parameters.PapParameterGroup; -public class PublisherTest extends Threaded { +class PublisherTest extends Threaded { // these messages will have different request IDs private static final PdpStateChange MSG1 = new PdpStateChange(); @@ -84,7 +84,7 @@ public class PublisherTest extends Threaded { * Configures the topic and attaches a listener. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { final PapParameterGroup parameterGroup = new CommonTestData().getPapParameterGroup(6969); TopicEndpointManager.getManager().shutdown(); @@ -93,7 +93,7 @@ public class PublisherTest extends Threaded { } @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { TopicEndpointManager.getManager().shutdown(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java index 188bece0..31cb96a5 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.notification.StatusAction.Action; import org.onap.policy.pap.main.service.PolicyStatusService; -public class DeploymentStatusTest { +class DeploymentStatusTest { private static final String VERSION = "1.2.3"; private static final @NonNull String GROUP_A = "groupA"; @@ -89,7 +89,7 @@ public class DeploymentStatusTest { * Set up the meter registry for tests. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { Registry.registerOrReplace(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry()); } @@ -97,7 +97,7 @@ public class DeploymentStatusTest { * Tear down the meter registry after tests. */ @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.unregister(PapConstants.REG_METER_REGISTRY); } @@ -105,7 +105,7 @@ public class DeploymentStatusTest { * Sets up. */ @BeforeEach - public void setUp() { + void setUp() { autoCloseable = MockitoAnnotations.openMocks(this); tracker = new DeploymentStatus(policyStatusService); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentTrackerTest.java index 3c351e50..1107d1e5 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentTrackerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentTrackerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ class DeploymentTrackerTest { * Sets up test objects. */ @BeforeEach - public void setUp() { + void setUp() { tracker = new DeploymentTracker(); builder = PdpPolicyStatus.builder().deploy(true).state(State.SUCCESS).pdpGroup(MY_GROUP).pdpType(MY_PDP_TYPE) .policy(POLICY_A).policyType(POLICY_TYPE).pdpId(PDP_A); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java index 3b99ab03..29b2ab13 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -81,7 +81,7 @@ class PolicyNotifierTest { * Creates various objects, including {@link #notifier}. */ @BeforeEach - public void setUp() { + void setUp() { closeable = MockitoAnnotations.openMocks(this); lenient().when(policyStatusService.getGroupPolicyStatus(anyString())).thenReturn(Collections.emptyList()); Registry.registerOrReplace(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry()); diff --git a/main/src/test/java/org/onap/policy/pap/main/parameters/TestPdpModifyRequestMapParams.java b/main/src/test/java/org/onap/policy/pap/main/parameters/TestPdpModifyRequestMapParams.java index ae46e66b..c33233b7 100644 --- a/main/src/test/java/org/onap/policy/pap/main/parameters/TestPdpModifyRequestMapParams.java +++ b/main/src/test/java/org/onap/policy/pap/main/parameters/TestPdpModifyRequestMapParams.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ class TestPdpModifyRequestMapParams { */ @BeforeEach @SuppressWarnings("unchecked") - public void setUp() { + void setUp() { pub = mock(Publisher.class); disp = mock(RequestIdDispatcher.class); lock = new Object(); diff --git a/main/src/test/java/org/onap/policy/pap/main/parameters/TestRequestParams.java b/main/src/test/java/org/onap/policy/pap/main/parameters/TestRequestParams.java index f853f01d..176cfcc1 100644 --- a/main/src/test/java/org/onap/policy/pap/main/parameters/TestRequestParams.java +++ b/main/src/test/java/org/onap/policy/pap/main/parameters/TestRequestParams.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ class TestRequestParams { */ @BeforeEach @SuppressWarnings("unchecked") - public void setUp() { + void setUp() { pub = mock(Publisher.class); disp = mock(RequestIdDispatcher.class); lock = new Object(); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java b/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java index 93f73b08..68edbe1e 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2023 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,13 +45,13 @@ class PapRestControllerV1Test { private BodyBuilder bldr; @BeforeEach - public void setUp() { + void setUp() { bldr = ResponseEntity.ok(); closeable = MockitoAnnotations.openMocks(this); } @AfterEach - public void after() throws Exception { + void after() throws Exception { closeable.close(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java b/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java index 98ce4034..2bdea753 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021-2024 Nordix Foundation. + * Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022-2023 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -102,7 +102,7 @@ public class ProviderSuper { * Configures DAO, captors, and various mocks. */ @BeforeEach - public void setUp() { + void setUp() { Registry.newRegistry(); @@ -129,7 +129,7 @@ public class ProviderSuper { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { closeable.close(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestActuatorEndpoints.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestActuatorEndpoints.java index a1a16bf5..415e21f1 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestActuatorEndpoints.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestActuatorEndpoints.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation. + * Copyright (C) 2022-2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ import org.springframework.web.context.WebApplicationContext; @AutoConfigureObservability @ContextConfiguration @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) -public class TestActuatorEndpoints { +class TestActuatorEndpoints { @Autowired private WebApplicationContext context; @@ -62,7 +62,7 @@ public class TestActuatorEndpoints { .httpBasic("policyAdmin", "zb!XztG34"); @BeforeAll - public static void setupClass() { + static void setupClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestGroupData.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestGroupData.java index 4a33e9f1..6a8e5c5b 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestGroupData.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestGroupData.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ class TestGroupData { * Sets up. */ @BeforeEach - public void setUp() { + void setUp() { oldGroup = new PdpGroup(); oldGroup.setName(NAME); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestHealthCheckRestControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestHealthCheckRestControllerV1.java index 036421ae..bea6d1ff 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestHealthCheckRestControllerV1.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestHealthCheckRestControllerV1.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2022-2024 Nordix Foundation. + * Copyright (C) 2019, 2022-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2019 AT&T Intellectual Property. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -31,8 +31,8 @@ import jakarta.ws.rs.client.SyncInvoker; import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.report.HealthCheckReport; import org.onap.policy.models.base.PfModelRuntimeException; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; /** * Class to perform unit test of {@link HealthCheckRestControllerV1}. @@ -44,7 +44,7 @@ class TestHealthCheckRestControllerV1 extends CommonPapRestServer { private static final String HEALTHCHECK_ENDPOINT = "healthcheck"; - @MockBean + @MockitoBean private PolicyStatusProvider policyStatusProvider; @Test diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java index b96b53fb..a96d13a7 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2019-2021, 2023-2024 Nordix Foundation. + * Copyright (C) 2019-2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2021 AT&T Intellectual Property. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -51,7 +51,7 @@ import org.onap.policy.models.pdp.enums.PdpState; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.pap.main.PapConstants; -public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper { +class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; private static final String PDP2 = "pdpB"; @@ -61,7 +61,7 @@ public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper { @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java index 23a62f8d..f9703ecc 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020-2024 Nordix Foundation. + * Modifications Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,7 +55,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; import org.onap.policy.pap.main.rest.ProviderBase.Updater; -public class TestPdpGroupDeleteProvider extends ProviderSuper { +class TestPdpGroupDeleteProvider extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; private static final String GROUP1_NAME = "groupA"; @@ -72,7 +72,7 @@ public class TestPdpGroupDeleteProvider extends ProviderSuper { private Updater updater; @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java index 6b9ecafa..a5231b63 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2021-2023 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,7 +55,7 @@ import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -public class TestPdpGroupDeployProvider extends ProviderSuper { +class TestPdpGroupDeployProvider extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; private static final String POLICY2_NAME = "policyB"; @@ -73,7 +73,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { private PdpGroupDeployProvider prov; @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java index 59aa6d2f..5409cf4a 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2023-2024 Nordix Foundation. + * Copyright (C) 2019, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -65,7 +65,7 @@ class TestPdpGroupHealthCheckProvider { * Configures DAO and mocks. */ @BeforeEach - public void setUp() { + void setUp() { autoCloseable = MockitoAnnotations.openMocks(this); Registry.newRegistry(); groups = loadFile().getGroups(); @@ -74,7 +74,7 @@ class TestPdpGroupHealthCheckProvider { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { autoCloseable.close(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyAuditManager.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyAuditManager.java index 9fa5948d..ccc2e112 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyAuditManager.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyAuditManager.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,7 +35,7 @@ import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.pap.concepts.PolicyAudit.AuditAction; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -public class TestPolicyAuditManager extends ProviderSuper { +class TestPolicyAuditManager extends ProviderSuper { private static final ToscaConceptIdentifier MY_POLICY = new ToscaConceptIdentifier("myPolicy", "1.0.0"); private static final String GROUP_A = "pdpGroup-A"; @@ -56,7 +56,7 @@ public class TestPolicyAuditManager extends ProviderSuper { } @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java index ddb8f0de..dfb478ac 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020, 2022-2024 Nordix Foundation. + * Copyright (C) 2020, 2022-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2020-2021 AT&T Corp. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -108,7 +108,7 @@ class TestPolicyComponentsHealthCheckProvider { * @throws Exception if an error occurs */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { autoCloseable = MockitoAnnotations.openMocks(this); groups = loadPdpGroupsFromFile().getGroups(); when(pdpGroupService.getPdpGroups()).thenReturn(groups); @@ -157,7 +157,7 @@ class TestPolicyComponentsHealthCheckProvider { * Tear down. */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { if (savedPapParameterGroup != null) { ParameterService.register(savedPapParameterGroup, true); } else { diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyStatusProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyStatusProvider.java index 0eb4e7fc..ae00104d 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyStatusProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyStatusProvider.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ import org.onap.policy.models.pdp.concepts.PdpPolicyStatus.State; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; -public class TestPolicyStatusProvider extends ProviderSuper { +class TestPolicyStatusProvider extends ProviderSuper { private static final String MY_GROUP = "MyGroup"; private static final String MY_PDP_TYPE = "MySubGroup"; private static final @NonNull String POLICY_TYPE_VERSION = "1.0.3"; @@ -66,13 +66,12 @@ public class TestPolicyStatusProvider extends ProviderSuper { private PolicyStatusProvider prov; @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } /** * Configures mocks and objects. - * */ @Override @BeforeEach diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java index ccd0fe46..6f37b8dd 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -public class TestPolicyUndeployerImpl extends ProviderSuper { +class TestPolicyUndeployerImpl extends ProviderSuper { private static final String MY_GROUP = "my-group"; private static final String MY_SUBGROUP = "my-subgroup"; private static final String MY_SUBGROUP0 = "my-subgroup-0"; @@ -67,7 +67,7 @@ public class TestPolicyUndeployerImpl extends ProviderSuper { @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java index 70d25fde..b42f3c5e 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -52,7 +52,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.pap.main.PapConstants; import org.springframework.test.util.ReflectionTestUtils; -public class TestProviderBase extends ProviderSuper { +class TestProviderBase extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; private static final String POLICY1_NAME = "policyA"; @@ -71,7 +71,7 @@ public class TestProviderBase extends ProviderSuper { private MyProvider prov; @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { Registry.newRegistry(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/service/ToscaNodeTemplateServiceTest.java b/main/src/test/java/org/onap/policy/pap/main/service/ToscaNodeTemplateServiceTest.java index 7b64c47f..f9e209b2 100644 --- a/main/src/test/java/org/onap/policy/pap/main/service/ToscaNodeTemplateServiceTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/service/ToscaNodeTemplateServiceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2022-2023 Nordix Foundation. All rights reserved. + * Copyright (C) 2022-2023, 2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ class ToscaNodeTemplateServiceTest { * Set up for tests. */ @BeforeEach - public void setup() throws CoderException { + void setup() throws CoderException { autoCloseable = MockitoAnnotations.openMocks(this); coder.decode(ResourceUtils.getResourceAsString("e2e/policyMetadataSet.yaml"), ToscaServiceTemplate.class).getToscaTopologyTemplate().getNodeTemplates() @@ -75,7 +75,7 @@ class ToscaNodeTemplateServiceTest { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { autoCloseable.close(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/service/ToscaServiceTemplateServiceTest.java b/main/src/test/java/org/onap/policy/pap/main/service/ToscaServiceTemplateServiceTest.java index 032f44db..715edf89 100644 --- a/main/src/test/java/org/onap/policy/pap/main/service/ToscaServiceTemplateServiceTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/service/ToscaServiceTemplateServiceTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2022-2024 Nordix Foundation. + * Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ class ToscaServiceTemplateServiceTest { * @throws CoderException the exception */ @BeforeEach - public void setup() throws CoderException { + void setup() throws CoderException { autoCloseable = MockitoAnnotations.openMocks(this); coder.decode(ResourceUtils.getResourceAsString("e2e/policyMetadataSet.yaml"), ToscaServiceTemplate.class).getToscaTopologyTemplate().getNodeTemplates() @@ -115,7 +115,7 @@ class ToscaServiceTemplateServiceTest { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { autoCloseable.close(); } diff --git a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java index c740d695..d5c63c39 100644 --- a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java +++ b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2022-2024 Nordix Foundation. + * Copyright (C) 2019, 2022-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. * Modifications Copyright (C) 2021-2023 Bell Canada. All rights reserved. * ================================================================================ @@ -55,7 +55,7 @@ import org.onap.policy.pap.main.parameters.PapParameterGroup; * * @author Ram Krishna Verma (ram.krishna.verma@est.tech) */ -public class TestPapActivator { +class TestPapActivator { private static final String CONFIG_FILE = "src/test/resources/parameters/TestConfigParams.json"; private PapActivator activator; @@ -64,7 +64,7 @@ public class TestPapActivator { * Allocates a new DB name, server port, and creates a config file. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { Registry.newRegistry(); CommonTestData.newDb(); } @@ -75,7 +75,7 @@ public class TestPapActivator { * @throws Exception if an error occurs */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { Registry.newRegistry(); TopicEndpointManager.getManager().shutdown(); HttpServletServerFactoryInstance.getServerFactory().destroy(); @@ -104,14 +104,14 @@ public class TestPapActivator { * @throws Exception if an error occurs */ @AfterEach - public void teardown() throws Exception { + void teardown() throws Exception { if (activator != null && activator.isAlive()) { activator.stop(); } } @AfterAll - public static void afterClass() { + static void afterClass() { Registry.newRegistry(); } -- 2.16.6