jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1399706 - in /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak: AbstractOakTest.java OakAssert.java RootTest.java TreeTest.java
Date Thu, 18 Oct 2012 15:47:55 GMT
Author: jukka
Date: Thu Oct 18 15:47:54 2012
New Revision: 1399706

URL: http://svn.apache.org/viewvc?rev=1399706&view=rev
Log:
OAK-169: Support orderable nodes

Move utility method to a separate class.

Added:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/OakAssert.java 
 (with props)
Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java?rev=1399706&r1=1399705&r2=1399706&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
Thu Oct 18 15:47:54 2012
@@ -29,7 +29,6 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.security.OakConfiguration;
@@ -38,10 +37,6 @@ import org.apache.jackrabbit.oak.spi.lif
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.junit.Before;
 
-import com.google.common.collect.Lists;
-
-import static org.junit.Assert.assertEquals;
-
 /**
  * AbstractOakTest is the base class for oak test execution.
  */
@@ -87,12 +82,4 @@ public abstract class AbstractOakTest {
         return new CompositeMicroKernelTracker(hooks);
     }
 
-    protected void checkSequence(Iterable<Tree> trees, String... names) {
-        List<String> expected = Lists.newArrayList(names);
-        List<String> actual = Lists.newArrayList();
-        for (Tree t : trees) {
-            actual.add(t.getName());
-        }
-        assertEquals(expected.toString(), actual.toString());
-    }
 }
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/OakAssert.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/OakAssert.java?rev=1399706&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/OakAssert.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/OakAssert.java Thu
Oct 18 15:47:54 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.jackrabbit.oak.api.Tree;
+
+import com.google.common.collect.Lists;
+
+public class OakAssert {
+
+    public static void assertSequence(Iterable<Tree> trees, String... names) {
+        List<String> expected = Lists.newArrayList(names);
+        List<String> actual = Lists.newArrayList();
+        for (Tree t : trees) {
+            actual.add(t.getName());
+        }
+        assertEquals(expected.toString(), actual.toString());
+    }
+
+}

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java?rev=1399706&r1=1399705&r2=1399706&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java Thu
Oct 18 15:47:54 2012
@@ -18,6 +18,8 @@
  */
 package org.apache.jackrabbit.oak;
 
+import static org.apache.jackrabbit.oak.OakAssert.assertSequence;
+
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
@@ -57,8 +59,7 @@ public class RootTest extends AbstractOa
 
             r.copy("/node3", "/c/node3");
             c = r.getTree("/").getChild("c");
-            checkSequence(c.getChildren(), "node1", "node2", "node3");
-
+            assertSequence(c.getChildren(), "node1", "node2", "node3");
         } finally {
             s.close();
         }
@@ -79,8 +80,7 @@ public class RootTest extends AbstractOa
 
             r.move("/node3", "/c/node3");
             c = r.getTree("/").getChild("c");
-            checkSequence(c.getChildren(), "node1", "node2", "node3");
-
+            assertSequence(c.getChildren(), "node1", "node2", "node3");
         } finally {
             s.close();
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java?rev=1399706&r1=1399705&r2=1399706&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java Thu
Oct 18 15:47:54 2012
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.OakAssert.assertSequence;
 import static org.junit.Assert.assertEquals;
 
 /**
@@ -59,23 +60,23 @@ public class TreeTest extends AbstractOa
             t = r.getTree("/");
             t.getChild("node1").orderBefore("node2");
             t.getChild("node3").orderBefore(null);
-            checkSequence(t.getChildren(), "node1", "node2", "node3");
+            assertSequence(t.getChildren(), "node1", "node2", "node3");
             r.commit();
             // check again after commit
             t = r.getTree("/");
-            checkSequence(t.getChildren(), "node1", "node2", "node3");
+            assertSequence(t.getChildren(), "node1", "node2", "node3");
 
             t.getChild("node3").orderBefore("node2");
-            checkSequence(t.getChildren(), "node1", "node3", "node2");
+            assertSequence(t.getChildren(), "node1", "node3", "node2");
             r.commit();
             t = r.getTree("/");
-            checkSequence(t.getChildren(), "node1", "node3", "node2");
+            assertSequence(t.getChildren(), "node1", "node3", "node2");
 
             t.getChild("node1").orderBefore(null);
-            checkSequence(t.getChildren(), "node3", "node2", "node1");
+            assertSequence(t.getChildren(), "node3", "node2", "node1");
             r.commit();
             t = r.getTree("/");
-            checkSequence(t.getChildren(), "node3", "node2", "node1");
+            assertSequence(t.getChildren(), "node3", "node2", "node1");
 
             // TODO :childOrder property invisible?
             //assertEquals("must not have any properties", 0, t.getPropertyCount());
@@ -114,7 +115,8 @@ public class TreeTest extends AbstractOa
 
                 r1 = s1.getLatestRoot();
                 t1 = r1.getTree("/");
-                checkSequence(t1.getChildren(), "node1", "node2", "node3", "node4");
+                assertSequence(
+                        t1.getChildren(), "node1", "node2", "node3", "node4");
             } finally {
                 s2.close();
             }



Mime
View raw message