directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r503347 - /directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
Date Sun, 04 Feb 2007 03:05:56 GMT
Author: elecharny
Date: Sat Feb  3 19:05:55 2007
New Revision: 503347

URL: http://svn.apache.org/viewvc?view=rev&rev=503347
Log:
Added some checking on the constructed request

Modified:
    directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java

Modified: directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?view=diff&rev=503347&r1=503346&r2=503347
==============================================================================
--- directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
(original)
+++ directory/shared/branches/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
Sat Feb  3 19:05:55 2007
@@ -23,6 +23,7 @@
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.NamingException;
@@ -4504,5 +4505,61 @@
             ne.printStackTrace();
             fail( ne.getMessage() );
         }
+        
+        assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
+        
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchRequest sr = message.getSearchRequest();
+
+        assertEquals( 6, message.getMessageId() );
+        assertEquals( "ou=system", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( false, sr.isTypesOnly() );
+
+        // (&(...
+        AndFilter andFilter = ( AndFilter ) sr.getFilter();
+        assertNotNull( andFilter );
+
+        List andFilters = andFilter.getAndFilter();
+        assertEquals( 2, andFilters.size() );
+        
+        // (&(objectClass=person)..
+        AttributeValueAssertionFilter equalityMatch = ( AttributeValueAssertionFilter ) andFilters.get(
0 );
+        assertNotNull( equalityMatch );
+
+        AttributeValueAssertion assertion = equalityMatch.getAssertion();
+        assertNotNull( assertion );
+
+        assertEquals( "objectClass", assertion.getAttributeDesc() );
+        assertEquals( "person", assertion.getAssertionValue().toString() );
+
+        // (&(a=b)(|
+        OrFilter orFilter = ( OrFilter ) andFilters.get( 1 );
+        assertNotNull( orFilter );
+
+        List orFilters = orFilter.getOrFilter();
+        assertEquals( 2, orFilters.size() );
+        
+        // (&(a=b)(|(cn=Tori*
+        SubstringFilter substringFilter = ( SubstringFilter ) orFilters.get( 0 );
+        assertNotNull( substringFilter );
+
+        assertEquals( "cn", substringFilter.getType() );
+        assertEquals( "Tori", substringFilter.getInitialSubstrings() );
+        assertEquals( 0, substringFilter.getAnySubstrings().size() );
+        assertEquals( null, substringFilter.getFinalSubstrings() );
+
+        // (&(a=b)(|(cn=Tori*)(sn=Jagger)))
+        equalityMatch = ( AttributeValueAssertionFilter ) orFilters.get( 1 );
+        assertNotNull( equalityMatch );
+
+        assertion = equalityMatch.getAssertion();
+        assertNotNull( assertion );
+
+        assertEquals( "sn", assertion.getAttributeDesc() );
+        assertEquals( "Jagger", assertion.getAssertionValue().toString() );
     }
 }



Mime
View raw message