ARTEMIS-3523 Small tweaks into AddressControl delegation

This commit is contained in:
Clebert Suconic 2021-10-21 13:19:39 -04:00
parent ebf8adc72b
commit fdc0cc591c
2 changed files with 13 additions and 8 deletions

View File

@ -84,7 +84,7 @@ public class ReplayManager {
} }
} }
private void actualReplay(Date start, Date end, String sourceAddress, String targetAddress, String filterStr) throws Exception { private void actualReplay(Date start, Date end, String sourceAddress, String targetAddressParameter, String filterStr) throws Exception {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Replay::" + sourceAddress); logger.debug("Replay::" + sourceAddress);
} }
@ -92,6 +92,12 @@ public class ReplayManager {
throw new NullPointerException("sourceAddress"); throw new NullPointerException("sourceAddress");
} }
if (targetAddressParameter == null || targetAddressParameter.trim().isEmpty()) {
targetAddressParameter = sourceAddress;
}
final String targetAddress = targetAddressParameter;
if (journal == null) { if (journal == null) {
// notice this routing plays single threaded. no need for any sort of synchronization here // notice this routing plays single threaded. no need for any sort of synchronization here
journal = (JournalImpl)server.getStorageManager().getMessageJournal(); journal = (JournalImpl)server.getStorageManager().getMessageJournal();

View File

@ -363,7 +363,6 @@ public class AddressControlTest extends ManagementTestBase {
ClientSessionFactory sf2 = createSessionFactory(locator2); ClientSessionFactory sf2 = createSessionFactory(locator2);
session = sf2.createSession(false, true, false); session = sf2.createSession(false, true, false);
session.createQueue(new QueueConfiguration(address));
Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage()); Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage());
} }
@ -601,12 +600,11 @@ public class AddressControlTest extends ManagementTestBase {
} }
private void testReplaySimple(boolean useDate) throws Exception { private void testReplaySimple(boolean useDate) throws Exception {
SimpleString address = RandomUtil.randomSimpleString();
AddressControl addressControl = createManagementControl(address);
String queue = "testQueue" + RandomUtil.randomString(); String queue = "testQueue" + RandomUtil.randomString();
server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST)); server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST));
server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue)); server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue));
AddressControl addressControl = createManagementControl(SimpleString.toSimpleString(queue));
ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616");
try (Connection connection = factory.createConnection()) { try (Connection connection = factory.createConnection()) {
@ -661,13 +659,13 @@ public class AddressControlTest extends ManagementTestBase {
@Test @Test
public void testReplayFilter() throws Exception { public void testReplayFilter() throws Exception {
SimpleString address = RandomUtil.randomSimpleString();
AddressControl addressControl = createManagementControl(address);
String queue = "testQueue" + RandomUtil.randomString(); String queue = "testQueue" + RandomUtil.randomString();
server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST)); server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST));
server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue)); server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue));
AddressControl addressControl = createManagementControl(SimpleString.toSimpleString(queue));
ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616");
try (Connection connection = factory.createConnection()) { try (Connection connection = factory.createConnection()) {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -704,8 +702,9 @@ public class AddressControlTest extends ManagementTestBase {
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
Configuration config = createDefaultInVMConfig().setJMXManagementEnabled(true); Configuration config = createDefaultNettyConfig().setJMXManagementEnabled(true);
server = createServer(false, config); config.setJournalRetentionDirectory(config.getJournalDirectory() + "_ret"); // needed for replay tests
server = createServer(true, config);
server.setMBeanServer(mbeanServer); server.setMBeanServer(mbeanServer);
server.start(); server.start();