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 am...@apache.org on 2017/03/24 09:31:32 UTC

svn commit: r1788388 - in /jackrabbit/oak/trunk/oak-it: ./ src/test/java/org/apache/jackrabbit/oak/plugins/document/ src/test/java/org/apache/jackrabbit/oak/segment/

Author: amitj
Date: Fri Mar 24 09:31:32 2017
New Revision: 1788388

URL: http://svn.apache.org/viewvc?rev=1788388&view=rev
Log:
OAK-4933: Create a data store implementation that integrates with Microsoft Azure Blob Storage

- Azure specific DataStore GC integration tests

Added:
    jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java   (with props)
    jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java   (with props)
    jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java   (with props)
    jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java   (with props)
Modified:
    jackrabbit/oak/trunk/oak-it/pom.xml

Modified: jackrabbit/oak/trunk/oak-it/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/pom.xml?rev=1788388&r1=1788387&r2=1788388&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/pom.xml Fri Mar 24 09:31:32 2017
@@ -51,6 +51,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-blob-cloud-azure</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-core</artifactId>
             <version>${project.version}</version>
             <type>test-jar</type>
@@ -69,6 +75,13 @@
             <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-blob-cloud-azure</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>

Added: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java?rev=1788388&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java (added)
+++ jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java Fri Mar 24 09:31:32 2017
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureConstants;
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureDataStoreUtils;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.junit.After;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Shared BlobStoreGCTest for Azure.
+ */
+public class AzureSharedBlobStoreGCTest extends SharedBlobStoreGCTest {
+
+    protected String containerName;
+
+    @BeforeClass
+    public static void assumptions() {
+        assumeTrue(AzureDataStoreUtils.isAzureConfigured());
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        AzureDataStoreUtils.deleteContainer(containerName);
+        super.tearDown();
+    }
+
+    @Override
+    protected DataStoreBlobStore getBlobStore(File rootFolder) throws Exception {
+        Properties props = AzureDataStoreUtils.getAzureConfig();
+        containerName = rootFolder.getName();
+        props.setProperty(AzureConstants.AZURE_BLOB_CONTAINER_NAME, containerName);
+        props.setProperty("cacheSize", "0");
+        return new DataStoreBlobStore(
+            AzureDataStoreUtils.getAzureDataStore(props, rootFolder.getAbsolutePath()));
+    }
+
+    @Override
+    protected void sleep() throws InterruptedException {
+        if (AzureDataStoreUtils.isAzureConfigured()) {
+            Thread.sleep(1000);
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/AzureSharedBlobStoreGCTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java?rev=1788388&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java (added)
+++ jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java Fri Mar 24 09:31:32 2017
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureConstants;
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureDataStoreUtils;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.blob.ds.MongoDataStoreBlobGCTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * Tests DataStoreGC with Mongo and Azure
+ */
+public class MongoAzureDataStoreBlobGCTest extends MongoDataStoreBlobGCTest {
+
+    @BeforeClass
+    public static void assumptions() {
+        assumeTrue(AzureDataStoreUtils.isAzureConfigured());
+    }
+
+    protected String bucket;
+
+    @Before
+    @Override
+    public void setUpConnection() throws Exception {
+        Properties props = AzureDataStoreUtils.getAzureConfig();
+        startDate = new Date();
+        mongoConnection = connectionFactory.getConnection();
+        MongoUtils.dropCollections(mongoConnection.getDB());
+        File root = folder.newFolder();
+        bucket = root.getName();
+        props.setProperty(AzureConstants.AZURE_BLOB_CONTAINER_NAME, bucket);
+        props.setProperty("cacheSize", "0");
+        blobStore = new DataStoreBlobStore(
+            AzureDataStoreUtils.getAzureDataStore(props, root.getAbsolutePath()));
+        mk = new DocumentMK.Builder().clock(getTestClock()).setMongoDB(mongoConnection.getDB())
+            .setBlobStore(blobStore).open();
+    }
+
+    @After
+    @Override
+    public void tearDownConnection() throws Exception {
+        AzureDataStoreUtils.deleteContainer(bucket);
+        super.tearDownConnection();
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoAzureDataStoreBlobGCTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java?rev=1788388&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java (added)
+++ jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java Fri Mar 24 09:31:32 2017
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureConstants;
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureDataStoreUtils;
+import org.apache.jackrabbit.oak.plugins.blob.SharedDataStoreUtilsTest;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * SharedDataStoreUtilsTest for Azure.
+ */
+public class SharedAzureDataStoreUtilsTest extends SharedDataStoreUtilsTest {
+    private static final Logger log = LoggerFactory.getLogger(SharedAzureDataStoreUtilsTest.class);
+
+    protected String containerName;
+
+    @BeforeClass
+    public static void assumptions() {
+        assumeTrue(AzureDataStoreUtils.isAzureConfigured());
+    }
+
+    @Override
+    protected DataStoreBlobStore getBlobStore(File rootFolder) throws Exception {
+        Properties props = AzureDataStoreUtils.getAzureConfig();
+        containerName = rootFolder.getName();
+        props.setProperty(AzureConstants.AZURE_BLOB_CONTAINER_NAME, containerName);
+        props.setProperty("cacheSize", "0");
+        DataStoreBlobStore dataStoreBlobStore = new DataStoreBlobStore(
+            AzureDataStoreUtils.getAzureDataStore(props, rootFolder.getAbsolutePath()));
+        return dataStoreBlobStore;
+    }
+
+    @After
+    public void close() throws IOException {
+        try {
+            AzureDataStoreUtils.deleteContainer(containerName);
+        } catch (Exception e) {
+            log.error("Error closing data store", e);
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedAzureDataStoreUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java?rev=1788388&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java (added)
+++ jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java Fri Mar 24 09:31:32 2017
@@ -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.segment;
+
+import static org.apache.jackrabbit.oak.commons.FixturesHelper.Fixture.SEGMENT_TAR;
+import static org.apache.jackrabbit.oak.commons.FixturesHelper.getFixtures;
+import static org.junit.Assume.assumeTrue;
+
+import com.google.common.base.Strings;
+
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureConstants;
+import org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzureDataStoreUtils;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.junit.After;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Tests for SegmentNodeStore on AzureDataStore GC
+ */
+public class SegmentAzureDataStoreBlobGCIT extends SegmentDataStoreBlobGCIT {
+    protected String containerName;
+
+    @BeforeClass
+    public static void assumptions() {
+        assumeTrue(getFixtures().contains(SEGMENT_TAR));
+        assumeTrue(AzureDataStoreUtils.isAzureConfigured());
+    }
+
+    @Override
+    protected DataStoreBlobStore getBlobStore(File rootFolder) throws Exception {
+        Properties props = AzureDataStoreUtils.getAzureConfig();
+        containerName = rootFolder.getName();
+        props.setProperty(AzureConstants.AZURE_BLOB_CONTAINER_NAME, containerName);
+        props.setProperty("cacheSize", "0");
+        return new DataStoreBlobStore(AzureDataStoreUtils.getAzureDataStore(props, rootFolder.getAbsolutePath()));
+    }
+
+    @After
+    public void close() throws Exception {
+        if (!Strings.isNullOrEmpty(containerName)) {
+            AzureDataStoreUtils.deleteContainer(containerName);
+        }
+    }
+}
+

Propchange: jackrabbit/oak/trunk/oak-it/src/test/java/org/apache/jackrabbit/oak/segment/SegmentAzureDataStoreBlobGCIT.java
------------------------------------------------------------------------------
    svn:eol-style = native