jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792142 [28/35] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 08 Jul 2009 13:57:46 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java Wed Jul  8 13:57:13 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 
@@ -113,9 +114,12 @@
      * the given node.
      *
      * @param nodeState reference target
+     * @param propertyName
+     * @param weak Boolean flag indicating whether weak references should be
+     * returned or not.
      * @return reference property identifiers
      */
-    public PropertyId[] getNodeReferences(NodeState nodeState);
+    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak);
 
     /**
      * Adds the given <code>ItemStateCreationListener</code>.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java Wed Jul  8 13:57:13 2009
@@ -28,6 +28,7 @@
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -383,7 +384,8 @@
             // make sure there's an applicable definition for new child node
             Name[] ntNames = parentState.getAllNodeTypeNames();
             EffectiveNodeType entParent = mgrProvider.getEffectiveNodeTypeProvider().getEffectiveNodeType(ntNames);
-            entParent.checkAddNodeConstraints(nodeName, nodeTypeName, mgrProvider.getItemDefinitionProvider());
+            QNodeTypeDefinition def = mgrProvider.getNodeTypeDefinitionProvider().getNodeTypeDefinition(nodeTypeName);
+            entParent.checkAddNodeConstraints(nodeName, def, mgrProvider.getItemDefinitionProvider());
         }
         // collisions
         if ((options & CHECK_COLLISION) == CHECK_COLLISION) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java Wed Jul  8 13:57:13 2009
@@ -18,6 +18,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Iterator;
 
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
@@ -47,7 +48,7 @@
     /**
      * the name of this node's primary type
      */
-    private final Name nodeTypeName;
+    private Name nodeTypeName;
 
     /**
      * Definition of this node state
@@ -132,6 +133,11 @@
             synchronized (another) {
                 NodeState nState = (NodeState) another;
 
+                if (!nodeTypeName.equals(nState.nodeTypeName)) {
+                    nodeTypeName = nState.nodeTypeName;
+                    modified = true;
+                }
+
                 if (nState.definition != null && !nState.definition.equals(definition)) {
                     definition = nState.definition;
                     modified = true;
@@ -311,10 +317,14 @@
      * Returns the identifiers of all reference properties that point to
      * this node.
      *
+     * @param propertyName name filter of referring properties to be returned;
+     * if <code>null</code> then all references are returned.
+     * @param weak Boolean flag indicating whether weak references should be
+     * returned or not.
      * @return reference property identifiers
      */
-    public PropertyId[] getNodeReferences() {
-        return isf.getNodeReferences(this);
+    public Iterator<PropertyId> getNodeReferences(Name propertyName, boolean weak) {
+        return isf.getNodeReferences(this, propertyName, weak);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java Wed Jul  8 13:57:13 2009
@@ -27,7 +27,7 @@
 import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.commons.nodetype.ValueConstraint;
+import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Wed Jul  8 13:57:13 2009
@@ -16,72 +16,56 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
-import org.apache.jackrabbit.jcr2spi.util.ReferenceChangeTracker;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
+import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
+import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
-import org.apache.jackrabbit.jcr2spi.operation.Operation;
-import org.apache.jackrabbit.jcr2spi.operation.OperationVisitor;
 import org.apache.jackrabbit.jcr2spi.operation.AddNode;
 import org.apache.jackrabbit.jcr2spi.operation.AddProperty;
-import org.apache.jackrabbit.jcr2spi.operation.Clone;
-import org.apache.jackrabbit.jcr2spi.operation.Copy;
 import org.apache.jackrabbit.jcr2spi.operation.Move;
+import org.apache.jackrabbit.jcr2spi.operation.Operation;
+import org.apache.jackrabbit.jcr2spi.operation.OperationVisitor;
 import org.apache.jackrabbit.jcr2spi.operation.Remove;
+import org.apache.jackrabbit.jcr2spi.operation.ReorderNodes;
 import org.apache.jackrabbit.jcr2spi.operation.SetMixin;
+import org.apache.jackrabbit.jcr2spi.operation.SetPrimaryType;
 import org.apache.jackrabbit.jcr2spi.operation.SetPropertyValue;
-import org.apache.jackrabbit.jcr2spi.operation.ReorderNodes;
-import org.apache.jackrabbit.jcr2spi.operation.Checkout;
-import org.apache.jackrabbit.jcr2spi.operation.Checkin;
-import org.apache.jackrabbit.jcr2spi.operation.Update;
-import org.apache.jackrabbit.jcr2spi.operation.Restore;
-import org.apache.jackrabbit.jcr2spi.operation.ResolveMergeConflict;
-import org.apache.jackrabbit.jcr2spi.operation.Merge;
-import org.apache.jackrabbit.jcr2spi.operation.LockOperation;
-import org.apache.jackrabbit.jcr2spi.operation.LockRefresh;
-import org.apache.jackrabbit.jcr2spi.operation.LockRelease;
-import org.apache.jackrabbit.jcr2spi.operation.AddLabel;
-import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
-import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
-import org.apache.jackrabbit.jcr2spi.operation.WorkspaceImport;
-import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.jcr2spi.ManagerProvider;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
+import org.apache.jackrabbit.jcr2spi.operation.TransientOperationVisitor;
+import org.apache.jackrabbit.jcr2spi.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.PropertyType;
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
-import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemExistsException;
+import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ValueFormatException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Session;
-import javax.jcr.MergeException;
-import javax.jcr.version.VersionException;
+import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.lock.LockException;
+import javax.jcr.version.VersionException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ArrayList;
-import java.io.InputStream;
 
 /**
  * <code>SessionItemStateManager</code> ...
  */
-public class SessionItemStateManager implements UpdatableItemStateManager, OperationVisitor {
+public class SessionItemStateManager extends TransientOperationVisitor implements UpdatableItemStateManager {
 
     private static Logger log = LoggerFactory.getLogger(SessionItemStateManager.class);
 
@@ -383,6 +367,37 @@
     }
 
     /**
+     * @see OperationVisitor#visit(SetPrimaryType)
+     */
+    public void visit(SetPrimaryType operation) throws ConstraintViolationException, RepositoryException {
+        // NOTE: nodestate is only modified upon save of the changes!
+        Name primaryName = operation.getPrimaryTypeName();
+        NodeState nState = operation.getNodeState();
+        NodeEntry nEntry = nState.getNodeEntry();
+
+        // detect obvious node type conflicts
+
+        EffectiveNodeTypeProvider entProvider = mgrProvider.getEffectiveNodeTypeProvider();
+
+        // try to build new effective node type (will throw in case of conflicts)
+        Name[] mixins = nState.getMixinTypeNames();
+        List<Name> all = new ArrayList<Name>(Arrays.asList(mixins));
+        all.add(primaryName);
+        EffectiveNodeType entAll = entProvider.getEffectiveNodeType(all.toArray(new Name[all.size()]));
+
+        // modify the value of the jcr:primaryType property entry without
+        // changing the node state itself
+        PropertyEntry pEntry = nEntry.getPropertyEntry(NameConstants.JCR_PRIMARYTYPE);
+        PropertyState pState = pEntry.getPropertyState();
+        int options = ItemStateValidator.CHECK_VERSIONING | ItemStateValidator.CHECK_LOCK;
+        setPropertyStateValue(pState, getQValues(new Name[] {primaryName}, qValueFactory), PropertyType.NAME, options);
+
+        // mark the affected node state modified and remember the operation
+        nState.markModified();
+        transientStateMgr.addOperation(operation);
+    }
+
+    /**
      * @inheritDoc
      * @see OperationVisitor#visit(SetPropertyValue)
      */
@@ -407,134 +422,6 @@
         transientStateMgr.addOperation(operation);
     }
 
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Clone)
-     */
-    public void visit(Clone operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Clone cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Copy)
-     */
-    public void visit(Copy operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Copy cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Checkout)
-     */
-    public void visit(Checkout operation) throws RepositoryException, UnsupportedRepositoryOperationException {
-        throw new UnsupportedOperationException("Internal error: Checkout cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Checkin)
-     */
-    public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Checkin cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Checkpoint)
-     */
-    public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Checkin cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Update)
-     */
-    public void visit(Update operation) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Update cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Restore)
-     */
-    public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Restore cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Merge)
-     */
-    public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Merge cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(ResolveMergeConflict)
-     */
-    public void visit(ResolveMergeConflict operation) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Update cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockOperation)
-     */
-    public void visit(LockOperation operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Lock cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockRefresh)
-     */
-    public void visit(LockRefresh operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: LockRefresh cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockRelease)
-     */
-    public void visit(LockRelease operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: LockRelease cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(AddLabel)
-     */
-    public void visit(AddLabel operation) throws VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: AddLabel cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(RemoveLabel)
-     */
-    public void visit(RemoveLabel operation) throws VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: RemoveLabel cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(RemoveVersion)
-     */
-    public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: RemoveVersion cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(WorkspaceImport)
-     */
-    public void visit(WorkspaceImport operation) throws RepositoryException {
-        throw new UnsupportedOperationException("Internal error: WorkspaceImport cannot be handled by session ItemStateManager.");
-    }
-
     //--------------------------------------------< Internal State Handling >---
     /**
      *
@@ -583,7 +470,7 @@
             // try default primary type from definition
             nodeTypeName = definition.getDefaultPrimaryType();
             if (nodeTypeName == null) {
-                String msg = "an applicable node type could not be determined for " + nodeName;
+                String msg = "No applicable node type could be determined for " + nodeName;
                 log.debug(msg);
                 throw new ConstraintViolationException(msg);
             }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java Wed Jul  8 13:57:13 2009
@@ -32,6 +32,7 @@
 import javax.jcr.ItemNotFoundException;
 
 import java.util.Iterator;
+import java.util.Collections;
 
 /**
  * <code>TransientISFactory</code>...
@@ -139,13 +140,13 @@
 
     /**
      * @inheritDoc
-     * @see ItemStateFactory#getNodeReferences(NodeState)
+     * @see ItemStateFactory#getNodeReferences(NodeState,org.apache.jackrabbit.spi.Name,boolean)
      */
-    public PropertyId[] getNodeReferences(NodeState nodeState) {
+    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak) {
         if (nodeState.getStatus() == Status.NEW) {
-            return new PropertyId[0];
+            return Collections.EMPTY_SET.iterator();
         }
-        return workspaceStateFactory.getNodeReferences(nodeState);
+        return workspaceStateFactory.getNodeReferences(nodeState, propertyName, weak);
     }
 
     //------------------------------------------< ItemStateCreationListener >---

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java Wed Jul  8 13:57:13 2009
@@ -223,7 +223,7 @@
      *                     <code>null</code> if the created <code>NodeState</code>
      *                     cannot be identified by a unique ID.
      * @param nodeTypeName name of the node type of the new node state.
-     * @param definition   The qualified definition for the new node state.
+     * @param definition   The definition for the new node state.
      * @param parent       the parent of the new node state.
      * @return a new transient {@link NodeState}.
      */

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Wed Jul  8 13:57:13 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.Collections;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -158,26 +159,24 @@
 
     /**
      * @inheritDoc
-     * @see ItemStateFactory#getNodeReferences(NodeState)
-     * @param nodeState
+     * @see ItemStateFactory#getNodeReferences(NodeState,org.apache.jackrabbit.spi.Name,boolean)
      */
-    public PropertyId[] getNodeReferences(NodeState nodeState) {
+    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak) {
         NodeEntry entry = nodeState.getNodeEntry();
         // shortcut
         if (entry.getUniqueID() == null
                 || !entry.hasPropertyEntry(NameConstants.JCR_UUID)) {
             // for sure not referenceable
-            return new PropertyId[0];
+            return Collections.EMPTY_SET.iterator();
         }
 
         // nodestate has a unique ID and is potentially mix:referenceable
         // => try to retrieve references
         try {
-            NodeInfo nInfo = service.getNodeInfo(sessionInfo, entry.getWorkspaceId());
-            return nInfo.getReferences();
+            return service.getReferences(sessionInfo, entry.getWorkspaceId(), propertyName, weak);
         } catch (RepositoryException e) {
             log.debug("Unable to determine references to {}", nodeState);
-            return new PropertyId[0];
+            return Collections.EMPTY_SET.iterator();
         }
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java Wed Jul  8 13:57:13 2009
@@ -58,6 +58,13 @@
         }
     }
 
+    public static Name getPrimaryTypeName(PropertyState ps) throws RepositoryException {
+        if (!NameConstants.JCR_PRIMARYTYPE.equals(ps.getName())) {
+            throw new IllegalArgumentException();
+        }
+        QValue[] values = ps.getValues();
+        return values[0].getName();
+    }
 
     public static boolean isUuidOrMixin(Name propName) {
         return NameConstants.JCR_UUID.equals(propName) || NameConstants.JCR_MIXINTYPES.equals(propName);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java Wed Jul  8 13:57:13 2009
@@ -199,6 +199,42 @@
 
     /**
      *
+     * @param nodeState
+     * @param baselineState
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public NodeEntry createConfiguration(NodeState nodeState, NodeState baselineState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
+     * @param title
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
+     * @param activityState
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * 
+     * @param activityState
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public Iterator mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
      * @param versionState
      * @return
      */

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java Wed Jul  8 13:57:13 2009
@@ -29,6 +29,9 @@
 import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
 import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
+import org.apache.jackrabbit.jcr2spi.operation.CreateActivity;
+import org.apache.jackrabbit.jcr2spi.operation.CreateConfiguration;
+import org.apache.jackrabbit.jcr2spi.operation.RemoveActivity;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.slf4j.LoggerFactory;
@@ -40,6 +43,7 @@
 import javax.jcr.AccessDeniedException;
 import javax.jcr.MergeException;
 import javax.jcr.InvalidItemStateException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.lock.LockException;
 import javax.jcr.version.VersionException;
 
@@ -197,6 +201,29 @@
         workspaceManager.execute(op);
     }
 
+    public NodeEntry createConfiguration(NodeState nodeState, NodeState baselineState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        CreateConfiguration op = CreateConfiguration.create(nodeState, baselineState, this);
+        workspaceManager.execute(op);
+        return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewConfigurationId());
+    }
+
+    public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        CreateActivity op = CreateActivity.create(title, this);
+        workspaceManager.execute(op);
+        return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewActivityId());
+    }
+
+    public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Operation op = RemoveActivity.create(activityState, workspaceManager.getHierarchyManager());
+        workspaceManager.execute(op);
+    }
+
+    public Iterator mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Merge op = Merge.create(activityState, null, false, false, this);
+        workspaceManager.execute(op);
+        return op.getFailedIds();
+    }
+
     public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
         NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
         PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Wed Jul  8 13:57:13 2009
@@ -100,8 +100,8 @@
     /**
      * Creates a new <code>WorkspaceImporter</code> instance.
      *
-     * @param parentPath qualified path of target node where to add the imported
-     * subtree
+     * @param parentPath Path of target node where to add the imported
+     * subtree.
      * @param session
      * @param uuidBehavior Flag that governs how incoming UUIDs are handled.
      * @throws PathNotFoundException If no node exists at <code>parentPath</code>
@@ -215,7 +215,7 @@
                    // assert that the entry is available
                    conflicting.getItemState();
 
-                   nodeState = resolveUUIDConflict(parent, (NodeEntry) conflicting, nodeInfo);
+                   nodeState = resolveUUIDConflict(parent, conflicting, nodeInfo);
                } catch (ItemNotFoundException e) {
                    // no conflict: create new with given uuid
                    nodeState = importNode(nodeInfo, parent);
@@ -338,7 +338,7 @@
 
             case ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING:
                 // make sure conflicting node is not importTarget or an ancestor thereof
-                Path p0 = importTarget.getQPath();
+                Path p0 = importTarget.getPath();
                 Path p1 = conflicting.getPath();
                 if (p1.equals(p0) || p1.isAncestorOf(p0)) {
                     msg = "cannot remove ancestor node";

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ExternalModificationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ExternalModificationTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ExternalModificationTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ExternalModificationTest.java Wed Jul  8 13:57:13 2009
@@ -47,7 +47,7 @@
         refNode.addMixin(mixReferenceable);
         testRootNode.save();
 
-        testSession = helper.getReadWriteSession();
+        testSession = getHelper().getReadWriteSession();
     }
 
     protected void tearDown() throws Exception {
@@ -204,7 +204,7 @@
 
     public void testExternalRemoval() throws RepositoryException, NotExecutableException {
         String uuid = refNode.getUUID();
-        Node refNode2 = (Node) testSession.getNodeByUUID(uuid);
+        Node refNode2 = testSession.getNodeByUUID(uuid);
 
         String srcPath = refNode.getPath();
         String destPath = destParentNode.getPath() + "/" + nodeName2;
@@ -230,7 +230,7 @@
         refNode.save();
 
         String uuid = refNode.getUUID();
-        Node refNode2 = (Node) testSession.getNodeByUUID(uuid);
+        Node refNode2 = testSession.getNodeByUUID(uuid);
         Node c2 =  (Node) testSession.getItem(childN.getPath());
         Property p2 = (Property) testSession.getItem(p.getPath());
         // transiently remove the property -> test effect of external removal.
@@ -258,7 +258,7 @@
         refNode.save();
 
         String uuid = refNode.getUUID();
-        Node refNode2 = (Node) testSession.getNodeByUUID(uuid);
+        Node refNode2 = testSession.getNodeByUUID(uuid);
         Node c2 =  (Node) testSession.getItem(childN.getPath());
         Property p2 = (Property) testSession.getItem(p.getPath());
         // transiently modify  -> test effect of external removal.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java Wed Jul  8 13:57:13 2009
@@ -56,7 +56,7 @@
 
         testRootNode.save();
 
-        readOnly = helper.getReadOnlySession();
+        readOnly = getHelper().getReadOnlySession();
     }
 
     protected void tearDown() throws Exception {
@@ -190,7 +190,7 @@
         Property p3 = sib3.setProperty(propertyName1, "sib3-prop");
         testRootNode.save();
 
-        Session s = helper.getReadWriteSession();
+        Session s = getHelper().getReadWriteSession();
         try {
             Node sibNode = (Node) s.getItem(sib2.getPath());
             sibNode.remove();
@@ -229,7 +229,7 @@
     }
 
     public void testGetPropertyOfRemovedAncestor() throws RepositoryException {
-        Session rw = helper.getReadWriteSession();
+        Session rw = getHelper().getReadWriteSession();
         try {
             // add modification to a property.
             Property p = (Property) rw.getItem(prop1Path);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java Wed Jul  8 13:57:13 2009
@@ -64,7 +64,6 @@
         resourceProps.add(jcrPrefix+":lastModified");
         resourceProps.add(jcrPrefix+":mimeType");
         resourceProps.add(jcrPrefix+":data");
-        resourceProps.add(jcrPrefix+":uuid");
 
         try {
             Node folder = testRootNode.addNode("folder", ntFolder);
@@ -87,7 +86,7 @@
     }
 
     public void testGetProperties() throws RepositoryException {
-        Session readSession = helper.getReadOnlySession();
+        Session readSession = getHelper().getReadOnlySession();
         try {
             dump((Node) readSession.getItem(fileNode.getPath()));
         } finally {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/IsSameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/IsSameTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/IsSameTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/IsSameTest.java Wed Jul  8 13:57:13 2009
@@ -40,7 +40,7 @@
         testRootNode.save();
 
         // access same property through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Property otherProperty = (Property) otherSession.getItem(p.getPath());
             assertTrue(p.isSame(otherProperty));
@@ -59,7 +59,7 @@
         p.setValue("someOtherValue");
 
         // access same property through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Property otherProperty = (Property) otherSession.getItem(p.getPath());
             assertTrue(p.isSame(otherProperty));
@@ -78,7 +78,7 @@
         testRootNode.save();
 
         // access same property through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Property otherProperty = (Property) otherSession.getItem(jcrData.getPath());
             assertTrue(jcrData.isSame(otherProperty));
@@ -97,7 +97,7 @@
         testRootNode.save();
 
         // access same property through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Property otherProperty = (Property) otherSession.getItem(jcrData.getPath());
             assertTrue(n.getProperty("jcr:data").isSame(otherProperty));
@@ -116,7 +116,7 @@
         testRootNode.save();
 
         // access nt:resource node through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode = (Node) otherSession.getItem(n.getPath());
             assertTrue(n.isSame(otherNode));
@@ -135,7 +135,7 @@
         testRootNode.save();
 
         // access nt:resource node through different session
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode = (Node) otherSession.getItem(n.getPath());
             assertTrue(otherNode.isSame(n));
@@ -169,7 +169,7 @@
         String destPath = testRootNode.getPath() + "/" + nodeName2;
         testRootNode.getSession().move(srcPath, destPath);
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode = (Node) otherSession.getItem(srcPath);
             assertTrue(n.isSame(otherNode));
@@ -189,7 +189,7 @@
         String srcPath = n.getPath();
         String destPath = testRootNode.getPath() + "/" + nodeName2;
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode = (Node) otherSession.getItem(srcPath);
 
@@ -212,7 +212,7 @@
         String srcPath = n.getPath();
         String destPath = testRootNode.getPath() + "/" + nodeName2;
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode = (Node) otherSession.getItem(srcPath);
 
@@ -244,7 +244,7 @@
         n.addMixin(mixReferenceable);
         testRootNode.save();
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node otherNode3 = (Node) otherSession.getItem(n3.getPath());
 
@@ -297,7 +297,7 @@
         Node n = testRootNode.addNode(nodeName1, testNodeType);
         Property p = n.setProperty(propertyName1, "anyValue");
 
-        Session s2 = helper.getReadWriteSession();
+        Session s2 = getHelper().getReadWriteSession();
         try {
             Node trn = (Node) s2.getItem(testRootNode.getPath());
             Node n2 = trn.addNode(nodeName1, testNodeType);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/LoginTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/LoginTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/LoginTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/LoginTest.java Wed Jul  8 13:57:13 2009
@@ -29,7 +29,7 @@
     private static Logger log = LoggerFactory.getLogger(LoginTest.class);
 
     public void testNullLogin() throws RepositoryException {
-        Session s = helper.getRepository().login();
+        Session s = getHelper().getRepository().login();
         try {
             assertNotNull(s.getWorkspace().getName());
         } finally {
@@ -38,7 +38,7 @@
     }
 
     public void testNullWorkspaceLogin() throws RepositoryException {
-        Session s = helper.getRepository().login((String) null);
+        Session s = getHelper().getRepository().login((String) null);
         try {
             assertNotNull(s.getWorkspace().getName());
         } finally {
@@ -47,7 +47,7 @@
     }
 
     public void testNullCredentialsNullWorkspaceLogin() throws RepositoryException {
-        Session s = helper.getRepository().login(null, null);
+        Session s = getHelper().getRepository().login(null, null);
         try {
             assertNotNull(s.getWorkspace().getName());
         } finally {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MixinModificationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MixinModificationTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MixinModificationTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MixinModificationTest.java Wed Jul  8 13:57:13 2009
@@ -96,7 +96,7 @@
             throw new NotExecutableException();
         }
 
-        Session testSession = helper.getReadWriteSession();
+        Session testSession = getHelper().getReadWriteSession();
         try {
             Node n = (Node) testSession.getItem(nPath);
             String uuid = n.getUUID();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveCombinedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveCombinedTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveCombinedTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveCombinedTest.java Wed Jul  8 13:57:13 2009
@@ -33,7 +33,7 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        testSession = helper.getReadOnlySession();
+        testSession = getHelper().getReadOnlySession();
     }
 
     protected void tearDown() throws Exception {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java Wed Jul  8 13:57:13 2009
@@ -246,7 +246,7 @@
         Node childNode = moveNode.addNode(nodeName2, testNodeType);
         testRootNode.save();
 
-        Session otherSession = helper.getReadWriteSession();
+        Session otherSession = getHelper().getReadWriteSession();
         try {
             otherSession.move(originalPath, destinationPath);
             Node mv = (Node) otherSession.getItem(destinationPath);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java Wed Jul  8 13:57:13 2009
@@ -235,7 +235,9 @@
      * </code> to a location where a property already exists with same name.
      * <br/>
      * With JCR 1.0 this should throw an <code>{@link javax.jcr.ItemExistsException}</code>.
-     * With JCR 2.0 this must succeed.
+     * With JCR 2.0 the support for same-named property and node is optional and
+     * the expected behaviour depends on the
+     * {@link Repository#OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED} descriptor.
      */
     public void testMovePropertyExists() throws RepositoryException, NotExecutableException {
         // try to create a property with the name of the node to be moved
@@ -247,7 +249,8 @@
             throw new NotExecutableException("Cannot create property with name '" +nodeName2+ "' and value 'anyString' at move destination.");
         }
 
-        if ("1.0".equals(helper.getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
+        // TODO: fix 2.0 behaviour according to the OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED descriptor
+        if ("1.0".equals(getHelper().getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
             try {
                 // move the node
                 doMove(moveNode.getPath(), destProperty.getPath());

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java Wed Jul  8 13:57:13 2009
@@ -183,7 +183,7 @@
 
         testRootNode.save();
 
-        Session readOnly = helper.getReadOnlySession();
+        Session readOnly = getHelper().getReadOnlySession();
         try {
             Node trn = (Node) readOnly.getItem(testRootNode.getPath());
             NodeIterator it = trn.getNodes(nodeName1);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java Wed Jul  8 13:57:13 2009
@@ -85,7 +85,7 @@
      * <code>Session</code>.
      */
     public void testOrder2() throws RepositoryException {
-        Session another = helper.getReadOnlySession();
+        Session another = getHelper().getReadOnlySession();
         try {
             NodeIterator it = ((Node) another.getItem(testRootNode.getPath())).getNodes();
             checkOrder(it, children);
@@ -99,7 +99,7 @@
      * <code>Session</code> after having accessed some of the nodes individually.
      */
     public void testOrderAfterIndividualAccess() throws RepositoryException {
-        Session another = helper.getReadOnlySession();
+        Session another = getHelper().getReadOnlySession();
         try {
             Node n2 = (Node) another.getItem(children[2].getPath());
             Node n0 = (Node) another.getItem(children[0].getPath());
@@ -115,7 +115,7 @@
      * <code>Session</code> after having accessed some of the nodes individually.
      */
     public void testOrderAfterIndividualAccess2() throws RepositoryException {
-        Session another = helper.getReadOnlySession();
+        Session another = getHelper().getReadOnlySession();
         try {
             Node n2 = (Node) another.getItem(children[3].getPath());
             Node n3 = (Node) another.getItem(children[1].getPath());

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java Wed Jul  8 13:57:13 2009
@@ -79,7 +79,7 @@
      * @throws RepositoryException
      */
     public void testRefreshOtherSession() throws RepositoryException {
-        Session readSession = helper.getReadOnlySession();
+        Session readSession = getHelper().getReadOnlySession();
         try {
             Node anotherNode = (Node) readSession.getItem(srcPath);
             // workspace move

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java Wed Jul  8 13:57:13 2009
@@ -127,7 +127,7 @@
         superuser.save();
 
         // get the node with session 2
-        Session otherSession = helper.getReadWriteSession();
+        Session otherSession = getHelper().getReadWriteSession();
         try {
             Node childNode2 = (Node) otherSession.getItem(childNode.getPath());
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java Wed Jul  8 13:57:13 2009
@@ -134,7 +134,7 @@
         testRootNode.orderBefore(getRelPath(child3), getRelPath(child1));
         testRootNode.save();
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             testOrder((Node) otherSession.getItem(testRootNode.getPath()), new Node[] {child3, child1, child2, child4});
         } finally {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java Wed Jul  8 13:57:13 2009
@@ -86,7 +86,7 @@
      * by another session.
      */
     public void testIndexByOtherSession() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             for (int index = Path.INDEX_DEFAULT; index < 4; index++) {
                 Node sns = (Node) otherSession.getItem(buildPath(index));
@@ -123,7 +123,7 @@
      * without loading SNSs with lower index before
      */
     public void testNodeEntriesFilledCorrectly() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             Node sns = (Node) otherSession.getItem(buildPath(3));
             checkIndex(sns, 3);
@@ -168,7 +168,7 @@
      * Test if accessing the created nodes by name really returns all nodes.
      */
     public void testGetNodesByNameByOtherSession() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             NodeIterator it = ((Node) otherSession.getItem(parent.getPath())).getNodes(snsName);
             long size = it.getSize();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java Wed Jul  8 13:57:13 2009
@@ -67,7 +67,7 @@
         testRootNode.save();
 
         String srcWorkspace = null;
-        String wspName = helper.getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");
+        String wspName = getHelper().getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");
         if (wspName == null) {
             throw new NotExecutableException("Cannot run update. Missing config param.");
         }
@@ -153,7 +153,7 @@
 
         String srcWorkspace = getAnotherWorkspace();
         // get the root node in the second workspace
-        Session session2 = helper.getSuperuserSession(srcWorkspace);
+        Session session2 = getHelper().getSuperuserSession(srcWorkspace);
         try {
             // make sure the source-session has the corresponding node.
             Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace));
@@ -178,7 +178,7 @@
     public void testUpdateAddsMissingSubtree() throws RepositoryException, NotExecutableException {
         String srcWorkspace = getAnotherWorkspace();
         // get the root node in the second workspace
-        Session session2 = helper.getSuperuserSession(srcWorkspace);
+        Session session2 = getHelper().getSuperuserSession(srcWorkspace);
         try {
             // make sure the source-session has the corresponding node.
             Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace));
@@ -209,7 +209,7 @@
     }
 
     private String getAnotherWorkspace() throws NotExecutableException, RepositoryException {
-        String srcWorkspace = helper.getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");;
+        String srcWorkspace = getHelper().getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");;
         if (srcWorkspace == null || srcWorkspace.equals(currentWorkspace)) {
             throw new NotExecutableException("no alternative workspace configured");
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/WorkspaceMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/WorkspaceMoveTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/WorkspaceMoveTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/WorkspaceMoveTest.java Wed Jul  8 13:57:13 2009
@@ -42,7 +42,9 @@
      * with same name.
      * <br/> <br/>
      * With JCR 1.0 this should throw an <code>{@link javax.jcr.ItemExistsException}</code>.
-     * With JCR 2.0 this must succeed.
+     * With JCR 2.0 the support for same-named property and node is optional and
+     * the expected behaviour depends on the
+     * {@link Repository#OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED} descriptor.
      */
     public void testMovePropertyExists() throws RepositoryException, NotExecutableException {
         // try to create a property with the name of the node to be moved
@@ -55,7 +57,8 @@
             throw new NotExecutableException("Cannot create property with name '" +nodeName2+ "' and value 'anyString' at move destination.");
         }
 
-        if ("1.0".equals(helper.getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
+        // TODO: fix 2.0 behaviour according to the OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED descriptor
+        if ("1.0".equals(getHelper().getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
             try {
                 // move the node
                 doMove(moveNode.getPath(), destProperty.getPath());
@@ -79,9 +82,10 @@
             throw new NotExecutableException("Cannot create property with name '" +nodeName2+ "' and value 'anyString' at move destination.");
         }
 
+        // TODO: fix 2.0 behaviour according to the OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED descriptor        
         // workspace-move the node (must succeed)
         doMove(moveNode.getPath(), destProperty.getPath());
-         if ("1.0".equals(helper.getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
+         if ("1.0".equals(getHelper().getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
              try {
                  // saving transient new property must fail
                  destParentNode.save();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java Wed Jul  8 13:57:13 2009
@@ -25,11 +25,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Node;
 import javax.jcr.Repository;
-import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
-import java.util.List;
-import java.util.Arrays;
 
 /**
  * <code>AbstractLockTest</code>...
@@ -49,7 +46,7 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        otherSession = helper.getSuperuserSession();
+        otherSession = getHelper().getSuperuserSession();
 
         lockedNode = testRootNode.addNode(nodeName1, testNodeType);
         lockedNode.addMixin(mixLockable);
@@ -104,53 +101,6 @@
     }
 
     /**
-     * Test Lock.isDeep()
-     */
-    public void testNotIsDeep() throws RepositoryException {
-        assertFalse("Lock.isDeep() must be false if the lock has not been set as not deep", lock.isDeep());
-    }
-
-    /**
-     * Test Lock.isSessionScoped()
-     */
-    public void testIsSessionScoped() throws RepositoryException {
-        if (isSessionScoped()) {
-            assertTrue("Lock.isSessionScoped() must be true.", lock.isSessionScoped());
-        } else {
-            assertFalse("Lock.isSessionScoped() must be false. ", lock.isSessionScoped());
-        }
-    }
-
-    public void testLockIsLive() throws RepositoryException {
-        // assert: lock must be alive
-        assertTrue("lock must be alive", lock.isLive());
-    }
-
-    public void testRefresh() throws RepositoryException {
-        // assert: refresh must succeed
-        lock.refresh();
-    }
-
-    public void testUnlock() throws RepositoryException {
-        // unlock node
-        lockedNode.unlock();
-        // assert: lock must not be alive
-        assertFalse("lock must not be alive", lock.isLive());
-    }
-
-    public void testRefreshNotLive() throws Exception {
-        // unlock node
-        lockedNode.unlock();
-        // refresh
-        try {
-            lock.refresh();
-            fail("Refresh on a lock that is not alive must fail");
-        } catch (LockException e) {
-            // success
-        }
-    }
-
-    /**
      * Tests if a locked, checked-in node can be unlocked
      */
     public void testCheckedInUnlock() throws Exception {
@@ -275,15 +225,6 @@
     }
 
     /**
-     * A locked node must also be locked if accessed by some other session.
-     */
-    public void testLockVisibility() throws RepositoryException {
-        Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());
-        assertTrue("Locked node must also be locked for another session", ln2.isLocked());
-        assertTrue("Locked node must also be locked for another session", ln2.holdsLock());
-    }
-
-    /**
      * If a locked nodes is unlocked again, any Lock instance retrieved by
      * another session must change the lock-status. Similarly, the previously
      * locked node must not be marked locked any more.
@@ -325,43 +266,4 @@
         n.remove();
         otherSession.save();
     }
-
-    public void testRemoveMixLockableFromLockedNode() throws RepositoryException {
-        try {
-            lockedNode.removeMixin(mixLockable);
-            lockedNode.save();
-
-            // the mixin got removed -> the lock should implicitely be released
-            // as well in order not to have inconsistencies
-            String msg = "Lock should have been released.";
-            assertFalse(msg, lock.isLive());
-            assertFalse(msg, lockedNode.isLocked());
-            if (!isSessionScoped()) {
-                List tokens = Arrays.asList(superuser.getLockTokens());
-                assertFalse(msg, tokens.contains(lock.getLockToken()));
-            }
-
-            assertFalse(msg, lockedNode.hasProperty(jcrLockOwner));
-            assertFalse(msg, lockedNode.hasProperty(jcrlockIsDeep));
-
-        } catch (ConstraintViolationException e) {
-            // cannot remove the mixin -> ok
-            // consequently the node must still be locked, the lock still live...
-            String msg = "Lock must still be live.";
-            assertTrue(msg, lock.isLive());
-            assertTrue(msg, lockedNode.isLocked());
-            if (!isSessionScoped()) {
-                List tokens = Arrays.asList(superuser.getLockTokens());
-                assertTrue(tokens.contains(lock.getLockToken()));
-            }
-            assertTrue(msg, lockedNode.hasProperty(jcrLockOwner));
-            assertTrue(msg, lockedNode.hasProperty(jcrlockIsDeep));
-        } finally {
-            // ev. re-add the mixin in order to be able to unlock the node
-            if (lockedNode.isLocked() && !lockedNode.isNodeType(mixLockable)) {
-                lockedNode.addMixin(mixLockable);
-                lockedNode.save();
-            }
-        }
-    }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/DeepLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/DeepLockTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/DeepLockTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/DeepLockTest.java Wed Jul  8 13:57:13 2009
@@ -145,7 +145,7 @@
     }
 
     public void testRemoveLockedChild() throws RepositoryException {
-        Session otherSession = helper.getReadWriteSession();
+        Session otherSession = getHelper().getReadWriteSession();
         try {
             Node child = (Node) otherSession.getItem(childNode.getPath());
             child.remove();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java Wed Jul  8 13:57:13 2009
@@ -19,11 +19,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.LockException;
-import javax.jcr.lock.Lock;
-
 /**
  * <code>SessionScopedLockTest</code>...
  */
@@ -34,48 +29,4 @@
     boolean isSessionScoped() {
         return true;
     }
-
-    /**
-     * Test locks are released when session logs out
-     */
-    public void testLockNotLiveAfterLogout() throws RepositoryException {
-        Node testRoot2 = (Node) otherSession.getItem(testRootNode.getPath());
-
-        Node lockedNode2 = testRoot2.addNode(nodeName2, testNodeType);
-        lockedNode2.addMixin(mixLockable);
-        testRoot2.save();
-
-        Lock lock2 = lockedNode2.lock(false, isSessionScoped());
-        otherSession.logout();
-
-        assertFalse(lock2.isLive());
-    }
-
-    /**
-     * Test locks are released when session logs out
-     */
-    public void testNotLockedAfterLogout() throws RepositoryException {
-        Node testRoot2 = (Node) otherSession.getItem(testRootNode.getPath());
-
-        Node lockedNode2 = testRoot2.addNode(nodeName2, testNodeType);
-        lockedNode2.addMixin(mixLockable);
-        testRoot2.save();
-
-        // force reloading of the testroot in order to be aware of the
-        // locked noded added by another session
-        testRootNode.refresh(false);
-        Node n2 = (Node) superuser.getItem(lockedNode2.getPath());
-
-        // remove lock implicit by logout lock-holding session
-        otherSession.logout();
-
-        assertFalse(n2.isLocked());
-        assertFalse(n2.holdsLock());
-        try {
-            n2.getLock();
-            fail("Upon logout of the session a session-scoped lock must be gone.");
-        } catch (LockException e) {
-            // ok
-        }
-    }
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java Wed Jul  8 13:57:13 2009
@@ -72,7 +72,7 @@
      * @throws RepositoryException
      */
     public void testRegisteredNamespaceVisibility() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry();
 
@@ -111,7 +111,7 @@
      * @throws RepositoryException
      */
     public void testReRegisteredNamespace2() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry();
 
@@ -135,7 +135,7 @@
      * @throws RepositoryException
      */
     public void testReRegisteredNamespaceVisibility() throws RepositoryException {
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry();
 
@@ -169,7 +169,7 @@
         String prefix = getUnusedPrefix();
         String uri = getUnusedURI();
 
-        Session otherSession = helper.getReadOnlySession();
+        Session otherSession = getHelper().getReadOnlySession();
         try {
             NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry();
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java Wed Jul  8 13:57:13 2009
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.uuid.UUID;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -31,6 +32,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeType;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -152,12 +155,30 @@
      * @throws IOException
      * @throws RepositoryException
      */
-    public void testEmptyMixins2() throws IOException, RepositoryException {
+    public void testEmptyMixins2() throws IOException, RepositoryException, NotExecutableException {
         /*
-        JSR 170: nt:resource includes mix:referenceable
-        TODO: tests needs to be adjusted for JSR 283 (-> define test-property)
+        look for a a node type that includes mix:referenceable but isn't any
+        of the known internal nodetypes that ev. cannot be created through a
+        session-import
         */
-        String referenceableNt = "nt:resource";
+        String referenceableNt = null;
+        NodeTypeIterator it = superuser.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+        while (it.hasNext() && referenceableNt == null) {
+            NodeType nt = it.nextNodeType();
+            String ntName = nt.getName();
+            if (nt.isNodeType(mixReferenceable) &&
+                    !nt.isAbstract() &&
+                    // TODO: improve....
+                    // ignore are built-in nodetypes (mostly version related)
+                    !ntName.startsWith("nt:") &&
+                    // also skip all internal node types...
+                    !ntName.startsWith("rep:")) {
+                referenceableNt = ntName;
+            }
+        }
+        if (referenceableNt == null) {
+            throw new NotExecutableException("No primary type found that extends from mix:referenceable.");
+        }
         /*
         TODO: retrieve valid jcr:uuid value from test-properties.
         */

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-parent/pom.xml?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-parent/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-parent/pom.xml Wed Jul  8 13:57:13 2009
@@ -30,48 +30,23 @@
   <parent>
     <groupId>org.apache.jackrabbit</groupId>
     <artifactId>parent</artifactId>
-    <version>2</version>
+    <version>3</version>
   </parent>
 
   <artifactId>jackrabbit-parent</artifactId>
   <name>Jackrabbit Parent POM</name>
   <version>2.0-SNAPSHOT</version>
   <packaging>pom</packaging>
-  <description>
-    Apache Jackrabbit is a fully conforming implementation of the
-    Content Repository for Java Technology API (JCR). A content
-    repository is a hierarchical content store with support for
-    structured and unstructured content, full text search, versioning,
-    transactions, observation, and more.
-  </description>
   <issueManagement>
     <system>Jira</system>
     <url>http://issues.apache.org/jira/browse/JCR</url>
   </issueManagement>
-  <inceptionYear>2004</inceptionYear>
 
   <properties>
     <slf4j.version>1.5.3</slf4j.version>
     <jetty.version>6.1.14</jetty.version>
   </properties>
 
-  <distributionManagement>
-    <repository>
-      <id>apache.releases.https</id>
-      <name>Apache Release Distribution Repository</name>
-      <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
-    </repository>
-    <snapshotRepository>
-      <id>apache.snapshots.https</id>
-      <name>Apache Development Snapshot Repository</name>
-      <url>https://repository.apache.org/content/repositories/snapshots</url>
-    </snapshotRepository>
-  </distributionManagement>
-
-  <prerequisites>
-    <maven>2.0.9</maven>
-  </prerequisites>
-
   <build>
     <plugins>
       <!-- JCR-2087: Upgrade to Java 5 as the base platform -->
@@ -82,18 +57,6 @@
           <source>1.5</source>
         </configuration>
       </plugin>
-      <!-- JCR-704: Enable maven-source-plugin -->
-      <plugin>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
       <!-- Generate aggregate Javadocs -->
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>
@@ -141,11 +104,6 @@
             </instructions>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>rat-maven-plugin</artifactId>
-          <version>1.0-alpha-3</version>
-        </plugin>
       </plugins>
     </pluginManagement>
   </build>
@@ -184,60 +142,12 @@
     </plugins>
   </reporting>
 
-  <profiles>
-    <!-- JCR-661: The antrun tools.jar dependency is not needed on macs -->
-    <profile>
-      <id>non-mac</id>
-      <activation>
-        <os>
-          <family>!mac</family>
-        </os>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <artifactId>maven-antrun-plugin</artifactId>
-            <dependencies>
-              <!-- JCR-661: Plugin dependencies are inherited -->
-              <dependency>
-                <groupId>sun</groupId>
-                <artifactId>tools</artifactId>
-                <version>1.0</version>
-                <scope>system</scope>
-                <systemPath>${java.home}/../lib/tools.jar</systemPath>
-              </dependency>
-            </dependencies>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>with-rat</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>rat-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <phase>verify</phase>
-                  <goals>
-                    <goal>check</goal>
-                  </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
   <dependencyManagement>
     <dependencies>
       <dependency>
         <groupId>javax.jcr</groupId>
         <artifactId>jcr</artifactId>
-        <version>2.0-pfd</version>
+        <version>2.0-b18</version>
         <scope>provided</scope>
       </dependency>
       <dependency>

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/pom.xml?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/pom.xml Wed Jul  8 13:57:13 2009
@@ -108,8 +108,8 @@
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>rat-maven-plugin</artifactId>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
         <configuration>
           <excludes>
             <exclude>src/main/javacc/xpath/*</exclude>



Mime
View raw message