directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r697898 - in /directory: apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ shared/trunk/ldap/src/main/java/org/apache/dire...
Date Mon, 22 Sep 2008 16:58:28 GMT
Author: elecharny
Date: Mon Sep 22 09:58:28 2008
New Revision: 697898

URL: http://svn.apache.org/viewvc?rev=697898&view=rev
Log:
Fixed DIRSERVER-1269 : the attributeType was lowercased when it should remain the same

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java?rev=697898&r1=697897&r2=697898&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
Mon Sep 22 09:58:28 2008
@@ -27,7 +27,9 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
@@ -338,4 +340,31 @@
 
         sysRoot.destroySubcontext( rdn );
     }
+    
+    
+    /**
+     * Create a person entry, replace telephoneNumber, verify the 
+     * case of the attribute description attribute.
+     */
+    @Test
+    public void testReplaceCaseOfAttributeDescription() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( ldapService ).lookup( BASE );
+        String rdn = "cn=Kate Bush";
+
+        // Replace telephoneNumber
+        String newValue = "2345678901";
+        Attributes attrs = new BasicAttributes( "telephoneNumber", newValue, false );
+        ctx.modifyAttributes( rdn, DirContext.REPLACE_ATTRIBUTE, attrs );
+
+        // Verify, that
+        // - case of attribute description is correct
+        // - attribute value is added 
+        attrs = ctx.getAttributes( rdn );
+        Attribute attr = attrs.get( "telephoneNumber" );
+        assertNotNull( attr );
+        assertEquals( "telephoneNumber", attr.getID() );
+        assertTrue( attr.contains( newValue ) );
+        assertEquals( 1, attr.size() );
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java?rev=697898&r1=697897&r2=697898&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
Mon Sep 22 09:58:28 2008
@@ -179,7 +179,7 @@
      */
     public void addAttributeTypeAndValues( String type )
     {
-        currentAttribute = new DefaultClientAttribute( StringTools.lowerCaseAscii( type )
);
+        currentAttribute = new DefaultClientAttribute( type );
 
         Modification modification = new ClientModification( currentOperation, currentAttribute
);
         modifications.add( modification );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=697898&r1=697897&r2=697898&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
Mon Sep 22 09:58:28 2008
@@ -3533,7 +3533,7 @@
         
         for ( byte b:bytes )
         {
-            chars[pos++] = TO_LOWER_CASE[b];
+            chars[pos++] = (char)b;
         }
         
         return new String( chars );



Mime
View raw message