KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > remoting > marshall > dynamic > remote > socket > MarshallerLoadingClient


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.marshall.dynamic.remote.socket;
8
9 import org.jboss.remoting.Client;
10 import org.jboss.remoting.InvokerLocator;
11
12 import junit.framework.TestCase;
13
14 /**
15  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
16  */

17 public class MarshallerLoadingClient extends TestCase implements MarshallerLoadingConstants
18 {
19    public void testInvocation() throws Throwable JavaDoc
20    {
21       Client remotingClient = null;
22
23       // first, make sure can not load marshaller from current classpath
24
try
25       {
26          Class.forName("org.jboss.test.remoting.marshall.dynamic.remote.socket.TestMarshaller");
27          assertTrue("Was able to load the TestMarshaller class locally, when it should NOT be on the classpath.", false);
28          return;
29       }
30       catch(ClassNotFoundException JavaDoc e)
31       {
32          assertTrue("Was not able to load TestMarshaller from local classpath as expected.", true);
33       }
34
35       try
36       {
37          InvokerLocator locator = new InvokerLocator(locatorURI);
38          System.out.println("Calling remoting server with locator uri of: " + locatorURI);
39
40          remotingClient = new Client(locator, null);
41          Object JavaDoc response = remotingClient.invoke("Do something", null);
42          assertTrue(true);
43
44          System.out.println("Invocation response: " + response);
45       }
46       finally
47       {
48          if(remotingClient != null)
49          {
50             remotingClient.disconnect();
51          }
52       }
53    }
54
55 }
Popular Tags