KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > tests > CustomProtocolTest


1 package org.jgroups.tests;
2
3 import junit.framework.TestCase;
4 import junit.framework.TestSuite;
5 import org.jgroups.JChannel;
6 import org.jgroups.stack.Protocol;
7
8 /**
9  * Tests custom protocol.
10  * Author: Lenny Phan
11  * Version: $Id: CustomProtocolTest.java,v 1.1 2007/07/04 07:29:34 belaban Exp $
12  */

13 public class CustomProtocolTest extends TestCase {
14
15     static final String JavaDoc 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 JavaDoc {
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 JavaDoc testName) throws Exception JavaDoc {
42         super(testName);
43     }
44
45
46     /**
47      * A main() to allow running this test case by itself.
48      *
49      * @param args The command-line arguments.
50      */

51     public static void main(String JavaDoc args[]) {
52         String JavaDoc[] testCaseName = {"com.oracle.jgroups.protocols.CustomProtocolTest"};
53         junit.textui.TestRunner.main(testCaseName);
54     }
55
56
57     /**
58      * Compose a suite of test cases.
59      *
60      * @return The suite.
61      */

62     public static TestSuite suite() {
63         return new TestSuite(CustomProtocolTest.class);
64     }
65
66     public static class MyProtocol extends Protocol {
67
68         public String JavaDoc getName() {
69             return "MyProtocol";
70         }
71     }
72 }
73
Popular Tags