aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-11-02 14:28:59 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-11-02 20:15:00 +0400
commitf01f06c9c251159b9a5b56897d11df27c09837a4 (patch)
treeeef7d834731732f8eba089adfbd9b40f4e238b46
parent24c01b35b4a1e201a7a8f697e451a6e6b2741a15 (diff)
downloadsonarqube-f01f06c9c251159b9a5b56897d11df27c09837a4.tar.gz
sonarqube-f01f06c9c251159b9a5b56897d11df27c09837a4.zip
Disable creation of derby.log during execution of unit tests
-rw-r--r--pom.xml3
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java5
-rw-r--r--sonar-core/src/test/java/org/sonar/persistence/DerbyUtils.java4
3 files changed, 8 insertions, 4 deletions
diff --git a/pom.xml b/pom.xml
index 318d366b358..23314af9f2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -420,9 +420,6 @@
<argLine>-Xmx256m</argLine>
<systemPropertyVariables>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
-
- <!-- derby embedded database is used by unit tests -->
- <derby.stream.error.file>target/derby.log</derby.stream.error.file>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
index 11bf0efb1d1..e90ee4ed48d 100644
--- a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
+++ b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
@@ -49,11 +49,16 @@ import org.sonar.jpa.session.DefaultDatabaseConnector;
import org.sonar.jpa.session.JpaDatabaseSession;
import org.sonar.jpa.session.MemoryDatabaseConnector;
import org.sonar.persistence.Database;
+import org.sonar.persistence.DerbyUtils;
import org.sonar.persistence.HsqlDatabase;
import org.sonar.persistence.InMemoryDatabase;
public abstract class AbstractDbUnitTestCase {
+ static {
+ DerbyUtils.fixDerbyLogs();
+ }
+
private static final boolean USE_HSQL = false;
private DefaultDatabaseConnector dbConnector;
diff --git a/sonar-core/src/test/java/org/sonar/persistence/DerbyUtils.java b/sonar-core/src/test/java/org/sonar/persistence/DerbyUtils.java
index cd3e8c7e103..a7d27345aa1 100644
--- a/sonar-core/src/test/java/org/sonar/persistence/DerbyUtils.java
+++ b/sonar-core/src/test/java/org/sonar/persistence/DerbyUtils.java
@@ -33,7 +33,9 @@ public final class DerbyUtils {
};
/**
- * The embedded derby still creates the file derby.log in the execution directory. This method moves it to target/tmp-test.
+ * Disables Derby log.
+ * Note: in order to work properly this method should be called before Derby boot.
+ * See http://db.apache.org/derby/docs/10.7/ref/rrefproper33027.html
*/
public static void fixDerbyLogs() {
System.setProperty("derby.stream.error.field", "org.sonar.persistence.DerbyUtils.DEV_NULL");