directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r369955 - in /directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search: SearchRequestTest.java SearchResultDoneTest.java SearchResultEntryTest.java SearchResultReferenceTest.java
Date Tue, 17 Jan 2006 23:17:01 GMT
Author: elecharny
Date: Tue Jan 17 15:16:53 2006
New Revision: 369955

URL: http://svn.apache.org/viewcvs?rev=369955&view=rev
Log:
- Added some tests case
- Removed useless Assert prefix

Modified:
    directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestTest.java
    directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultDoneTest.java
    directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultEntryTest.java
    directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultReferenceTest.java

Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestTest.java?rev=369955&r1=369954&r2=369955&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestTest.java (original)
+++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestTest.java Tue Jan 17 15:16:53 2006
@@ -46,7 +46,6 @@
 import org.apache.ldap.common.codec.search.SubstringFilter;
 import org.apache.ldap.common.codec.util.LdapString;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 /**
@@ -148,72 +147,72 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (& (...
         AndFilter andFilter = (AndFilter)sr.getFilter();
-        Assert.assertNotNull(andFilter);
+        assertNotNull(andFilter);
         
         ArrayList andFilters = andFilter.getAndFilter();
         
         // (& (| (...
-        Assert.assertEquals(2, andFilters.size());
+        assertEquals(2, andFilters.size());
         OrFilter orFilter = (OrFilter)andFilters.get(0);
-        Assert.assertNotNull(orFilter);
+        assertNotNull(orFilter);
         
         // (& (| (obectclass=top) (...
         ArrayList orFilters = orFilter.getOrFilter();
-        Assert.assertEquals(2, orFilters.size());
+        assertEquals(2, orFilters.size());
         AttributeValueAssertionFilter equalityMatch = (AttributeValueAssertionFilter)orFilters.get(0);  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         AttributeValueAssertion assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("top", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("top", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass=top) (ou=contacts) ) (...
         equalityMatch = (AttributeValueAssertionFilter)orFilters.get(1);  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("ou", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("contacts", assertion.getAssertionValue().toString());
+        assertEquals("ou", assertion.getAttributeDesc().toString());
+        assertEquals("contacts", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass=top) (ou=contacts) ) (! ...
         NotFilter notFilter = ( NotFilter )andFilters.get(1);
-        Assert.assertNotNull(notFilter);
+        assertNotNull(notFilter);
         
         // (& (| (objectclass=top) (ou=contacts) ) (! (objectclass=ttt) ) )
         equalityMatch = (AttributeValueAssertionFilter)notFilter.getNotFilter();  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("ttt", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("ttt", assertion.getAssertionValue().toString());
         
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
 
         // Check the encoding
@@ -225,12 +224,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x81 ), decodedPdu.substring( 0, 0x81 ) );
+            assertEquals(encodedPdu.substring( 0, 0x81 ), decodedPdu.substring( 0, 0x81 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -311,77 +310,77 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (& (...
         AndFilter andFilter = (AndFilter)sr.getFilter();
-        Assert.assertNotNull(andFilter);
+        assertNotNull(andFilter);
         
         ArrayList andFilters = andFilter.getAndFilter();
         
         // (& (| (...
-        Assert.assertEquals(2, andFilters.size());
+        assertEquals(2, andFilters.size());
         OrFilter orFilter = (OrFilter)andFilters.get(0);
-        Assert.assertNotNull(orFilter);
+        assertNotNull(orFilter);
         
         // (& (| (objectclass~=top) (...
         ArrayList orFilters = orFilter.getOrFilter();
-        Assert.assertEquals(2, orFilters.size());
+        assertEquals(2, orFilters.size());
         AttributeValueAssertionFilter approxMatch = (AttributeValueAssertionFilter)orFilters.get(0);  
-        Assert.assertNotNull(approxMatch);
+        assertNotNull(approxMatch);
         
         AttributeValueAssertion assertion = approxMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("top", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("top", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass~=top) (ou<=contacts) ) (...
         AttributeValueAssertionFilter lessOrEqual = (AttributeValueAssertionFilter)orFilters.get(1);  
-        Assert.assertNotNull(lessOrEqual);
+        assertNotNull(lessOrEqual);
         
         assertion = lessOrEqual.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("ou", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("contacts", assertion.getAssertionValue().toString());
+        assertEquals("ou", assertion.getAttributeDesc().toString());
+        assertEquals("contacts", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass~=top) (ou<=contacts) ) (! ...
         NotFilter notFilter = (NotFilter)andFilters.get(1);
-        Assert.assertNotNull(notFilter);
+        assertNotNull(notFilter);
         
         // (& (| (objectclass~=top) (ou<=contacts) ) (! (objectclass>=ttt) ) )
         AttributeValueAssertionFilter greaterOrEqual = (AttributeValueAssertionFilter)notFilter.getNotFilter();  
-        Assert.assertNotNull(greaterOrEqual);
+        assertNotNull(greaterOrEqual);
         
         assertion = greaterOrEqual.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("ttt", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("ttt", assertion.getAssertionValue().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x90, message.computeLength());
+        assertEquals(0x90, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -392,12 +391,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x81 ), decodedPdu.substring( 0, 0x81 ) );
+            assertEquals(encodedPdu.substring( 0, 0x81 ), decodedPdu.substring( 0, 0x81 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -473,70 +472,70 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (& (...
         AndFilter andFilter = (AndFilter)sr.getFilter();
-        Assert.assertNotNull(andFilter);
+        assertNotNull(andFilter);
         
         ArrayList andFilters = andFilter.getAndFilter();
         
         // (& (| (...
-        Assert.assertEquals(2, andFilters.size());
+        assertEquals(2, andFilters.size());
         OrFilter orFilter = (OrFilter)andFilters.get(0);
-        Assert.assertNotNull(orFilter);
+        assertNotNull(orFilter);
         
         // (& (| (objectclass=*) (...
         ArrayList orFilters = orFilter.getOrFilter();
-        Assert.assertEquals(2, orFilters.size());
+        assertEquals(2, orFilters.size());
 
         PresentFilter presentFilter = (PresentFilter)orFilters.get(0);  
-        Assert.assertNotNull(presentFilter);
+        assertNotNull(presentFilter);
         
-        Assert.assertEquals("objectclass", presentFilter.getAttributeDescription().toString());
+        assertEquals("objectclass", presentFilter.getAttributeDescription().toString());
         
         // (& (| (objectclass=*) (ou=*) ) (...
         presentFilter = (PresentFilter)orFilters.get(1);  
-        Assert.assertNotNull(presentFilter);
+        assertNotNull(presentFilter);
         
-        Assert.assertEquals("ou", presentFilter.getAttributeDescription().toString());
+        assertEquals("ou", presentFilter.getAttributeDescription().toString());
         
         // (& (| (objectclass=*) (ou=*) ) (! ...
         NotFilter notFilter = (NotFilter)andFilters.get(1);
-        Assert.assertNotNull(notFilter);
+        assertNotNull(notFilter);
         
         // (& (| (objectclass=*) (ou=*) ) (! (objectclass>=ttt) ) )
         AttributeValueAssertionFilter greaterOrEqual = (AttributeValueAssertionFilter)notFilter.getNotFilter();  
-        Assert.assertNotNull(greaterOrEqual);
+        assertNotNull(greaterOrEqual);
         
         AttributeValueAssertion assertion = greaterOrEqual.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("ttt", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("ttt", assertion.getAssertionValue().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x7B, message.computeLength());
+        assertEquals(0x7B, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -547,12 +546,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x6C ), decodedPdu.substring( 0, 0x6C ) );
+            assertEquals(encodedPdu.substring( 0, 0x6C ), decodedPdu.substring( 0, 0x6C ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -614,32 +613,32 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 3, message.getMessageId() );
-        Assert.assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 0, sr.getSizeLimit() );
-        Assert.assertEquals( 0, sr.getTimeLimit() );
-        Assert.assertEquals( false, sr.isTypesOnly() );
+        assertEquals( 3, message.getMessageId() );
+        assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( false, sr.isTypesOnly() );
         
         // (objectClass = *)
         PresentFilter presentFilter = (PresentFilter)sr.getFilter();
-        Assert.assertNotNull(presentFilter);
-        Assert.assertEquals("objectClass", presentFilter.getAttributeDescription().toString());
+        assertNotNull(presentFilter);
+        assertEquals("objectClass", presentFilter.getAttributeDescription().toString());
         
         // The attributes
         Attributes attributes = sr.getAttributes();
         
-       	Assert.assertNull( attributes );
+       	assertNull( attributes );
 
         // Check the length
-        Assert.assertEquals(0x39, message.computeLength());
+        assertEquals(0x39, message.computeLength());
 
         // Check the encoding
         try
@@ -648,12 +647,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu, decodedPdu.substring( 0, decodedPdu.length() - 35) );
+            assertEquals(encodedPdu, decodedPdu.substring( 0, decodedPdu.length() - 35) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -719,37 +718,37 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals("t", substringFilter.getInitialSubstrings().toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals("t", substringFilter.getInitialSubstrings().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
 
         // Check the length
-        Assert.assertEquals(0x64, message.computeLength());
+        assertEquals(0x64, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -760,12 +759,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x53 ), decodedPdu.substring( 0, 0x53 ) );
+            assertEquals(encodedPdu.substring( 0, 0x53 ), decodedPdu.substring( 0, 0x53 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -831,39 +830,39 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals(null, substringFilter.getInitialSubstrings());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
-        Assert.assertEquals(null, substringFilter.getFinalSubstrings());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals(null, substringFilter.getInitialSubstrings());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals(null, substringFilter.getFinalSubstrings());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
 
         // Check the length
-        Assert.assertEquals(0x64, message.computeLength());
+        assertEquals(0x64, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -874,12 +873,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x53 ), decodedPdu.substring( 0, 0x53 ) );
+            assertEquals(encodedPdu.substring( 0, 0x53 ), decodedPdu.substring( 0, 0x53 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -946,39 +945,39 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals(null, substringFilter.getInitialSubstrings());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
-        Assert.assertEquals("t", substringFilter.getFinalSubstrings().toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals(null, substringFilter.getInitialSubstrings());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals("t", substringFilter.getFinalSubstrings().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x67, message.computeLength());
+        assertEquals(0x67, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -989,12 +988,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
+            assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1062,39 +1061,39 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals("t", substringFilter.getInitialSubstrings().toString());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
-        Assert.assertEquals("t", substringFilter.getFinalSubstrings().toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals("t", substringFilter.getInitialSubstrings().toString());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals("t", substringFilter.getFinalSubstrings().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x6A, message.computeLength());
+        assertEquals(0x6A, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1105,12 +1104,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
+            assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1177,38 +1176,38 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals("t", substringFilter.getInitialSubstrings().toString());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals("t", substringFilter.getInitialSubstrings().toString());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x67, message.computeLength());
+        assertEquals(0x67, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1219,12 +1218,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
+            assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1292,40 +1291,40 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals(null, substringFilter.getInitialSubstrings());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(1)).toString());
-        Assert.assertEquals("t", substringFilter.getFinalSubstrings().toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals(null, substringFilter.getInitialSubstrings());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(1)).toString());
+        assertEquals("t", substringFilter.getFinalSubstrings().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x6A, message.computeLength());
+        assertEquals(0x6A, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1336,12 +1335,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
+            assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1408,38 +1407,38 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().toString());
-        Assert.assertEquals("t", substringFilter.getInitialSubstrings().toString());
-        Assert.assertEquals("*", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
+        assertEquals("objectclass", substringFilter.getType().toString());
+        assertEquals("t", substringFilter.getInitialSubstrings().toString());
+        assertEquals("*", ((LdapString)substringFilter.getAnySubstrings().get(0)).toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x67, message.computeLength());
+        assertEquals(0x67, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1450,12 +1449,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
+            assertEquals(encodedPdu.substring( 0, 0x58 ), decodedPdu.substring( 0, 0x58 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1523,41 +1522,41 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         SubstringFilter substringFilter = (SubstringFilter)sr.getFilter();
-        Assert.assertNotNull(substringFilter);
+        assertNotNull(substringFilter);
         
-        Assert.assertEquals("objectclass", substringFilter.getType().getString());
-        Assert.assertEquals(null, substringFilter.getInitialSubstrings());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).getString());
-        Assert.assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(1)).getString());
-        Assert.assertEquals("t", (( LdapString )substringFilter.getAnySubstrings().get(2)).getString());
-        Assert.assertEquals(null, substringFilter.getFinalSubstrings());
+        assertEquals("objectclass", substringFilter.getType().getString());
+        assertEquals(null, substringFilter.getInitialSubstrings());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(0)).getString());
+        assertEquals("t", ((LdapString)substringFilter.getAnySubstrings().get(1)).getString());
+        assertEquals("t", (( LdapString )substringFilter.getAnySubstrings().get(2)).getString());
+        assertEquals(null, substringFilter.getFinalSubstrings());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x6A, message.computeLength());
+        assertEquals(0x6A, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1568,12 +1567,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
+            assertEquals(encodedPdu.substring( 0, 0x5B ), decodedPdu.substring( 0, 0x5B ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1632,64 +1631,64 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 33, message.getMessageId() );
-        Assert.assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
-        Assert.assertEquals( 2, sr.getSizeLimit() );
-        Assert.assertEquals( 3, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 33, message.getMessageId() );
+        assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
+        assertEquals( 2, sr.getSizeLimit() );
+        assertEquals( 3, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (objectclass=t*)
         OrFilter orFilter = (OrFilter)sr.getFilter();
-        Assert.assertNotNull(orFilter);
+        assertNotNull(orFilter);
 
         // uid=akarasulu
         AttributeValueAssertion assertion = ((AttributeValueAssertionFilter)orFilter.getOrFilter().get(0)).getAssertion();
         
-        Assert.assertEquals("uid", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("akarasulu", assertion.getAssertionValue().toString());
+        assertEquals("uid", assertion.getAttributeDesc().toString());
+        assertEquals("akarasulu", assertion.getAssertionValue().toString());
 
         // cn=aok
         assertion = ((AttributeValueAssertionFilter)orFilter.getOrFilter().get(1)).getAssertion();
         
-        Assert.assertEquals("cn", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("aok", assertion.getAssertionValue().toString());
+        assertEquals("cn", assertion.getAttributeDesc().toString());
+        assertEquals("aok", assertion.getAssertionValue().toString());
 
         // ou = Human Resources
         assertion = ((AttributeValueAssertionFilter)orFilter.getOrFilter().get(2)).getAssertion();
         
-        Assert.assertEquals("ou", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("Human Resources", assertion.getAssertionValue().toString());
+        assertEquals("ou", assertion.getAttributeDesc().toString());
+        assertEquals("Human Resources", assertion.getAssertionValue().toString());
 
         // l=Santa Clara
         assertion = ((AttributeValueAssertionFilter)orFilter.getOrFilter().get(3)).getAssertion();
         
-        Assert.assertEquals("l", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("Santa Clara", assertion.getAssertionValue().toString());
+        assertEquals("l", assertion.getAttributeDesc().toString());
+        assertEquals("Santa Clara", assertion.getAssertionValue().toString());
 
         // cn=abok
         assertion = (( AttributeValueAssertionFilter )orFilter.getOrFilter().get(4)).getAssertion();
         
-        Assert.assertEquals("cn", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("abok", assertion.getAssertionValue().toString());
+        assertEquals("cn", assertion.getAttributeDesc().toString());
+        assertEquals("abok", assertion.getAssertionValue().toString());
 
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x96, message.computeLength());
+        assertEquals(0x96, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1700,12 +1699,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x87 ), decodedPdu.substring( 0, 0x87 ) );
+            assertEquals(encodedPdu.substring( 0, 0x87 ), decodedPdu.substring( 0, 0x87 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -1756,30 +1755,30 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
-        Assert.assertEquals( 2, sr.getSizeLimit() );
-        Assert.assertEquals( 3, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
+        assertEquals( 2, sr.getSizeLimit() );
+        assertEquals( 3, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // The attributes
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
         
         // Check the length
-        Assert.assertEquals(0x65, message.computeLength());
+        assertEquals(0x65, message.computeLength());
 
         // Check the encoding
         // We won't check the whole PDU, as it may differs because
@@ -1790,12 +1789,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu.substring( 0, 0x56 ), decodedPdu.substring( 0, 0x56 ) );
+            assertEquals(encodedPdu.substring( 0, 0x56 ), decodedPdu.substring( 0, 0x56 ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
     
@@ -1852,34 +1851,34 @@
        catch ( DecoderException de )
        {
            de.printStackTrace();
-           Assert.fail( de.getMessage() );
+           fail( de.getMessage() );
        }
     
        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
-       Assert.assertEquals( 4, message.getMessageId() );
-       Assert.assertEquals( 2, message.getControls().size() );
+       assertEquals( 4, message.getMessageId() );
+       assertEquals( 2, message.getControls().size() );
     
        // this is a constant in Java 5 API
        String pagedResultsControlOID = "1.2.840.113556.1.4.319";
        Control pagedResultsControl = message.getControls( 0 );
-       Assert.assertEquals( pagedResultsControlOID, pagedResultsControl.getControlType() );
-       Assert.assertTrue( pagedResultsControl.getCriticality() );
+       assertEquals( pagedResultsControlOID, pagedResultsControl.getControlType() );
+       assertTrue( pagedResultsControl.getCriticality() );
     
        // this is a constant in Java 5 API
        String manageReferralControlOID = "2.16.840.1.113730.3.4.2";
        Control manageReferralControl = message.getControls( 1 );
-       Assert.assertEquals( manageReferralControlOID, manageReferralControl.getControlType() );
+       assertEquals( manageReferralControlOID, manageReferralControl.getControlType() );
     
        SearchRequest sr    = message.getSearchRequest();
-       Assert.assertEquals( "dc=my-domain,dc=com", sr.getBaseObject() );
-       Assert.assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, sr.getScope() );
-       Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-       Assert.assertEquals( 0, sr.getSizeLimit() );
-       Assert.assertEquals( 0, sr.getTimeLimit() );
-       Assert.assertEquals( false, sr.isTypesOnly() );
+       assertEquals( "dc=my-domain,dc=com", sr.getBaseObject() );
+       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() );
     
-       Assert.assertTrue( sr.getFilter() instanceof PresentFilter );
-       Assert.assertEquals ( "objectClass",
+       assertTrue( sr.getFilter() instanceof PresentFilter );
+       assertEquals ( "objectClass",
            ( (PresentFilter) sr.getFilter() ).getAttributeDescription().getString());
     
        // Check the encoding
@@ -1887,12 +1886,12 @@
        {
            ByteBuffer bb = message.encode( null );
            String encodedPdu = StringTools.dumpBytes( bb.array() );
-           Assert.assertEquals(encodedPdu, decodedPdu );
+           assertEquals(encodedPdu, decodedPdu );
        }
        catch ( EncoderException ee )
        {
            ee.printStackTrace();
-           Assert.fail( ee.getMessage() );
+           fail( ee.getMessage() );
        }
     }    
 
@@ -1972,72 +1971,72 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchRequest sr      = message.getSearchRequest();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        Assert.assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
-        Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
-        Assert.assertEquals( 1000, sr.getSizeLimit() );
-        Assert.assertEquals( 1000, sr.getTimeLimit() );
-        Assert.assertEquals( true, sr.isTypesOnly() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 1000, sr.getSizeLimit() );
+        assertEquals( 1000, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
         
         // (& (...
         AndFilter andFilter = (AndFilter)sr.getFilter();
-        Assert.assertNotNull(andFilter);
+        assertNotNull(andFilter);
         
         ArrayList andFilters = andFilter.getAndFilter();
         
         // (& (| (...
-        Assert.assertEquals(2, andFilters.size());
+        assertEquals(2, andFilters.size());
         OrFilter orFilter = (OrFilter)andFilters.get(0);
-        Assert.assertNotNull(orFilter);
+        assertNotNull(orFilter);
         
         // (& (| (obectclass=top) (...
         ArrayList orFilters = orFilter.getOrFilter();
-        Assert.assertEquals(2, orFilters.size());
+        assertEquals(2, orFilters.size());
         AttributeValueAssertionFilter equalityMatch = (AttributeValueAssertionFilter)orFilters.get(0);  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         AttributeValueAssertion assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("objectclass", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("top", assertion.getAssertionValue().toString());
+        assertEquals("objectclass", assertion.getAttributeDesc().toString());
+        assertEquals("top", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass=top) (ou=contacts) ) (...
         equalityMatch = (AttributeValueAssertionFilter)orFilters.get(1);  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("ou", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("contacts", assertion.getAssertionValue().toString());
+        assertEquals("ou", assertion.getAttributeDesc().toString());
+        assertEquals("contacts", assertion.getAssertionValue().toString());
         
         // (& (| (objectclass=top) (ou=contacts) ) (! ...
         NotFilter notFilter = ( NotFilter )andFilters.get(1);
-        Assert.assertNotNull(notFilter);
+        assertNotNull(notFilter);
         
         // (& (| (objectclass=top) (ou=contacts) ) (! (objectclass=ttt) ) )
         equalityMatch = (AttributeValueAssertionFilter)notFilter.getNotFilter();  
-        Assert.assertNotNull(equalityMatch);
+        assertNotNull(equalityMatch);
         
         assertion = equalityMatch.getAssertion();
-        Assert.assertNotNull(assertion);
+        assertNotNull(assertion);
         
-        Assert.assertEquals("ou", assertion.getAttributeDesc().toString());
-        Assert.assertEquals("ttt", assertion.getAssertionValue().toString());
+        assertEquals("ou", assertion.getAttributeDesc().toString());
+        assertEquals("ttt", assertion.getAssertionValue().toString());
         
         Attributes attributes = sr.getAttributes();
         
         for (int i = 0; i < attributes.size(); i++) 
         {
-        	Assert.assertNotNull( attributes.get( "attr" + i ) );
+        	assertNotNull( attributes.get( "attr" + i ) );
         }
 
         // We won't check the encoding, as it has changed because of 

Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultDoneTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultDoneTest.java?rev=369955&r1=369954&r2=369955&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultDoneTest.java (original)
+++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultDoneTest.java Tue Jan 17 15:16:53 2006
@@ -28,7 +28,6 @@
 import org.apache.ldap.common.codec.search.SearchResultDone;
 import org.apache.ldap.common.util.StringTools;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 /**
@@ -77,19 +76,19 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchResultDone searchResultDone      = message.getSearchResultDone();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( 0, searchResultDone.getLdapResult().getResultCode() );
-        Assert.assertEquals( "", searchResultDone.getLdapResult().getMatchedDN() );
-        Assert.assertEquals( "", searchResultDone.getLdapResult().getErrorMessage() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( 0, searchResultDone.getLdapResult().getResultCode() );
+        assertEquals( "", searchResultDone.getLdapResult().getMatchedDN() );
+        assertEquals( "", searchResultDone.getLdapResult().getErrorMessage() );
         
         // Check the length
-        Assert.assertEquals(0x0E, message.computeLength());
+        assertEquals(0x0E, message.computeLength());
 
         // Check the encoding
         try
@@ -98,12 +97,49 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu, decodedPdu );
+            assertEquals(encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
+    }
+    
+    /**
+     * Test the decoding of a SearchResultDone with no LdapResult
+     */
+    public void testDecodeSearchResultDoneEmptyResult()
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer  stream      = ByteBuffer.allocate( 0x07 );
+        
+        stream.put(
+            new byte[]
+            {
+                    0x30, 0x05,         // LDAPMessage ::=SEQUENCE {
+                      0x02, 0x01, 0x01, //         messageID MessageID
+                      0x65, 0x00        //        CHOICE { ..., delResponse DelResponse, ...
+            } );
+
+        stream.flip();
+
+        // Allocate a LdapMessage Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        // Decode a SearchResultDone message
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            System.out.println( de.getMessage() );
+            assertTrue( true );
+            return;
+        }
+        
+        fail( "We should not reach this point" );
     }
 }

Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultEntryTest.java?rev=369955&r1=369954&r2=369955&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultEntryTest.java (original)
+++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultEntryTest.java Tue Jan 17 15:16:53 2006
@@ -34,7 +34,6 @@
 import org.apache.ldap.common.codec.search.SearchResultEntry;
 import org.apache.ldap.common.util.StringTools;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 /**
@@ -90,24 +89,24 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchResultEntry searchResultEntry      = message.getSearchResultEntry();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName() );
 
         Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
-        Assert.assertEquals( 1, partialAttributesList.size() );
+        assertEquals( 1, partialAttributesList.size() );
         
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
             BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( "objectclass" );
             
-            Assert.assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
+            assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
             
             NamingEnumeration values = attributeValue.getAll();
             
@@ -120,14 +119,14 @@
             {
                 Object value = values.next();
                 
-                Assert.assertTrue( expectedValues.contains( value.toString() ) );
+                assertTrue( expectedValues.contains( value.toString() ) );
                 
                 expectedValues.remove( value.toString() );
             }
         }
         
         // Check the length
-        Assert.assertEquals(0x50, message.computeLength());
+        assertEquals(0x50, message.computeLength());
 
         // Check the encoding
         try
@@ -136,12 +135,12 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu, decodedPdu );
+            assertEquals(encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 
@@ -198,18 +197,18 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchResultEntry searchResultEntry      = message.getSearchResultEntry();
 
-        Assert.assertEquals( 1, message.getMessageId() );
-        Assert.assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName() );
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName() );
 
         Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
-        Assert.assertEquals( 2, partialAttributesList.size() );
+        assertEquals( 2, partialAttributesList.size() );
         
         String[] expectedAttributes = new String[]{"objectClass", "objectClass2"}; 
         
@@ -217,7 +216,7 @@
         {
             BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( expectedAttributes[i] );
             
-            Assert.assertEquals( expectedAttributes[i].toLowerCase(), attributeValue.getID().toLowerCase() );
+            assertEquals( expectedAttributes[i].toLowerCase(), attributeValue.getID().toLowerCase() );
             
             NamingEnumeration values = attributeValue.getAll();
             
@@ -230,14 +229,14 @@
             {
                 Object value = values.next();
                 
-                Assert.assertTrue( expectedValues.contains( value.toString() ) );
+                assertTrue( expectedValues.contains( value.toString() ) );
                 
                 expectedValues.remove( value.toString() );
             }
         }
         
         // Check the length
-        Assert.assertEquals(0x7b, message.computeLength());
+        assertEquals(0x7b, message.computeLength());
 
         // Check the encoding
         try
@@ -249,7 +248,7 @@
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
     
@@ -303,24 +302,24 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchResultEntry searchResultEntry      = message.getSearchResultEntry();
 
-        Assert.assertEquals( 2, message.getMessageId() );
-        Assert.assertEquals( "uid=admin,ou=system", searchResultEntry.getObjectName() );
+        assertEquals( 2, message.getMessageId() );
+        assertEquals( "uid=admin,ou=system", searchResultEntry.getObjectName() );
 
         Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
-        Assert.assertEquals( 1, partialAttributesList.size() );
+        assertEquals( 1, partialAttributesList.size() );
         
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
             BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( "objectclass" );
             
-            Assert.assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
+            assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
             
             NamingEnumeration values = attributeValue.getAll();
             
@@ -335,21 +334,21 @@
             {
                 Object value = values.next();
                 
-                Assert.assertTrue( expectedValues.contains( value.toString() ) );
+                assertTrue( expectedValues.contains( value.toString() ) );
                 
                 expectedValues.remove( value.toString() );
             }
         }
         
         // Check the length
-        Assert.assertEquals(0x61, message.computeLength());
+        assertEquals(0x61, message.computeLength());
         
         // Check that the next bytes is the first of the next PDU
-        Assert.assertEquals(0x30, stream.get(stream.position()));
-        Assert.assertEquals(0x45, stream.get(stream.position() + 1));
-        Assert.assertEquals(0x02, stream.get(stream.position() + 2));
-        Assert.assertEquals(0x01, stream.get(stream.position() + 3));
-        Assert.assertEquals(0x02, stream.get(stream.position() + 4));
+        assertEquals(0x30, stream.get(stream.position()));
+        assertEquals(0x45, stream.get(stream.position() + 1));
+        assertEquals(0x02, stream.get(stream.position() + 2));
+        assertEquals(0x01, stream.get(stream.position() + 3));
+        assertEquals(0x02, stream.get(stream.position() + 4));
 
         // Check the encoding
         try
@@ -360,12 +359,12 @@
             
             // We have to supress the last 5 chars from the decodedPDU, as they
             // belongs to the next message.
-            Assert.assertEquals(encodedPdu, decodedPdu.substring(0, 0x61 * 5) );
+            assertEquals(encodedPdu, decodedPdu.substring(0, 0x61 * 5) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
         }
     }
 }

Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultReferenceTest.java?rev=369955&r1=369954&r2=369955&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultReferenceTest.java (original)
+++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchResultReferenceTest.java Tue Jan 17 15:16:53 2006
@@ -34,7 +34,6 @@
 import org.apache.ldap.common.codec.util.LdapURLEncodingException;
 import org.apache.ldap.common.util.StringTools;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 /**
@@ -115,13 +114,13 @@
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            Assert.fail( de.getMessage() );
+            fail( de.getMessage() );
         }
     	
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         SearchResultReference searchResultReference      = message.getSearchResultReference();
 
-        Assert.assertEquals( 1, message.getMessageId() );
+        assertEquals( 1, message.getMessageId() );
         
         HashSet ldapUrlsSet = new HashSet();
         
@@ -132,7 +131,7 @@
 	        }
         } catch ( LdapURLEncodingException luee)
         {
-            Assert.fail();
+            fail();
         }
         
         Iterator iter = searchResultReference.getSearchResultReferences().iterator();
@@ -147,14 +146,14 @@
             }
             else
             {
-                Assert.fail(ldapUrl.toString() + " is not present");
+                fail(ldapUrl.toString() + " is not present");
             }
         }
         
-        Assert.assertTrue( ldapUrlsSet.size() == 0 );
+        assertTrue( ldapUrlsSet.size() == 0 );
         
         // Check the length
-        Assert.assertEquals(0x3D8, message.computeLength());
+        assertEquals(0x3D8, message.computeLength());
         
         // Check the encoding
         try
@@ -163,12 +162,118 @@
             
             String encodedPdu = StringTools.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu, decodedPdu );
+            assertEquals(encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
-            Assert.fail( ee.getMessage() );
+            fail( ee.getMessage() );
+        }
+    }
+
+    /**
+     * Test the decoding of a SearchResultReference with no reference
+     */
+    public void testDecodeSearchResultReferenceNoReference() throws NamingException
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer  stream      = ByteBuffer.allocate( 0x07 );
+        
+
+        stream.put(
+            new byte[]
+            {
+                 
+                
+                0x30, 0x05,         // LDAPMessage ::=SEQUENCE {
+                  0x02, 0x01, 0x01, //     messageID MessageID
+                  0x73, 0x00        //     CHOICE { ..., searchResEntry  SearchResultEntry, ...
+                                    // SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
+            } );
+
+        stream.flip();
+
+        // Allocate a LdapMessage Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        // Decode a SearchResultReference message
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            System.out.println( de.getMessage() );
+            assertTrue( true );
+            return;
+        }
+        
+        fail( "We should not reach this point" );
+    }
+
+    /**
+     * Test the decoding of a SearchResultReference with one reference
+     */
+    public void testDecodeSearchResultReferenceOneReference() throws NamingException
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer  stream      = ByteBuffer.allocate( 0x11 );
+        
+
+        stream.put(
+            new byte[]
+            {
+                 
+                
+                0x30, 0x0F,         // LDAPMessage ::=SEQUENCE {
+                  0x02, 0x01, 0x01, //     messageID MessageID
+                  0x73, 0x0A,        //     CHOICE { ..., searchResEntry  SearchResultEntry, ...
+                    0x04, 0x08, 'l', 'd', 'a', 'p', ':', '/', '/', '/'  // SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
+            } );
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+        stream.flip();
+
+        // Allocate a BindRequest Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            fail( de.getMessage() );
+        }
+        
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchResultReference searchResultReference      = message.getSearchResultReference();
+
+        assertEquals( 1, message.getMessageId() );
+        
+        LdapURL ldapUrl = (LdapURL)searchResultReference.getSearchResultReferences().get( 0 );
+        
+        assertEquals( "ldap:///", ldapUrl.toString() );
+        
+        // Check the length
+        assertEquals(0x11, message.computeLength());
+        
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = message.encode( null );
+            
+            String encodedPdu = StringTools.dumpBytes( bb.array() ); 
+            
+            assertEquals(encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            fail( ee.getMessage() );
         }
     }
 }



Mime
View raw message