1 25 package org.objectweb.easybeans.tests.sessionbean.stateful.remove; 26 27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance; 28 29 import javax.ejb.NoSuchEJBException ; 30 31 import org.objectweb.easybeans.log.JLog; 32 import org.objectweb.easybeans.log.JLogFactory; 33 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck00; 34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck02; 35 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck03; 36 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.remove.SFSBRemove00; 37 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.remove.SFSBRemoveByException; 38 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.remove.SFSBRemoveWithRetain; 39 import org.objectweb.easybeans.tests.common.exception.AppException; 40 import org.testng.annotations.BeforeClass; 41 import org.testng.annotations.Test; 42 43 51 public class TestSFRemove { 52 53 56 private JLog logger = JLogFactory.getLog(TestSFRemove.class); 57 58 61 private ItfCheck02 beanRemoveDefault; 62 63 66 private ItfCheck00 beanRemoveByException; 67 68 71 private ItfCheck03 beanRetain; 72 73 77 @BeforeClass 78 public void startUp() throws Exception { 79 beanRemoveDefault = getBeanRemoteInstance(SFSBRemove00.class, ItfCheck02.class); 80 beanRemoveByException = getBeanRemoteInstance(SFSBRemoveByException.class, ItfCheck00.class); 81 beanRetain = getBeanRemoteInstance(SFSBRemoveWithRetain.class, ItfCheck03.class); 82 } 83 84 90 @Test(expectedExceptions = { NoSuchEJBException .class }) 91 public void testRemoveMethod() throws Exception { 92 beanRemoveDefault.remove(); 93 beanRemoveDefault.check(); 94 } 95 96 102 @Test(expectedExceptions = { NoSuchEJBException .class }) 103 public void testRemoveBySystemException() throws Exception { 104 try { 105 beanRemoveByException.check(); 106 } catch (Exception e) { 107 logger.debug("Exception."); 108 } 109 beanRemoveByException.check(); 110 } 111 112 119 @Test 120 public void testRetain() throws Exception { 121 try { 122 beanRetain.remove(); 123 }catch (AppException e) { 124 logger.debug("Expected Exception occured."); 125 }catch (Exception e) { 126 logger.debug("Exception"); 127 } 128 beanRetain.check(); 129 } 130 } 131 | Popular Tags |