1 |
| package org.jboss.cache.pojo.jmx; |
2 |
| |
3 |
| import javax.management.ObjectName; |
4 |
| |
5 |
| import org.jboss.cache.CacheImpl; |
6 |
| import org.jboss.cache.config.Configuration; |
7 |
| import org.jboss.cache.pojo.PojoCache; |
8 |
| import org.jboss.cache.pojo.PojoCacheFactory; |
9 |
| import org.jboss.cache.pojo.impl.PojoCacheImpl; |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| public class NotificationTest extends org.jboss.cache.jmx.NotificationTest |
18 |
| { |
19 |
| private PojoCache pojoCache; |
20 |
| |
21 |
| |
22 |
| |
23 |
8
| @Override
|
24 |
| protected Object createCacheAndJmxWrapper() throws Exception |
25 |
| { |
26 |
8
| pojoCache = createCache(CLUSTER_NAME);
|
27 |
8
| cache = (CacheImpl) pojoCache.getCache();
|
28 |
8
| return new PojoCacheJmxWrapper(pojoCache);
|
29 |
| } |
30 |
| |
31 |
10
| @Override
|
32 |
| protected void destroyCache() |
33 |
| { |
34 |
10
| if (pojoCache != null)
|
35 |
| { |
36 |
| |
37 |
| |
38 |
8
| pojoCache.destroy();
|
39 |
8
| pojoCache = null;
|
40 |
8
| cache = null;
|
41 |
| } |
42 |
| } |
43 |
| |
44 |
26
| protected ObjectName getWrapperObjectName() throws Exception
|
45 |
| { |
46 |
26
| return new ObjectName(JmxUtil.PREFIX + CLUSTER_NAME);
|
47 |
| } |
48 |
| |
49 |
8
| protected PojoCacheImpl createCache(String clusterName) throws Exception
|
50 |
| { |
51 |
8
| Configuration config = createConfiguration(clusterName);
|
52 |
| |
53 |
8
| PojoCacheImpl cache = (PojoCacheImpl) PojoCacheFactory.createCache(config, false);
|
54 |
| |
55 |
8
| cache.create();
|
56 |
| |
57 |
| |
58 |
8
| return cache;
|
59 |
| } |
60 |
| |
61 |
0
| private String getTempDir()
|
62 |
| { |
63 |
0
| return System.getProperty("java.io.tempdir", "/tmp");
|
64 |
| } |
65 |
| } |