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 2004/10/26 03:18:26 UTC

svn commit: rev 55553 - in incubator/directory/eve/trunk/backend/core: . src/java/org/apache/eve/db src/java/org/apache/eve/jndi src/java/org/apache/eve/jndi/exception src/java/org/apache/eve/jndi/ibs src/test/org/apache/eve/jndi

Author: akarasulu
Date: Mon Oct 25 18:18:24 2004
New Revision: 55553

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameAlreadyBoundException.java
Modified:
   incubator/directory/eve/trunk/backend/core/project.properties
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DefaultSearchEngine.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
   incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/SearchContextTest.java
Log:
count the bug in EveDirContext that was messing up search

Modified: incubator/directory/eve/trunk/backend/core/project.properties
==============================================================================
--- incubator/directory/eve/trunk/backend/core/project.properties	(original)
+++ incubator/directory/eve/trunk/backend/core/project.properties	Mon Oct 25 18:18:24 2004
@@ -1,4 +1,4 @@
-maven.junit.fork=no
+maven.junit.fork=yes
 
 maven.javadoc.private=true
 maven.javadoc.overview=src/java/org/apache/eve/schema/overview.html

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DefaultSearchEngine.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DefaultSearchEngine.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DefaultSearchEngine.java	Mon Oct 25 18:18:24 2004
@@ -102,8 +102,8 @@
 
 
         /*
-         * I the base is not an alias or i alias dereerencing does not
-         * occur on inding the base then we set the eective base to the
+         * If the base is not an alias or if alias dereerencing does not
+         * occur on finding the base then we set the effective base to the
          * given base.
          */
         if ( null == aliasedBase || ! mode.derefFindingBase() )

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java	Mon Oct 25 18:18:24 2004
@@ -536,8 +536,7 @@
             throw ne;
         }
         
-        return getNexusProxy().search( target , getEnvironment(),
-            filterNode, new SearchControls() );
+        return getNexusProxy().search( target , getEnvironment(), filterNode, cons );
     }
 
 

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameAlreadyBoundException.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameAlreadyBoundException.java	Mon Oct 25 18:18:24 2004
@@ -0,0 +1,44 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed 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.eve.jndi.exception;
+
+
+import javax.naming.NameAlreadyBoundException;
+
+import org.apache.eve.exception.EveException;
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * An Eve specific NameAlreadyBoundException.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class EveNameAlreadyBoundException extends NameAlreadyBoundException
+        implements EveException
+{
+    /**
+     * Always returns ResultCodeEnum.ENTRYALREADYEXISTS.
+     *
+     * @see EveException#getResultCode()
+     */
+    public ResultCodeEnum getResultCode()
+    {
+        return ResultCodeEnum.ENTRYALREADYEXISTS;
+    }
+}

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java	Mon Oct 25 18:18:24 2004
@@ -23,8 +23,9 @@
 
 import org.apache.eve.jndi.*;
 import org.apache.eve.jndi.exception.EveNameNotFoundException;
+import org.apache.eve.jndi.exception.EveNameAlreadyBoundException;
+
 import org.apache.eve.RootNexus;
-import org.apache.eve.exception.EveAttributeInUseException;
 
 
 /**
@@ -42,7 +43,7 @@
  */
 public class EveExceptionService extends BaseInterceptor
 {
-    /** */
+    /** the root nexus of the system */
     private RootNexus nexus = null;
 
 
@@ -72,7 +73,7 @@
         {
             if ( nexus.hasEntry( normName ) )
             {
-                NamingException ne = new EveAttributeInUseException();
+                NamingException ne = new EveNameAlreadyBoundException();
                 invocation.setBeforeFailure( ne );
                 throw ne;
             }

Modified: incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/SearchContextTest.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/SearchContextTest.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/SearchContextTest.java	Mon Oct 25 18:18:24 2004
@@ -38,13 +38,20 @@
     {
         super.setUp();
 
-        CreateContextTest createContextTest = new CreateContextTest();
-        createContextTest.setUp();
-        createContextTest.testCreateContexts();
+        try
+        {
+            CreateContextTest createContextTest = new CreateContextTest();
+            createContextTest.setUp();
+            createContextTest.testCreateContexts();
+        }
+        catch( Exception e )
+        {
+            // do nothing
+        }
     }
 
 
-    public void testSearchOneLeve() throws NamingException
+    public void testSearchOneLevel() throws NamingException
     {
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -53,7 +60,7 @@
                 DerefAliasesEnum.NEVERDEREFALIASES.getName() );
 
         HashMap map = new HashMap();
-        NamingEnumeration list = sysRoot.search( "", "(ou = *)", new SearchControls() );
+        NamingEnumeration list = sysRoot.search( "", "(ou = *)", controls );
         while ( list.hasMore() )
         {
             SearchResult result = ( SearchResult ) list.next();
@@ -67,7 +74,7 @@
     }
 
 
-    public void testSearchSubTreeLeve() throws NamingException
+    public void testSearchSubTreeLevel() throws NamingException
     {
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -76,7 +83,7 @@
                 DerefAliasesEnum.NEVERDEREFALIASES.getName() );
 
         HashMap map = new HashMap();
-        NamingEnumeration list = sysRoot.search( "", "(ou = *)", new SearchControls() );
+        NamingEnumeration list = sysRoot.search( "", "(ou = *)", controls );
         while ( list.hasMore() )
         {
             SearchResult result = ( SearchResult ) list.next();