1 |
| package org.jboss.cache.loader; |
2 |
| |
3 |
| import junit.framework.Test; |
4 |
| import junit.framework.TestSuite; |
5 |
| import org.jboss.cache.loader.tcp.TcpCacheServer; |
6 |
| import org.jboss.cache.misc.TestingUtil; |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| public class TcpCacheLoaderTest extends CacheLoaderTestsBase |
15 |
| { |
16 |
| static TcpCacheServer cache_server = null; |
17 |
| |
18 |
| static |
19 |
| { |
20 |
1
| Thread runner = new Thread()
|
21 |
| { |
22 |
1
| public void run()
|
23 |
| { |
24 |
1
| try
|
25 |
| { |
26 |
1
| System.out.println("Starting TcpCacheServer");
|
27 |
1
| cache_server = new TcpCacheServer();
|
28 |
1
| cache_server.setBindAddress("127.0.0.1");
|
29 |
1
| cache_server.setPort(12121);
|
30 |
1
| cache_server.setConfig("META-INF/local-service.xml");
|
31 |
1
| cache_server.create();
|
32 |
1
| cache_server.start();
|
33 |
| } |
34 |
| catch (Exception ex) |
35 |
| { |
36 |
0
| ex.printStackTrace();
|
37 |
| } |
38 |
| } |
39 |
| }; |
40 |
| |
41 |
1
| Runtime.getRuntime().addShutdownHook(new Thread()
|
42 |
| { |
43 |
0
| public void run()
|
44 |
| { |
45 |
0
| if (cache_server != null)
|
46 |
| { |
47 |
0
| System.out.println("Stopping TcpCacheServer");
|
48 |
0
| cache_server.stop();
|
49 |
| } |
50 |
| } |
51 |
| }); |
52 |
| |
53 |
1
| runner.start();
|
54 |
| } |
55 |
| |
56 |
1
| public void testPartialLoadAndStore()
|
57 |
| { |
58 |
| |
59 |
| } |
60 |
| |
61 |
1
| public void testBuddyBackupStore()
|
62 |
| { |
63 |
| |
64 |
| } |
65 |
| |
66 |
| |
67 |
59
| protected void configureCache() throws Exception
|
68 |
| { |
69 |
59
| cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
|
70 |
| "org.jboss.cache.loader.TcpDelegatingCacheLoader", |
71 |
| "host=127.0.0.1\nport=12121", false, true, false)); |
72 |
| |
73 |
| |
74 |
59
| TestingUtil.sleepThread(2000);
|
75 |
| } |
76 |
| |
77 |
| |
78 |
1
| public static Test suite()
|
79 |
| { |
80 |
1
| return new TestSuite(TcpCacheLoaderTest.class);
|
81 |
| } |
82 |
| |
83 |
| |
84 |
0
| public static void main(String[] args)
|
85 |
| { |
86 |
0
| junit.textui.TestRunner.run(suite());
|
87 |
| } |
88 |
| |
89 |
| } |