directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1129756 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Date Tue, 31 May 2011 15:26:32 GMT
Author: elecharny
Date: Tue May 31 15:26:31 2011
New Revision: 1129756

URL: http://svn.apache.org/viewvc?rev=1129756&view=rev
Log:
Added a test to demonstrate that we can now inject strings longer than 64K in the server (cf
DIRSERVER-1319)

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=1129756&r1=1129755&r2=1129756&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Tue May 31 15:26:31 2011
@@ -96,7 +96,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Strings;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -1436,4 +1435,51 @@ public class AddIT extends AbstractLdapT
 
         connection.add( personEntry );
     }
+
+
+    /**
+     * Adding an entry with a 100K attribute's value.
+     * 
+     * @throws Exception 
+     */
+    @Test( expected = LdapOperationException.class )
+    public void testAddEntry100KData() throws Exception
+    {
+        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer()
);
+
+        int size = 100*1024;
+        byte[] dataBytes = new byte[size];
+        
+        for ( int i = 0; i < size; i++)
+        {
+            dataBytes[i] = 'A';
+        }
+        
+        String data = Strings.utf8ToString( dataBytes );
+
+        Dn dn = new Dn( "cn=Kate Bush," + BASE );
+        
+        Entry personEntry = new DefaultEntry( "cn=Kate Bush," + BASE,
+        "objectClass: top",
+        "objectClass: person",
+        "cn: Kate Bush",
+        "sn: Bush",
+        "description", data );
+
+        connection.add( personEntry );
+        
+        // Check that the entry has been stored 
+        Entry entry = connection.lookup( dn, "description", "cn", "sn" );
+        
+        String description = entry.get( "description" ).getString();
+        
+        assertNotNull( description );
+        assertTrue( description.startsWith( "AAA" ) );
+        assertEquals( size, description.length() );
+        
+        for ( int i = 0; i < size; i++ )
+        {
+            assertEquals( 'A', description.charAt( i ) );
+        }
+    }
 }



Mime
View raw message