jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1540741 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java
Date Mon, 11 Nov 2013 14:29:19 GMT
Author: angela
Date: Mon Nov 11 14:29:18 2013
New Revision: 1540741

URL: http://svn.apache.org/r1540741
Log:
OAK-1124 : test-case

Added:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java
Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1540741&r1=1540740&r2=1540741&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Nov 11 14:29:18 2013
@@ -115,6 +115,7 @@
 
       <!-- User Management -->
       org.apache.jackrabbit.oak.jcr.security.user.MemberNodeImportTest                  
            <!-- OAK-414, OAK-482 -->
+      org.apache.jackrabbit.oak.jcr.security.user.RefreshTest#testAuthorizableGetProperty
           <!-- OAK-1124 -->
 
       <!-- Query -->
       org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestSomeNTWithSNS
         <!-- OAK-203 -->

Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java?rev=1540741&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RefreshTest.java
Mon Nov 11 14:29:18 2013
@@ -0,0 +1,104 @@
+/*
+ * 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.oak.jcr.security.user;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.User;
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl;
+import org.apache.jackrabbit.test.RepositoryStub;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests asserting that auto-refresh on session is properly propagated to the
+ * user management API.
+ */
+public class RefreshTest extends AbstractUserTest {
+
+    private Session adminSession = null;
+    private UserManager adminUserManager;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        String adminId = getHelper().getProperty(RepositoryStub.PROP_PREFIX + '.' + RepositoryStub.PROP_SUPERUSER_NAME);
+        String adminPw = getHelper().getProperty(RepositoryStub.PROP_PREFIX + '.' + RepositoryStub.PROP_SUPERUSER_PWD);
+        SimpleCredentials credentials = new SimpleCredentials(adminId, adminPw.toCharArray());
+        credentials.setAttribute(RepositoryImpl.REFRESH_INTERVAL, 0);
+        adminSession = getHelper().getRepository().login(credentials);
+        adminUserManager = ((JackrabbitSession) adminSession).getUserManager();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        try {
+            if (adminSession != null) {
+                adminSession.logout();
+            }
+        } finally {
+            super.tearDown();
+        }
+    }
+
+    @Test
+    public void testGetAuthorizable() throws RepositoryException {
+        User user = null;
+        try {
+            String uid = createUserId();
+            user = userMgr.createUser(uid, uid);
+            superuser.save();
+
+            assertNotNull(adminUserManager.getAuthorizable(uid));
+        } finally {
+            if (user != null) {
+                user.remove();
+                superuser.save();
+            }
+        }
+    }
+
+    @Ignore("OAK-1124") // FIXME: OAK-1124
+    @Test
+    public void testAuthorizableGetProperty() throws RepositoryException {
+        User user = null;
+        try {
+            String uid = createUserId();
+            user = userMgr.createUser(uid, uid);
+            superuser.save();
+
+            Authorizable a = adminUserManager.getAuthorizable(uid);
+
+            user.setProperty("prop", superuser.getValueFactory().createValue("val"));
+            superuser.save();
+
+            assertNotNull(a.getProperty("prop"));
+
+        } finally {
+            if (user != null) {
+                user.remove();
+                superuser.save();
+            }
+        }
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java?rev=1540741&r1=1540740&r2=1540741&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java
Mon Nov 11 14:29:18 2013
@@ -27,15 +27,13 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
-import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.AuthorizableExistsException;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.api.security.user.UserManager;
-import org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl;
-import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
+import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.junit.Test;
@@ -84,35 +82,6 @@ public class UserManagerTest extends Abs
             }
         }
     }
-    
-    @Test
-    // FIXME clarify expectations, move to auto refresh related tests. See OAK-938.
-    public void testAutoRefreshSession() throws RepositoryException {
-        Session adminSession = null;
-        SimpleCredentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
-        credentials.setAttribute(RepositoryImpl.REFRESH_INTERVAL, 0);
-
-        User user = null;
-        try {
-            adminSession = superuser.getRepository().login(credentials);
-            UserManager adminUserManager = ((JackrabbitSession) adminSession).getUserManager();
-
-            String uid = createUserId();
-            user = userMgr.createUser(uid, uid);
-            superuser.save();
-
-            assertNotNull(adminUserManager.getAuthorizable(uid));
-        } finally {
-            if (adminSession != null) {
-                adminSession.logout();
-            }
-            if (user != null) {
-                user.remove();
-            }
-        }
-    }
-    
-    
 
     @Test
     public void testGetAuthorizableByPath() throws RepositoryException, NotExecutableException
{



Mime
View raw message