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.pojo.jmx; |
24 |
| |
25 |
| import org.jboss.cache.config.Configuration; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| public class InterceptorRegistrationTest extends PojoCacheJmxWrapperTestBase |
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
| PojoCacheJmxWrapperMBean wrapper = registerWrapper(cache);
|
52 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
53 |
| |
54 |
1
| interceptorRegistrationTest(true);
|
55 |
| |
56 |
1
| wrapper.stop();
|
57 |
1
| wrapper.destroy();
|
58 |
| |
59 |
| |
60 |
1
| interceptorRegistrationTest(true);
|
61 |
| |
62 |
1
| unregisterWrapper();
|
63 |
| |
64 |
1
| interceptorRegistrationTest(false);
|
65 |
| } |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
1
| public void testInterceptorMBeans2() throws Exception
|
78 |
| { |
79 |
| |
80 |
1
| createCache(createConfiguration());
|
81 |
1
| cache.start();
|
82 |
| |
83 |
1
| PojoCacheJmxWrapperMBean wrapper = new PojoCacheJmxWrapper(cache);
|
84 |
1
| wrapper.start();
|
85 |
1
| wrapper = registerWrapper(wrapper);
|
86 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
87 |
| |
88 |
1
| interceptorRegistrationTest(true);
|
89 |
| |
90 |
1
| wrapper.stop();
|
91 |
1
| wrapper.destroy();
|
92 |
| |
93 |
| |
94 |
1
| interceptorRegistrationTest(false);
|
95 |
| |
96 |
1
| unregisterWrapper();
|
97 |
| |
98 |
1
| interceptorRegistrationTest(false);
|
99 |
| } |
100 |
| |
101 |
| |
102 |
| |
103 |
| |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
| |
109 |
| |
110 |
| |
111 |
1
| public void testInterceptorMBeans3() throws Exception
|
112 |
| { |
113 |
1
| PojoCacheJmxWrapperMBean wrapper = registerWrapper(createConfiguration());
|
114 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
115 |
| |
116 |
| |
117 |
1
| wrapper.create();
|
118 |
1
| wrapper.start();
|
119 |
| |
120 |
1
| interceptorRegistrationTest(true);
|
121 |
| |
122 |
1
| wrapper.stop();
|
123 |
1
| wrapper.destroy();
|
124 |
| |
125 |
| |
126 |
1
| interceptorRegistrationTest(false);
|
127 |
| |
128 |
1
| unregisterWrapper();
|
129 |
| |
130 |
1
| interceptorRegistrationTest(false);
|
131 |
| } |
132 |
| |
133 |
| |
134 |
| |
135 |
| |
136 |
| |
137 |
| |
138 |
| |
139 |
| |
140 |
| |
141 |
| |
142 |
| |
143 |
1
| public void testInterceptorMBeans4() throws Exception
|
144 |
| { |
145 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
146 |
| |
147 |
| |
148 |
1
| wrapper.create();
|
149 |
1
| wrapper.start();
|
150 |
| |
151 |
1
| registerWrapper(wrapper);
|
152 |
| |
153 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
154 |
| |
155 |
1
| interceptorRegistrationTest(true);
|
156 |
| |
157 |
1
| wrapper.stop();
|
158 |
1
| wrapper.destroy();
|
159 |
| |
160 |
| |
161 |
1
| interceptorRegistrationTest(false);
|
162 |
| |
163 |
1
| unregisterWrapper();
|
164 |
| |
165 |
1
| interceptorRegistrationTest(false);
|
166 |
| } |
167 |
| |
168 |
| |
169 |
| |
170 |
| |
171 |
| |
172 |
| |
173 |
| |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
1
| public void testInterceptorMBeans5() throws Exception
|
179 |
| { |
180 |
1
| PojoCacheJmxWrapperMBean wrapper = new PojoCacheJmxWrapper(createCache(createConfiguration()));
|
181 |
| |
182 |
1
| wrapper = registerWrapper(wrapper);
|
183 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
184 |
| |
185 |
| |
186 |
1
| wrapper.create();
|
187 |
1
| wrapper.start();
|
188 |
| |
189 |
1
| interceptorRegistrationTest(true);
|
190 |
| |
191 |
1
| wrapper.stop();
|
192 |
1
| wrapper.destroy();
|
193 |
| |
194 |
| |
195 |
1
| interceptorRegistrationTest(false);
|
196 |
| |
197 |
1
| unregisterWrapper();
|
198 |
| |
199 |
1
| interceptorRegistrationTest(false);
|
200 |
| } |
201 |
| |
202 |
| |
203 |
| |
204 |
| |
205 |
| |
206 |
| |
207 |
| |
208 |
| |
209 |
| |
210 |
| |
211 |
| |
212 |
1
| public void testInterceptorMBeans6() throws Exception
|
213 |
| { |
214 |
1
| PojoCacheJmxWrapperMBean wrapper = registerWrapper();
|
215 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
216 |
| |
217 |
| |
218 |
1
| wrapper.create();
|
219 |
1
| wrapper.start();
|
220 |
| |
221 |
1
| interceptorRegistrationTest(true);
|
222 |
| |
223 |
1
| wrapper.stop();
|
224 |
1
| wrapper.destroy();
|
225 |
| |
226 |
1
| interceptorRegistrationTest(false);
|
227 |
| |
228 |
1
| unregisterWrapper();
|
229 |
| |
230 |
1
| interceptorRegistrationTest(false);
|
231 |
| } |
232 |
| |
233 |
| |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
| |
240 |
| |
241 |
| |
242 |
| |
243 |
1
| public void testInterceptorMBeans7() throws Exception
|
244 |
| { |
245 |
1
| PojoCacheJmxWrapperMBean wrapper = new PojoCacheJmxWrapper(createCache(createConfiguration()));
|
246 |
| |
247 |
| |
248 |
1
| wrapper.create();
|
249 |
1
| wrapper.start();
|
250 |
| |
251 |
1
| wrapper = registerWrapper(wrapper);
|
252 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
253 |
| |
254 |
1
| interceptorRegistrationTest(true);
|
255 |
| |
256 |
1
| wrapper.stop();
|
257 |
1
| wrapper.destroy();
|
258 |
| |
259 |
1
| interceptorRegistrationTest(false);
|
260 |
| |
261 |
1
| unregisterWrapper();
|
262 |
| |
263 |
1
| interceptorRegistrationTest(false);
|
264 |
| } |
265 |
| |
266 |
| |
267 |
| |
268 |
| |
269 |
| |
270 |
| |
271 |
| |
272 |
| |
273 |
1
| public void testRegisterInterceptors1() throws Exception
|
274 |
| { |
275 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
276 |
1
| wrapper.setRegisterInterceptors(false);
|
277 |
| |
278 |
1
| registerWrapper(wrapper);
|
279 |
| |
280 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
281 |
| |
282 |
1
| wrapper.create();
|
283 |
1
| wrapper.start();
|
284 |
| |
285 |
1
| interceptorRegistrationTest(false);
|
286 |
| |
287 |
1
| wrapper.stop();
|
288 |
1
| wrapper.destroy();
|
289 |
| |
290 |
1
| interceptorRegistrationTest(false);
|
291 |
| |
292 |
1
| unregisterWrapper();
|
293 |
| |
294 |
1
| interceptorRegistrationTest(false);
|
295 |
| } |
296 |
| |
297 |
| |
298 |
| |
299 |
| |
300 |
| |
301 |
| |
302 |
| |
303 |
| |
304 |
1
| public void testRegisterInterceptors2() throws Exception
|
305 |
| { |
306 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
307 |
1
| wrapper.setRegisterInterceptors(false);
|
308 |
| |
309 |
1
| wrapper.create();
|
310 |
1
| wrapper.start();
|
311 |
| |
312 |
1
| registerWrapper(wrapper);
|
313 |
| |
314 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
315 |
| |
316 |
1
| interceptorRegistrationTest(false);
|
317 |
| |
318 |
1
| wrapper.stop();
|
319 |
1
| wrapper.destroy();
|
320 |
| |
321 |
1
| interceptorRegistrationTest(false);
|
322 |
| |
323 |
1
| unregisterWrapper();
|
324 |
| |
325 |
1
| interceptorRegistrationTest(false);
|
326 |
| } |
327 |
| |
328 |
| |
329 |
| |
330 |
| |
331 |
| |
332 |
| |
333 |
| |
334 |
| |
335 |
1
| public void testRegisterPlainCache1() throws Exception
|
336 |
| { |
337 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
338 |
1
| wrapper.setRegisterPlainCache(false);
|
339 |
1
| wrapper.setRegisterInterceptors(true);
|
340 |
| |
341 |
1
| registerWrapper(wrapper);
|
342 |
| |
343 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
344 |
| |
345 |
1
| wrapper.create();
|
346 |
1
| wrapper.start();
|
347 |
| |
348 |
1
| interceptorRegistrationTest(false);
|
349 |
| |
350 |
1
| wrapper.stop();
|
351 |
1
| wrapper.destroy();
|
352 |
| |
353 |
1
| interceptorRegistrationTest(false);
|
354 |
| |
355 |
1
| unregisterWrapper();
|
356 |
| |
357 |
1
| interceptorRegistrationTest(false);
|
358 |
| } |
359 |
| |
360 |
| |
361 |
| |
362 |
| |
363 |
| |
364 |
| |
365 |
| |
366 |
| |
367 |
1
| public void testRegisterPlainCache2() throws Exception
|
368 |
| { |
369 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(createConfiguration());
|
370 |
1
| wrapper.setRegisterPlainCache(false);
|
371 |
1
| wrapper.setRegisterInterceptors(true);
|
372 |
| |
373 |
1
| wrapper.create();
|
374 |
1
| wrapper.start();
|
375 |
| |
376 |
1
| registerWrapper(wrapper);
|
377 |
| |
378 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
379 |
| |
380 |
1
| interceptorRegistrationTest(false);
|
381 |
| |
382 |
1
| wrapper.stop();
|
383 |
1
| wrapper.destroy();
|
384 |
| |
385 |
1
| interceptorRegistrationTest(false);
|
386 |
| |
387 |
1
| unregisterWrapper();
|
388 |
| |
389 |
1
| interceptorRegistrationTest(false);
|
390 |
| } |
391 |
| |
392 |
1
| public void testExposeManagementStatistics1() throws Exception
|
393 |
| { |
394 |
1
| Configuration cfg = createConfiguration();
|
395 |
1
| cfg.setExposeManagementStatistics(false);
|
396 |
| |
397 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(cfg);
|
398 |
1
| registerWrapper(cfg);
|
399 |
| |
400 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
401 |
| |
402 |
1
| wrapper.create();
|
403 |
1
| wrapper.start();
|
404 |
| |
405 |
1
| interceptorRegistrationTest(false);
|
406 |
| |
407 |
1
| wrapper.stop();
|
408 |
1
| wrapper.destroy();
|
409 |
| |
410 |
1
| interceptorRegistrationTest(false);
|
411 |
| |
412 |
1
| unregisterWrapper();
|
413 |
| |
414 |
1
| interceptorRegistrationTest(false);
|
415 |
| } |
416 |
| |
417 |
1
| public void testExposeManagementStatistics2() throws Exception
|
418 |
| { |
419 |
1
| Configuration cfg = createConfiguration();
|
420 |
1
| cfg.setExposeManagementStatistics(false);
|
421 |
| |
422 |
1
| PojoCacheJmxWrapper wrapper = createWrapper(cfg);
|
423 |
| |
424 |
1
| wrapper.create();
|
425 |
1
| wrapper.start();
|
426 |
| |
427 |
1
| registerWrapper(wrapper);
|
428 |
| |
429 |
1
| assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
|
430 |
| |
431 |
1
| interceptorRegistrationTest(false);
|
432 |
| |
433 |
1
| wrapper.stop();
|
434 |
1
| wrapper.destroy();
|
435 |
| |
436 |
1
| interceptorRegistrationTest(false);
|
437 |
| |
438 |
1
| unregisterWrapper();
|
439 |
| |
440 |
1
| interceptorRegistrationTest(false);
|
441 |
| |
442 |
| } |
443 |
| |
444 |
| |
445 |
| |
446 |
| } |