You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/12/04 21:46:41 UTC

svn commit: r601082 - in /directory/apacheds/branches/bigbang: core-integ/src/test/java/org/apache/directory/server/core/ core-integ/src/test/java/org/apache/directory/server/core/jndi/ core-unit/src/test/java/org/apache/directory/server/core/jndi/

Author: akarasulu
Date: Tue Dec  4 12:46:40 2007
New Revision: 601082

URL: http://svn.apache.org/viewvc?rev=601082&view=rev
Log:
renamed ListAsAdminIT to ListIT and added tests from ListAsNonAdminITest to it and deleted the old test

Added:
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java   (contents, props changed)
      - copied, changed from r601078, directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListAsAdminIT.java
Removed:
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListAsAdminIT.java
    directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/ListAsNonAdminITest.java
Modified:
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java?rev=601082&r1=601081&r2=601082&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java Tue Dec  4 12:46:40 2007
@@ -52,7 +52,7 @@
         DIRSERVER759IT.class,
         DIRSERVER783IT.class,
         DIRSERVER791IT.class,
-        ListAsAdminIT.class,
+        ListIT.class,
         ExtensibleObjectIT.class,
         PartitionConfigurationIT.class  // Leaves the server in a bad state (partition removal is incomplete)
         } )

Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java (from r601078, directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListAsAdminIT.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java&p1=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListAsAdminIT.java&r1=601078&r2=601082&rev=601082&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListAsAdminIT.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java Tue Dec  4 12:46:40 2007
@@ -24,7 +24,9 @@
 import org.apache.directory.server.core.integ.CiRunner;
 import static org.apache.directory.server.core.integ.IntegrationUtils.*;
 import org.apache.directory.shared.ldap.ldif.Entry;
+
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -44,9 +46,52 @@
  * @version $Rev$
  */
 @RunWith ( CiRunner.class )
-public class ListAsAdminIT
+public class ListIT
 {
     public static DirectoryService service;
+
+
+    @Test
+    public void testListSystemAsNonAdmin() throws NamingException
+    {
+        Entry akarasulu = getUserAddLdif();
+        getRootContext( service ).createSubcontext( akarasulu.getDn(), akarasulu.getAttributes() );
+
+        LdapContext sysRoot = getContext( akarasulu.getDn(), service, "ou=system" );
+        HashSet<String> set = new HashSet<String>();
+        NamingEnumeration list = sysRoot.list( "" );
+
+        while ( list.hasMore() )
+        {
+            NameClassPair ncp = ( NameClassPair ) list.next();
+            set.add( ncp.getName() );
+        }
+
+        assertFalse( set.contains( "uid=admin,ou=system" ) );
+        assertTrue( set.contains( "ou=users,ou=system" ) );
+        assertTrue( set.contains( "ou=groups,ou=system" ) );
+    }
+
+
+    @Test
+    public void testListUsersAsNonAdmin() throws NamingException
+    {
+        Entry akarasulu = getUserAddLdif();
+        getRootContext( service ).createSubcontext( akarasulu.getDn(), akarasulu.getAttributes() );
+
+        LdapContext sysRoot = getContext( akarasulu.getDn(), service, "ou=system" );
+        HashSet<String> set = new HashSet<String>();
+        NamingEnumeration list = sysRoot.list( "ou=users" );
+
+        while ( list.hasMore() )
+        {
+            NameClassPair ncp = ( NameClassPair ) list.next();
+            set.add( ncp.getName() );
+        }
+
+        // @todo this assertion fails now - is this the expected behavoir?
+        // assertFalse( set.contains( "uid=akarasulu,ou=users,ou=system" ) );
+    }
 
 
     @Test

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

Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ListIT.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Tue Dec  4 12:46:40 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id