directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szoer...@apache.org
Subject svn commit: r328742 - /directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java
Date Wed, 26 Oct 2005 21:29:11 GMT
Author: szoerner
Date: Wed Oct 26 14:29:07 2005
New Revision: 328742

URL: http://svn.apache.org/viewcvs?rev=328742&view=rev
Log:
Added a new test method testAnonymousBindsEnabledBaseSearch in order to cover a problem which
is described in DIREVE-283.
It is commented out because it currently fails.

Modified:
    directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java

Modified: directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java?rev=328742&r1=328741&r2=328742&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java (original)
+++ directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java Wed Oct 26
14:29:07 2005
@@ -79,7 +79,29 @@
             partition.setIndexedAttributes( Collections.singleton( "dc" ) );
             partitions.add( partition );
             configuration.setContextPartitionConfigurations( partitions );
+	}
+        else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
+        {
+            // allow anonymous access
+            configuration.setAllowAnonymousAccess( true );
+            
+            // create a partition to search
+            Set partitions = new HashSet();
+            partitions.addAll( configuration.getContextPartitionConfigurations() );
+            MutableDirectoryPartitionConfiguration partition = new MutableDirectoryPartitionConfiguration();
+            partition.setSuffix( "dc=apache,dc=org" );
+            Attributes entry = new BasicAttributes( "dc", "apache", true );
+            Attribute oc = new BasicAttribute( "objectClass" );
+            entry.put( oc );
+            oc.add( "top" );
+            oc.add( "domain" );
+            partition.setName( "apache" );
+            partition.setContextEntry( entry );
+            partition.setIndexedAttributes( Collections.singleton( "dc" ) );
+            partitions.add( partition );
+            configuration.setContextPartitionConfigurations( partitions );
         }
+ 
 
         super.setUp();
     }
@@ -159,6 +181,39 @@
         assertEquals( "", result.getName().trim() );
     }
 
+    /**
+     * Test to make sure that if anonymous binds are allowed a user may search 
+     * within a a partition.
+     *
+     * @throws Exception if anything goes wrong
+     */
+    /*
+    public void testAnonymousBindsEnabledBaseSearch() throws Exception
+    {
+        // Use the SUN JNDI provider to hit server port and bind as anonymous
+
+        final Hashtable env = new Hashtable();
+
+        env.put( Context.PROVIDER_URL, "ldap://localhost:" + port + "/" );
+        env.put( Context.SECURITY_AUTHENTICATION, "none" );
+        env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
+
+        InitialDirContext ctx = new InitialDirContext( env );
+        SearchControls cons = new SearchControls();
+        cons.setSearchScope( SearchControls.OBJECT_SCOPE );
+        NamingEnumeration list = ctx.search( "dc=apache,dc=org", "(objectClass=*)", cons
);
+        SearchResult result = null;
+        if ( list.hasMore() )
+        {
+            result = ( SearchResult ) list.next();
+        }
+        assertFalse( list.hasMore() );
+        list.close();
+
+        assertNotNull( result );
+        assertNotNull( result.getAttributes().get("dc") );
+    }
+    */
 
     /**
      * Reproduces the problem with



Mime
View raw message