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 2008/05/22 13:19:24 UTC

svn commit: r659077 - in /directory/apacheds/branches/bigbang/core/src: main/java/org/apache/directory/server/core/authz/support/ test/java/org/apache/directory/server/core/authz/support/ test/java/org/apache/directory/server/core/schema/

Author: akarasulu
Date: Thu May 22 04:19:23 2008
New Revision: 659077

URL: http://svn.apache.org/viewvc?rev=659077&view=rev
Log:
fixing some issues with test failures after fixing NamingException and Enumeration problems.

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=659077&r1=659076&r2=659077&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java Thu May 22 04:19:23 2008
@@ -142,16 +142,12 @@
         Collection<String> c = new HashSet<String>();
         c.add( NormalizationInterceptor.class.getName() );
         c.add( AuthenticationInterceptor.class.getName() );
-//        c.add( ReferralInterceptor.class.getName() );
         c.add( AciAuthorizationInterceptor.class.getName() );
         c.add( DefaultAuthorizationInterceptor.class.getName() );
-//        c.add( ExceptionInterceptor.class.getName() );
         c.add( OperationalAttributeInterceptor.class.getName() );
         c.add( SchemaInterceptor.class.getName() );
         c.add( SubentryInterceptor.class.getName() );
-//        c.add( CollectiveAttributeInterceptor.class.getName() );
         c.add( EventInterceptor.class.getName() );
-//        c.add( TriggerInterceptor.class.getName() );
         SEARCH_BYPASS = Collections.unmodifiableCollection( c );
     }
 
@@ -159,29 +155,28 @@
     private int getImmSubCount( Registries registries, PartitionNexusProxy proxy, LdapDN entryName ) throws Exception
     {
         int cnt = 0;
-        Cursor<ServerEntry> e = null;
+        Cursor<ServerEntry> results = null;
         
         try
         {
-            e = proxy.search( new SearchOperationContext( registries, ( LdapDN ) entryName.getPrefix( 1 ),
+            results = proxy.search( new SearchOperationContext( registries, ( LdapDN ) entryName.getPrefix( 1 ),
                     AliasDerefMode.DEREF_ALWAYS, childrenFilter, childrenSearchControls ), SEARCH_BYPASS );
 
-            while ( e.next() )
+            while ( results.next() )
             {
-                e.get();
+                results.get();
                 cnt++;
             }
 
         }
         finally
         {
-            if ( e != null )
+            if ( results != null )
             {
-                e.close();
+                results.close();
             }
         }
 
         return cnt;
     }
-
 }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=659077&r1=659076&r2=659077&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Thu May 22 04:19:23 2008
@@ -25,6 +25,7 @@
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.changelog.ChangeLog;
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -37,6 +38,7 @@
 import org.apache.directory.server.core.schema.SchemaOperationControl;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
@@ -45,7 +47,6 @@
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.ldap.LdapContext;
 import java.io.File;
@@ -54,6 +55,7 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Set;
@@ -180,17 +182,13 @@
         public Cursor<ServerEntry> search( SearchOperationContext opContext )
             throws NamingException
         {
-            //TODO FixMe
-            //return new BogusEnumeration( count );
-            return null;
+            return new BogusCursor( count );
         }
 
 
         public Cursor<ServerEntry> search( SearchOperationContext opContext, Collection bypass ) throws NamingException
         {
-            //// TODO FixMe
-            //return new BogusEnumeration( count );
-            return null;
+            return new BogusCursor( count );
         }
     }
 
@@ -511,19 +509,37 @@
         }
     }
 
-    class BogusEnumeration implements NamingEnumeration
+    class BogusCursor implements Cursor<ServerEntry>
     {
         final int count;
         int ii;
 
 
-        public BogusEnumeration(int count)
+        public BogusCursor(int count)
         {
             this.count = count;
         }
 
 
-        public Object next() throws NamingException
+        public boolean available() 
+        {
+            return ii < count;
+        }
+
+
+        public void close() throws NamingException
+        {
+            ii = count;
+        }
+
+
+        public boolean hasMoreElements()
+        {
+            return ii < count;
+        }
+
+
+        public Object nextElement()
         {
             if ( ii >= count )
             {
@@ -536,34 +552,88 @@
         }
 
 
-        public boolean hasMore() throws NamingException
+        public void after( ServerEntry element ) throws Exception
         {
-            return ii < count;
         }
 
 
-        public void close() throws NamingException
+        public void afterLast() throws Exception
         {
-            ii = count;
         }
 
 
-        public boolean hasMoreElements()
+        public void before( ServerEntry element ) throws Exception
         {
+            throw new NotImplementedException();
+        }
+
+
+        public void beforeFirst() throws Exception
+        {
+            ii = -1;
+        }
+
+
+        public boolean first() throws Exception
+        {
+            ii = 0;
             return ii < count;
         }
 
 
-        public Object nextElement()
+        public ServerEntry get() throws Exception
+        {
+            return null;
+        }
+
+
+        public boolean isClosed() throws Exception
+        {
+            return false;
+        }
+
+
+        public boolean isElementReused()
+        {
+            return false;
+        }
+
+
+        public boolean last() throws Exception
+        {
+            ii = count;
+            return true;
+        }
+
+
+        public boolean next() 
         {
             if ( ii >= count )
             {
-                throw new NoSuchElementException();
+                return false;
             }
 
             ii++;
             
-            return new Object();
+            return true;
+        }
+
+
+        public boolean previous() throws Exception
+        {
+            if ( ii < 0 )
+            {
+                return false;
+            }
+            
+            ii--;
+            return true;
+        }
+
+
+        public Iterator<ServerEntry> iterator()
+        {
+            return new CursorIterator<ServerEntry>( this );
         }
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=659077&r1=659076&r2=659077&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Thu May 22 04:19:23 2008
@@ -58,6 +58,8 @@
 
 /**
  * Tests the partition schema loader.
+ * 
+ * TODO move this to core-integ does not belong here and get rid of all the static 
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java?rev=659077&r1=659076&r2=659077&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java Thu May 22 04:19:23 2008
@@ -73,7 +73,7 @@
         assertTrue( nameAttrs.contains( "sn" ) );
         assertTrue( nameAttrs.contains( "title" ) );
         assertTrue( nameAttrs.contains( "l" ) );
-        assertTrue( nameAttrs.contains( "apacheExistance" ) );
+        assertTrue( nameAttrs.contains( "apachePresence" ) );
         assertTrue( nameAttrs.contains( "cn" ) );
         assertTrue( nameAttrs.contains( "st" ) );
         assertTrue( nameAttrs.contains( "givenName" ) );