directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r680789 - in /directory/apacheds/branches/bigbang/server-integ/src: main/java/org/apache/directory/server/integ/ main/java/org/apache/directory/server/integ/state/ test/java/org/apache/directory/server/referral/ test/resources/
Date Tue, 29 Jul 2008 17:50:32 GMT
Author: akarasulu
Date: Tue Jul 29 10:50:31 2008
New Revision: 680789

URL: http://svn.apache.org/viewvc?rev=680789&view=rev
Log:
setting up to fix referral issues using server-integ framework features

Added:
    directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/
    directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
  (with props)
Modified:
    directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
    directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
    directory/apacheds/branches/bigbang/server-integ/src/test/resources/log4j.properties

Modified: directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java?rev=680789&r1=680788&r2=680789&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
(original)
+++ directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
Tue Jul 29 10:50:31 2008
@@ -22,6 +22,7 @@
 import java.util.Hashtable;
 
 import javax.naming.Context;
+import javax.naming.ldap.Control;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
@@ -50,6 +51,21 @@
      */
     public static LdapContext getWiredContext( LdapServer ldapServer ) throws Exception
     {
+        return getWiredContext( ldapServer, null );
+    }
+
+
+    /**
+     * Creates a JNDI LdapContext with a connection over the wire using the 
+     * SUN LDAP provider.  The connection is made using the administrative 
+     * user as the principalDN.  The context is to the rootDSE.
+     *
+     * @param ldapServer the LDAP server to get the connection to
+     * @return an LdapContext as the administrative user to the RootDSE
+     * @throws Exception if there are problems creating the context
+     */
+    public static LdapContext getWiredContext( LdapServer ldapServer, Control[] controls
) throws Exception
+    {
         LOG.debug( "Creating a wired context to local LDAP server on port {}", ldapServer.getIpPort()
);
         Hashtable<String, String> env = new Hashtable<String, String>();
         env.put( Context.INITIAL_CONTEXT_FACTORY, CTX_FACTORY );
@@ -57,6 +73,6 @@
         env.put( Context.SECURITY_PRINCIPAL, ServerDNConstants.ADMIN_SYSTEM_DN );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        return new InitialLdapContext( env, null );
+        return new InitialLdapContext( env, controls );
     }
 }

Modified: directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java?rev=680789&r1=680788&r2=680789&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
(original)
+++ directory/apacheds/branches/bigbang/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
Tue Jul 29 10:50:31 2008
@@ -193,6 +193,7 @@
                     
                     LdapContext root = IntegrationUtils.getRootContext( service );
                     root.createSubcontext( entry.getDn(), entry.getAttributes() );
+                    LOG.debug( "Injected LDIF for test {}: {}", settings.getDescription(),
ldif );
                 }
                 catch ( Exception e )
                 {

Added: directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java?rev=680789&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
(added)
+++ directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
Tue Jul 29 10:50:31 2008
@@ -0,0 +1,105 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.server.referral;
+
+
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.ServerIntegrationUtils;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.newldap.LdapServer;
+import org.apache.directory.shared.ldap.message.ManageDsaITControl;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Server integration tests for proper referral handling.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith ( SiRunner.class ) 
+@CleanupLevel ( Level.CLASS )
+public class ReferralIT
+{
+    private static final Logger LOG = LoggerFactory.getLogger( ReferralIT.class );
+    
+    public static LdapServer ldapServer;
+    
+
+    @Test
+    public void testBind() throws Exception
+    {
+    }
+    
+    
+    @Test
+    @ApplyLdifs( {
+        // Entry # 1
+        "dn: uid=akarasulu,ou=users,ou=system\n" +
+        "objectClass: uidObject\n" +
+        "objectClass: person\n" +
+        "objectClass: top\n" +
+        "uid: akarasulu\n" +
+        "cn: Alex Karasulu\n" +
+        "sn: karasulu\n\n" + 
+        // Entry # 2
+        "dn: uid=akarasuluref,ou=users,ou=system\n" +
+        "objectClass: uidObject\n" +
+        "objectClass: referral\n" +
+        "objectClass: top\n" +
+        "uid: akarasuluref\n" +
+        "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system\n\n" 
+        }
+    )
+    @Ignore ( "Broken for now" )
+    public void testSearch() throws Exception
+    {
+        LdapContext ctx = ServerIntegrationUtils.getWiredContext( ldapServer,
+            new Control[] { new ManageDsaITControl() } );
+        
+        NamingEnumeration<SearchResult> results = ctx.search( "ou=users,ou=system",

+            "(objectClass=*)", new SearchControls() );
+        while ( results.hasMore() )
+        {
+            LOG.debug( "testSearch() search result = {}", results.next() );
+        }
+        
+        ctx.getAttributes( "uid=akarasulu,ou=users,ou=system" );
+        ctx.getAttributes( "uid=akarasuluref,ou=users,ou=system" );
+    }
+
+
+    @Test
+    public void testBlah() throws Exception
+    {
+    }
+}

Propchange: directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/apacheds/branches/bigbang/server-integ/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/test/resources/log4j.properties?rev=680789&r1=680788&r2=680789&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/branches/bigbang/server-integ/src/test/resources/log4j.properties Tue
Jul 29 10:50:31 2008
@@ -21,4 +21,5 @@
 log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 log4j.logger.org.apache.directory.server.core.integ=ERROR
 
-#log4j.logger.org.apache.directory.server.core.partition.PartitionIT=DEBUG
+log4j.logger.org.apache.directory.server.integ=DEBUG
+log4j.logger.org.apache.directory.server.referral.ReferralIT=DEBUG



Mime
View raw message