KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > marshall > dynamic > remote > http > 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.remoting.marshall.dynamic.remote.http;
8
9 import org.apache.log4j.Level;
10 import org.jboss.dtf.MultipleTestRunner;
11 import org.jboss.remoting.AbstractInvokerTest;
12 import org.jboss.remoting.Client;
13 import org.jboss.remoting.InvokerLocator;
14 import org.jboss.remoting.marshall.dynamic.remote.socket.MarshallerLoadingConstants;
15
16 /**
17  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
18  */

19 public class MarshallerLoadingClient extends AbstractInvokerTest implements MarshallerLoadingConstants
20 {
21    public MarshallerLoadingClient(String JavaDoc name)
22    {
23       super(name);
24    }
25
26    public MarshallerLoadingClient(String JavaDoc name, int numberOfInstances)
27    {
28       super(name, numberOfInstances);
29    }
30
31    public MarshallerLoadingClient(String JavaDoc name, String JavaDoc transport, int port)
32    {
33       super(name, transport, port);
34    }
35
36    public MarshallerLoadingClient(String JavaDoc name, String JavaDoc transport, int port, int numberOfInstances)
37    {
38       super(name, transport, port, numberOfInstances);
39    }
40
41    public void testInvocation() throws Throwable JavaDoc
42    {
43       InvokerLocator locator = new InvokerLocator(locatorURI);
44       System.out.println("Calling remoting server with locator uri of: " + locatorURI);
45
46       Client remotingClient = new Client(locator, null);
47       Object JavaDoc response = remotingClient.invoke("Do something", null);
48       assertTrue(true);
49
50       System.out.println("Invocation response: " + response);
51    }
52
53    /**
54     * Can pass transport and port to be used as parameters.
55     * Valid transports are 'rmi' and 'socket'.
56     *
57     * @param args
58     */

59    public static void main(String JavaDoc[] args)
60    {
61       org.apache.log4j.BasicConfigurator.configure();
62       org.apache.log4j.Category.getRoot().setLevel(Level.INFO);
63       org.apache.log4j.Category.getInstance("org.jboss.remoting").setLevel(Level.DEBUG);
64
65       /*
66       if(args != null && args.length == 2)
67       {
68          transport = args[0];
69          port = Integer.parseInt(args[1]);
70       }
71       */

72       MarshallerLoadingClient client = new MarshallerLoadingClient(MarshallerLoadingClient.class.getName());
73       try
74       {
75          MultipleTestRunner runner = new MultipleTestRunner();
76          runner.doRun(client, true);
77       }
78       catch(Throwable JavaDoc e)
79       {
80          e.printStackTrace();
81          System.exit(1);
82       }
83       System.exit(0);
84    }
85
86
87 }
Popular Tags