directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r936554 [1/4] - in /directory: apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/ apacheds/trunk/core-api/src/main/java/o...
Date Wed, 21 Apr 2010 22:42:42 GMT
Author: elecharny
Date: Wed Apr 21 22:42:40 2010
New Revision: 936554

URL: http://svn.apache.org/viewvc?rev=936554&view=rev
Log:
o Removed the DefaultServerAttribute class, merged all its methods into the DefaultClientAttribute class

Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java
Modified:
    directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
    directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
    directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java

Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java (original)
+++ directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java Wed Apr 21 22:42:40 2010
@@ -47,13 +47,13 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.name.DN;
@@ -604,7 +604,7 @@ public class AvlStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
+        EntryAttribute attrib = new DefaultClientAttribute( SchemaConstants.OU_AT, schemaManager
             .lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
         attrib.add( "Engineering" );
 
@@ -706,7 +706,7 @@ public class AvlStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SURNAME_AT, schemaManager
+        EntryAttribute attrib = new DefaultClientAttribute( SchemaConstants.SURNAME_AT, schemaManager
             .lookupAttributeTypeRegistry( SchemaConstants.SURNAME_AT ) );
 
         String attribVal = "Walker";
@@ -738,7 +738,7 @@ public class AvlStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
+        EntryAttribute attrib = new DefaultClientAttribute( SchemaConstants.SN_AT, schemaManager
             .lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );
 
         String attribVal = "Johnny";
@@ -771,7 +771,7 @@ public class AvlStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
+        EntryAttribute attrib = new DefaultClientAttribute( SchemaConstants.SN_AT, schemaManager
             .lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );
 
         Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
@@ -811,7 +811,7 @@ public class AvlStoreTest
         store.add( entry );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
+        EntryAttribute attrib = new DefaultClientAttribute( SchemaConstants.OU_AT, schemaManager
             .lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
 
         String attribVal = "Marketing";

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java Wed Apr 21 22:42:40 2010
@@ -50,11 +50,11 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.controls.CascadeControl;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
@@ -466,11 +466,11 @@ public final class SchemaPartition exten
 
         List<Modification> mods = new ArrayList<Modification>( 2 );
 
-        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
             ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, schemaManager
                 .lookupAttributeTypeRegistry( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ), modifyTimestamp ) ) );
 
-        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
             ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, schemaManager
                 .lookupAttributeTypeRegistry( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ), modifiersName ) ) );
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java Wed Apr 21 22:42:40 2010
@@ -40,12 +40,12 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.StringValue;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -590,14 +590,14 @@ public class SchemaPartitionDaoImpl impl
             return;
         }
 
-        mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultClientAttribute(
             MetaSchemaConstants.M_DISABLED_AT, schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
 
-        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultClientAttribute(
             SchemaConstants.MODIFIERS_NAME_AT, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFIERS_NAME_AT ),
             ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
 
-        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultClientAttribute(
             SchemaConstants.MODIFY_TIMESTAMP_AT, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
                 .getGeneralizedTime() ) ) );
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java Wed Apr 21 22:42:40 2010
@@ -34,13 +34,13 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
@@ -527,21 +527,21 @@ public class SchemaSynchronizer implemen
         List<Modification> modifications = new ArrayList<Modification>();
         
         // The m-disabled AT
-        EntryAttribute disabledAttr = new DefaultServerAttribute( disabledAT, "FALSE" );
+        EntryAttribute disabledAttr = new DefaultClientAttribute( disabledAT, "FALSE" );
         Modification disabledMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disabledAttr );
         
         modifications.add( disabledMod );
         
         // The modifiersName AT
         EntryAttribute modifiersNameAttr = 
-            new DefaultServerAttribute( modifiersNameAT, session.getEffectivePrincipal().getName() );
+            new DefaultClientAttribute( modifiersNameAT, session.getEffectivePrincipal().getName() );
         Modification modifiersNameMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifiersNameAttr );
         
         modifications.add( modifiersNameMod );
         
         // The modifyTimestamp AT
         EntryAttribute modifyTimestampAttr = 
-            new DefaultServerAttribute( modifyTimestampAT, DateUtils.getGeneralizedTime() );
+            new DefaultClientAttribute( modifyTimestampAT, DateUtils.getGeneralizedTime() );
         Modification modifyTimestampMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifyTimestampAttr );
         
         modifications.add( modifyTimestampMod );
@@ -632,7 +632,7 @@ public class SchemaSynchronizer implemen
                     continue;
                 }
                 
-                EntryAttribute disable = new DefaultServerAttribute( disabledAT, "TRUE"  );
+                EntryAttribute disable = new DefaultClientAttribute( disabledAT, "TRUE"  );
                 Modification modification = 
                     new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disable );
                 

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Wed Apr 21 22:42:40 2010
@@ -37,7 +37,6 @@ import javax.naming.directory.SearchResu
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
@@ -45,6 +44,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException;
 import org.apache.directory.shared.ldap.name.DN;
@@ -130,7 +130,7 @@ public class ServerEntryUtils
      * 
      * @throws InvalidAttributeIdentifierException If we had an incorrect attribute
      */
-    public static EntryAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
+    public static EntryAttribute toServerAttribute( Attribute attribute, AttributeType attributeType ) throws LdapInvalidAttributeTypeException
     {
         if ( attribute == null )
         {
@@ -139,11 +139,12 @@ public class ServerEntryUtils
         
         try 
         {
-            EntryAttribute serverAttribute = new DefaultServerAttribute( attributeType );
+            EntryAttribute serverAttribute = new DefaultClientAttribute( attributeType );
         
             for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements(); )
             {
                 Object value = values.nextElement();
+                int nbAdded = 0;
                 
                 if ( value == null )
                 {
@@ -154,39 +155,44 @@ public class ServerEntryUtils
                 {
                     if ( value instanceof String )
                     {
-                        serverAttribute.add( (String)value );
+                        nbAdded = serverAttribute.add( (String)value );
                     }
                     else if ( value instanceof byte[] )
                     {
-                        serverAttribute.add( StringTools.utf8ToString( (byte[])value ) );
+                        nbAdded = serverAttribute.add( StringTools.utf8ToString( (byte[])value ) );
                     }
                     else
                     {
-                        return null;
+                        throw new LdapInvalidAttributeTypeException();
                     }
                 }
                 else
                 {
                     if ( value instanceof String )
                     {
-                        serverAttribute.add( StringTools.getBytesUtf8( (String)value ) );
+                        nbAdded = serverAttribute.add( StringTools.getBytesUtf8( (String)value ) );
                     }
                     else if ( value instanceof byte[] )
                     {
-                        serverAttribute.add( (byte[])value );
+                        nbAdded = serverAttribute.add( (byte[])value );
                     }
                     else
                     {
-                        return null;
+                        throw new LdapInvalidAttributeTypeException();
                     }
                 }
+                
+                if ( nbAdded == 0 )
+                {
+                    throw new LdapInvalidAttributeTypeException();
+                }
             }
             
             return serverAttribute;
         }
         catch ( NamingException ne )
         {
-            return null;
+            throw new LdapInvalidAttributeTypeException();
         }
     }
 
@@ -285,7 +291,7 @@ public class ServerEntryUtils
                 break;
                 
             case ADD_ATTRIBUTE :
-                EntryAttribute combined = new DefaultServerAttribute( id, attributeType );
+                EntryAttribute combined = new DefaultClientAttribute( id, attributeType );
                 EntryAttribute toBeAdded = mod.getAttribute();
                 EntryAttribute existing = entry.get( id );
 
@@ -363,7 +369,8 @@ public class ServerEntryUtils
      * @param attributeType the associated attributeType
      * @return a instance of a ServerModification object
      */
-    private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) 
+    private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) throws LdapInvalidAttributeTypeException
+
     {
         ModificationOperation operation;
         
@@ -440,7 +447,7 @@ public class ServerEntryUtils
         
         Modification serverModification = new ServerModification( 
             modification.getOperation(),
-            new DefaultServerAttribute( attributeType, modification.getAttribute() ) ); 
+            new DefaultClientAttribute( attributeType, modification.getAttribute() ) ); 
         
         return serverModification;
         

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=936554&r1=936553&r2=936554&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Wed Apr 21 22:42:40 2010
@@ -33,7 +33,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -45,7 +44,6 @@ import javax.naming.directory.InvalidAtt
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.StringValue;
-import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
@@ -64,7 +62,7 @@ import org.junit.Test;
 
 
 /**
- * Tests for the DefaultServerAttribute class
+ * Tests for the DefaultClientAttribute class
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -144,9 +142,9 @@ public class DefaultServerAttributeTest
     }
 
     /**
-     * Serialize a DefaultServerAttribute
+     * Serialize a DefaultClientAttribute
      */
-    private ByteArrayOutputStream serializeValue( DefaultServerAttribute value ) throws IOException
+    private ByteArrayOutputStream serializeValue( DefaultClientAttribute value ) throws IOException
     {
         ObjectOutputStream oOut = null;
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -181,9 +179,9 @@ public class DefaultServerAttributeTest
     
     
     /**
-     * Deserialize a DefaultServerAttribute
+     * Deserialize a DefaultClientAttribute
      */
-    private DefaultServerAttribute deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
+    private DefaultClientAttribute deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
     {
         ObjectInputStream oIn = null;
         ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -192,7 +190,7 @@ public class DefaultServerAttributeTest
         {
             oIn = new ObjectInputStream( in );
 
-            DefaultServerAttribute value = new DefaultServerAttribute( at );
+            DefaultClientAttribute value = new DefaultClientAttribute( at );
             value.deserialize( oIn );
             
             return value;
@@ -222,7 +220,7 @@ public class DefaultServerAttributeTest
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
-        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        DefaultClientAttribute attr = new DefaultClientAttribute( at );
         
         // Add a String value
         attr.add( "test" );
@@ -270,7 +268,7 @@ public class DefaultServerAttributeTest
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
-        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        DefaultClientAttribute attr = new DefaultClientAttribute( at );
         
         // Add String values
         attr.add( "test" );
@@ -304,7 +302,7 @@ public class DefaultServerAttributeTest
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
-        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        DefaultClientAttribute attr = new DefaultClientAttribute( at );
         
         // Add a null value
         attr.add( new StringValue( at, null ) );
@@ -324,7 +322,7 @@ public class DefaultServerAttributeTest
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
-        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        DefaultClientAttribute attr = new DefaultClientAttribute( at );
         
         attr.add( "Test1" );
         attr.add( "Test2" );
@@ -345,7 +343,7 @@ public class DefaultServerAttributeTest
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
-        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        DefaultClientAttribute attr = new DefaultClientAttribute( at );
         
         attr.add( "Test  1" );
         attr.add( "Test  2" );
@@ -363,17 +361,17 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetBytes() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd );
         
         attr1.add( (byte[])null );
         assertNull( attr1.getBytes() );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         
         attr2.add( BYTES1, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, attr2.getBytes() ) );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr3 = new DefaultClientAttribute( atCN );
         
         attr3.add( "a", "b" );
         
@@ -395,7 +393,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetId()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
 
         assertEquals( "cn", attr.getId() );
         
@@ -416,17 +414,26 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetString() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atCN );
         
-        attr1.add( (String)null );
-        assertEquals( "", attr1.getString() );
+        assertEquals( 0, attr1.add( (String)null ) );
+        
+        try 
+        {
+            attr1.getString();
+            fail();
+        }
+        catch ( LdapInvalidAttributeValueException liave )
+        {
+            // expected
+        }
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( atCN );
         
         attr2.add( "a", "b" );
         assertEquals( "a", attr2.getString() );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( atPwd );
         
         attr3.add( BYTES1, BYTES2 );
         
@@ -448,7 +455,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetUpId()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
 
         assertNotNull( attr.getUpId() );
         assertEquals( "cn", attr.getUpId() );
@@ -470,47 +477,49 @@ public class DefaultServerAttributeTest
     @Test
     public void testHashCode()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
-        EntryAttribute attr2 = new DefaultServerAttribute( atSN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( atSN );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
         
         attr2.setAttributeType( atCN );
         assertEquals( attr1.hashCode(), attr2.hashCode() );
         
-        attr1.put( (String)null );
+        attr1.add( (String)null );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
 
         attr1.clear();
         assertEquals( attr1.hashCode(), attr2.hashCode() );
         
-        attr1.put( "a", "b" );
+        attr1.add( "a", "b" );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
 
-        attr2.put( "a", "b" );
+        attr2.add( "a", "b" );
         assertEquals( attr1.hashCode(), attr2.hashCode() );
         
         // Order matters
-        attr2.put( "b", "a" );
+        attr2.clear();
+        attr2.add( "b", "a" );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
-        EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( atPwd );
+        EntryAttribute attr4 = new DefaultClientAttribute( atPwd );
         assertNotSame( attr3.hashCode(), attr4.hashCode() );
         
-        attr3.put( (byte[])null );
+        attr3.add( (byte[])null );
         assertNotSame( attr3.hashCode(), attr4.hashCode() );
 
         attr3.clear();
         assertEquals( attr3.hashCode(), attr4.hashCode() );
         
-        attr3.put( new byte[]{0x01, 0x02}, new byte[]{0x03, 0x04} );
+        attr3.add( new byte[]{0x01, 0x02}, new byte[]{0x03, 0x04} );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
 
-        attr4.put( new byte[]{0x01, 0x02}, new byte[]{0x03, 0x04} );
+        attr4.add( new byte[]{0x01, 0x02}, new byte[]{0x03, 0x04} );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
 
         // Order matters
-        attr4.put( new byte[]{0x03, 0x04}, new byte[]{0x01, 0x02} );
+        attr4.clear();
+        attr4.add( new byte[]{0x03, 0x04}, new byte[]{0x01, 0x02} );
         assertNotSame( attr1.hashCode(), attr2.hashCode() );
     }
     
@@ -521,7 +530,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testSetId()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
 
         attr.setId( "Cn" );
         assertEquals( "cn", attr.getId() );
@@ -583,7 +592,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testIsValid() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         // No value, this should not be valid
         assertFalse( attr.isValid() );
@@ -597,8 +606,9 @@ public class DefaultServerAttributeTest
         assertTrue( attr.isValid() );
 
         // test a SINGLE-VALUE attribute. CountryName is SINGLE-VALUE
+        attr.clear();
         attr.setAttributeType( atC );
-        attr.put( "FR" );
+        attr.add( "FR" );
         assertTrue( attr.isValid() );
         attr.add( "US" );
         assertFalse( attr.isValid() );
@@ -611,21 +621,21 @@ public class DefaultServerAttributeTest
     @Test
     public void testAddValueArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atCN );
         
         int nbAdded = attr1.add( new StringValue( atCN, null ) );
         assertEquals( 1, nbAdded );
         assertTrue( attr1.isHR() );
         assertEquals( NULL_STRING_VALUE, attr1.get() );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr2.add( new BinaryValue( atPwd, null ) );
         assertEquals( 1, nbAdded );
         assertFalse( attr2.isHR() );
         assertEquals( NULL_BINARY_VALUE, attr2.get() );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr3 = new DefaultClientAttribute( atCN );
         
         nbAdded = attr3.add( new StringValue( atCN, "a" ), new StringValue( atCN, "b" ) );
         assertEquals( 2, nbAdded );
@@ -633,7 +643,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr3.contains( "a" ) );
         assertTrue( attr3.contains( "b" ) );
         
-        EntryAttribute attr4 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr4 = new DefaultClientAttribute( atCN );
         
         nbAdded = attr4.add( new BinaryValue( atPwd, BYTES1 ), new BinaryValue( atPwd, BYTES2 ) );
         assertEquals( 0, nbAdded );
@@ -641,7 +651,7 @@ public class DefaultServerAttributeTest
         assertFalse( attr4.contains( BYTES1 ) );
         assertFalse( attr4.contains( BYTES2 ) );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr5 = new DefaultClientAttribute( atCN );
         
         nbAdded = attr5.add( new StringValue( atCN, "c" ), new BinaryValue( atPwd, BYTES1 ) );
         assertEquals( 1, nbAdded );
@@ -649,7 +659,7 @@ public class DefaultServerAttributeTest
         assertFalse( attr5.contains( "ab" ) );
         assertTrue( attr5.contains( "c" ) );
 
-        EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr6.add( new BinaryValue( atPwd, BYTES1 ), new StringValue( atCN, "c" ) );
         assertEquals( 1, nbAdded );
@@ -657,7 +667,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr6.contains( BYTES1 ) );
         assertFalse( attr6.contains( BYTES3 ) );
 
-        EntryAttribute attr7 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr7 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr7.add( new BinaryValue( atPwd, null ), new StringValue( atCN, "c" ) );
         assertEquals( 1, nbAdded );
@@ -665,7 +675,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr7.contains( NULL_BINARY_VALUE ) );
         assertFalse( attr7.contains( BYTES3 ) );
 
-        EntryAttribute attr8 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr8 = new DefaultClientAttribute( atDC );
         
         nbAdded = attr8.add( new StringValue( atDC, null ), new BinaryValue( atPwd, BYTES1 ) );
         assertEquals( 1, nbAdded );
@@ -674,7 +684,7 @@ public class DefaultServerAttributeTest
         assertFalse( attr8.contains( "ab" ) );
 
     
-        EntryAttribute attr9 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr9 = new DefaultClientAttribute( atDC );
         
         nbAdded = attr9.add( new StringValue( (String)null ), new StringValue( "ab" ) );
         assertEquals( 2, nbAdded );
@@ -682,7 +692,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr9.contains( NULL_STRING_VALUE ) );
         assertTrue( attr9.contains( "ab" ) );
 
-        EntryAttribute attr10 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr10 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr10.add( new BinaryValue( (byte[])null ), new BinaryValue( BYTES1 ) );
         assertEquals( 2, nbAdded );
@@ -698,28 +708,28 @@ public class DefaultServerAttributeTest
     @Test
     public void testAddStringArray() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
         int nbAdded = attr1.add( (String)null );
         assertEquals( 1, nbAdded );
         assertTrue( attr1.isHR() );
         assertEquals( NULL_STRING_VALUE, attr1.get() );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( atDC );
         
         nbAdded = attr2.add( "" );
         assertEquals( 1, nbAdded );
         assertTrue( attr2.isHR() );
         assertEquals( "", attr2.getString() );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr3 = new DefaultClientAttribute( atCN );
         
         nbAdded = attr3.add( "t" );
         assertEquals( 1, nbAdded );
         assertTrue( attr3.isHR() );
         assertEquals( "t", attr3.getString() );
         
-        EntryAttribute attr4 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr4 = new DefaultClientAttribute( atCN );
         
         nbAdded = attr4.add( "a", "b", "c", "d" );
         assertEquals( 4, nbAdded );
@@ -751,7 +761,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr4.contains( "e" ) );
         assertFalse( attr4.contains( "ab" ) );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr5 = new DefaultClientAttribute( atDC );
         
         nbAdded = attr5.add( "a", "b", (String)null, "d" );
         assertEquals( 4, nbAdded );
@@ -761,10 +771,10 @@ public class DefaultServerAttributeTest
         assertTrue( attr5.contains( NULL_STRING_VALUE ) );
         assertTrue( attr5.contains( "d" ) );
 
-        EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr6.add( "a", (String)null );
-        assertEquals( 0, nbAdded );
+        assertEquals( 1, nbAdded );
         assertFalse( attr6.isHR() );
     }
 
@@ -775,28 +785,28 @@ public class DefaultServerAttributeTest
     @Test
     public void testAddByteArray() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd );
         
         int nbAdded = attr1.add( (byte[])null );
         assertEquals( 1, nbAdded );
         assertFalse( attr1.isHR() );
         assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr2.add( StringTools.EMPTY_BYTES );
         assertEquals( 1, nbAdded );
         assertFalse( attr2.isHR() );
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, attr2.getBytes() ) );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr3.add( BYTES1 );
         assertEquals( 1, nbAdded );
         assertFalse( attr3.isHR() );
         assertTrue( Arrays.equals( BYTES1, attr3.getBytes() ) );
         
-        EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr4 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr4.add( BYTES1, BYTES2, BYTES3, BYTES4 );
         assertEquals( 4, nbAdded );
@@ -806,7 +816,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr4.contains( BYTES3 ) );
         assertTrue( attr4.contains( BYTES4 ) );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr5 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr5.add( BYTES1, BYTES2, (byte[])null, BYTES3 );
         assertEquals( 4, nbAdded );
@@ -816,10 +826,10 @@ public class DefaultServerAttributeTest
         assertTrue( attr5.contains( (byte[])null ) );
         assertTrue( attr5.contains( BYTES3 ) );
 
-        EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atPwd );
         
         nbAdded = attr6.add( "ab", (String)null );
-        assertEquals( 0, nbAdded );
+        assertEquals( 1, nbAdded );
         assertFalse( attr6.isHR() );
     }
 
@@ -830,7 +840,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testClear()
     {
-        EntryAttribute attr = new DefaultServerAttribute( "cn", atCN );
+        EntryAttribute attr = new DefaultClientAttribute( "dc", atDC );
         
         assertEquals( 0, attr.size() );
         
@@ -840,7 +850,7 @@ public class DefaultServerAttributeTest
         attr.clear();
         assertTrue( attr.isHR() );
         assertEquals( 0, attr.size() );
-        assertEquals( atCN, attr.getAttributeType() );
+        assertEquals( atDC, attr.getAttributeType() );
     }
 
 
@@ -850,7 +860,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testContainsValueArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
         assertEquals( 0, attr1.size() );
         assertFalse( attr1.contains( STR_VALUE1 ) );
@@ -873,7 +883,7 @@ public class DefaultServerAttributeTest
         assertFalse( attr1.contains( STR_VALUE4 ) );
         assertFalse( attr1.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         assertEquals( 0, attr2.size() );
         assertFalse( attr2.contains( BYTES1 ) );
         assertFalse( attr2.contains( NULL_BINARY_VALUE ) );
@@ -901,7 +911,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testContainsStringArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
         assertEquals( 0, attr1.size() );
         assertFalse( attr1.contains( "a" ) );
@@ -931,7 +941,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testContainsByteArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd );
         
         assertEquals( 0, attr1.size() );
         assertFalse( attr1.contains( BYTES1 ) );
@@ -961,11 +971,11 @@ public class DefaultServerAttributeTest
     @Test
     public void testEquals()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atCN );
         
         assertFalse( attr1.equals( null ) );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( atCN );
         
         assertTrue( attr1.equals( attr2 ) );
         
@@ -986,34 +996,34 @@ public class DefaultServerAttributeTest
         attr2.setHR( false );
         assertTrue( attr1.equals( attr2 ) );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
-        EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( atPwd );
+        EntryAttribute attr4 = new DefaultClientAttribute( atPwd );
         
-        attr3.put( NULL_BINARY_VALUE );
-        attr4.put( NULL_BINARY_VALUE );
+        attr3.add( NULL_BINARY_VALUE );
+        attr4.add( NULL_BINARY_VALUE );
         assertTrue( attr3.equals( attr4 ) );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
-        EntryAttribute attr6 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr5 = new DefaultClientAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atCN );
         assertFalse( attr5.equals( attr6 ) );
         
-        attr5.put( NULL_BINARY_VALUE );
-        attr6.put( NULL_STRING_VALUE );
+        attr5.add( NULL_BINARY_VALUE );
+        attr6.add( NULL_STRING_VALUE );
         assertFalse( attr5.equals( attr6 ) );
 
-        EntryAttribute attr7 = new DefaultServerAttribute( atCN );
-        EntryAttribute attr8 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr7 = new DefaultClientAttribute( atCN );
+        EntryAttribute attr8 = new DefaultClientAttribute( atPwd );
         
-        attr7.put( "a" );
-        attr8.put( BYTES2 );
+        attr7.add( "a" );
+        attr8.add( BYTES2 );
         assertFalse( attr7.equals( attr8 ) );
 
-        EntryAttribute attr9 = new DefaultServerAttribute( atCN );
-        EntryAttribute attr10 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr9 = new DefaultClientAttribute( atCN );
+        EntryAttribute attr10 = new DefaultClientAttribute( atPwd );
         
-        attr7.put( "a" );
-        attr7.add( BYTES2 );
-        attr8.put( "a", "b" );
+        attr9.add( "a" );
+        attr9.add( BYTES2 );
+        attr10.add( "a", "b" );
         assertFalse( attr9.equals( attr10 ) );
     }
 
@@ -1024,12 +1034,12 @@ public class DefaultServerAttributeTest
     @Test
     public void testGet()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( "dc", atDC );
         
         attr1.add( (String)null );
         assertEquals( NULL_STRING_VALUE,attr1.get() );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( "cn", atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( "dc", atDC );
         
         attr2.add( "a", "b", "c" );
         assertEquals( "a", attr2.get().getString() );
@@ -1043,7 +1053,7 @@ public class DefaultServerAttributeTest
         attr2.remove( "c" );
         assertNull( attr2.get() );
 
-        EntryAttribute attr3 = new DefaultServerAttribute( "userPassword", atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( "userPassword", atPwd );
         
         attr3.add( BYTES1, BYTES2, BYTES3 );
         assertTrue( Arrays.equals( BYTES1, attr3.get().getBytes() ) );
@@ -1065,7 +1075,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetAll()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         Iterator<Value<?>> iterator = attr.getAll(); 
         assertFalse( iterator.hasNext() );
@@ -1097,14 +1107,14 @@ public class DefaultServerAttributeTest
     @Test
     public void testSize() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
 
         assertEquals( 0, attr1.size() );
         
         attr1.add( (String)null );
         assertEquals( 1, attr1.size() );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( atCN );
         
         attr2.add( "a", "b" );
         assertEquals( 2, attr2.size() );
@@ -1112,7 +1122,7 @@ public class DefaultServerAttributeTest
         attr2.clear();
         assertEquals( 0, attr2.size() );
 
-        EntryAttribute attr3 = new DefaultServerAttribute( atC );
+        EntryAttribute attr3 = new DefaultClientAttribute( atC );
         
         attr3.add( "US" );
         assertEquals( 1, attr3.size() );
@@ -1129,44 +1139,45 @@ public class DefaultServerAttributeTest
     @Test
     public void testPutByteArray() throws InvalidAttributeValueException, Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd );
         
-        int nbAdded = attr1.put( (byte[])null );
+        int nbAdded = attr1.add( (byte[])null );
         assertEquals( 1, nbAdded );
         assertFalse( attr1.isHR() );
         assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         
-        nbAdded = attr2.put( StringTools.EMPTY_BYTES );
+        nbAdded = attr2.add( StringTools.EMPTY_BYTES );
         assertEquals( 1, nbAdded );
         assertFalse( attr2.isHR() );
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, attr2.getBytes() ) );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr3 = new DefaultClientAttribute( atPwd );
         
-        nbAdded = attr3.put( BYTES1 );
+        nbAdded = attr3.add( BYTES1 );
         assertEquals( 1, nbAdded );
         assertFalse( attr3.isHR() );
         assertTrue( Arrays.equals( BYTES1, attr3.getBytes() ) );
         
-        EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr4 = new DefaultClientAttribute( atPwd );
         
-        nbAdded = attr4.put( BYTES1, BYTES2 );
+        nbAdded = attr4.add( BYTES1, BYTES2 );
         assertEquals( 2, nbAdded );
         assertFalse( attr4.isHR() );
         assertTrue( attr4.contains( BYTES1 ) );
         assertTrue( attr4.contains( BYTES2 ) );
         
-        nbAdded = attr4.put( BYTES3, BYTES4 );
+        attr4.clear();
+        nbAdded = attr4.add( BYTES3, BYTES4 );
         assertEquals( 2, nbAdded );
         assertFalse( attr4.isHR() );
         assertTrue( attr4.contains( BYTES3 ) );
         assertTrue( attr4.contains( BYTES4 ) );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr5 = new DefaultClientAttribute( atPwd );
         
-        nbAdded = attr5.put( BYTES1, BYTES2, (byte[])null, BYTES3 );
+        nbAdded = attr5.add( BYTES1, BYTES2, (byte[])null, BYTES3 );
         assertEquals( 4, nbAdded );
         assertFalse( attr5.isHR() );
         assertTrue( attr5.contains( BYTES1 ) );
@@ -1174,11 +1185,11 @@ public class DefaultServerAttributeTest
         assertTrue( attr5.contains( (byte[])null ) );
         assertTrue( attr5.contains( BYTES3 ) );
 
-        EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atPwd );
         
         attr6.setHR( true );
         assertFalse( attr6.isHR() );
-        nbAdded = attr6.put( BYTES1, (byte[])null );
+        nbAdded = attr6.add( BYTES1, (byte[])null );
         assertEquals( 2, nbAdded );
         assertTrue( attr6.contains( BYTES1 ) );
         assertTrue( attr6.contains( (byte[])null ) );
@@ -1191,30 +1202,30 @@ public class DefaultServerAttributeTest
     @Test
     public void testPutStringArray() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
-        int nbAdded = attr1.put( (String)null );
+        int nbAdded = attr1.add( (String)null );
         assertEquals( 1, nbAdded );
         assertTrue( attr1.isHR() );
         assertEquals( NULL_STRING_VALUE, attr1.get() );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr2 = new DefaultClientAttribute( atDC );
         
-        nbAdded = attr2.put( "" );
+        nbAdded = attr2.add( "" );
         assertEquals( 1, nbAdded );
         assertTrue( attr2.isHR() );
         assertEquals( "", attr2.getString() );
         
-        EntryAttribute attr3 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr3 = new DefaultClientAttribute( atDC );
         
-        nbAdded = attr3.put( "t" );
+        nbAdded = attr3.add( "t" );
         assertEquals( 1, nbAdded );
         assertTrue( attr3.isHR() );
         assertEquals( "t", attr3.getString() );
         
-        EntryAttribute attr4 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr4 = new DefaultClientAttribute( atDC );
         
-        nbAdded = attr4.put( "a", "b", "c", "d" );
+        nbAdded = attr4.add( "a", "b", "c", "d" );
         assertEquals( 4, nbAdded );
         assertTrue( attr4.isHR() );
         assertEquals( "a", attr4.getString() );
@@ -1223,7 +1234,8 @@ public class DefaultServerAttributeTest
         assertTrue( attr4.contains( "c" ) );
         assertTrue( attr4.contains( "d" ) );
         
-        nbAdded = attr4.put( "e" );
+        attr4.clear();
+        nbAdded = attr4.add( "e" );
         assertEquals( 1, nbAdded );
         assertTrue( attr4.isHR() );
         assertEquals( "e", attr4.getString() );
@@ -1233,13 +1245,14 @@ public class DefaultServerAttributeTest
         assertFalse( attr4.contains( "d" ) );
         assertTrue( attr4.contains( "e" ) );
         
-        nbAdded = attr4.put( BYTES1 );
+        attr4.clear();
+        nbAdded = attr4.add( BYTES1 );
         assertEquals( 0, nbAdded );
         assertTrue( attr4.isHR() );
         
-        EntryAttribute attr5 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr5 = new DefaultClientAttribute( atDC );
         
-        nbAdded = attr5.put( "a", "b", (String)null, "d" );
+        nbAdded = attr5.add( "a", "b", (String)null, "d" );
         assertEquals( 4, nbAdded );
         assertTrue( attr5.isHR() );
         assertTrue( attr5.contains( "a" ) );
@@ -1247,10 +1260,10 @@ public class DefaultServerAttributeTest
         assertTrue( attr5.contains( NULL_STRING_VALUE ) );
         assertTrue( attr5.contains( "d" ) );
 
-        EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr6 = new DefaultClientAttribute( atPwd );
         
-        nbAdded = attr6.put( "a", (String)null );
-        assertEquals( 0, nbAdded );
+        nbAdded = attr6.add( "a", (String)null );
+        assertEquals( 1, nbAdded );
         assertFalse( attr6.isHR() );
     }
 
@@ -1261,47 +1274,52 @@ public class DefaultServerAttributeTest
     @Test
     public void testPutValueArray() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
         assertEquals( 0, attr1.size() );
         
-        attr1.put( NULL_STRING_VALUE );
+        attr1.add( NULL_STRING_VALUE );
         assertEquals( 1, attr1.size() );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
         
-        attr1.put( STR_VALUE1, STR_VALUE2, STR_VALUE3 );
+        attr1.clear();
+        attr1.add( STR_VALUE1, STR_VALUE2, STR_VALUE3 );
         assertEquals( 3, attr1.size() );
         assertTrue( attr1.contains( STR_VALUE1 ) );
         assertTrue( attr1.contains( STR_VALUE2 ) );
         assertTrue( attr1.contains( STR_VALUE3 ) );
 
-        attr1.put( STR_VALUE1, NULL_STRING_VALUE, STR_VALUE3 );
+        attr1.clear();
+        attr1.add( STR_VALUE1, NULL_STRING_VALUE, STR_VALUE3 );
         assertEquals( 3, attr1.size() );
         assertTrue( attr1.contains( STR_VALUE1 ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
         assertTrue( attr1.contains( STR_VALUE3 ) );
         
-        attr1.put( STR_VALUE1, NULL_STRING_VALUE, BIN_VALUE3 );
+        attr1.clear();
+        attr1.add( STR_VALUE1, NULL_STRING_VALUE, BIN_VALUE3 );
         assertEquals( 2, attr1.size() );
         assertTrue( attr1.contains( STR_VALUE1 ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
         assertFalse( attr1.contains( STR_VALUE3 ) );
         
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         assertEquals( 0, attr2.size() );
         
-        attr2.put( NULL_BINARY_VALUE );
+        attr2.add( NULL_BINARY_VALUE );
         assertEquals( 1, attr2.size() );
         assertTrue( attr2.contains( NULL_BINARY_VALUE ) );
         
-        attr2.put( BIN_VALUE1, BIN_VALUE2, BIN_VALUE3 );
+        attr2.clear();
+        attr2.add( BIN_VALUE1, BIN_VALUE2, BIN_VALUE3 );
         assertEquals( 3, attr2.size() );
         assertTrue( attr2.contains( BIN_VALUE1 ) );
         assertTrue( attr2.contains( BIN_VALUE2 ) );
         assertTrue( attr2.contains( BIN_VALUE3 ) );
         
-        attr2.put( BIN_VALUE1, NULL_BINARY_VALUE, STR_VALUE3 );
+        attr2.clear();
+        attr2.add( BIN_VALUE1, NULL_BINARY_VALUE, STR_VALUE3 );
         assertEquals( 2, attr2.size() );
         assertTrue( attr2.contains( BIN_VALUE1 ) );
         assertTrue( attr2.contains( NULL_BINARY_VALUE ) );
@@ -1311,18 +1329,18 @@ public class DefaultServerAttributeTest
 
     /**
      * Test method put( List&lt;Value&gt; )
-     */
+     *
     @Test
     public void testPutListOfValues()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
         
         assertEquals( 0, attr1.size() );
         
         List<Value<?>> list = new ArrayList<Value<?>>();
         list.add( NULL_STRING_VALUE );
         
-        attr1.put( list );
+        attr1.add( list );
         assertEquals( 1, attr1.size() );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
         
@@ -1357,7 +1375,7 @@ public class DefaultServerAttributeTest
         assertFalse( attr1.contains( STR_VALUE3 ) );
         
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
         assertEquals( 0, attr2.size() );
         
         list.clear();
@@ -1394,14 +1412,14 @@ public class DefaultServerAttributeTest
     @Test
     public void testRemoveValueArray() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
 
         assertFalse( attr1.remove( STR_VALUE1 ) );
 
         attr1.setHR( true );
         assertFalse( attr1.remove( STR_VALUE1 ) );
         
-        attr1.put( "a", "b", "c" );
+        attr1.add( "a", "b", "c" );
         assertTrue( attr1.remove( STR_VALUE1 ) );
         assertEquals( 2, attr1.size() );
         
@@ -1410,29 +1428,30 @@ public class DefaultServerAttributeTest
         
         assertFalse( attr1.remove( STR_VALUE4 ) );
         
-        attr1.put( "a", "b", "c" );
+        attr1.clear();
+        attr1.add( "a", "b", "c" );
         assertFalse( attr1.remove( STR_VALUE2, STR_VALUE4 ) );
         assertEquals( 2, attr1.size() );
         
         attr1.clear();
-        attr1.put( "a", (String)null, "b" );
+        attr1.add( "a", (String)null, "b" );
         assertTrue( attr1.remove( NULL_STRING_VALUE, STR_VALUE1 ) );
         assertEquals( 1, attr1.size() );
         
         attr1.clear();
-        attr1.put( "a", (String)null, "b" );
+        attr1.add( "a", (String)null, "b" );
         attr1.add( BYTES3 );
         assertFalse( attr1.remove( NULL_STRING_VALUE, STR_VALUE1, BIN_VALUE3 ) );
         assertEquals( 1, attr1.size() );
         
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd );
 
         assertFalse( attr2.remove( BIN_VALUE1 ) );
 
         attr2.setHR( true );
         assertFalse( attr2.remove( BIN_VALUE1 ) );
         
-        attr2.put( BYTES1, BYTES2, BYTES3 );
+        attr2.add( BYTES1, BYTES2, BYTES3 );
         assertTrue( attr2.remove( BIN_VALUE1 ) );
         assertEquals( 2, attr2.size() );
         
@@ -1441,20 +1460,22 @@ public class DefaultServerAttributeTest
         
         assertFalse( attr2.remove( BIN_VALUE4 ) );
         
-        attr2.put( BYTES1, BYTES2, BYTES3 );
+        attr2.clear();
+        attr2.add( BYTES1, BYTES2, BYTES3 );
         assertFalse( attr2.remove( BIN_VALUE2, STR_VALUE4 ) );
         assertEquals( 2, attr2.size() );
         
         attr2.clear();
-        attr2.put( BYTES1, (byte[])null, BYTES3 );
+        attr2.add( BYTES1, (byte[])null, BYTES3 );
         assertFalse( attr2.remove( NULL_STRING_VALUE, BIN_VALUE1 ) );
         assertEquals( 2, attr2.size() );
         
         attr2.clear();
-        attr2.put( BYTES1, (byte[])null, BYTES2 );
+        attr2.add( BYTES1, (byte[])null, BYTES2 );
         attr2.add( "c" );
+        assertEquals( 4, attr2.size() );
         assertFalse( attr2.remove( NULL_STRING_VALUE, BIN_VALUE1, STR_VALUE3 ) );
-        assertEquals( 2, attr2.size() );
+        assertEquals( 3, attr2.size() );
     }
 
 
@@ -1464,11 +1485,11 @@ public class DefaultServerAttributeTest
     @Test
     public void testRemoveByteArray() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd );
 
         assertFalse( attr1.remove( BYTES1 ) );
 
-        attr1.put( BYTES1, BYTES2, BYTES3 );
+        attr1.add( BYTES1, BYTES2, BYTES3 );
         assertTrue( attr1.remove( BYTES1 ) );
         assertEquals( 2, attr1.size() );
         
@@ -1477,12 +1498,13 @@ public class DefaultServerAttributeTest
         
         assertFalse( attr1.remove( BYTES4 ) );
         
-        attr1.put( BYTES1, BYTES2, BYTES3 );
+        attr1.clear();
+        attr1.add( BYTES1, BYTES2, BYTES3 );
         assertFalse( attr1.remove( BYTES3, BYTES4 ) );
         assertEquals( 2, attr1.size() );
         
         attr1.clear();
-        attr1.put( BYTES1, (byte[])null, BYTES2 ) ;
+        attr1.add( BYTES1, (byte[])null, BYTES2 ) ;
         assertTrue( attr1.remove( (byte[])null, BYTES1 ) );
         assertEquals( 1, attr1.size() );
     }
@@ -1494,14 +1516,14 @@ public class DefaultServerAttributeTest
     @Test
     public void testRemoveStringArray() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC );
 
         assertFalse( attr1.remove( "a" ) );
 
         attr1.setHR( true );
         assertFalse( attr1.remove( "a" ) );
         
-        attr1.put( "a", "b", "c" );
+        attr1.add( "a", "b", "c" );
         assertTrue( attr1.remove( "a" ) );
         assertEquals( 2, attr1.size() );
         
@@ -1510,18 +1532,19 @@ public class DefaultServerAttributeTest
         
         assertFalse( attr1.remove( "d" ) );
         
-        attr1.put( "a", "b", "c" );
+        attr1.clear();
+        attr1.add( "a", "b", "c" );
         assertFalse( attr1.remove( "b", "e" ) );
         assertEquals( 2, attr1.size() );
         
         attr1.clear();
-        attr1.put( "a", (String)null, "b" );
+        attr1.add( "a", (String)null, "b" );
         assertTrue( attr1.remove( (String )null, "a" ) );
         assertEquals( 1, attr1.size() );
         
         EntryAttribute attr2 = new DefaultClientAttribute( "test" );
         
-        attr2.put( BYTES1, BYTES2, BYTES3 );
+        attr2.add( BYTES1, BYTES2, BYTES3 );
         
         assertFalse( attr2.remove( (String)null ) );
         assertTrue( attr2.remove( "ab", "c" ) );
@@ -1535,7 +1558,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testIterator()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( atCN );
         attr1.add(  "a", "b", "c" );
         
         Iterator<Value<?>> iter = attr1.iterator();
@@ -1559,18 +1582,19 @@ public class DefaultServerAttributeTest
     @Test
     public void testToString()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atDC );
         
-        assertEquals( "    cn: (null)\n", attr.toString() );
+        assertEquals( "    dc: (null)\n", attr.toString() );
         
-        attr.setUpId( "CommonName" );
-        assertEquals( "    CommonName: (null)\n", attr.toString() );
+        attr.setUpId( "DomainComponent" );
+        assertEquals( "    DomainComponent: (null)\n", attr.toString() );
         
         attr.add( (String)null );
-        assertEquals( "    CommonName: ''\n", attr.toString() );
+        assertEquals( "    DomainComponent: ''\n", attr.toString() );
 
-        attr.put( "a", "b" );
-        assertEquals( "    CommonName: a\n    CommonName: b\n", attr.toString() );
+        attr.clear();
+        attr.add( "a", "b" );
+        assertEquals( "    DomainComponent: a\n    DomainComponent: b\n", attr.toString() );
     }
 
 
@@ -1580,7 +1604,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testInstanceOf() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         assertTrue( attr.instanceOf( "CommonName" ) );
         assertTrue( attr.instanceOf( "2.5.4.3" ) );
@@ -1597,7 +1621,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testSetUpIdStringAttributeType() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atSN );
+        EntryAttribute attr = new DefaultClientAttribute( atSN );
         
         attr.setUpId( null, atCN );
         assertEquals( "cn", attr.getId() );
@@ -1653,7 +1677,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testSetUpIdString() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         attr.setUpId( "cn" );
         assertEquals( "cn", attr.getId() );
@@ -1676,7 +1700,7 @@ public class DefaultServerAttributeTest
         assertEquals( atCN, attr.getAttributeType() );
         
         // Now check wrong IDs
-        attr = new DefaultServerAttribute( atCN );
+        attr = new DefaultClientAttribute( atCN );
         attr.setUpId( "sn" );
         assertEquals( "cn", attr.getId() );
         assertEquals( "cn", attr.getUpId() );
@@ -1705,7 +1729,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testSetAttributeType() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         try
         {
@@ -1731,18 +1755,18 @@ public class DefaultServerAttributeTest
     @Test
     public void testGetAttributeType() throws Exception
     {
-        EntryAttribute attr = new DefaultServerAttribute( atSN );
+        EntryAttribute attr = new DefaultClientAttribute( atSN );
         assertEquals( atSN, attr.getAttributeType() );
     }
 
 
     /**
-     * Test constructor DefaultServerAttribute( AttributeType )
+     * Test constructor DefaultClientAttribute( AttributeType )
      */
     @Test
     public void testDefaultServerAttributeAttributeType()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         assertTrue( attr.isHR() );
         assertEquals( 0, attr.size() );
@@ -1753,12 +1777,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test constructor DefaultServerAttribute( String, AttributeType )
+     * Test constructor DefaultClientAttribute( String, AttributeType )
      */
     @Test
     public void testDefaultServerAttributeStringAttributeType()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
+        EntryAttribute attr1 = new DefaultClientAttribute( "cn", atCN );
         
         assertTrue( attr1.isHR() );
         assertEquals( 0, attr1.size() );
@@ -1766,7 +1790,7 @@ public class DefaultServerAttributeTest
         assertEquals( "cn", attr1.getUpId() );
         assertEquals( atCN, attr1.getAttributeType() );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( "  CommonName  ", atCN );
+        EntryAttribute attr2 = new DefaultClientAttribute( "  CommonName  ", atCN );
         
         assertTrue( attr2.isHR() );
         assertEquals( 0, attr2.size() );
@@ -1774,7 +1798,7 @@ public class DefaultServerAttributeTest
         assertEquals( "  CommonName  ", attr2.getUpId() );
         assertEquals( atCN, attr2.getAttributeType() );
 
-        EntryAttribute attr3 = new DefaultServerAttribute( "  ", atCN );
+        EntryAttribute attr3 = new DefaultClientAttribute( "  ", atCN );
         
         assertTrue( attr3.isHR() );
         assertEquals( 0, attr3.size() );
@@ -1785,12 +1809,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test constructor DefaultServerAttribute( AttributeType, Value... )
+     * Test constructor DefaultClientAttribute( AttributeType, Value... )
      */
     @Test
     public void testDefaultServerAttributeAttributeTypeValueArray() throws Exception
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1800,7 +1824,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( "a", "b" ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr2 = new DefaultClientAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr2.isHR() );
         assertEquals( 2, attr2.size() );
@@ -1813,12 +1837,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test constructor DefaultServerAttribute( String, AttributeType, Value... )
+     * Test constructor DefaultClientAttribute( String, AttributeType, Value... )
      */
     @Test
     public void testDefaultServerAttributeStringAttributeTypeValueArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( "dc", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr1 = new DefaultClientAttribute( "dc", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1828,7 +1852,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( "a", "b" ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr2 = new DefaultClientAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr2.isHR() );
         assertEquals( 2, attr2.size() );
@@ -1838,7 +1862,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr2.contains( "a" ) );
         assertTrue( attr2.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr3 = new DefaultServerAttribute( "DomainComponent", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr3 = new DefaultClientAttribute( "DomainComponent", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr3.isHR() );
         assertEquals( 3, attr3.size() );
@@ -1848,7 +1872,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr3.contains( "a", "b" ) );
         assertTrue( attr3.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr4 = new DefaultServerAttribute( " 0.9.2342.19200300.100.1.25 ", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr4 = new DefaultClientAttribute( " 0.9.2342.19200300.100.1.25 ", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr4.isHR() );
         assertEquals( 3, attr4.size() );
@@ -1861,12 +1885,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test constructor DefaultServerAttribute( AttributeType, String... ) 
+     * Test constructor DefaultClientAttribute( AttributeType, String... ) 
      */
     @Test
     public void testDefaultServerAttributeAttributeTypeStringArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atDC, "a", "b", (String)null );
+        EntryAttribute attr1 = new DefaultClientAttribute( atDC, "a", "b", (String)null );
         
         assertTrue( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1876,7 +1900,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( "a", "b" ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+        EntryAttribute attr2 = new DefaultClientAttribute( atDC, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
         
         assertTrue( attr2.isHR() );
         assertEquals( 2, attr2.size() );
@@ -1889,12 +1913,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test constructor DefaultServerAttribute( String, AttributeType, String... )
+     * Test constructor DefaultClientAttribute( String, AttributeType, String... )
      */
     @Test
     public void testDefaultServerAttributeStringAttributeTypeStringArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( "dc", atDC, "a", "b", (String)null );
+        EntryAttribute attr1 = new DefaultClientAttribute( "dc", atDC, "a", "b", (String)null );
         
         assertTrue( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1904,7 +1928,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( "a", "b" ) );
         assertTrue( attr1.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( "DomainComponent", atDC, "a", "b", (String)null );
+        EntryAttribute attr2 = new DefaultClientAttribute( "DomainComponent", atDC, "a", "b", (String)null );
         
         assertTrue( attr2.isHR() );
         assertEquals( 3, attr2.size() );
@@ -1914,7 +1938,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr2.contains( "a", "b" ) );
         assertTrue( attr2.contains( NULL_STRING_VALUE ) );
 
-        EntryAttribute attr3 = new DefaultServerAttribute( " 0.9.2342.19200300.100.1.25 ", atDC, "a", "b", (String)null );
+        EntryAttribute attr3 = new DefaultClientAttribute( " 0.9.2342.19200300.100.1.25 ", atDC, "a", "b", (String)null );
         
         assertTrue( attr3.isHR() );
         assertEquals( 3, attr3.size() );
@@ -1927,12 +1951,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test method DefaultServerAttribute( AttributeType, byte[]... ) 
+     * Test method DefaultClientAttribute( AttributeType, byte[]... ) 
      */
     @Test
     public void testDefaultServerAttributeAttributeTypeByteArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( atPwd, BYTES1, BYTES2, (byte[])null );
+        EntryAttribute attr1 = new DefaultClientAttribute( atPwd, BYTES1, BYTES2, (byte[])null );
         
         assertFalse( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1942,7 +1966,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( BYTES1, BYTES2 ) );
         assertTrue( attr1.contains( NULL_BINARY_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
+        EntryAttribute attr2 = new DefaultClientAttribute( atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
         
         assertFalse( attr2.isHR() );
         assertEquals( 2, attr2.size() );
@@ -1955,12 +1979,12 @@ public class DefaultServerAttributeTest
 
 
     /**
-     * Test method DefaultServerAttribute( String, AttributeType, byte[]... )
+     * Test method DefaultClientAttribute( String, AttributeType, byte[]... )
      */
     @Test
     public void testDefaultServerAttributeStringAttributeTypeByteArray()
     {
-        EntryAttribute attr1 = new DefaultServerAttribute( "userPassword", atPwd, BYTES1, BYTES2, (byte[])null );
+        EntryAttribute attr1 = new DefaultClientAttribute( "userPassword", atPwd, BYTES1, BYTES2, (byte[])null );
         
         assertFalse( attr1.isHR() );
         assertEquals( 3, attr1.size() );
@@ -1970,7 +1994,7 @@ public class DefaultServerAttributeTest
         assertTrue( attr1.contains( BYTES1, BYTES2 ) );
         assertTrue( attr1.contains( NULL_BINARY_VALUE ) );
 
-        EntryAttribute attr2 = new DefaultServerAttribute( "2.5.4.35", atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
+        EntryAttribute attr2 = new DefaultClientAttribute( "2.5.4.35", atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
         
         assertFalse( attr2.isHR() );
         assertEquals( 2, attr2.size() );
@@ -1988,7 +2012,7 @@ public class DefaultServerAttributeTest
     @Test
     public void testClone()
     {
-        EntryAttribute attr = new DefaultServerAttribute( atCN );
+        EntryAttribute attr = new DefaultClientAttribute( atCN );
         
         EntryAttribute clone = attr.clone();
         
@@ -2014,15 +2038,15 @@ public class DefaultServerAttributeTest
     @Test 
     public void testCopyConstructorServerAttribute() throws LdapInvalidAttributeValueException
     {
-        EntryAttribute attribute = new DefaultServerAttribute( atCN );
+        EntryAttribute attribute = new DefaultClientAttribute( atCN );
         
-        EntryAttribute copy = new DefaultServerAttribute( atCN, attribute );
+        EntryAttribute copy = new DefaultClientAttribute( atCN, attribute );
         
         assertEquals( copy, attribute );
 
-        EntryAttribute attribute2 = new DefaultServerAttribute( atCN, "test" );
+        EntryAttribute attribute2 = new DefaultClientAttribute( atCN, "test" );
         
-        EntryAttribute copy2 = new DefaultServerAttribute( atCN, attribute2 );
+        EntryAttribute copy2 = new DefaultClientAttribute( atCN, attribute2 );
         
         assertEquals( copy2, attribute2 );
         attribute2.add( "test2" );
@@ -2038,9 +2062,9 @@ public class DefaultServerAttributeTest
     public void testCopyConstructorClientAttribute() throws LdapInvalidAttributeValueException
     {
         EntryAttribute attribute = new DefaultClientAttribute( "commonName" );
-        attribute.put( "test" );
+        attribute.add( "test" );
         
-        EntryAttribute copy = new DefaultServerAttribute( atCN, attribute );
+        EntryAttribute copy = new DefaultClientAttribute( atCN, attribute );
 
         assertEquals( atCN, copy.getAttributeType() );
         assertEquals( "test", copy.getString() );
@@ -2057,7 +2081,7 @@ public class DefaultServerAttributeTest
     @Test 
     public void testToClientAttribute()
     {
-        EntryAttribute attribute = new DefaultServerAttribute( atCN, "test", "test2" );
+        EntryAttribute attribute = new DefaultClientAttribute( atCN, "test", "test2" );
         
         EntryAttribute clientAttribute = attribute.toClientAttribute();
         
@@ -2077,12 +2101,12 @@ public class DefaultServerAttributeTest
     @Test
     public void testSerializeCompleteAttribute() throws LdapException, IOException, ClassNotFoundException
     {
-        DefaultServerAttribute dsa = new DefaultServerAttribute( atCN );
+        DefaultClientAttribute dsa = new DefaultClientAttribute( atCN );
         dsa.setHR( true );
         dsa.setUpId( "CommonName" );
         dsa.add( "test1", "test2" );
 
-        DefaultServerAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
+        DefaultClientAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
         assertEquals( dsa.toString(), dsaSer.toString() );
         assertEquals( "commonname", dsaSer.getId() );
         assertEquals( "CommonName", dsaSer.getUpId() );
@@ -2099,11 +2123,11 @@ public class DefaultServerAttributeTest
     @Test
     public void testSerializeAttributeWithNoValue() throws LdapException, IOException, ClassNotFoundException
     {
-        DefaultServerAttribute dsa = new DefaultServerAttribute( atCN );
+        DefaultClientAttribute dsa = new DefaultClientAttribute( atCN );
         dsa.setHR( true );
         dsa.setId( "cn" );
 
-        DefaultServerAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
+        DefaultClientAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
         assertEquals( dsa.toString(), dsaSer.toString() );
         assertEquals( "cn", dsaSer.getId() );
         assertEquals( "cn", dsaSer.getUpId() );
@@ -2119,20 +2143,20 @@ public class DefaultServerAttributeTest
     @Test
     public void testSerializeAttributeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
-        DefaultServerAttribute dsa = new DefaultServerAttribute( atCN );
+        DefaultClientAttribute dsa = new DefaultClientAttribute( atDC );
         dsa.setHR( true );
-        dsa.setUpId( "CommonName" );
+        dsa.setUpId( "DomainComponent" );
         dsa.add( (String)null );
 
-        DefaultServerAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
+        DefaultClientAttribute dsaSer = deserializeValue( serializeValue( dsa ), atDC );
         assertEquals( dsa.toString(), dsaSer.toString() );
-        assertEquals( "commonname", dsaSer.getId() );
-        assertEquals( "CommonName", dsaSer.getUpId() );
+        assertEquals( "domaincomponent", dsaSer.getId() );
+        assertEquals( "DomainComponent", dsaSer.getUpId() );
         assertEquals( "", dsaSer.getString() );
         assertEquals( 1, dsaSer.size() );
         assertTrue( dsaSer.contains( (String)null ) );
         assertTrue( dsaSer.isHR() );
-        assertFalse( dsaSer.isValid() );
+        assertTrue( dsaSer.isValid() );
     }
     
     
@@ -2142,12 +2166,12 @@ public class DefaultServerAttributeTest
     @Test
     public void testSerializeAttributeBinaryValue() throws LdapException, IOException, ClassNotFoundException
     {
-        DefaultServerAttribute dsa = new DefaultServerAttribute( atPwd );
+        DefaultClientAttribute dsa = new DefaultClientAttribute( atPwd );
         dsa.setHR( false );
         byte[] password = StringTools.getBytesUtf8( "secret" );
         dsa.add( password );
 
-        DefaultServerAttribute dsaSer = deserializeValue( serializeValue( dsa ), atPwd );
+        DefaultClientAttribute dsaSer = deserializeValue( serializeValue( dsa ), atPwd );
         assertEquals( dsa.toString(), dsaSer.toString() );
         assertEquals( "userpassword", dsaSer.getId() );
         assertEquals( "userPassword", dsaSer.getUpId() );



Mime
View raw message