KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > remoting > registry > InvokerRegistryUpdateTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.remoting.registry;
8
9 import org.jboss.remoting.transport.Connector;
10 import org.jboss.remoting.InvokerRegistry;
11 import org.jboss.remoting.ServerInvoker;
12 import org.jboss.remoting.InvokerLocator;
13
14 import junit.framework.TestCase;
15
16 /**
17  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
18  */

19 public class InvokerRegistryUpdateTestCase extends TestCase
20 {
21    private Connector connector;
22    private String JavaDoc locatorURI = "socket://localhost";
23
24    public void setUp() throws Exception JavaDoc
25    {
26       connector = new Connector();
27       connector.setInvokerLocator(locatorURI);
28       connector.create();
29       connector.stop();
30    }
31
32    public void tearDown() throws Exception JavaDoc
33    {
34       if(connector != null)
35       {
36          connector.stop();
37          connector.destroy();
38       }
39    }
40
41    public void testRegistryUpdate()
42    {
43       ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
44       ServerInvoker serverInvoker = serverInvokers[0];
45       InvokerLocator locator = serverInvoker.getLocator();
46       String JavaDoc locatorURI = locator.getLocatorURI();
47       assertTrue("Invoker locator uri should have changed.", !this.locatorURI.equals(locatorURI));
48    }
49 }
Popular Tags