jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1133433 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
Date Wed, 08 Jun 2011 15:33:59 GMT
Author: mduerig
Date: Wed Jun  8 15:33:59 2011
New Revision: 1133433

URL: http://svn.apache.org/viewvc?rev=1133433&view=rev
Log:
spi2microkernel prototype (WIP)
cleanup and minor refactor

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1133433&r1=1133432&r2=1133433&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Wed Jun  8 15:33:59 2011
@@ -379,21 +379,19 @@ public class RepositoryServiceImpl exten
         }
 
         public void addProperty(NodeId parentId, Name propertyName, QValue value) throws
RepositoryException {
-            String val = Values.create(value);
-            sb.append('^').append(target(parentId, propertyName)).append(" : ").append(val);
+            addProperty(parentId, propertyName, Values.create(value));
         }
 
         public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws
RepositoryException {
-            String val = Values.create(values);
-            sb.append('^').append(target(parentId, propertyName)).append(" : ").append(val);
+            addProperty(parentId, propertyName, Values.create(values));
         }
 
         public void setValue(PropertyId propertyId, QValue value) throws RepositoryException
{
-            addProperty(propertyId.getParentId(), propertyId.getName(), value);
+            addProperty(propertyId.getParentId(), propertyId.getName(), Values.create(value));
         }
 
         public void setValue(PropertyId propertyId, QValue[] values) throws RepositoryException
{
-            addProperty(propertyId.getParentId(), propertyId.getName(), values);
+            addProperty(propertyId.getParentId(), propertyId.getName(), Values.create(values));
         }
 
         public void remove(ItemId itemId) throws RepositoryException {
@@ -432,6 +430,10 @@ public class RepositoryServiceImpl exten
             String name = Paths.translateQName(itemName);
             return PathUtil.concat(PathUtil.relativize("/", path), name);
         }
+
+        private void addProperty(NodeId parentId, Name propertyName, String val) throws RepositoryException
{
+            sb.append('^').append(target(parentId, propertyName)).append(" : ").append(val);
+        }
     }
 
     private static class ChangeLog extends ConsolidatingChangeLog {

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java?rev=1133433&r1=1133432&r2=1133433&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
Wed Jun  8 15:33:59 2011
@@ -85,7 +85,7 @@ public class MicrokernelTest {
     }
 
     @Test
-    public void testAddMultipleNodes() {
+    public void addMultipleNodes() {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 
@@ -98,12 +98,11 @@ public class MicrokernelTest {
     }
 
     @Test
-    public void testAddItemsIncrementally() {
+    public void addItemsIncrementally() {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 
-        long millis = System.currentTimeMillis();
-        String node = "n_" + millis;
+        String node = "n_" + System.currentTimeMillis();
 
         head = mk.commit("/",
                 '+' + node + " : {} \r" +
@@ -123,7 +122,34 @@ public class MicrokernelTest {
     }
 
     @Test
-    public void testStringProperty() throws ParseException {
+    public void removeNode() {
+        MicroKernel mk = getMicroKernel();
+        String head = mk.getHeadRevision();
+        String node = "removeNode_" + System.currentTimeMillis();
+
+        head = mk.commit("/", '+' + node + " : {\"child\":{}}", head);
+
+        head = mk.commit('/' + node, "-child : ", head);
+        String json = mk.getNodes('/' + node, 2, head);
+        assertEquals("{\":name\":\"" + node + "\",\":childNodeCount\":0}", json);
+    }
+
+    @Ignore  // todo fix in microkernel
+    @Test
+    public void removeProperty() {
+        MicroKernel mk = getMicroKernel();
+        String head = mk.getHeadRevision();
+        String node = "removeProperty_" + System.currentTimeMillis();
+
+        head = mk.commit("/", '+' + node + " : {\"prop\":\"value\"}", head);
+
+        head = mk.commit("/", '^' + node + "/prop : null", head);
+        String json = mk.getNodes('/' + node, 2, head);
+        assertEquals("{\":name\":\"removeProperty_1307540526522\",\":childNodeCount\":0}",
json);
+    }
+
+    @Test
+    public void getStringProperty() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 
@@ -136,7 +162,7 @@ public class MicrokernelTest {
 
     @Ignore  // todo fix in microkernel
     @Test
-    public void testIntProperty() throws ParseException {
+    public void getIntProperty() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 
@@ -149,7 +175,7 @@ public class MicrokernelTest {
 
     @Ignore  // todo fix in microkernel
     @Test
-    public void testFloatProperty() throws ParseException {
+    public void getFloatProperty() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 
@@ -162,7 +188,7 @@ public class MicrokernelTest {
 
     @Ignore  // todo fix in microkernel
     @Test
-    public void testMultiIntProperty() throws ParseException {
+    public void getMultiIntProperty() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String head = mk.getHeadRevision();
 



Mime
View raw message