Permalink
Browse files

added test for automatic purging

  • Loading branch information...
1 parent d257d6c commit dc42cb29a2c9aa039bc6e12764c970917fa1d71b Bela Ban committed Dec 20, 2010
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/junit-functional/org/jgroups/tests/RetransmitTableTest.java
@@ -235,6 +235,22 @@ public void testCompact() {
}
+ public void testCompactWithAutomaticPurging() {
+ RetransmitTable table=new RetransmitTable(3, 10, 0);
+ table.setAutomaticPurging(true);
+ for(long i=0; i < 80; i++)
+ addAndGet(table, i, "hello-" + i);
+ assert table.size() == 80;
+ for(long i=0; i <= 59; i++)
+ table.remove(i);
+
+ assert table.size() == 20;
+ table.compact();
+ assert table.size() == 20;
+ assert table.capacity() == 40;
+ }
+
+
protected static void addAndGet(RetransmitTable table, long seqno, String message) {
boolean added=table.put(seqno, new Message(null, null, message));
assert added;

0 comments on commit dc42cb2

Please sign in to comment.