You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2016/12/01 00:56:51 UTC
activemq-artemis git commit: Fix AddressConfigTest
Repository: activemq-artemis
Updated Branches:
refs/heads/ARTEMIS-780 054b3b977 -> b704c1ebf
Fix AddressConfigTest
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b704c1eb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b704c1eb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b704c1eb
Branch: refs/heads/ARTEMIS-780
Commit: b704c1ebfb406ad49c1669a62c7f1e57b43eae6d
Parents: 054b3b9
Author: jbertram <jb...@apache.com>
Authored: Wed Nov 30 18:56:19 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Wed Nov 30 18:56:19 2016 -0600
----------------------------------------------------------------------
.../codec/PersistentAddressBindingEncoding.java | 4 ++++
.../artemis/core/server/impl/ActiveMQServerImpl.java | 15 +++++++--------
.../integration/addressing/AddressConfigTest.java | 2 +-
3 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b704c1eb/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
index c3aa9de..9684481 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
@@ -48,6 +48,10 @@ public class PersistentAddressBindingEncoding implements EncodingSupport, Addres
for (RoutingType routingType : routingTypes) {
sb.append(routingType.toString() + ",");
}
+ if (sb.charAt(sb.length() - 1) == ',') {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ sb.append("}");
sb.append(", autoCreated=" + autoCreated + "]");
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b704c1eb/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index cf862c5..7f103e7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -2244,16 +2244,16 @@ public class ActiveMQServerImpl implements ActiveMQServer {
recoverStoredConfigs();
+ Map<Long, AddressBindingInfo> addressBindingInfosMap = new HashMap<>();
+
+ journalLoader.initAddresses(addressBindingInfosMap, addressBindingInfos);
+
Map<Long, QueueBindingInfo> queueBindingInfosMap = new HashMap<>();
journalLoader.initQueues(queueBindingInfosMap, queueBindingInfos);
journalLoader.handleGroupingBindings(groupingInfos);
- Map<Long, AddressBindingInfo> addressBindingInfosMap = new HashMap<>();
-
- journalLoader.initAddresses(addressBindingInfosMap, addressBindingInfos);
-
Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<>();
HashSet<Pair<Long, Long>> pendingLargeMessages = new HashSet<>();
@@ -2403,10 +2403,12 @@ public class ActiveMQServerImpl implements ActiveMQServer {
defaultAddressInfo.addRoutingType(routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType);
AddressInfo info = postOffice.getAddressInfo(addressName);
+ boolean addressAlreadyExists = true;
+
if (info == null) {
if (autoCreateAddress) {
postOffice.addAddressInfo(defaultAddressInfo.setAutoCreated(true));
- info = postOffice.getAddressInfo(addressName);
+ addressAlreadyExists = false;
} else {
throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressName);
}
@@ -2416,12 +2418,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final Queue queue = queueFactory.createQueueWith(queueConfig);
- boolean addressAlreadyExists = true;
-
AddressInfo addressInfo = postOffice.getAddressInfo(queue.getAddress());
if (addressInfo == null) {
postOffice.addAddressInfo(new AddressInfo(queue.getAddress()));
- addressAlreadyExists = false;
} else {
if (!addressInfo.getRoutingTypes().contains(routingType)) {
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(routingType, addressInfo.getName().toString(), addressInfo.getRoutingTypes());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b704c1eb/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java
index 4e3f689..0beaab7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java
@@ -52,6 +52,6 @@ public class AddressConfigTest extends ActiveMQTestBase {
Set<RoutingType> routingTypeSet = new HashSet<>();
routingTypeSet.add(RoutingType.MULTICAST);
- assertEquals(RoutingType.MULTICAST, addressInfo.getRoutingTypes());
+ assertEquals(routingTypeSet, addressInfo.getRoutingTypes());
}
}