You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2013/01/28 20:00:29 UTC
svn commit: r1439566 -
/incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java
Author: juanpablo
Date: Mon Jan 28 19:00:29 2013
New Revision: 1439566
URL: http://svn.apache.org/viewvc?rev=1439566&view=rev
Log:
Minor refactor to HsqlDbUtils init checks
Modified:
incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java
Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java?rev=1439566&r1=1439565&r2=1439566&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java (original)
+++ incubator/jspwiki/trunk/tests/org/apache/wiki/HsqlDbUtils.java Mon Jan 28 19:00:29 2013
@@ -88,46 +88,22 @@ public class HsqlDbUtils
*/
public void start() throws Exception
{
- // pre-checks
- File lock = new File( "tests/etc/db/hsql/jspwiki.lck" );
- if( lock.exists() )
- {
- lock.delete();
- }
-
- for( long l = 0; l < 50; l++ )
- {
- if( lock.exists() )
- {
- Thread.sleep( 200L );
- }
- else
- {
- break;
- }
- }
-
-
- if( lock.exists() )
- {
- throw new InternalWikiException( "Another HSQL server seems to be running" );
- }
// start Hypersonic server
Properties hProps = loadPropertiesFrom( "tests/etc/db/hsql/server.properties" );
hsqlServer = new Server();
+ // pre-checks
+ hsqlServer.checkRunning( false ); // throws RuntimeException if running
+
+ // configure
hsqlServer.setPort( Integer.valueOf( hProps.getProperty( "server.port" ) ) );
hsqlServer.setDatabaseName( 0, hProps.getProperty( "server.dbname.0" ) );
hsqlServer.setDatabasePath( 0, hProps.getProperty( "server.database.0" ) );
hsqlServer.start();
Class.forName( "org.hsqldb.jdbcDriver" );
-
- if( !lock.exists() )
- {
- throw new InternalWikiException( "Unable to start HSQL server, check logs" );
- }
+ hsqlServer.checkRunning( true ); // throws RuntimeException if not running
}
/**