directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r494173 [2/2] - in /directory/trunks/shared/ldap: ./ src/main/antlr/ src/main/java/org/apache/directory/shared/ldap/aci/ src/main/java/org/apache/directory/shared/ldap/codec/ src/main/java/org/apache/directory/shared/ldap/codec/add/ src/mai...
Date Mon, 08 Jan 2007 19:42:37 GMT
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java Mon Jan  8 11:42:35 2007
@@ -31,7 +31,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -127,7 +126,7 @@
      * @param mod
      *            a ModificationItem to add.
      */
-    public void addModification( ModificationItem mod )
+    public void addModification( ModificationItemImpl mod )
     {
         mods.add( mod );
     }
@@ -140,7 +139,7 @@
      * @param mod
      *            a ModificationItem to remove.
      */
-    public void removeModification( ModificationItem mod )
+    public void removeModification( ModificationItemImpl mod )
     {
         mods.remove( mod );
     }
@@ -227,9 +226,9 @@
 
         for ( int ii = 0; ii < mods.size(); ii++ )
         {
-            ModificationItem item = ( ModificationItem ) list.next();
+            ModificationItemImpl item = ( ModificationItemImpl ) list.next();
 
-            if ( !equals( ( ModificationItem ) mods.get( ii ), item ) )
+            if ( !equals( ( ModificationItemImpl ) mods.get( ii ), item ) )
             {
                 return false;
             }
@@ -249,7 +248,7 @@
      *            the second ModificationItem to compare
      * @return true if the ModificationItems are equal, false otherwise
      */
-    private boolean equals( ModificationItem item0, ModificationItem item1 )
+    private boolean equals( ModificationItemImpl item0, ModificationItemImpl item1 )
     {
         if ( item0 == item1 )
         {
@@ -342,7 +341,7 @@
             for ( int i = 0; i < mods.size(); i++ )
             {
 
-                ModificationItem modification = ( ModificationItem ) mods.get( i );
+                ModificationItemImpl modification = ( ModificationItemImpl ) mods.get( i );
 
                 sb.append( "            Modification[" ).append( i ).append( "]\n" );
                 sb.append( "                Operation : " );

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java Mon Jan  8 11:42:35 2007
@@ -19,8 +19,12 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
-import java.util.*;
 
 
 /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java Mon Jan  8 11:42:35 2007
@@ -30,10 +30,10 @@
 import javax.naming.InvalidNameException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 
 import org.apache.commons.collections.MultiHashMap;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -877,7 +877,7 @@
     */
    public Attributes toAttributes()
    {
-       Attributes attributes = new BasicAttributes( true );
+       Attributes attributes = new AttributesImpl( true );
        Attribute attribute = null;
 
        switch ( nbAtavs  )
@@ -886,7 +886,7 @@
                break;
 
            case 1 :
-               attribute = new BasicAttribute( atavType, true );
+               attribute = new AttributeImpl( atavType, true );
                attribute.add( atav.getValue() );
                attributes.put( attribute );
                break;
@@ -899,7 +899,7 @@
                    String type = ( String ) types.next();
                    List values = ( List ) atavTypes.get( type );
 
-                   attribute = new BasicAttribute( type, true );
+                   attribute = new AttributeImpl( type );
 
                    Iterator iterValues = values.iterator();
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java Mon Jan  8 11:42:35 2007
@@ -25,9 +25,9 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 
 
 /**
@@ -47,7 +47,7 @@
      * @return the resultant entry after the modifications have taken place
      * @throws NamingException if there are problems accessing attributes
      */
-    public static Attributes getTargetEntry( ModificationItem[] mods, Attributes entry ) throws NamingException
+    public static Attributes getTargetEntry( ModificationItemImpl[] mods, Attributes entry ) throws NamingException
     {
         Attributes targetEntry = ( Attributes ) entry.clone();
         for ( int ii = 0; ii < mods.length; ii++ )
@@ -60,7 +60,7 @@
                     targetEntry.put( mods[ii].getAttribute() );
                     break;
                 case( DirContext.ADD_ATTRIBUTE ):
-                    Attribute combined = new LockableAttributeImpl( id );
+                    Attribute combined = new AttributeImpl( id );
                     Attribute toBeAdded = mods[ii].getAttribute();
                     Attribute existing = entry.get( id );
                     
@@ -156,7 +156,7 @@
                 while ( list.hasMore() )
                 {
                     String id = list.next();
-                    Attribute combined = new LockableAttributeImpl( id );
+                    Attribute combined = new AttributeImpl( id );
                     Attribute toBeAdded = mods.get( id );
                     Attribute existing = entry.get( id );
                     

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java Mon Jan  8 11:42:35 2007
@@ -29,10 +29,10 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
 
@@ -95,7 +95,7 @@
         byte[] buf = getClassFileAsStream( clazz );
         String fullClassName = clazz.getName();
         
-        Attributes attributes = new BasicAttributes( "objectClass", "top", true );
+        Attributes attributes = new AttributesImpl( "objectClass", "top", true );
         attributes.get( "objectClass" ).add( "javaClass" );
         attributes.put( "fullyQualifiedJavaClassName", fullClassName );
         attributes.put( "javaClassByteCode", buf );

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java Mon Jan  8 11:42:35 2007
@@ -24,11 +24,12 @@
 import javax.naming.NamingException;
 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.ldap.LdapContext;
 
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+
 /**
  * A utility class for working with Triggers Execution Administrative Points
  * Trigger Execution Subentries and Trigger Specifications.
@@ -52,7 +53,7 @@
         Attribute administrativeRole = ap.get( ADMINISTRATIVE_ROLE_ATTR );
         if ( administrativeRole == null || !administrativeRole.contains( TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE ) )
         {
-            Attributes changes = new BasicAttributes( ADMINISTRATIVE_ROLE_ATTR, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE, true );
+            Attributes changes = new AttributesImpl( ADMINISTRATIVE_ROLE_ATTR, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE, true );
             apCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
         }
     }
@@ -64,8 +65,8 @@
         String subtreeSpec,
         String prescriptiveTriggerSpec ) throws NamingException
     {
-        Attributes subentry = new BasicAttributes( "cn", subentryCN, true );
-        Attribute objectClass = new BasicAttribute( "objectClass" );
+        Attributes subentry = new AttributesImpl( "cn", subentryCN, true );
+        Attribute objectClass = new AttributeImpl( "objectClass" );
         subentry.put( objectClass );
         objectClass.add( "top" );
         objectClass.add( "subentry" );
@@ -81,7 +82,7 @@
         String subentryCN,
         String triggerSpec ) throws NamingException
     {        
-        Attributes changes = new BasicAttributes( PRESCRIPTIVE_TRIGGER_SPECIFICATION_ATTR, triggerSpec, true );
+        Attributes changes = new AttributesImpl( PRESCRIPTIVE_TRIGGER_SPECIFICATION_ATTR, triggerSpec, true );
         apCtx.modifyAttributes( "cn=" + subentryCN, DirContext.ADD_ATTRIBUTE, changes );
     }
     
@@ -90,7 +91,7 @@
         LdapContext ctx,
         String triggerSpec ) throws NamingException
     {        
-        Attributes changes = new BasicAttributes( ENTRY_TRIGGER_SPECIFICATION_ATTR, triggerSpec, true );
+        Attributes changes = new AttributesImpl( ENTRY_TRIGGER_SPECIFICATION_ATTR, triggerSpec, true );
         ctx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java Mon Jan  8 11:42:35 2007
@@ -20,13 +20,16 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
+import java.util.Arrays;
+
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 
@@ -40,6 +43,139 @@
 public class AttributeUtils
 {
     /**
+     * Compare two values and return true if they are equal.
+     * 
+     * @param value1 The first value
+     * @param value2 The second value
+     * @return true if both value are null or if they are equal.
+     */
+    public final static boolean equals( Object value1, Object value2 )
+    {
+        if ( value1 == value2 )
+        {
+            return true;
+        }
+        
+        if ( value1 instanceof byte[] )
+        {
+            if ( value2 instanceof byte[] )
+            {
+                return Arrays.equals( (byte[])value1, (byte[])value2 );
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return value1.equals( value2 );
+        }
+    }
+    
+    /**
+     * Clone the value. An attribute value is supposed to be either a String
+     * or a byte array. If it's a String, then we just return it ( as String
+     * is immutable, we don't need to copy it). If it's a bu=yte array, we
+     * create a new byte array and copy the bytes into it.
+     * 
+     * @param value The value to clone
+     * @return The cloned value
+     */
+    public final static Object cloneValue( Object value )
+    {
+        // First copy the value
+        Object newValue = null;
+        
+        if ( value instanceof byte[] )
+        {
+            newValue = ((byte[])value).clone();
+        }
+        else
+        {
+            newValue = value;
+        }
+        
+        return newValue;
+    }
+
+    /**
+     * Switch from a BasicAttribute to a AttributeImpl. This is
+     * necessary to allow cloning to be correctly handled.
+     * 
+     * @param attribute The attribute to transform
+     * @return A instance of AttributeImpl
+     */
+    public final static Attribute toAttributeImpl( Attribute attribute )
+    {
+        if ( attribute instanceof AttributeImpl )
+        {
+            // Just return the attribute
+            return attribute;
+        }
+        else
+        {
+            // Create a new AttributeImpl from the original attribute
+            AttributeImpl newAttribute = new AttributeImpl( attribute.getID() );
+            
+            try
+            {
+                NamingEnumeration values = attribute.getAll();
+                
+                while ( values.hasMoreElements() )
+                {
+                    newAttribute.add( cloneValue( values.next() ) );
+                }
+                
+                return newAttribute;
+            }
+            catch ( NamingException ne )
+            {
+                return newAttribute;
+            }
+        }
+    }
+    
+    /**
+     * Switch from a BasicAttributes to a AttributesImpl. This is
+     * necessary to allow cloning to be correctly handled.
+     * 
+     * @param attributes The attributes to transform
+     * @return A instance of AttributesImpl
+     */
+    public final static Attributes toAttributesImpl( Attributes attributes )
+    {
+        if ( attributes instanceof AttributesImpl )
+        {
+            // Just return the attribute
+            return attributes;
+        }
+        else
+        {
+            // Create a new AttributesImpl from the original attribute
+            AttributesImpl newAttributes = new AttributesImpl( attributes.isCaseIgnored() );
+            
+            try
+            {
+                NamingEnumeration values = attributes.getAll();
+                
+                while ( values.hasMoreElements() )
+                {
+                    Attribute attribute = (Attribute)values.next();
+                    
+                    newAttributes.put( toAttributeImpl( attribute ) );
+                }
+                
+                return newAttributes;
+            }
+            catch ( NamingException ne )
+            {
+                return newAttributes;
+            }
+        }
+    }
+    
+    /**
      * Utility method to extract an attribute from Attributes object using
      * all combinationos of the name including aliases.
      * 
@@ -81,7 +217,7 @@
      * @param type the attributeType spec of the Attribute to extract
      * @return the extract Attribute or null if no such attribute exists
      */
-    public final static Attribute getAttribute( ModificationItem[] mods, AttributeType type )
+    public final static Attribute getAttribute( ModificationItemImpl[] mods, AttributeType type )
     {
         // optimization bypass to avoid cost of the loop below
         if ( type.getNames().length == 1 )
@@ -231,7 +367,7 @@
         }
         else if ( attr0 == null )
         {
-            return new LockableAttributeImpl( attr1.getID() );
+            return new AttributeImpl( attr1.getID() );
         }
         else if ( attr1 == null )
         {
@@ -246,7 +382,7 @@
             id = attr0.getID();
         }
 
-        Attribute attr = new LockableAttributeImpl( id );
+        Attribute attr = new AttributeImpl( id );
 
         if ( attr0 != null )
         {
@@ -309,7 +445,7 @@
             id = attr0.getID();
         }
 
-        Attribute attr = new LockableAttributeImpl( id );
+        Attribute attr = new AttributeImpl( id );
 
         if ( attr0 != null )
         {
@@ -341,60 +477,93 @@
      *            The attributes to print
      * @return A string
      */
-    public static String toString( String tabs, Attributes attributes )
+    public static String toString( String tabs, Attribute attribute )
     {
         StringBuffer sb = new StringBuffer();
 
-        sb.append( tabs ).append( "Attributes\n" );
+        sb.append( tabs ).append( "Attribute\n" );
 
-        if ( attributes != null )
+        if ( attribute != null )
         {
-            NamingEnumeration attributesIterator = attributes.getAll();
-    
-            while ( attributesIterator.hasMoreElements() )
+            sb.append( tabs ).append( "    Type : '" ).append( attribute.getID() ).append( "'\n" );
+
+            for ( int j = 0; j < attribute.size(); j++ )
             {
-                Attribute attribute = ( Attribute ) attributesIterator.nextElement();
-    
-                if ( attribute != null )
+
+                try
                 {
-                    sb.append( tabs ).append( "    Type : '" ).append( attribute.getID() ).append( "'\n" );
-        
-                    for ( int j = 0; j < attribute.size(); j++ )
+                    Object attr = attribute.get( j );
+
+                    if ( attr != null )
                     {
-        
-                        try
+                        if ( attr instanceof String )
                         {
-                            Object attr = attribute.get( j );
-        
-                            if ( attr != null )
-                            {
-                                if ( attr instanceof String )
-                                {
-                                    sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " ).append( attr ).append(
-                                        " \n" );
-                                }
-                                else if ( attr instanceof byte[] )
-                                {
-                                    String string = StringTools.utf8ToString( ( byte[] ) attr );
-            
-                                    sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " );
-                                    sb.append( string ).append( '/' );
-                                    sb.append( StringTools.dumpBytes( ( byte[] ) attr ) );
-                                    sb.append( " \n" );
-                                }
-                                else
-                                {
-                                    sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " ).append( attr ).append(
-                                        " \n" );
-                                }
-                            }
+                            sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " ).append( attr ).append(
+                                " \n" );
                         }
-                        catch ( NamingException ne )
+                        else if ( attr instanceof byte[] )
                         {
-                            sb.append( "Bad attribute : " ).append( ne.getMessage() );
+                            String string = StringTools.utf8ToString( ( byte[] ) attr );
+    
+                            sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " );
+                            sb.append( string ).append( '/' );
+                            sb.append( StringTools.dumpBytes( ( byte[] ) attr ) );
+                            sb.append( " \n" );
+                        }
+                        else
+                        {
+                            sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " ).append( attr ).append(
+                                " \n" );
                         }
                     }
                 }
+                catch ( NamingException ne )
+                {
+                    sb.append( "Bad attribute : " ).append( ne.getMessage() );
+                }
+            }
+        }
+        
+        return sb.toString();
+    }
+
+    /**
+     * Return a string representing the attributes
+     * 
+     * @param attributes
+     *            The attributes to print
+     * @return A string
+     */
+    public static String toString( Attribute attribute )
+    {
+        return toString( "", attribute );
+    }
+
+    /**
+     * Return a string representing the attributes with tabs in front of the
+     * string
+     * 
+     * @param tabs
+     *            Spaces to be added before the string
+     * @param attributes
+     *            The attributes to print
+     * @return A string
+     */
+    public static String toString( String tabs, Attributes attributes )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( tabs ).append( "Attributes\n" );
+
+        if ( attributes != null )
+        {
+            NamingEnumeration attributesIterator = attributes.getAll();
+    
+            while ( attributesIterator.hasMoreElements() )
+            {
+                Attribute attribute = ( Attribute ) attributesIterator.nextElement();
+    
+                sb.append( tabs ).append( attribute.toString() );
             }
         }
         

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java Mon Jan  8 11:42:35 2007
@@ -27,7 +27,11 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.sql.SQLException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 
 /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java Mon Jan  8 11:42:35 2007
@@ -22,9 +22,13 @@
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.*;
 import java.util.ArrayList;
 import java.util.List;
+
+import javax.naming.CompositeName;
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+import javax.naming.NamingException;
 
 
 /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java Mon Jan  8 11:42:35 2007
@@ -20,13 +20,21 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import java.util.*;
 
 import java.io.File;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.FileInputStream;
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
 
 import javax.naming.directory.Attributes;
 import javax.naming.NamingException;
@@ -34,7 +42,7 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 
 
 /**
@@ -689,7 +697,7 @@
         {
             if ( values == null )
             {
-                return new LockableAttributesImpl();
+                return new AttributesImpl();
             }
 
             return values;

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java Mon Jan  8 11:42:35 2007
@@ -24,7 +24,18 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.util.*;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
 
 
 /**

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java Mon Jan  8 11:42:35 2007
@@ -29,8 +29,8 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -140,7 +140,7 @@
         lVal2.add( "test3" );
         typesVals.put( "attrs", lVal2 );
 
-        BasicAttribute attributeValue = ( BasicAttribute ) attributes.get( "l" );
+        Attribute attributeValue = attributes.get( "l" );
 
         assertTrue( expectedTypes.contains( attributeValue.getID().toLowerCase() ) );
 
@@ -156,7 +156,7 @@
             vals.remove( value.toString() );
         }
 
-        attributeValue = ( BasicAttribute ) attributes.get( "attrs" );
+        attributeValue = attributes.get( "attrs" );
 
         assertTrue( expectedTypes.contains( attributeValue.getID().toLowerCase() ) );
 
@@ -627,7 +627,7 @@
 
         assertEquals( 1, attributes.size() );
 
-        BasicAttribute attributeValue = ( BasicAttribute ) attributes.get( "l" );
+        Attribute attributeValue = attributes.get( "l" );
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
 
@@ -719,7 +719,7 @@
 
         assertEquals( 1, attributes.size() );
 
-        BasicAttribute attributeValue = ( BasicAttribute ) attributes.get( "l" );
+        Attribute attributeValue = attributes.get( "l" );
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java Mon Jan  8 11:42:35 2007
@@ -24,8 +24,7 @@
 import java.util.List;
 
 import javax.naming.NamingException;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.ModificationItem;
+import javax.naming.directory.Attribute;
 
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -38,6 +37,7 @@
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequest;
 import org.apache.directory.shared.ldap.message.Message;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -120,20 +120,20 @@
         assertEquals( 1, message.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 2, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue =  modification.getAttribute();
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
 
         String attrValue = ( String ) attributeValue.get( 0 );
         assertEquals( "Paris", attrValue );
 
-        modification = ( ModificationItem ) modifications.get( 1 );
-        attributeValue = ( BasicAttribute ) modification.getAttribute();
+        modification = modifications.get( 1 );
+        attributeValue =  modification.getAttribute();
 
         assertEquals( "attrs", attributeValue.getID().toLowerCase() );
 
@@ -162,7 +162,7 @@
     /**
      * Test the decoding of a ModifyRequest
      */
-    public void testDecodeModifyRequestBadDN() throws NamingException
+    public void testDecodeModifyRequestBadDN()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
 
@@ -293,20 +293,20 @@
         assertEquals( 21, message.getMessageId() );
         assertEquals( "cn=Tori Amos,ou=playground,dc=apache,dc=org", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 2, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "telephonenumber", attributeValue.getID().toLowerCase() );
 
         String attrValue = ( String ) attributeValue.get( 0 );
         assertEquals( "1234567890", attrValue );
 
-        modification = ( ModificationItem ) modifications.get( 1 );
-        attributeValue = ( BasicAttribute ) modification.getAttribute();
+        modification = modifications.get( 1 );
+        attributeValue = modification.getAttribute();
 
         assertEquals( "cn", attributeValue.getID().toLowerCase() );
 
@@ -416,18 +416,18 @@
         assertEquals( 49, message.getMessageId() );
         assertEquals( "cn=Tori Amos,ou=playground,dc=apache,dc=org", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 3, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "description", attributeValue.getID().toLowerCase() );
         assertEquals( 0, attributeValue.size() );
 
-        modification = ( ModificationItem ) modifications.get( 1 );
-        attributeValue = ( BasicAttribute ) modification.getAttribute();
+        modification = modifications.get( 1 );
+        attributeValue = modification.getAttribute();
 
         String attrValue = ( String ) attributeValue.get( 0 );
 
@@ -435,8 +435,8 @@
 
         assertEquals( "01234567890", attrValue );
 
-        modification = ( ModificationItem ) modifications.get( 2 );
-        attributeValue = ( BasicAttribute ) modification.getAttribute();
+        modification = modifications.get( 2 );
+        attributeValue = modification.getAttribute();
 
         attrValue = ( String ) attributeValue.get( 0 );
 
@@ -547,12 +547,12 @@
         assertEquals( 1, message.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 2, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
 
@@ -562,8 +562,8 @@
         attrValue = ( String ) attributeValue.get( 1 );
         assertEquals( "London", attrValue );
 
-        modification = ( ModificationItem ) modifications.get( 1 );
-        attributeValue = ( BasicAttribute ) modification.getAttribute();
+        modification = modifications.get( 1 );
+        attributeValue = modification.getAttribute();
 
         assertEquals( "attrs", attributeValue.getID().toLowerCase() );
 
@@ -942,7 +942,7 @@
      * Test the decoding of a ModifyRequest with an add operation, and a
      * modification with an empty type
      */
-    public void testDecodeModifyRequestAddOperationModificationEmptyType() throws NamingException
+    public void testDecodeModifyRequestAddOperationModificationEmptyType()
     {
         Asn1Decoder ldapDecoder = new LdapDecoder();
 
@@ -1083,12 +1083,12 @@
         assertEquals( 49, message.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
         assertEquals( 0, attributeValue.size() );
@@ -1166,12 +1166,12 @@
         assertEquals( 49, message.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
         assertEquals( 0, attributeValue.size() );
@@ -1257,12 +1257,12 @@
         assertEquals( 49, message.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyRequest.getObject().toString() );
 
-        List<ModificationItem> modifications = modifyRequest.getModifications();
+        List<ModificationItemImpl> modifications = modifyRequest.getModifications();
 
         assertEquals( 1, modifications.size() );
 
-        ModificationItem modification = ( ModificationItem ) modifications.get( 0 );
-        BasicAttribute attributeValue = ( BasicAttribute ) modification.getAttribute();
+        ModificationItemImpl modification = modifications.get( 0 );
+        Attribute attributeValue = modification.getAttribute();
 
         assertEquals( "l", attributeValue.getID().toLowerCase() );
         assertEquals( 2, attributeValue.size() );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java Mon Jan  8 11:42:35 2007
@@ -27,8 +27,8 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -111,7 +111,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -221,7 +221,7 @@
 
         for ( int i = 0; i < expectedAttributes.length; i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( expectedAttributes[i] );
+            Attribute attributeValue = partialAttributesList.get( expectedAttributes[i] );
 
             assertEquals( expectedAttributes[i].toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -330,7 +330,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -803,7 +803,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -886,12 +886,12 @@
 
         assertEquals( 2, partialAttributesList.size() );
 
-        BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+        Attribute attributeValue = partialAttributesList.get( "objectclass" );
         assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
         NamingEnumeration values = attributeValue.getAll();
         assertFalse( values.hasMore() );
 
-        attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclazz" );
+        attributeValue = partialAttributesList.get( "objectclazz" );
         assertEquals( "objectClazz".toLowerCase(), attributeValue.getID().toLowerCase() );
         values = attributeValue.getAll();
         assertFalse( values.hasMore() );
@@ -973,7 +973,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -1067,7 +1067,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 
@@ -1160,7 +1160,7 @@
 
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = ( BasicAttribute ) partialAttributesList.get( "objectclass" );
+            Attribute attributeValue = partialAttributesList.get( "objectclass" );
 
             assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase() );
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java Mon Jan  8 11:42:35 2007
@@ -30,10 +30,10 @@
 
 import javax.naming.directory.Attribute;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.Control;
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 /**
@@ -1217,20 +1217,20 @@
 
         // "add: postaladdress"
         // "postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086"
-        ModificationItem item = (ModificationItem) modifs.get( 0 );
+        ModificationItemImpl item = (ModificationItemImpl) modifs.get( 0 );
         assertEquals( DirContext.ADD_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[4][1][0], item.getAttribute().getID() );
         assertEquals( values[4][1][1], item.getAttribute().get( 0 ) );
 
         // "delete: description\n" +
-        item = (ModificationItem) modifs.get( 1 );
+        item = (ModificationItemImpl) modifs.get( 1 );
         assertEquals( DirContext.REMOVE_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[4][2][0], item.getAttribute().getID() );
 
         // "replace: telephonenumber"
         // "telephonenumber: +1 408 555 1234"
         // "telephonenumber: +1 408 555 5678"
-        item = (ModificationItem) modifs.get( 2 );
+        item = (ModificationItemImpl) modifs.get( 2 );
         assertEquals( DirContext.REPLACE_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[4][3][0], item.getAttribute().getID() );
         assertEquals( values[4][3][1], item.getAttribute().get( 0 ) );
@@ -1238,7 +1238,7 @@
 
         // "delete: facsimiletelephonenumber"
         // "facsimiletelephonenumber: +1 408 555 9876"
-        item = (ModificationItem) modifs.get( 3 );
+        item = (ModificationItemImpl) modifs.get( 3 );
         assertEquals( DirContext.REMOVE_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[4][4][0], item.getAttribute().getID() );
         assertEquals( values[4][4][1], item.getAttribute().get( 0 ) );
@@ -1251,12 +1251,12 @@
         assertEquals( values[5][0][1], entry.getDn() );
 
         // "replace: postaladdress"
-        item = (ModificationItem) modifs.get( 0 );
+        item = (ModificationItemImpl) modifs.get( 0 );
         assertEquals( DirContext.REPLACE_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[5][1][0], item.getAttribute().getID() );
 
         // "delete: description"
-        item = (ModificationItem) modifs.get( 1 );
+        item = (ModificationItemImpl) modifs.get( 1 );
         assertEquals( DirContext.REMOVE_ATTRIBUTE, item.getModificationOp() );
         assertEquals( values[5][2][0], item.getAttribute().getID() );
     }

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java Mon Jan  8 11:42:35 2007
@@ -32,8 +32,8 @@
 import org.apache.directory.shared.ldap.message.AddRequest;
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.message.Control;
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ResultResponse;
@@ -49,15 +49,15 @@
 public class AddRequestImplTest extends TestCase
 {
     /**
-     * Creates and populates a LockableAttributeImpl with a specific id.
+     * Creates and populates a AttributeImpl with a specific id.
      * 
      * @param id
      *            the id for the attribute
-     * @return the LockableAttributeImpl assembled for testing
+     * @return the AttributeImpl assembled for testing
      */
-    private LockableAttributeImpl getAttribute( String id )
+    private AttributeImpl getAttribute( String id )
     {
-        LockableAttributeImpl attr = new LockableAttributeImpl( id );
+        AttributeImpl attr = new AttributeImpl( id );
         attr.add( "value0" );
         attr.add( "value1" );
         attr.add( "value2" );
@@ -70,9 +70,9 @@
      * 
      * @return
      */
-    private LockableAttributesImpl getAttributes()
+    private AttributesImpl getAttributes()
     {
-        LockableAttributesImpl attrs = new LockableAttributesImpl();
+        AttributesImpl attrs = new AttributesImpl();
         attrs.put( getAttribute( "attr0" ) );
         attrs.put( getAttribute( "attr1" ) );
         attrs.put( getAttribute( "attr2" ) );

Copied: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributeImplTest.java (from r494042, directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributeImplTest.java)
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributeImplTest.java?view=diff&rev=494173&p1=directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributeImplTest.java&r1=494042&p2=directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributeImplTest.java&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributeImplTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributeImplTest.java Mon Jan  8 11:42:35 2007
@@ -20,12 +20,15 @@
 package org.apache.directory.shared.ldap.message;
 
 
-import junit.framework.TestCase;
-
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.BasicAttribute;
 
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
+import junit.framework.TestCase;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -34,14 +37,14 @@
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  *         $Rev$
  */
-public class LockableAttributeImplTest extends TestCase
+public class AttributeImplTest extends TestCase
 {
     /**
      * Creates and populates a LockableAttributeImpl instance for tests.
      */
-    private LockableAttributeImpl getAttribute()
+    private AttributeImpl getAttribute()
     {
-        LockableAttributeImpl attr = new LockableAttributeImpl( "test-attr1" );
+        AttributeImpl attr = new AttributeImpl( "test-attr1" );
         attr.add( "value0" );
         attr.add( "value1" );
         attr.add( "value2" );
@@ -54,7 +57,7 @@
      */
     public void testEqualsSameObj()
     {
-        LockableAttributeImpl attr = getAttribute();
+        AttributeImpl attr = getAttribute();
         assertTrue( "same object should be equal", attr.equals( attr ) );
     }
 
@@ -64,8 +67,8 @@
      */
     public void testEqualsExactCopy()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        LockableAttributeImpl attr1 = getAttribute();
+        AttributeImpl attr0 = getAttribute();
+        AttributeImpl attr1 = getAttribute();
         assertTrue( "exact copies should be equal", attr0.equals( attr1 ) );
         assertTrue( "exact copies should be equal", attr1.equals( attr0 ) );
     }
@@ -76,8 +79,8 @@
      */
     public void testNotEqualDiffId()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        LockableAttributeImpl attr1 = new LockableAttributeImpl( "test-attr2" );
+        AttributeImpl attr0 = getAttribute();
+        AttributeImpl attr1 = new AttributeImpl( "test-attr2" );
         attr1.add( "value0" );
         attr1.add( "value1" );
         attr1.add( "value2" );
@@ -91,8 +94,8 @@
      */
     public void testNotEqualDiffCasedId()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        LockableAttributeImpl attr1 = new LockableAttributeImpl( "TEST-attr1" );
+        AttributeImpl attr0 = getAttribute();
+        AttributeImpl attr1 = new AttributeImpl( "TEST-attr1" );
         attr1.add( "value0" );
         attr1.add( "value1" );
         attr1.add( "value2" );
@@ -106,8 +109,8 @@
      */
     public void testNotEqualDiffValues()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        LockableAttributeImpl attr1 = new LockableAttributeImpl( "test-attr1" );
+        AttributeImpl attr0 = getAttribute();
+        AttributeImpl attr1 = new AttributeImpl( "test-attr1" );
         attr1.add( "value0" );
         attr1.add( "value1" );
         assertFalse( "Attributes with different values should not be equal", attr0.equals( attr1 ) );
@@ -129,8 +132,8 @@
      */
     public void testNotEqualWithReplicatedValues()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        LockableAttributeImpl attr1 = new LockableAttributeImpl( "test-attr1" );
+        AttributeImpl attr0 = getAttribute();
+        AttributeImpl attr1 = new AttributeImpl( "test-attr1" );
         attr1.add( "value0" );
         attr1.add( "value1" );
         assertFalse( "Attributes with different values should not be equal", attr0.equals( attr1 ) );
@@ -141,8 +144,8 @@
         assertTrue( "Attributes with same values should be equal", attr1.equals( attr0 ) );
 
         attr1.add( "value2" );
-        assertFalse( "Attributes with different values should not be equal", attr0.equals( attr1 ) );
-        assertFalse( "Attributes with different values should not be equal", attr1.equals( attr0 ) );
+        assertTrue( "Attributes with different values should not be equal", attr0.equals( attr1 ) );
+        assertTrue( "Attributes with different values should not be equal", attr1.equals( attr0 ) );
     }
 
 
@@ -154,8 +157,8 @@
      */
     public void testNotEqualDiffImpl()
     {
-        LockableAttributeImpl attr0 = getAttribute();
-        Attribute attr1 = new BasicAttribute( "test-attr1" );
+        AttributeImpl attr0 = getAttribute();
+        Attribute attr1 = new AttributeImpl( "test-attr1" );
         attr1.add( "value0" );
         attr1.add( "value1" );
         assertFalse( "Attributes with different values should not be equal", attr0.equals( attr1 ) );
@@ -175,9 +178,121 @@
 
     public void testContains()
     {
-        LockableAttributeImpl attr = getAttribute();
+        AttributeImpl attr = getAttribute();
         assertTrue( attr.contains( "value0" ) );
         assertTrue( attr.contains( "value1" ) );
         assertTrue( attr.contains( "value2" ) );
+    }
+    
+    // Test the clone operation
+    public void testCloneAttribute() throws NamingException
+    {
+        Attribute attr = new AttributeImpl( "test" );
+
+        String zero = "zero";
+        attr.add( zero );
+
+        String one = "one";
+        attr.add( one );
+        
+        byte[] two = StringTools.getBytesUtf8( "two" );
+        attr.add( two );
+
+        byte[] three = StringTools.getBytesUtf8( "three" );
+        attr.add( three );
+        
+        Object[] allValues = new Object[] { zero, one, two, three };
+
+        Attribute clone = (Attribute)attr.clone();
+        
+        // Test the atomic elements
+        assertTrue( clone instanceof AttributeImpl );
+        assertEquals( 4, clone.size() );
+        assertEquals( "test", clone.getID() );
+        
+        // Now test the values
+        NamingEnumeration values = clone.getAll();
+        
+        int i = 0;
+        
+        while ( values.hasMoreElements() )
+        {
+            Object value = values.next();
+            
+            if ( value instanceof String )
+            {
+                assertEquals( allValues[i++], value );
+            }
+            else
+            {
+                byte[] v = (byte[])value;
+                
+                // The content should be equal
+                assertTrue( ArrayUtils.isEquals( allValues[i], v ) );
+                
+                // but not the container
+                assertNotSame( allValues[i++], value );
+            }
+        }
+        
+        // Check that if we change the content, the cloned attribute
+        // is still the same.
+        two[1] = 'o';
+        attr.set( 2, two );
+        
+        // The initial attribute should be modified
+        Object attrTwo = attr.get( 2 );
+        assertNotSame( two, attrTwo );
+        assertTrue( ArrayUtils.isEquals( two, attrTwo ) );
+        
+        // but the cloned attribute should remain the same
+        Object clonedTwo = clone.get( 2 );
+        assertNotSame( two, clonedTwo );
+        assertFalse( ArrayUtils.isEquals( two, clonedTwo ) );
+        
+        // Remove a value from the original attribute
+        three = (byte[])attr.remove( 3 );
+        
+        // Check that it does not have modified the cloned attribute
+        assertEquals( 4, clone.size() );
+        
+        // The content should be equal
+        assertTrue( ArrayUtils.isEquals( three, clone.get( 3 ) ) );
+        
+        // but not the container
+        assertNotSame( three, clone.get( 3 ) );
+    }
+    
+    public void testEquals()
+    {
+        Attribute attr = new AttributeImpl( "test" );
+
+        String zero = "zero";
+        attr.add( zero );
+
+        String one = "one";
+        attr.add( one );
+        
+        byte[] two = StringTools.getBytesUtf8( "two" );
+        attr.add( two );
+
+        byte[] three = StringTools.getBytesUtf8( "three" );
+        attr.add( three );
+        
+        Attribute clone = (Attribute)attr.clone();
+        
+        // Check that both attributes are equals
+        assertTrue( attr.equals( clone ) );
+
+        clone.set(  3, "three" );
+        assertFalse( attr.equals(  clone  ) );
+
+        two[1] = 'o';
+        attr.set( 2, two );
+        
+        assertFalse( attr.equals(  clone  ) );
+
+        attr.set( 2, "two" );
+        assertFalse( attr.equals(  clone  ) );
     }
 }

Copied: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributesImplTest.java (from r494042, directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributesImplTest.java)
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributesImplTest.java?view=diff&rev=494173&p1=directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributesImplTest.java&r1=494042&p2=directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributesImplTest.java&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/LockableAttributesImplTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/AttributesImplTest.java Mon Jan  8 11:42:35 2007
@@ -20,12 +20,12 @@
 package org.apache.directory.shared.ldap.message;
 
 
-import junit.framework.TestCase;
+import javax.naming.directory.Attributes;
 
-import javax.naming.directory.BasicAttributes;
+import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 
 /**
@@ -34,7 +34,7 @@
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  *         $Rev$
  */
-public class LockableAttributesImplTest extends TestCase
+public class AttributesImplTest extends TestCase
 {
     /**
      * Creates and populates a LockableAttributeImpl with a specific id.
@@ -43,9 +43,9 @@
      *            the id for the attribute
      * @return the LockableAttributeImpl assembled for testing
      */
-    private LockableAttributeImpl getAttribute( String id )
+    private AttributeImpl getAttribute( String id )
     {
-        LockableAttributeImpl attr = new LockableAttributeImpl( id );
+        AttributeImpl attr = new AttributeImpl( id );
         attr.add( "value0" );
         attr.add( "value1" );
         attr.add( "value2" );
@@ -58,9 +58,9 @@
      * 
      * @return
      */
-    private LockableAttributesImpl getAttributes()
+    private AttributesImpl getAttributes()
     {
-        LockableAttributesImpl attrs = new LockableAttributesImpl();
+        AttributesImpl attrs = new AttributesImpl();
         attrs.put( getAttribute( "attr0" ) );
         attrs.put( getAttribute( "attr1" ) );
         attrs.put( getAttribute( "attr2" ) );
@@ -73,7 +73,7 @@
      */
     public void testToString()
     {
-        LockableAttributesImpl attrs = getAttributes();
+        AttributesImpl attrs = getAttributes();
         attrs.put( "binaryNullAttr", null );
         attrs.put( "binaryEmptyAttr", ArrayUtils.EMPTY_BYTE_ARRAY );
         attrs.put( "binaryFullAttr", new byte[]
@@ -90,7 +90,7 @@
      */
     public void testEqualsSameObj()
     {
-        LockableAttributesImpl attrs = getAttributes();
+        AttributesImpl attrs = getAttributes();
         assertTrue( "same object should return true", attrs.equals( attrs ) );
     }
 
@@ -100,8 +100,8 @@
      */
     public void testEqualsExactCopy()
     {
-        LockableAttributesImpl attrs0 = getAttributes();
-        LockableAttributesImpl attrs1 = getAttributes();
+        AttributesImpl attrs0 = getAttributes();
+        AttributesImpl attrs1 = getAttributes();
         assertTrue( "exact copies should be equal", attrs0.equals( attrs1 ) );
         assertTrue( "exact copies should be equal", attrs1.equals( attrs0 ) );
     }
@@ -113,8 +113,8 @@
      */
     public void testEqualsExactCopyWithReplicas()
     {
-        LockableAttributesImpl attrs0 = getAttributes();
-        LockableAttributesImpl attrs1 = getAttributes();
+        AttributesImpl attrs0 = getAttributes();
+        AttributesImpl attrs1 = getAttributes();
         attrs1.put( getAttribute( "attr0" ) );
         attrs1.put( getAttribute( "attr0" ) );
         assertTrue( "exact copies with repeated adds should be equal", attrs0.equals( attrs1 ) );
@@ -127,8 +127,8 @@
      */
     public void testNotEqualDiffAttr()
     {
-        LockableAttributesImpl attrs0 = getAttributes();
-        LockableAttributesImpl attrs1 = getAttributes();
+        AttributesImpl attrs0 = getAttributes();
+        AttributesImpl attrs1 = getAttributes();
         attrs1.put( getAttribute( "blah" ) );
         assertFalse( "different attributes should not be equal", attrs0.equals( attrs1 ) );
         assertFalse( "different attributes should not be equal", attrs1.equals( attrs0 ) );
@@ -140,8 +140,8 @@
      */
     public void testEqualsDiffImpl()
     {
-        LockableAttributesImpl attrs0 = getAttributes();
-        BasicAttributes attrs1 = new BasicAttributes( true );
+        AttributesImpl attrs0 = getAttributes();
+        Attributes attrs1 = new AttributesImpl( true );
         attrs1.put( getAttribute( "attr0" ) );
         attrs1.put( getAttribute( "attr1" ) );
         attrs1.put( getAttribute( "attr2" ) );
@@ -153,13 +153,13 @@
 
     public void testCompareToBasicAttributes()
     {
-        LockableAttributesImpl attrs0 = new LockableAttributesImpl();
+        AttributesImpl attrs0 = new AttributesImpl();
         attrs0.put( "attr0", "value0" );
         attrs0.put( "attr1", "value1" );
         attrs0.put( "attr2", "value2" );
         attrs0.put( "attr2", "value3" );
 
-        BasicAttributes attrs1 = new BasicAttributes( true );
+        Attributes attrs1 = new AttributesImpl( true );
         attrs1.put( "attr0", "value0" );
         attrs1.put( "attr1", "value1" );
         attrs1.put( "attr2", "value2" );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java Mon Jan  8 11:42:35 2007
@@ -24,11 +24,10 @@
 
 import javax.naming.InvalidNameException;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
 import org.apache.directory.shared.ldap.message.Control;
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModifyRequest;
@@ -70,22 +69,22 @@
             // do nothing
         }
 
-        LockableAttributeImpl attr = new LockableAttributeImpl( "attr0" );
+        AttributeImpl attr = new AttributeImpl( "attr0" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req.addModification( item );
 
-        attr = new LockableAttributeImpl( "attr1" );
+        attr = new AttributeImpl( "attr1" );
         attr.add( "val3" );
-        item = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
+        item = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr );
         req.addModification( item );
 
-        attr = new LockableAttributeImpl( "attr2" );
+        attr = new AttributeImpl( "attr2" );
         attr.add( "val4" );
         attr.add( "val5" );
-        item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
+        item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr );
         req.addModification( item );
 
         return req;
@@ -151,19 +150,19 @@
     public void testNotEqualDiffModOps() throws InvalidNameException
     {
         ModifyRequestImpl req0 = getRequest();
-        LockableAttributeImpl attr = new LockableAttributeImpl( "attr3" );
+        AttributeImpl attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new LockableAttributeImpl( "attr3" );
+        attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        item = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
+        item = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr );
         req0.addModification( item );
 
         assertFalse( req0.equals( req1 ) );
@@ -177,11 +176,11 @@
     public void testNotEqualDiffModCount() throws InvalidNameException
     {
         ModifyRequestImpl req0 = getRequest();
-        LockableAttributeImpl attr = new LockableAttributeImpl( "attr3" );
+        AttributeImpl attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
@@ -197,19 +196,19 @@
     public void testNotEqualDiffModIds() throws InvalidNameException
     {
         ModifyRequestImpl req0 = getRequest();
-        LockableAttributeImpl attr = new LockableAttributeImpl( "attr3" );
+        AttributeImpl attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new LockableAttributeImpl( "attr4" );
+        attr = new AttributeImpl( "attr4" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         assertFalse( req0.equals( req1 ) );
@@ -223,20 +222,20 @@
     public void testNotEqualDiffModValues() throws InvalidNameException
     {
         ModifyRequestImpl req0 = getRequest();
-        LockableAttributeImpl attr = new LockableAttributeImpl( "attr3" );
+        AttributeImpl attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new LockableAttributeImpl( "attr3" );
+        attr = new AttributeImpl( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
         attr.add( "val3" );
-        item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+        item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
         req0.addModification( item );
 
         assertFalse( req0.equals( req1 ) );
@@ -253,35 +252,35 @@
         {
             public Collection getModificationItems()
             {
-                List<ModificationItem> list = new ArrayList<ModificationItem>();
-                LockableAttributeImpl attr = new LockableAttributeImpl( "attr0" );
+                List<ModificationItemImpl> list = new ArrayList<ModificationItemImpl>();
+                AttributeImpl attr = new AttributeImpl( "attr0" );
                 attr.add( "val0" );
                 attr.add( "val1" );
                 attr.add( "val2" );
-                ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
+                ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr );
                 list.add( item );
 
-                attr = new LockableAttributeImpl( "attr1" );
+                attr = new AttributeImpl( "attr1" );
                 attr.add( "val3" );
-                item = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
+                item = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr );
                 list.add( item );
 
-                attr = new LockableAttributeImpl( "attr2" );
+                attr = new AttributeImpl( "attr2" );
                 attr.add( "val4" );
                 attr.add( "val5" );
-                item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
+                item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr );
                 list.add( item );
 
                 return list;
             }
 
 
-            public void addModification( ModificationItem a_mod )
+            public void addModification( ModificationItemImpl a_mod )
             {
             }
 
 
-            public void removeModification( ModificationItem a_mod )
+            public void removeModification( ModificationItemImpl a_mod )
             {
             }
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java?view=diff&rev=494173&r1=494172&r2=494173
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java Mon Jan  8 11:42:35 2007
@@ -29,8 +29,8 @@
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.shared.ldap.message.Control;
-import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.SearchResponseEntry;
@@ -47,15 +47,15 @@
 public class SearchResponseEntryImplTest extends TestCase
 {
     /**
-     * Creates and populates a LockableAttributeImpl with a specific id.
+     * Creates and populates a AttributeImpl with a specific id.
      * 
      * @param id
      *            the id for the attribute
-     * @return the LockableAttributeImpl assembled for testing
+     * @return the AttributeImpl assembled for testing
      */
-    private LockableAttributeImpl getAttribute( String id )
+    private AttributeImpl getAttribute( String id )
     {
-        LockableAttributeImpl attr = new LockableAttributeImpl( id );
+        AttributeImpl attr = new AttributeImpl( id );
         attr.add( "value0" );
         attr.add( "value1" );
         attr.add( "value2" );
@@ -68,9 +68,9 @@
      * 
      * @return
      */
-    LockableAttributesImpl getAttributes()
+    AttributesImpl getAttributes()
     {
-        LockableAttributesImpl attrs = new LockableAttributesImpl();
+        AttributesImpl attrs = new AttributesImpl();
         attrs.put( getAttribute( "attr0" ) );
         attrs.put( getAttribute( "attr1" ) );
         attrs.put( getAttribute( "attr2" ) );



Mime
View raw message