You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/05 21:16:37 UTC
svn commit: r375094 -
/directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java
Author: akarasulu
Date: Sun Feb 5 12:16:36 2006
New Revision: 375094
URL: http://svn.apache.org/viewcvs?rev=375094&view=rev
Log:
formatting
Modified:
directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java
Modified: directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java?rev=375094&r1=375093&r2=375094&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java (original)
+++ directory/sandbox/akarasulu/rc1refactor/apacheds/simple/unit/src/main/java/org/apache/ldap/server/AbstractServerTest.java Sun Feb 5 12:16:36 2006
@@ -77,7 +77,6 @@
port = AvailablePortFinder.getNextAvailable( 1024 );
configuration.setLdapPort( port );
configuration.setShutdownHookEnabled( false );
-
setSysRoot( "uid=admin,ou=system", "secret" );
}
@@ -114,11 +113,9 @@
protected LdapContext setSysRoot( String user, String passwd ) throws NamingException
{
Hashtable env = new Hashtable( configuration.toJndiEnvironment() );
-
env.put( Context.SECURITY_PRINCIPAL, user );
env.put( Context.SECURITY_CREDENTIALS, passwd );
env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-
return setSysRoot( env );
}
@@ -137,7 +134,6 @@
Hashtable envFinal = new Hashtable( env );
envFinal.put( Context.PROVIDER_URL, "ou=system" );
envFinal.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
-
return sysRoot = new InitialLdapContext( envFinal, null );
}
@@ -150,19 +146,12 @@
protected void tearDown() throws Exception
{
super.tearDown();
-
Hashtable env = new Hashtable();
-
env.put( Context.PROVIDER_URL, "ou=system" );
-
env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.ServerContextFactory" );
-
env.putAll( new ShutdownConfiguration().toJndiEnvironment() );
-
env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-
env.put( Context.SECURITY_CREDENTIALS, "secret" );
-
try { new InitialContext( env ); } catch( Exception e ) {}
sysRoot = null;
@@ -183,40 +172,28 @@
protected void importLdif( InputStream in ) throws NamingException
{
Hashtable env = new Hashtable();
-
env.putAll( sysRoot.getEnvironment() );
-
LdapContext ctx = new InitialLdapContext( env, null );
-
LdifParser parser = new LdifParserImpl();
try
{
LdifIterator iterator = new LdifIterator( in );
-
while ( iterator.hasNext() )
{
Attributes attributes = new LockableAttributesImpl();
-
String ldif = ( String ) iterator.next();
-
parser.parse( attributes, ldif );
-
Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );
-
dn.remove( 0 );
-
ctx.createSubcontext( dn, attributes );
}
}
catch ( Exception e )
{
String msg = "failed while trying to parse system ldif file";
-
NamingException ne = new LdapConfigurationException( msg );
-
ne.setRootCause( e );
-
throw ne;
}
}