[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader ...
Manik Surtani
msurtani at jboss.com
Wed Oct 25 10:40:48 EDT 2006
User: msurtani
Date: 06/10/25 10:40:48
Modified: tests/functional/org/jboss/cache/loader Tag:
Branch_JBossCache_1_4_0 TcpCacheLoaderTest.java
Log:
Added some sleep time to allow for the tcp cache server to start accepting conns.
Revision Changes Path
No revision
No revision
1.4.4.1 +34 -23 JBossCache/tests/functional/org/jboss/cache/loader/TcpCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TcpCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/TcpCacheLoaderTest.java,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -b -r1.4 -r1.4.4.1
--- TcpCacheLoaderTest.java 27 Jan 2006 15:47:17 -0000 1.4
+++ TcpCacheLoaderTest.java 25 Oct 2006 14:40:48 -0000 1.4.4.1
@@ -3,36 +3,47 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jboss.cache.loader.tcp.TcpCacheServer;
+import org.jboss.cache.misc.TestingUtil;
/**
* Tests the TcpDelegatingCacheLoader
+ *
* @author Bela Ban
- * @version $Id: TcpCacheLoaderTest.java,v 1.4 2006/01/27 15:47:17 msurtani Exp $
+ * @version $Id: TcpCacheLoaderTest.java,v 1.4.4.1 2006/10/25 14:40:48 msurtani Exp $
*/
-public class TcpCacheLoaderTest extends CacheLoaderTestsBase {
- static TcpCacheServer cache_server=null;
-
- static {
- Thread runner=new Thread() {
- public void run() {
- try {
+public class TcpCacheLoaderTest extends CacheLoaderTestsBase
+{
+ static TcpCacheServer cache_server = null;
+
+ static
+ {
+ Thread runner = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
System.out.println("Starting TcpCacheServer");
- cache_server=new TcpCacheServer();
+ cache_server = new TcpCacheServer();
cache_server.setBindAddress("127.0.0.1");
cache_server.setPort(12121);
cache_server.setConfig("META-INF/local-service.xml"); // must be in classpath (./etc/META-INF)
cache_server.createService();
cache_server.startService();
}
- catch(Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
};
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- if(cache_server != null) {
+ Runtime.getRuntime().addShutdownHook(new Thread()
+ {
+ public void run()
+ {
+ if (cache_server != null)
+ {
System.out.println("Stopping TcpCacheServer");
cache_server.stopService();
}
@@ -40,27 +51,27 @@
});
runner.start();
+ // sleep for half a sec to give the server thread time to start listening.
+ TestingUtil.sleepThread(500);
}
-
- protected void configureCache() throws Exception {
+ protected void configureCache() throws Exception
+ {
cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("",
"org.jboss.cache.loader.tcp.TcpDelegatingCacheLoader",
"host=127.0.0.1\nport=12121", false, true, false));
}
-
-
-
-
- public static Test suite() {
+ public static Test suite()
+ {
return new TestSuite(TcpCacheLoaderTest.class);
}
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
junit.textui.TestRunner.run(suite());
}
More information about the jboss-cvs-commits
mailing list