Skip to content
Browse files

added test for compact()

  • Loading branch information...
1 parent 57f66f2 commit db8d66aa17baa2f2f5485bcceda6651c7bf42f4a @belaban committed Dec 19, 2010
Showing with 13 additions and 0 deletions.
  1. +13 −0 tests/junit-functional/org/jgroups/tests/RetransmitTableTest.java
View
13 tests/junit-functional/org/jgroups/tests/RetransmitTableTest.java
@@ -222,6 +222,19 @@ public static void testPurge() {
}
+ public void testCompact() {
+ RetransmitTable table=new RetransmitTable(10, 10, 0);
+ for(long i=0; i < 80; i++)
+ addAndGet(table, i, "hello-" + i);
+ assert table.size() == 80;
+ table.purge(59);
+ assert table.size() == 20;
+ table.compact();
+ assert table.size() == 20;
+ assert table.capacity() == 30;
+ }
+
+
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 db8d66a

Please sign in to comment.
Something went wrong with that request. Please try again.