directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1071728 [7/7] - in /directory: apacheds/branches/m1/core-annotations/src/main/java/org/apache/directory/server/core/factory/ apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/m1/core-api/src/ma...
Date Thu, 17 Feb 2011 17:50:56 GMT
Modified: directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
(original)
+++ directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
Thu Feb 17 17:50:50 2011
@@ -22,30 +22,26 @@ package org.apache.directory.server.core
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
-import java.io.File;
 import java.security.KeyPair;
 import java.security.cert.X509Certificate;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schemaextractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test for the TlsKeyGenerator class.
@@ -67,6 +63,7 @@ public class TlsKeyGeneratorTest
     @BeforeClass
     public static void setup() throws Exception
     {
+        /*
         String workingDirectory = System.getProperty( "workingDirectory" );
 
         if ( workingDirectory == null )
@@ -79,15 +76,9 @@ public class TlsKeyGeneratorTest
         File schemaRepository = new File( workingDirectory, "schema" );
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
         extractor.extractOrCopy( true );
-        loader = new LdifSchemaLoader( schemaRepository );
-        schemaManager = new DefaultSchemaManager( loader );
-
-        boolean loaded = schemaManager.loadAllEnabled();
-
-        if ( !loaded )
-        {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors())
);
-        }
+        */
+        
+        schemaManager = new DefaultSchemaManager();
     }
 
 
@@ -97,7 +88,7 @@ public class TlsKeyGeneratorTest
     @Test
     public void testAll() throws Exception
     {
-        Entry entry = new DefaultEntry( schemaManager, new Dn() );
+        Entry entry = new DefaultEntry( schemaManager, new Dn( schemaManager ) );
         TlsKeyGenerator.addKeyPair( entry );
         LOG.debug( "Entry: {}", entry );
         assertTrue( entry.contains( SchemaConstants.OBJECT_CLASS_AT, TlsKeyGenerator.TLS_KEY_INFO_OC
) );

Modified: directory/apacheds/branches/m1/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
(original)
+++ directory/apacheds/branches/m1/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
Thu Feb 17 17:50:50 2011
@@ -209,7 +209,7 @@ public class SaslGssapiBindITest extends
 
         // Get a context, create the ou=users subcontext, then create the 3 principals.
         Hashtable<String, Object> env = new Hashtable<String, Object>();
-        env.put( DirectoryService.JNDI_KEY, service );
+        env.put( DirectoryService.JNDI_KEY, getService() );
         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" );
@@ -383,7 +383,7 @@ public class SaslGssapiBindITest extends
     protected void setContexts( String user, String passwd ) throws Exception
     {
         Hashtable<String, Object> env = new Hashtable<String, Object>();
-        env.put( DirectoryService.JNDI_KEY, service );
+        env.put( DirectoryService.JNDI_KEY, getService() );
         env.put( Context.SECURITY_PRINCIPAL, user );
         env.put( Context.SECURITY_CREDENTIALS, passwd );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
@@ -406,7 +406,7 @@ public class SaslGssapiBindITest extends
         sysRoot = new InitialLdapContext( envFinal, null );
 
         envFinal.put( Context.PROVIDER_URL, "" );
-        rootDSE = service.getAdminSession();
+        rootDSE = getService().getAdminSession();
 
         envFinal.put( Context.PROVIDER_URL, SchemaConstants.OU_SCHEMA );
         schemaRoot = new InitialLdapContext( envFinal, null );

Modified: directory/apacheds/branches/m1/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
(original)
+++ directory/apacheds/branches/m1/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Thu Feb 17 17:50:50 2011
@@ -24,10 +24,8 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
 
 import org.apache.directory.ldap.client.api.LdapAsyncConnection;
 import org.apache.directory.ldap.client.api.LdapConnection;
@@ -42,8 +40,11 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.message.*;
+import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
+import org.apache.directory.shared.ldap.model.message.BindResponse;
+import org.apache.directory.shared.ldap.model.message.LdapResult;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.After;
 import org.junit.Before;
@@ -314,7 +315,7 @@ public class SimpleBindRequestTest exten
         {
             // Inject the interceptor that waits 1 second when binding 
             // in order to be able to send a request before we get the response
-            service.getInterceptorChain().addFirst( new BaseInterceptor()
+            getService().getInterceptorChain().addFirst( new BaseInterceptor()
             {
                 /**
                  * Wait 1 second before going any further
@@ -360,7 +361,7 @@ public class SimpleBindRequestTest exten
         }
         finally
         {
-            service.getInterceptorChain().remove( this.getClass().getName() + "$1" );
+            getService().getInterceptorChain().remove( this.getClass().getName() + "$1" );
         }
     }
 

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
Thu Feb 17 17:50:50 2011
@@ -33,6 +33,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.event.NotificationCriteria;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -40,7 +41,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.filter.SearchScope;
-import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.message.Response;
 import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
@@ -82,7 +82,7 @@ public class ReplicaDitStoreUtil
 
     private void init() throws Exception
     {
-        Dn replConsumerDn = new Dn( REPL_CONSUMER_DN );
+        Dn replConsumerDn = new Dn( schemaManager, REPL_CONSUMER_DN );
 
         if ( !adminSession.exists( replConsumerDn ) )
         {
@@ -106,7 +106,7 @@ public class ReplicaDitStoreUtil
         }
 
         Entry entry = new DefaultEntry( schemaManager );
-        entry.setDn( new Dn( "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN
) );
+        entry.setDn( new Dn( schemaManager, "ads-dsReplicaId=" + replica.getId() + "," +
REPL_CONSUMER_DN ) );
 
         entry.add( SchemaConstants.OBJECT_CLASS_AT, "ads-replConsumer" );
         entry.add( "ads-dsReplicaId", String.valueOf( replica.getId() ) );
@@ -146,7 +146,7 @@ public class ReplicaDitStoreUtil
             lastSentCsnAt.add( replica.getLastSentCsn() );
         }
 
-        Dn dn = new Dn( "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN );
+        Dn dn = new Dn( schemaManager, "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN
);
         adminSession.modify( dn, mods );
     }
 
@@ -181,7 +181,7 @@ public class ReplicaDitStoreUtil
         searchCriteria.setAliasDerefMode( AliasDerefMode.getDerefMode( Integer.parseInt(
aliasMode ) ) );
 
         String baseDn = entry.get( "ads-searchBaseDN" ).getString();
-        searchCriteria.setBase( baseDn );
+        searchCriteria.setBase( new Dn( schemaManager, baseDn ) );
 
         String lastSentCsn = entry.get( "ads-replLastSentCsn" ).getString();
         replica.setLastSentCsn( lastSentCsn );

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java
Thu Feb 17 17:50:50 2011
@@ -143,7 +143,7 @@ public class AdministrativePointAddIT ex
     @Before
     public void init() throws Exception
     {
-        connection = IntegrationUtils.getAdminConnection( service );
+        connection = IntegrationUtils.getAdminConnection( getService() );
         schemaManager = ldapServer.getDirectoryService().getSchemaManager();
     }
 

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyDelIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyDelIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyDelIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyDelIT.java
Thu Feb 17 17:50:50 2011
@@ -31,9 +31,12 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.model.entry.*;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultModification;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
+import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -263,7 +266,7 @@ public class AdministrativePointModifyDe
     @Before
     public void init() throws Exception
     {
-        connection = IntegrationUtils.getAdminConnection( service );
+        connection = IntegrationUtils.getAdminConnection( getService() );
         schemaManager = ldapServer.getDirectoryService().getSchemaManager();
     }
 

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointModifyIT.java
Thu Feb 17 17:50:50 2011
@@ -31,11 +31,12 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.model.entry.*;
-import org.apache.directory.shared.ldap.model.entry.DefaultModification;
-import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultModification;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
+import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -264,7 +265,7 @@ public class AdministrativePointModifyIT
     @Before
     public void init() throws Exception
     {
-        connection = IntegrationUtils.getAdminConnection( service );
+        connection = IntegrationUtils.getAdminConnection( getService() );
         schemaManager = ldapServer.getDirectoryService().getSchemaManager();
     }
 

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java
Thu Feb 17 17:50:50 2011
@@ -136,7 +136,7 @@ public class AdministrativePointPersiste
     @Before
     public void init() throws Exception
     {
-        connection = IntegrationUtils.getAdminConnection( service );
+        connection = IntegrationUtils.getAdminConnection( getService() );
         schemaManager = ldapServer.getDirectoryService().getSchemaManager();
     }
 
@@ -182,7 +182,7 @@ public class AdministrativePointPersiste
         ldapServer.start();
         schemaManager = ldapServer.getDirectoryService().getSchemaManager();
 
-        assertTrue( service.isStarted() );
+        assertTrue( getService().isStarted() );
         assertTrue( ldapServer.getDirectoryService().isStarted() );
         
         // Check that the roles are present

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
Thu Feb 17 17:50:50 2011
@@ -92,8 +92,8 @@ public class DelegatedAuthIT extends Abs
     @Test
     public void testDelegatedAuthentication() throws Exception
     {
-        assertTrue( service.isStarted() );
-        assertEquals( "DelegatedAuthIT-method", service.getInstanceId() );
+        assertTrue( getService().isStarted() );
+        assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
         LdapConnection ldapConnection = LdapConnectionFactory.getNetworkConnection( "localhost",
ldapServer.getPort() );
         BindResponse bindResponse = ldapConnection.bind( "uid=antoine,ou=users,ou=system",
"secret" );
         
@@ -170,8 +170,8 @@ public class DelegatedAuthIT extends Abs
     @Test
     public void testMultipleAuthenticators() throws Exception
     {
-        assertTrue( service.isStarted() );
-        assertEquals( "DelegatedAuthIT-MultipleAuthenticators-method", service.getInstanceId()
);
+        assertTrue( getService().isStarted() );
+        assertEquals( "DelegatedAuthIT-MultipleAuthenticators-method", getService().getInstanceId()
);
         LdapConnection ldapConnection = LdapConnectionFactory.getNetworkConnection( "localhost",
ldapServer.getPort() );
         BindResponse bindResponse = ldapConnection.bind( "uid=emmanuel,ou=users,ou=system",
"sesame" );
 

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
Thu Feb 17 17:50:50 2011
@@ -193,7 +193,7 @@ public class SaslBindIT extends Abstract
         modifyRequest.setName( new Dn( "uid=ldap,ou=users,dc=example,dc=com" ) );
         modifyRequest.replace( "userPassword", "randall" );
         modifyRequest.replace( "krb5PrincipalName", servicePrincipal );
-        service.getAdminSession().modify( modifyRequest );
+        getService().getAdminSession().modify( modifyRequest );
     }
 
 

Modified: directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
Thu Feb 17 17:50:50 2011
@@ -33,7 +33,7 @@ import org.apache.directory.server.ldap.
 public abstract class AbstractLdapTestUnit
 {
     /** The used DirectoryService instance */
-    public static DirectoryService service;
+    private static DirectoryService service;
 
     /** The used LdapServer instance */
     public static LdapServer ldapServer;
@@ -43,7 +43,7 @@ public abstract class AbstractLdapTestUn
 
     /** A flag set if the test is run in a suite */
     public static boolean isRunInSuite;
-
+    
 
     public static DirectoryService getService()
     {

Modified: directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Thu Feb 17 17:50:50 2011
@@ -20,6 +20,7 @@ package org.apache.directory.server.core
 
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
@@ -59,6 +60,8 @@ public class FrameworkRunner extends Blo
 
     /** The 'service' field in the run tests */
     private static final String DIRECTORY_SERVICE_FIELD_NAME = "service";
+    private static final String GET_SERVICE_METHOD_NAME = "getService";
+    private static final String SET_SERVICE_METHOD_NAME = "setService";
 
     /** The 'ldapServer' field in the run tests */
     private static final String LDAP_SERVER_FIELD_NAME = "ldapServer";
@@ -389,8 +392,9 @@ public class FrameworkRunner extends Blo
 
             // At this point, we know which service to use.
             // Inject it into the class
-            Field dirServiceField = getTestClass().getJavaClass().getField( DIRECTORY_SERVICE_FIELD_NAME
);
-            dirServiceField.set( getTestClass().getJavaClass(), directoryService );
+            Method setService = getTestClass().getJavaClass().getMethod( SET_SERVICE_METHOD_NAME,
DirectoryService.class );
+            Method getService = getTestClass().getJavaClass().getMethod( GET_SERVICE_METHOD_NAME
);
+            setService.invoke( getTestClass().getJavaClass(), directoryService );
 
             // if we run this class in a suite, tell it to the test
             Field runInSuiteField = getTestClass().getJavaClass().getField( IS_RUN_IN_SUITE_FIELD_NAME
);
@@ -398,8 +402,6 @@ public class FrameworkRunner extends Blo
 
             Field ldapServerField = getTestClass().getJavaClass().getField( LDAP_SERVER_FIELD_NAME
);
 
-            dirServiceField.set( getTestClass().getJavaClass(), directoryService );
-
             DirectoryService oldLdapServerDirService = null;
             DirectoryService oldKdcServerDirService = null;
             

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
Thu Feb 17 17:50:50 2011
@@ -59,11 +59,11 @@ public class TestClassA extends Abstract
     {
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+            assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         }
         
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testClassA,ou=system" )
) );
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testMethodA,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testClassA,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testMethodA,ou=system"
) ) );
     }
 
 
@@ -79,12 +79,12 @@ public class TestClassA extends Abstract
     {
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+            assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         }
 
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testClassA,ou=system" )
) );
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testClassA2,ou=system"
) ) );
-        assertFalse( service.getAdminSession().exists( new Dn( "cn=testMethodA,ou=system"
) ) );
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testMethodWithApplyLdif,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testClassA,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testClassA2,ou=system"
) ) );
+        assertFalse( getService().getAdminSession().exists( new Dn( "cn=testMethodA,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testMethodWithApplyLdif,ou=system"
) ) );
     }
 }

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassB.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassB.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassB.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassB.java
Thu Feb 17 17:50:50 2011
@@ -44,10 +44,10 @@ public class TestClassB extends Abstract
     {
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+            assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         }
 
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testClassB,ou=system" )
) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testClassB,ou=system"
) ) );
     }
     
     
@@ -57,12 +57,12 @@ public class TestClassB extends Abstract
         // this assertion will only work if ran as part of TestSuite
         // commenting this to make maven report test success, uncomment in an IDE
         // while running the TestSuite
-        // assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+        // assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+            assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         }
 
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testClassB,ou=system" )
) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testClassB,ou=system"
) ) );
     }
 }

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassC.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassC.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassC.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassC.java
Thu Feb 17 17:50:50 2011
@@ -35,14 +35,14 @@ public class TestClassC extends Abstract
     {
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
+            assertTrue( getService().getAdminSession().exists( new Dn( "cn=testSuite,ou=system"
) ) );
         }
 
-        assertFalse( service.getAdminSession().exists( new Dn( "cn=testClassC,ou=system"
) ) );
+        assertFalse( getService().getAdminSession().exists( new Dn( "cn=testClassC,ou=system"
) ) );
         
         // the below Dn will be injected in TestClassB when ran as suite, but that Dn
         // shouldn't be present in the suite level DS cause of revert operation
-        assertFalse( service.getAdminSession().exists( new Dn( "cn=testClassB,ou=system"
) ) );
+        assertFalse( getService().getAdminSession().exists( new Dn( "cn=testClassB,ou=system"
) ) );
     }
     
     
@@ -50,7 +50,7 @@ public class TestClassC extends Abstract
     @ApplyLdifFiles( "test-entry.ldif" )
     public void testWithApplyLdifFiles() throws Exception
     {
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
     }
 }

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassServer.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassServer.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassServer.java
Thu Feb 17 17:50:50 2011
@@ -32,13 +32,13 @@ public class TestClassServer extends Abs
     @ApplyLdifFiles( "test-entry.ldif" )
     public void testWithApplyLdifFiles() throws Exception
     {
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
         
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "dc=example,dc=com" ) )
);
+            assertTrue( getService().getAdminSession().exists( new Dn( "dc=example,dc=com"
) ) );
         }
         
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
     }
 }

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestMultiLevelDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestMultiLevelDS.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestMultiLevelDS.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestMultiLevelDS.java
Thu Feb 17 17:50:50 2011
@@ -44,10 +44,10 @@ public class TestMultiLevelDS extends Ab
         // to make this test pass standalone
         if( isRunInSuite )
         {
-            assertTrue( ldapServer.getDirectoryService() == service );
+            assertTrue( ldapServer.getDirectoryService() == getService() );
         }
-        assertFalse( service.isAccessControlEnabled() );
-        assertEquals( "TestMultiLevelDS-class", service.getInstanceId() );
+        assertFalse( getService().isAccessControlEnabled() );
+        assertEquals( "TestMultiLevelDS-class", getService().getInstanceId() );
     }
     
     
@@ -58,9 +58,9 @@ public class TestMultiLevelDS extends Ab
         // to make this test pass standalone
         if( isRunInSuite )
         {
-            assertTrue( ldapServer.getDirectoryService() == service );
+            assertTrue( ldapServer.getDirectoryService() == getService() );
         }
-        assertTrue( service.isAccessControlEnabled() );
-        assertEquals( "testMethodWithClassLevelDs-method", service.getInstanceId() );
+        assertTrue( getService().isAccessControlEnabled() );
+        assertEquals( "testMethodWithClassLevelDs-method", getService().getInstanceId() );
     }
 }

Modified: directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestWithClassLevelLdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestWithClassLevelLdapServer.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestWithClassLevelLdapServer.java
(original)
+++ directory/apacheds/branches/m1/test-framework/src/test/java/org/apache/directory/server/core/integ/TestWithClassLevelLdapServer.java
Thu Feb 17 17:50:50 2011
@@ -41,11 +41,11 @@ public class TestWithClassLevelLdapServe
     @ApplyLdifFiles( "test-entry.ldif" )
     public void testWithApplyLdifFiles() throws Exception
     {
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson1,ou=system"
) ) );
         
         if ( isRunInSuite )
         {
-            assertTrue( service.getAdminSession().exists( new Dn( "dc=example,dc=com" ) )
);
+            assertTrue( getService().getAdminSession().exists( new Dn( "dc=example,dc=com"
) ) );
             // the SuiteDS is the name given to the DS instance in the enclosing TestSuite
             assertEquals( "SuiteDS", ldapServer.getDirectoryService().getInstanceId() );
         }
@@ -54,7 +54,7 @@ public class TestWithClassLevelLdapServe
             assertTrue( ldapServer.getDirectoryService().getInstanceId().startsWith( "default"
) ); // after 'default' a UUID follows
         }
         
-        assertTrue( service.getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
+        assertTrue( getService().getAdminSession().exists( new Dn( "cn=testPerson2,ou=system"
) ) );
         
         assertNotNull( ldapServer );
     }

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1071728&r1=1071727&r2=1071728&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Thu Feb 17 17:50:50 2011
@@ -413,6 +413,43 @@ public final class Dn implements Iterabl
 
 
     /**
+     * Creates a Dn concatenating a Rdn and a Dn.
+     *
+     * @param rdns the list of Rdns to be used for the Dn
+     */
+    public Dn( SchemaManager schemaManager, Dn dn ) throws LdapInvalidDnException
+    {
+        if ( dn == null )
+        {
+            throw new IllegalArgumentException( "The dn is null" );
+        }
+        
+        for ( Rdn rdnParent : dn )
+        {
+            rdns.add( rdnParent );
+        }
+        
+        normalized = new AtomicBoolean();
+        this.schemaManager = schemaManager;
+
+        if ( schemaManager != null )
+        {
+            normalize( schemaManager.getNormalizerMapping() );
+        }
+        else
+        {
+            normalized.set( false );
+
+            // Stores the representations of a Dn : internal (as a string and as a
+            // byte[]) and external.
+            normalizeInternal();
+        }
+
+        toUpName();
+    }
+
+
+    /**
      * Creates a Schema aware Dn from a list of Rdns.
      *
      *  @param schemaManager The SchemaManager to use
@@ -433,7 +470,13 @@ public final class Dn implements Iterabl
         try
         {
             normalized = new AtomicBoolean( false );
-            normalize( schemaManager );
+            
+            if ( this.schemaManager != null )
+            {
+                normalize( schemaManager.getNormalizerMapping() );
+            }
+
+            normalizeInternal();
             toUpName();
         }
         catch( LdapInvalidDnException lide )
@@ -1220,7 +1263,9 @@ public final class Dn implements Iterabl
         {
             if ( schemaManager != null )
             {
-                clonedDn.normalize( schemaManager );
+                clonedDn.normalize( schemaManager.getNormalizerMapping() );
+
+                normalizeInternal();
             }
             else
             {
@@ -1254,7 +1299,7 @@ public final class Dn implements Iterabl
 
         if ( schemaManager != null )
         {
-            clonedDn.normalize( schemaManager );
+            clonedDn.normalize( schemaManager.getNormalizerMapping() );
         }
         else
         {
@@ -1294,7 +1339,7 @@ public final class Dn implements Iterabl
             {
                 if ( schemaManager != null )
                 {
-                    clonedDn.normalize( schemaManager );
+                    clonedDn.normalize( schemaManager.getNormalizerMapping() );
                 }
                 else
                 {
@@ -1336,7 +1381,7 @@ public final class Dn implements Iterabl
 
         if ( schemaManager != null )
         {
-            clonedDn.normalize( schemaManager );
+            clonedDn.normalize( schemaManager.getNormalizerMapping() );
         }
         else
         {



Mime
View raw message