ARTEMIS-2315 ClientSession.createQueue routing-type bug

This commit is contained in:
Justin Bertram 2019-04-19 14:46:30 -05:00 committed by Clebert Suconic
parent 847c83fc2d
commit 755fa0c3a6
2 changed files with 143 additions and 0 deletions

View File

@ -386,6 +386,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
public void createQueue(final String address, final RoutingType routingType, final String queueName, final String filterString,
final boolean durable, final boolean autoCreated) throws ActiveMQException {
createQueue(SimpleString.toSimpleString(address),
routingType,
SimpleString.toSimpleString(queueName),
SimpleString.toSimpleString(filterString),
durable,

View File

@ -17,10 +17,12 @@
package org.apache.activemq.artemis.tests.integration.client;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
@ -495,4 +497,144 @@ public class SessionTest extends ActiveMQTestBase {
String nodeId = ((ClientSessionInternal) clientSession).getNodeId();
assertNotNull(nodeId);
}
@Test
public void testCreateQueue() throws Exception {
cf = createSessionFactory(locator);
ClientSession clientSession = addClientSession(cf.createSession(false, true, true));
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString());
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString());
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertTrue(result.isDurable());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertTrue(result.isDurable());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
assertEquals(0, result.getMaxConsumers());
assertTrue(result.isPurgeOnNoConsumers());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
assertEquals(0, result.getMaxConsumers());
assertTrue(result.isPurgeOnNoConsumers());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true, true, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
assertEquals(0, result.getMaxConsumers());
assertTrue(result.isPurgeOnNoConsumers());
assertTrue(result.isExclusive());
assertTrue(result.isLastValue());
server.destroyQueue(queueName);
}
{
clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true, true, true);
Queue result = server.locateQueue(queueName);
assertEquals(addressName, result.getAddress());
assertEquals(queueName, result.getName());
assertEquals(RoutingType.ANYCAST, result.getRoutingType());
assertEquals("filter", result.getFilter().getFilterString().toString());
assertTrue(result.isDurable());
assertTrue(result.isAutoCreated());
assertEquals(0, result.getMaxConsumers());
assertTrue(result.isPurgeOnNoConsumers());
assertTrue(result.isExclusive());
assertTrue(result.isLastValue());
server.destroyQueue(queueName);
}
}
}