1 22 package org.jboss.test.isolation.ejb.a; 23 24 import javax.ejb.CreateException ; 25 import javax.ejb.EJBException ; 26 import javax.ejb.SessionBean ; 27 import javax.ejb.SessionContext ; 28 import javax.naming.InitialContext ; 29 30 import org.jboss.logging.Logger; 31 import org.jboss.test.isolation.interfaces.IsolationDTO; 32 import org.jboss.test.isolation.interfaces.b.SessionB; 33 import org.jboss.test.isolation.interfaces.b.SessionBHome; 34 import org.jboss.test.util.Debug; 35 36 42 public class SessionAEJB implements SessionBean 43 { 44 private static final Logger log = Logger.getLogger(SessionAEJB.class); 45 46 public void invokeSessionB() 47 { 48 try 49 { 50 InitialContext ctx = new InitialContext (); 51 Object o = ctx.lookup("java:comp/env/ejb/SessionB"); 52 53 StringBuffer buffer = new StringBuffer ("SessionBHome lookup"); 54 Debug.displayClassInfo(o.getClass(), buffer); 55 log.info(buffer.toString()); 56 buffer = new StringBuffer ("My SessionBHome"); 57 Debug.displayClassInfo(SessionBHome.class, buffer); 58 log.info(buffer.toString()); 59 60 SessionBHome home = (SessionBHome) o; 61 SessionB session = home.create(); 62 63 IsolationDTO dto = new IsolationDTO(); 64 dto.payload = "hello"; 65 66 IsolationDTO result = session.sayHello(dto); 67 if (dto == result) 68 throw new EJBException ("Expected pass by value"); 69 if ("goodbye".equals(result.payload) == false) 70 throw new EJBException ("Did not get expected 'goodbye'"); 71 } 72 catch (Exception e) 73 { 74 throw new EJBException (e); 75 } 76 } 77 78 public void ejbCreate() throws CreateException 79 { 80 } 81 82 public void ejbActivate() 83 { 84 } 85 86 public void ejbPassivate() 87 { 88 } 89 90 public void ejbRemove() 91 { 92 } 93 94 public void setSessionContext(SessionContext ctx) 95 { 96 } 97 } 98 | Popular Tags |