Author: clebert.suconic(a)jboss.com
Date: 2012-01-05 08:57:59 -0500 (Thu, 05 Jan 2012)
New Revision: 11972
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java
Log:
Fixing race on test
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2012-01-05
13:12:52 UTC (rev 11971)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2012-01-05
13:57:59 UTC (rev 11972)
@@ -4350,26 +4350,7 @@
session.start();
- // ClientConsumer consumer =
session.createConsumer(PagingTest.ADDRESS.concat("=1"));
- //
- // for (int i = 0; i < numberOfMessages; i++)
- // {
- // message = consumer.receive(500000);
- // assertNotNull(message);
- // message.acknowledge();
- //
- // // assertEquals(msg,
message.getIntProperty("propTest").intValue());
- //
- // System.out.println("i = " + i + " msg = " +
message.getIntProperty("propTest"));
- // }
- //
- // session.commit();
-
- // consumer.close();
-
session.deleteQueue(PagingTest.ADDRESS.concat("=1"));
- // server.stop();
- // server.start();
sf = locator.createSessionFactory();
@@ -4385,8 +4366,6 @@
assertNotNull(message);
message.acknowledge();
- // assertEquals(msg,
message.getIntProperty("propTest").intValue());
-
System.out.println("i = " + i + " msg = " +
message.getIntProperty("propTest"));
}
@@ -4395,8 +4374,17 @@
assertNull(consumer.receiveImmediate());
consumer.close();
+
+ long timeout = System.currentTimeMillis() + 10000;
+
+ PagingStore store = server.getPagingManager().getPageStore(ADDRESS);
// It's async, so need to wait a bit for it happening
+ while (timeout < System.currentTimeMillis() && store.isPaging())
+ {
+ Thread.sleep(100);
+ }
+
assertFalse(server.getPagingManager().getPageStore(ADDRESS).isPaging());
server.stop();