01: /*
02: * NamedClientTest.java
03: * JUnit based test
04: *
05: * Created on 27 February 2007, 09:04
06: */
07:
08: package test.client.named;
09:
10: import java.util.Hashtable;
11: import javax.naming.Context;
12: import javax.naming.InitialContext;
13: import javax.rmi.PortableRemoteObject;
14: import junit.framework.*;
15: import java.rmi.Remote;
16: import java.rmi.RemoteException;
17:
18: /**
19: *
20: * @author Admin
21: */
22: public class NamedClientTest extends TestCase {
23:
24: public NamedClientTest(String testName) {
25: super (testName);
26: }
27:
28: protected void setUp() throws Exception {
29: }
30:
31: protected void tearDown() throws Exception {
32: }
33:
34: public static Test suite() {
35: TestSuite suite = new TestSuite(NamedClientTest.class);
36:
37: return suite;
38: }
39:
40: /**
41: * Test of runBasicTest method, of class test.client.named.NamedClient.
42: */
43: public void testRunBasicTest() throws Exception {
44: System.out.println("runBasicTest");
45: try {
46: Hashtable env = new Hashtable();
47: env.put(Context.INITIAL_CONTEXT_FACTORY,
48: "com.rift.coad.client.naming."
49: + "CoadunationInitialContextFactory");
50: env.put(Context.PROVIDER_URL, System
51: .getProperty("coadunation.master"));
52: env.put("com.rift.coad.username", "test");
53: env.put("com.rift.coad.password", "112233");
54: Context ctx = new InitialContext(env);
55:
56: Object obj = ctx.lookup(System.getProperty("test.url"));
57: test.client.named.NamedClient beanInterface = (test.client.named.NamedClient) PortableRemoteObject
58: .narrow(obj, test.client.named.NamedClient.class);
59:
60: if (beanInterface == null) {
61: throw new Exception("narrow failed.");
62: } else {
63: beanInterface.runBasicTest("huh");
64: }
65:
66: } catch (Exception ex) {
67: System.out.println(ex.getMessage());
68: ex.printStackTrace(System.out);
69: throw new Exception(ex);
70: }
71: }
72:
73: /**
74: * Generated implementation of abstract class test.client.named.NamedClient. Please fill dummy bodies of generated methods.
75: */
76: private class NamedClientImpl implements NamedClient {
77:
78: public void runBasicTest(java.lang.String text) {
79: // TODO fill the body in order to provide useful implementation
80:
81: }
82: }
83:
84: }
|