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.ItfClassInterceptor; 33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBClassInterceptorTest00; 34 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor; 35 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder02Interceptor; 36 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor; 37 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder04Interceptor; 38 import org.testng.annotations.Test; 39 40 46 public class BaseClassInterceptor00 { 47 48 51 private ItfClassInterceptor<Integer > clBean; 52 53 58 @Test(groups = {"onlyClassInterceptor"}) 59 public void testClassInterCallOrder00() { 60 List <Integer > arResult = new ArrayList <Integer >(); 62 List <Integer > arExpected = new ArrayList <Integer >(); 63 64 arExpected.add(SLSBClassInterceptorTest00.ORDER); 68 69 arResult = clBean.withoutMethodInterceptor(arResult); 71 72 assertEquals(arExpected, arResult, "This class does not have interceptor, but the method is calling one."); 74 } 75 76 81 @Test(groups = {"excludeDefaultInterceptor"}) 82 public void testClassInterCallOrder01() { 83 List <Integer > arResult = new ArrayList <Integer >(); 85 List <Integer > arExpected = new ArrayList <Integer >(); 86 87 arExpected.add(SLSBClassInterceptorTest00.ORDER); 91 92 arResult = clBean.withExcludeDefaultInterceptor(arResult); 94 95 assertEquals(arExpected, arResult, 97 "This class does not have a default interceptor, but the method is calling one."); 98 } 99 100 106 @Test(groups = {"excludeClassInterceptor", "onlyClassInterceptor"}) 107 public void testClassInterCallOrder02() { 108 List <Integer > arResult = new ArrayList <Integer >(); 110 List <Integer > arExpected = new ArrayList <Integer >(); 111 112 arExpected.add(SLSBClassInterceptorTest00.ORDER); 114 115 arResult = clBean.withExcludeClassInterceptor(arResult); 117 118 assertEquals(arExpected, arResult, 120 "This method has the excludeClassInterceptor annotation, but the method is calling one."); 121 } 122 123 131 @Test(groups = {"methodInterceptor", "excludeClassInterceptor"}) 132 public void testClassInterCallOrder03() { 133 List <Integer > arResult = new ArrayList <Integer >(); 135 List <Integer > arExpected = new ArrayList <Integer >(); 136 137 arExpected.add(PrintOrder01Interceptor.ORDER); 139 arExpected.add(SLSBClassInterceptorTest00.ORDER); 141 142 arResult = clBean.excludeClassAndOneMtd(arResult); 144 145 assertEquals(arExpected, arResult, "The interceptors are running in a incorrect order."); 147 } 148 149 157 @Test(groups = {"excludeDefaultInterceptor", "excludeClassInterceptor", "methodInterceptor", "withInheritance"}) 158 public void testClassInterCallOrder04() { 159 List <Integer > arResult = new ArrayList <Integer >(); 161 List <Integer > arExpected = new ArrayList <Integer >(); 162 163 arExpected.add(PrintOrder01Interceptor.ORDER); 165 arExpected.add(PrintOrder02Interceptor.ORDER); 167 arExpected.add(PrintOrder03Interceptor.ORDER); 169 arExpected.add(PrintOrder04Interceptor.ORDER); 171 arExpected.add(SLSBClassInterceptorTest00.ORDER); 173 174 arResult = clBean.excludeClassDefAndFourMtd(arResult); 176 177 assertEquals(arExpected, arResult, "The method interceptors are running in the incorrect order."); 179 } 180 181 188 @Test(groups = {"methodInterceptor", "withInheritance"}) 189 public void testClassInterCallOrder05() { 190 List <Integer > arResult = new ArrayList <Integer >(); 192 List <Integer > arExpected = new ArrayList <Integer >(); 193 194 arExpected.add(PrintOrder01Interceptor.ORDER); 196 arExpected.add(PrintOrder02Interceptor.ORDER); 198 arExpected.add(PrintOrder03Interceptor.ORDER); 200 arExpected.add(SLSBClassInterceptorTest00.ORDER); 202 203 arResult = clBean.withThreeMethodInterceptor(arResult); 205 206 assertEquals(arExpected, arResult, "The method interceptor are running in the incorrect order."); 208 } 209 210 217 @Test(groups = {"methodInterceptor"}) 218 public void testClassInterCallOrder06() { 219 List <Integer > arResult = new ArrayList <Integer >(); 221 List <Integer > arExpected = new ArrayList <Integer >(); 222 223 arExpected.add(PrintOrder01Interceptor.ORDER); 225 arExpected.add(SLSBClassInterceptorTest00.ORDER); 227 228 arResult = clBean.withOneMethodInterceptor(arResult); 230 231 assertEquals(arExpected, arResult, "The method interceptor are running in the incorrect order."); 233 } 234 235 239 public void setBean(final ItfClassInterceptor<Integer > bean){ 240 this.clBean = bean; 241 } 242 } 243 | Popular Tags |