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/06 19:16:18 UTC
svn commit: r429157 -
/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
Author: akarasulu
Date: Sun Aug 6 10:16:18 2006
New Revision: 429157
URL: http://svn.apache.org/viewvc?rev=429157&view=rev
Log:
fix for DIRSERVER-643: adding entry ith two attributes of same type does not combine
Modified:
directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java?rev=429157&r1=429156&r2=429157&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java (original)
+++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java Sun Aug 6 10:16:18 2006
@@ -20,6 +20,12 @@
import javax.naming.directory.*;
import javax.naming.NamingException;
+import netscape.ldap.LDAPAttribute;
+import netscape.ldap.LDAPAttributeSet;
+import netscape.ldap.LDAPConnection;
+import netscape.ldap.LDAPEntry;
+import netscape.ldap.LDAPException;
+
import org.apache.directory.server.unit.AbstractServerTest;
import java.util.Hashtable;
@@ -188,5 +194,54 @@
{
// expected
}
+ }
+
+
+
+ static final String HOST = "localhost";
+ static final String USER = "uid=admin,ou=system";
+ static final String PASSWORD = "secret";
+ static final String BASE = "ou=system";
+
+
+ /**
+ * 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 testAddEntryWithTwoDescriptions() 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();
}
}