ARTEMIS-1416 Fixing testsuite

This commit is contained in:
Clebert Suconic 2017-11-03 18:25:07 -04:00
parent 0e9b39c825
commit 559a704818
4 changed files with 22 additions and 3 deletions

View File

@ -446,7 +446,7 @@ public class ServerSessionPacketHandler implements ChannelHandler {
if (!queueNames.isEmpty()) {
final List<SimpleString> convertedQueueNames = request.convertQueueNames(clientVersion, queueNames);
if (convertedQueueNames != queueNames) {
result = new BindingQueryResult(result.isExists(), convertedQueueNames, result.isAutoCreateQueues(), result.isAutoCreateAddresses(), result.isDefaultPurgeOnNoConsumers(), result.getDefaultMaxConsumers());
result = new BindingQueryResult(result.isExists(), result.getAddressInfo(), convertedQueueNames, result.isAutoCreateQueues(), result.isAutoCreateAddresses(), result.isDefaultPurgeOnNoConsumers(), result.getDefaultMaxConsumers());
}
}
}

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.server;
import java.util.List;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
public class BindingQueryResult {
@ -34,12 +35,17 @@ public class BindingQueryResult {
private int defaultMaxConsumers;
private final AddressInfo addressInfo;
public BindingQueryResult(final boolean exists,
final AddressInfo addressInfo,
final List<SimpleString> queueNames,
final boolean autoCreateQueues,
final boolean autoCreateAddresses,
final boolean defaultPurgeOnNoConsumers,
final int defaultMaxConsumers) {
this.addressInfo = addressInfo;
this.exists = exists;
this.queueNames = queueNames;
@ -57,6 +63,10 @@ public class BindingQueryResult {
return exists;
}
public AddressInfo getAddressInfo() {
return addressInfo;
}
public boolean isAutoCreateQueues() {
return autoCreateQueues;
}

View File

@ -852,7 +852,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
SimpleString bindAddress = new SimpleString(realAddress);
if (managementService != null) {
if (bindAddress.equals(managementService.getManagementAddress())) {
return new BindingQueryResult(true, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers);
return new BindingQueryResult(true, null, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers);
}
}
@ -868,7 +868,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
}
return new BindingQueryResult(getAddressInfo(bindAddress) != null, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers);
AddressInfo info = getAddressInfo(bindAddress);
return new BindingQueryResult(info != null, info, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers);
}
@Override

View File

@ -40,6 +40,11 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport {
SimpleString queue1 = new SimpleString("queue1");
SimpleString queue2 = new SimpleString("queue2");
@Override
protected boolean isAutoCreateQueues() {
return false;
}
@Test(timeout = 60000)
public void testConsumeFromSingleQueueOnAddressSameName() throws Exception {
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
@ -187,6 +192,8 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport {
@Test(timeout = 60000)
public void testConsumeWhenNoAddressCreatedAutoCreate() throws Exception {
// This test needs auto-create.. for that just clear the settings and use defaults
server.getAddressSettingsRepository().clear();
AddressSettings settings = new AddressSettings();
settings.setAutoCreateAddresses(true);
server.getAddressSettingsRepository().addMatch(address.toString(), settings);