directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r122668 - /incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java /incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java
Date Fri, 17 Dec 2004 19:30:37 GMT
Author: akarasulu
Date: Fri Dec 17 11:30:34 2004
New Revision: 122668

URL: http://svn.apache.org/viewcvs?view=rev&rev=122668
Log:
getting test cases to work again
Modified:
   incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java
   incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java

Modified: incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java?view=diff&rev=122668&p1=incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java&r1=122667&p2=incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java&r2=122668
==============================================================================
--- incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java
(original)
+++ incubator/directory/kerberos/trunk/store/src/java/org/apache/kerberos/kdc/EmbeddedEveStore.java
Fri Dec 17 11:30:34 2004
@@ -27,13 +27,12 @@
 import org.apache.kerberos.kdc.store.PrincipalStore;
 import org.apache.kerberos.kdc.store.PrincipalStoreEntry;
 import org.apache.kerberos.kdc.store.PrincipalStoreEntryModifier;
-import org.apache.eve.jndi.EveContextFactory;
 import org.apache.ldap.common.util.NestableRuntimeException;
-import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.ldif.LdifIterator;
-import org.apache.ldap.common.ldif.LdifParserImpl;
 import org.apache.ldap.common.ldif.LdifParser;
+import org.apache.ldap.common.ldif.LdifParserImpl;
 import org.apache.ldap.common.message.LockableAttributesImpl;
+import com.sun.jndi.ldap.LdapName;
 
 
 /**
@@ -84,7 +83,7 @@
     public EmbeddedEveStore( Hashtable env )
     {
         this.env = ( Hashtable ) env.clone();
-        this.env.put( Context.INITIAL_CONTEXT_FACTORY, EveContextFactory.class.getName()
);
+        this.env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.eve.jndi.EveContextFactory"
);
     }
 
 
@@ -101,7 +100,6 @@
     public void init()
     {
         LdapName ctxRoot;
-        boolean isFirstStart = false;
 
         try
         {
@@ -149,25 +147,6 @@
                 fault = new NestableRuntimeException( msg, e );
                 throw fault;
             }
-        }
-
-
-        // check and see if we have the search base if not we create it
-        try
-        {
-            Attributes attrs = ctx.getAttributes( searchBaseDn );
-            if ( attrs == null )
-            {
-                isFirstStart = true;
-            }
-        }
-        catch ( NamingException e )
-        {
-            // @todo for now until we can find a better means of error handling
-            e.printStackTrace();
-            String msg = "looks like the context does not exist";
-            isFirstStart = true;
-            System.out.println( msg );
         }
 
         // An LDIF must be loaded if this is the first time we're starting

Modified: incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java?view=diff&rev=122668&p1=incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java&r1=122667&p2=incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java&r2=122668
==============================================================================
--- incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java
(original)
+++ incubator/directory/kerberos/trunk/store/src/test/org/apache/kerberos/kdc/EmbeddedEveStoreTest.java
Fri Dec 17 11:30:34 2004
@@ -31,6 +31,7 @@
 import org.apache.eve.jndi.EnvKeys;
 import org.apache.ldap.common.util.PropertiesUtils;
 import org.apache.commons.io.FileUtils;
+import org.apache.seda.listener.AvailablePortFinder;
 
 
 /**
@@ -88,37 +89,20 @@
         env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.eve.jndi.EveContextFactory"
);
         env.put( EnvKeys.SHUTDOWN, "" );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        env.put( Context.SECURITY_CREDENTIALS, "testing" );
+        env.put( Context.SECURITY_CREDENTIALS, "secret" );
         try { new InitialContext( env ); } catch( Exception e ) {}
     }
 
 
-    public void testLoadFromEtc() throws Exception
-    {
-        Properties env = PropertiesUtils.getProperties( new File( "./etc/kerberos.properties"
) );
-
-        EmbeddedEveStore store = new EmbeddedEveStore( env );
-        store.init();
-
-        assertNull( store.getEntry( null ) );
-
-        KerberosPrincipal akarasulu = new KerberosPrincipal( "akarasulu@EXAMPLE.COM" );
-        assertNotNull( store.getEntry( akarasulu ) );
-
-        KerberosPrincipal erodriguez = new KerberosPrincipal( "erodriguez@EXAMPLE.COM" );
-        assertNotNull( store.getEntry( erodriguez ) );
-
-        KerberosPrincipal nonexistent = new KerberosPrincipal( "nonexistent@EXAMPLE.COM"
);
-        assertNull( store.getEntry( nonexistent ) );
-    }
-
-
     public void testEveStoreHardCodedProperties() throws Exception
     {
         Hashtable env = new Hashtable();
         env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.eve.jndi.EveContextFactory"
);
         env.put( EnvKeys.WKDIR, "target" + File.separator + "eve" );
+        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
 
         BasicAttributes attrs = new BasicAttributes( true );
         BasicAttribute attr = new BasicAttribute( "objectClass" );
@@ -134,6 +118,22 @@
         env.put( EnvKeys.SUFFIX + "example", "dc=example,dc=com" );
         env.put( EnvKeys.INDICES + "example", "ou objectClass" );
         env.put( EnvKeys.ATTRIBUTES + "example", attrs );
+        
+        if ( ! AvailablePortFinder.available( 389 )  )
+        {
+            env.put( EnvKeys.LDAP_PORT,
+                  new Integer( AvailablePortFinder.getNextAvailable( 1024 ) ) );
+        }
+
+
+        StringBuffer schemas = new StringBuffer();
+        schemas.append( "org.apache.eve.schema.bootstrap.SystemSchema " );
+        schemas.append( "org.apache.eve.schema.bootstrap.EveSchema " );
+        schemas.append( "org.apache.eve.schema.bootstrap.CoreSchema " );
+        schemas.append( "org.apache.eve.schema.bootstrap.CosineSchema " );
+        schemas.append( "org.apache.eve.schema.bootstrap.InetorgpersonSchema " );
+        schemas.append( "org.apache.eve.schema.bootstrap.Krb5kdcSchema " );
+        env.put( EnvKeys.SCHEMAS, schemas.toString() );
 
         env.put( EmbeddedEveStore.KDC_ENTRY_LDIF_FILE, "./src/ldif/example.com" );
         env.put( EmbeddedEveStore.KDC_ENTRY_BASEDN_KEY, "ou=Users,dc=example,dc=com" );

Mime
View raw message