You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/02/28 12:50:46 UTC
svn commit: r1294594 -
/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Author: elecharny
Date: Tue Feb 28 11:50:46 2012
New Revision: 1294594
URL: http://svn.apache.org/viewvc?rev=1294594&view=rev
Log:
Added a test for DIRSERVER-1681
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=1294594&r1=1294593&r2=1294594&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 Feb 28 11:50:46 2012
@@ -1478,4 +1478,47 @@ public class AddIT extends AbstractLdapT
assertEquals( 'A', description.charAt( i ) );
}
}
+
+
+ /**
+ * Test case to demonstrate DIRSERVER-1681
+ * Create an entry with a certificate;binary value
+ *
+ * @throws LDAPException if we fail to connect and add entries
+ */
+ @Test
+ public void testAddWithCertificateBinary() throws Exception
+ {
+ LdapConnection con = getAdminConnection( getLdapServer() );
+ con.loadSchema();
+
+ String dn = "cn=Kate Bush," + BASE;
+ Entry kate = new DefaultEntry( dn,
+ "objectclass: top",
+ "objectclass: person",
+ "objectclass: inetOrgPerson",
+ "userCertificate;binary:: PEhlbGxvIHdvcmxkICE+", // This is "<hello world !>"
+ "sn: Bush",
+ "cn: Kate Bush" );
+
+ con.add( kate );
+
+ // Analyze entry and description attribute
+ Entry kateReloaded = con.lookup( dn );
+ assertNotNull( kateReloaded );
+ Attribute certificate = kateReloaded.get( "userCertificate;binary" );
+ assertNotNull( certificate );
+ assertEquals( 1, certificate.size() );
+ assertTrue( certificate.contains( Strings.getBytesUtf8( "<Hello world !>" ) ) );
+
+ // Same check without the ";binary"
+ certificate = kateReloaded.get( "userCertificate" );
+ assertNotNull( certificate );
+ assertEquals( 1, certificate.size() );
+ assertTrue( certificate.contains( Strings.getBytesUtf8( "<Hello world !>" ) ) );
+
+ // Remove entry
+ con.delete( dn );
+ con.unBind();
+ }
}