Author: clebert.suconic(a)jboss.com
Date: 2011-09-09 22:13:50 -0400 (Fri, 09 Sep 2011)
New Revision: 11316
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagedReferenceImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java
Log:
HORNETQ-765 - fixing a failing test
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagedReferenceImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagedReferenceImpl.java 2011-09-09
21:41:06 UTC (rev 11315)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/PagedReferenceImpl.java 2011-09-10
02:13:50 UTC (rev 11316)
@@ -86,7 +86,15 @@
final PageSubscription subscription)
{
this.position = position;
- this.messageEstimate = message.getMessage().getMemoryEstimate();
+
+ if (message == null)
+ {
+ this.messageEstimate = -1;
+ }
+ else
+ {
+ this.messageEstimate = message.getMessage().getMemoryEstimate();
+ }
this.message = new WeakReference<PagedMessage>(message);
this.subscription = subscription;
}
@@ -112,6 +120,10 @@
*/
public int getMessageMemoryEstimate()
{
+ if (messageEstimate < 0)
+ {
+ messageEstimate = getMessage().getMemoryEstimate();
+ }
return messageEstimate;
}
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 2011-09-09
21:41:06 UTC (rev 11315)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2011-09-10
02:13:50 UTC (rev 11316)
@@ -263,6 +263,8 @@
PagingTest.PAGE_MAX,
new HashMap<String, AddressSettings>());
server.start();
+
+ waitForServer(server);
queue = server.locateQueue(ADDRESS);