1 25 package org.objectweb.easybeans.tests.interceptors.lifecycle.stateful.containermanaged; 26 27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.POST_CONSTRUCT; 28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.PRE_DESTROY; 29 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance; 30 31 import java.util.ArrayList ; 32 import java.util.List ; 33 34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck02; 35 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.BasePostConstructAllOrder00; 36 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.BasePreDestroyAllOrder00; 37 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.SFSBPostConstructAllOrder; 38 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.SFSBPreDestroyAllOrder; 39 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess; 40 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess; 41 import org.objectweb.easybeans.tests.common.interceptors.lifecycle.postconstruct.PostConstructLogger00; 42 import org.objectweb.easybeans.tests.common.interceptors.lifecycle.postconstruct.PostConstructLogger01; 43 import org.objectweb.easybeans.tests.common.interceptors.lifecycle.predestroy.PreDestroyLogger00; 44 import org.objectweb.easybeans.tests.common.interceptors.lifecycle.predestroy.PreDestroyLogger01; 45 import org.testng.annotations.AfterMethod; 46 import org.testng.annotations.BeforeClass; 47 import org.testng.annotations.BeforeMethod; 48 import org.testng.annotations.Test; 49 50 60 public class TestSFAllCallbackOrder00 { 61 62 65 private ItfCheck02 beanPostConstructAllOrder; 66 67 70 private ItfCheck02 beanPreDestroyAllOrder; 71 72 75 private ItfCallbackLoggerAccess beanLogger; 76 77 81 @BeforeClass 82 public void startBeans() throws Exception { 83 beanPostConstructAllOrder = getBeanRemoteInstance(SFSBPostConstructAllOrder.class, ItfCheck02.class); 84 beanPreDestroyAllOrder = getBeanRemoteInstance(SFSBPreDestroyAllOrder.class, ItfCheck02.class); 85 } 86 87 91 @BeforeMethod 92 public void startLog() throws Exception { 93 beanLogger = getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class); 94 beanLogger.deleteAll(); 95 } 96 97 103 @Test 104 public void testPostConstruct() throws Exception { 105 beanPostConstructAllOrder.check(); 106 107 List <String > arLife = new ArrayList <String >(); 109 110 arLife.add(PostConstructLogger00.class.getName()); 111 arLife.add(PostConstructLogger01.class.getName()); 112 arLife.add(BasePostConstructAllOrder00.class.getName()); 113 arLife.add(SFSBPostConstructAllOrder.class.getName()); 114 115 beanLogger.verifyCallbackOrder(SFSBPostConstructAllOrder.class, POST_CONSTRUCT, arLife.toArray(new String [0])); 116 } 117 118 124 @Test 125 public void testPreDestroy() throws Exception { 126 127 128 beanPreDestroyAllOrder.check(); 129 beanPreDestroyAllOrder.remove(); 130 131 List <String > arLife = new ArrayList <String >(); 133 134 arLife.add(PreDestroyLogger00.class.getName()); 135 arLife.add(PreDestroyLogger01.class.getName()); 136 arLife.add(BasePreDestroyAllOrder00.class.getName()); 137 arLife.add(SFSBPreDestroyAllOrder.class.getName()); 138 139 beanLogger.verifyCallbackOrder(SFSBPreDestroyAllOrder.class, PRE_DESTROY, arLife.toArray(new String [0])); 140 } 141 142 143 144 147 @AfterMethod 148 public void tearDown() { 149 beanLogger.deleteAll(); 150 } 151 } 152 | Popular Tags |