}
}
session.commit();
JMSQueueControl queueControl = createManagementControl();
JMSQueueControl otherQueueControl = ManagementControlHelper.createJMSQueueControl((HornetQQueue)otherQueue,
mbeanServer);
Assert.assertEquals(10, queueControl.getMessageCount());
int moved = queueControl.moveMessages(null, otherQueueName, true);
assertEquals(10, moved);
assertEquals(0, queueControl.getDeliveringCount());
session.start();
ClientConsumer cons1 = session.createConsumer(queue.getAddress());
assertNull(cons1.receiveImmediate());
cons1.close();
ClientConsumer cons2 = session.createConsumer(otherQueue.getAddress());
for (int i = 0; i < 10; i++)
{
ClientMessage msg = cons2.receive(10000);
assertNotNull(msg);
msg.acknowledge();
}
cons2.close();
session.close();
sf.close();
locator.close();
Assert.assertEquals(0, queueControl.getMessageCount());
Assert.assertEquals(0, otherQueueControl.getMessageCount());
serverManager.destroyQueue(otherQueueName);
}