* 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.
@Test
void testServiceApis() {
assertTrue(new OrderedServiceImpl<>(PolicyEngineFeatureApi.class).getList().stream()
- .anyMatch(obj -> obj instanceof DistributedLockManager));
+ .anyMatch(DistributedLockManager.class::isInstance));
}
@Test
* 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.
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";
* 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");
* Tear down.
*/
@AfterAll
- public static void teardown() {
+ static void teardown() {
PolicyControllerConstants.getFactory().destroy();
HttpClientFactoryInstance.getClientFactory().destroy();
HttpServletServerFactoryInstance.getServerFactory().destroy();
* 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.
* Initializes the object to be tested.
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
properties = new Properties();
mocks();
* 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.
/**
* REST Healthcheck Tests.
*/
-public class RestHealthCheckTest {
+class RestHealthCheckTest {
private static HttpClientFactory clientFactory;
private static PolicyControllerFactory controllerFactory;
*/
@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");
*/
@AfterAll
- public static void tearDown() {
+ static void tearDown() {
HttpClientFactoryInstance.getClientFactory().destroy();
HttpServletServerFactoryInstance.getServerFactory().destroy();
}
* 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.
* Set up.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
configF = new LegacyConfigFeature();
}
* Tear down.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
NoopTopicFactories.getSourceFactory().destroy();
NoopTopicFactories.getSinkFactory().destroy();
SystemPersistenceConstants.getManager().setConfigurationDir(null);
* 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.
* Set up.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
}
* Tear down.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
NoopTopicFactories.getSourceFactory().destroy();
NoopTopicFactories.getSinkFactory().destroy();
SystemPersistenceConstants.getManager().setConfigurationDir(null);
/*
* ============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.
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
import org.onap.policy.drools.system.PolicyControllerConstants;
-public class RestLegacyConfigTest {
+class RestLegacyConfigTest {
private static HttpClient client;
* Set up.
*/
@BeforeAll
- public static void setUp() throws Exception {
+ static void setUp() throws Exception {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
HttpServletServerFactoryInstance.getServerFactory().destroy();
* Tear down.
*/
@AfterAll
- public static void tearDown() {
+ static void tearDown() {
LegacyConfigFeature.getLegacyConfig().shutdown();
HttpClientFactoryInstance.getClientFactory().destroy();
HttpServletServerFactoryInstance.getServerFactory().destroy();
/*
* ============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.
/**
* 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 =
* 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");
}
@AfterAll
- public static void afterClass() {
+ static void afterClass() {
resetExecutionStats();
}
/*
* ============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.
/**
* 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 =
* 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");
* Tear Down.
*/
@AfterAll
- public static void tearDown() throws NoSuchFieldException, IllegalAccessException {
+ static void tearDown() throws NoSuchFieldException, IllegalAccessException {
PolicyControllerConstants.getFactory().destroy();
NoopTopicFactories.getSourceFactory().destroy();
* 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() {
/*
* ============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.
* Start tests in the Active state.
*/
@BeforeEach
- public void startActive() throws CoderException {
+ void startActive() throws CoderException {
fsm = makeFsmWithPseudoTime();
fsm.setStatusTimerSeconds(15);
/*
* ============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.
* Start tests in the Active state.
*/
@BeforeEach
- public void startActive() throws CoderException {
+ void startActive() throws CoderException {
fsm = makeFsmWithPseudoTime();
fsm.setStatusTimerSeconds(15);
* 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.
* Start tests in the Passive state.
*/
@BeforeEach
- public void startPassive() {
+ void startPassive() {
/* start every test in passive mode */
fsm = makeFsmWithPseudoTime();
fsm.setStatusTimerSeconds(15L);
* 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.
/**
* 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);
}
* 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.
* 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);
/*
* ============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.
* Test initialization.
*/
@BeforeEach
- public void init() {
+ void init() {
fsm = makeFsmWithPseudoTime();
}
/*-
* ============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.
* Set up.
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
fsm = newFsmInstance();
* Tear down.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
fsm.shutdown();
NoopTopicFactories.getSourceFactory().destroy();
* 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.
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;
* Set up Junits.
*/
@BeforeAll
- public static void setUp() {
+ static void setUp() {
List<PolicyEngineFeatureApi> engineServices = PolicyEngineFeatureApiConstants.getProviders().getList();
assertThat(engineServices).hasSize(1);
nlm = (NoLockManager) engineServices.get(0);
* 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.
* <p>The following fields must be set before executing this: <ul> <li>SERVER</li>
* <li>INTERNAL_TOPIC</li> <li>EXTERNAL_TOPIC</li> </ul>
*/
-public class EndToEndFeatureTest {
+class EndToEndFeatureTest {
private static final Logger logger = LoggerFactory.getLogger(EndToEndFeatureTest.class);
*
*/
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
externalSink = TopicEndpointManager.getManager().addTopicSinks(makeSinkProperties(EXTERNAL_TOPIC)).get(0);
externalSink.start();
*
*/
@AfterAll
- public static void tearDownAfterClass() {
+ static void tearDownAfterClass() {
externalSink.stop();
internalSink.stop();
}
* Setup.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
ctx = null;
}
* Tear down.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
if (ctx != null) {
ctx.destroy();
}
*/
@Disabled
@Test
- public void test_SingleHost() throws Exception { // NOSONAR
+ void test_SingleHost() throws Exception { // NOSONAR
run(70, 1);
}
*/
@Disabled
@Test
- public void test_TwoHosts() throws Exception { // NOSONAR
+ void test_TwoHosts() throws Exception { // NOSONAR
run(200, 2);
}
*/
@Disabled
@Test
- public void test_ThreeHosts() throws Exception { // NOSONAR
+ void test_ThreeHosts() throws Exception { // NOSONAR
run(200, 3);
}
* 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.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
ctx = null;
}
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
if (ctx != null) {
ctx.destroy();
}
*/
public void startHosts() {
- hosts.forEach(host -> host.start());
+ hosts.forEach(Host::start);
}
/**
*/
public void stopHosts() {
- hosts.forEach(host -> host.stop());
+ hosts.forEach(Host::stop);
}
/**
* 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.
/**
* Setup.
*
- * @throws Exception exception
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
props = initProperties();
engine = mock(PolicyEngine.class);
controller1 = mock(PolicyController.class);
}
@Test
- void testBeforeStart() throws Exception {
+ void testBeforeStart() {
assertFalse(pool.beforeStart(controller1));
verify(mgr1).beforeStart();
}
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) {
* 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.
/**
* Setup.
*
- * @throws Exception throws exception
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
Properties plainProps = new Properties();
poolProps = mock(PoolingProperties.class);
}
@Test
- void testGetCurrent() throws Exception {
+ void testGetCurrent() {
assertEquals(IdleState.class, mgr.getCurrent().getClass());
startMgr();
}
@Test
- void testAfterStart() throws Exception {
+ void testAfterStart() {
startMgr();
verify(topicMessageManager).startConsumer(mgr);
}
@Test
- void testAfterStop() throws Exception {
+ void testAfterStop() {
startMgr();
mgr.beforeStop();
}
@Test
- void testBeforeLock() throws Exception {
+ void testBeforeLock() {
startMgr();
mgr.beforeLock();
}
@Test
- void testAfterUnlock_AliveStarted() throws Exception {
+ void testAfterUnlock_AliveStarted() {
startMgr();
lockMgr();
}
@Test
- void testAfterUnlock_StoppedIdle() throws Exception {
+ void testAfterUnlock_StoppedIdle() {
startMgr();
lockMgr();
}
@Test
- void testAfterUnlock_StoppedStarted() throws Exception {
+ void testAfterUnlock_StoppedStarted() {
startMgr();
// Note: don't lockMgr()
}
@Test
- void testChangeState() throws Exception {
+ void testChangeState() {
// start should invoke changeState()
startMgr();
}
@Test
- void testSchedule() throws Exception {
+ void testSchedule() {
// must start the scheduler
startMgr();
}
@Test
- void testScheduleWithFixedDelay() throws Exception {
+ void testScheduleWithFixedDelay() {
// must start the scheduler
startMgr();
}
@Test
- void testBeforeOffer_Unlocked() throws Exception {
+ void testBeforeOffer_Unlocked() {
startMgr();
// route the message to another host
}
@Test
- void testBeforeOffer_Locked() throws Exception {
+ void testBeforeOffer_Locked() {
startMgr();
lockMgr();
}
@Test
- void testBeforeInsert() throws Exception {
+ void testBeforeInsert() {
startMgr();
lockMgr();
}
@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
}
@Test
- void testHandleEvent_NullTarget() throws Exception {
+ void testHandleEvent_NullTarget() {
// buckets have null targets
validateDiscarded(new BucketAssignments(new String[] {null, null}));
}
}
@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
}
@Test
- void testDecodeEvent_UnsuppEx() throws Exception {
+ void testDecodeEvent_UnsuppEx() {
// generate exception
mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) {
}
@Test
- void testDecodeEvent_ArgEx() throws Exception {
+ void testDecodeEvent_ArgEx() {
// generate exception
mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) {
@Override
}
@Test
- void testDecodeEvent_StateEx() throws Exception {
+ void testDecodeEvent_StateEx() {
// generate exception
mgr = new PoolingManagerTest(MY_HOST, controller, poolProps, active) {
@Override
}
@Test
- void testDecodeEvent() throws Exception {
+ void testDecodeEvent() {
startMgr();
when(controller.isLocked()).thenReturn(true);
}
@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");
}
@Test
- void testHandleInternal_PoolEx() throws Exception {
+ void testHandleInternal_PoolEx() {
startMgr();
StartState st = (StartState) mgr.getCurrent();
}
@Test
- void testTimerActionRun() throws Exception {
+ void testTimerActionRun() {
// must start the scheduler
startMgr();
}
@Test
- void testTimerActionRun_DiffState() throws Exception {
+ void testTimerActionRun_DiffState() {
// must start the scheduler
startMgr();
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
/**
* Used to create a mock object that implements both super interfaces.
*/
- private static interface ListeningController extends TopicListener, PolicyController {
+ private interface ListeningController extends TopicListener, PolicyController {
}
* 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.
* @throws Exception throws an exception
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
plain = makeProperties();
pooling = new PoolingProperties(CONTROLLER, plain);
* 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.
* @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;
* 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.
}
@BeforeEach
- public void setUp() {
+ void setUp() {
setNullAssignments(false);
}
* 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.
}
@BeforeEach
- public void setUp() {
+ void setUp() {
setNullAssignments(false);
}
* 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.
@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);
}
/**
* 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.
/**
* Setup.
*/
+ @Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
* 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.
/**
* Setup.
*/
+ @Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
* 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.
/**
* Setup.
*/
+ @Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
int initDelay = 200;
/*
- * Create three tasks tasks.
+ * Create three tasks.
*/
StateTimerTask task1 = mock(StateTimerTask.class);
* 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.
* Initialize objects for each test.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
theThread = mock(Thread.class);
controller = mock(PolicyController.class);
controller2 = mock(PolicyController.class);
* 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.
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
}
};
- 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
* @param method method to invoke
*/
private void checkCombos(AtomicInteger counter, Function<PolicyController, Boolean> 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));
}
* @param method method to invoke
*/
private void checkSimple(AtomicInteger counter, Function<PolicyController, Boolean> 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));
}
}
* 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.
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;
*
*/
@BeforeAll
- public static void startUp() {
+ static void startUp() {
logger.info("enter");
cleanUpWorkingDir();
* 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.
* PolicySession
* PolicySessionFeatureAPI
*/
-public class DroolsContainerTest {
+class DroolsContainerTest {
private static final long TIMEOUT_SEC = 5;
* 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(),
* Initialize test objects.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
container = mock(PolicyContainer.class);
kie = mock(KieSession.class);
* 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.
private PdpJmx jmx;
@BeforeEach
- public void setUp() {
+ void setUp() {
jmx = new PdpJmx();
}
* 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.
class AlwaysFailLockTest extends AlwaysLockBaseTest<AlwaysFailLock> {
@BeforeEach
- public void setUp() {
+ void setUp() {
callback = mock(LockCallback.class);
lock = new AlwaysFailLock(RESOURCE, OWNER_KEY, HOLD_SEC, callback);
}
* 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.
class AlwaysSuccessLockTest extends AlwaysLockBaseTest<AlwaysSuccessLock> {
@BeforeEach
- public void setUp() {
+ void setUp() {
callback = mock(LockCallback.class);
lock = new AlwaysSuccessLock(RESOURCE, OWNER_KEY, HOLD_SEC, callback);
}
* 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.
* Populates {@link #lock}.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
callback = mock(LockCallback.class);
lock = new LockImpl(STATE, RESOURCE, OWNER_KEY, HOLD_SEC, callback);
* 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.
/**
* Kie Utils Tests.
*/
-public class KieUtilsTest {
+class KieUtilsTest {
private static KieContainer container;
private static KieSession session;
* 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(),
/*
* ============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.
private StandardCoder nonValCoder;
@BeforeEach
- public void setUp() {
+ void setUp() {
domainMaker = new DomainMaker();
nonValCoder = new StandardCoder();
}
* 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.
private StandardCoder nonValCoder;
@BeforeEach
- public void setUp() {
+ void setUp() {
domainMaker = new DomainMaker();
nonValCoder = new StandardCoder();
}
* 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.
* 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));
* 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.
* @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(),
}
@BeforeEach
- public void setUp() {
+ void setUp() {
running = new CountDownLatch(1);
}
* 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.
* 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",
* Creates a controller before each test.
*/
@BeforeEach
- public void beforeTest() {
+ void beforeTest() {
controller =
new MavenDroolsController(
rulesDescriptor1.getGroupId(), rulesDescriptor1.getArtifactId(), rulesDescriptor1.getVersion(),
* Shuts down the controller after each test.
*/
@AfterEach
- public void afterTest() {
+ void afterTest() {
if (controller != null) {
controller.halt();
}
* 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.
* (File) System Persistence Tests.
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
-public class SystemPersistenceTest {
+class SystemPersistenceTest {
/**
* sample configuration dir.
*/
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();
}
* 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.
* 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,
* Test Set Up.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
controller = createController();
}
* Test Termination.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
if (controller != null) {
DroolsControllerConstants.getFactory().destroy(controller);
}
* 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.
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";
* @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);
* @throws IOException IO exception
*/
@AfterAll
- public static void tearDown() throws IOException {
+ static void tearDown() throws IOException {
try {
client.close();
} catch (IOException ex) {
* 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.
* Initializes the object to be tested.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
controller = mock(PolicyController.class);
controller2 = mock(PolicyController.class);
properties = new Properties();
* 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.
* @throws Exception if an error occurs
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
registry = PrometheusRegistry.defaultRegistry;
registry.clear();
properties = new Properties();
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
PrometheusRegistry.defaultRegistry.clear();
}
}
@Test
- public void testTransaction() {
+ void testTransaction() {
mgr.metric(CONTROLLER1, POLICY, new Metric());
assertEquals(0, mgr.getStats().getGroupStat().getPolicyExecutedCount());
assertEquals(0, mgr.getStats().getSubgroupStats().size());
* 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.
* Initializes the object to be tested.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
properties = new Properties();
source1 = mock(TopicSource.class);
* 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.
* Resets fields and creates {@link #mgr}.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
closeable = MockitoAnnotations.openMocks(this);
doAnswer(args -> {
}
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
closeable.close();
}
/*
* ============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.
private DomainMaker domainMaker;
@BeforeEach
- public void setUp() {
+ void setUp() {
domainMaker = new DomainMaker();
}
/*
* ============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.
}
@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");
* 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.
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.
* 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
* 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
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>3.8.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-compat</artifactId>
+ <version>3.8.6</version>
+ </dependency>
</dependencies>
<dependencyManagement>