1 |
| package org.jboss.cache.optimistic; |
2 |
| |
3 |
| import org.jboss.cache.CacheImpl; |
4 |
| import org.jboss.cache.InvocationContext; |
5 |
| import org.jboss.cache.interceptors.Interceptor; |
6 |
| import org.jboss.cache.marshall.MethodCall; |
7 |
| |
8 |
| import java.lang.reflect.Method; |
9 |
| import java.util.ArrayList; |
10 |
| import java.util.List; |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| public class MockInterceptor extends Interceptor |
21 |
| { |
22 |
| |
23 |
| |
24 |
76
| public void setCache(CacheImpl cache)
|
25 |
| { |
26 |
76
| super.setCache(cache);
|
27 |
| |
28 |
| } |
29 |
| |
30 |
| private Method called = null; |
31 |
| |
32 |
| private List calledlist = new ArrayList(); |
33 |
| |
34 |
474
| public synchronized Object invoke(InvocationContext ctx) throws Throwable
|
35 |
| { |
36 |
474
| MethodCall m = ctx.getMethodCall();
|
37 |
474
| calledlist.add(m.getMethod());
|
38 |
474
| called = m.getMethod();
|
39 |
| |
40 |
474
| return null;
|
41 |
| } |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
98
| public Method getCalled()
|
48 |
| { |
49 |
98
| return called;
|
50 |
| } |
51 |
| |
52 |
35
| public List getAllCalled()
|
53 |
| { |
54 |
35
| return calledlist;
|
55 |
| } |
56 |
| |
57 |
| |
58 |
| |
59 |
| |
60 |
0
| public void setCalled(Method called)
|
61 |
| { |
62 |
0
| this.called = called;
|
63 |
| } |
64 |
| } |