1 25 package org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.sessioncontext; 26 27 import static org.testng.Assert.assertEquals; 28 29 import javax.annotation.Resource; 30 import javax.ejb.Remote ; 31 import javax.ejb.SessionContext ; 32 import javax.ejb.Stateful ; 33 import javax.ejb.TransactionManagement ; 34 import javax.ejb.TransactionManagementType ; 35 36 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextBMT; 37 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextCMT; 38 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextEJB3; 39 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer; 40 41 46 @Stateful (name = "SFSBBeanManagedSessionCtxMethods") 47 @Remote ({ItfSessionContextBMT.class, ItfSessionContextCMT.class, ItfSessionContextEJB3.class, 48 ItfSessionContextTimer.class}) 49 @TransactionManagement (value = TransactionManagementType.BEAN) 50 public class SFSBBeanManagedSessionCtxMethods implements ItfSessionContextBMT, ItfSessionContextCMT, 51 ItfSessionContextEJB3, ItfSessionContextTimer { 52 53 56 @Resource 57 private SessionContext ctx; 58 59 62 public void verifySetRollbackOnly() { 63 ctx.setRollbackOnly(); 65 } 66 67 70 public void verifyGetRollbackOnly() { 71 ctx.getRollbackOnly(); 73 } 74 75 78 public void verifyGetBusinessObject() { 79 ItfSessionContextCMT bean = ctx.getBusinessObject(ItfSessionContextCMT.class); 80 bean.verifyGetRollbackOnly(); 81 } 82 83 86 public void verifyGetInvokedBusinessInterface() { 87 Class cl = ctx.getInvokedBusinessInterface(); 88 assertEquals(cl, ItfSessionContextEJB3.class, "This method should return the " 89 + "interface ItfSessionContextEJB3, but returned " + cl.getName()); 90 } 91 92 95 public void verifyGetTimerService() { 96 ctx.getTimerService(); 98 } 99 100 103 public void verifyGetUserTransaction() { 104 ctx.getUserTransaction(); 105 } 106 107 } 108 | Popular Tags |