Skip to content

Commit

Permalink
ns
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Dec 19, 2010
1 parent ff1d875 commit 031e9f7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/junit/org/jgroups/tests/DuplicateTest.java
Expand Up @@ -3,6 +3,7 @@

import org.jgroups.*;
import org.jgroups.protocols.DUPL;
import org.jgroups.protocols.UNICAST2;
import org.jgroups.protocols.pbcast.NAKACK;
import org.jgroups.protocols.pbcast.STABLE;
import org.jgroups.stack.ProtocolStack;
Expand Down Expand Up @@ -50,14 +51,15 @@ void init() throws Exception {

@AfterMethod
void tearDown() throws Exception {
removeDUPL(c3, c2, c1);
Util.close(c3, c2, c1);
}



public void testRegularUnicastsToSelf() throws Exception {
send(c1, c1.getAddress(), false, 10);
sendStableMessages(c1,c2, c3);
sendStableMessages(c1, c2, c3);
check(r1, 1, false, new Tuple<Address,Integer>(a1, 10));
}

Expand Down Expand Up @@ -164,6 +166,25 @@ private static void sendStableMessages(JChannel ... channels) {
}
}

protected static void removeDUPL(JChannel ... channels) {
for(JChannel ch: channels) {
DUPL dupl=(DUPL)ch.getProtocolStack().findProtocol(DUPL.class);
if(dupl != null) {
dupl.setCopyMulticastMsgs(false);
dupl.setCopyUnicastMsgs(false);
}
}
}


private static void sendUnicastStableMessages(JChannel ... channels) {
for(JChannel ch: channels) {
UNICAST2 unicast=(UNICAST2)ch.getProtocolStack().findProtocol(UNICAST2.class);
if(unicast != null)
unicast.sendStableMessages();
}
}


private void createChannels(boolean copy_multicasts, boolean copy_unicasts, int num_outgoing_copies, int num_incoming_copies) throws Exception {
c1=createChannel(true, 3);
Expand Down

0 comments on commit 031e9f7

Please sign in to comment.