|
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.common.ejbs.base; |
|
26 |
| |
|
27 |
| import java.util.ArrayList; |
|
28 |
| import java.util.List; |
|
29 |
| |
|
30 |
| import javax.annotation.PostConstruct; |
|
31 |
| import javax.interceptor.Interceptors; |
|
32 |
| |
|
33 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PackageInterceptor; |
|
34 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder01Interceptor; |
|
35 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder02Interceptor; |
|
36 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder03Interceptor; |
|
37 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder04Interceptor; |
|
38 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder05Interceptor; |
|
39 |
| import org.objectweb.easybeans.tests.common.interceptors.business.PrivateInterceptor; |
|
40 |
| import org.objectweb.easybeans.tests.common.interceptors.business.ProtectedInterceptor; |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| public class MethodInterceptorTest implements ItfMethodInterceptor<Integer> { |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| private List<Integer> lstPostconstruct; |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
2
| @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class,
|
|
63 |
| PrintOrder04Interceptor.class, PrintOrder05Interceptor.class}) |
|
64 |
| public List<Integer> withFiveMethodInterceptors(final List<Integer> par) { |
|
65 |
2
| par.add(ORDER);
|
|
66 |
2
| return par;
|
|
67 |
| } |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
2
| @Interceptors({PrintOrder05Interceptor.class, PrintOrder04Interceptor.class, PrintOrder03Interceptor.class,
|
|
77 |
| PrintOrder02Interceptor.class, PrintOrder01Interceptor.class}) |
|
78 |
| public List<Integer> withFiveMethodInterceptorsInverse(final List<Integer> par) { |
|
79 |
2
| par.add(ORDER);
|
|
80 |
2
| return par;
|
|
81 |
| } |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
2
| @Interceptors({PrintOrder01Interceptor.class})
|
|
90 |
| public List<Integer> withOneMethodInterceptor(final List<Integer> par) { |
|
91 |
2
| par.add(ORDER);
|
|
92 |
2
| return par;
|
|
93 |
| } |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
2
| public List<Integer> withoutInterceptor(final List<Integer> par) {
|
|
102 |
2
| par.add(ORDER);
|
|
103 |
2
| return par;
|
|
104 |
| } |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| |
|
109 |
| |
|
110 |
| |
|
111 |
| |
|
112 |
2
| @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class})
|
|
113 |
| public List<Integer> withTwoMethodInterceptors(final List<Integer> par) { |
|
114 |
2
| par.add(ORDER);
|
|
115 |
2
| return par;
|
|
116 |
| } |
|
117 |
| |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
| |
|
122 |
0
| public boolean checkPostbackInterceptors(){
|
|
123 |
0
| return (lstPostconstruct != null);
|
|
124 |
| } |
|
125 |
| |
|
126 |
| |
|
127 |
| |
|
128 |
| |
|
129 |
2
| @PostConstruct
|
|
130 |
| public void postConstruct(){ |
|
131 |
2
| lstPostconstruct = new ArrayList<Integer>();
|
|
132 |
| } |
|
133 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
| |
|
138 |
| |
|
139 |
| |
|
140 |
2
| @Interceptors({PrivateInterceptor.class, ProtectedInterceptor.class, PrintOrder01Interceptor.class,
|
|
141 |
| PrivateInterceptor.class, PrintOrder03Interceptor.class, PrivateInterceptor.class, ProtectedInterceptor.class, |
|
142 |
| ProtectedInterceptor.class}) |
|
143 |
| public List<Integer> withPrivateProtectedPublicInterceptors(final List<Integer> par) { |
|
144 |
2
| par.add(ORDER);
|
|
145 |
2
| return par;
|
|
146 |
| } |
|
147 |
| |
|
148 |
| |
|
149 |
| |
|
150 |
| |
|
151 |
| |
|
152 |
| |
|
153 |
| |
|
154 |
2
| @Interceptors({PrivateInterceptor.class, PrivateInterceptor.class, PrivateInterceptor.class})
|
|
155 |
| public List<Integer> withPrivateInterceptors(final List<Integer> par) { |
|
156 |
2
| par.add(ORDER);
|
|
157 |
2
| return par;
|
|
158 |
| } |
|
159 |
| |
|
160 |
| |
|
161 |
| |
|
162 |
| |
|
163 |
| |
|
164 |
| |
|
165 |
| |
|
166 |
2
| @Interceptors({ProtectedInterceptor.class, ProtectedInterceptor.class})
|
|
167 |
| public List<Integer> withProtectedInterceptors(final List<Integer> par) { |
|
168 |
2
| par.add(ORDER);
|
|
169 |
2
| return par;
|
|
170 |
| } |
|
171 |
| |
|
172 |
| |
|
173 |
| |
|
174 |
| |
|
175 |
| |
|
176 |
| |
|
177 |
| |
|
178 |
2
| @Interceptors({PackageInterceptor.class, PackageInterceptor.class, PackageInterceptor.class, PackageInterceptor.class})
|
|
179 |
| public List<Integer> withPackageInterceptors(final List<Integer> par) { |
|
180 |
2
| par.add(ORDER);
|
|
181 |
2
| return par;
|
|
182 |
| } |
|
183 |
| } |