From a243e0559f4bc4768fc7af356a1153837ac4f3de Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Fri, 17 Feb 2017 11:20:51 +0000 Subject: [PATCH] ARTEMIS-977 - record id of address not set on journal reload https://issues.apache.org/jira/browse/ARTEMIS-977 --- .../server/impl/PostOfficeJournalLoader.java | 1 + .../management/ActiveMQServerControlTest.java | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java index 3290b6fcd2..005a99475a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java @@ -178,6 +178,7 @@ public class PostOfficeJournalLoader implements JournalLoader { addressBindingInfosMap.put(addressBindingInfo.getId(), addressBindingInfo); AddressInfo addressInfo = new AddressInfo(addressBindingInfo.getName()).setRoutingTypes(addressBindingInfo.getRoutingTypes()); + addressInfo.setId(addressBindingInfo.getId()); postOffice.addAddressInfo(addressInfo); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 16c19d5497..75b78328dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -411,6 +411,29 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Assert.assertFalse(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); } + @Test + public void testGetAddressDeletedFromJournal() throws Exception { + SimpleString address = RandomUtil.randomSimpleString(); + SimpleString name = RandomUtil.randomSimpleString(); + + ActiveMQServerControl serverControl = createManagementControl(); + + // due to replication, there can be another queue created for replicating + // management operations + + Assert.assertFalse(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); + serverControl.createAddress(address.toString(), "ANYCAST"); + Assert.assertTrue(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); + + restartServer(); + + serverControl.deleteAddress(address.toString()); + + restartServer(); + + Assert.assertFalse(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); + } + @Test public void testMessageCounterMaxDayCount() throws Exception { ActiveMQServerControl serverControl = createManagementControl();