You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/11/11 12:46:45 UTC

svn commit: r593869 - /directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java

Author: seelmann
Date: Sun Nov 11 03:46:45 2007
New Revision: 593869

URL: http://svn.apache.org/viewvc?rev=593869&view=rev
Log:
Added test for DIRSERVER-1096

Modified:
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java?rev=593869&r1=593868&r2=593869&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java Sun Nov 11 03:46:45 2007
@@ -437,4 +437,56 @@
         ctx.unbind( newRdn );
     }
     */
-}
\ No newline at end of file
+
+
+    /**
+     * Test for DIRSERVER-1096.
+     * Modify the RDN of an entry with an encoded new RDN. 
+     * Ensure that the attribute itself contains the unencoded value.
+     *
+     * @throws Exception
+     */
+    /*
+    @Test public void testModifyRdnWithEncodedNewRdn() throws Exception
+    {
+        // Create a person, cn value is rdn
+        String cnVal = "Tori Amos";
+        String snVal = "Amos";
+        String oldRdn = "cn=" + cnVal;
+        Attributes attributes = this.getPersonAttributes( snVal, cnVal );
+        ctx.createSubcontext( oldRdn, attributes );
+
+        // modify Rdn from cn=Tori Amos to cn=Ä\+
+        String newCnVal = new String( new byte[]
+             { ( byte ) 0xC3, ( byte ) 0x84, '\\', '+' }, "UTF-8" );
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "true" );
+        String newRdn = "cn=" + newCnVal;
+        ctx.rename( oldRdn, newRdn );
+
+        // Check, whether old Entry does not exists
+        try
+        {
+            ctx.lookup( oldRdn );
+            fail( "Entry must not exist" );
+        }
+        catch ( NameNotFoundException ignored )
+        {
+            // expected behaviour
+        }
+        
+        // Check, whether new Entry exists
+        DirContext newCtx = ( DirContext ) ctx.lookup( newRdn );
+        assertNotNull( newCtx );
+
+        // Check that cn contains the unecnoded value
+        Attribute cn = newCtx.getAttributes( "" ).get( "cn" );
+        assertEquals( "Number of cn occurences", 1, cn.size() );
+        assertTrue( cn.contains( newCnVal ) );
+
+        // Remove entry (use new rdn)
+        ctx.unbind( newRdn );
+    }
+    */
+
+}
+