Assert.assertEquals(expiryAddress, queueControl.getExpiryAddress());
}
public void testExpireMessage() throws Exception
{
JMSQueueControl queueControl = createManagementControl();
String expiryQueueName = RandomUtil.randomString();
HornetQQueue expiryQueue = (HornetQQueue)HornetQJMSClient.createQueue(expiryQueueName);
serverManager.createQueue(false, expiryQueueName, null, true, expiryQueueName);
queueControl.setExpiryAddress(expiryQueue.getAddress());
JMSQueueControl expiryQueueControl = ManagementControlHelper.createJMSQueueControl(expiryQueue, mbeanServer);
String[] messageIDs = JMSUtil.sendMessages(queue, 1);
Assert.assertEquals(1, queueControl.getMessageCount());
Assert.assertEquals(0, expiryQueueControl.getMessageCount());
Assert.assertTrue(queueControl.expireMessage(messageIDs[0]));
Assert.assertEquals(0, queueControl.getMessageCount());
Assert.assertEquals(1, expiryQueueControl.getMessageCount());
Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
connection.start();
MessageConsumer consumer = JMSUtil.createConsumer(connection, expiryQueue);