Permalink
Browse files

added printing of digests

  • Loading branch information...
1 parent cd5c8a1 commit 98c8a17a61daae09c38a89779026896cd5e581e4 @belaban committed Dec 10, 2010
Showing with 17 additions and 3 deletions.
  1. +17 −3 tests/junit/org/jgroups/protocols/GMS_MergeTest.java
View
20 tests/junit/org/jgroups/protocols/GMS_MergeTest.java
@@ -143,22 +143,28 @@ static void _testSimpleMerge(String props, String cluster_name) throws Exception
checkViews(channels, "A", "A", "B");
checkViews(channels, "B", "A", "B");
checkViews(channels, "C", "C", "D");
- checkViews(channels, "D", "C", "D");
+ checkViews(channels, "C", "C", "D");
+
+ System.out.println("\ndigests:");
+ printDigests(channels);
Address leader=determineLeader(channels, "A", "C");
long end_time=System.currentTimeMillis() + 30000;
do {
System.out.println("\n==== injecting merge events into " + leader + " ====");
injectMergeEvent(channels, leader, "A", "C");
Util.sleep(1000);
- if(allChannelsHaveViewOf(channels, 4))
+ if(allChannelsHaveViewOf(channels, channels.length))
break;
}
while(end_time > System.currentTimeMillis());
System.out.println("\n");
print(channels);
- assertAllChannelsHaveViewOf(channels, 4);
+ assertAllChannelsHaveViewOf(channels, channels.length);
+
+ System.out.println("\ndigests:");
+ printDigests(channels);
}
finally {
System.out.println("closing channels");
@@ -643,6 +649,14 @@ private static void print(JChannel[] channels) {
}
}
+ private static void printDigests(JChannel[] channels) {
+ for(JChannel ch: channels) {
+ NAKACK nak=(NAKACK)ch.getProtocolStack().findProtocol(NAKACK.class);
+ Digest digest=nak.getDigest();
+ System.out.println(ch.getName() + ": " + digest.toStringSorted());
+ }
+ }
+
static void waitForNumMessages(int num_msgs, long timeout, long interval, MyReceiver ... receivers) {
long target_time=System.currentTimeMillis() + timeout;
while(System.currentTimeMillis() < target_time) {

0 comments on commit 98c8a17

Please sign in to comment.