1 |
| package org.jboss.cache.marshall; |
2 |
| |
3 |
| import junit.framework.TestCase; |
4 |
| import org.jboss.cache.CacheImpl; |
5 |
| import org.jboss.cache.DefaultCacheFactory; |
6 |
| import org.jboss.cache.Fqn; |
7 |
| import org.jboss.cache.buddyreplication.BuddyGroup; |
8 |
| |
9 |
| import java.lang.reflect.Method; |
10 |
| import java.util.Collections; |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| public class RemoteCallerReturnValuesTest extends TestCase |
19 |
| { |
20 |
| private CacheImpl cache; |
21 |
| private Fqn fqn = Fqn.fromString("/a"); |
22 |
| private Object key = "key"; |
23 |
| private Object value = "value"; |
24 |
| |
25 |
2
| protected void setUp() throws Exception
|
26 |
| { |
27 |
2
| cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache();
|
28 |
2
| cache.put(fqn, key, value);
|
29 |
| } |
30 |
| |
31 |
2
| protected void tearDown()
|
32 |
| { |
33 |
2
| cache.stop();
|
34 |
| } |
35 |
| |
36 |
1
| public void testMethodsThatShouldReturnValues() throws Throwable
|
37 |
| { |
38 |
1
| Object retval = cache._replicate(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn), false));
|
39 |
1
| assertNotNull(retval);
|
40 |
| |
41 |
1
| assertNotNull(cache._replicate(MethodCallFactory.create(MethodDeclarations.dataGravitationMethod, fqn, false)));
|
42 |
| } |
43 |
| |
44 |
| |
45 |
1
| public void testMethodsThatShouldReturnNull() throws Throwable
|
46 |
| { |
47 |
1
| doNullReturnTest(MethodDeclarations.getDataMapMethodLocal, fqn);
|
48 |
1
| doNullReturnTest(MethodDeclarations.existsMethod, fqn);
|
49 |
1
| doNullReturnTest(MethodDeclarations.getNodeMethodLocal, fqn);
|
50 |
1
| doNullReturnTest(MethodDeclarations.getKeysMethodLocal, fqn);
|
51 |
1
| doNullReturnTest(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
|
52 |
1
| doNullReturnTest(MethodDeclarations.releaseAllLocksMethodLocal, fqn);
|
53 |
1
| doNullReturnTest(MethodDeclarations.printMethodLocal, fqn);
|
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
1
| doNullReturnTest(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, cache.getLocalAddress(), null);
|
59 |
1
| doNullReturnTest(MethodDeclarations.remoteRemoveFromBuddyGroupMethod, "arse");
|
60 |
1
| doNullReturnTest(MethodDeclarations.remoteAssignToBuddyGroupMethod, new BuddyGroup(), Collections.emptyMap());
|
61 |
| |
62 |
| |
63 |
1
| doNullReturnTest(MethodDeclarations.moveMethodLocal, fqn, Fqn.ROOT);
|
64 |
| |
65 |
| |
66 |
1
| doNullReturnTest(MethodDeclarations.blockChannelLocal);
|
67 |
1
| doNullReturnTest(MethodDeclarations.unblockChannelLocal);
|
68 |
| } |
69 |
| |
70 |
| |
71 |
13
| private void doNullReturnTest(Method m, Object... args) throws Throwable
|
72 |
| { |
73 |
13
| MethodCall c = MethodCallFactory.create(m, args);
|
74 |
13
| assertNull(m + " should return a null when called remotely", cache._replicate(c));
|
75 |
| } |
76 |
| } |