jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1324767 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jackrabb...
Date Wed, 11 Apr 2012 14:05:23 GMT
Author: mduerig
Date: Wed Apr 11 14:05:22 2012
New Revision: 1324767

URL: http://svn.apache.org/viewvc?rev=1324767&view=rev
Log:
OAK-15: Clean up oak-jcr
fix refresh and re-enable refresh tests

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java?rev=1324767&r1=1324766&r2=1324767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
Wed Apr 11 14:05:22 2012
@@ -27,4 +27,18 @@ package org.apache.jackrabbit.oak.api;
  *       - CommitFailedException transports status code that are then converted to jcr exceptions
  */
 public class CommitFailedException extends Exception {
+    public CommitFailedException() {
+    }
+
+    public CommitFailedException(String message) {
+        super(message);
+    }
+
+    public CommitFailedException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public CommitFailedException(Throwable cause) {
+        super(cause);
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java?rev=1324767&r1=1324766&r2=1324767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
Wed Apr 11 14:05:22 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.MicroKernelFactory;
 import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Connection;
@@ -111,7 +112,12 @@ public class ConnectionImpl implements C
 
     @Override
     public NodeState commit(NodeStateEditor editor) throws CommitFailedException {
-        return store.merge(editor, editor.getBaseNodeState());
+        try {
+            return store.merge(editor, editor.getBaseNodeState());
+        }
+        catch (MicroKernelException e) {
+            throw new CommitFailedException(e);
+        }
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1324767&r1=1324766&r2=1324767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed Apr 11 14:05:22 2012
@@ -170,8 +170,10 @@ public class SessionImpl extends Abstrac
         try {
             // todo: need a better way to update a connection to head
             NodeState newState = connection.commit(connection.getNodeStateEditor(connection.getCurrentRoot()));
-            editor = connection.getNodeStateEditor(newState);
-            itemStateProvider = new ItemStateProvider(editor.getTransientState());
+            if (!keepChanges) {
+                editor = connection.getNodeStateEditor(newState);
+                itemStateProvider = new ItemStateProvider(editor.getTransientState());
+            }
         } catch (CommitFailedException e) {
             throw new RepositoryException(e);
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1324767&r1=1324766&r2=1324767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Wed Apr 11 14:05:22 2012
@@ -69,7 +69,6 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 public class RepositoryTest extends AbstractRepositoryTest {
     private static final String TEST_NODE = "test_node";
@@ -1062,7 +1061,6 @@ public class RepositoryTest extends Abst
         }
     }
 
-    @Ignore("WIP")  // fixme
     @Test
     public void sessionRefresh() throws RepositoryException {
         Session session = getRepository().login();
@@ -1123,8 +1121,7 @@ public class RepositoryTest extends Abst
         }
     }
 
-    @Ignore("WIP")  // fixme
-    @Test
+    @Test(expected = RepositoryException.class)
     public void refreshConflict() throws RepositoryException {
         Session session1 = getRepository().login();
         Session session2 = getRepository().login();
@@ -1134,13 +1131,7 @@ public class RepositoryTest extends Abst
 
             session1.save();
             session2.refresh(true);
-            try {
-                session2.save();
-                fail();
-            }
-            catch (RepositoryException e) {
-                // expected
-            }
+            session2.save();
         }
         finally {
             session1.logout();
@@ -1148,8 +1139,7 @@ public class RepositoryTest extends Abst
         }
     }
 
-    @Ignore("WIP")  // fixme
-    @Test
+    @Test(expected = RepositoryException.class)
     public void refreshConflict2() throws RepositoryException {
         getSession().getRootNode().addNode("node");
         getSession().save();
@@ -1161,13 +1151,7 @@ public class RepositoryTest extends Abst
             session2.getNode("/node").addNode("2");
 
             session1.save();
-            try {
-                session2.save();
-                fail();
-            }
-            catch (RepositoryException e) {
-                // expected
-            }
+            session2.save();
         }
         finally {
             session1.logout();



Mime
View raw message