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