directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r231284 - in /directory/shared/ldap/trunk/apache-provider/src: java/org/apache/ldap/common/berlib/asn1/decoder/add/ test/org/apache/ldap/common/berlib/asn1/decoder/add/ test/org/apache/ldap/common/berlib/asn1/decoder/search/
Date Wed, 10 Aug 2005 17:32:42 GMT
Author: akarasulu
Date: Wed Aug 10 10:32:30 2005
New Revision: 231284

URL: http://svn.apache.org/viewcvs?rev=231284&view=rev
Log:
More corrections to the usage of LockableAttributesImpl.put().  These changes
should fix the specific problems in DIREVE-216.

Modified:
    directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
    directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
    directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java

Modified: directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java?rev=231284&r1=231283&r2=231284&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
(original)
+++ directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
Wed Aug 10 10:32:30 2005
@@ -19,8 +19,10 @@
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
 import org.apache.asn1.ber.primitives.UniversalTag;
+import org.apache.ldap.common.message.LockableAttributeImpl;
 
 import javax.naming.directory.Attributes;
+import javax.naming.directory.Attribute;
 import java.nio.ByteBuffer;
 
 
@@ -82,7 +84,15 @@
         }
 
         // Add the attribute
-        attrs.put( id, new String( octets ) ) ;
+        Attribute attr = attrs.get( id );
+
+        if ( attr == null )
+        {
+            attr = new LockableAttributeImpl( id );
+            attrs.put( attr );
+        }
+
+        attr.add( new String( octets ) ) ;
 
         // clean up
         setConstructed( false ) ;

Modified: directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java?rev=231284&r1=231283&r2=231284&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
(original)
+++ directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
Wed Aug 10 10:32:30 2005
@@ -21,6 +21,7 @@
 import org.apache.ldap.common.message.AddRequest;
 import org.apache.ldap.common.message.AddRequestImpl;
 import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.message.LockableAttributeImpl;
 
 
 /**
@@ -42,8 +43,10 @@
         AddRequestImpl expected = new AddRequestImpl( 33 ) ;
         expected.setName( "dc=example,dc=com" ) ;
         LockableAttributesImpl attrs = new LockableAttributesImpl( expected ) ;
-        attrs.put( "objectClass", "top" ) ;
-        attrs.put( "objectClass", "dcObject" ) ;
+        LockableAttributeImpl objectClass = new LockableAttributeImpl( attrs, "objectClass"
);
+        attrs.put( objectClass );
+        objectClass.add( "top" ) ;
+        objectClass.add( "dcObject" ) ;
         attrs.put( "dc", "dc=example" ) ;
         expected.setEntry( attrs ) ;
 

Modified: directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java?rev=231284&r1=231283&r2=231284&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
(original)
+++ directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
Wed Aug 10 10:32:30 2005
@@ -21,6 +21,7 @@
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.message.SearchResponseEntry;
 import org.apache.ldap.common.message.SearchResponseEntryImpl;
+import org.apache.ldap.common.message.LockableAttributeImpl;
 
 
 /**
@@ -32,7 +33,7 @@
  */
 public class SearchResponseEntryTest extends RuleTestCase
 {
-    public void testAddRequest() throws Exception
+    public void testSetResponseEntry() throws Exception
     {
         byte[] pdu = new byte[] {0x30, 0x4E, 0x02, 0x01, 0x21, 0x64, 0x49, 0x04, 0x11, 0x64,
0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F,
0x6D, 0x30, 0x34, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C,
0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x04, 0x08, 0x64, 0x63, 0x4F,
0x62, 0x6A, 0x65, 0x63, 0x74, 0x30, 0x12, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0C, 0x04, 0x0A,
0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65};
         SearchResponseEntry decoded = ( SearchResponseEntry ) decode( pdu );
@@ -40,8 +41,10 @@
         SearchResponseEntryImpl expected = new SearchResponseEntryImpl( 33 ) ;
         expected.setObjectName( "dc=example,dc=com" ) ;
         LockableAttributesImpl attrs = new LockableAttributesImpl( expected ) ;
-        attrs.put( "objectClass", "top" ) ;
-        attrs.put( "objectClass", "dcObject" ) ;
+        LockableAttributeImpl objectClass = new LockableAttributeImpl( attrs, "objectClass"
);
+        attrs.put( objectClass );
+        objectClass.add( "top" ) ;
+        objectClass.add( "dcObject" ) ;
         attrs.put( "dc", "dc=example" ) ;
         expected.setAttributes( attrs ); ;
 



Mime
View raw message