message.getBodyBuffer().writeBytes(body);
producer.send(message);
}
ClientConsumer consumer = session.createConsumer(PagingTest.ADDRESS);
session.start();
for (int i = 0; i < 6; i++)
{
ClientMessage message2 = consumer.receive(PagingTest.RECEIVE_TIMEOUT);
Assert.assertNotNull(message2);
message2.acknowledge();
}
Assert.assertNull(consumer.receiveImmediate());
Assert.assertEquals(0, server.getPostOffice()
.getPagingManager()
.getPageStore(PagingTest.ADDRESS)
.getAddressSize());
for (int i = 0; i < numberOfMessages; i++)
{
byte[] body = new byte[1024];
message = session.createMessage(true);
message.getBodyBuffer().writeBytes(body);
producer.send(message);
}
for (int i = 0; i < 6; i++)
{
ClientMessage message2 = consumer.receive(PagingTest.RECEIVE_TIMEOUT);
Assert.assertNotNull(message2);
message2.acknowledge();
}
Assert.assertNull(consumer.receiveImmediate());
session.close();
session = sf.createSession(false, true, true);
producer = session.createProducer(PagingTest.ADDRESS);
for (int i = 0; i < numberOfMessages; i++)
{
byte[] body = new byte[1024];
message = session.createMessage(true);
message.getBodyBuffer().writeBytes(body);
producer.send(message);
}
session.commit();
consumer = session.createConsumer(PagingTest.ADDRESS);
session.start();
for (int i = 0; i < 6; i++)
{
ClientMessage message2 = consumer.receive(PagingTest.RECEIVE_TIMEOUT);
Assert.assertNotNull(message2);
message2.acknowledge();
}
session.commit();
Assert.assertNull(consumer.receiveImmediate());
session.close();
Assert.assertEquals(0, server.getPostOffice()
.getPagingManager()