Modified to use DirContentsInitializer.

This commit is contained in:
Robert Sanders 2005-03-24 02:21:08 +00:00
parent 0e9dc00c15
commit 7cfec03a86
1 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,7 @@
package net.sf.acegisecurity.providers.dao.ldap;
import java.io.IOException;
import java.io.InputStream;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingException;
@ -16,6 +18,20 @@ public class BaseLdapTestCase extends TestCase {
// never seems to get the chance to cleanup after itself
protected static LdapTestHelper ldapTestHelper = new LdapTestHelper();
static {
//InputStream in = BaseLdapTestCase.class.getResourceAsStream("net/sf/acegisecurity/providers/dao/ldap/test-data.ldif");
/* InputStream in = ldapTestHelper.getClass().getResourceAsStream("test-data.ldif");
try {
ldapTestHelper.importLDIF(in);
} catch (Exception x) {
x.printStackTrace();
ldapTestHelper.shutdownServer();
ldapTestHelper = null;
throw new RuntimeException("Server initialization failed.");
} */
DirContentsInitializer.initialize( ldapTestHelper.getServerContext() );
}
protected DirContext getClientContext() throws NamingException {
Hashtable env = new Hashtable();
env.put( Context.PROVIDER_URL, "ldap://localhost:389/ou=system" );