* ONAP
* ================================================================================
* Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* 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.pooling;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
/**
* UEB servers for both internal & external topics.
*/
- private static final String UEB_SERVERS = "";
+ private static final String UEB_SERVERS = "ueb-server";
/**
* Name of the topic used for inter-host communication.
*/
- private static final String INTERNAL_TOPIC = "";
+ private static final String INTERNAL_TOPIC = "internal-topic";
/**
* Name of the topic from which "external" events "arrive".
*/
- private static final String EXTERNAL_TOPIC = "";
+ private static final String EXTERNAL_TOPIC = "external-topic";
/**
* Consumer group to use when polling the external topic.
* Setup before class.
*
*/
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
externalSink = TopicEndpointManager.getManager().addTopicSinks(makeSinkProperties(EXTERNAL_TOPIC)).get(0);
externalSink.start();
* Tear down after class.
*
*/
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() {
externalSink.stop();
internalSink.stop();
/**
* Setup.
*/
- @Before
+ @BeforeEach
public void setUp() {
ctx = null;
}
/**
* Tear down.
*/
- @After
+ @AfterEach
public void tearDown() {
if (ctx != null) {
ctx.destroy();
}
/*
- * This test should only be run manually, after configuring all of the fields,
+ * This test should only be run manually, after configuring all the fields,
* thus it is ignored.
*/
- @Ignore
+ @Disabled
@Test
public void test_SingleHost() throws Exception { // NOSONAR
run(70, 1);
}
/*
- * This test should only be run manually, after configuring all of the fields,
+ * This test should only be run manually, after configuring all the fields,
* thus it is ignored.
*/
- @Ignore
+ @Disabled
@Test
public void test_TwoHosts() throws Exception { // NOSONAR
run(200, 2);
}
/*
- * This test should only be run manually, after configuring all of the fields,
+ * This test should only be run manually, after configuring all the fields,
* thus it is ignored.
*/
- @Ignore
+ @Disabled
@Test
public void test_ThreeHosts() throws Exception { // NOSONAR
run(200, 3);
public void checkAllSawAMsg() {
int msgs = 0;
for (Host host : hosts) {
- assertTrue("msgs=" + msgs, host.messageSeen());
+ assertTrue(host.messageSeen(), "msgs=" + msgs);
++msgs;
}
}
}
@Override
- protected DmaapManager makeDmaapManager(String topic) throws PoolingFeatureException {
- return new DmaapManagerImpl(topic);
+ protected TopicMessageManager makeTopicMessagesManager(String topic) throws PoolingFeatureException {
+ return new TopicMessageManagerImpl(topic);
}
@Override
/**
* DMaaP Manager with overrides.
*/
- private static class DmaapManagerImpl extends DmaapManager {
+ private static class TopicMessageManagerImpl extends TopicMessageManager {
/**
* Constructor.
* @param topic the topic
* @throws PoolingFeatureException if an error occurs
*/
- public DmaapManagerImpl(String topic) throws PoolingFeatureException {
+ public TopicMessageManagerImpl(String topic) throws PoolingFeatureException {
super(topic);
}