jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1407119 [9/9] - in /jackrabbit/oak/trunk: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/ oak-mk-perf/ oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/tasks/ oak-...
Date Thu, 08 Nov 2012 15:18:02 GMT
Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java?rev=1407119&r1=1407118&r2=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
Thu Nov  8 15:17:50 2012
@@ -25,10 +25,6 @@ import org.apache.jackrabbit.mongomk.imp
 import org.junit.Assert;
 import org.junit.Test;
 
-/**
- * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
- */
-@SuppressWarnings("javadoc")
 public class JsopParserTest {
 
     private static class CountingHandler extends DefaultJsopHandler {
@@ -204,7 +200,6 @@ public class JsopParserTest {
         private final List<NodeMoved> nodesCopied;
         private final List<NodeMoved> nodesMoved;
         private final List<Node> nodesRemoved;
-        private final List<Property> propertiesAdded;
         private final List<Property> propertiesSet;
 
         CountingHandler() {
@@ -212,7 +207,6 @@ public class JsopParserTest {
             this.nodesCopied = new LinkedList<NodeMoved>();
             this.nodesMoved = new LinkedList<NodeMoved>();
             this.nodesRemoved = new LinkedList<Node>();
-            this.propertiesAdded = new LinkedList<Property>();
             this.propertiesSet = new LinkedList<Property>();
         }
 
@@ -262,10 +256,6 @@ public class JsopParserTest {
             Assert.assertEquals(num, this.propertiesSet.size());
         }
 
-        public void assertPropertiesAdded(int num) {
-            Assert.assertEquals(num, this.propertiesAdded.size());
-        }
-
         @Override
         public void nodeAdded(String path, String name) {
             this.nodesAdded.add(new Node(path, name));
@@ -287,11 +277,6 @@ public class JsopParserTest {
         }
 
         @Override
-        public void propertyAdded(String path, String key, Object value) {
-            this.propertiesAdded.add(new Property(path, key, value));
-        }
-
-        @Override
         public void propertySet(String path, String key, Object value) {
             this.propertiesSet.add(new Property(path, key, value));
         }
@@ -306,16 +291,6 @@ public class JsopParserTest {
             Assert.assertEquals(firstIndex, lastIndex);
         }
 
-        void assertPropertyAdded(String path, String key, Object value) {
-            Property expected = new Property(path, key, value);
-
-            int firstIndex = this.propertiesAdded.indexOf(expected);
-            int lastIndex = this.propertiesAdded.lastIndexOf(expected);
-
-            Assert.assertTrue(firstIndex != -1);
-            Assert.assertEquals(firstIndex, lastIndex);
-        }
-
         void assertPropertySet(String path, String key, Object value) {
             Property expected = new Property(path, key, value);
 
@@ -349,10 +324,10 @@ public class JsopParserTest {
         countingHandler.assertNodeAdded("/a/b", "d");
         countingHandler.assertNodeAdded("/a", "c");
 
-        countingHandler.assertPropertiesAdded(3);
-        countingHandler.assertPropertyAdded("/a", "integer", 123);
-        countingHandler.assertPropertyAdded("/a/b", "double", 123.456);
-        countingHandler.assertPropertyAdded("/a/c", "string", "string");
+        countingHandler.assertNoOfPropertiesSet(3);
+        countingHandler.assertPropertySet("/a", "integer", 123);
+        countingHandler.assertPropertySet("/a/b", "double", 123.456);
+        countingHandler.assertPropertySet("/a/c", "string", "string");
     }
 
     @Test
@@ -373,10 +348,10 @@ public class JsopParserTest {
         countingHandler.assertNodeAdded("/a", "b");
         countingHandler.assertNodeAdded("/a", "c");
 
-        countingHandler.assertPropertiesAdded(3);
-        countingHandler.assertPropertyAdded("/a", "int", Integer.valueOf(1));
-        countingHandler.assertPropertyAdded("/a/b", "string", "foo");
-        countingHandler.assertPropertyAdded("/a/c", "bool", Boolean.TRUE);
+        countingHandler.assertNoOfPropertiesSet(3);
+        countingHandler.assertPropertySet("/a", "int", Integer.valueOf(1));
+        countingHandler.assertPropertySet("/a/b", "string", "foo");
+        countingHandler.assertPropertySet("/a/c", "bool", Boolean.TRUE);
     }
 
     @Test
@@ -397,10 +372,10 @@ public class JsopParserTest {
 
         countingHandler.assetNoOfNodesAdded(6);
 
-        countingHandler.assertPropertiesAdded(3);
-        countingHandler.assertPropertyAdded("/a", "int", Integer.valueOf(1));
-        countingHandler.assertPropertyAdded("/a/b", "string", "foo");
-        countingHandler.assertPropertyAdded("/a/c", "bool", Boolean.TRUE);
+        countingHandler.assertNoOfPropertiesSet(3);
+        countingHandler.assertPropertySet("/a", "int", Integer.valueOf(1));
+        countingHandler.assertPropertySet("/a/b", "string", "foo");
+        countingHandler.assertPropertySet("/a/c", "bool", Boolean.TRUE);
     }
 
     @Test
@@ -413,8 +388,8 @@ public class JsopParserTest {
 
         jsopParser.parse();
 
-        countingHandler.assertPropertiesAdded(1);
-        countingHandler.assertPropertyAdded(
+        countingHandler.assertNoOfPropertiesSet(1);
+        countingHandler.assertPropertySet(
                 "/a",
                 "array_complex",
                 Arrays.asList(new Object[] { 123, 123.456, true, false, null, "string",
@@ -435,8 +410,8 @@ public class JsopParserTest {
         countingHandler.assetNoOfNodesAdded(1);
         countingHandler.assertNodeAdded("", "/");
 
-        countingHandler.assertPropertiesAdded(1);
-        countingHandler.assertPropertyAdded("/", "int", Integer.valueOf(1));
+        countingHandler.assertNoOfPropertiesSet(1);
+        countingHandler.assertPropertySet("/", "int", Integer.valueOf(1));
     }
 
     @Test
@@ -470,14 +445,14 @@ public class JsopParserTest {
 
         jsopParser.parse();
 
-        countingHandler.assertPropertiesAdded(7);
-        countingHandler.assertPropertyAdded("/a", "integer", 123);
-        countingHandler.assertPropertyAdded("/a", "double", 123.456);
-        countingHandler.assertPropertyAdded("/a", "true", true);
-        countingHandler.assertPropertyAdded("/a", "false", false);
-        countingHandler.assertPropertyAdded("/a", "null", null);
-        countingHandler.assertPropertyAdded("/a", "string", "string");
-        countingHandler.assertPropertyAdded("/a", "array", Arrays.asList(new Object[] { 1,
2, 3, 4, 5 }));
+        countingHandler.assertNoOfPropertiesSet(7);
+        countingHandler.assertPropertySet("/a", "integer", 123);
+        countingHandler.assertPropertySet("/a", "double", 123.456);
+        countingHandler.assertPropertySet("/a", "true", true);
+        countingHandler.assertPropertySet("/a", "false", false);
+        countingHandler.assertPropertySet("/a", "null", null);
+        countingHandler.assertPropertySet("/a", "string", "string");
+        countingHandler.assertPropertySet("/a", "array", Arrays.asList(new Object[] { 1,
2, 3, 4, 5 }));
     }
 
     @Test
@@ -537,7 +512,6 @@ public class JsopParserTest {
         jsopParser.parse();
 
         countingHandler.assertNoOfPropertiesSet(1);
-        // TODO - Is this correct?
         countingHandler.assertPropertySet("/", "a", "b");
     }
 }

Copied: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java
(from r1407101, jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilderImplTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilderImplTest.java&r1=1407101&r2=1407119&rev=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilderImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java
Thu Nov  8 15:17:50 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk.impl.builder;
+package org.apache.jackrabbit.mongomk.impl.model;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -24,24 +24,18 @@ import java.util.List;
 
 import junit.framework.Assert;
 
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction;
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction.AddNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction.CopyNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction.MoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction.RemoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.instruction.Instruction.SetPropertyInstruction;
 import org.apache.jackrabbit.mongomk.api.model.Commit;
-import org.apache.jackrabbit.mongomk.api.model.Instruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.AddNodeInstruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.AddPropertyInstruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.CopyNodeInstruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.MoveNodeInstruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.RemoveNodeInstruction;
-import org.apache.jackrabbit.mongomk.api.model.Instruction.SetPropertyInstruction;
 import org.apache.jackrabbit.mongomk.impl.InstructionAssert;
-import org.apache.jackrabbit.mongomk.impl.builder.CommitBuilder;
+import org.apache.jackrabbit.mongomk.impl.model.CommitBuilder;
 import org.junit.Test;
 
-
-/**
- * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
- */
-@SuppressWarnings("javadoc")
-public class CommitBuilderImplTest {
+public class CommitBuilderTest {
 
     private static final String MESSAGE = "This is a simple commit";
     private static final String ROOT = "/";
@@ -53,17 +47,17 @@ public class CommitBuilderImplTest {
         sb.append("+\"a/b\" : { \"string\" : \"foo\" } \n");
         sb.append("+\"a/c\" : { \"bool\" : true }");
 
-        Commit commit = this.buildAndAssertCommit(sb.toString());
+        Commit commit = buildAndAssertCommit(sb.toString());
 
         List<Instruction> instructions = commit.getInstructions();
         Assert.assertEquals(6, instructions.size());
         InstructionAssert.assertAddNodeInstruction((AddNodeInstruction) instructions.get(0),
"/a");
-        InstructionAssert.assertAddPropertyInstruction((AddPropertyInstruction) instructions.get(1),
"/a", "int", 1);
+        InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction) instructions.get(1),
"/a", "int", 1);
         InstructionAssert.assertAddNodeInstruction((AddNodeInstruction) instructions.get(2),
"/a/b");
-        InstructionAssert.assertAddPropertyInstruction((AddPropertyInstruction) instructions.get(3),
"/a/b", "string",
+        InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction) instructions.get(3),
"/a/b", "string",
                 "foo");
         InstructionAssert.assertAddNodeInstruction((AddNodeInstruction) instructions.get(4),
"/a/c");
-        InstructionAssert.assertAddPropertyInstruction((AddPropertyInstruction) instructions.get(5),
"/a/c", "bool",
+        InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction) instructions.get(5),
"/a/c", "bool",
                 true);
     }
 
@@ -73,7 +67,7 @@ public class CommitBuilderImplTest {
         sb.append("*\"a\" : \"b\"\n");
         sb.append("*\"a/b\" : \"a/c\"\n");
 
-        Commit commit = this.buildAndAssertCommit(sb.toString());
+        Commit commit = buildAndAssertCommit(sb.toString());
         List<Instruction> instructions = commit.getInstructions();
         assertEquals(2, instructions.size());
         InstructionAssert.assertCopyNodeInstruction((CopyNodeInstruction) instructions.get(0),
"/", "/a", "/b");
@@ -86,7 +80,7 @@ public class CommitBuilderImplTest {
         sb.append(">\"a\" : \"b\"\n");
         sb.append(">\"a/b\" : \"a/c\"\n");
 
-        Commit commit = this.buildAndAssertCommit(sb.toString());
+        Commit commit = buildAndAssertCommit(sb.toString());
         List<Instruction> instructions = commit.getInstructions();
         assertEquals(2, instructions.size());
         InstructionAssert.assertMoveNodeInstruction((MoveNodeInstruction) instructions.get(0),
"/", "/a", "/b");
@@ -97,13 +91,15 @@ public class CommitBuilderImplTest {
     public void testSimpleRemove() throws Exception {
         StringBuilder sb = new StringBuilder();
         sb.append("-\"a\"");
-        // TODO properties
-
-        Commit commit = this.buildAndAssertCommit(sb.toString());
+        sb.append("^\"a/prop\" : null");
 
+        Commit commit = buildAndAssertCommit(sb.toString());
         List<Instruction> instructions = commit.getInstructions();
-        assertEquals(1, instructions.size());
-        InstructionAssert.assertRemoveNodeInstruction((RemoveNodeInstruction) instructions.get(0),
"/a");
+        assertEquals(2, instructions.size());
+        InstructionAssert.assertRemoveNodeInstruction((RemoveNodeInstruction) instructions.get(0),
+                "/a");
+        InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction)instructions.get(1),
+                "/a", "prop", null);
     }
 
     @Test
@@ -111,8 +107,7 @@ public class CommitBuilderImplTest {
         StringBuilder sb = new StringBuilder();
         sb.append("^\"a\" : \"b\"\n");
 
-        Commit commit = this.buildAndAssertCommit(sb.toString());
-
+        Commit commit = buildAndAssertCommit(sb.toString());
         List<Instruction> instructions = commit.getInstructions();
         assertEquals(1, instructions.size());
         InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction) instructions.get(0),
"/", "a", "b");
@@ -120,7 +115,6 @@ public class CommitBuilderImplTest {
 
     private Commit buildAndAssertCommit(String commitString) throws Exception {
         Commit commit = CommitBuilder.build(ROOT, commitString, MESSAGE);
-
         assertNotNull(commit);
         assertEquals(MESSAGE, commit.getMessage());
         assertNull(commit.getRevisionId());

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/CommitBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Copied: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/util/NodeBuilderTest.java
(from r1407101, jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilderTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/util/NodeBuilderTest.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/util/NodeBuilderTest.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilderTest.java&r1=1407101&r2=1407119&rev=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/util/NodeBuilderTest.java
Thu Nov  8 15:17:50 2012
@@ -14,19 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk.impl.builder;
+package org.apache.jackrabbit.mongomk.util;
 
 import org.apache.jackrabbit.mongomk.api.model.Node;
 import org.apache.jackrabbit.mongomk.impl.NodeAssert;
-import org.apache.jackrabbit.mongomk.impl.builder.NodeBuilder;
 import org.apache.jackrabbit.mongomk.impl.model.NodeImpl;
+import org.apache.jackrabbit.mongomk.util.NodeBuilder;
 import org.junit.Test;
 
-
-/**
- * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
- */
-@SuppressWarnings("javadoc")
 public class NodeBuilderTest {
 
     @Test
@@ -34,10 +29,13 @@ public class NodeBuilderTest {
         String json = "{ \"/\" : { \"a\" : { \"b\" : {} , \"c\" : {} } } }";
         Node node = NodeBuilder.build(json);
 
-        Node node_c = new NodeImpl("/a/c");
-        Node node_b = new NodeImpl("/a/b");
-        Node node_a = new NodeImpl("/a", new Node[] { node_b, node_c });
-        Node node_root = new NodeImpl("/", new Node[] { node_a });
+        NodeImpl node_c = new NodeImpl("/a/c");
+        NodeImpl node_b = new NodeImpl("/a/b");
+        NodeImpl node_a = new NodeImpl("/a");
+        node_a.addChildNodeEntry(node_b);
+        node_a.addChildNodeEntry(node_c);
+        NodeImpl node_root = new NodeImpl("/");
+        node_root.addChildNodeEntry(node_a);
 
         NodeAssert.assertDeepEquals(node, node_root);
     }
@@ -47,13 +45,19 @@ public class NodeBuilderTest {
         String json = "{ \"/#1\" : { \"a#1\" : { \"b#2\" : {} , \"c#2\" : {} } } }";
         Node node = NodeBuilder.build(json);
 
-        Node node_c = new NodeImpl("/a/c");
+        NodeImpl node_c = new NodeImpl("/a/c");
         node_c.setRevisionId(2L);
-        Node node_b = new NodeImpl("/a/b");
+
+        NodeImpl node_b = new NodeImpl("/a/b");
         node_b.setRevisionId(2L);
-        Node node_a = new NodeImpl("/a", new Node[] { node_b, node_c });
+
+        NodeImpl node_a = new NodeImpl("/a");
+        node_a.addChildNodeEntry(node_b);
+        node_a.addChildNodeEntry(node_c);
         node_a.setRevisionId(1L);
-        Node node_root = new NodeImpl("/", new Node[] { node_a });
+
+        NodeImpl node_root = new NodeImpl("/");
+        node_root.addChildNodeEntry(node_a);
         node_root.setRevisionId(1L);
 
         NodeAssert.assertDeepEquals(node, node_root);

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

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/util/NodeBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: jackrabbit/oak/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/pom.xml?rev=1407119&r1=1407118&r2=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/pom.xml (original)
+++ jackrabbit/oak/trunk/pom.xml Thu Nov  8 15:17:50 2012
@@ -48,6 +48,7 @@
     <module>oak-run</module>
     <module>oak-it</module>
     <module>oak-bench</module>
+    <module>oak-mk-perf</module>
   </modules>
 
   <scm>



Mime
View raw message