From 4c84942b9af6e4d7f3aea84fa958a2b9c873b77d Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Tue, 15 Jul 2025 16:35:57 +0100 Subject: [PATCH] Fix sonar issues - fix sonar issues - change maven plugin dependencies version for conflicting with kie-maven from drools.org Issue-ID: POLICY-5414 Change-Id: If85a7193be8824bcca1039b3e22580c30dc4e1f3 Signed-off-by: adheli.tavares --- .../locking/DistributedLockManagerTest.java | 4 +- .../drools/healthcheck/HealthCheckFeatureTest.java | 8 +- .../drools/healthcheck/HealthCheckManagerTest.java | 4 +- .../drools/healthcheck/RestHealthCheckTest.java | 8 +- .../legacy/config/LegacyConfigFeatureTest.java | 6 +- .../drools/legacy/config/LegacyConfigTest.java | 6 +- .../server/restful/RestLegacyConfigTest.java | 8 +- .../policy/drools/lifecycle/LifecycleFsmTest.java | 8 +- .../drools/lifecycle/LifecycleFsmUpdateTest.java | 10 +-- .../LifecycleStateActivePoliciesTest.java | 4 +- .../drools/lifecycle/LifecycleStateActiveTest.java | 4 +- .../lifecycle/LifecycleStatePassiveTest.java | 4 +- .../lifecycle/LifecycleStateTerminatedTest.java | 8 +- .../PolicyTypeNativeArtifactControllerTest.java | 4 +- .../PolicyTypeNativeDroolsControllerTest.java | 4 +- .../server/restful/RestLifecycleManagerTest.java | 6 +- .../onap/policy/no/locking/NoLockManagerTest.java | 6 +- .../policy/drools/pooling/EndToEndFeatureTest.java | 18 ++-- .../onap/policy/drools/pooling/FeatureTest.java | 10 +-- .../policy/drools/pooling/PoolingFeatureTest.java | 21 +++-- .../drools/pooling/PoolingManagerImplTest.java | 96 ++++++++-------------- .../drools/pooling/PoolingPropertiesTest.java | 4 +- .../drools/pooling/TopicMessageManagerTest.java | 4 +- .../drools/pooling/message/IdentificationTest.java | 4 +- .../policy/drools/pooling/message/LeaderTest.java | 4 +- .../policy/drools/pooling/message/MessageTest.java | 6 +- .../policy/drools/pooling/state/IdleStateTest.java | 3 +- .../drools/pooling/state/ProcessingStateTest.java | 3 +- .../policy/drools/pooling/state/StateTest.java | 5 +- .../TestTransactionAdditionalTest.java | 4 +- .../TestTransactionFeatureTest.java | 70 ++++++++-------- .../testtransaction/TestTransactionTest.java | 6 +- .../policy/drools/core/DroolsContainerTest.java | 6 +- .../onap/policy/drools/core/PolicySessionTest.java | 2 +- .../onap/policy/drools/core/jmx/PdpJmxTest.java | 4 +- .../drools/core/lock/AlwaysFailLockTest.java | 4 +- .../drools/core/lock/AlwaysSuccessLockTest.java | 4 +- .../onap/policy/drools/core/lock/LockImplTest.java | 4 +- .../org/onap/policy/drools/util/KieUtilsTest.java | 6 +- .../domain/models/DomainPolicyTypesTest.java | 4 +- .../models/operational/OperationalPolicyTest.java | 4 +- .../internal/MavenDroolsController2Test.java | 4 +- .../internal/MavenDroolsControllerTest.java | 6 +- .../MavenDroolsControllerUpgradesTest.java | 8 +- .../drools/persistence/SystemPersistenceTest.java | 8 +- .../protocol/coders/ProtocolCoderToolsetTest.java | 8 +- .../server/restful/test/RestManagerTest.java | 8 +- .../drools/system/PolicyControllerFactoryTest.java | 4 +- .../drools/system/PolicyEngineManagerTest.java | 8 +- .../internal/AggregatedPolicyControllerTest.java | 4 +- .../drools/system/internal/LockManagerTest.java | 6 +- .../policy/drools/policies/DomainMakerTest.java | 4 +- .../drools/policies/StandardValCoderTest.java | 4 +- .../onap/policy/drools/utils/PropertyUtilTest.java | 8 +- pom.xml | 10 +++ 55 files changed, 234 insertions(+), 254 deletions(-) diff --git a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java index 579d53cc..0586ff85 100644 --- a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java +++ b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023-2024 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. @@ -238,7 +238,7 @@ class DistributedLockManagerTest { @Test void testServiceApis() { assertTrue(new OrderedServiceImpl<>(PolicyEngineFeatureApi.class).getList().stream() - .anyMatch(obj -> obj instanceof DistributedLockManager)); + .anyMatch(DistributedLockManager.class::isInstance)); } @Test diff --git a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckFeatureTest.java b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckFeatureTest.java index 90413041..51761d12 100644 --- a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckFeatureTest.java +++ b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2019,2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -59,7 +59,7 @@ import org.onap.policy.drools.util.KieUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class HealthCheckFeatureTest { +class HealthCheckFeatureTest { private static final Logger logger = LoggerFactory.getLogger(HealthCheckFeatureTest.class); private static final String EXPECTED = "expected exception"; @@ -68,7 +68,7 @@ public class HealthCheckFeatureTest { * Set up. */ @BeforeAll - public static void setup() throws IOException { + static void setup() throws IOException { SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes"); LoggerUtils.setLevel("org.onap.policy.common.endpoints", "WARN"); @@ -95,7 +95,7 @@ public class HealthCheckFeatureTest { * Tear down. */ @AfterAll - public static void teardown() { + static void teardown() { PolicyControllerConstants.getFactory().destroy(); HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); diff --git a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckManagerTest.java b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckManagerTest.java index 8553301f..f26552cd 100644 --- a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckManagerTest.java +++ b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -103,7 +103,7 @@ class HealthCheckManagerTest { * Initializes the object to be tested. */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { properties = new Properties(); mocks(); diff --git a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java index 4e75d315..5610a593 100644 --- a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java +++ b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -46,7 +46,7 @@ import org.onap.policy.drools.system.PolicyControllerFactory; /** * REST Healthcheck Tests. */ -public class RestHealthCheckTest { +class RestHealthCheckTest { private static HttpClientFactory clientFactory; private static PolicyControllerFactory controllerFactory; @@ -62,7 +62,7 @@ public class RestHealthCheckTest { */ @BeforeAll - public static void setUp() throws Exception { + static void setUp() throws Exception { LoggerUtils.setLevel("org.onap.policy.common.endpoints", "WARN"); LoggerUtils.setLevel("org.eclipse", "ERROR"); LoggerUtils.setLevel("org.onap.policy.drools.healthcheck", "DEBUG"); @@ -105,7 +105,7 @@ public class RestHealthCheckTest { */ @AfterAll - public static void tearDown() { + static void tearDown() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java index 85d152fa..7449c689 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -40,7 +40,7 @@ class LegacyConfigFeatureTest { * Set up. */ @BeforeEach - public void setUp() { + void setUp() { SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes"); configF = new LegacyConfigFeature(); } @@ -49,7 +49,7 @@ class LegacyConfigFeatureTest { * Tear down. */ @AfterEach - public void tearDown() { + void tearDown() { NoopTopicFactories.getSourceFactory().destroy(); NoopTopicFactories.getSinkFactory().destroy(); SystemPersistenceConstants.getManager().setConfigurationDir(null); diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java index 69d5bf2c..d84e13b0 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -42,7 +42,7 @@ class LegacyConfigTest { * Set up. */ @BeforeEach - public void setUp() { + void setUp() { SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes"); } @@ -50,7 +50,7 @@ class LegacyConfigTest { * Tear down. */ @AfterEach - public void tearDown() { + void tearDown() { NoopTopicFactories.getSourceFactory().destroy(); NoopTopicFactories.getSinkFactory().destroy(); SystemPersistenceConstants.getManager().setConfigurationDir(null); diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java index 9183403d..fe22c9a2 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -39,7 +39,7 @@ import org.onap.policy.drools.legacy.config.LegacyConfigFeature; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.system.PolicyControllerConstants; -public class RestLegacyConfigTest { +class RestLegacyConfigTest { private static HttpClient client; @@ -47,7 +47,7 @@ public class RestLegacyConfigTest { * Set up. */ @BeforeAll - public static void setUp() throws Exception { + static void setUp() throws Exception { SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes"); HttpServletServerFactoryInstance.getServerFactory().destroy(); @@ -81,7 +81,7 @@ public class RestLegacyConfigTest { * Tear down. */ @AfterAll - public static void tearDown() { + static void tearDown() { LegacyConfigFeature.getLegacyConfig().shutdown(); HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java index 9538cc44..0de170ea 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021-2022 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. @@ -49,7 +49,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** * Lifecycle FSM Test. */ -public class LifecycleFsmTest { +class LifecycleFsmTest { private static final String EXAMPLE_NATIVE_CONTROLLER_POLICY_NAME = "example.controller"; private static final String EXAMPLE_NATIVE_CONTROLLER_POLICY_JSON = @@ -99,7 +99,7 @@ public class LifecycleFsmTest { * Test initialization. */ @BeforeEach - public void beforeTest() throws CoderException, IOException { + void beforeTest() throws CoderException, IOException { LoggerUtils.setLevel(LoggerUtils.ROOT_LOGGER, "INFO"); LoggerUtils.setLevel("org.onap.policy.common.endpoints", "WARN"); LoggerUtils.setLevel("org.onap.policy.drools", "INFO"); @@ -131,7 +131,7 @@ public class LifecycleFsmTest { } @AfterAll - public static void afterClass() { + static void afterClass() { resetExecutionStats(); } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java index 0a9dd41f..ef95a514 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021-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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** * Lifecycle FSM Updates Test. */ -public class LifecycleFsmUpdateTest { +class LifecycleFsmUpdateTest { private static final String EXAMPLE_NATIVE_CONTROLLER_POLICY_NAME = "example.controller"; private static final String EXAMPLE_NATIVE_CONTROLLER_POLICY_JSON = @@ -118,7 +118,7 @@ public class LifecycleFsmUpdateTest { * Set up. */ @BeforeAll - public static void setUp() throws IOException { + static void setUp() throws IOException { LoggerUtils.setLevel(LoggerUtils.ROOT_LOGGER, "INFO"); LoggerUtils.setLevel("org.onap.policy.common.endpoints", "WARN"); LoggerUtils.setLevel("org.onap.policy.drools", "INFO"); @@ -151,7 +151,7 @@ public class LifecycleFsmUpdateTest { * Tear Down. */ @AfterAll - public static void tearDown() throws NoSuchFieldException, IllegalAccessException { + static void tearDown() throws NoSuchFieldException, IllegalAccessException { PolicyControllerConstants.getFactory().destroy(); NoopTopicFactories.getSourceFactory().destroy(); @@ -172,7 +172,7 @@ public class LifecycleFsmUpdateTest { * Test initialization. */ @BeforeEach - public void init() throws CoderException, IOException, NoSuchFieldException, IllegalAccessException { + void init() throws CoderException, IOException, NoSuchFieldException, IllegalAccessException { fsm = new LifecycleFsm() { @Override protected ScheduledExecutorService makeExecutor() { diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java index 81904b3b..a4ccba5c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020-2022 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. @@ -69,7 +69,7 @@ class LifecycleStateActivePoliciesTest extends LifecycleStateRunningTest { * Start tests in the Active state. */ @BeforeEach - public void startActive() throws CoderException { + void startActive() throws CoderException { fsm = makeFsmWithPseudoTime(); fsm.setStatusTimerSeconds(15); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java index 80fe946f..2be5ea5c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2019-2022 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. @@ -60,7 +60,7 @@ class LifecycleStateActiveTest extends LifecycleStateRunningTest { * Start tests in the Active state. */ @BeforeEach - public void startActive() throws CoderException { + void startActive() throws CoderException { fsm = makeFsmWithPseudoTime(); fsm.setStatusTimerSeconds(15); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java index 67e741ac..2fcbf05c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2022 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. @@ -54,7 +54,7 @@ class LifecycleStatePassiveTest extends LifecycleStateRunningTest { * Start tests in the Passive state. */ @BeforeEach - public void startPassive() { + void startPassive() { /* start every test in passive mode */ fsm = makeFsmWithPseudoTime(); fsm.setStatusTimerSeconds(15L); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java index bd7561fd..81bec542 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2022 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. @@ -43,17 +43,17 @@ import org.onap.policy.models.pdp.enums.PdpState; /** * Lifecycle State Terminated Tests. */ -public class LifecycleStateTerminatedTest { +class LifecycleStateTerminatedTest { private LifecycleFsm fsm = new LifecycleFsm(); @BeforeAll - public static void setUp() { + static void setUp() { SystemPersistenceConstants.getManager().setConfigurationDir("src/test/resources"); LoggerUtils.setLevel("org.onap.policy.common.endpoints", "WARN"); } @AfterAll - public static void tearDown() { + static void tearDown() { SystemPersistenceConstants.getManager().setConfigurationDir(null); } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeArtifactControllerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeArtifactControllerTest.java index ae11fd27..dbf8352d 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeArtifactControllerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeArtifactControllerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-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. @@ -57,7 +57,7 @@ class PolicyTypeNativeArtifactControllerTest extends LifecycleStateRunningTest { * Test Set initialization. */ @BeforeEach - public void init() throws IOException, CoderException { + void init() throws IOException, CoderException { fsm = makeFsmWithPseudoTime(); policy = getPolicyFromFile(EXAMPLE_NATIVE_DROOLS_POLICY_JSON, EXAMPLE_NATIVE_DROOLS_POLICY_NAME); nativePolicy = fsm.getDomainMaker().convertTo(policy, NativeArtifactPolicy.class); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java index fe5a3b21..ac8a798f 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -53,7 +53,7 @@ class PolicyTypeNativeDroolsControllerTest extends LifecycleStateRunningTest { * Test initialization. */ @BeforeEach - public void init() { + void init() { fsm = makeFsmWithPseudoTime(); } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java index 675d101a..1554e859 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2022, 2024-2025 Nordix Foundation. + * Modifications Copyright (C) 2022, 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. @@ -107,7 +107,7 @@ public class RestLifecycleManagerTest { * Set up. */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes"); fsm = newFsmInstance(); @@ -158,7 +158,7 @@ public class RestLifecycleManagerTest { * Tear down. */ @AfterEach - public void tearDown() { + void tearDown() { fsm.shutdown(); NoopTopicFactories.getSourceFactory().destroy(); diff --git a/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java b/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java index 22f3f5d1..9e1ddd42 100644 --- a/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java +++ b/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -40,7 +40,7 @@ import org.onap.policy.drools.core.lock.LockCallback; import org.onap.policy.drools.features.PolicyEngineFeatureApi; import org.onap.policy.drools.features.PolicyEngineFeatureApiConstants; -public class NoLockManagerTest { +class NoLockManagerTest { private static NoLockManager nlm; private static LockCallback callback; @@ -49,7 +49,7 @@ public class NoLockManagerTest { * Set up Junits. */ @BeforeAll - public static void setUp() { + static void setUp() { List engineServices = PolicyEngineFeatureApiConstants.getProviders().getList(); assertThat(engineServices).hasSize(1); nlm = (NoLockManager) engineServices.get(0); diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java index b487762a..868ace34 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -77,7 +77,7 @@ import org.slf4j.LoggerFactory; *

The following fields must be set before executing this:

  • SERVER
  • *
  • INTERNAL_TOPIC
  • EXTERNAL_TOPIC
*/ -public class EndToEndFeatureTest { +class EndToEndFeatureTest { private static final Logger logger = LoggerFactory.getLogger(EndToEndFeatureTest.class); @@ -149,7 +149,7 @@ public class EndToEndFeatureTest { * */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { externalSink = TopicEndpointManager.getManager().addTopicSinks(makeSinkProperties(EXTERNAL_TOPIC)).get(0); externalSink.start(); @@ -162,7 +162,7 @@ public class EndToEndFeatureTest { * */ @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { externalSink.stop(); internalSink.stop(); } @@ -171,7 +171,7 @@ public class EndToEndFeatureTest { * Setup. */ @BeforeEach - public void setUp() { + void setUp() { ctx = null; } @@ -179,7 +179,7 @@ public class EndToEndFeatureTest { * Tear down. */ @AfterEach - public void tearDown() { + void tearDown() { if (ctx != null) { ctx.destroy(); } @@ -191,7 +191,7 @@ public class EndToEndFeatureTest { */ @Disabled @Test - public void test_SingleHost() throws Exception { // NOSONAR + void test_SingleHost() throws Exception { // NOSONAR run(70, 1); } @@ -201,7 +201,7 @@ public class EndToEndFeatureTest { */ @Disabled @Test - public void test_TwoHosts() throws Exception { // NOSONAR + void test_TwoHosts() throws Exception { // NOSONAR run(200, 2); } @@ -211,7 +211,7 @@ public class EndToEndFeatureTest { */ @Disabled @Test - public void test_ThreeHosts() throws Exception { // NOSONAR + void test_ThreeHosts() throws Exception { // NOSONAR run(200, 3); } diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java index f4e74375..dede11fa 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020, 2024 Nordix Foundation + * Modifications Copyright (C) 2020, 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. @@ -119,7 +119,7 @@ class FeatureTest { */ @BeforeEach - public void setUp() { + void setUp() { ctx = null; } @@ -128,7 +128,7 @@ class FeatureTest { */ @AfterEach - public void tearDown() { + void tearDown() { if (ctx != null) { ctx.destroy(); } @@ -269,7 +269,7 @@ class FeatureTest { */ public void startHosts() { - hosts.forEach(host -> host.start()); + hosts.forEach(Host::start); } /** @@ -277,7 +277,7 @@ class FeatureTest { */ public void stopHosts() { - hosts.forEach(host -> host.stop()); + hosts.forEach(Host::stop); } /** diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java index f288767d..da37967c 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020, 2024 Nordix Foundation + * Modifications Copyright (C) 2020, 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. @@ -86,10 +86,9 @@ class PoolingFeatureTest { /** * Setup. * - * @throws Exception exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() { props = initProperties(); engine = mock(PolicyEngine.class); controller1 = mock(PolicyController.class); @@ -206,7 +205,7 @@ class PoolingFeatureTest { } @Test - void testBeforeStart() throws Exception { + void testBeforeStart() { assertFalse(pool.beforeStart(controller1)); verify(mgr1).beforeStart(); @@ -470,17 +469,17 @@ class PoolingFeatureTest { } private Properties initProperties() { - Properties props = new Properties(); + Properties initProps = new Properties(); - initProperties(props, "A", 0); - initProperties(props, "B", 1); - initProperties(props, "Exception", 2); + initProperties(initProps, "A", 0); + initProperties(initProps, "B", 1); + initProperties(initProps, "Exception", 2); - props.setProperty("pooling.controllerDisabled.enabled", "false"); + initProps.setProperty("pooling.controllerDisabled.enabled", "false"); - props.setProperty("pooling.controllerException.offline.queue.limit", "INVALID NUMBER"); + initProps.setProperty("pooling.controllerException.offline.queue.limit", "INVALID NUMBER"); - return props; + return initProps; } private void initProperties(Properties props, String suffix, int offset) { diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java index 65b52eb6..7032e929 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -109,10 +109,9 @@ class PoolingManagerImplTest { /** * Setup. * - * @throws Exception throws exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() { Properties plainProps = new Properties(); poolProps = mock(PoolingProperties.class); @@ -183,7 +182,7 @@ class PoolingManagerImplTest { } @Test - void testGetCurrent() throws Exception { + void testGetCurrent() { assertEquals(IdleState.class, mgr.getCurrent().getClass()); startMgr(); @@ -232,7 +231,7 @@ class PoolingManagerImplTest { } @Test - void testAfterStart() throws Exception { + void testAfterStart() { startMgr(); verify(topicMessageManager).startConsumer(mgr); @@ -314,7 +313,7 @@ class PoolingManagerImplTest { } @Test - void testAfterStop() throws Exception { + void testAfterStop() { startMgr(); mgr.beforeStop(); @@ -324,7 +323,7 @@ class PoolingManagerImplTest { } @Test - void testBeforeLock() throws Exception { + void testBeforeLock() { startMgr(); mgr.beforeLock(); @@ -345,7 +344,7 @@ class PoolingManagerImplTest { } @Test - void testAfterUnlock_AliveStarted() throws Exception { + void testAfterUnlock_AliveStarted() { startMgr(); lockMgr(); @@ -355,7 +354,7 @@ class PoolingManagerImplTest { } @Test - void testAfterUnlock_StoppedIdle() throws Exception { + void testAfterUnlock_StoppedIdle() { startMgr(); lockMgr(); @@ -368,7 +367,7 @@ class PoolingManagerImplTest { } @Test - void testAfterUnlock_StoppedStarted() throws Exception { + void testAfterUnlock_StoppedStarted() { startMgr(); // Note: don't lockMgr() @@ -382,7 +381,7 @@ class PoolingManagerImplTest { } @Test - void testChangeState() throws Exception { + void testChangeState() { // start should invoke changeState() startMgr(); @@ -408,7 +407,7 @@ class PoolingManagerImplTest { } @Test - void testSchedule() throws Exception { + void testSchedule() { // must start the scheduler startMgr(); @@ -436,7 +435,7 @@ class PoolingManagerImplTest { } @Test - void testScheduleWithFixedDelay() throws Exception { + void testScheduleWithFixedDelay() { // must start the scheduler startMgr(); @@ -531,7 +530,7 @@ class PoolingManagerImplTest { } @Test - void testBeforeOffer_Unlocked() throws Exception { + void testBeforeOffer_Unlocked() { startMgr(); // route the message to another host @@ -541,7 +540,7 @@ class PoolingManagerImplTest { } @Test - void testBeforeOffer_Locked() throws Exception { + void testBeforeOffer_Locked() { startMgr(); lockMgr(); @@ -552,7 +551,7 @@ class PoolingManagerImplTest { } @Test - void testBeforeInsert() throws Exception { + void testBeforeInsert() { startMgr(); lockMgr(); @@ -563,30 +562,25 @@ class PoolingManagerImplTest { } @Test - void testHandleExternalCommInfrastructureStringStringString_NullReqId() throws Exception { + void testHandleExternalCommInfrastructureStringStringString_NullReqId() { validateHandleReqId(); } @Test - void testHandleExternalCommInfrastructureStringStringString_EmptyReqId() throws Exception { + void testHandleExternalCommInfrastructureStringStringString_EmptyReqId() { validateHandleReqId(); } @Test - void testHandleExternalCommInfrastructureStringStringString_InvalidMsg() throws Exception { + void testHandleExternalCommInfrastructureStringStringString_InvalidMsg() { startMgr(); assertFalse(mgr.beforeInsert(TOPIC2, "invalid message")); } @Test - void testHandleExternalCommInfrastructureStringStringString() throws Exception { - validateUnhandled(); - } - - @Test - void testHandleExternalForward_NoAssignments() throws Exception { - validateUnhandled(); + void testHandleExternalCommInfrastructureStringStringString() { + validateHandleReqId(); } @Test @@ -595,7 +589,7 @@ class PoolingManagerImplTest { } @Test - void testHandleEvent_NullTarget() throws Exception { + void testHandleEvent_NullTarget() { // buckets have null targets validateDiscarded(new BucketAssignments(new String[] {null, null})); } @@ -606,13 +600,13 @@ class PoolingManagerImplTest { } @Test - void testHandleEvent_DiffHost() throws Exception { + void testHandleEvent_DiffHost() { // route the message to the *OTHER* host validateDiscarded(makeAssignments(false)); } @Test - void testDecodeEvent_CannotDecode() throws Exception { + void testDecodeEvent_CannotDecode() { mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) { @Override @@ -632,7 +626,7 @@ class PoolingManagerImplTest { } @Test - void testDecodeEvent_UnsuppEx() throws Exception { + void testDecodeEvent_UnsuppEx() { // generate exception mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) { @@ -653,7 +647,7 @@ class PoolingManagerImplTest { } @Test - void testDecodeEvent_ArgEx() throws Exception { + void testDecodeEvent_ArgEx() { // generate exception mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) { @Override @@ -673,7 +667,7 @@ class PoolingManagerImplTest { } @Test - void testDecodeEvent_StateEx() throws Exception { + void testDecodeEvent_StateEx() { // generate exception mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) { @Override @@ -693,7 +687,7 @@ class PoolingManagerImplTest { } @Test - void testDecodeEvent() throws Exception { + void testDecodeEvent() { startMgr(); when(controller.isLocked()).thenReturn(true); @@ -705,26 +699,7 @@ class PoolingManagerImplTest { } @Test - void testHandleInternal() throws Exception { - startMgr(); - - StartState st = (StartState) mgr.getCurrent(); - - /* - * give it its heart beat, that should cause it to transition to the Query state. - */ - Heartbeat hb = new Heartbeat(mgr.getHost(), st.getHbTimestampMs()); - hb.setChannel(Message.ADMIN); - - String msg = ser.encodeMsg(hb); - - mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg); - - assertInstanceOf(QueryState.class, mgr.getCurrent()); - } - - @Test - void testHandleInternal_IoEx() throws Exception { + void testHandleInternal_IoEx() { startMgr(); mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, "invalid message"); @@ -733,7 +708,7 @@ class PoolingManagerImplTest { } @Test - void testHandleInternal_PoolEx() throws Exception { + void testHandleInternal_PoolEx() { startMgr(); StartState st = (StartState) mgr.getCurrent(); @@ -814,7 +789,7 @@ class PoolingManagerImplTest { } @Test - void testTimerActionRun() throws Exception { + void testTimerActionRun() { // must start the scheduler startMgr(); @@ -837,7 +812,7 @@ class PoolingManagerImplTest { } @Test - void testTimerActionRun_DiffState() throws Exception { + void testTimerActionRun_DiffState() { // must start the scheduler startMgr(); @@ -888,12 +863,7 @@ class PoolingManagerImplTest { verify(topicMessageManager, times(START_PUB)).publish(any()); } - private void validateUnhandled() { - startMgr(); - assertFalse(mgr.beforeInsert(TOPIC2, DECODED_EVENT)); - } - - private void validateDiscarded(BucketAssignments bucketAssignments) throws PoolingFeatureException { + private void validateDiscarded(BucketAssignments bucketAssignments) { startMgr(); // buckets have null targets @@ -952,7 +922,7 @@ class PoolingManagerImplTest { /** * Used to create a mock object that implements both super interfaces. */ - private static interface ListeningController extends TopicListener, PolicyController { + private interface ListeningController extends TopicListener, PolicyController { } diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java index 383e0071..8b47a181 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -65,7 +65,7 @@ public class PoolingPropertiesTest { * @throws Exception throws an exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { plain = makeProperties(); pooling = new PoolingProperties(CONTROLLER, plain); diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java index 82fe3a8f..336f3894 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -63,7 +63,7 @@ class TopicMessageManagerTest { * @throws Exception throws an exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { listener = mock(TopicListener.class); source = mock(TopicSource.class); gotSources = false; diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/IdentificationTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/IdentificationTest.java index dced372d..a7d4bd28 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/IdentificationTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/IdentificationTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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 @@ class IdentificationTest extends SupportMessageWithAssignmentsTester { } @BeforeEach - public void setUp() { + void setUp() { setNullAssignments(false); } diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java index cf2cb695..2e45d039 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -61,10 +61,10 @@ class MessageTest extends SupportBasicMessageTester { @Test void testCheckValidity_InvalidFields() { // null or empty source - expectCheckValidityFailure_NullOrEmpty((msg, value) -> msg.setSource(value)); + expectCheckValidityFailure_NullOrEmpty(Message::setSource); // null or empty channel - expectCheckValidityFailure_NullOrEmpty((msg, value) -> msg.setChannel(value)); + expectCheckValidityFailure_NullOrEmpty(Message::setChannel); } /** diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java index 51e27738..f50d30a2 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -44,6 +44,7 @@ class IdleStateTest extends SupportBasicStateTester { /** * Setup. */ + @Override @BeforeEach public void setUp() throws Exception { super.setUp(); diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java index dbac7619..d67b0c80 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -51,6 +51,7 @@ class ProcessingStateTest extends SupportBasicStateTester { /** * Setup. */ + @Override @BeforeEach public void setUp() throws Exception { super.setUp(); diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java index cfae6f3c..bc1b7293 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -50,6 +50,7 @@ class StateTest extends SupportBasicStateTester { /** * Setup. */ + @Override @BeforeEach public void setUp() throws Exception { super.setUp(); @@ -84,7 +85,7 @@ class StateTest extends SupportBasicStateTester { int initDelay = 200; /* - * Create three tasks tasks. + * Create three tasks. */ StateTimerTask task1 = mock(StateTimerTask.class); diff --git a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionAdditionalTest.java b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionAdditionalTest.java index f567c593..bd7f2f9a 100644 --- a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionAdditionalTest.java +++ b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionAdditionalTest.java @@ -3,7 +3,7 @@ * feature-test-transaction * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -78,7 +78,7 @@ class TestTransactionAdditionalTest { * Initialize objects for each test. */ @BeforeEach - public void setUp() { + void setUp() { theThread = mock(Thread.class); controller = mock(PolicyController.class); controller2 = mock(PolicyController.class); diff --git a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionFeatureTest.java b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionFeatureTest.java index a7b213bb..8f93efcf 100644 --- a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionFeatureTest.java +++ b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -41,19 +41,19 @@ class TestTransactionFeatureTest { private AtomicInteger unregCount; private TestTransaction mgr; private DroolsController drools; - private PolicyController ctlr; + private PolicyController controller; private TestTransactionFeature feat; /** * Initialize objects for each test. */ @BeforeEach - public void setUp() { + void setUp() { regCount = new AtomicInteger(0); unregCount = new AtomicInteger(0); mgr = mock(TestTransaction.class); drools = mock(DroolsController.class); - ctlr = mock(PolicyController.class); + controller = mock(PolicyController.class); feat = new TestTransactionFeature() { @Override @@ -62,17 +62,17 @@ class TestTransactionFeatureTest { } }; - when(ctlr.getDrools()).thenReturn(drools); + when(controller.getDrools()).thenReturn(drools); doAnswer(args -> { regCount.incrementAndGet(); return null; - }).when(mgr).register(ctlr); + }).when(mgr).register(controller); doAnswer(args -> { unregCount.incrementAndGet(); return null; - }).when(mgr).unregister(ctlr); + }).when(mgr).unregister(controller); } @Test @@ -114,53 +114,53 @@ class TestTransactionFeatureTest { * @param method method to invoke */ private void checkCombos(AtomicInteger counter, Function method) { - when(ctlr.isAlive()).thenReturn(true); - when(ctlr.isLocked()).thenReturn(true); + when(controller.isAlive()).thenReturn(true); + when(controller.isLocked()).thenReturn(true); when(drools.isBrained()).thenReturn(true); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(true); - when(ctlr.isLocked()).thenReturn(true); + when(controller.isAlive()).thenReturn(true); + when(controller.isLocked()).thenReturn(true); when(drools.isBrained()).thenReturn(false); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); // this is the only one that should cause it to register - when(ctlr.isAlive()).thenReturn(true); - when(ctlr.isLocked()).thenReturn(false); + when(controller.isAlive()).thenReturn(true); + when(controller.isLocked()).thenReturn(false); when(drools.isBrained()).thenReturn(true); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(1, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(true); - when(ctlr.isLocked()).thenReturn(false); + when(controller.isAlive()).thenReturn(true); + when(controller.isLocked()).thenReturn(false); when(drools.isBrained()).thenReturn(false); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(false); - when(ctlr.isLocked()).thenReturn(true); + when(controller.isAlive()).thenReturn(false); + when(controller.isLocked()).thenReturn(true); when(drools.isBrained()).thenReturn(true); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(false); - when(ctlr.isLocked()).thenReturn(true); + when(controller.isAlive()).thenReturn(false); + when(controller.isLocked()).thenReturn(true); when(drools.isBrained()).thenReturn(false); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(false); - when(ctlr.isLocked()).thenReturn(false); + when(controller.isAlive()).thenReturn(false); + when(controller.isLocked()).thenReturn(false); when(drools.isBrained()).thenReturn(true); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(false); - when(ctlr.isLocked()).thenReturn(false); + when(controller.isAlive()).thenReturn(false); + when(controller.isLocked()).thenReturn(false); when(drools.isBrained()).thenReturn(false); - assertFalse(method.apply(ctlr)); + assertFalse(method.apply(controller)); assertEquals(0, counter.getAndSet(0)); } @@ -171,12 +171,12 @@ class TestTransactionFeatureTest { * @param method method to invoke */ private void checkSimple(AtomicInteger counter, Function method) { - when(ctlr.isAlive()).thenReturn(true); - assertFalse(method.apply(ctlr)); + when(controller.isAlive()).thenReturn(true); + assertFalse(method.apply(controller)); assertEquals(1, counter.getAndSet(0)); - when(ctlr.isAlive()).thenReturn(false); - assertFalse(method.apply(ctlr)); + when(controller.isAlive()).thenReturn(false); + assertFalse(method.apply(controller)); assertEquals(1, counter.getAndSet(0)); } } diff --git a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionTest.java b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionTest.java index a1fd2738..65174ba2 100644 --- a/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionTest.java +++ b/feature-test-transaction/src/test/java/org/onap/policy/drools/testtransaction/TestTransactionTest.java @@ -3,7 +3,7 @@ * feature-test-transaction * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -21,11 +21,9 @@ package org.onap.policy.drools.testtransaction; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -61,7 +59,7 @@ public class TestTransactionTest { * */ @BeforeAll - public static void startUp() { + static void startUp() { logger.info("enter"); cleanUpWorkingDir(); diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java index d6804b60..42e6b579 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java @@ -3,7 +3,7 @@ * policy-core * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -48,7 +48,7 @@ import org.onap.policy.drools.util.KieUtils; * PolicySession * PolicySessionFeatureAPI */ -public class DroolsContainerTest { +class DroolsContainerTest { private static final long TIMEOUT_SEC = 5; @@ -58,7 +58,7 @@ public class DroolsContainerTest { * version. */ @BeforeAll - public static void setUp() throws Exception { + static void setUp() throws Exception { KieUtils.installArtifact( Paths.get("src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml").toFile(), Paths.get("src/test/resources/drools-artifact-1.1/pom.xml").toFile(), diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java index 6f07a34f..da546a48 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java @@ -51,7 +51,7 @@ class PolicySessionTest { * Initialize test objects. */ @BeforeEach - public void setUp() { + void setUp() { container = mock(PolicyContainer.class); kie = mock(KieSession.class); diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java index 6bd994be..b1979ddf 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -33,7 +33,7 @@ class PdpJmxTest { private PdpJmx jmx; @BeforeEach - public void setUp() { + void setUp() { jmx = new PdpJmx(); } diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java index 02c3fead..bde37f0f 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test; class AlwaysFailLockTest extends AlwaysLockBaseTest { @BeforeEach - public void setUp() { + void setUp() { callback = mock(LockCallback.class); lock = new AlwaysFailLock(RESOURCE, OWNER_KEY, HOLD_SEC, callback); } diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysSuccessLockTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysSuccessLockTest.java index 0104d0a8..eee91632 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysSuccessLockTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysSuccessLockTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; class AlwaysSuccessLockTest extends AlwaysLockBaseTest { @BeforeEach - public void setUp() { + void setUp() { callback = mock(LockCallback.class); lock = new AlwaysSuccessLock(RESOURCE, OWNER_KEY, HOLD_SEC, callback); } diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java index f16d9c4e..b36cf96a 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -59,7 +59,7 @@ class LockImplTest { * Populates {@link #lock}. */ @BeforeEach - public void setUp() { + void setUp() { callback = mock(LockCallback.class); lock = new LockImpl(STATE, RESOURCE, OWNER_KEY, HOLD_SEC, callback); diff --git a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java index 7089fdad..2c6f6c56 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -44,7 +44,7 @@ import org.kie.api.runtime.KieSession; /** * Kie Utils Tests. */ -public class KieUtilsTest { +class KieUtilsTest { private static KieContainer container; private static KieSession session; @@ -53,7 +53,7 @@ public class KieUtilsTest { * Test class initialization. */ @BeforeAll - public static void createArtifact() throws Exception { + static void createArtifact() throws Exception { ReleaseId releaseId = KieUtils.installArtifact( Paths.get("src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml").toFile(), diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java index dc6212b3..a7773e04 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020,2022 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. @@ -63,7 +63,7 @@ class DomainPolicyTypesTest { private StandardCoder nonValCoder; @BeforeEach - public void setUp() { + void setUp() { domainMaker = new DomainMaker(); nonValCoder = new StandardCoder(); } diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java index 8168e75a..c1e283ac 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -49,7 +49,7 @@ class OperationalPolicyTest { private StandardCoder nonValCoder; @BeforeEach - public void setUp() { + void setUp() { domainMaker = new DomainMaker(); nonValCoder = new StandardCoder(); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java index 877489d8..5e24c2b0 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java +++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023-2024 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. @@ -195,7 +195,7 @@ class MavenDroolsController2Test { * Initializes objects, including the drools controller. */ @BeforeEach - public void setUp() { + void setUp() { autoCloseable = MockitoAnnotations.openMocks(this); lenient().when(droolsProviders.getList()).thenReturn(List.of(prov1, prov2)); diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerTest.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerTest.java index fbaf8433..20bba50e 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -54,7 +54,7 @@ public class MavenDroolsControllerTest { * @throws IOException throws an IO exception */ @BeforeAll - public static void setUpBeforeClass() throws IOException { + static void setUpBeforeClass() throws IOException { releaseId = KieUtils.installArtifact(Paths.get(JUNIT_ECHO_KMODULE_PATH).toFile(), Paths.get(JUNIT_ECHO_KMODULE_POM_PATH).toFile(), @@ -63,7 +63,7 @@ public class MavenDroolsControllerTest { } @BeforeEach - public void setUp() { + void setUp() { running = new CountDownLatch(1); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java index 753296a8..3b7ee340 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -96,7 +96,7 @@ public class MavenDroolsControllerUpgradesTest { * Test Class Initialization. */ @BeforeAll - public static void setUpBeforeClass() throws IOException { + static void setUpBeforeClass() throws IOException { Path path = Paths.get(DROOLS_RESOURCES_DIR + "rules1" + DRL_EXT); rulesDescriptor1 = install("rules1", @@ -116,7 +116,7 @@ public class MavenDroolsControllerUpgradesTest { * Creates a controller before each test. */ @BeforeEach - public void beforeTest() { + void beforeTest() { controller = new MavenDroolsController( rulesDescriptor1.getGroupId(), rulesDescriptor1.getArtifactId(), rulesDescriptor1.getVersion(), @@ -127,7 +127,7 @@ public class MavenDroolsControllerUpgradesTest { * Shuts down the controller after each test. */ @AfterEach - public void afterTest() { + void afterTest() { if (controller != null) { controller.halt(); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/persistence/SystemPersistenceTest.java b/policy-management/src/test/java/org/onap/policy/drools/persistence/SystemPersistenceTest.java index b6a9ce52..85163279 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/persistence/SystemPersistenceTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/persistence/SystemPersistenceTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -44,7 +44,7 @@ import org.onap.policy.drools.properties.DroolsPropertyConstants; * (File) System Persistence Tests. */ @TestMethodOrder(MethodOrderer.MethodName.class) -public class SystemPersistenceTest { +class SystemPersistenceTest { /** * sample configuration dir. */ @@ -126,12 +126,12 @@ public class SystemPersistenceTest { private static final String SYSTEM_PROPS_FILE = SYSTEM_PROPS + "-system.properties"; @BeforeAll - public static void setUp() throws IOException { + static void setUp() throws IOException { cleanUpWorkingDirs(); } @AfterAll - public static void tearDown() throws IOException { + static void tearDown() throws IOException { cleanUpWorkingDirs(); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java index 4df04d9c..aa8c0301 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2021-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -85,7 +85,7 @@ public class ProtocolCoderToolsetTest { * Test Class Initialization. */ @BeforeAll - public static void setUpClass() throws IOException { + static void setUpClass() throws IOException { releaseId = KieUtils.installArtifact(Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_PATH).toFile(), Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_POM_PATH).toFile(), MavenDroolsControllerTest.JUNIT_ECHO_KJAR_DRL_PATH, @@ -96,7 +96,7 @@ public class ProtocolCoderToolsetTest { * Test Set Up. */ @BeforeEach - public void setUp() { + void setUp() { controller = createController(); } @@ -104,7 +104,7 @@ public class ProtocolCoderToolsetTest { * Test Termination. */ @AfterEach - public void tearDown() { + void tearDown() { if (controller != null) { DroolsControllerConstants.getFactory().destroy(controller); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java index cb92b2ef..d8ffeffc 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java @@ -3,7 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -70,7 +70,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @TestMethodOrder(MethodOrderer.DisplayName.class) -public class RestManagerTest { +class RestManagerTest { private static final int DEFAULT_TELEMETRY_PORT = 7887; private static final String HOST = "localhost"; private static final String REST_MANAGER_PATH = "/policy/pdp"; @@ -101,7 +101,7 @@ public class RestManagerTest { * @throws IOException throws an IO exception */ @BeforeAll - public static void setUp() throws IOException, InterruptedException { + static void setUp() throws IOException, InterruptedException { cleanUpWorkingDirs(); SystemPersistenceConstants.getManager().setConfigurationDir(null); @@ -158,7 +158,7 @@ public class RestManagerTest { * @throws IOException IO exception */ @AfterAll - public static void tearDown() throws IOException { + static void tearDown() throws IOException { try { client.close(); } catch (IOException ex) { diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyControllerFactoryTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyControllerFactoryTest.java index 8a388dfc..2af4956e 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyControllerFactoryTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyControllerFactoryTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -81,7 +81,7 @@ class PolicyControllerFactoryTest { * Initializes the object to be tested. */ @BeforeEach - public void setUp() { + void setUp() { controller = mock(PolicyController.class); controller2 = mock(PolicyController.class); properties = new Properties(); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java index 63a96b06..857154d2 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023-2025 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. @@ -163,7 +163,7 @@ class PolicyEngineManagerTest { * @throws Exception if an error occurs */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { registry = PrometheusRegistry.defaultRegistry; registry.clear(); properties = new Properties(); @@ -330,7 +330,7 @@ class PolicyEngineManagerTest { } @AfterEach - public void tearDown() { + void tearDown() { PrometheusRegistry.defaultRegistry.clear(); } @@ -1411,7 +1411,7 @@ class PolicyEngineManagerTest { } @Test - public void testTransaction() { + void testTransaction() { mgr.metric(CONTROLLER1, POLICY, new Metric()); assertEquals(0, mgr.getStats().getGroupStat().getPolicyExecutedCount()); assertEquals(0, mgr.getStats().getSubgroupStats().size()); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java index 02774e17..d7c60b3e 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -96,7 +96,7 @@ class AggregatedPolicyControllerTest { * Initializes the object to be tested. */ @BeforeEach - public void setUp() { + void setUp() { properties = new Properties(); source1 = mock(TopicSource.class); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java index 47d0f275..bf5cb6c4 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -64,7 +64,7 @@ class LockManagerTest { * Resets fields and creates {@link #mgr}. */ @BeforeEach - public void setUp() { + void setUp() { closeable = MockitoAnnotations.openMocks(this); doAnswer(args -> { @@ -76,7 +76,7 @@ class LockManagerTest { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { closeable.close(); } diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java index 8fbf237f..8b577b34 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020 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. @@ -49,7 +49,7 @@ class DomainMakerTest { private DomainMaker domainMaker; @BeforeEach - public void setUp() { + void setUp() { domainMaker = new DomainMaker(); } diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/StandardValCoderTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/StandardValCoderTest.java index 43f537ed..e36dab56 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/policies/StandardValCoderTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/StandardValCoderTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation + * Modifications Copyright (C) 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. @@ -64,7 +64,7 @@ class StandardValCoderTest { } @BeforeEach - public void testSetUp() { + void testSetUp() { jsonSchema = getJson("src/test/resources/coder/test.schema.json"); validJson = getJson("src/test/resources/coder/valid.json"); missingReqJson = getJson("src/test/resources/coder/missing-required.json"); diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java index bec22237..4a5441ae 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation. + * Modifications Copyright (C) 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. @@ -44,7 +44,7 @@ import org.onap.policy.common.utils.security.CryptoUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PropertyUtilTest { +class PropertyUtilTest { /* * Note: to generate the encrypted values, invoke CryptoUtils passing both the value * to be encrypted and the crypto key. @@ -90,7 +90,7 @@ public class PropertyUtilTest { * Test Setup -- Create a directory for temporary files. */ @BeforeAll - public static void setup() { + static void setup() { logger.info("setup: creating a temporary directory"); // create a directory for temporary files @@ -103,7 +103,7 @@ public class PropertyUtilTest { * Test Cleanup -- Remove temporary files. */ @AfterAll - public static void teardown() { + static void teardown() { logger.info("teardown: remove the temporary directory"); // the assumption is that we only have one level of temporary files diff --git a/pom.xml b/pom.xml index 951fb44c..bdedaf66 100644 --- a/pom.xml +++ b/pom.xml @@ -118,6 +118,16 @@ awaitility test + + org.apache.maven + maven-core + 3.8.6 + + + org.apache.maven + maven-compat + 3.8.6 + -- 2.16.6