KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > 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.remoting.marshall.dynamic.remote.socket;
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
15 /**
16  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
17  */

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

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

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