jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1526223 - /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
Date Wed, 25 Sep 2013 16:29:44 GMT
Author: jukka
Date: Wed Sep 25 16:29:43 2013
New Revision: 1526223

URL: http://svn.apache.org/r1526223
Log:
OAK-641: Improved benchmark tooling

Prevent Derby from polluting the current directory with log files

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java?rev=1526223&r1=1526222&r2=1526223&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
Wed Sep 25 16:29:43 2013
@@ -20,6 +20,8 @@ import static org.apache.jackrabbit.core
 
 import java.io.File;
 import java.io.InputStream;
+import java.sql.DriverManager;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import javax.jcr.Repository;
@@ -62,6 +64,11 @@ public class JackrabbitRepositoryFixture
             RepositoryConfig config = RepositoryConfig.create(
                     new InputSource(xml), variables);
 
+            // Prevent Derby from polluting the current directory
+            System.setProperty(
+                    "derby.stream.error.file",
+                    new File(directory, "derby.log").getPath());
+
             RepositoryImpl repository = RepositoryImpl.create(config);
             this.cluster = new RepositoryImpl[] { repository };
             return new Repository[] { repository };
@@ -80,6 +87,11 @@ public class JackrabbitRepositoryFixture
         for (RepositoryImpl repository : cluster) {
             File directory = new File(repository.getConfig().getHomeDir());
             repository.shutdown();
+            try {
+                DriverManager.getConnection("jdbc:derby:;shutdown=true");
+            } catch (SQLException e) {
+                // ignore
+            }
             FileUtils.deleteQuietly(directory);
         }
     }



Mime
View raw message