small improvement on org.apache.activemq.JmsQueueCompositeSendReceiveTest

This commit is contained in:
Clebert Suconic 2015-08-05 09:32:09 -04:00
parent ee84d7efdf
commit 2ad821a0ca
1 changed files with 12 additions and 17 deletions

View File

@ -20,18 +20,16 @@ import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.jms.client.ActiveMQSession;
import org.apache.activemq.artemis.uri.ConnectionFactoryParser;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.test.JmsTopicSendReceiveTest;
import java.net.URI;
/**
*
@ -107,15 +105,12 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest {
Thread.sleep(200); // wait for messages to be queue;
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory("tcp://localhost:61616?type=CF");
org.apache.activemq.artemis.jms.client.ActiveMQConnection conn = (org.apache.activemq.artemis.jms.client.ActiveMQConnection) factory.createConnection();
try {
ActiveMQSession session = (ActiveMQSession) conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
ClientSession.QueueQuery query = session.getCoreSession().queueQuery(new SimpleString("jms.queue.TEST"));
try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = factory.createSession()) {
ClientSession.QueueQuery query = session.queueQuery(new SimpleString("jms.queue.TEST"));
assertNotNull(query);
assertEquals(data.length, query.getMessageCount());
} finally {
conn.close();
}
}
}