1 25 26 package org.objectweb.jonas.jtests.clients.service; 27 28 import javax.rmi.PortableRemoteObject ; 29 30 import junit.framework.Test; 31 import junit.framework.TestSuite; 32 33 import org.objectweb.jonas.jtests.beans.wsclient.WsClient1; 34 import org.objectweb.jonas.jtests.beans.wsclient.WsClient1Home; 35 36 39 public class F_AgnosticServiceUsage extends A_ServiceUsage { 40 41 protected static final String BEAN_HOME = "WsClient1Home"; 42 protected WsClient1Home home = null; 43 44 public F_AgnosticServiceUsage(String name) { 45 super(name); 46 } 47 48 public static Test suite() { 49 return new TestSuite(F_AgnosticServiceUsage.class); 50 } 51 52 public void setUp() throws Exception { 53 super.setUp(); 54 } 55 56 public void tearDown() throws Exception { 57 super.tearDown(); 58 } 59 60 protected WsClient1Home getHome() throws Exception { 61 if (home == null) { 62 home = (WsClient1Home) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME),WsClient1Home.class) ; 63 } 64 assertTrue(home != null); 65 return home; 66 } 67 68 public void testJNDILookupWithJNDIName() throws Exception { 69 WsClient1 wsc = getHome().create(); 70 assertFalse("lookup with jndi name must fail", wsc.lookupServiceJNDI()); 71 wsc.remove(); 72 } 73 74 public void testJNDILookupWithServiceRefName() throws Exception { 75 WsClient1 wsc = getHome().create(); 76 assertTrue("lookup with service-ref-name fail", wsc.lookupServiceName()); 77 wsc.remove(); 78 } 79 80 public static void main (String args[]) { 81 String testtorun = null; 82 for (int argn = 0; argn < args.length; argn++) { 84 String s_arg = args[argn]; 85 if (s_arg.equals("-n")) { 86 testtorun = args[++argn]; 87 } 88 } 89 if (testtorun == null) { 90 junit.textui.TestRunner.run(suite()); 91 } else { 92 junit.textui.TestRunner.run(new F_AgnosticServiceUsage(testtorun)); 93 } 94 } 95 96 } 97 | Popular Tags |