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 re...@apache.org on 2015/08/07 12:31:01 UTC

svn commit: r1694646 [2/2] - in /jackrabbit/oak/trunk: oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/ oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/ oak-jcr/src/test/java/org/apache/j...

Modified: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/CopyVersionHistoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/CopyVersionHistoryTest.java?rev=1694646&r1=1694645&r2=1694646&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/CopyVersionHistoryTest.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/CopyVersionHistoryTest.java Fri Aug  7 10:31:00 2015
@@ -1,277 +1,277 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.core.RepositoryContext;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.oak.Oak;
-import org.apache.jackrabbit.oak.jcr.Jcr;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.RepositoryUpgradeSetup;
-import org.junit.AfterClass;
-import org.junit.Test;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.version.VersionManager;
-
-import java.io.File;
-import java.util.Calendar;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.apache.jackrabbit.oak.plugins.version.VersionConstants.MIX_REP_VERSIONABLE_PATHS;
-import static org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.createVersionableNode;
-import static org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.isVersionable;
-
-public class CopyVersionHistoryTest extends AbstractRepositoryUpgradeTest {
-
-    private static final String VERSIONABLES_OLD = "/versionables/old";
-
-    private static final String VERSIONABLES_OLD_ORPHANED = "/versionables/oldOrphaned";
-
-    private static final String VERSIONABLES_YOUNG = "/versionables/young";
-
-    private static final String VERSIONABLES_YOUNG_ORPHANED = "/versionables/youngOrphaned";
-
-    private static Calendar betweenHistories;
-
-    /**
-     * Home directory of source repository.
-     */
-    private static File source;
-
-    private static String oldOrphanedHistory;
-    private static String youngOrphanedHistory;
-    private static String oldHistory;
-    private static String youngHistory;
-
-    @Override
-    protected void createSourceContent(Repository repository) throws Exception {
-        final Session session = repository.login(CREDENTIALS);
-
-        oldHistory = createVersionableNode(session, VERSIONABLES_OLD);
-        oldOrphanedHistory = createVersionableNode(session, VERSIONABLES_OLD_ORPHANED);
-        Thread.sleep(10);
-        betweenHistories = Calendar.getInstance();
-        Thread.sleep(10);
-        youngOrphanedHistory = createVersionableNode(session, VERSIONABLES_YOUNG_ORPHANED);
-        youngHistory = createVersionableNode(session, VERSIONABLES_YOUNG);
-
-        session.getNode(VERSIONABLES_OLD_ORPHANED).remove();
-        session.getNode(VERSIONABLES_YOUNG_ORPHANED).remove();
-        session.save();
-    }
-
-    @Override
-    protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException {
-        // abuse this method to capture the source repo directory
-        CopyVersionHistoryTest.source = source;
-    }
-
-    @AfterClass
-    public static void teardown() {
-        CopyVersionHistoryTest.source = null;
-    }
-
-    @Test
-    public void copyAllVersions() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                // copying all versions is enabled by default
-            }
-        });
-        assertTrue(isVersionable(session, VERSIONABLES_OLD));
-        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
-        assertExisting(session, oldOrphanedHistory, youngOrphanedHistory, oldHistory, youngHistory);
-        assertHasVersionablePath(session, oldHistory, youngHistory);
-    }
-
-    @Test
-    public void referencedSinceDate() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyVersions(betweenHistories);
-            }
-        });
-
-        assertFalse(isVersionable(session, VERSIONABLES_OLD));
-        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldHistory, oldOrphanedHistory);
-        assertExisting(session, youngHistory, youngOrphanedHistory);
-        assertHasVersionablePath(session, youngHistory);
-    }
-
-    @Test
-    public void referencedOlderThanOrphaned() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyOrphanedVersions(betweenHistories);
-            }
-        });
-
-        assertTrue(isVersionable(session, VERSIONABLES_OLD));
-        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldOrphanedHistory);
-        assertExisting(session, oldHistory, youngHistory, youngOrphanedHistory);
-        assertHasVersionablePath(session, oldHistory, youngHistory);
-    }
-
-    @Test
-    public void onlyReferenced() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyOrphanedVersions(null);
-            }
-        });
-        assertTrue(isVersionable(session, VERSIONABLES_OLD));
-        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldOrphanedHistory, youngOrphanedHistory);
-        assertExisting(session, oldHistory, youngHistory);
-        assertHasVersionablePath(session, oldHistory, youngHistory);
-    }
-
-    @Test
-    public void onlyReferencedAfterDate() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyVersions(betweenHistories);
-                upgrade.setCopyOrphanedVersions(null);
-            }
-        });
-        assertFalse(isVersionable(session, VERSIONABLES_OLD));
-        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldHistory, oldOrphanedHistory, youngOrphanedHistory);
-        assertExisting(session, youngHistory);
-        assertHasVersionablePath(session, youngHistory);
-    }
-
-    @Test
-    public void onlyOrphaned() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyVersions(null);
-            }
-        });
-
-        assertFalse(isVersionable(session, VERSIONABLES_OLD));
-        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
-    }
-
-    @Test
-    public void onlyOrphanedAfterDate() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyVersions(null);
-                upgrade.setCopyOrphanedVersions(betweenHistories);
-            }
-        });
-
-        assertFalse(isVersionable(session, VERSIONABLES_OLD));
-        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
-    }
-
-    @Test
-    public void dontCopyVersionHistory() throws RepositoryException {
-        assert source != null;
-
-        Session session = performCopy(source, new RepositoryUpgradeSetup() {
-            @Override
-            public void setup(RepositoryUpgrade upgrade) {
-                upgrade.setCopyVersions(null);
-                upgrade.setCopyOrphanedVersions(null);
-            }
-        });
-
-        assertFalse(isVersionable(session, VERSIONABLES_OLD));
-        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
-        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
-    }
-
-    public Session performCopy(File source, RepositoryUpgradeSetup setup) throws RepositoryException {
-        final RepositoryConfig sourceConfig = RepositoryConfig.create(source);
-        final RepositoryContext sourceContext = RepositoryContext.create(sourceConfig);
-        final NodeStore targetNodeStore = new MemoryNodeStore();
-        try {
-            final RepositoryUpgrade upgrade = new RepositoryUpgrade(sourceContext, targetNodeStore);
-            setup.setup(upgrade);
-            upgrade.copy(null);
-        } finally {
-            sourceContext.getRepository().shutdown();
-        }
-
-        final Repository repository = new Jcr(new Oak(targetNodeStore)).createRepository();
-        return repository.login(AbstractRepositoryUpgradeTest.CREDENTIALS);
-    }
-
-    private static void assertExisting(final Session session, final String... paths) throws RepositoryException {
-        for (final String path : paths) {
-            final String relPath = path.substring(1);
-            assertTrue("node " + path + " should exist", session.getRootNode().hasNode(relPath));
-        }
-    }
-
-    private static void assertMissing(final Session session, final String... paths) throws RepositoryException {
-        for (final String path : paths) {
-            final String relPath = path.substring(1);
-            assertFalse("node " + path + " should not exist", session.getRootNode().hasNode(relPath));
-        }
-    }
-    
-    public static void assertHasVersionablePath(final Session session, final String... historyPaths) throws RepositoryException {
-        for (String historyPath : historyPaths) {
-            final String workspaceName = session.getWorkspace().getName();
-            final Node versionHistory = session.getNode(historyPath);
-            assertTrue(versionHistory.isNodeType(MIX_REP_VERSIONABLE_PATHS));
-            assertTrue(versionHistory.hasProperty(workspaceName));
-            final Property pathProperty = versionHistory.getProperty(workspaceName);
-            assertEquals(PropertyType.PATH, pathProperty.getType());
-    
-            final VersionManager vm = session.getWorkspace().getVersionManager();
-            assertEquals(historyPath, vm.getVersionHistory(pathProperty.getString()).getPath());
-        }
-    }
-}
+/*
+ * 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;
+
+import org.apache.jackrabbit.core.RepositoryContext;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.RepositoryUpgradeSetup;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.version.VersionManager;
+
+import java.io.File;
+import java.util.Calendar;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.apache.jackrabbit.oak.plugins.version.VersionConstants.MIX_REP_VERSIONABLE_PATHS;
+import static org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.createVersionableNode;
+import static org.apache.jackrabbit.oak.upgrade.util.VersionCopyTestUtils.isVersionable;
+
+public class CopyVersionHistoryTest extends AbstractRepositoryUpgradeTest {
+
+    private static final String VERSIONABLES_OLD = "/versionables/old";
+
+    private static final String VERSIONABLES_OLD_ORPHANED = "/versionables/oldOrphaned";
+
+    private static final String VERSIONABLES_YOUNG = "/versionables/young";
+
+    private static final String VERSIONABLES_YOUNG_ORPHANED = "/versionables/youngOrphaned";
+
+    private static Calendar betweenHistories;
+
+    /**
+     * Home directory of source repository.
+     */
+    private static File source;
+
+    private static String oldOrphanedHistory;
+    private static String youngOrphanedHistory;
+    private static String oldHistory;
+    private static String youngHistory;
+
+    @Override
+    protected void createSourceContent(Repository repository) throws Exception {
+        final Session session = repository.login(CREDENTIALS);
+
+        oldHistory = createVersionableNode(session, VERSIONABLES_OLD);
+        oldOrphanedHistory = createVersionableNode(session, VERSIONABLES_OLD_ORPHANED);
+        Thread.sleep(10);
+        betweenHistories = Calendar.getInstance();
+        Thread.sleep(10);
+        youngOrphanedHistory = createVersionableNode(session, VERSIONABLES_YOUNG_ORPHANED);
+        youngHistory = createVersionableNode(session, VERSIONABLES_YOUNG);
+
+        session.getNode(VERSIONABLES_OLD_ORPHANED).remove();
+        session.getNode(VERSIONABLES_YOUNG_ORPHANED).remove();
+        session.save();
+    }
+
+    @Override
+    protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException {
+        // abuse this method to capture the source repo directory
+        CopyVersionHistoryTest.source = source;
+    }
+
+    @AfterClass
+    public static void teardown() {
+        CopyVersionHistoryTest.source = null;
+    }
+
+    @Test
+    public void copyAllVersions() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                // copying all versions is enabled by default
+            }
+        });
+        assertTrue(isVersionable(session, VERSIONABLES_OLD));
+        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
+        assertExisting(session, oldOrphanedHistory, youngOrphanedHistory, oldHistory, youngHistory);
+        assertHasVersionablePath(session, oldHistory, youngHistory);
+    }
+
+    @Test
+    public void referencedSinceDate() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyVersions(betweenHistories);
+            }
+        });
+
+        assertFalse(isVersionable(session, VERSIONABLES_OLD));
+        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldHistory, oldOrphanedHistory);
+        assertExisting(session, youngHistory, youngOrphanedHistory);
+        assertHasVersionablePath(session, youngHistory);
+    }
+
+    @Test
+    public void referencedOlderThanOrphaned() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyOrphanedVersions(betweenHistories);
+            }
+        });
+
+        assertTrue(isVersionable(session, VERSIONABLES_OLD));
+        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldOrphanedHistory);
+        assertExisting(session, oldHistory, youngHistory, youngOrphanedHistory);
+        assertHasVersionablePath(session, oldHistory, youngHistory);
+    }
+
+    @Test
+    public void onlyReferenced() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyOrphanedVersions(null);
+            }
+        });
+        assertTrue(isVersionable(session, VERSIONABLES_OLD));
+        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldOrphanedHistory, youngOrphanedHistory);
+        assertExisting(session, oldHistory, youngHistory);
+        assertHasVersionablePath(session, oldHistory, youngHistory);
+    }
+
+    @Test
+    public void onlyReferencedAfterDate() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyVersions(betweenHistories);
+                upgrade.setCopyOrphanedVersions(null);
+            }
+        });
+        assertFalse(isVersionable(session, VERSIONABLES_OLD));
+        assertTrue(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldHistory, oldOrphanedHistory, youngOrphanedHistory);
+        assertExisting(session, youngHistory);
+        assertHasVersionablePath(session, youngHistory);
+    }
+
+    @Test
+    public void onlyOrphaned() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyVersions(null);
+            }
+        });
+
+        assertFalse(isVersionable(session, VERSIONABLES_OLD));
+        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
+    }
+
+    @Test
+    public void onlyOrphanedAfterDate() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyVersions(null);
+                upgrade.setCopyOrphanedVersions(betweenHistories);
+            }
+        });
+
+        assertFalse(isVersionable(session, VERSIONABLES_OLD));
+        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
+    }
+
+    @Test
+    public void dontCopyVersionHistory() throws RepositoryException {
+        assert source != null;
+
+        Session session = performCopy(source, new RepositoryUpgradeSetup() {
+            @Override
+            public void setup(RepositoryUpgrade upgrade) {
+                upgrade.setCopyVersions(null);
+                upgrade.setCopyOrphanedVersions(null);
+            }
+        });
+
+        assertFalse(isVersionable(session, VERSIONABLES_OLD));
+        assertFalse(isVersionable(session, VERSIONABLES_YOUNG));
+        assertMissing(session, oldHistory, youngHistory, oldOrphanedHistory, youngOrphanedHistory);
+    }
+
+    public Session performCopy(File source, RepositoryUpgradeSetup setup) throws RepositoryException {
+        final RepositoryConfig sourceConfig = RepositoryConfig.create(source);
+        final RepositoryContext sourceContext = RepositoryContext.create(sourceConfig);
+        final NodeStore targetNodeStore = new MemoryNodeStore();
+        try {
+            final RepositoryUpgrade upgrade = new RepositoryUpgrade(sourceContext, targetNodeStore);
+            setup.setup(upgrade);
+            upgrade.copy(null);
+        } finally {
+            sourceContext.getRepository().shutdown();
+        }
+
+        final Repository repository = new Jcr(new Oak(targetNodeStore)).createRepository();
+        return repository.login(AbstractRepositoryUpgradeTest.CREDENTIALS);
+    }
+
+    private static void assertExisting(final Session session, final String... paths) throws RepositoryException {
+        for (final String path : paths) {
+            final String relPath = path.substring(1);
+            assertTrue("node " + path + " should exist", session.getRootNode().hasNode(relPath));
+        }
+    }
+
+    private static void assertMissing(final Session session, final String... paths) throws RepositoryException {
+        for (final String path : paths) {
+            final String relPath = path.substring(1);
+            assertFalse("node " + path + " should not exist", session.getRootNode().hasNode(relPath));
+        }
+    }
+    
+    public static void assertHasVersionablePath(final Session session, final String... historyPaths) throws RepositoryException {
+        for (String historyPath : historyPaths) {
+            final String workspaceName = session.getWorkspace().getName();
+            final Node versionHistory = session.getNode(historyPath);
+            assertTrue(versionHistory.isNodeType(MIX_REP_VERSIONABLE_PATHS));
+            assertTrue(versionHistory.hasProperty(workspaceName));
+            final Property pathProperty = versionHistory.getProperty(workspaceName);
+            assertEquals(PropertyType.PATH, pathProperty.getType());
+    
+            final VersionManager vm = session.getWorkspace().getVersionManager();
+            assertEquals(historyPath, vm.getVersionHistory(pathProperty.getString()).getPath());
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/CopyVersionHistoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/IncludeExcludeUpgradeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/IncludeExcludeUpgradeTest.java?rev=1694646&r1=1694645&r2=1694646&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/IncludeExcludeUpgradeTest.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/IncludeExcludeUpgradeTest.java Fri Aug  7 10:31:00 2015
@@ -1,87 +1,87 @@
-package org.apache.jackrabbit.oak.upgrade;
-
-import org.apache.jackrabbit.commons.JcrUtils;
-import org.apache.jackrabbit.core.RepositoryContext;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.Test;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import java.io.File;
-
-public class IncludeExcludeUpgradeTest extends AbstractRepositoryUpgradeTest {
-
-    @Override
-    protected void createSourceContent(Repository repository) throws Exception {
-        final Session session = repository.login(CREDENTIALS);
-        JcrUtils.getOrCreateByPath("/content/foo/de", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/foo/en", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/foo/fr", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/foo/it", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2015", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2015/02", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2015/01", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2014", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2013", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2012", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2011", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2010", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2010/12", "nt:folder", session);
-        JcrUtils.getOrCreateByPath("/content/assets/foo/2010/11", "nt:folder", session);
-        session.save();
-    }
-
-    @Override
-    protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException {
-        final RepositoryConfig config = RepositoryConfig.create(source);
-        final RepositoryContext context = RepositoryContext.create(config);
-        try {
-            final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
-            upgrade.setIncludes(
-                    "/content/foo/en",
-                    "/content/assets/foo"
-            );
-            upgrade.setExcludes(
-                    "/content/assets/foo/2013",
-                    "/content/assets/foo/2012",
-                    "/content/assets/foo/2011",
-                    "/content/assets/foo/2010"
-            );
-            upgrade.copy(null);
-        } finally {
-            context.getRepository().shutdown();
-        }
-    }
-
-    @Test
-    public void shouldHaveIncludedPaths() throws RepositoryException {
-        assertExisting(
-                "/content/foo/en",
-                "/content/assets/foo/2015/02",
-                "/content/assets/foo/2015/01",
-                "/content/assets/foo/2014"
-        );
-    }
-
-    @Test
-    public void shouldLackPathsThatWereNotIncluded() throws RepositoryException {
-        assertMissing(
-                "/content/foo/de",
-                "/content/foo/fr",
-                "/content/foo/it"
-        );
-    }
-
-    @Test
-    public void shouldLackExcludedPaths() throws RepositoryException {
-        assertMissing(
-                "/content/assets/foo/2013",
-                "/content/assets/foo/2012",
-                "/content/assets/foo/2011",
-                "/content/assets/foo/2010"
-        );
-    }
-}
+package org.apache.jackrabbit.oak.upgrade;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+import org.apache.jackrabbit.core.RepositoryContext;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Test;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import java.io.File;
+
+public class IncludeExcludeUpgradeTest extends AbstractRepositoryUpgradeTest {
+
+    @Override
+    protected void createSourceContent(Repository repository) throws Exception {
+        final Session session = repository.login(CREDENTIALS);
+        JcrUtils.getOrCreateByPath("/content/foo/de", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/foo/en", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/foo/fr", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/foo/it", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2015", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2015/02", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2015/01", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2014", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2013", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2012", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2011", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2010", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2010/12", "nt:folder", session);
+        JcrUtils.getOrCreateByPath("/content/assets/foo/2010/11", "nt:folder", session);
+        session.save();
+    }
+
+    @Override
+    protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException {
+        final RepositoryConfig config = RepositoryConfig.create(source);
+        final RepositoryContext context = RepositoryContext.create(config);
+        try {
+            final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
+            upgrade.setIncludes(
+                    "/content/foo/en",
+                    "/content/assets/foo"
+            );
+            upgrade.setExcludes(
+                    "/content/assets/foo/2013",
+                    "/content/assets/foo/2012",
+                    "/content/assets/foo/2011",
+                    "/content/assets/foo/2010"
+            );
+            upgrade.copy(null);
+        } finally {
+            context.getRepository().shutdown();
+        }
+    }
+
+    @Test
+    public void shouldHaveIncludedPaths() throws RepositoryException {
+        assertExisting(
+                "/content/foo/en",
+                "/content/assets/foo/2015/02",
+                "/content/assets/foo/2015/01",
+                "/content/assets/foo/2014"
+        );
+    }
+
+    @Test
+    public void shouldLackPathsThatWereNotIncluded() throws RepositoryException {
+        assertMissing(
+                "/content/foo/de",
+                "/content/foo/fr",
+                "/content/foo/it"
+        );
+    }
+
+    @Test
+    public void shouldLackExcludedPaths() throws RepositoryException {
+        assertMissing(
+                "/content/assets/foo/2013",
+                "/content/assets/foo/2012",
+                "/content/assets/foo/2011",
+                "/content/assets/foo/2010"
+        );
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/IncludeExcludeUpgradeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/UpgradeFromTwoSourcesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/UpgradeFromTwoSourcesTest.java?rev=1694646&r1=1694645&r2=1694646&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/UpgradeFromTwoSourcesTest.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/UpgradeFromTwoSourcesTest.java Fri Aug  7 10:31:00 2015
@@ -1,155 +1,155 @@
-package org.apache.jackrabbit.oak.upgrade;
-
-import org.apache.jackrabbit.commons.JcrUtils;
-import org.apache.jackrabbit.core.RepositoryContext;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-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 org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Test case that simulates copying different paths from two source repositories
- * into a single target repository.
- */
-public class UpgradeFromTwoSourcesTest extends AbstractRepositoryUpgradeTest {
-
-    private static boolean upgradeComplete;
-    private static FileStore fileStore;
-
-    @Override
-    protected NodeStore createTargetNodeStore() {
-        return new SegmentNodeStore(fileStore);
-    }
-
-    @BeforeClass
-    public static void initialize() {
-        final File dir = new File(getTestDirectory(), "segments");
-        dir.mkdirs();
-        try {
-            fileStore = FileStore.newFileStore(dir).withMaxFileSize(128).create();
-            upgradeComplete = false;
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @AfterClass
-    public static void cleanup() {
-        fileStore.close();
-        fileStore = null;
-    }
-
-    @Before
-    public synchronized void upgradeRepository() throws Exception {
-        if (!upgradeComplete) {
-            final File sourceDir1 = new File(getTestDirectory(), "source1");
-            final File sourceDir2 = new File(getTestDirectory(), "source2");
-
-            sourceDir1.mkdirs();
-            sourceDir2.mkdirs();
-
-            final RepositoryImpl source1 = createSourceRepository(sourceDir1);
-            final RepositoryImpl source2 = createSourceRepository(sourceDir2);
-
-            try {
-                createSourceContent(source1);
-                createSourceContent2(source2);
-            } finally {
-                source1.shutdown();
-                source2.shutdown();
-            }
-
-            final NodeStore target = getTargetNodeStore();
-            doUpgradeRepository(sourceDir1, target, "/left");
-            doUpgradeRepository(sourceDir2, target, "/right", "/left/child2", "/left/child3");
-            fileStore.flush();
-            upgradeComplete = true;
-        }
-    }
-
-    private void doUpgradeRepository(File source, NodeStore target, String... includes) throws RepositoryException {
-        final RepositoryConfig config = RepositoryConfig.create(source);
-        final RepositoryContext context = RepositoryContext.create(config);
-        try {
-            final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
-            upgrade.setIncludes(includes);
-            upgrade.copy(null);
-        } finally {
-            context.getRepository().shutdown();
-        }
-    }
-
-    @Override
-    protected void createSourceContent(Repository repository) throws RepositoryException {
-        Session session = null;
-        try {
-            session = repository.login(CREDENTIALS);
-
-            JcrUtils.getOrCreateByPath("/left/child1/grandchild1", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child1/grandchild2", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child1/grandchild3", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child2/grandchild1", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child2/grandchild2", "nt:unstructured", session);
-
-            session.save();
-        } finally {
-            if (session != null && session.isLive()) {
-                session.logout();
-            }
-        }
-    }
-
-    protected void createSourceContent2(Repository repository) throws RepositoryException {
-        Session session = null;
-        try {
-            session = repository.login(CREDENTIALS);
-
-            JcrUtils.getOrCreateByPath("/left/child2/grandchild3", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child2/grandchild2", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/left/child3", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/right/child1/grandchild1", "nt:unstructured", session);
-            JcrUtils.getOrCreateByPath("/right/child1/grandchild2", "nt:unstructured", session);
-
-            session.save();
-        } finally {
-            if (session != null && session.isLive()) {
-                session.logout();
-            }
-        }
-    }
-
-    @Test
-    public void shouldContainNodesFromBothSources() throws Exception {
-        assertExisting(
-                "/",
-                "/left",
-                "/left/child1",
-                "/left/child2",
-                "/left/child3",
-                "/left/child1/grandchild1",
-                "/left/child1/grandchild2",
-                "/left/child1/grandchild3",
-                "/left/child2/grandchild2",
-                "/left/child2/grandchild3",
-                "/right",
-                "/right/child1",
-                "/right/child1/grandchild1",
-                "/right/child1/grandchild2"
-        );
-
-        assertMissing(
-                "/left/child2/grandchild1"
-        );
-    }
+package org.apache.jackrabbit.oak.upgrade;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+import org.apache.jackrabbit.core.RepositoryContext;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+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 org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test case that simulates copying different paths from two source repositories
+ * into a single target repository.
+ */
+public class UpgradeFromTwoSourcesTest extends AbstractRepositoryUpgradeTest {
+
+    private static boolean upgradeComplete;
+    private static FileStore fileStore;
+
+    @Override
+    protected NodeStore createTargetNodeStore() {
+        return new SegmentNodeStore(fileStore);
+    }
+
+    @BeforeClass
+    public static void initialize() {
+        final File dir = new File(getTestDirectory(), "segments");
+        dir.mkdirs();
+        try {
+            fileStore = FileStore.newFileStore(dir).withMaxFileSize(128).create();
+            upgradeComplete = false;
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        fileStore.close();
+        fileStore = null;
+    }
+
+    @Before
+    public synchronized void upgradeRepository() throws Exception {
+        if (!upgradeComplete) {
+            final File sourceDir1 = new File(getTestDirectory(), "source1");
+            final File sourceDir2 = new File(getTestDirectory(), "source2");
+
+            sourceDir1.mkdirs();
+            sourceDir2.mkdirs();
+
+            final RepositoryImpl source1 = createSourceRepository(sourceDir1);
+            final RepositoryImpl source2 = createSourceRepository(sourceDir2);
+
+            try {
+                createSourceContent(source1);
+                createSourceContent2(source2);
+            } finally {
+                source1.shutdown();
+                source2.shutdown();
+            }
+
+            final NodeStore target = getTargetNodeStore();
+            doUpgradeRepository(sourceDir1, target, "/left");
+            doUpgradeRepository(sourceDir2, target, "/right", "/left/child2", "/left/child3");
+            fileStore.flush();
+            upgradeComplete = true;
+        }
+    }
+
+    private void doUpgradeRepository(File source, NodeStore target, String... includes) throws RepositoryException {
+        final RepositoryConfig config = RepositoryConfig.create(source);
+        final RepositoryContext context = RepositoryContext.create(config);
+        try {
+            final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
+            upgrade.setIncludes(includes);
+            upgrade.copy(null);
+        } finally {
+            context.getRepository().shutdown();
+        }
+    }
+
+    @Override
+    protected void createSourceContent(Repository repository) throws RepositoryException {
+        Session session = null;
+        try {
+            session = repository.login(CREDENTIALS);
+
+            JcrUtils.getOrCreateByPath("/left/child1/grandchild1", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child1/grandchild2", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child1/grandchild3", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child2/grandchild1", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child2/grandchild2", "nt:unstructured", session);
+
+            session.save();
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+    }
+
+    protected void createSourceContent2(Repository repository) throws RepositoryException {
+        Session session = null;
+        try {
+            session = repository.login(CREDENTIALS);
+
+            JcrUtils.getOrCreateByPath("/left/child2/grandchild3", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child2/grandchild2", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/left/child3", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/right/child1/grandchild1", "nt:unstructured", session);
+            JcrUtils.getOrCreateByPath("/right/child1/grandchild2", "nt:unstructured", session);
+
+            session.save();
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+    }
+
+    @Test
+    public void shouldContainNodesFromBothSources() throws Exception {
+        assertExisting(
+                "/",
+                "/left",
+                "/left/child1",
+                "/left/child2",
+                "/left/child3",
+                "/left/child1/grandchild1",
+                "/left/child1/grandchild2",
+                "/left/child1/grandchild3",
+                "/left/child2/grandchild2",
+                "/left/child2/grandchild3",
+                "/right",
+                "/right/child1",
+                "/right/child1/grandchild1",
+                "/right/child1/grandchild2"
+        );
+
+        assertMissing(
+                "/left/child2/grandchild1"
+        );
+    }
 }
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/UpgradeFromTwoSourcesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/nodestate/FilteringNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/nodestate/FilteringNodeStateTest.java?rev=1694646&r1=1694645&r2=1694646&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/nodestate/FilteringNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/nodestate/FilteringNodeStateTest.java Fri Aug  7 10:31:00 2015
@@ -1,304 +1,304 @@
-package org.apache.jackrabbit.oak.upgrade.nodestate;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.jcr.RepositoryException;
-import java.util.Set;
-
-import static com.google.common.collect.ImmutableSet.of;
-import static com.google.common.collect.Lists.newArrayList;
-import static java.util.Arrays.asList;
-import static org.apache.jackrabbit.oak.plugins.memory.PropertyStates.createProperty;
-import static org.apache.jackrabbit.oak.plugins.tree.impl.TreeConstants.OAK_CHILD_ORDER;
-import static org.apache.jackrabbit.oak.upgrade.nodestate.FilteringNodeState.wrap;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.assertExists;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.assertMissing;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.commit;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.create;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.createNodeStoreWithContent;
-import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.getNodeState;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-public class FilteringNodeStateTest {
-
-    private static final Set<String> DEFAULT_INCLUDES = FilteringNodeState.ALL;
-
-    private static final Set<String> DEFAULT_EXCLUDES = FilteringNodeState.NONE;
-
-    private NodeState rootNodeState;
-
-    @Before
-    public void setup() throws RepositoryException, CommitFailedException {
-        final NodeStore nodeStore = createNodeStoreWithContent(
-                "/content/foo/de",
-                "/content/foo/en",
-                "/content/football/en",
-                "/apps/foo/install",
-                "/libs/foo/install"
-        );
-
-        final PropertyState childOrder = createProperty(OAK_CHILD_ORDER, asList("foo", "football"), Type.NAMES);
-        final NodeBuilder builder = nodeStore.getRoot().builder();
-        create(builder, "/content", childOrder);
-        commit(nodeStore, builder);
-
-        rootNodeState = nodeStore.getRoot();
-    }
-
-    @Test
-    public void shouldNotDecorateForNullArgs() {
-        final NodeState decorated = wrap("/", rootNodeState, null, null);
-        assertSame("root should be identical to decorated", rootNodeState, decorated);
-    }
-
-    @Test
-    public void shouldNotDecorateForDefaultIncludes() {
-        final NodeState decorated = wrap("/", rootNodeState, DEFAULT_INCLUDES, null);
-        assertSame("root should be identical to decorated", rootNodeState, decorated);
-    }
-
-    @Test
-    public void shouldNotDecorateForDefaultExcludes() {
-        final NodeState decorated = wrap("/", rootNodeState, null, DEFAULT_EXCLUDES);
-        assertSame("root should be identical to decorated", rootNodeState, decorated);
-    }
-
-    @Test
-    public void shouldNotDecorateForDefaultIncludesAndExcludes() {
-        final NodeState decorated = wrap("/", rootNodeState, DEFAULT_INCLUDES, DEFAULT_EXCLUDES);
-        assertSame("root should be identical to decorated", rootNodeState, decorated);
-    }
-
-    @Test
-    public void shouldNotDecorateIncludedPath() {
-        final NodeState content = getNodeState(rootNodeState, "/content");
-        final NodeState decorated = wrap("/content", content, of("/content"), null);
-        assertSame("content should be identical to decorated", content, decorated);
-    }
-
-    @Test
-    public void shouldNotDecorateIncludedDescendants() {
-        final NodeState foo = getNodeState(rootNodeState, "/content/foo");
-        final NodeState decorated = wrap("/content/foo", foo, of("/content"), null);
-        assertSame("foo should be identical to decorated", foo, decorated);
-    }
-
-    @Test
-    public void shouldDecorateAncestorOfExcludedDescendants() {
-        final NodeState foo = getNodeState(rootNodeState, "/content/foo");
-        final NodeState decorated = wrap("/content/foo", foo, of("/content"), of("/content/foo/de"));
-        assertNotSame("foo should not be identical to decorated", foo, decorated);
-
-        assertMissing(decorated, "de");
-        assertExists(decorated, "en");
-        assertFalse("child nodes \"de\" should not be equal",
-                getNodeState(foo, "de").equals(getNodeState(decorated, "de")));
-
-        final NodeState en = getNodeState(decorated, "en");
-        assertEquals("child nodes \"en\" should be equal", getNodeState(foo, "en"), en);
-        assertTrue("child node \"en\" should not be decorated", !(en instanceof FilteringNodeState));
-    }
-
-    @Test
-    public void shouldHaveCorrectChildOrderProperty() throws CommitFailedException {
-        final NodeState content = rootNodeState.getChildNode("content");
-        final NodeState decorated = wrap("/content", content, null, of("/content/foo"));
-
-        assertTrue(decorated.hasProperty(OAK_CHILD_ORDER));
-
-        { // access via getProperty()
-            final PropertyState childOrder = decorated.getProperty(OAK_CHILD_ORDER);
-            final Iterable<String> values = childOrder.getValue(Type.STRINGS);
-            assertEquals(newArrayList("football"), newArrayList(values));
-        }
-
-        { // access via getProperties()
-            final Predicate<PropertyState> isChildOrderProperty = new Predicate<PropertyState>() {
-                @Override
-                public boolean apply(PropertyState propertyState) {
-                    return OAK_CHILD_ORDER.equals(propertyState.getName());
-                }
-            };
-            final PropertyState childOrder = Iterables.find(decorated.getProperties(), isChildOrderProperty);
-            final Iterable<String> values = childOrder.getValue(Type.STRINGS);
-            assertEquals(newArrayList("football"), newArrayList(values));
-        }
-    }
-
-    @Test
-    public void shouldDecorateExcludedNode() {
-        final NodeState decoratedRoot = wrap("/", rootNodeState, of("/content"), of("/content/foo/de"));
-        final NodeState de = getNodeState(rootNodeState, "/content/foo/de");
-        final NodeState decorated = getNodeState(decoratedRoot, "/content/foo/de");
-        assertFalse("de should not be equal to decorated", de.equals(decorated));
-        assertFalse("decorated should not exist", decorated.exists());
-    }
-
-    @Test
-    public void shouldDecorateImplicitlyExcludedNode() {
-        final NodeState content = getNodeState(rootNodeState, "/content");
-        final NodeState decorated = wrap("/content", content, of("/apps"), null);
-        assertNotSame("content should not be identical to decorated", content, decorated);
-    }
-
-
-    @Test
-    public void shouldHideExcludedPathsViaExists() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
-        assertMissing(decorated, "apps");
-        assertMissing(decorated, "libs/foo/install");
-
-        assertExists(decorated, "content/foo/de");
-        assertExists(decorated, "content/foo/en");
-    }
-
-    @Test
-    public void shouldHideExcludedPathsViaHasChildNode() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
-
-        assertExistingHasChildNode(decorated, "content");
-        assertMissingHasChildNode(decorated, "apps");
-        assertMissingHasChildNode(decorated, "libs");
-    }
-
-    @Test
-    public void shouldHideExcludedPathsViaGetChildNodeNames() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
-
-        assertExistingChildNodeName(decorated, "content");
-        assertMissingChildNodeName(decorated, "apps");
-        assertMissingChildNodeName(decorated, "libs");
-    }
-
-    @Test
-    public void shouldHideMissingIncludedPathsViaExists() {
-        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
-        assertMissing(decorated, "apps");
-        assertMissing(decorated, "libs/foo/install");
-
-        assertExists(decorated, "content/foo/de");
-        assertExists(decorated, "content/foo/en");
-    }
-
-    @Test
-    public void shouldHideMissingIncludedPathsViaHasChildNode() {
-        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
-
-        assertExistingHasChildNode(decorated, "content");
-        assertMissingHasChildNode(decorated, "apps");
-        assertMissingHasChildNode(decorated, "libs");
-    }
-
-    @Test
-    public void shouldHideMissingIncludedPathsViaGetChildNodeNames() {
-        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
-
-        assertExistingChildNodeName(decorated, "content");
-        assertMissingChildNodeName(decorated, "apps");
-        assertMissingChildNodeName(decorated, "libs");
-    }
-
-    @Test
-    public void shouldGivePrecedenceForExcludesOverIncludes() {
-        final NodeState conflictingRules = wrap("/", rootNodeState, of("/content"), of("/content"));
-        assertMissingChildNodeName(conflictingRules, "content");
-
-        final NodeState overlappingRules = wrap("/", rootNodeState, of("/content"), of("/content/foo"));
-        assertExistingChildNodeName(overlappingRules, "content");
-        assertMissingChildNodeName(overlappingRules.getChildNode("content"), "foo");
-
-
-        final NodeState overlappingRules2 = wrap("/", rootNodeState, of("/content/foo"), of("/content"));
-        assertMissingChildNodeName(overlappingRules2, "content");
-        assertMissingChildNodeName(overlappingRules2.getChildNode("content"), "foo");
-
-    }
-
-    @Test
-    public void shouldRespectPathBoundariesForIncludes() {
-        final NodeState decorated = wrap("/", rootNodeState, of("/content/foo"), null);
-
-        assertExistingChildNodeName(decorated, "content");
-        assertExistingChildNodeName(decorated.getChildNode("content"), "foo");
-        assertMissingChildNodeName(decorated.getChildNode("content"), "football");
-    }
-
-    @Test
-    public void shouldRespectPathBoundariesForExcludes() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
-
-        assertExistingChildNodeName(decorated, "content");
-        assertMissingChildNodeName(decorated.getChildNode("content"), "foo");
-        assertExistingChildNodeName(decorated.getChildNode("content"), "football");
-    }
-
-    @Test
-    public void shouldDelegatePropertyCount() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo/de"));
-
-        assertEquals(1, getNodeState(decorated, "/content").getPropertyCount());
-        assertEquals(0, getNodeState(decorated, "/content/foo").getPropertyCount());
-    }
-
-
-    @Test
-    public void shouldDelegateGetProperty() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
-        final NodeState content = getNodeState(decorated, "/content");
-
-        assertNotNull(content.getProperty(OAK_CHILD_ORDER));
-        assertNull(content.getProperty("nonexisting"));
-    }
-
-
-    @Test
-    public void shouldDelegateHasProperty() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo/de"));
-
-        assertTrue(getNodeState(decorated, "/content").hasProperty(OAK_CHILD_ORDER));
-        assertFalse(getNodeState(decorated, "/content").hasProperty("foo"));
-    }
-
-
-    @Test
-    public void exists() {
-        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
-        assertTrue("/content should exist and be visible", getNodeState(decorated, "/content").exists());
-        assertFalse("/content/foo should be hidden", getNodeState(decorated, "/content/foo").exists());
-        assertFalse("/nonexisting should not exist", getNodeState(decorated, "/nonexisting").exists());
-    }
-
-
-    private void assertExistingHasChildNode(NodeState decorated, String name) {
-        assertTrue("should have child \"" + name + "\"", decorated.hasChildNode(name));
-    }
-
-    private void assertMissingHasChildNode(NodeState decorated, String name) {
-        assertFalse("should not have child \"" + name + "\"", decorated.hasChildNode(name));
-    }
-
-    private void assertExistingChildNodeName(NodeState decorated, String name) {
-        final Iterable<String> childNodeNames = decorated.getChildNodeNames();
-        assertTrue("should list child \"" + name + "\"", Iterables.contains(childNodeNames, name));
-    }
-
-    private void assertMissingChildNodeName(NodeState decorated, String name) {
-        final Iterable<String> childNodeNames = decorated.getChildNodeNames();
-        assertFalse("should not list child \"" + name + "\"", Iterables.contains(childNodeNames, name));
-    }
-}
+package org.apache.jackrabbit.oak.upgrade.nodestate;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.jcr.RepositoryException;
+import java.util.Set;
+
+import static com.google.common.collect.ImmutableSet.of;
+import static com.google.common.collect.Lists.newArrayList;
+import static java.util.Arrays.asList;
+import static org.apache.jackrabbit.oak.plugins.memory.PropertyStates.createProperty;
+import static org.apache.jackrabbit.oak.plugins.tree.impl.TreeConstants.OAK_CHILD_ORDER;
+import static org.apache.jackrabbit.oak.upgrade.nodestate.FilteringNodeState.wrap;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.assertExists;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.assertMissing;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.commit;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.create;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.createNodeStoreWithContent;
+import static org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.getNodeState;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+public class FilteringNodeStateTest {
+
+    private static final Set<String> DEFAULT_INCLUDES = FilteringNodeState.ALL;
+
+    private static final Set<String> DEFAULT_EXCLUDES = FilteringNodeState.NONE;
+
+    private NodeState rootNodeState;
+
+    @Before
+    public void setup() throws RepositoryException, CommitFailedException {
+        final NodeStore nodeStore = createNodeStoreWithContent(
+                "/content/foo/de",
+                "/content/foo/en",
+                "/content/football/en",
+                "/apps/foo/install",
+                "/libs/foo/install"
+        );
+
+        final PropertyState childOrder = createProperty(OAK_CHILD_ORDER, asList("foo", "football"), Type.NAMES);
+        final NodeBuilder builder = nodeStore.getRoot().builder();
+        create(builder, "/content", childOrder);
+        commit(nodeStore, builder);
+
+        rootNodeState = nodeStore.getRoot();
+    }
+
+    @Test
+    public void shouldNotDecorateForNullArgs() {
+        final NodeState decorated = wrap("/", rootNodeState, null, null);
+        assertSame("root should be identical to decorated", rootNodeState, decorated);
+    }
+
+    @Test
+    public void shouldNotDecorateForDefaultIncludes() {
+        final NodeState decorated = wrap("/", rootNodeState, DEFAULT_INCLUDES, null);
+        assertSame("root should be identical to decorated", rootNodeState, decorated);
+    }
+
+    @Test
+    public void shouldNotDecorateForDefaultExcludes() {
+        final NodeState decorated = wrap("/", rootNodeState, null, DEFAULT_EXCLUDES);
+        assertSame("root should be identical to decorated", rootNodeState, decorated);
+    }
+
+    @Test
+    public void shouldNotDecorateForDefaultIncludesAndExcludes() {
+        final NodeState decorated = wrap("/", rootNodeState, DEFAULT_INCLUDES, DEFAULT_EXCLUDES);
+        assertSame("root should be identical to decorated", rootNodeState, decorated);
+    }
+
+    @Test
+    public void shouldNotDecorateIncludedPath() {
+        final NodeState content = getNodeState(rootNodeState, "/content");
+        final NodeState decorated = wrap("/content", content, of("/content"), null);
+        assertSame("content should be identical to decorated", content, decorated);
+    }
+
+    @Test
+    public void shouldNotDecorateIncludedDescendants() {
+        final NodeState foo = getNodeState(rootNodeState, "/content/foo");
+        final NodeState decorated = wrap("/content/foo", foo, of("/content"), null);
+        assertSame("foo should be identical to decorated", foo, decorated);
+    }
+
+    @Test
+    public void shouldDecorateAncestorOfExcludedDescendants() {
+        final NodeState foo = getNodeState(rootNodeState, "/content/foo");
+        final NodeState decorated = wrap("/content/foo", foo, of("/content"), of("/content/foo/de"));
+        assertNotSame("foo should not be identical to decorated", foo, decorated);
+
+        assertMissing(decorated, "de");
+        assertExists(decorated, "en");
+        assertFalse("child nodes \"de\" should not be equal",
+                getNodeState(foo, "de").equals(getNodeState(decorated, "de")));
+
+        final NodeState en = getNodeState(decorated, "en");
+        assertEquals("child nodes \"en\" should be equal", getNodeState(foo, "en"), en);
+        assertTrue("child node \"en\" should not be decorated", !(en instanceof FilteringNodeState));
+    }
+
+    @Test
+    public void shouldHaveCorrectChildOrderProperty() throws CommitFailedException {
+        final NodeState content = rootNodeState.getChildNode("content");
+        final NodeState decorated = wrap("/content", content, null, of("/content/foo"));
+
+        assertTrue(decorated.hasProperty(OAK_CHILD_ORDER));
+
+        { // access via getProperty()
+            final PropertyState childOrder = decorated.getProperty(OAK_CHILD_ORDER);
+            final Iterable<String> values = childOrder.getValue(Type.STRINGS);
+            assertEquals(newArrayList("football"), newArrayList(values));
+        }
+
+        { // access via getProperties()
+            final Predicate<PropertyState> isChildOrderProperty = new Predicate<PropertyState>() {
+                @Override
+                public boolean apply(PropertyState propertyState) {
+                    return OAK_CHILD_ORDER.equals(propertyState.getName());
+                }
+            };
+            final PropertyState childOrder = Iterables.find(decorated.getProperties(), isChildOrderProperty);
+            final Iterable<String> values = childOrder.getValue(Type.STRINGS);
+            assertEquals(newArrayList("football"), newArrayList(values));
+        }
+    }
+
+    @Test
+    public void shouldDecorateExcludedNode() {
+        final NodeState decoratedRoot = wrap("/", rootNodeState, of("/content"), of("/content/foo/de"));
+        final NodeState de = getNodeState(rootNodeState, "/content/foo/de");
+        final NodeState decorated = getNodeState(decoratedRoot, "/content/foo/de");
+        assertFalse("de should not be equal to decorated", de.equals(decorated));
+        assertFalse("decorated should not exist", decorated.exists());
+    }
+
+    @Test
+    public void shouldDecorateImplicitlyExcludedNode() {
+        final NodeState content = getNodeState(rootNodeState, "/content");
+        final NodeState decorated = wrap("/content", content, of("/apps"), null);
+        assertNotSame("content should not be identical to decorated", content, decorated);
+    }
+
+
+    @Test
+    public void shouldHideExcludedPathsViaExists() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
+        assertMissing(decorated, "apps");
+        assertMissing(decorated, "libs/foo/install");
+
+        assertExists(decorated, "content/foo/de");
+        assertExists(decorated, "content/foo/en");
+    }
+
+    @Test
+    public void shouldHideExcludedPathsViaHasChildNode() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
+
+        assertExistingHasChildNode(decorated, "content");
+        assertMissingHasChildNode(decorated, "apps");
+        assertMissingHasChildNode(decorated, "libs");
+    }
+
+    @Test
+    public void shouldHideExcludedPathsViaGetChildNodeNames() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/apps", "/libs"));
+
+        assertExistingChildNodeName(decorated, "content");
+        assertMissingChildNodeName(decorated, "apps");
+        assertMissingChildNodeName(decorated, "libs");
+    }
+
+    @Test
+    public void shouldHideMissingIncludedPathsViaExists() {
+        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
+        assertMissing(decorated, "apps");
+        assertMissing(decorated, "libs/foo/install");
+
+        assertExists(decorated, "content/foo/de");
+        assertExists(decorated, "content/foo/en");
+    }
+
+    @Test
+    public void shouldHideMissingIncludedPathsViaHasChildNode() {
+        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
+
+        assertExistingHasChildNode(decorated, "content");
+        assertMissingHasChildNode(decorated, "apps");
+        assertMissingHasChildNode(decorated, "libs");
+    }
+
+    @Test
+    public void shouldHideMissingIncludedPathsViaGetChildNodeNames() {
+        final NodeState decorated = wrap("/", rootNodeState, of("/content"), null);
+
+        assertExistingChildNodeName(decorated, "content");
+        assertMissingChildNodeName(decorated, "apps");
+        assertMissingChildNodeName(decorated, "libs");
+    }
+
+    @Test
+    public void shouldGivePrecedenceForExcludesOverIncludes() {
+        final NodeState conflictingRules = wrap("/", rootNodeState, of("/content"), of("/content"));
+        assertMissingChildNodeName(conflictingRules, "content");
+
+        final NodeState overlappingRules = wrap("/", rootNodeState, of("/content"), of("/content/foo"));
+        assertExistingChildNodeName(overlappingRules, "content");
+        assertMissingChildNodeName(overlappingRules.getChildNode("content"), "foo");
+
+
+        final NodeState overlappingRules2 = wrap("/", rootNodeState, of("/content/foo"), of("/content"));
+        assertMissingChildNodeName(overlappingRules2, "content");
+        assertMissingChildNodeName(overlappingRules2.getChildNode("content"), "foo");
+
+    }
+
+    @Test
+    public void shouldRespectPathBoundariesForIncludes() {
+        final NodeState decorated = wrap("/", rootNodeState, of("/content/foo"), null);
+
+        assertExistingChildNodeName(decorated, "content");
+        assertExistingChildNodeName(decorated.getChildNode("content"), "foo");
+        assertMissingChildNodeName(decorated.getChildNode("content"), "football");
+    }
+
+    @Test
+    public void shouldRespectPathBoundariesForExcludes() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
+
+        assertExistingChildNodeName(decorated, "content");
+        assertMissingChildNodeName(decorated.getChildNode("content"), "foo");
+        assertExistingChildNodeName(decorated.getChildNode("content"), "football");
+    }
+
+    @Test
+    public void shouldDelegatePropertyCount() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo/de"));
+
+        assertEquals(1, getNodeState(decorated, "/content").getPropertyCount());
+        assertEquals(0, getNodeState(decorated, "/content/foo").getPropertyCount());
+    }
+
+
+    @Test
+    public void shouldDelegateGetProperty() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
+        final NodeState content = getNodeState(decorated, "/content");
+
+        assertNotNull(content.getProperty(OAK_CHILD_ORDER));
+        assertNull(content.getProperty("nonexisting"));
+    }
+
+
+    @Test
+    public void shouldDelegateHasProperty() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo/de"));
+
+        assertTrue(getNodeState(decorated, "/content").hasProperty(OAK_CHILD_ORDER));
+        assertFalse(getNodeState(decorated, "/content").hasProperty("foo"));
+    }
+
+
+    @Test
+    public void exists() {
+        final NodeState decorated = wrap("/", rootNodeState, null, of("/content/foo"));
+        assertTrue("/content should exist and be visible", getNodeState(decorated, "/content").exists());
+        assertFalse("/content/foo should be hidden", getNodeState(decorated, "/content/foo").exists());
+        assertFalse("/nonexisting should not exist", getNodeState(decorated, "/nonexisting").exists());
+    }
+
+
+    private void assertExistingHasChildNode(NodeState decorated, String name) {
+        assertTrue("should have child \"" + name + "\"", decorated.hasChildNode(name));
+    }
+
+    private void assertMissingHasChildNode(NodeState decorated, String name) {
+        assertFalse("should not have child \"" + name + "\"", decorated.hasChildNode(name));
+    }
+
+    private void assertExistingChildNodeName(NodeState decorated, String name) {
+        final Iterable<String> childNodeNames = decorated.getChildNodeNames();
+        assertTrue("should list child \"" + name + "\"", Iterables.contains(childNodeNames, name));
+    }
+
+    private void assertMissingChildNodeName(NodeState decorated, String name) {
+        final Iterable<String> childNodeNames = decorated.getChildNodeNames();
+        assertFalse("should not list child \"" + name + "\"", Iterables.contains(childNodeNames, name));
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/nodestate/FilteringNodeStateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/util/VersionCopyTestUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/util/VersionCopyTestUtils.java?rev=1694646&r1=1694645&r2=1694646&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/util/VersionCopyTestUtils.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/util/VersionCopyTestUtils.java Fri Aug  7 10:31:00 2015
@@ -1,57 +1,57 @@
-package org.apache.jackrabbit.oak.upgrade.util;
-
-import static org.apache.jackrabbit.oak.plugins.version.VersionConstants.MIX_REP_VERSIONABLE_PATHS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionManager;
-
-import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.commons.JcrUtils;
-import org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade;
-
-public class VersionCopyTestUtils {
-
-    public static String createVersionableNode(Session session, String versionablePath)
-            throws RepositoryException, InterruptedException {
-        final VersionManager versionManager = session.getWorkspace().getVersionManager();
-        final Node versionable = JcrUtils.getOrCreateUniqueByPath(session.getRootNode(), versionablePath,
-                JcrConstants.NT_UNSTRUCTURED);
-        versionable.addMixin("mix:versionable");
-        versionable.setProperty("version", "root");
-        session.save();
-
-        final String path = versionable.getPath();
-        final List<String> versionNames = new ArrayList<String>();
-        for (int i = 0; i < 3; i++) {
-            versionable.setProperty("version", "1." + i);
-            session.save();
-            final Version v = versionManager.checkpoint(path);
-            versionNames.add(v.getName());
-        }
-
-        final VersionHistory history = versionManager.getVersionHistory(path);
-        for (final String versionName : versionNames) {
-            history.addVersionLabel(versionName, String.format("version %s", versionName), false);
-        }
-        return history.getPath();
-    }
-
-    public static boolean isVersionable(Session session, String path) throws RepositoryException {
-        return session.getNode(path).isNodeType(JcrConstants.MIX_VERSIONABLE);
-    }
-
-    public interface RepositoryUpgradeSetup {
-        void setup(RepositoryUpgrade upgrade);
-    }
-}
+package org.apache.jackrabbit.oak.upgrade.util;
+
+import static org.apache.jackrabbit.oak.plugins.version.VersionConstants.MIX_REP_VERSIONABLE_PATHS;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+import javax.jcr.version.VersionManager;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.commons.JcrUtils;
+import org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade;
+
+public class VersionCopyTestUtils {
+
+    public static String createVersionableNode(Session session, String versionablePath)
+            throws RepositoryException, InterruptedException {
+        final VersionManager versionManager = session.getWorkspace().getVersionManager();
+        final Node versionable = JcrUtils.getOrCreateUniqueByPath(session.getRootNode(), versionablePath,
+                JcrConstants.NT_UNSTRUCTURED);
+        versionable.addMixin("mix:versionable");
+        versionable.setProperty("version", "root");
+        session.save();
+
+        final String path = versionable.getPath();
+        final List<String> versionNames = new ArrayList<String>();
+        for (int i = 0; i < 3; i++) {
+            versionable.setProperty("version", "1." + i);
+            session.save();
+            final Version v = versionManager.checkpoint(path);
+            versionNames.add(v.getName());
+        }
+
+        final VersionHistory history = versionManager.getVersionHistory(path);
+        for (final String versionName : versionNames) {
+            history.addVersionLabel(versionName, String.format("version %s", versionName), false);
+        }
+        return history.getPath();
+    }
+
+    public static boolean isVersionable(Session session, String path) throws RepositoryException {
+        return session.getNode(path).isNodeType(JcrConstants.MIX_VERSIONABLE);
+    }
+
+    public interface RepositoryUpgradeSetup {
+        void setup(RepositoryUpgrade upgrade);
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/util/VersionCopyTestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native