1 25 package org.objectweb.easybeans.tests.sessionbean.stateful.context; 26 27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance; 28 import static org.objectweb.easybeans.tests.common.helper.ExceptionHelper.checkCause; 29 import static org.testng.Assert.fail; 30 31 import javax.ejb.EJBException ; 32 33 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextBMT; 34 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextCMT; 35 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextEJB3; 36 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer; 37 import org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.sessioncontext.SFSBBeanManagedSessionCtxMethods; 38 import org.testng.annotations.BeforeMethod; 39 import org.testng.annotations.Test; 40 41 52 public class TestSFBeanManagedSessionContextMethods00 implements ItfSessionContextBMT, ItfSessionContextCMT, 53 ItfSessionContextEJB3, ItfSessionContextTimer { 54 55 58 private ItfSessionContextBMT beanBMT; 59 60 63 private ItfSessionContextCMT beanCMT; 64 65 68 private ItfSessionContextEJB3 beanEJB3; 69 70 71 74 private ItfSessionContextTimer beanTimer; 75 76 80 @BeforeMethod 81 public void startUp() throws Exception { 82 beanBMT = getBeanRemoteInstance(SFSBBeanManagedSessionCtxMethods.class, ItfSessionContextBMT.class); 83 beanCMT = getBeanRemoteInstance(SFSBBeanManagedSessionCtxMethods.class, ItfSessionContextCMT.class); 84 beanEJB3 = getBeanRemoteInstance(SFSBBeanManagedSessionCtxMethods.class, ItfSessionContextEJB3.class); 85 beanTimer = getBeanRemoteInstance(SFSBBeanManagedSessionCtxMethods.class, ItfSessionContextTimer.class); 86 } 87 88 93 @Test 94 public void verifyGetUserTransaction() { 95 beanBMT.verifyGetUserTransaction(); 96 } 97 98 103 @Test 104 public void verifyGetBusinessObject() { 105 beanEJB3.verifyGetBusinessObject(); 106 } 107 108 113 @Test 114 public void verifyGetInvokedBusinessInterface() { 115 beanEJB3.verifyGetInvokedBusinessInterface(); 116 } 117 118 123 @Test 124 public void verifyGetTimerService() { 125 try { 126 beanTimer.verifyGetTimerService(); 127 fail("The bean must throw an exception."); 128 } catch (EJBException e) { 129 checkCause(e, IllegalStateException .class); 130 } 131 132 } 133 134 139 @Test 140 public void verifySetRollbackOnly() { 141 try { 142 beanCMT.verifySetRollbackOnly(); 143 fail("The bean must throw an exception."); 144 } catch (EJBException e) { 145 checkCause(e, IllegalStateException .class); 146 } 147 } 148 149 154 @Test 155 public void verifyGetRollbackOnly() { 156 try { 157 beanCMT.verifyGetRollbackOnly(); 158 fail("The bean must throw an exception."); 159 } catch (EJBException e) { 160 checkCause(e, IllegalStateException .class); 161 } 162 } 163 164 165 } 166 | Popular Tags |