01: package org.jgroups.tests;
02:
03: import junit.framework.TestCase;
04: import junit.framework.TestSuite;
05: import org.jgroups.JChannel;
06: import org.jgroups.stack.Protocol;
07:
08: /**
09: * Tests custom protocol.
10: * Author: Lenny Phan
11: * Version: $Id: CustomProtocolTest.java,v 1.1 2005/10/20 04:00:01 belaban Exp $
12: */
13: public class CustomProtocolTest extends TestCase {
14:
15: static final String PROTOCOL_STACK = "UDP(mcast_addr=228.1.2.3;mcast_port=45566;ip_ttl=32):"
16: + "org.jgroups.tests.CustomProtocolTest$MyProtocol:"
17: + "PING(timeout=3000;num_initial_members=6):"
18: + "FD(timeout=3000):"
19: + "VERIFY_SUSPECT(timeout=1500):"
20: + "pbcast.NAKACK(gc_lag=10;retransmit_timeout=600,1200,2400,4800):"
21: + "UNICAST(timeout=600,1200,2400,4800):"
22: + "pbcast.STABLE(desired_avg_gossip=10000):"
23: + "FRAG:"
24: + "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;"
25: + "shun=true;print_local_addr=true)";
26:
27: public void testMyProtocol() throws Exception {
28: System.out.println("PROTOCOL_STACK: " + PROTOCOL_STACK);
29: JChannel channel = new JChannel(PROTOCOL_STACK);
30: assertTrue(true);
31: }
32:
33: // --------- BOILERPLATE CODE -----------------------------------
34:
35: /**
36: * Constructor. Normally called by JUnit framework.
37: *
38: * @param testName The test name.
39: * @throws Exception
40: */
41: public CustomProtocolTest(String testName) throws Exception {
42: super (testName);
43: }
44:
45: /**
46: * A main() to allow running this test case by itself.
47: *
48: * @param args The command-line arguments.
49: */
50: public static void main(String args[]) {
51: String[] testCaseName = { "com.oracle.jgroups.protocols.CustomProtocolTest" };
52: junit.textui.TestRunner.main(testCaseName);
53: }
54:
55: /**
56: * Compose a suite of test cases.
57: *
58: * @return The suite.
59: */
60: public static TestSuite suite() {
61: return new TestSuite(CustomProtocolTest.class);
62: }
63:
64: public static class MyProtocol extends Protocol {
65:
66: public String getName() {
67: return "MyProtocol";
68: }
69: }
70: }
|