* transfered to the new store, and functions as expected with continued use
* by monitoring message count while sending new messages to the topic.
*/
public void testSelectorDurability() throws Exception
{
JMXTestUtils jmxUtils = null;
try
{
jmxUtils = new JMXTestUtils(this, "guest", "guest");
jmxUtils.open();
}
catch (Exception e)
{
fail("Unable to establish JMX connection, test cannot proceed");
}
try
{
ManagedQueue dursubQueue = jmxUtils.getManagedQueue("clientid" + ":" + SUB_NAME);
assertEquals("DurableSubscription backing queue should have 1 message on it initially",
new Integer(1), dursubQueue.getMessageCount());
// Create a connection and start it
TopicConnection connection = (TopicConnection) getConnection();
connection.start();
// Send messages which don't match and do match the selector, checking message count
TopicSession pubSession = connection.createTopicSession(true, org.apache.qpid.jms.Session.SESSION_TRANSACTED);
Topic topic = pubSession.createTopic(TOPIC_NAME);
TopicPublisher publisher = pubSession.createPublisher(topic);
BDBStoreUpgradeTestPreparer.publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "false");
pubSession.commit();
assertEquals("DurableSubscription backing queue should still have 1 message on it",
new Integer(1), dursubQueue.getMessageCount());
BDBStoreUpgradeTestPreparer.publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
pubSession.commit();
assertEquals("DurableSubscription backing queue should now have 2 messages on it",
new Integer(2), dursubQueue.getMessageCount());
dursubQueue.clearQueue();
pubSession.close();
}
finally
{
jmxUtils.close();
}
}