You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2014/02/10 14:45:26 UTC

svn commit: r1566623 [2/2] - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/cloud/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugin...

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/DocumentMKDataStoreWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/DocumentMKDataStoreWriteTest.java?rev=1566623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/DocumentMKDataStoreWriteTest.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/DocumentMKDataStoreWriteTest.java Mon Feb 10 13:45:26 2014
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.blob.ds;
+
+import java.io.File;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
+import org.apache.jackrabbit.oak.plugins.document.MongoUtils;
+import org.apache.jackrabbit.oak.plugins.document.blob.DocumentMKWriteTest;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+/**
+ * Tests for {@code DocumentMK#write(java.io.InputStream)} using
+ * {@link DataStore}
+ */
+public class DocumentMKDataStoreWriteTest extends DocumentMKWriteTest {
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        try {
+            Assume.assumeNotNull(DataStoreUtils.getBlobStore());
+        } catch (Exception e) {
+            Assume.assumeNoException(e);
+        }
+    }
+
+    @Override
+    @Before
+    public void setUpConnection() throws Exception {
+        mongoConnection = MongoUtils.getConnection();
+        MongoUtils.dropCollections(mongoConnection.getDB());
+        mk = new DocumentMK.Builder().setMongoDB(mongoConnection.getDB())
+                .setBlobStore(DataStoreUtils.getBlobStore()).open();
+    }
+
+    @Override
+    @After
+    public void tearDownConnection() throws Exception {
+        FileUtils.deleteDirectory(new File(DataStoreUtils.PATH));
+        mk.dispose();
+        // the db might already be closed
+        mongoConnection.close();
+        mongoConnection = MongoUtils.getConnection();
+        MongoUtils.dropCollections(mongoConnection.getDB());
+        mongoConnection.close();
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/MongoDataStoreBlobStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/MongoDataStoreBlobStoreTest.java?rev=1566623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/MongoDataStoreBlobStoreTest.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/ds/MongoDataStoreBlobStoreTest.java Mon Feb 10 13:45:26 2014
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.blob.ds;
+
+import java.io.File;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.blob.AbstractBlobStoreTest;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the {@link DataStoreBlobStore} implementation.
+ */
+public class MongoDataStoreBlobStoreTest extends AbstractBlobStoreTest {
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        try {
+            Assume.assumeNotNull(DataStoreUtils.getBlobStore());
+        } catch (Exception e) {
+            Assume.assumeNoException(e);
+        }
+    }
+
+    @Before
+    @Override
+    public void setUp() throws Exception {
+        store = DataStoreUtils.getBlobStore();
+    }
+
+    @Override
+    @Test
+    public void testCombinedIdentifier() throws Exception {
+    }
+
+    @Override
+    @Test
+    public void testGarbageCollection() throws Exception {
+    }
+
+    @After
+    @Override
+    public void tearDown() throws Exception {
+        FileUtils.deleteDirectory(new File(DataStoreUtils.PATH));
+        super.tearDown();
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/test/resources/aws.properties
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/aws.properties?rev=1566623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/aws.properties (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/aws.properties Mon Feb 10 13:45:26 2014
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# AWS account ID
+accessKey=
+# AWS secret key
+secretKey=
+# AWS bucket name
+s3Bucket=oakblobstore
+# AWS bucket region
+# Mapping of S3 regions to their constants
+# US Standard us-standard
+# US West us-west-2
+# US West (Northern California) us-west-1
+# EU (Ireland) EU
+# Asia Pacific (Singapore) ap-southeast-1
+# Asia Pacific (Sydney) ap-southeast-2
+# Asia Pacific (Tokyo) ap-northeast-1
+# South America (Sao Paulo) sa-east-1
+s3Region=us-standard
+connectionTimeout=120000
+socketTimeout=120000
+maxConnections=10
+maxErrorRetry=10

Modified: jackrabbit/oak/trunk/oak-it/mk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/pom.xml?rev=1566623&r1=1566622&r2=1566623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/mk/pom.xml Mon Feb 10 13:45:26 2014
@@ -108,6 +108,18 @@
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-data</artifactId>
+      <version>${jackrabbit.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-aws-ext</artifactId>
+      <version>${jackrabbit.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/BaseMongoMicroKernelFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/BaseMongoMicroKernelFixture.java?rev=1566623&r1=1566622&r2=1566623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/BaseMongoMicroKernelFixture.java (original)
+++ jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/BaseMongoMicroKernelFixture.java Mon Feb 10 13:45:26 2014
@@ -39,7 +39,7 @@ public abstract class BaseMongoMicroKern
 
     private MongoConnection mongoConnection = null;
 
-    private MongoConnection getMongoConnection() throws Exception {
+    protected MongoConnection getMongoConnection() throws Exception {
         if (mongoConnection == null) {
             mongoConnection = new MongoConnection(HOST, PORT, DB);
         }
@@ -93,7 +93,7 @@ public abstract class BaseMongoMicroKern
 
     protected abstract BlobStore getBlobStore(DB db);
 
-    private static void dropCollections(DB db) {
+    protected void dropCollections(DB db) {
         db.getCollection(MongoBlobStore.COLLECTION_BLOBS).drop();
         db.getCollection(Collection.NODES.toString()).drop();
     }

Added: jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoCloudBlobMicroKernelFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoCloudBlobMicroKernelFixture.java?rev=1566623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoCloudBlobMicroKernelFixture.java (added)
+++ jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoCloudBlobMicroKernelFixture.java Mon Feb 10 13:45:26 2014
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.test;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.blobs.BlobStore;
+import org.apache.jackrabbit.oak.plugins.blob.BlobStoreConfiguration;
+import org.apache.jackrabbit.oak.plugins.blob.cloud.CloudBlobStore;
+import org.apache.jackrabbit.oak.plugins.blob.cloud.CloudBlobStoreBuilder;
+import org.apache.jackrabbit.oak.plugins.document.Collection;
+import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
+import org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+
+import com.mongodb.DB;
+
+/**
+ * The Class MongoCloudBlobMicroKernelFixture.
+ */
+public class MongoCloudBlobMicroKernelFixture extends BaseMongoMicroKernelFixture {
+
+    /** The blob store. */
+    private BlobStore blobStore;
+
+    /**
+     * Open connection.
+     * 
+     * @throws Exception
+     */
+    protected void openConnection() throws Exception {
+        if (blobStore == null) {
+            blobStore =
+                    CloudBlobStoreBuilder
+                            .newInstance()
+                            .build(
+                                    BlobStoreConfiguration.newInstance().loadFromSystemProps()).get();
+        }
+    }
+
+    @Override
+    protected BlobStore getBlobStore(com.mongodb.DB db) {
+        return blobStore;
+    }
+
+    @Override
+    public void setUpCluster(MicroKernel[] cluster) throws Exception {
+        MongoConnection connection = getMongoConnection();
+        openConnection();
+        DB db = connection.getDB();
+        dropCollections(db);
+
+        for (int i = 0; i < cluster.length; i++) {
+            cluster[i] = new DocumentMK.Builder().
+                    setMongoDB(db).setBlobStore(blobStore).setClusterId(i).open();
+        }
+    }
+
+    @Override
+    protected void dropCollections(DB db) {
+        db.getCollection(MongoBlobStore.COLLECTION_BLOBS).drop();
+        db.getCollection(Collection.NODES.toString()).drop();
+        ((CloudBlobStore) blobStore).deleteBucket();
+    }
+}

Added: jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoDataStoreBlobMicroKernelFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoDataStoreBlobMicroKernelFixture.java?rev=1566623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoDataStoreBlobMicroKernelFixture.java (added)
+++ jackrabbit/oak/trunk/oak-it/mk/src/test/java/org/apache/jackrabbit/mk/test/MongoDataStoreBlobMicroKernelFixture.java Mon Feb 10 13:45:26 2014
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.test;
+
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.blobs.BlobStore;
+import org.apache.jackrabbit.oak.plugins.blob.BlobStoreConfiguration;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStoreBuilder;
+import org.apache.jackrabbit.oak.plugins.document.Collection;
+import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
+import org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+
+import com.mongodb.DB;
+
+/**
+ * The Class MongoCloudBlobMicroKernelFixture.
+ */
+public class MongoDataStoreBlobMicroKernelFixture extends BaseMongoMicroKernelFixture {
+
+    /** The blob store. */
+    private BlobStore blobStore;
+
+    /**
+     * Open connection.
+     * 
+     * @throws Exception
+     */
+    protected void openConnection() throws Exception {
+        if (blobStore == null) {
+            blobStore =
+                    DataStoreBlobStoreBuilder
+                            .newInstance()
+                            .build(
+                                    BlobStoreConfiguration.newInstance().loadFromSystemProps()).get();
+        }
+    }
+
+    @Override
+    protected BlobStore getBlobStore(com.mongodb.DB db) {
+        return blobStore;
+    }
+
+    @Override
+    public void setUpCluster(MicroKernel[] cluster) throws Exception {
+        MongoConnection connection = getMongoConnection();
+        openConnection();
+        DB db = connection.getDB();
+        dropCollections(db);
+
+        for (int i = 0; i < cluster.length; i++) {
+            cluster[i] = new DocumentMK.Builder().
+                    setMongoDB(db).setBlobStore(blobStore).setClusterId(i).open();
+        }
+    }
+
+    @Override
+    protected void dropCollections(DB db) {
+        db.getCollection(MongoBlobStore.COLLECTION_BLOBS).drop();
+        db.getCollection(Collection.NODES.toString()).drop();
+        try {
+            ((DataStoreBlobStore) blobStore).clearInUse();
+            ((DataStoreBlobStore) blobStore).getDataStore()
+                    .deleteAllOlderThan(System.currentTimeMillis() + 1000000);
+        } catch (DataStoreException e) {
+        }
+    }
+}

Modified: jackrabbit/oak/trunk/oak-parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-parent/pom.xml?rev=1566623&r1=1566622&r2=1566623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-parent/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-parent/pom.xml Mon Feb 10 13:45:26 2014
@@ -333,6 +333,12 @@
         <artifactId>logback-classic</artifactId>
         <version>${logback.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.jclouds.provider</groupId>
+        <artifactId>aws-s3</artifactId>
+        <version>1.7.0</version>
+      </dependency>
+      
     </dependencies>
   </dependencyManagement>
 

Modified: jackrabbit/oak/trunk/oak-run/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/pom.xml?rev=1566623&r1=1566622&r2=1566623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-run/pom.xml Mon Feb 10 13:45:26 2014
@@ -154,6 +154,16 @@
       <version>${jackrabbit.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-data</artifactId>
+      <version>${jackrabbit.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-aws-ext</artifactId>
+      <version>${jackrabbit.version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-math</artifactId>
       <version>2.0</version>
@@ -172,7 +182,10 @@
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
     </dependency>
-
+    <dependency>
+      <groupId>org.apache.jclouds.provider</groupId>
+      <artifactId>aws-s3</artifactId>
+    </dependency>
     <!-- Test dependencies -->
     <dependency>
       <groupId>junit</groupId>

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java?rev=1566623&r1=1566622&r2=1566623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java Mon Feb 10 13:45:26 2014
@@ -23,13 +23,18 @@ import javax.jcr.Repository;
 import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.api.JackrabbitRepository;
 import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
-import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
-import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
-import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.jcr.Jcr;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.plugins.blob.BlobStoreConfiguration;
+import org.apache.jackrabbit.oak.plugins.blob.BlobStoreHelper;
+import org.apache.jackrabbit.oak.plugins.blob.cloud.CloudBlobStore;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentStore;
 import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
@@ -84,9 +89,25 @@ public abstract class OakRepositoryFixtu
     public static RepositoryFixture getMongo(
             final String host, final int port, final String database,
             final boolean dropDBAfterTest, final long cacheSize) {
+
         return new OakRepositoryFixture("Oak-Mongo") {
             private String dbName = database != null ? database : unique;
             private DocumentMK[] kernels;
+            private BlobStore blobStore;
+
+            private BlobStore getBlobStore() {
+                BlobStoreConfiguration config =
+                        BlobStoreConfiguration.newInstance().loadFromSystemProps();
+                try {
+                    blobStore =
+                            BlobStoreHelper.create(config).orNull();
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+                return blobStore;
+            }
+
             @Override
             protected Repository[] internalSetUpCluster(int n) throws Exception {
                 Repository[] cluster = new Repository[n];
@@ -94,14 +115,20 @@ public abstract class OakRepositoryFixtu
                 for (int i = 0; i < cluster.length; i++) {
                     MongoConnection mongo =
                             new MongoConnection(host, port, dbName);
-                    kernels[i] = new DocumentMK.Builder().
+                    BlobStore blobStore = getBlobStore();
+                    DocumentMK.Builder mkBuilder = new DocumentMK.Builder().
                             setMongoDB(mongo.getDB()).
-                            setClusterId(i).setLogging(false).open();
+                            setClusterId(i).setLogging(false);
+                    if (blobStore != null) {
+                            mkBuilder.setBlobStore(blobStore);
+                    }
+                    kernels[i] = mkBuilder.open();
                     Oak oak = new Oak(new KernelNodeStore(kernels[i], cacheSize));
                     cluster[i] = new Jcr(oak).createRepository();
                 }
                 return cluster;
             }
+
             @Override
             public void tearDownCluster() {
                 super.tearDownCluster();
@@ -114,6 +141,13 @@ public abstract class OakRepositoryFixtu
                                 new MongoConnection(host, port, dbName);
                         mongo.getDB().dropDatabase();
                         mongo.close();
+                        if (blobStore instanceof CloudBlobStore) {
+                            ((CloudBlobStore) blobStore).deleteBucket();
+                        } else if (blobStore instanceof DataStoreBlobStore) {
+                            ((DataStoreBlobStore) blobStore).clearInUse();
+                            ((DataStoreBlobStore) blobStore).deleteAllOlderThan(
+                                    System.currentTimeMillis() + 10000000);
+                        }
                     } catch (Exception e) {
                         throw new RuntimeException(e);
                     }
@@ -125,9 +159,25 @@ public abstract class OakRepositoryFixtu
     public static RepositoryFixture getMongoNS(
             final String host, final int port, final String database,
             final boolean dropDBAfterTest, final long cacheSize) {
+
         return new OakRepositoryFixture("Oak-MongoNS") {
             private String dbName = database != null ? database : unique;
             private DocumentNodeStore[] stores;
+            private BlobStore blobStore;
+
+            private BlobStore getBlobStore() {
+                BlobStoreConfiguration config =
+                        BlobStoreConfiguration.newInstance().loadFromSystemProps();
+                try {
+                    blobStore =
+                            BlobStoreHelper.create(config).orNull();
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+                return blobStore;
+            }
+
             @Override
             protected Repository[] internalSetUpCluster(int n) throws Exception {
                 Repository[] cluster = new Repository[n];
@@ -135,15 +185,22 @@ public abstract class OakRepositoryFixtu
                 for (int i = 0; i < cluster.length; i++) {
                     MongoConnection mongo =
                             new MongoConnection(host, port, dbName);
-                    stores[i] = new DocumentMK.Builder().
+                    BlobStore blobStore = getBlobStore();
+                    DocumentMK.Builder mkBuilder =
+                            new DocumentMK.Builder().
                             setMongoDB(mongo.getDB()).
                             memoryCacheSize(cacheSize).
-                            setClusterId(i).setLogging(false).getNodeStore();
+                            setClusterId(i).setLogging(false);
+                    if (blobStore != null) {
+                        mkBuilder.setBlobStore(blobStore);
+                    }
+                    stores[i] = mkBuilder.getNodeStore();             
                     Oak oak = new Oak(stores[i]);
                     cluster[i] = new Jcr(oak).createRepository();
                 }
                 return cluster;
             }
+
             @Override
             public void tearDownCluster() {
                 super.tearDownCluster();
@@ -156,6 +213,13 @@ public abstract class OakRepositoryFixtu
                                 new MongoConnection(host, port, dbName);
                         mongo.getDB().dropDatabase();
                         mongo.close();
+                        if (blobStore instanceof CloudBlobStore) {
+                            ((CloudBlobStore) blobStore).deleteBucket();
+                        } else if (blobStore instanceof DataStoreBlobStore) {
+                            ((DataStoreBlobStore) blobStore).clearInUse();
+                            ((DataStoreBlobStore) blobStore).deleteAllOlderThan(
+                                    System.currentTimeMillis() + 10000000);
+                        }
                     } catch (Exception e) {
                         throw new RuntimeException(e);
                     }