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 2015/09/25 12:18:13 UTC

svn commit: r1705265 [3/3] - in /jackrabbit/oak/trunk: oak-run/ oak-run/src/main/java/org/apache/jackrabbit/oak/run/ oak-run/src/test/java/org/apache/jackrabbit/oak/run/ oak-upgrade/ oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/blob/ oak...

Added: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentNodeStoreContainer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentNodeStoreContainer.java?rev=1705265&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentNodeStoreContainer.java (added)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentNodeStoreContainer.java Fri Sep 25 10:18:10 2015
@@ -0,0 +1,79 @@
+/*
+ * 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.upgrade.cli.container;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
+import com.google.common.io.Files;
+
+public class SegmentNodeStoreContainer implements NodeStoreContainer {
+
+    private final File directory;
+
+    private final BlobStoreContainer blob;
+
+    private FileStore fs;
+
+    public SegmentNodeStoreContainer() {
+        this(Files.createTempDir());
+    }
+
+    public SegmentNodeStoreContainer(File directory) {
+        this.blob = null;
+        this.directory = directory;
+    }
+
+    public SegmentNodeStoreContainer(BlobStoreContainer blob) {
+        this.blob = blob;
+        this.directory = Files.createTempDir();
+    }
+
+    @Override
+    public NodeStore open() throws IOException {
+        FileStore.Builder builder = FileStore.newFileStore(new File(directory, "segmentstore"));
+        if (blob != null) {
+            builder.withBlobStore(blob.open());
+        }
+        fs = builder.create();
+        return SegmentNodeStore.newSegmentNodeStore(fs).create();
+    }
+
+    @Override
+    public void close() {
+        fs.close();
+    }
+
+    @Override
+    public void clean() throws IOException {
+        FileUtils.deleteDirectory(directory);
+        if (blob != null) {
+            blob.clean();
+        }
+    }
+
+    @Override
+    public String getDescription() {
+        return directory.getPath();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-upgrade/src/test/resources/jcr2.zip
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/resources/jcr2.zip?rev=1705265&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/resources/jcr2.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jackrabbit/oak/trunk/oak-upgrade/src/test/resources/segmentstore.zip
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/resources/segmentstore.zip?rev=1705265&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/resources/segmentstore.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream