directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r727022 - /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
Date Tue, 16 Dec 2008 11:29:07 GMT
Author: elecharny
Date: Tue Dec 16 03:29:06 2008
New Revision: 727022

URL: http://svn.apache.org/viewvc?rev=727022&view=rev
Log:
Fixed a failing test in shared, due to some modification in the pagedSearch control : as we
are now accepting negative values for the page sizeLimit, the test should check that.

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java?rev=727022&r1=727021&r2=727022&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
Tue Dec 16 03:29:06 2008
@@ -191,12 +191,27 @@
         try
         {
             decoder.decode( bb, container );
-            fail();
         }
         catch ( DecoderException de )
         {
-            assertTrue( true );
+            de.printStackTrace();
+            Assert.fail( de.getMessage() );
         }
+
+        PagedSearchControlCodec pagedSearch = container.getPagedSearchControl();
+        assertEquals( Integer.MAX_VALUE, pagedSearch.getSize() );
+        assertTrue( Arrays.equals( StringTools.getBytesUtf8( "test" ), 
+            pagedSearch.getCookie() ) );
+            
+        String expected = StringTools.dumpBytes( bb.array() );
+        bb.flip();
+
+        PagedSearchControlCodec ctrl = new PagedSearchControlCodec();
+        ctrl.setSize( -1 );
+        ctrl.setCookie( StringTools.getBytesUtf8( "test" ) );
+        bb = ctrl.encode( null );
+        String decoded = StringTools.dumpBytes( bb.array() );
+        assertEquals( expected, decoded );
     }
     
     



Mime
View raw message