You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/08/08 06:34:31 UTC

svn commit: r429566 - /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java

Author: akarasulu
Date: Mon Aug  7 21:34:30 2006
New Revision: 429566

URL: http://svn.apache.org/viewvc?rev=429566&view=rev
Log:
Fix for DIRSERVER-700: entry add with 2-desc values separated still shows one value

Modified:
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java?rev=429566&r1=429565&r2=429566&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java (original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java Mon Aug  7 21:34:30 2006
@@ -225,7 +225,88 @@
             { "a British singer-songwriter with an expressive four-octave voice",
                 "one of the most influential female artists of the twentieth century" };
 
+        attrs.add( new LDAPAttribute( "description", descr ) );
+
+        String dn = "cn=Kate Bush," + BASE;
+        LDAPEntry kate = new LDAPEntry( dn, attrs );
+
+        con.add( kate );
+
+        // Analyze entry and description attribute
+        LDAPEntry kateReloaded = con.read( dn );
+        assertNotNull( kateReloaded );
+        LDAPAttribute attr = kateReloaded.getAttribute( "description" );
+        assertNotNull( attr );
+        assertEquals( 2, attr.getStringValueArray().length );
+
+        // Remove entry
+        con.delete( dn );
+        con.disconnect();
+    }
+
+
+    /**
+     * Testcase to demonstrate DIRSERVER-643 ("Netscape SDK: Adding an entry with
+     * two description attributes does not combine values."). Uses Sun ONE Directory
+     * SDK for Java 4.1 , or comparable (Netscape, Mozilla).
+     */
+    public void testAddEntryWithTwoDescriptionsVariant() throws LDAPException
+    {
+        LDAPConnection con = new LDAPConnection();
+        con.connect( 3, HOST, super.port, USER, PASSWORD );
+        LDAPAttributeSet attrs = new LDAPAttributeSet();
+        LDAPAttribute ocls = new LDAPAttribute( "objectclass", new String[]
+            { "top", "person" } );
+        attrs.add( ocls );
+        attrs.add( new LDAPAttribute( "sn", "Bush" ) );
+        attrs.add( new LDAPAttribute( "cn", "Kate Bush" ) );
+
+        String descr[] =
+            { "a British singer-songwriter with an expressive four-octave voice",
+                "one of the most influential female artists of the twentieth century" };
+
         attrs.add( new LDAPAttribute( "description", descr[0] ) );
+        attrs.add( new LDAPAttribute( "description", descr[1] ) );
+
+        String dn = "cn=Kate Bush," + BASE;
+        LDAPEntry kate = new LDAPEntry( dn, attrs );
+
+        con.add( kate );
+
+        // Analyze entry and description attribute
+        LDAPEntry kateReloaded = con.read( dn );
+        assertNotNull( kateReloaded );
+        LDAPAttribute attr = kateReloaded.getAttribute( "description" );
+        assertNotNull( attr );
+        assertEquals( 2, attr.getStringValueArray().length );
+
+        // Remove entry
+        con.delete( dn );
+        con.disconnect();
+    }
+
+
+    /**
+     * Testcase to demonstrate DIRSERVER-643 ("Netscape SDK: Adding an entry with
+     * two description attributes does not combine values."). Uses Sun ONE Directory
+     * SDK for Java 4.1 , or comparable (Netscape, Mozilla).
+     */
+    public void testAddEntryWithTwoDescriptionsSecondVariant() throws LDAPException
+    {
+        LDAPConnection con = new LDAPConnection();
+        con.connect( 3, HOST, super.port, USER, PASSWORD );
+        LDAPAttributeSet attrs = new LDAPAttributeSet();
+        LDAPAttribute ocls = new LDAPAttribute( "objectclass", new String[]
+            { "top", "person" } );
+        attrs.add( ocls );
+        attrs.add( new LDAPAttribute( "sn", "Bush" ) );
+
+        String descr[] =
+            { "a British singer-songwriter with an expressive four-octave voice",
+                "one of the most influential female artists of the twentieth century" };
+
+        attrs.add( new LDAPAttribute( "description", descr[0] ) );
+        attrs.add( new LDAPAttribute( "cn", "Kate Bush" ) );
         attrs.add( new LDAPAttribute( "description", descr[1] ) );
 
         String dn = "cn=Kate Bush," + BASE;