[Jboss-cvs] JBossAS SVN: r55469 - branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 9 23:03:02 EDT 2006
Author: bstansberry at jboss.com
Date: 2006-08-09 23:03:01 -0400 (Wed, 09 Aug 2006)
New Revision: 55469
Modified:
branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/DBSetup.java
Log:
Wait for Hypersonic to start
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/DBSetup.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/DBSetup.java 2006-08-10 03:00:00 UTC (rev 55468)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/DBSetup.java 2006-08-10 03:03:01 UTC (rev 55469)
@@ -56,39 +56,28 @@
throw new IOException("Failed to create directory: " + hypersoniDir);
}
- final File dbPath = new File(hypersoniDir, "cif-db");
+ File dbPath = new File(hypersoniDir, "cif-db");
// Start DB in new thread, or else it will block us
- Thread serverThread = new Thread("hypersonic")
+ DBThread serverThread = new DBThread(dbPath);
+ serverThread.start();
+
+ int elapsed = 0;
+ while (!serverThread.isStarted() && elapsed < 15000)
{
- public void run()
+ try
{
- try
- {
- // Create startup arguments
- String[] args = {
- "-database",
- dbPath.toString(),
- "-port",
- String.valueOf(1701),
- "-silent",
- "false",
- "-trace",
- "false",
- "-no_system_exit",
- "true",
- };
- System.out.println("Starting hsqldb");
- org.hsqldb.Server.main(args);
- System.out.println("Done");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ Thread.sleep(100);
+ elapsed += 100;
}
- };
- serverThread.start();
+ catch (InterruptedException ie)
+ {
+ System.out.println("Interrupted while waiting for Hypersonic");
+ }
+ }
+
+ if (!serverThread.isStarted())
+ System.out.println("Hypersonic failed to start in a timely fashion");
}
protected void tearDown() throws Exception
@@ -108,4 +97,52 @@
Thread.sleep(120*1000);
setup.tearDown();
}
+
+ class DBThread extends Thread
+ {
+ boolean started;
+ File dbPath;
+
+ DBThread(File dbPath)
+ {
+ super("hypersonic");
+ this.dbPath = dbPath;
+ }
+
+ boolean isStarted()
+ {
+ return started;
+ }
+
+ public void run()
+ {
+ try
+ {
+ // Create startup arguments
+ String[] args = {
+ "-database",
+ dbPath.toString(),
+ "-port",
+ String.valueOf(1701),
+ "-silent",
+ "false",
+ "-trace",
+ "false",
+ "-no_system_exit",
+ "true",
+ };
+ System.out.println("Starting hsqldb");
+ org.hsqldb.Server.main(args);
+ System.out.println("Done");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ started = true;
+ }
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list