1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.sessioncontext; 26 27 import static org.testng.Assert.assertEquals; 28 import static org.testng.Assert.assertNotNull; 29 import static org.testng.Assert.assertTrue; 30 31 import javax.annotation.Resource; 32 import javax.ejb.Remote ; 33 import javax.ejb.SessionContext ; 34 import javax.ejb.Stateless ; 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 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextWS; 41 42 47 @Stateless (name = "SLSBSessionCtxMethods") 48 @Remote ({ItfSessionContextBMT.class, ItfSessionContextCMT.class, ItfSessionContextEJB3.class, 49 ItfSessionContextTimer.class, ItfSessionContextWS.class}) 50 public class SLSBSessionCtxMethods implements ItfSessionContextBMT, ItfSessionContextCMT, ItfSessionContextEJB3, 51 ItfSessionContextTimer, ItfSessionContextWS{ 52 53 56 @Resource 57 private SessionContext ctx; 58 59 62 public void verifySetRollbackOnly() { 63 ctx.setRollbackOnly(); 64 assertTrue(ctx.getRollbackOnly(), "The transaction should be marked to rollback."); 65 } 66 67 70 public void verifyGetRollbackOnly() { 71 this.verifySetRollbackOnly(); 72 } 73 74 77 public void verifyGetBusinessObject() { 78 ItfSessionContextCMT bean = ctx.getBusinessObject(ItfSessionContextCMT.class); 79 bean.verifyGetRollbackOnly(); 80 } 81 82 85 public void verifyGetInvokedBusinessInterface() { 86 Class cl = ctx.getInvokedBusinessInterface(); 87 assertEquals(cl, ItfSessionContextEJB3.class, "This method should return the " 88 + "interface ItfSessionContextEJB3, but returned " + cl.getName()); 89 } 90 91 94 public void verifyGetTimerService() { 95 assertNotNull(ctx.getTimerService(), "The Timer should not be null."); 96 } 97 98 101 public void verifyGetUserTransaction() { 102 ctx.getUserTransaction(); 104 } 105 106 109 public void verifyGetMessageContext() { 110 112 } 113 114 } 115 | Popular Tags |