code style improvements.
[utils] / test / enterprise / src / main / java / org / wamblee / support / persistence / DerbyDatabase.java
index 84f0a2efc6adaa6265c7e5a334c4d84a9413b535..a41bf0850c4e97cf7cce1c5afb5dd2128acf06fb 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 the original author or authors.
+ * Copyright 2005-2010 the original author or authors.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.derby.drda.NetworkServerControl;
@@ -110,6 +111,7 @@ public class DerbyDatabase extends AbstractDatabase {
      */
     public void doStart() {
         try {
+            System.setProperty("derby.stream.error.file", "target/derby.log");
             // just in case a previous run was killed without the
             // cleanup
             cleanPersistentStorage();
@@ -167,9 +169,8 @@ public class DerbyDatabase extends AbstractDatabase {
             lWaited += POLL_INTERVAL;
 
             if (lWaited > MAX_WAIT_TIME) {
-                throw new RuntimeException(
-                    "Derby database did not start within " + MAX_WAIT_TIME +
-                        "ms");
+                Assert.fail("Derby database did not start within " +
+                    MAX_WAIT_TIME + "ms");
             }
         }
     }
@@ -243,8 +244,8 @@ public class DerbyDatabase extends AbstractDatabase {
     private void shutdownDerby() {
         try {
             DriverManager.getConnection("jdbc:derby:;shutdown=true");
-            throw new RuntimeException("Derby did not shutdown, "
-                + " should always throw exception at shutdown");
+            throw new RuntimeException(
+                "Derby did not shutdown, should always throw exception at shutdown");
         } catch (Exception e) {
             LOGGER.info("Derby has been shut down.");
         }