directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r997710 - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/ apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ shared/trunk/ldap/src/main/java/org/apache/d...
Date Thu, 16 Sep 2010 12:17:56 GMT
Author: elecharny
Date: Thu Sep 16 12:17:55 2010
New Revision: 997710

URL: http://svn.apache.org/viewvc?rev=997710&view=rev
Log:
o Fixed DIRSERVER-1553 : the link to the top level filter was lost during the processing in
some cases.
o Reformted some ldif files in some tests

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=997710&r1=997709&r2=997710&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
Thu Sep 16 12:17:55 2010
@@ -106,35 +106,60 @@ import org.junit.runner.RunWith;
         "sn: a1-1",
         "",
         // entry A1-2
-        "dn: cn=A1-2,cn=A1,dc=AP-A,dc=test,ou=system", "objectClass: top",
+        "dn: cn=A1-2,cn=A1,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
         "objectClass: person",
         "cn: A1-2",
         "sn: a1-2",
         "",
         // entry A2
-        "dn: cn=A2,dc=AP-A,dc=test,ou=system", "objectClass: top", "objectClass: person",
+        "dn: cn=A2,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: person",
         "cn: A2",
         "sn: a2",
         "",
         // entry A2-1
-        "dn: cn=A2-1,cn=A2,dc=AP-A,dc=test,ou=system", "objectClass: top", "objectClass:
person",
+        "dn: cn=A2-1,cn=A2,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: person",
         "cn: A2-1",
         "sn: a2-1",
         "",
         // The second level AP
-        "dn: dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system", "objectClass: top", "objectClass:
domain",
-        "administrativeRole: collectiveAttributeSpecificArea", "dc: AP-B",
+        "dn: dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: domain",
+        "administrativeRole: collectiveAttributeSpecificArea",
+        "dc: AP-B",
         "",
         // entry B1
-        "dn: cn=B1,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system", "objectClass: top", "objectClass:
person", "cn: B1",
-        "sn: b1", "",
+        "dn: cn=B1,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: person",
+        "cn: B1",
+        "sn: b1",
+        "",
         // entry B2
-        "dn: cn=B2,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system", "objectClass: top", "objectClass:
person", "cn: B2",
-        "sn: b2", "",
+        "dn: cn=B2,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: person",
+        "cn: B2",
+        "sn: b2",
+        "",
         // The first level non AP
-        "dn: dc=not-AP,dc=test,ou=system", "objectClass: top", "objectClass: domain", "dc:
not-AP", "",
+        "dn: dc=not-AP,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: domain",
+        "dc: not-AP",
+        "",
         // An entry under non-AP
-        "dn: cn=C,dc=not-AP,dc=test,ou=system", "objectClass: top", "objectClass: person",
"cn: C", "sn: entry-C", "" })
+        "dn: cn=C,dc=not-AP,dc=test,ou=system",
+        "objectClass: top",
+        "objectClass: person",
+        "cn: C",
+        "sn: entry-C",
+        "" })
 public class SubentryServiceIT extends AbstractLdapTestUnit
 {
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=997710&r1=997709&r2=997710&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
Thu Sep 16 12:17:55 2010
@@ -143,9 +143,14 @@ import org.junit.runner.RunWith;
         " AigC14//Z",
 
         // Entry # 4
-        "dn: cn=Heather Nova,ou=system", "objectClass: person", "objectClass: organizationalPerson",
-        "objectClass: inetOrgPerson", "objectClass: strongAuthenticationUser", "objectClass:
top",
-        "userCertificate:: NFZOXw==", "cn: Heather Nova",
+        "dn: cn=Heather Nova,ou=system",
+        "objectClass: person",
+        "objectClass: organizationalPerson",
+        "objectClass: inetOrgPerson",
+        "objectClass: strongAuthenticationUser",
+        "objectClass: top",
+        "userCertificate:: NFZOXw==",
+        "cn: Heather Nova",
         "sn: Nova",
         "jpegPhoto:: /9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAX",
         " Q3JlYXRlZCB3aXRoIFRoZSBHSU1Q/9sAQwAQCwwODAoQDg0OEhEQExgoGhgWFhgxIyUdKDozPTw",
@@ -156,12 +161,22 @@ import org.junit.runner.RunWith;
         " AigC14//Z",
 
         // Entry #5
-        "dn: cn=Janis Joplin,ou=system", "objectClass: person", "objectClass: organizationalPerson",
-        "objectClass: inetOrgPerson", "objectClass: top", "objectClass: strongAuthenticationUser",
"cn: Janis Joplin",
-        "sn: Joplin", "userCertificate:: ",
+        "dn: cn=Janis Joplin,ou=system",
+        "objectClass: person",
+        "objectClass: organizationalPerson",
+        "objectClass: inetOrgPerson",
+        "objectClass: top",
+        "objectClass: strongAuthenticationUser",
+        "cn: Janis Joplin",
+        "sn: Joplin",
+        "userCertificate:: ",
 
         // Entry #6
-        "dn: cn=Kim Wilde,ou=system", "objectClass: person", "objectClass: top", "cn: Kim
Wilde", "sn: Wilde",
+        "dn: cn=Kim Wilde,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "cn: Kim Wilde",
+        "sn: Wilde",
         "description: an American singer-songwriter+sexy blond"
 
     })
@@ -1703,4 +1718,31 @@ public class SearchIT extends AbstractLd
 
         assertTrue( newCount < count );
     }
+
+
+    @Test
+    public void testSearchComplexFilter() throws Exception
+    {
+        LdapContext ctx = getWiredContext( ldapServer );
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        controls.setTimeLimit( 10 );
+
+        NamingEnumeration<SearchResult> result = ctx.search( "cn=Kim Wilde,ou=system",
+            "(&(&(ObjectClass=person)(!(ObjectClass=strongAuthenticationUser))(sn=Wilde)))",
controls );
+
+        assertTrue( result.hasMore() );
+        SearchResult sr = result.next();
+        assertNotNull( sr );
+        assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
+
+        // Now check with another version of the filter
+        result = ctx.search( "cn=Kim Wilde,ou=system",
+            "(&(sn=Wilde)(&(objectClass=person)(!(objectClass=strongAuthenticationUser))))",
controls );
+
+        assertTrue( result.hasMore() );
+        sr = result.next();
+        assertNotNull( sr );
+        assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=997710&r1=997709&r2=997710&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
Thu Sep 16 12:17:55 2010
@@ -86,6 +86,9 @@ public class SearchRequestImpl extends A
     /** The current filter. This is used while decoding a PDU */
     private Filter currentFilter;
 
+    /** The global filter. This is used while decoding a PDU */
+    private Filter topFilter;
+
     /** The SearchRequest TLV id */
     private int tlvId;
 
@@ -517,7 +520,7 @@ public class SearchRequestImpl extends A
     {
         if ( filterNode == null )
         {
-            filterNode = transform( currentFilter );
+            filterNode = transform( topFilter );
         }
 
         return filterNode;
@@ -626,6 +629,7 @@ public class SearchRequestImpl extends A
             // No parent. This Filter will become the root.
             currentFilter = localFilter;
             currentFilter.setParent( null, tlvId );
+            topFilter = localFilter;
         }
     }
 



Mime
View raw message