|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| package org.objectweb.easybeans.tests.interceptors.business.base; |
|
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.SLSBSimpleInterceptorTest00; |
|
34 |
| import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.SLSBSimpleInterceptorTest01; |
|
35 |
| import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.SLSBSimpleInterceptorTest02; |
|
36 |
| import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.SLSBSimpleInterceptorTest03; |
|
37 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder01Interceptor; |
|
38 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder03Interceptor; |
|
39 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder06Interceptor; |
|
40 |
| import org.testng.annotations.Test; |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| public class BaseMiscInterceptor00 { |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| private ItfSimpleBean<Integer> mtBean00; |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| private ItfSimpleBean<Integer> mtBean01; |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| private ItfSimpleBean<Integer> mtBean02; |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| private ItfSimpleBean<Integer> mtBean03; |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
1
| @Test(groups = {"withInterceptor"})
|
|
79 |
| public void testMiscPublicInterCallOrder() { |
|
80 |
| |
|
81 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
82 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
83 |
| |
|
84 |
| |
|
85 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
86 |
| |
|
87 |
1
| arExpected.add(PrintOrder01Interceptor.ORDER);
|
|
88 |
| |
|
89 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
90 |
| |
|
91 |
1
| arExpected.add(SLSBSimpleInterceptorTest00.ORDER);
|
|
92 |
| |
|
93 |
| |
|
94 |
1
| arResult = mtBean00.withInterceptors(arResult);
|
|
95 |
| |
|
96 |
1
| 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 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| |
|
109 |
1
| @Test(groups = {"withInterceptor"})
|
|
110 |
| public void testMiscProtectedInterCallOrder() { |
|
111 |
| |
|
112 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
113 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
114 |
| |
|
115 |
| |
|
116 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
117 |
| |
|
118 |
1
| arExpected.add(PrintOrder01Interceptor.ORDER);
|
|
119 |
| |
|
120 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
121 |
| |
|
122 |
1
| arExpected.add(SLSBSimpleInterceptorTest01.ORDER);
|
|
123 |
| |
|
124 |
| |
|
125 |
1
| arResult = mtBean01.withInterceptors(arResult);
|
|
126 |
| |
|
127 |
| |
|
128 |
1
| 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 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
| |
|
138 |
| |
|
139 |
| |
|
140 |
| |
|
141 |
1
| @Test(groups = {"withInterceptor"})
|
|
142 |
| public void testMiscPrivateInterCallOrder() { |
|
143 |
| |
|
144 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
145 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
146 |
| |
|
147 |
| |
|
148 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
149 |
| |
|
150 |
1
| arExpected.add(PrintOrder01Interceptor.ORDER);
|
|
151 |
| |
|
152 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
153 |
| |
|
154 |
1
| arExpected.add(SLSBSimpleInterceptorTest02.ORDER);
|
|
155 |
| |
|
156 |
| |
|
157 |
1
| arResult = mtBean02.withInterceptors(arResult);
|
|
158 |
| |
|
159 |
| |
|
160 |
1
| 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 |
| |
|
166 |
| |
|
167 |
| |
|
168 |
| |
|
169 |
| |
|
170 |
| |
|
171 |
| |
|
172 |
| |
|
173 |
1
| @Test(groups = {"withInterceptor", "withInheritance"})
|
|
174 |
| public void testMiscInheritanceInterCallOrder00() { |
|
175 |
| |
|
176 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
177 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
178 |
| |
|
179 |
| |
|
180 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
181 |
| |
|
182 |
1
| arExpected.add(PrintOrder03Interceptor.ORDER);
|
|
183 |
| |
|
184 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
185 |
| |
|
186 |
1
| arExpected.add(SLSBSimpleInterceptorTest00.ORDER);
|
|
187 |
| |
|
188 |
| |
|
189 |
1
| arResult = mtBean00.withInterceptorsInheritance(arResult);
|
|
190 |
| |
|
191 |
| |
|
192 |
1
| 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 |
| |
|
198 |
| |
|
199 |
| |
|
200 |
| |
|
201 |
| |
|
202 |
| |
|
203 |
| |
|
204 |
| |
|
205 |
1
| @Test(groups = {"withInterceptor", "withInheritance"})
|
|
206 |
| public void testMiscInheritanceInterCallOrder01() { |
|
207 |
| |
|
208 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
209 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
210 |
| |
|
211 |
| |
|
212 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
213 |
| |
|
214 |
1
| arExpected.add(PrintOrder03Interceptor.ORDER);
|
|
215 |
| |
|
216 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
217 |
| |
|
218 |
1
| arExpected.add(SLSBSimpleInterceptorTest01.ORDER);
|
|
219 |
| |
|
220 |
| |
|
221 |
1
| arResult = mtBean01.withInterceptorsInheritance(arResult);
|
|
222 |
| |
|
223 |
| |
|
224 |
1
| 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 |
| |
|
230 |
| |
|
231 |
| |
|
232 |
| |
|
233 |
| |
|
234 |
| |
|
235 |
| |
|
236 |
| |
|
237 |
1
| @Test(groups = {"withInterceptor", "withInheritance"})
|
|
238 |
| public void testMiscInheritanceInterCallOrder02() { |
|
239 |
| |
|
240 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
241 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
242 |
| |
|
243 |
| |
|
244 |
1
| arExpected.add(PrintOrder06Interceptor.ORDER);
|
|
245 |
| |
|
246 |
1
| arExpected.add(PrintOrder03Interceptor.ORDER);
|
|
247 |
| |
|
248 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
249 |
| |
|
250 |
1
| arExpected.add(SLSBSimpleInterceptorTest02.ORDER);
|
|
251 |
| |
|
252 |
| |
|
253 |
1
| arResult = mtBean02.withInterceptorsInheritance(arResult);
|
|
254 |
| |
|
255 |
| |
|
256 |
1
| 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 |
| |
|
262 |
| |
|
263 |
| |
|
264 |
| |
|
265 |
| |
|
266 |
| |
|
267 |
| |
|
268 |
| |
|
269 |
1
| @Test(groups = {"withInterceptor"})
|
|
270 |
| public void testMiscPackageInterCallOrder() { |
|
271 |
| |
|
272 |
1
| List<Integer> arResult = new ArrayList<Integer>();
|
|
273 |
1
| List<Integer> arExpected = new ArrayList<Integer>();
|
|
274 |
| |
|
275 |
| |
|
276 |
1
| arExpected.add(PrintOrder03Interceptor.ORDER);
|
|
277 |
| |
|
278 |
1
| arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
|
|
279 |
| |
|
280 |
1
| arExpected.add(SLSBSimpleInterceptorTest03.ORDER);
|
|
281 |
| |
|
282 |
| |
|
283 |
1
| arResult = mtBean03.withInterceptorsInheritance(arResult);
|
|
284 |
| |
|
285 |
| |
|
286 |
1
| 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 |
| |
|
292 |
| |
|
293 |
| |
|
294 |
| |
|
295 |
| |
|
296 |
| |
|
297 |
| |
|
298 |
7
| public void setBeans(final ItfSimpleBean<Integer> bean00, final ItfSimpleBean<Integer> bean01,
|
|
299 |
| final ItfSimpleBean<Integer> bean02, final ItfSimpleBean<Integer> bean03) { |
|
300 |
7
| this.mtBean00 = bean00;
|
|
301 |
7
| this.mtBean01 = bean01;
|
|
302 |
7
| this.mtBean02 = bean02;
|
|
303 |
7
| this.mtBean03 = bean03;
|
|
304 |
| } |
|
305 |
| } |