jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1568910 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java
Date Mon, 17 Feb 2014 09:04:31 GMT
Author: angela
Date: Mon Feb 17 09:04:31 2014
New Revision: 1568910

URL: http://svn.apache.org/r1568910
Log:
OAK-168 : Basic JCR VersionManager support (enable tck tests)

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1568910&r1=1568909&r2=1568910&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Feb 17 09:04:31 2014
@@ -68,9 +68,6 @@
       org.apache.jackrabbit.test.api.lock.SessionScopedLockTest#testImplicitUnlock
       org.apache.jackrabbit.test.api.lock.SessionScopedLockTest#testImplicitUnlock2
 
-      <!-- Lifecycle Mgt : not implemented -->
-      org.apache.jackrabbit.test.api.LifecycleTest
-
       <!-- Observation -->
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeMoved  <!--
Move in 2nd session not reflected in nodes of 1st session -->
       org.apache.jackrabbit.test.api.observation.NodeReorderTest#testNodeReorderAddRemove
         <!-- Uses SNS -->
@@ -82,26 +79,10 @@
       org.apache.jackrabbit.oak.jcr.observation.ObservationRefreshTest <!-- [tripod] currently
too slow...will fix soon -->
 
       <!-- Versioning -->
-      org.apache.jackrabbit.test.api.version.CheckinTest#testCheckinCreatesNewVersion <!--
OAK-1335 -->
-      org.apache.jackrabbit.test.api.version.CheckinTest#testCheckinCreatesNewVersionJcr2
<!-- OAK-1335 -->
-      org.apache.jackrabbit.test.api.version.VersionTest#testUpdate
-      org.apache.jackrabbit.test.api.version.VersionTest#testGetCorrespondingNodePath
-      org.apache.jackrabbit.test.api.version.VersionTest#testGetLock
-      org.apache.jackrabbit.test.api.version.VersionTest#testGetLockJcr2
       org.apache.jackrabbit.test.api.version.VersionTest#testMerge
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testUpdate
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetCorrespondingNodePath
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetLock
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetLockJcr2
       org.apache.jackrabbit.test.api.version.VersionHistoryTest#testMerge
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testInitialNumberOfLinearVersions
<!-- OAK-1335 -->
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testInitialNumberOfVersions
<!-- OAK-1335 -->
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetAllVersions <!--
OAK-1335 -->
-      org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetAllVersionsJcr2 <!--
OAK-1335 -->
       org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreLabel
       org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreLabelJcr2
-      org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName <!-- OAK-1335
-->
-      org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreNameJcr2 <!-- OAK-1335
-->
       org.apache.jackrabbit.test.api.version.WorkspaceRestoreTest
       org.apache.jackrabbit.test.api.version.MergeCancelMergeTest
       org.apache.jackrabbit.test.api.version.MergeCheckedoutSubNodeTest

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java?rev=1568910&r1=1568909&r2=1568910&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java
Mon Feb 17 09:04:31 2014
@@ -16,24 +16,12 @@
  */
 package org.apache.jackrabbit.oak.jcr.session;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterators.transform;
-import static com.google.common.collect.Sets.newLinkedHashSet;
-import static java.util.Arrays.asList;
-import static java.util.Collections.singleton;
-import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.oak.api.Type.NAME;
-import static org.apache.jackrabbit.oak.api.Type.NAMES;
-import static org.apache.jackrabbit.oak.util.TreeUtil.getNames;
-
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Binary;
@@ -81,6 +69,7 @@ import org.apache.jackrabbit.oak.jcr.del
 import org.apache.jackrabbit.oak.jcr.delegate.VersionManagerDelegate;
 import org.apache.jackrabbit.oak.jcr.lock.LockImpl;
 import org.apache.jackrabbit.oak.jcr.lock.LockOperation;
+import org.apache.jackrabbit.oak.jcr.session.operation.ItemOperation;
 import org.apache.jackrabbit.oak.jcr.session.operation.NodeOperation;
 import org.apache.jackrabbit.oak.jcr.version.VersionHistoryImpl;
 import org.apache.jackrabbit.oak.jcr.version.VersionImpl;
@@ -92,6 +81,17 @@ import org.apache.jackrabbit.value.Value
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterators.transform;
+import static com.google.common.collect.Sets.newLinkedHashSet;
+import static java.util.Arrays.asList;
+import static java.util.Collections.singleton;
+import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.oak.api.Type.NAME;
+import static org.apache.jackrabbit.oak.api.Type.NAMES;
+import static org.apache.jackrabbit.oak.util.TreeUtil.getNames;
+
 /**
  * TODO document
  *
@@ -1003,26 +1003,41 @@ public class NodeImpl<T extends NodeDele
 
     @Override
     @Nonnull
-    public String getCorrespondingNodePath(String workspaceName) throws RepositoryException
{
-        // TODO: use perform()
-        checkValidWorkspace(workspaceName);
-        throw new UnsupportedRepositoryOperationException("TODO: Node.getCorrespondingNodePath");
+    public String getCorrespondingNodePath(final String workspaceName) throws RepositoryException
{
+        return toJcrPath(perform(new ItemOperation<String>(dlg) {
+            @Override
+            public String perform() throws RepositoryException {
+                checkValidWorkspace(workspaceName);
+                if (workspaceName.equals(sessionDelegate.getWorkspaceName())) {
+                    return item.getPath();
+                } else {
+                    throw new UnsupportedRepositoryOperationException("OAK-118: Node.getCorrespondingNodePath");
+                }
+            }
+        }));
     }
 
 
     @Override
-    public void update(String srcWorkspace) throws RepositoryException {
-        // TODO: use perform()
-        checkValidWorkspace(srcWorkspace);
+    public void update(final String srcWorkspace) throws RepositoryException {
+        perform(new ItemWriteOperation<Void>() {
+            @Override
+            public Void perform() throws RepositoryException {
+                checkValidWorkspace(srcWorkspace);
 
-        // check for pending changes
-        if (sessionDelegate.hasPendingChanges()) {
-            String msg = "Unable to perform operation. Session has pending changes.";
-            log.debug(msg);
-            throw new InvalidItemStateException(msg);
-        }
+                // check for pending changes
+                if (sessionDelegate.hasPendingChanges()) {
+                    String msg = "Unable to perform operation. Session has pending changes.";
+                    log.debug(msg);
+                    throw new InvalidItemStateException(msg);
+                }
 
-        // TODO
+                if (!srcWorkspace.equals(sessionDelegate.getWorkspaceName())) {
+                    throw new UnsupportedRepositoryOperationException("OAK-118: Node.update");
+                }
+                return null;
+            }
+        });
     }
 
     /**



Mime
View raw message