KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > server > RemoteRefStatelessTest


1 package org.sapia.ubik.rmi.server;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.ubik.net.ServerAddress;
6 import org.sapia.ubik.net.TCPAddress;
7
8
9 /**
10  * @author Yanick Duchesne
11  *
12  * <dl>
13  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 public class RemoteRefStatelessTest extends TestCase {
19   public RemoteRefStatelessTest(String JavaDoc arg0) {
20     super(arg0);
21   }
22
23   public void testAddSibling() throws Exception JavaDoc {
24     RemoteRefStateless st = new RemoteRefStateless();
25     ServerAddress currentAddr = new TCPAddress("current", 1);
26     OID currentOid = new OID(1);
27     RemoteRefStateless.ServiceInfo current = new RemoteRefStateless.ServiceInfo(currentAddr,
28         currentOid, false, VmId.getInstance(), true);
29     st._serviceInfos.add(current);
30     super.assertEquals(1, st.getInfos().size());
31
32     RemoteRefStateless otherRef = new RemoteRefStateless();
33     ServerAddress otherAddr = new TCPAddress("other", 1);
34     OID otherOid = new OID(2);
35     RemoteRefStateless.ServiceInfo other = new RemoteRefStateless.ServiceInfo(currentAddr,
36         currentOid, false, VmId.getInstance(), true);
37     st.addSibling(otherRef);
38     super.assertEquals(1, st.getInfos().size());
39     st.addSibling(st);
40     super.assertEquals(1, st.getInfos().size());
41   }
42 }
43
Popular Tags