1 7 8 package test.client; 9 10 import java.util.Hashtable ; 11 import javax.rmi.PortableRemoteObject ; 12 import junit.framework.*; 13 import java.rmi.Remote ; 14 import java.rmi.RemoteException ; 15 import javax.naming.Context ; 16 import javax.naming.InitialContext ; 17 21 public class RPCClientTestTest extends TestCase { 22 23 public RPCClientTestTest(String testName) { 24 super(testName); 25 } 26 27 protected void setUp() throws Exception { 28 } 29 30 protected void tearDown() throws Exception { 31 } 32 33 public static Test suite() { 34 TestSuite suite = new TestSuite(RPCClientTestTest.class); 35 36 return suite; 37 } 38 39 42 public void testRunBasicTest() throws Exception { 43 System.out.println("runBasicTest"); 44 try { 45 Hashtable env = new Hashtable (); 46 env.put(Context.INITIAL_CONTEXT_FACTORY, 47 "com.rift.coad.client.naming." + 48 "CoadunationInitialContextFactory"); 49 env.put(Context.PROVIDER_URL,System.getProperty("coadunation.master")); 50 env.put("com.rift.coad.username","test"); 51 env.put("com.rift.coad.password","112233"); 52 Context ctx = new InitialContext (env); 53 54 Object obj = ctx.lookup(System.getProperty("test2.url")); 55 test.client.RPCClientTest beanInterface = 56 (test.client.RPCClientTest) 57 PortableRemoteObject.narrow(obj, 58 test.client.RPCClientTest.class); 59 60 if (beanInterface == null) { 61 throw new Exception ("narrow failed."); 62 } else { 63 beanInterface.runBasicTest("huh"); 64 beanInterface.runBasicMessageTest("do you think i'm sexy?"); 65 } 66 67 } catch (Exception ex) { 68 System.out.println(ex.getMessage()); 69 ex.printStackTrace(System.out); 70 throw new Exception (ex); 71 } 72 } 73 74 75 } 76 | Popular Tags |