jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1536314 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java oak-jcr/pom.xml oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
Date Mon, 28 Oct 2013 11:19:31 GMT
Author: angela
Date: Mon Oct 28 11:19:31 2013
New Revision: 1536314

URL: http://svn.apache.org/r1536314
Log:
OAK-1098 : AuthorizableImpl methods should convert path to Oak path (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java?rev=1536314&r1=1536313&r2=1536314&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java
Mon Oct 28 11:19:31 2013
@@ -100,8 +100,8 @@ public class UserQueryManager {
         StringBuilder statement = new StringBuilder();
         ConditionVisitor visitor = new XPathConditionVisitor(statement, namePathMapper);
 
-        String searchRoot = QueryUtil.getSearchRoot(builder.getSelectorType(), config);
-        String ntName = QueryUtil.getNodeTypeName(builder.getSelectorType());
+        String searchRoot = namePathMapper.getJcrPath(QueryUtil.getSearchRoot(builder.getSelectorType(),
config));
+        String ntName = namePathMapper.getJcrName(QueryUtil.getNodeTypeName(builder.getSelectorType()));
         statement.append(searchRoot).append("//element(*,").append(ntName).append(')');
 
         if (condition != null) {

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1536314&r1=1536313&r2=1536314&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Oct 28 11:19:31 2013
@@ -120,8 +120,7 @@
 
       <!-- User Management -->
       org.apache.jackrabbit.oak.jcr.security.user.MemberNodeImportTest                  
            <!-- OAK-414, OAK-482 -->
-      org.apache.jackrabbit.oak.jcr.security.user.RemappingTest#testFindAuthorizable    
            <!-- OAK-1098 -->
-      org.apache.jackrabbit.oak.jcr.security.user.RemappingTest#testFindAuthorizable2   
            <!-- OAK-1098 -->
+      org.apache.jackrabbit.oak.jcr.security.user.RemappingTest#testQuery               
            <!-- OAK-1098 -->
 
       <!-- Query -->
       org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestSomeNTWithSNS
         <!-- OAK-203 -->

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java?rev=1536314&r1=1536313&r2=1536314&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
Mon Oct 28 11:19:31 2013
@@ -27,6 +27,9 @@ import javax.jcr.Value;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.Query;
+import org.apache.jackrabbit.api.security.user.QueryBuilder;
+import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceConstants;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.junit.Test;
@@ -125,8 +128,33 @@ public class RemappingTest extends Abstr
     }
 
     @Test
+    public void testFindAuthorizable3() throws Exception {
+        for (String relPath : unmappedPaths) {
+            user.setProperty(relPath, nameValue);
+        }
+        superuser.save();
+        session.refresh(false);
+
+        Map<String, String> m = ImmutableMap.of("my:property", "my:value", "my:node/my:property2",
"my:value");
+        for (String relPath : m.keySet()) {
+            String value = m.get(relPath);
+            Iterator<Authorizable> result = getUserManager(session).findAuthorizables(relPath,
value, UserManager.SEARCH_TYPE_USER);
+            assertTrue(result.hasNext());
+            assertEquals(user.getID(), result.next().getID());
+        }
+    }
+
+    @Test
     public void testQuery() throws Exception {
-        // TODO
+        Iterator<Authorizable> result = getUserManager(session).findAuthorizables(new
Query() {
+            public <T> void build(QueryBuilder<T> builder) {
+                builder.setCondition(builder.
+                            eq("@my:property", vf.createValue("value")));
+            }
+        });
+
+        assertTrue(result.hasNext());
+        assertEquals(user.getID(), result.next().getID());
     }
 
     @Test



Mime
View raw message