| 1 22 package org.jboss.test.cts.ejb; 23 24 import java.lang.reflect.Method ; 25 import java.rmi.RemoteException ; 26 import java.rmi.ServerException ; 27 import javax.naming.InitialContext ; 28 29 import org.jboss.test.cts.interfaces.CtsCmp2Local; 30 import org.jboss.test.cts.interfaces.CtsCmp2LocalHome; 31 import org.jboss.test.util.ejb.SessionSupport; 32 33 40 public class CtsCmp2SessionBean extends SessionSupport 41 { 42 43 public void ejbCreate () 44 { 45 } 46 47 public void testV1() throws RemoteException  48 { 49 try 50 { 51 InitialContext ctx = new InitialContext (); 52 CtsCmp2LocalHome home = (CtsCmp2LocalHome) ctx.lookup("java:comp/env/ejb/CtsCmp2LocalHome"); 53 CtsCmp2Local bean = home.create("key1", "data1"); 54 String data = bean.getData(); 55 bean.remove(); 56 } 57 catch(Exception e) 58 { 59 throw new ServerException ("testV1 failed", e); 60 } 61 } 62 public void testV2() throws RemoteException  63 { 64 try 65 { 66 InitialContext ctx = new InitialContext (); 67 CtsCmp2LocalHome home = (CtsCmp2LocalHome) ctx.lookup("java:comp/env/ejb/CtsCmp2LocalHome"); 68 CtsCmp2Local bean = home.create("key1", "data1"); 69 String data = bean.getData(); 70 Class [] sig = {}; 71 Method getMoreData = bean.getClass().getMethod("getMoreData", sig); 72 Object [] args = {}; 73 data = (String ) getMoreData.invoke(bean, args); 74 bean.remove(); 75 } 76 catch(Exception e) 77 { 78 throw new ServerException ("testV2 failed", e); 79 } 80 } 81 } 82 | Popular Tags |