Skip to content

Commit

Permalink
added printing of digests
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Dec 10, 2010
1 parent cd5c8a1 commit 98c8a17
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/junit/org/jgroups/protocols/GMS_MergeTest.java
Expand Up @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 98c8a17

Please sign in to comment.