}
public void testMoveMessagesBack() throws Exception
{
server.createQueue(new SimpleString("q1"), new SimpleString("q1"), null, true, false);
server.createQueue(new SimpleString("q2"), new SimpleString("q2"), null, true, false);
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, true);
ClientProducer prod1 = session.createProducer("q1");
for (int i = 0; i < 10; i++)
{
ClientMessage msg = session.createMessage(true);
msg.putStringProperty(org.hornetq.api.core.Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString("dupl-" + i));
prod1.send(msg);
}
session.commit();
ClientConsumer consumer = session.createConsumer("q1", true);
session.start();
assertNotNull(consumer.receive(5000));
consumer.close();
QueueControl q1Control = ManagementControlHelper.createQueueControl(new SimpleString("q1"),
new SimpleString("q1"),
mbeanServer);
QueueControl q2Control = ManagementControlHelper.createQueueControl(new SimpleString("q2"),
new SimpleString("q2"),
mbeanServer);
assertEquals(10, q1Control.moveMessages(null, "q2"));
consumer = session.createConsumer("q2", true);