jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1400054 - in /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak: ./ security/ security/authentication/ security/authentication/token/ security/principal/ security/user/
Date Fri, 19 Oct 2012 11:53:21 GMT
Author: jukka
Date: Fri Oct 19 11:53:20 2012
New Revision: 1400054

URL: http://svn.apache.org/viewvc?rev=1400054&view=rev
Log:
OAK-352: Oak builder for simplified repository construction

AbstractOakTest is now needed only by the security tests,
and can be further simplified with the Oak class

Added:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/AbstractSecurityTest.java
  (contents, props changed)
      - copied, changed from r1400048, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/DefaultLoginModuleTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java

Copied: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/AbstractSecurityTest.java
(from r1400048, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/AbstractSecurityTest.java?p2=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/AbstractSecurityTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java&r1=1400048&r2=1400054&rev=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractOakTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/AbstractSecurityTest.java
Fri Oct 19 11:53:20 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak;
+package org.apache.jackrabbit.oak.security;
 
 import javax.jcr.Credentials;
 import javax.jcr.NoSuchWorkspaceException;
@@ -22,21 +22,15 @@ import javax.jcr.SimpleCredentials;
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginException;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.security.OakConfiguration;
-import org.apache.jackrabbit.oak.spi.lifecycle.CompositeMicroKernelTracker;
-import org.apache.jackrabbit.oak.spi.lifecycle.MicroKernelTracker;
 import org.junit.Before;
 
 /**
  * AbstractOakTest is the base class for oak test execution.
  */
-public abstract class AbstractOakTest {
+public abstract class AbstractSecurityTest {
 
     private ContentRepository contentRepository;
 
@@ -47,20 +41,11 @@ public abstract class AbstractOakTest {
         Configuration.setConfiguration(new OakConfiguration());
     }
 
-    protected MicroKernel createMicroKernelWithInitialContent() {
-        MicroKernel mk = new MicroKernelImpl();
-        new InitialContent().available(new KernelNodeStore(mk));
-        return mk;
-    }
-
     protected abstract ContentRepository createRepository();
 
-    protected ContentRepository getContentRepository() {
-        return contentRepository;
-    }
-
-    protected ContentSession createAdminSession() throws LoginException, NoSuchWorkspaceException
{
-        return getContentRepository().login(getAdminCredentials(), null);
+    protected ContentSession login(Credentials credentials)
+            throws LoginException, NoSuchWorkspaceException {
+        return contentRepository.login(credentials, null);
     }
 
     protected Credentials getAdminCredentials() {

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/DefaultLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/DefaultLoginModuleTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/DefaultLoginModuleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/DefaultLoginModuleTest.java
Fri Oct 19 11:53:20 2012
@@ -26,13 +26,14 @@ import javax.security.auth.login.LoginEx
 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.AbstractOakTest;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
@@ -50,7 +51,7 @@ import static org.junit.Assert.fail;
 /**
  * LoginTest...
  */
-public class DefaultLoginModuleTest extends AbstractOakTest {
+public class DefaultLoginModuleTest extends AbstractSecurityTest {
 
     SecurityProvider securityProvider = new SecurityProviderImpl();
 
@@ -60,7 +61,7 @@ public class DefaultLoginModuleTest exte
     public void before() throws Exception {
         super.before();
 
-        admin = createAdminSession();
+        admin = login(getAdminCredentials());
         Configuration.setConfiguration(new DefaultConfiguration());
     }
 
@@ -74,14 +75,17 @@ public class DefaultLoginModuleTest exte
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak(createMicroKernelWithInitialContent()).with(securityProvider).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(securityProvider)
+            .createContentRepository();
     }
 
     @Test
     public void testNullLogin() throws Exception {
         ContentSession cs = null;
         try {
-            cs = getContentRepository().login(null, null);
+            cs = login(null);
             fail("Null login should fail");
         } catch (LoginException e) {
             // success
@@ -94,7 +98,7 @@ public class DefaultLoginModuleTest exte
 
     @Test
     public void testGuestLogin() throws Exception {
-        ContentSession cs = getContentRepository().login(new GuestCredentials(), null);
+        ContentSession cs = login(new GuestCredentials());
         try {
             AuthInfo authInfo = cs.getAuthInfo();
             String anonymousID = UserUtility.getAnonymousId(securityProvider.getUserConfiguration().getConfigurationParameters());
@@ -118,7 +122,7 @@ public class DefaultLoginModuleTest exte
 
         ContentSession cs = null;
         try {
-            cs = getContentRepository().login(new SimpleCredentials(anonymousID, new char[0]),
null);
+            cs = login(new SimpleCredentials(anonymousID, new char[0]));
             fail("Login with anonymousID should fail since the initial setup doesn't provide
a password.");
         } catch (LoginException e) {
             // success
@@ -142,7 +146,7 @@ public class DefaultLoginModuleTest exte
             user = userManager.createUser("test", "pw");
             root.commit();
 
-            cs = getContentRepository().login(new SimpleCredentials("test", "pw".toCharArray()),
null);
+            cs = login(new SimpleCredentials("test", "pw".toCharArray()));
             AuthInfo authInfo = cs.getAuthInfo();
             assertEquals("test", authInfo.getUserID());
         } finally {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
Fri Oct 19 11:53:20 2012
@@ -21,11 +21,12 @@ import javax.jcr.GuestCredentials;
 import javax.security.auth.login.AppConfigurationEntry;
 import javax.security.auth.login.Configuration;
 
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
@@ -40,7 +41,7 @@ import static org.junit.Assert.assertEqu
 /**
  * LoginTest...
  */
-public class GuestDefaultLoginModuleTest extends AbstractOakTest {
+public class GuestDefaultLoginModuleTest extends AbstractSecurityTest {
 
     SecurityProvider securityProvider = new SecurityProviderImpl();
 
@@ -57,12 +58,15 @@ public class GuestDefaultLoginModuleTest
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak(createMicroKernelWithInitialContent()).with(securityProvider).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(securityProvider)
+            .createContentRepository();
     }
 
     @Test
     public void testNullLogin() throws Exception {
-        ContentSession cs = getContentRepository().login(null, null);
+        ContentSession cs = login(null);
         try {
             AuthInfo authInfo = cs.getAuthInfo();
             String anonymousID = UserUtility.getAnonymousId(securityProvider.getUserConfiguration().getConfigurationParameters());
@@ -74,7 +78,7 @@ public class GuestDefaultLoginModuleTest
 
     @Test
     public void testGuestLogin() throws Exception {
-        ContentSession cs = getContentRepository().login(new GuestCredentials(), null);
+        ContentSession cs = login(new GuestCredentials());
         try {
             AuthInfo authInfo = cs.getAuthInfo();
             String anonymousID = UserUtility.getAnonymousId(securityProvider.getUserConfiguration().getConfigurationParameters());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
Fri Oct 19 11:53:20 2012
@@ -24,11 +24,12 @@ import javax.security.auth.login.Configu
 import javax.security.auth.login.LoginException;
 
 import org.apache.jackrabbit.api.security.authentication.token.TokenCredentials;
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.authentication.token.TokenLoginModule;
 import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
@@ -45,7 +46,7 @@ import static org.junit.Assert.fail;
 /**
  * LoginTest...
  */
-public class TokenLoginModuleTest extends AbstractOakTest {
+public class TokenLoginModuleTest extends AbstractSecurityTest {
 
     SecurityProvider securityProvider = new SecurityProviderImpl();
     ContentSession admin;
@@ -54,7 +55,7 @@ public class TokenLoginModuleTest extend
     public void before() throws Exception {
         super.before();
 
-        admin = createAdminSession();
+        admin = login(getAdminCredentials());
         Configuration.setConfiguration(new TokenConfiguration());
     }
 
@@ -66,14 +67,17 @@ public class TokenLoginModuleTest extend
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak(createMicroKernelWithInitialContent()).with(securityProvider).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(securityProvider)
+            .createContentRepository();
     }
 
     @Test
     public void testNullLogin() throws Exception {
         ContentSession cs = null;
         try {
-            cs = getContentRepository().login(null, null);
+            cs = login(null);
             fail("Null login should fail");
         } catch (LoginException e) {
             // success
@@ -88,7 +92,7 @@ public class TokenLoginModuleTest extend
     public void testGuestLogin() throws Exception {
         ContentSession cs = null;
         try {
-            cs = getContentRepository().login(new GuestCredentials(), null);
+            cs = login(new GuestCredentials());
             fail("GuestCredentials login should fail");
         } catch (LoginException e) {
             // success
@@ -106,7 +110,7 @@ public class TokenLoginModuleTest extend
             SimpleCredentials sc = new SimpleCredentials("test", new char[0]);
             sc.setAttribute(TokenProviderImpl.TOKEN_ATTRIBUTE, "");
 
-            cs = getContentRepository().login(sc, null);
+            cs = login(sc);
             fail("Unsupported credentials login should fail");
         } catch (LoginException e) {
             // success
@@ -121,7 +125,7 @@ public class TokenLoginModuleTest extend
     public void testInvalidTokenCredentials() throws Exception {
         ContentSession cs = null;
         try {
-            cs = getContentRepository().login(new TokenCredentials("invalid"), null);
+            cs = login(new TokenCredentials("invalid"));
             fail("Invalid token credentials login should fail");
         } catch (LoginException e) {
             // success
@@ -140,7 +144,7 @@ public class TokenLoginModuleTest extend
         SimpleCredentials sc = (SimpleCredentials) getAdminCredentials();
         TokenInfo info = tp.createToken(sc.getUserID(), Collections.<String, Object>emptyMap());
 
-        ContentSession cs = getContentRepository().login(new TokenCredentials(info.getToken()),
null);
+        ContentSession cs = login(new TokenCredentials(info.getToken()));
         try {
             assertEquals(sc.getUserID(), cs.getAuthInfo().getUserID());
         } finally {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
Fri Oct 19 11:53:20 2012
@@ -16,14 +16,14 @@
  */
 package org.apache.jackrabbit.oak.security.authentication.token;
 
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.junit.Test;
 
 /**
  * TokenProviderImplTest...
  */
-public class TokenProviderImplTest extends AbstractOakTest {
+public class TokenProviderImplTest extends AbstractSecurityTest {
 
     @Override
     protected ContentRepository createRepository() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
Fri Oct 19 11:53:20 2012
@@ -19,13 +19,14 @@ package org.apache.jackrabbit.oak.securi
 import java.security.Principal;
 import java.util.Set;
 
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexHook;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.principal.AdminPrincipal;
@@ -40,7 +41,7 @@ import static org.junit.Assert.assertTru
 /**
  * PrincipalProviderImplTest...
  */
-public class PrincipalProviderImplTest extends AbstractOakTest {
+public class PrincipalProviderImplTest extends AbstractSecurityTest {
 
     private SecurityProvider securityProvider = new SecurityProviderImpl();
     private ContentSession admin;
@@ -50,14 +51,18 @@ public class PrincipalProviderImplTest e
     public void before() throws Exception {
         super.before();
 
-        admin = createAdminSession();
+        admin = login(getAdminCredentials());
         Root root = admin.getLatestRoot();
         principalProvider = new PrincipalProviderImpl(root, securityProvider.getUserConfiguration(),
NamePathMapper.DEFAULT);
     }
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak(createMicroKernelWithInitialContent()).with(new PropertyIndexHook()).with(securityProvider).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(new PropertyIndexHook())
+            .with(securityProvider)
+            .createContentRepository();
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
Fri Oct 19 11:53:20 2012
@@ -20,9 +20,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.jackrabbit.api.security.user.User;
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
 import org.junit.Test;
 
@@ -36,7 +36,7 @@ import static org.junit.Assert.fail;
 /**
  * UserManagerImplTest...
  */
-public class UserManagerImplTest extends AbstractOakTest {
+public class UserManagerImplTest extends AbstractSecurityTest {
 
      @Override
     protected ContentRepository createRepository() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java?rev=1400054&r1=1400053&r2=1400054&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
Fri Oct 19 11:53:20 2012
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Map;
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -30,8 +29,9 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexHook;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
+import org.apache.jackrabbit.oak.security.AbstractSecurityTest;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
-import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.util.Text;
 import org.junit.After;
@@ -50,7 +50,7 @@ import static org.junit.Assert.fail;
  * TODO: add tests for setProtectedProperty (might still be refactored...)
  * TODO: add tests for findAuthorizables once implementation is ready
  */
-public class UserProviderTest extends AbstractOakTest {
+public class UserProviderTest extends AbstractSecurityTest {
 
     private ContentSession contentSession;
     private Root root;
@@ -67,7 +67,7 @@ public class UserProviderTest extends Ab
 
     @Before
     public void setUp() throws Exception {
-        contentSession = createAdminSession();
+        contentSession = login(getAdminCredentials());
         root = contentSession.getLatestRoot();
 
         defaultConfig = new ConfigurationParameters();
@@ -96,7 +96,10 @@ public class UserProviderTest extends Ab
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak(createMicroKernelWithInitialContent()).with(new PropertyIndexHook()).with(new
OpenSecurityProvider()).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(new PropertyIndexHook())
+            .createContentRepository();
     }
 
     private UserProvider createUserProvider() {



Mime
View raw message