1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| package org.jboss.cache.jmx; |
24 |
| |
25 |
| import org.jboss.cache.config.Configuration; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| public class InterceptorRegistrationTest extends CacheJmxWrapperTestBase |
34 |
| { |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
| |
43 |
| |
44 |
| |
45 |
1
| public void testInterceptorMBeans1() throws Exception
|
46 |
| { |
47 |
| |
48 |
1
| createCache(createConfiguration());
|
49 |
1
| cache.start();
|
50 |
| |
51 |
1
| CacheJmxWrapperMBean wrapper = registerWrapper(cache);
|
52 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
53 |
| |
54 |
1
| interceptorRegistrationTest(true);
|
55 |
| |
56 |
| |
57 |
| |
58 |
1
| wrapper.stop();
|
59 |
1
| wrapper.destroy();
|
60 |
| |
61 |
| |
62 |
1
| interceptorRegistrationTest(true);
|
63 |
| |
64 |
1
| unregisterWrapper();
|
65 |
| |
66 |
1
| interceptorRegistrationTest(false);
|
67 |
| } |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
1
| public void testInterceptorMBeans2() throws Exception
|
80 |
| { |
81 |
| |
82 |
1
| createCache(createConfiguration());
|
83 |
1
| cache.start();
|
84 |
| |
85 |
1
| CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(cache);
|
86 |
1
| wrapper.start();
|
87 |
1
| wrapper = registerWrapper(wrapper);
|
88 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
89 |
| |
90 |
1
| interceptorRegistrationTest(true);
|
91 |
| |
92 |
1
| wrapper.stop();
|
93 |
1
| wrapper.destroy();
|
94 |
| |
95 |
| |
96 |
1
| interceptorRegistrationTest(false);
|
97 |
| |
98 |
1
| unregisterWrapper();
|
99 |
| |
100 |
1
| interceptorRegistrationTest(false);
|
101 |
| } |
102 |
| |
103 |
| |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
| |
109 |
| |
110 |
| |
111 |
| |
112 |
| |
113 |
1
| public void testInterceptorMBeans3() throws Exception
|
114 |
| { |
115 |
1
| CacheJmxWrapperMBean wrapper = registerWrapper(createConfiguration());
|
116 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
117 |
| |
118 |
| |
119 |
1
| wrapper.create();
|
120 |
1
| wrapper.start();
|
121 |
| |
122 |
1
| interceptorRegistrationTest(true);
|
123 |
| |
124 |
1
| wrapper.stop();
|
125 |
1
| wrapper.destroy();
|
126 |
| |
127 |
| |
128 |
1
| interceptorRegistrationTest(false);
|
129 |
| |
130 |
1
| unregisterWrapper();
|
131 |
| |
132 |
1
| interceptorRegistrationTest(false);
|
133 |
| } |
134 |
| |
135 |
| |
136 |
| |
137 |
| |
138 |
| |
139 |
| |
140 |
| |
141 |
| |
142 |
| |
143 |
| |
144 |
| |
145 |
1
| public void testInterceptorMBeans4() throws Exception
|
146 |
| { |
147 |
1
| CacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
148 |
| |
149 |
| |
150 |
1
| wrapper.create();
|
151 |
1
| wrapper.start();
|
152 |
| |
153 |
1
| registerWrapper(wrapper);
|
154 |
| |
155 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
156 |
| |
157 |
1
| interceptorRegistrationTest(true);
|
158 |
| |
159 |
1
| wrapper.stop();
|
160 |
1
| wrapper.destroy();
|
161 |
| |
162 |
| |
163 |
1
| interceptorRegistrationTest(false);
|
164 |
| |
165 |
1
| unregisterWrapper();
|
166 |
| |
167 |
1
| interceptorRegistrationTest(false);
|
168 |
| } |
169 |
| |
170 |
| |
171 |
| |
172 |
| |
173 |
| |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
| |
179 |
| |
180 |
1
| public void testInterceptorMBeans5() throws Exception
|
181 |
| { |
182 |
1
| CacheJmxWrapperMBean wrapper = registerWrapper();
|
183 |
| |
184 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
185 |
| |
186 |
| |
187 |
1
| wrapper.create();
|
188 |
1
| wrapper.start();
|
189 |
| |
190 |
1
| interceptorRegistrationTest(true);
|
191 |
| |
192 |
1
| wrapper.stop();
|
193 |
1
| wrapper.destroy();
|
194 |
| |
195 |
| |
196 |
1
| interceptorRegistrationTest(false);
|
197 |
| |
198 |
1
| unregisterWrapper();
|
199 |
| |
200 |
1
| interceptorRegistrationTest(false);
|
201 |
| } |
202 |
| |
203 |
| |
204 |
| |
205 |
| |
206 |
| |
207 |
| |
208 |
| |
209 |
| |
210 |
| |
211 |
| |
212 |
| |
213 |
1
| public void testInterceptorMBeans6() throws Exception
|
214 |
| { |
215 |
1
| CacheJmxWrapperMBean wrapper = registerWrapper();
|
216 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
217 |
| |
218 |
| |
219 |
1
| wrapper.create();
|
220 |
1
| wrapper.start();
|
221 |
| |
222 |
1
| interceptorRegistrationTest(true);
|
223 |
| |
224 |
1
| wrapper.stop();
|
225 |
1
| wrapper.destroy();
|
226 |
| |
227 |
1
| interceptorRegistrationTest(false);
|
228 |
| |
229 |
1
| unregisterWrapper();
|
230 |
| |
231 |
1
| interceptorRegistrationTest(false);
|
232 |
| } |
233 |
| |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
| |
240 |
| |
241 |
| |
242 |
| |
243 |
| |
244 |
1
| public void testInterceptorMBeans7() throws Exception
|
245 |
| { |
246 |
1
| CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(createCache(createConfiguration()));
|
247 |
| |
248 |
| |
249 |
1
| wrapper.create();
|
250 |
1
| wrapper.start();
|
251 |
| |
252 |
1
| wrapper = registerWrapper(wrapper);
|
253 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
254 |
| |
255 |
1
| interceptorRegistrationTest(true);
|
256 |
| |
257 |
1
| wrapper.stop();
|
258 |
1
| wrapper.destroy();
|
259 |
| |
260 |
1
| interceptorRegistrationTest(false);
|
261 |
| |
262 |
1
| unregisterWrapper();
|
263 |
| |
264 |
1
| interceptorRegistrationTest(false);
|
265 |
| } |
266 |
| |
267 |
| |
268 |
| |
269 |
| |
270 |
| |
271 |
| |
272 |
| |
273 |
| |
274 |
1
| public void testRegisterInterceptors1() throws Exception
|
275 |
| { |
276 |
1
| CacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
277 |
1
| wrapper.setRegisterInterceptors(false);
|
278 |
| |
279 |
1
| registerWrapper(wrapper);
|
280 |
| |
281 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
282 |
| |
283 |
1
| wrapper.create();
|
284 |
1
| wrapper.start();
|
285 |
| |
286 |
1
| interceptorRegistrationTest(false);
|
287 |
| |
288 |
1
| wrapper.stop();
|
289 |
1
| wrapper.destroy();
|
290 |
| |
291 |
1
| interceptorRegistrationTest(false);
|
292 |
| |
293 |
1
| unregisterWrapper();
|
294 |
| |
295 |
1
| interceptorRegistrationTest(false);
|
296 |
| } |
297 |
| |
298 |
| |
299 |
| |
300 |
| |
301 |
| |
302 |
| |
303 |
| |
304 |
| |
305 |
1
| public void testRegisterInterceptors2() throws Exception
|
306 |
| { |
307 |
1
| CacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
308 |
1
| wrapper.setRegisterInterceptors(false);
|
309 |
| |
310 |
1
| wrapper.create();
|
311 |
1
| wrapper.start();
|
312 |
| |
313 |
1
| registerWrapper(wrapper);
|
314 |
| |
315 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
316 |
| |
317 |
1
| interceptorRegistrationTest(false);
|
318 |
| |
319 |
1
| wrapper.stop();
|
320 |
1
| wrapper.destroy();
|
321 |
| |
322 |
1
| interceptorRegistrationTest(false);
|
323 |
| |
324 |
1
| unregisterWrapper();
|
325 |
| |
326 |
1
| interceptorRegistrationTest(false);
|
327 |
| } |
328 |
| |
329 |
1
| public void testExposeManagementStatistics1() throws Exception
|
330 |
| { |
331 |
1
| Configuration cfg = createConfiguration();
|
332 |
1
| cfg.setExposeManagementStatistics(false);
|
333 |
| |
334 |
1
| CacheJmxWrapper wrapper = createWrapper(cfg);
|
335 |
1
| registerWrapper(cfg);
|
336 |
| |
337 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
338 |
| |
339 |
1
| wrapper.create();
|
340 |
1
| wrapper.start();
|
341 |
| |
342 |
1
| interceptorRegistrationTest(false);
|
343 |
| |
344 |
1
| wrapper.stop();
|
345 |
1
| wrapper.destroy();
|
346 |
| |
347 |
1
| interceptorRegistrationTest(false);
|
348 |
| |
349 |
1
| unregisterWrapper();
|
350 |
| |
351 |
1
| interceptorRegistrationTest(false);
|
352 |
| } |
353 |
| |
354 |
1
| public void testExposeManagementStatistics2() throws Exception
|
355 |
| { |
356 |
1
| Configuration cfg = createConfiguration();
|
357 |
1
| cfg.setExposeManagementStatistics(false);
|
358 |
| |
359 |
1
| CacheJmxWrapper wrapper = createWrapper(cfg);
|
360 |
| |
361 |
1
| wrapper.create();
|
362 |
1
| wrapper.start();
|
363 |
| |
364 |
1
| registerWrapper(wrapper);
|
365 |
| |
366 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
367 |
| |
368 |
1
| interceptorRegistrationTest(false);
|
369 |
| |
370 |
1
| wrapper.stop();
|
371 |
1
| wrapper.destroy();
|
372 |
| |
373 |
1
| interceptorRegistrationTest(false);
|
374 |
| |
375 |
1
| unregisterWrapper();
|
376 |
| |
377 |
1
| interceptorRegistrationTest(false);
|
378 |
| |
379 |
| } |
380 |
| |
381 |
| |
382 |
| |
383 |
| } |