jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r656595 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/security/user/ test/java/org/apache/jackrabbit/core/security/user/
Date Thu, 15 May 2008 11:49:36 GMT
Author: angela
Date: Thu May 15 04:49:36 2008
New Revision: 656595

URL: http://svn.apache.org/viewvc?rev=656595&view=rev
Log:
JCR-1588: JSR 283 Access Control (work in progress)

- fixing TraversingNodeResolver and adding tests

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java?rev=656595&r1=656594&r2=656595&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
Thu May 15 04:49:36 2008
@@ -19,6 +19,7 @@
 
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.slf4j.Logger;
@@ -29,6 +30,8 @@
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.Property;
+import javax.jcr.Value;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -58,25 +61,42 @@
      * @inheritDoc
      */
     public Node findNode(Name nodeName, Name ntName) throws RepositoryException {
-        Node root = (Node) getSession().getItem(getSearchRoot(ntName));
-        return collectNode(nodeName, ntName, root.getNodes());
+        String sr = getSearchRoot(ntName);
+        // TODO: remove cast once 283 is released
+        SessionImpl sImpl = (SessionImpl) getSession();
+        if (sImpl.nodeExists(sr)) {
+            try {
+                Node root = sImpl.getNode(sr);
+                return collectNode(nodeName, ntName, root.getNodes());
+            } catch (PathNotFoundException e) {
+                // should not get here
+                log.warn("Error while retrieving node " + sr);
+            }
+        } // else: searchRoot does not exist yet -> omit the search
+        return null;
     }
 
     /**
      * @inheritDoc
      */
     public Node findNode(Name propertyName, String value, Name ntName) throws RepositoryException
{
-        try {
-            Node root = (Node) getSession().getItem(getSearchRoot(ntName));
-            NodeIterator nodes = collectNodes(value, Collections.singleton(propertyName),
ntName,
-                    root.getNodes(), true, 1);
-            if (nodes.hasNext()) {
-                return nodes.nextNode();
+        String sr = getSearchRoot(ntName);
+        // TODO: remove cast once 283 is released
+        SessionImpl sImpl = (SessionImpl) getSession();
+        if (sImpl.nodeExists(sr)) {
+            try {
+                Node root = sImpl.getNode(sr);
+                NodeIterator nodes = collectNodes(value,
+                        Collections.singleton(propertyName), ntName,
+                        root.getNodes(), true, 1);
+                if (nodes.hasNext()) {
+                    return nodes.nextNode();
+                }
+            } catch (PathNotFoundException e) {
+                // should not get here
+                log.warn("Error while retrieving node " + sr);
             }
-        } catch (PathNotFoundException e) {
-            log.warn("Error while searching for node having a property " + propertyName +
" with value " + value);
-        }
-
+        } // else: searchRoot does not exist yet -> omit the search
         return null;
     }
 
@@ -85,29 +105,44 @@
      */
     public NodeIterator findNodes(Set propertyNames, String value, Name ntName,
                                   boolean exact, long maxSize) throws RepositoryException
{
-
-        NodeImpl root = (NodeImpl) getSession().getItem(getSearchRoot(ntName));
-        return collectNodes(value, propertyNames, ntName, root.getNodes(), exact, maxSize);
+        String sr = getSearchRoot(ntName);
+        // TODO: remove cast once 283 is released
+        SessionImpl sImpl = (SessionImpl) getSession();
+        if (sImpl.nodeExists(sr)) {
+            try {
+                Node root = sImpl.getNode(sr);
+                return collectNodes(value, propertyNames, ntName, root.getNodes(), exact,
maxSize);
+            } catch (PathNotFoundException e) {
+                // should not get here
+                log.warn("Error while retrieving node " + sr);
+            }
+        } // else: searchRoot does not exist yet -> omit the search
+        return NodeIteratorAdapter.EMPTY;
     }
 
     //--------------------------------------------------------------------------
-
+    /**
+     *
+     * @param nodeName
+     * @param ntName
+     * @param nodes
+     * @return The first matching node or <code>null</code>.
+     */
     private Node collectNode(Name nodeName, Name ntName, NodeIterator nodes) {
-        while (nodes.hasNext()) {
+        Node match = null;
+        while (match == null && nodes.hasNext()) {
             NodeImpl node = (NodeImpl) nodes.nextNode();
             try {
                 if (node.isNodeType(ntName) && nodeName.equals(node.getQName()))
{
-                    return node;
-                }
-                if (node.hasNodes()) {
-                    return collectNode(nodeName, ntName, node.getNodes());
+                    match = node;
+                } else if (node.hasNodes()) {
+                    match = collectNode(nodeName, ntName, node.getNodes());
                 }
             } catch (RepositoryException e) {
                 log.warn("Internal error while accessing node", e);
             }
         }
-        log.debug("Could not find a node matching name '" + nodeName + " and nodetype " +
ntName);
-        return null;
+        return match;
     }
 
     /**
@@ -125,9 +160,9 @@
     private NodeIterator collectNodes(String value, Set props, Name ntName,
                                       NodeIterator nodes, boolean exact,
                                       long maxSize) {
-        Set matches = new HashSet();
-        collectNodes(value, props, ntName, nodes, matches, exact, maxSize);
-        return new NodeIteratorAdapter(matches);
+        Set matchSet = new HashSet();
+        collectNodes(value, props, ntName, nodes, matchSet, exact, maxSize);
+        return new NodeIteratorAdapter(matchSet);
     }
 
     /**
@@ -138,23 +173,23 @@
      * @param propertyNames property to be searched, or null if {@link javax.jcr.Item#getName()}
      * @param nodeTypeName  name of nodetypes to search
      * @param itr           range of nodes and descendants to be searched
-     * @param matches       Set of found matches to append results
+     * @param matchSet      Set of found matches to append results
      * @param exact         if set to true the value has to match exact
      * @param maxSize
      */
     private void collectNodes(String value, Set propertyNames,
                               Name nodeTypeName, NodeIterator itr,
-                              Set matches, boolean exact, long maxSize) {
+                              Set matchSet, boolean exact, long maxSize) {
         while (itr.hasNext()) {
             NodeImpl node = (NodeImpl) itr.nextNode();
             try {
                 if (matches(node, nodeTypeName, propertyNames, value, exact)) {
-                    matches.add(node);
+                    matchSet.add(node);
                     maxSize--;
                 }
                 if (node.hasNodes() && maxSize > 0) {
                     collectNodes(value, propertyNames, nodeTypeName,
-                            node.getNodes(), matches, exact, maxSize);
+                            node.getNodes(), matchSet, exact, maxSize);
                 }
             } catch (RepositoryException e) {
                 log.warn("Internal error while accessing node", e);
@@ -172,7 +207,7 @@
      * @return
      * @throws RepositoryException
      */
-    private boolean matches(NodeImpl node, Name nodeTypeName,
+    private static boolean matches(NodeImpl node, Name nodeTypeName,
                             Collection propertyNames, String value,
                             boolean exact) throws RepositoryException {
 
@@ -187,10 +222,15 @@
                     while (!match && pItr.hasNext()) {
                         Name propertyName = (Name) pItr.next();
                         if (node.hasProperty(propertyName)) {
-                            String toMatch = node.getProperty(propertyName).getString();
-                            match = (exact) ?
-                                    toMatch.equals(value) :
-                                    toMatch.matches(".*"+value+".*");
+                            Property prop = node.getProperty(propertyName);
+                            if (prop.getDefinition().isMultiple()) {
+                                Value[] values = prop.getValues();
+                                for (int i = 0; i < values.length && !match; i++)
{
+                                    match = matches(value, values[i].getString(), exact);
+                                }
+                            } else {
+                                match = matches(value, prop.getString(), exact);
+                            }
                         }
                     }
                 }
@@ -201,4 +241,8 @@
         }
         return match;
     }
+
+    private static boolean matches(String value, String toMatch, boolean exact) {
+        return (exact) ? toMatch.equals(value) : toMatch.matches(".*"+value+".*");
+    }
 }

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java?rev=656595&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
Thu May 15 04:49:36 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.security.user;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.core.SessionImpl;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/** <code>IndexNodeResolver</code>... */
+public class IndexNodeResolverTest extends NodeResolverTest {
+
+    private static Logger log = LoggerFactory.getLogger(IndexNodeResolver.class);
+
+    protected NodeResolver createNodeResolver(Session session) throws RepositoryException,
NotExecutableException {
+        if (!(session instanceof SessionImpl)) {
+            throw new NotExecutableException();
+        }
+        return new IndexNodeResolver(session, (SessionImpl) session);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java?rev=656595&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
Thu May 15 04:49:36 2008
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.security.user;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.api.JackrabbitSession;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.NodeIterator;
+import javax.jcr.Node;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import java.util.Iterator;
+
+/** <code>NodeResolverTest</code>... */
+public abstract class NodeResolverTest extends AbstractJCRTest {
+
+    private static Logger log = LoggerFactory.getLogger(NodeResolverTest.class);
+
+    NodeResolver nodeResolver;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        nodeResolver = createNodeResolver(superuser);
+    }
+
+    private static UserImpl getCurrentUser(Session session) throws NotExecutableException,
RepositoryException {
+        if (!(session instanceof JackrabbitSession)) {
+            throw new NotExecutableException();
+        }
+        try {
+            UserManagerImpl uMgr = (UserManagerImpl) ((JackrabbitSession) session).getUserManager();
+            return uMgr.getCurrentUser();
+        } catch (UnsupportedRepositoryOperationException e) {
+            throw new NotExecutableException(e.getMessage());
+        } catch (UnsupportedOperationException e) {
+            throw new NotExecutableException(e.getMessage());
+        }
+    }
+
+    protected abstract NodeResolver createNodeResolver(Session session) throws RepositoryException,
NotExecutableException;
+
+    public void testFindNode() throws NotExecutableException, RepositoryException {
+        UserImpl currentUser = getCurrentUser(superuser);
+
+        NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+        Node result = nr.findNode(currentUser.getNode().getQName(), UserConstants.NT_REP_USER);
+        assertNotNull(result);
+        assertTrue(currentUser.getNode().isSame(result));
+
+        result = nr.findNode(currentUser.getNode().getQName(), UserConstants.NT_REP_AUTHORIZABLE);
+        assertNotNull(result);
+        assertTrue(currentUser.getNode().isSame(result));
+
+        result = nr.findNode(currentUser.getNode().getQName(), UserConstants.NT_REP_GROUP);
+        assertNull(result);
+
+        Iterator it = currentUser.memberOf();
+        while (it.hasNext()) {
+            GroupImpl gr = (GroupImpl) it.next();
+
+            result = nr.findNode(gr.getNode().getQName(), UserConstants.NT_REP_GROUP);
+            assertNotNull(result);
+            assertTrue(gr.getNode().isSame(result));
+
+            result = nr.findNode(gr.getNode().getQName(), UserConstants.NT_REP_AUTHORIZABLE);
+            assertNotNull(result);
+            assertTrue(gr.getNode().isSame(result));
+
+            result = nr.findNode(gr.getNode().getQName(), UserConstants.NT_REP_USER);
+            assertNull(result);
+        }
+    }
+
+    public void testFindNodeByPrincipalName() throws NotExecutableException, RepositoryException
{
+        UserImpl currentUser = getCurrentUser(superuser);
+
+        NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+        Node result = nr.findNode(UserConstants.P_PRINCIPAL_NAME, currentUser.getPrincipal().getName(),
UserConstants.NT_REP_USER);
+        assertNotNull(result);
+        assertTrue(currentUser.getNode().isSame(result));
+
+        Iterator it = currentUser.memberOf();
+        while (it.hasNext()) {
+            GroupImpl gr = (GroupImpl) it.next();
+
+            result = nr.findNode(UserConstants.P_PRINCIPAL_NAME, gr.getPrincipal().getName(),
UserConstants.NT_REP_GROUP);
+            assertNotNull(result);
+            assertTrue(gr.getNode().isSame(result));
+
+            result = nr.findNode(UserConstants.P_PRINCIPAL_NAME, gr.getPrincipal().getName(),
UserConstants.NT_REP_AUTHORIZABLE_FOLDER);
+            assertNull(result);
+        }
+    }
+
+    public void testFindNodeByUserID() throws NotExecutableException, RepositoryException
{
+        UserImpl currentUser = getCurrentUser(superuser);
+
+        NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+        Node result = nr.findNode(UserConstants.P_USERID, currentUser.getID(), UserConstants.NT_REP_USER);
+        assertNotNull(result);
+        assertTrue(currentUser.getNode().isSame(result));
+    }
+
+    public void testFindNodeByMultiValueProp() throws NotExecutableException, RepositoryException
{
+        UserImpl currentUser = getCurrentUser(superuser);
+
+        Value[] vs = new Value[] {
+                superuser.getValueFactory().createValue("blub"),
+                superuser.getValueFactory().createValue("blib")
+        };
+        currentUser.setProperty(propertyName1, vs);
+
+        NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+        Node result = nr.findNode(((SessionImpl) superuser).getQName(propertyName1),
+                "blib", UserConstants.NT_REP_USER);
+        assertNotNull(result);
+        assertTrue(currentUser.getNode().isSame(result));
+
+        currentUser.removeProperty(propertyName1);
+    }
+
+    public void testFindNodeWithNonExistingSearchRoot() throws NotExecutableException, RepositoryException
{
+        String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE_FOLDER);
+        SessionImpl sImpl = (SessionImpl) superuser;
+
+        if (sImpl.nodeExists(searchRoot)) {
+            throw new NotExecutableException();
+        }
+        Node result = nodeResolver.findNode(sImpl.getQName(UserConstants.GROUP_ADMIN_GROUP_NAME),
UserConstants.NT_REP_AUTHORIZABLE);
+        assertNull(result);
+    }
+
+    public void testFindNodes() throws NotExecutableException, RepositoryException {
+        Value[] vs = new Value[] {
+                superuser.getValueFactory().createValue("blub"),
+                superuser.getValueFactory().createValue("blib")
+        };
+
+        UserImpl currentUser = getCurrentUser(superuser);
+        currentUser.setProperty(propertyName1, vs);
+
+        Iterator it = currentUser.memberOf();
+        while (it.hasNext()) {
+            GroupImpl gr = (GroupImpl) it.next();
+            gr.setProperty(propertyName1, vs);
+        }
+
+        Name propName = ((SessionImpl) superuser).getQName(propertyName1);
+
+        try {
+            NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+            NodeIterator result = nr.findNodes(propName, "blub", UserConstants.NT_REP_USER,
false);
+            assertTrue(result.getSize() == 1);
+            assertTrue(result.nextNode().isSame(currentUser.getNode()));
+
+            result = nr.findNodes(propName, "blub", UserConstants.NT_REP_AUTHORIZABLE, false);
+            assertTrue(result.getSize() > 1);
+
+        } finally {
+            currentUser.removeProperty(propertyName1);
+            it = currentUser.memberOf();
+            while (it.hasNext()) {
+                GroupImpl gr = (GroupImpl) it.next();
+                gr.removeProperty(propertyName1);
+            }
+        }
+    }
+
+    public void testFindNodesWithNonExistingSearchRoot() throws NotExecutableException, RepositoryException
{
+        String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE);
+        if (((SessionImpl) superuser).nodeExists(searchRoot)) {
+            throw new NotExecutableException();
+        }
+
+        NodeIterator result = nodeResolver.findNodes(UserConstants.P_REFEREES, "anyValue",
UserConstants.NT_REP_AUTHORIZABLE, true);
+        assertNotNull(result);
+        assertFalse(result.hasNext());
+    }
+
+    public void testGetSearchRoot() {
+        String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE);
+        assertNotNull(searchRoot);
+        assertEquals(UserConstants.AUTHORIZABLES_PATH, searchRoot);
+
+        searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_GROUP);
+        assertNotNull(searchRoot);
+        assertEquals(UserConstants.GROUPS_PATH, searchRoot);
+
+        searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_USER);
+        assertNotNull(searchRoot);
+        assertEquals(UserConstants.USERS_PATH, searchRoot);
+    }
+
+    public void testGetSearchRootDefault() {
+        String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE_FOLDER);
+        assertNotNull(searchRoot);
+        assertEquals(UserConstants.AUTHORIZABLES_PATH, searchRoot);
+
+        searchRoot = nodeResolver.getSearchRoot(NameConstants.NT_UNSTRUCTURED);
+        assertNotNull(searchRoot);
+        assertEquals(UserConstants.AUTHORIZABLES_PATH, searchRoot);
+    }
+
+    public void testGetNamePathResolver() {
+        assertNotNull(nodeResolver.getNamePathResolver());
+    }
+
+    public void testGetSession() {
+        assertNotNull(nodeResolver.getSession());
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java?rev=656595&r1=656594&r2=656595&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java
Thu May 15 04:49:36 2008
@@ -39,6 +39,9 @@
         suite.addTestSuite(NotUserAdministratorTest.class);
         suite.addTestSuite(GroupAdministratorTest.class);
 
+        suite.addTestSuite(IndexNodeResolverTest.class);
+        suite.addTestSuite(TraversingNodeResolverTest.class);
+
         return suite;
     }
 }

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java?rev=656595&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
Thu May 15 04:49:36 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.security.user;
+
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/** <code>TraversingNodeResolverTest</code>... */
+public class TraversingNodeResolverTest extends NodeResolverTest {
+
+    private static Logger log = LoggerFactory.getLogger(TraversingNodeResolverTest.class);
+
+    protected NodeResolver createNodeResolver(Session session) throws RepositoryException,
NotExecutableException {
+        if (!(session instanceof SessionImpl)) {
+            throw new NotExecutableException();
+        }
+        return new TraversingNodeResolver(session, (SessionImpl) session);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url



Mime
View raw message