sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, false, false, false, 0);
ClientConsumer consumer = session.createConsumer(PagingTest.ADDRESS);
session.start();
// 347 = I just picked any odd number, not rounded, to make sure it's not at the beggining of any page
for (int i = 0; i < 347; i++)
{
System.out.println("Received " + i);
ClientMessage msg = consumer.receive(5000);
assertEquals(i, msg.getIntProperty("id").intValue());
Assert.assertNotNull(msg);
msg.acknowledge();
session.commit();
}
session.close();
locator.close();
server.stop();
server = createServer(true,
config,
PagingTest.PAGE_SIZE,
PagingTest.PAGE_MAX,
new HashMap<String, AddressSettings>());
server.start();
locator = createInVMNonHALocator();
sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, false, false, false, 0);
consumer = session.createConsumer(PagingTest.ADDRESS);
session.start();
for (int i = 347; i < numberOfMessages; i++)
{
System.out.println("Received " + i);
ClientMessage msg = consumer.receive(5000);
assertEquals(i, msg.getIntProperty("id").intValue());
Assert.assertNotNull(msg);
msg.acknowledge();
session.commit();
}