You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2013/12/04 10:34:51 UTC
svn commit: r1547744 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java
Author: angela
Date: Wed Dec 4 09:34:51 2013
New Revision: 1547744
URL: http://svn.apache.org/r1547744
Log:
OAK-516 : Create LdapLoginModule based on ExternalLoginModule (simplify base test)
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java?rev=1547744&r1=1547743&r2=1547744&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapLoginTestBase.java Wed Dec 4 09:34:51 2013
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.jcr.SimpleCredentials;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginException;
import org.apache.directory.server.constants.ServerDNConstants;
@@ -84,27 +82,13 @@ public abstract class LdapLoginTestBase
}
}
- @Override
- protected Configuration getConfiguration() {
- return new Configuration() {
- @Override
- public AppConfigurationEntry[] getAppConfigurationEntry(String s) {
- return new AppConfigurationEntry[]{
- new AppConfigurationEntry(
- LdapLoginModule.class.getName(),
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
- options)
- };
- }
- };
- }
-
@Before
public void before() throws Exception {
super.before();
if (!USE_COMMON_LDAP_FIXTURE) {
LDAP_SERVER.setUp();
+ createLdapFixture();
}
options.put(LdapSettings.KEY_HOST, "127.0.0.1");
@@ -150,11 +134,6 @@ public abstract class LdapLoginTestBase
@Test
public void testLoginFailed() throws Exception {
-
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
try {
ContentSession cs = login(new SimpleCredentials(USER_ID, new char[0]));
cs.close();
@@ -168,11 +147,6 @@ public abstract class LdapLoginTestBase
@Test
public void testSyncCreateUser() throws Exception {
-
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, SyncMode.CREATE_USER);
ContentSession cs = null;
@@ -195,10 +169,6 @@ public abstract class LdapLoginTestBase
@Test
public void testSyncCreateGroup() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, SyncMode.CREATE_GROUP);
ContentSession cs = null;
@@ -219,10 +189,6 @@ public abstract class LdapLoginTestBase
@Test
public void testSyncCreateUserAndGroups() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, new String[]{SyncMode.CREATE_USER, SyncMode.CREATE_GROUP});
ContentSession cs = null;
@@ -247,10 +213,6 @@ public abstract class LdapLoginTestBase
@Test
public void testNoSync() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, "");
ContentSession cs = null;
@@ -271,10 +233,6 @@ public abstract class LdapLoginTestBase
@Test
public void testDefaultSync() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, null);
// create user upfront in order to test update mode
@@ -303,10 +261,6 @@ public abstract class LdapLoginTestBase
@Test
public void testSyncUpdate() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, SyncMode.UPDATE);
// create user upfront in order to test update mode
@@ -333,10 +287,6 @@ public abstract class LdapLoginTestBase
@Test
public void testSyncUpdateAndGroups() throws Exception {
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
options.put(ExternalLoginModule.PARAM_SYNC_MODE, new String[]{SyncMode.UPDATE, SyncMode.CREATE_GROUP});
// create user upfront in order to test update mode
@@ -365,23 +315,16 @@ public abstract class LdapLoginTestBase
@Ignore
@Test
public void testConcurrentLogin() throws Exception {
-
concurrentLogin(false);
}
@Ignore
@Test
public void testConcurrentLoginSameGroup() throws Exception {
-
concurrentLogin(true);
}
private void concurrentLogin(boolean sameGroup) throws Exception {
-
- if (!USE_COMMON_LDAP_FIXTURE) {
- createLdapFixture();
- }
-
final List<Exception> exceptions = new ArrayList<Exception>();
List<Thread> workers = new ArrayList<Thread>();
for (int i = 0; i < CONCURRENT_LOGINS; i++) {