1 25 26 package org.objectweb.jonas.jtests.clients.session; 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.local.Target; 34 import org.objectweb.jonas.jtests.beans.local.TargetSFHome; 35 import org.objectweb.jonas.jtests.beans.local.TargetSLHome; 36 37 38 43 public class G_ClientViewSF extends B_ClientView { 44 45 protected static String BEAN_HOME = "EJB/localTargetSFHome"; 46 protected static TargetSFHome home = null; 47 48 public G_ClientViewSF(String name) { 49 super(name); 50 } 51 52 53 public void testEmpty() throws Exception {System.out.println("load bean localTargetSF"); 54 } 55 56 59 public void testCreateWithParameter() throws Exception { 60 String s1 = "String1"; 61 TargetSFHome tsfh = (TargetSFHome)getHome(); 62 Target tr = tsfh.create(s1, 1000); 63 assertEquals(tr.getString(), s1); 64 assertEquals(tr.getNumber(), 1000); 65 assertTrue(!tr.isCreatedViaCreateXX()); 66 tr.remove(); 67 } 68 69 73 public void testCreateMethod() throws Exception { 74 String s2 = "String2"; 75 TargetSFHome tsfh = (TargetSFHome)getHome(); 76 Target tr = tsfh.createXX(s2,2000); 77 assertEquals(tr.getString(),s2); 78 assertEquals(tr.getNumber(),2000); 79 assertTrue(tr.isCreatedViaCreateXX()); 80 tr.remove(); 81 } 82 83 84 87 protected void setUp() { 88 super.setUp(); 89 useBeans("local", false); 90 } 91 92 public TargetSLHome getHome() throws Exception { 93 if (home == null) { 94 home = (TargetSFHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME),TargetSFHome.class) ; 95 } 96 assertTrue(home != null); 97 return home; 98 } 99 100 public static Test suite() { 101 return new TestSuite(G_ClientViewSF.class); 102 } 103 104 105 106 public static void main (String args[]) throws Exception { 107 String testtorun = null; 108 for (int argn = 0; argn < args.length; argn++) { 110 String s_arg = args[argn]; 111 Integer i_arg; 112 if (s_arg.equals("-n")) { 113 testtorun = args[++argn]; 114 } 115 } 116 if (testtorun == null) { 117 junit.textui.TestRunner.run(suite()); 118 119 } else { 120 junit.textui.TestRunner.run(new G_ClientViewSF(testtorun)); 121 } 122 } 123 } 124 | Popular Tags |