1 25 package org.objectweb.easybeans.tests.interceptors.business.base.invocationorder; 26 27 import static org.objectweb.easybeans.tests.common.asserts.Assert.assertEquals; 28 29 import java.util.ArrayList ; 30 import java.util.List ; 31 32 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleBean; 33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest00; 34 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest01; 35 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest02; 36 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest03; 37 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor; 38 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor; 39 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder06Interceptor; 40 import org.testng.annotations.Test; 41 42 48 public class BaseMiscInterceptor00 { 49 50 53 private ItfSimpleBean<Integer > mtBean00; 54 55 58 private ItfSimpleBean<Integer > mtBean01; 59 60 63 private ItfSimpleBean<Integer > mtBean02; 64 65 68 private ItfSimpleBean<Integer > mtBean03; 69 70 78 @Test(groups = {"withInterceptor"}) 79 public void testMiscPublicInterCallOrder() { 80 List <Integer > arResult = new ArrayList <Integer >(); 82 List <Integer > arExpected = new ArrayList <Integer >(); 83 84 arExpected.add(PrintOrder06Interceptor.ORDER); 86 arExpected.add(PrintOrder01Interceptor.ORDER); 88 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 90 arExpected.add(SLSBSimpleInterceptorTest00.ORDER); 92 93 arResult = mtBean00.withInterceptors(arResult); 95 96 assertEquals(arExpected, arResult, 97 "The method has class interceptors, a method interceptor and a public bean interceptor method" 98 + " declared inside the bean; however it isn't running in the correct order."); 99 } 100 101 109 @Test(groups = {"withInterceptor"}) 110 public void testMiscProtectedInterCallOrder() { 111 List <Integer > arResult = new ArrayList <Integer >(); 113 List <Integer > arExpected = new ArrayList <Integer >(); 114 115 arExpected.add(PrintOrder06Interceptor.ORDER); 117 arExpected.add(PrintOrder01Interceptor.ORDER); 119 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 121 arExpected.add(SLSBSimpleInterceptorTest01.ORDER); 123 124 arResult = mtBean01.withInterceptors(arResult); 126 127 assertEquals(arExpected, arResult, 129 "The method has class interceptors, a method interceptor and a protected bean interceptor method" 130 + " declared inside the bean; however it isn't running in the correct order."); 131 } 132 133 141 @Test(groups = {"withInterceptor"}) 142 public void testMiscPrivateInterCallOrder() { 143 List <Integer > arResult = new ArrayList <Integer >(); 145 List <Integer > arExpected = new ArrayList <Integer >(); 146 147 arExpected.add(PrintOrder06Interceptor.ORDER); 149 arExpected.add(PrintOrder01Interceptor.ORDER); 151 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 153 arExpected.add(SLSBSimpleInterceptorTest02.ORDER); 155 156 arResult = mtBean02.withInterceptors(arResult); 158 159 assertEquals(arExpected, arResult, 161 "The method has class interceptors, a method interceptor and a protected bean interceptor method" 162 + " declared inside the bean; however it isn't running in the correct order."); 163 } 164 165 173 @Test(groups = {"withInterceptor", "withInheritance"}) 174 public void testMiscInheritanceInterCallOrder00() { 175 List <Integer > arResult = new ArrayList <Integer >(); 177 List <Integer > arExpected = new ArrayList <Integer >(); 178 179 arExpected.add(PrintOrder06Interceptor.ORDER); 181 arExpected.add(PrintOrder03Interceptor.ORDER); 183 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 185 arExpected.add(SLSBSimpleInterceptorTest00.ORDER); 187 188 arResult = mtBean00.withInterceptorsInheritance(arResult); 190 191 assertEquals(arExpected, arResult, 193 "The method has class interceptors, a method interceptor with inheritance and a public bean interceptor method" 194 + " declared inside the bean; however it isn't running in the correct order."); 195 } 196 197 205 @Test(groups = {"withInterceptor", "withInheritance"}) 206 public void testMiscInheritanceInterCallOrder01() { 207 List <Integer > arResult = new ArrayList <Integer >(); 209 List <Integer > arExpected = new ArrayList <Integer >(); 210 211 arExpected.add(PrintOrder06Interceptor.ORDER); 213 arExpected.add(PrintOrder03Interceptor.ORDER); 215 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 217 arExpected.add(SLSBSimpleInterceptorTest01.ORDER); 219 220 arResult = mtBean01.withInterceptorsInheritance(arResult); 222 223 assertEquals(arExpected, arResult, 225 "The method has class interceptors, a method interceptor with inheritance and a protected bean interceptor method" 226 + " declared inside the bean; however it isn't running in the correct order."); 227 } 228 229 237 @Test(groups = {"withInterceptor", "withInheritance"}) 238 public void testMiscInheritanceInterCallOrder02() { 239 List <Integer > arResult = new ArrayList <Integer >(); 241 List <Integer > arExpected = new ArrayList <Integer >(); 242 243 arExpected.add(PrintOrder06Interceptor.ORDER); 245 arExpected.add(PrintOrder03Interceptor.ORDER); 247 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 249 arExpected.add(SLSBSimpleInterceptorTest02.ORDER); 251 252 arResult = mtBean02.withInterceptorsInheritance(arResult); 254 255 assertEquals(arExpected, arResult, 257 "The method has class interceptors, a method interceptor with inheritance and a private bean interceptor method" 258 + " declared inside the bean; however it isn't running in the correct order."); 259 } 260 261 269 @Test(groups = {"withInterceptor"}) 270 public void testMiscPackageInterCallOrder() { 271 List <Integer > arResult = new ArrayList <Integer >(); 273 List <Integer > arExpected = new ArrayList <Integer >(); 274 275 arExpected.add(PrintOrder03Interceptor.ORDER); 277 arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR); 279 arExpected.add(SLSBSimpleInterceptorTest03.ORDER); 281 282 arResult = mtBean03.withInterceptorsInheritance(arResult); 284 285 assertEquals(arExpected, arResult, 287 "The method has a method interceptor and a package level bean interceptor method" 288 + " declared inside the bean; however it isn't running in the correct order."); 289 } 290 291 298 public void setBeans(final ItfSimpleBean<Integer > bean00, final ItfSimpleBean<Integer > bean01, 299 final ItfSimpleBean<Integer > bean02, final ItfSimpleBean<Integer > bean03) { 300 this.mtBean00 = bean00; 301 this.mtBean01 = bean01; 302 this.mtBean02 = bean02; 303 this.mtBean03 = bean03; 304 } 305 } 306 | Popular Tags |