-
Notifications
You must be signed in to change notification settings - Fork 6
/
ExtendProxies.java
executable file
·49 lines (37 loc) · 1.44 KB
/
ExtendProxies.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.benstopford.coherence.bootstrap.basic;
import com.benstopford.coherence.bootstrap.structures.framework.cluster.ClusterRunner;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.ConfigurableCacheFactory;
import com.tangosol.net.NamedCache;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import static junit.framework.Assert.assertEquals;
/**
* BTS, 25-Jan-2008
*/
public class ExtendProxies extends ClusterRunner {
@Test
public void useExtendProxy() throws IOException, InterruptedException {
//start data enabled node
startCoherenceProcess("config/basic-cache.xml");
//start data disabled node as extend proxy
startCoherenceProcess("config/basic-extend-enabled-cache-32001.xml", LOCAL_STORAGE_FALSE);
//use extend config for this client
ConfigurableCacheFactory factory = CacheFactory.getCacheFactoryBuilder().getConfigurableCacheFactory("config/extend-client-32001.xml", getClass().getClassLoader());
NamedCache cache = factory.ensureCache("stuff", getClass().getClassLoader());
//write
cache.put("Foo", "Bar");
//read
assertEquals("Bar", cache.get("Foo"));
}
@Before
public void setUp() throws Exception {
super.setUp();
}
@After
public void tearDown() throws Exception {
super.tearDown();
}
}