directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r586084 [4/4] - in /directory/sandbox/djencks/triplesec-jacc2: ./ admin-api2/src/main/java/org/apache/directory/triplesec/admin/ admin-api2/src/test/java/org/apache/directory/triplesec/admin/ changelog/src/main/java/org/apache/directory/tri...
Date Thu, 18 Oct 2007 19:02:13 GMT
Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/ApplicationACIManagerITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/ApplicationACIManagerITest.java?rev=586084&r1=586083&r2=586084&view=diff
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/ApplicationACIManagerITest.java
(original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/ApplicationACIManagerITest.java
Thu Oct 18 12:02:07 2007
@@ -34,10 +34,10 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.Krb5kdcSchema;
@@ -75,12 +75,12 @@
         schemas.add( new TriplesecSchema() );
 //        config.setBootstrapSchemas( schemas );
         loader.loadWithDependencies( schemas, bsRegistries );
-        super.configuration.setShutdownHookEnabled( false );
+        service.setShutdownHookEnabled( false );
         
-        MutablePartitionConfiguration partitionCfg = new MutablePartitionConfiguration();
+        JdbmPartition partitionCfg = new JdbmPartition();
 //        partitionCfg.setName( "example" );
         //????
-        partitionCfg.setName( "example" );
+        partitionCfg.setId( "example" );
         partitionCfg.setSuffix( "dc=example,dc=com" );
         Attributes ctxEntry = new AttributesImpl();
         ctxEntry.put( "objectClass", "top" );
@@ -89,31 +89,31 @@
         partitionCfg.setContextEntry( ctxEntry );
 //        partitionCfg.setContextPartition( new JdbmPartition() );
 
-        Set partitions = super.configuration.getPartitionConfigurations();
+        Set<Partition> partitions = new HashSet<Partition>(service.getPartitions());
         partitions.add( partitionCfg );
-        super.configuration.setPartitionConfigurations( partitions );
+        service.setPartitions( partitions );
 
-        List<Interceptor> interceptors = super.configuration.getInterceptors();
+        List<Interceptor> interceptors = service.getInterceptors();
         interceptors.add( new PolicyProtectionInterceptor() );
-        super.configuration.setInterceptors( interceptors );
-        super.configuration.setAccessControlEnabled( true );
+        service.setInterceptors( interceptors );
+        service.setAccessControlEnabled( true );
         
         super.overrideEnvironment( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName()
);
         super.overrideEnvironment( Context.STATE_FACTORIES, ProfileStateFactory.class.getName()
);
         super.setLdifPath( "/server.ldif", getClass() );
         super.setUp();
 
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, "" );
-        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        env.put( Configuration.JNDI_KEY, super.configuration );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, "" );
+//        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+//        env.put( Configuration.JNDI_KEY, super.configuration );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
 
-        ctx = new InitialDirContext( env );
+        ctx = service.getJndiContext( "" );
     }
 
 
@@ -132,17 +132,17 @@
         
         LdapDN dn = new LdapDN( "appName="+appName+",ou=Applications,dc=example,dc=com" );
 
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
-        env.put( Context.SECURITY_PRINCIPAL, dn.getUpName() );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, userPassword );
-        env.put( Configuration.JNDI_KEY, super.configuration );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
+//        env.put( Context.SECURITY_PRINCIPAL, dn.getUpName() );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, userPassword );
+//        env.put( Configuration.JNDI_KEY, super.configuration );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
 
-        InitialDirContext ctx = new InitialDirContext( env );
+        DirContext ctx = service.getJndiContext( "dc=example,dc=com" );
 
         try
         {
@@ -229,17 +229,17 @@
         
         LdapDN dn = new LdapDN( "appName="+appName+",ou=Applications,dc=example,dc=com" );
 
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, dn.getUpName() );
-        env.put( Context.SECURITY_PRINCIPAL, dn.getUpName() );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, userPassword );
-        env.put( Configuration.JNDI_KEY, super.configuration );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, dn.getUpName() );
+//        env.put( Context.SECURITY_PRINCIPAL, dn.getUpName() );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, userPassword );
+//        env.put( Configuration.JNDI_KEY, super.configuration );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
 
-        return new InitialDirContext( env );
+        return service.getJndiContext( dn.getUpName() );
     }
     
     

Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java?rev=586084&r1=586083&r2=586084&view=diff
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
(original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/apache/directory/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
Thu Oct 18 12:02:07 2007
@@ -21,7 +21,6 @@
 
 
 import java.util.HashSet;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Set;
 
@@ -32,14 +31,13 @@
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SchemaViolationException;
 
 import junit.framework.Assert;
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.interceptor.Interceptor;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
@@ -75,12 +73,12 @@
         schemas.add( new TriplesecSchema() );
 //        config.setBootstrapSchemas( schemas );
         loader.loadWithDependencies( schemas, bsRegistries );
-        super.configuration.setShutdownHookEnabled( false );
-        super.configuration.setAccessControlEnabled( true );
-        
-        MutablePartitionConfiguration partitionCfg = new MutablePartitionConfiguration();
+//        super.configuration.setShutdownHookEnabled( false );
+        service.setAccessControlEnabled( true );
+
+        JdbmPartition partitionCfg = new JdbmPartition();
         //?? was setName
-        partitionCfg.setName( "example" );
+        partitionCfg.setId( "example" );
         partitionCfg.setSuffix( "dc=example,dc=com" );
         Attributes ctxEntry = new BasicAttributes();
         ctxEntry.put( "objectClass", "top" );
@@ -88,30 +86,30 @@
         partitionCfg.setContextEntry( ctxEntry );
 //        partitionCfg.setContextPartition( new JdbmPartition() );
 
-        Set partitions = super.configuration.getPartitionConfigurations();
+        Set<Partition> partitions = new HashSet<Partition>(service.getPartitions());
         partitions.add( partitionCfg );
-        super.configuration.setPartitionConfigurations( partitions );
+        service.setPartitions( partitions );
 
-        List<Interceptor> interceptors = super.configuration.getInterceptors();
+        List<Interceptor> interceptors = service.getInterceptors();
         interceptors.add( new PolicyProtectionInterceptor() );
-        super.configuration.setInterceptors( interceptors );
+        service.setInterceptors( interceptors );
 
         super.overrideEnvironment( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName()
);
         super.overrideEnvironment( Context.STATE_FACTORIES, ProfileStateFactory.class.getName()
);
         super.setLdifPath( "/server.ldif", getClass() );
         super.setUp();
 
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, "" );
-        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        env.put( Configuration.JNDI_KEY, super.configuration );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, "" );
+//        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+//        env.put( Configuration.JNDI_KEY, super.configuration );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
 
-        ctx = new InitialDirContext( env );
+        ctx = service.getJndiContext( "" );
     }
 
 

Modified: directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/GenerateHotp.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/GenerateHotp.java?rev=586084&r1=586083&r2=586084&view=diff
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/GenerateHotp.java
(original)
+++ directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/GenerateHotp.java
Thu Oct 18 12:02:07 2007
@@ -20,39 +20,37 @@
 package org.apache.directory.triplesec.verifier.hotp;
 
 
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
 
-import javax.security.auth.kerberos.KerberosPrincipal;
 import javax.naming.NamingException;
-import javax.naming.Context;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.security.auth.kerberos.KerberosPrincipal;
 
-import org.apache.directory.triplesec.store.*;
-import org.apache.directory.triplesec.store.schema.TriplesecSchema;
-import org.apache.directory.triplesec.profile.ServerProfile;
-import org.apache.directory.triplesec.profile.BaseServerProfileModifier;
-import org.apache.directory.triplesec.otp.Hotp;
-import org.apache.directory.triplesec.otp.Base64;
-import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
-//import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.bootstrap.CosineSchema;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.bootstrap.Krb5kdcSchema;
-import org.apache.directory.server.schema.bootstrap.InetorgpersonSchema;
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.CosineSchema;
+import org.apache.directory.server.schema.bootstrap.InetorgpersonSchema;
+import org.apache.directory.server.schema.bootstrap.Krb5kdcSchema;
 import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
+import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.triplesec.otp.Base64;
+import org.apache.directory.triplesec.otp.Hotp;
+import org.apache.directory.triplesec.profile.BaseServerProfileModifier;
+import org.apache.directory.triplesec.profile.ServerProfile;
+import org.apache.directory.triplesec.store.DefaultServerProfileStore;
+import org.apache.directory.triplesec.store.ServerProfileStore;
+import org.apache.directory.triplesec.store.schema.TriplesecSchema;
 
 
 /**
@@ -76,11 +74,10 @@
         {
             principal = DEFAULT_PRINCIPAL;
 
-            MutableStartupConfiguration config = new MutableStartupConfiguration();
+            DefaultDirectoryService config = new DefaultDirectoryService();
 
-            MutablePartitionConfiguration partConfig = new MutablePartitionConfiguration();
-//            partConfig.setName( "example" );
-            partConfig.setName( "example" );
+            JdbmPartition partConfig = new JdbmPartition();
+            partConfig.setId( "example" );
 
             HashSet indices = new HashSet();
             indices.add( "dc" );
@@ -112,21 +109,21 @@
             schemas.add( new Krb5kdcSchema() );
 //            config.setBootstrapSchemas( schemas );
             loader.loadWithDependencies( schemas, bsRegistries );
-            config.setPartitionConfigurations( Collections.singleton( partConfig ) );
+            config.setPartitions( Collections.singleton( partConfig ) );
 
             partConfig.setSuffix( "dc=example,dc=com" );
 
-            Hashtable env = new Hashtable();
-            env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-            env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
-            env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-            env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-            env.put( Context.SECURITY_CREDENTIALS, "secret" );
-            env.put( Configuration.JNDI_KEY, config );
-            env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-            env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//            Hashtable env = new Hashtable();
+//            env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//            env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
+//            env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+//            env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//            env.put( Context.SECURITY_CREDENTIALS, "secret" );
+//            env.put( Configuration.JNDI_KEY, config );
+//            env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//            env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
 
-            DirContext userContext = new InitialDirContext( env );
+            DirContext userContext = config.getJndiContext( "dc=example,dc=com" );
             try
             {
                 userContext = ( DirContext ) userContext.lookup( "ou=users" );

Modified: directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/HotpSamVerifierITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/HotpSamVerifierITest.java?rev=586084&r1=586083&r2=586084&view=diff
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/HotpSamVerifierITest.java
(original)
+++ directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/apache/directory/triplesec/verifier/hotp/HotpSamVerifierITest.java
Thu Oct 18 12:02:07 2007
@@ -20,24 +20,29 @@
 package org.apache.directory.triplesec.verifier.hotp;
 
 
-import java.io.IOException;
 import java.io.File;
-import java.util.*;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.Context;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import junit.framework.TestCase;
-
 import org.apache.commons.io.FileUtils;
-import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.partition.impl.btree.Index;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.kerberos.sam.SamException;
+import org.apache.directory.server.kerberos.sam.TimestampChecker;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.io.encoder.EncryptedDataEncoder;
@@ -46,35 +51,26 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStampModifier;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.sam.SamException;
-import org.apache.directory.server.kerberos.sam.TimestampChecker;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
-import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
-import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
+import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.CosineSchema;
 import org.apache.directory.server.schema.bootstrap.InetorgpersonSchema;
 import org.apache.directory.server.schema.bootstrap.Krb5kdcSchema;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
-import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
+import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.triplesec.otp.Hotp;
 import org.apache.directory.triplesec.otp.HotpErrorConstants;
 import org.apache.directory.triplesec.otp.ResynchParameters;
 import org.apache.directory.triplesec.profile.ServerProfile;
 import org.apache.directory.triplesec.store.DefaultServerProfileStore;
 import org.apache.directory.triplesec.store.ServerProfileStore;
-import org.apache.directory.triplesec.store.ProfileStateFactory;
-import org.apache.directory.triplesec.store.ProfileObjectFactory;
 import org.apache.directory.triplesec.store.schema.TriplesecSchema;
 
 
@@ -99,26 +95,25 @@
 
     protected void setUp() throws Exception
     {
-        File workingDirectory = new File ( System.getProperty( "workingDirectory", "target/working")
); 
-        if ( ! workingDirectory.exists() ) 
+        File workingDirectory = new File( System.getProperty( "workingDirectory", "target/working"
) );
+        if ( !workingDirectory.exists() )
         {
             workingDirectory.mkdirs();
         }
         FileUtils.forceDelete( workingDirectory );
-        
-        MutableStartupConfiguration config = new MutableStartupConfiguration();
+
+        DefaultDirectoryService config = new DefaultDirectoryService();
         config.setWorkingDirectory( workingDirectory );
         config.setShutdownHookEnabled( false );
-        MutablePartitionConfiguration partConfig = new MutablePartitionConfiguration();
-//        partConfig.setName( "example" );
-        partConfig.setName( "example" );
-
-        HashSet indices = new HashSet();
-        indices.add( "dc" );
-        indices.add( "ou" );
-        indices.add( "objectClass" );
-        indices.add( "krb5PrincipalName" );
-        indices.add( "uid" );
+        JdbmPartition partConfig = new JdbmPartition();
+        partConfig.setId( "example" );
+
+        HashSet<Index> indices = new HashSet<Index>();
+        indices.add( new JdbmIndex( "dc" ) );
+        indices.add( new JdbmIndex( "ou" ) );
+        indices.add( new JdbmIndex( "objectClass" ) );
+        indices.add( new JdbmIndex( "krb5PrincipalName" ) );
+        indices.add( new JdbmIndex( "uid" ) );
         partConfig.setIndexedAttributes( indices );
 
         partConfig.setSuffix( "dc=example,dc=com" );
@@ -143,30 +138,30 @@
         schemas.add( new Krb5kdcSchema() );
 //            config.setBootstrapSchemas( schemas );
         loader.loadWithDependencies( schemas, bsRegistries );
-        config.setPartitionConfigurations( Collections.singleton( partConfig ) );
-
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
-        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        env.put( Configuration.JNDI_KEY, config );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+        config.setPartitions( Collections.singleton( partConfig ) );
 
-        userContext = new InitialDirContext( env );
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
+//        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+//        env.put( Configuration.JNDI_KEY, config );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+        config.startup();
+        userContext = config.getJndiContext( "dc=example,dc=com" );
         try
         {
             userContext = ( DirContext ) userContext.lookup( "ou=users" );
         }
         catch ( NamingException e )
         {
-            Attributes users = new AttributesImpl( );
+            Attributes users = new AttributesImpl();
             Attribute ocAttr = new AttributeImpl( "objectClass" );
             ocAttr.add( "top" );
             ocAttr.add( "organizationalUnit" );
-            users.put(ocAttr);
+            users.put( ocAttr );
 //            users.get( "objectClass" ).add( "organizationalUnit" );
             users.put( "ou", "users" );
             userContext = userContext.createSubcontext( "ou=users", users );
@@ -182,18 +177,18 @@
     protected void tearDown() throws Exception
     {
         userContext.close();
-        ShutdownConfiguration config = new ShutdownConfiguration();
-        Hashtable env = new Hashtable();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
-        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
-        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        env.put( Configuration.JNDI_KEY, config );
-        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
-        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
-        new InitialDirContext( env );
-        
+//        ShutdownConfiguration config = new ShutdownConfiguration();
+//        Hashtable env = new Hashtable();
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+//        env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
+//        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+//        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+//        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+//        env.put( Configuration.JNDI_KEY, config );
+//        env.put( Context.STATE_FACTORIES, ProfileStateFactory.class.getName() );
+//        env.put( Context.OBJECT_FACTORIES, ProfileObjectFactory.class.getName() );
+//        new InitialDirContext( env );
+
         userContext = null;
         store = null;
     }
@@ -203,7 +198,7 @@
      * Generates the encrypted time stamp using a KerberosKey to mimic clients
      *
      * @param kerberosKey the kerberos key (from hotp value)
-     * @param time the kerberos time for timestamp
+     * @param time        the kerberos time for timestamp
      * @return the encrypted time stamp
      */
     private byte[] generateSad( KerberosKey kerberosKey, KerberosTime time )
@@ -227,11 +222,11 @@
             // Encode the EncryptedData
             sad = EncryptedDataEncoder.encode( encryptedData );
         }
-        catch (IOException ioe)
+        catch ( IOException ioe )
         {
             ioe.printStackTrace();
         }
-        catch (KerberosException ke)
+        catch ( KerberosException ke )
         {
             ke.printStackTrace();
         }
@@ -275,7 +270,7 @@
         int ii = 0;
         final int limit = ResynchParameters.DEFAULTS.getLockoutCount();
 
-        for (; ii < limit; ii++ )
+        for ( ; ii < limit; ii++ )
         {
             char[] hotp = "123456".toCharArray();
             KerberosKey key = new KerberosKey( akarasulu, hotp, "DES" );
@@ -285,7 +280,7 @@
             {
                 samVerifierDefault.verify( akarasulu, sad );
             }
-            catch( SamException e )
+            catch ( SamException e )
             {
                 assertEquals( HotpErrorConstants.HOTPAUTH_FAILURE_MSG, e.getMessage() );
             }



Mime
View raw message