You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/03/30 01:25:43 UTC

svn commit: r928938 [2/2] - in /directory: apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-integ/src/test/jav...

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java Mon Mar 29 23:25:42 2010
@@ -64,7 +64,7 @@ public class ClientStringValue extends A
     // Constructors
     // -----------------------------------------------------------------------
     /**
-     * Creates a ServerStringValue without an initial wrapped value.
+     * Creates a ClientStringValue without an initial wrapped value.
      */
     public ClientStringValue()
     {
@@ -74,7 +74,34 @@ public class ClientStringValue extends A
 
 
     /**
-     * Creates a ServerStringValue with an initial wrapped String value.
+     * Creates a ClientStringValue without an initial wrapped value.
+     *
+     * @param attributeType the schema type associated with this ClientStringValue
+     */
+    public ClientStringValue( AttributeType attributeType )
+    {
+        if ( attributeType == null )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) );
+        }
+
+        if ( attributeType.getSyntax() == null )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) );
+        }
+
+        if ( ! attributeType.getSyntax().isHumanReadable() )
+        {
+            LOG.warn( "Treating a value of a binary attribute {} as a String: " +
+                    "\nthis could cause data corruption!", attributeType.getName() );
+        }
+
+        this.attributeType = attributeType;
+    }
+
+
+    /**
+     * Creates a ClientStringValue with an initial wrapped String value.
      *
      * @param wrapped the value to wrap which can be null
      */
@@ -86,6 +113,37 @@ public class ClientStringValue extends A
     }
 
 
+    /**
+     * Creates a ClientStringValue with an initial wrapped String value.
+     *
+     * @param attributeType the schema type associated with this ClientStringValue
+     * @param wrapped the value to wrap which can be null
+     */
+    public ClientStringValue( AttributeType attributeType, String wrapped )
+    {
+        this( attributeType );
+        this.wrapped = wrapped;
+    }
+
+
+    /**
+     * Creates a ClientStringValue with an initial wrapped String value and
+     * a normalized value.
+     *
+     * @param attributeType the schema type associated with this ClientStringValue
+     * @param wrapped the value to wrap which can be null
+     * @param normalizedValue the normalized value
+     */
+    /** No protection */ ClientStringValue( AttributeType attributeType, String wrapped, String normalizedValue, boolean valid )
+    {
+        this( wrapped );
+        this.normalized = true;
+        this.attributeType = attributeType;
+        this.normalizedValue = normalizedValue;
+        this.valid = valid;
+    }
+
+
     // -----------------------------------------------------------------------
     // Value<String> Methods
     // -----------------------------------------------------------------------
@@ -140,9 +198,24 @@ public class ClientStringValue extends A
     {
         if ( isNull() )
         {
+            normalized = true;
             return null;
         }
 
+        if ( !normalized )
+        {
+            try
+            {
+                normalize();
+            }
+            catch ( LdapException ne )
+            {
+                String message = "Cannot normalize the value :" + ne.getLocalizedMessage();
+                LOG.info( message );
+                normalized = false;
+            }
+        }
+        
         if ( normalizedValue == null )
         {
             return wrapped;
@@ -150,6 +223,35 @@ public class ClientStringValue extends A
 
         return normalizedValue;
     }
+    
+    
+    public void apply( AttributeType attributeType )
+    {
+        if ( this.attributeType != null ) 
+        {
+            if ( !attributeType.equals( this.attributeType ) )
+            {
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04476, attributeType.getName(), this.attributeType.getName() ) );
+            }
+            else
+            {
+                return;
+            }
+        }
+        
+        this.attributeType = attributeType;
+        
+        try
+        {
+            normalize();
+        }
+        catch ( LdapException ne )
+        {
+            String message = I18n.err( I18n.ERR_04447, ne.getLocalizedMessage() );
+            LOG.info( message );
+            normalized = false;
+        }
+    }
 
 
     /**
@@ -165,6 +267,38 @@ public class ClientStringValue extends A
 
 
     /**
+     * Compute the normalized (canonical) representation for the wrapped string.
+     * If the wrapped String is null, the normalized form will be null too.  
+     *
+     * @throws LdapException if the value cannot be properly normalized
+     */
+    public void normalize() throws LdapException
+    {
+        // If the value is already normalized, get out.
+        if ( normalized )
+        {
+            return;
+        }
+        
+        if ( attributeType != null )
+        {
+            Normalizer normalizer = getNormalizer();
+    
+            if ( normalizer == null )
+            {
+                normalizedValue = wrapped;
+            }
+            else
+            {
+                normalizedValue = ( String ) normalizer.normalize( wrapped );
+            }
+    
+            normalized = true;
+        }
+    }
+
+    
+    /**
      * Normalize the value. For a client String value, applies the given normalizer.
      * 
      * It supposes that the client has access to the schema in order to select the
@@ -209,18 +343,46 @@ public class ClientStringValue extends A
             return 1;
         }
 
-        if ( value instanceof ClientStringValue )
-        {
-            ClientStringValue stringValue = ( ClientStringValue ) value;
-            
-            return getNormalizedValue().compareTo( stringValue.getNormalizedValue() );
-        }
-        else 
+        if ( !( value instanceof ClientStringValue ) )
         {
             String message = I18n.err( I18n.ERR_04128, toString(), value.getClass() );
             LOG.error( message );
             throw new NotImplementedException( message );
         }
+        
+        ClientStringValue stringValue = ( ClientStringValue ) value;
+        
+        if ( attributeType != null )
+        {
+            if ( stringValue.getAttributeType() == null )
+            {
+                return getNormalizedValue().compareTo( stringValue.getNormalizedValue() );
+            }
+            else
+            {
+                if ( !attributeType.equals( stringValue.getAttributeType() ) )
+                {
+                    String message = I18n.err( I18n.ERR_04128, toString(), value.getClass() );
+                    LOG.error( message );
+                    throw new NotImplementedException( message );
+                }
+            }
+        }
+        else 
+        {
+            return getNormalizedValue().compareTo( stringValue.getNormalizedValue() );
+        }
+            
+        try
+        {
+            return getLdapComparator().compare( getNormalizedValue(), stringValue.getNormalizedValue() );
+        }
+        catch ( LdapException e )
+        {
+            String msg = I18n.err( I18n.ERR_04443, this, value );
+            LOG.error( msg, e );
+            throw new IllegalStateException( msg, e );
+        }
     }
 
 
@@ -310,9 +472,70 @@ public class ClientStringValue extends A
         {
             return other.isNull();
         }
-        
-        // Test the normalized values
-        return this.getNormalizedValue().equals( other.getNormalizedValue() );
+       
+        // If we have an attributeType, it must be equal
+        // We should also use the comparator if we have an AT
+        if ( attributeType != null )
+        {
+            if ( other.attributeType != null )
+            {
+                if ( !attributeType.equals( other.attributeType ) )
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                return this.getNormalizedValue().equals( other.getNormalizedValue() );
+            }
+        }
+        else if ( other.attributeType != null )
+        {
+            return this.getNormalizedValue().equals( other.getNormalizedValue() );
+        }
+
+        // Shortcut : compare the values without normalization
+        // If they are equal, we may avoid a normalization.
+        // Note : if two values are equal, then their normalized
+        // value are equal too if their attributeType are equal. 
+        if ( getReference().equals( other.getReference() ) )
+        {
+            return true;
+        }
+
+        if ( attributeType != null )
+        {
+            try
+            {
+                LdapComparator<? super Object> comparator = getLdapComparator();
+
+                // Compare normalized values
+                if ( comparator == null )
+                {
+                    return getNormalizedValue().equals( other.getNormalizedValue() );
+                }
+                else
+                {
+                    if ( isNormalized() )
+                    {
+                        return comparator.compare( getNormalizedValue(), other.getNormalizedValue() ) == 0;
+                    }
+                    else
+                    {
+                        Normalizer normalizer = attributeType.getEquality().getNormalizer();
+                        return comparator.compare( normalizer.normalize( get() ), normalizer.normalize( other.get() ) ) == 0;
+                    }
+                }
+            }
+            catch ( LdapException ne )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return this.getNormalizedValue().equals( other.getNormalizedValue() );
+        }
     }
     
     
@@ -660,7 +883,7 @@ public class ClientStringValue extends A
 
     
     /**
-     * Deserialize a ServerStringValue. 
+     * Deserialize a ClientStringValue. 
      *
      * @param in the buffer containing the bytes with the serialized value
      * @throws IOException 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java Mon Mar 29 23:25:42 2010
@@ -34,7 +34,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -512,7 +511,7 @@ public class DefaultClientAttribute impl
                     // We have to do that because we are using a Set,
                     // and we can't remove the first element of the Set.
                     nullBinaryValue = new BinaryValue( (byte[])null );
-                    nullStringValue = new ClientStringValue( null );
+                    nullStringValue = new ClientStringValue( (String)null );
                     
                     values.add( nullBinaryValue );
                     values.add( nullStringValue );
@@ -535,7 +534,7 @@ public class DefaultClientAttribute impl
                 else
                 {
                     // The attribute is HR
-                    nullStringValue = new ClientStringValue( null );
+                    nullStringValue = new ClientStringValue( (String)null );
                     
                     // Don't add a value if it already exists. 
                     if ( !values.contains( nullStringValue ) )
@@ -1449,7 +1448,7 @@ public class DefaultClientAttribute impl
         {
             Value<?> clientValue = null;
             
-            if ( value instanceof ServerStringValue )
+            if ( value instanceof ClientStringValue )
             {
                 clientValue = new ClientStringValue( value.getString() );
             }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java Mon Mar 29 23:25:42 2010
@@ -35,8 +35,8 @@ import java.io.ObjectOutputStream;
 import java.util.Arrays;
 
 import org.apache.directory.shared.ldap.entry.BinaryValue;
-import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
@@ -204,7 +204,7 @@ public class BinaryValueAttributeTypeTes
     {
         try
         {
-            new BinaryValue( null, (byte[])null );
+            new BinaryValue( null, null );
             fail();
         }
         catch ( IllegalArgumentException iae )
@@ -330,7 +330,7 @@ public class BinaryValueAttributeTypeTes
         BinaryValue value4 = new BinaryValue( at1, new byte[]{0x01} );
         BinaryValue value5 = new BinaryValue( at1, null );
         BinaryValue value6 = new BinaryValue( at, new byte[]{0x01, 0x02} );
-        ServerStringValue value7 = new ServerStringValue( EntryUtils.getIA5StringAttributeType(), 
+        ClientStringValue value7 = new ClientStringValue( EntryUtils.getIA5StringAttributeType(), 
             "test" );
         
         assertTrue( value1.equals( value1 ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java Mon Mar 29 23:25:42 2010
@@ -39,8 +39,8 @@ import java.util.HashSet;
 import java.util.List;
 
 import org.apache.directory.shared.ldap.entry.BinaryValue;
-import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
@@ -54,7 +54,7 @@ import org.junit.Test;
 
 
 /**
- * Tests that the ServerStringValue class works properly as expected.
+ * Tests that the ClientStringValue class works properly as expected.
  *
  * Some notes while conducting tests:
  *
@@ -94,9 +94,9 @@ public class StringValueAttributeTypeTes
     
     
     /**
-     * Serialize a ServerStringValue
+     * Serialize a ClientStringValue
      */
-    private ByteArrayOutputStream serializeValue( ServerStringValue value ) throws IOException
+    private ByteArrayOutputStream serializeValue( ClientStringValue value ) throws IOException
     {
         ObjectOutputStream oOut = null;
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -131,9 +131,9 @@ public class StringValueAttributeTypeTes
     
     
     /**
-     * Deserialize a ServerStringValue
+     * Deserialize a ClientStringValue
      */
-    private ServerStringValue deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
+    private ClientStringValue deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
     {
         ObjectInputStream oIn = null;
         ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -142,7 +142,7 @@ public class StringValueAttributeTypeTes
         {
             oIn = new ObjectInputStream( in );
 
-            ServerStringValue value = new ServerStringValue( at );
+            ClientStringValue value = new ClientStringValue( at );
             value.deserialize( oIn );
 
             return value;
@@ -172,11 +172,11 @@ public class StringValueAttributeTypeTes
      * Test the constructor with a null value
      */
     @Test 
-    public void testServerStringValueNullValue()
+    public void testClientStringValueNullValue()
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( attribute, null );
+        ClientStringValue value = new ClientStringValue( attribute, null );
         
         assertNull( value.get() );
         assertTrue( value.isNull() );
@@ -190,7 +190,7 @@ public class StringValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( attribute, null );
+        ClientStringValue value = new ClientStringValue( attribute, null );
         
         assertFalse( value.isNormalized() );
         assertNull( value.getNormalizedValue() );
@@ -217,7 +217,7 @@ public class StringValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( attribute, null );
+        ClientStringValue value = new ClientStringValue( attribute, null );
         assertTrue( value.isValid() );
 
         value.set( "" );
@@ -238,7 +238,7 @@ public class StringValueAttributeTypeTes
     public void testNormalize() throws LdapException
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( attribute );
+        ClientStringValue ssv = new ClientStringValue( attribute );
 
         ssv.normalize();
         assertEquals( null, ssv.getNormalizedValue() );
@@ -260,7 +260,7 @@ public class StringValueAttributeTypeTes
     public void testInstanceOf() throws LdapException
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( attribute );
+        ClientStringValue ssv = new ClientStringValue( attribute );
         
         assertTrue( ssv.instanceOf( attribute ) );
         
@@ -277,7 +277,7 @@ public class StringValueAttributeTypeTes
     public void testgetAttributeType()
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( attribute );
+        ClientStringValue ssv = new ClientStringValue( attribute );
         
         assertEquals( attribute, ssv.getAttributeType() );
     }    
@@ -291,13 +291,13 @@ public class StringValueAttributeTypeTes
         AttributeType at1 = EntryUtils.getIA5StringAttributeType();
         AttributeType at2 = EntryUtils.getBytesAttributeType();
         
-        ServerStringValue value1 = new ServerStringValue( at1, "test" );
-        ServerStringValue value2 = new ServerStringValue( at1, "test" );
-        ServerStringValue value3 = new ServerStringValue( at1, "TEST" );
-        ServerStringValue value4 = new ServerStringValue( at1, "tes" );
-        ServerStringValue value5 = new ServerStringValue( at1, null );
+        ClientStringValue value1 = new ClientStringValue( at1, "test" );
+        ClientStringValue value2 = new ClientStringValue( at1, "test" );
+        ClientStringValue value3 = new ClientStringValue( at1, "TEST" );
+        ClientStringValue value4 = new ClientStringValue( at1, "tes" );
+        ClientStringValue value5 = new ClientStringValue( at1, null );
         BinaryValue valueBytes = new BinaryValue( at2, new byte[]{0x01} );
-        ServerStringValue valueString = new ServerStringValue( at, "test" );
+        ClientStringValue valueString = new ClientStringValue( at, "test" );
         
         assertTrue( value1.equals( value1 ) );
         assertTrue( value1.equals( value2 ) );
@@ -327,7 +327,7 @@ public class StringValueAttributeTypeTes
     {
         try
         {
-            new ServerStringValue( null );
+            new ClientStringValue( null, null );
             fail();
         }
         catch ( IllegalArgumentException iae )
@@ -340,7 +340,7 @@ public class StringValueAttributeTypeTes
         
         try
         {
-            new ServerStringValue( attribute );
+            new ClientStringValue( attribute );
             fail();
         }
         catch ( IllegalArgumentException iae )
@@ -357,9 +357,9 @@ public class StringValueAttributeTypeTes
     @Test public void testHashCode()
     {
         AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
-        ServerStringValue v0 = new ServerStringValue( at1, "Alex" );
-        ServerStringValue v1 = new ServerStringValue( at1, "ALEX" );
-        ServerStringValue v2 = new ServerStringValue( at1, "alex" );
+        ClientStringValue v0 = new ClientStringValue( at1, "Alex" );
+        ClientStringValue v1 = new ClientStringValue( at1, "ALEX" );
+        ClientStringValue v2 = new ClientStringValue( at1, "alex" );
         
         assertEquals( v0.hashCode(), v1.hashCode() );
         assertEquals( v0.hashCode(), v2.hashCode() );
@@ -373,12 +373,12 @@ public class StringValueAttributeTypeTes
         assertTrue( v1.isValid() );
         assertTrue( v2.isValid() );
 
-        ServerStringValue v3 = new ServerStringValue( at1, "Timber" );
+        ClientStringValue v3 = new ClientStringValue( at1, "Timber" );
         
         assertTrue( v3.isValid() );
         assertNotSame( v0.hashCode(), v3.hashCode() );
 
-        ServerStringValue v4 = new ServerStringValue( at, "Alex" );
+        ClientStringValue v4 = new ClientStringValue( at, "Alex" );
         
         assertNotSame( v0.hashCode(), v4.hashCode() );
     }
@@ -391,13 +391,13 @@ public class StringValueAttributeTypeTes
     public void testCompareTo()
     {
         AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
-        ServerStringValue v0 = new ServerStringValue( at1, "Alex" );
-        ServerStringValue v1 = new ServerStringValue( at1, "ALEX" );
+        ClientStringValue v0 = new ClientStringValue( at1, "Alex" );
+        ClientStringValue v1 = new ClientStringValue( at1, "ALEX" );
         
         assertEquals( 0, v0.compareTo( v1 ) );
         assertEquals( 0, v1.compareTo( v0 ) );
 
-        ServerStringValue v2 = new ServerStringValue( at1, null );
+        ClientStringValue v2 = new ClientStringValue( at1, null );
         
         assertEquals( 1, v0.compareTo( v2 ) );
         assertEquals( -1, v2.compareTo( v0 ) );
@@ -411,9 +411,9 @@ public class StringValueAttributeTypeTes
     public void testClone() throws LdapException
     {
         AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
-        ServerStringValue ssv = new ServerStringValue( at1, "Test" );
+        ClientStringValue ssv = new ClientStringValue( at1, "Test" );
         
-        ServerStringValue ssv1 = ssv.clone();
+        ClientStringValue ssv1 = ssv.clone();
         
         assertEquals( ssv, ssv1 );
         
@@ -503,24 +503,24 @@ public class StringValueAttributeTypeTes
         at.setSyntax( s );
 
         // check that normalization and syntax checks work as expected
-        ServerStringValue value = new ServerStringValue( at, "HIGH" );
+        ClientStringValue value = new ClientStringValue( at, "HIGH" );
         assertEquals( value.get(), value.get() );
         assertTrue( value.isValid() );
-        value = new ServerStringValue( at, "high" );
+        value = new ClientStringValue( at, "high" );
         assertFalse( value.isValid() );
 
         // create a bunch to best tested for equals and in containers
-        ServerStringValue v0 = new ServerStringValue( at, "LOW" );
+        ClientStringValue v0 = new ClientStringValue( at, "LOW" );
         assertTrue( v0.isValid() );
-        ServerStringValue v1 = new ServerStringValue( at, "LOW" );
+        ClientStringValue v1 = new ClientStringValue( at, "LOW" );
         assertTrue( v1.isValid() );
-        ServerStringValue v2 = new ServerStringValue( at, "MEDIUM" );
+        ClientStringValue v2 = new ClientStringValue( at, "MEDIUM" );
         assertTrue( v2.isValid() );
-        ServerStringValue v3 = new ServerStringValue( at, "HIGH" );
+        ClientStringValue v3 = new ClientStringValue( at, "HIGH" );
         assertTrue( v3.isValid() );
-        ServerStringValue v4 = new ServerStringValue( at );
+        ClientStringValue v4 = new ClientStringValue( at );
         assertFalse( v4.isValid() );
-        ServerStringValue v5 = new ServerStringValue( at );
+        ClientStringValue v5 = new ClientStringValue( at );
         assertFalse( v5.isValid() );
 
         // check equals
@@ -538,7 +538,7 @@ public class StringValueAttributeTypeTes
         assertTrue( v3.compareTo( v2 ) > 0 );
 
         // add all except v1 and v5 to a set
-        HashSet<ServerStringValue> set = new HashSet<ServerStringValue>();
+        HashSet<ClientStringValue> set = new HashSet<ClientStringValue>();
         set.add( v0 );
         set.add( v2 );
         set.add( v3 );
@@ -590,17 +590,17 @@ public class StringValueAttributeTypeTes
     @Test public void testAcceptAllNoNormalization()
     {
         // check that normalization and syntax checks work as expected
-        ServerStringValue value = new ServerStringValue( at, "hello" );
+        ClientStringValue value = new ClientStringValue( at, "hello" );
         assertEquals( value.get(), value.get() );
         assertTrue( value.isValid() );
 
         // create a bunch to best tested for equals and in containers
-        ServerStringValue v0 = new ServerStringValue( at, "hello" );
-        ServerStringValue v1 = new ServerStringValue( at, "hello" );
-        ServerStringValue v2 = new ServerStringValue( at, "next0" );
-        ServerStringValue v3 = new ServerStringValue( at, "next1" );
-        ServerStringValue v4 = new ServerStringValue( at );
-        ServerStringValue v5 = new ServerStringValue( at );
+        ClientStringValue v0 = new ClientStringValue( at, "hello" );
+        ClientStringValue v1 = new ClientStringValue( at, "hello" );
+        ClientStringValue v2 = new ClientStringValue( at, "next0" );
+        ClientStringValue v3 = new ClientStringValue( at, "next1" );
+        ClientStringValue v4 = new ClientStringValue( at );
+        ClientStringValue v5 = new ClientStringValue( at );
 
         // check equals
         assertTrue( v0.equals( v1 ) );
@@ -611,7 +611,7 @@ public class StringValueAttributeTypeTes
         assertFalse( v3.equals( v2 ) );
 
         // add all except v1 and v5 to a set
-        HashSet<ServerStringValue> set = new HashSet<ServerStringValue>();
+        HashSet<ClientStringValue> set = new HashSet<ClientStringValue>();
         set.add( v0 );
         set.add( v2 );
         set.add( v3 );
@@ -622,7 +622,7 @@ public class StringValueAttributeTypeTes
         assertTrue( "since v4.equals( v5 ) and v4 was added then this should be true", set.contains( v5 ) );
 
         // check ordering based on the comparator
-        ArrayList<ServerStringValue> list = new ArrayList<ServerStringValue>();
+        ArrayList<ClientStringValue> list = new ArrayList<ClientStringValue>();
         list.add( v1 );
         list.add( v3 );
         list.add( v5 );
@@ -630,9 +630,9 @@ public class StringValueAttributeTypeTes
         list.add( v2 );
         list.add( v4 );
 
-        Comparator<ServerStringValue> c = new Comparator<ServerStringValue>()
+        Comparator<ClientStringValue> c = new Comparator<ClientStringValue>()
         {
-            public int compare( ServerStringValue o1, ServerStringValue o2 )
+            public int compare( ClientStringValue o1, ClientStringValue o2 )
             {
                 String n1 = null;
                 String n2 = null;
@@ -685,7 +685,7 @@ public class StringValueAttributeTypeTes
     @Test public void testNormalizedStringValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
-        ServerStringValue ssv = new ServerStringValue( at, "  Test   Test  " );
+        ClientStringValue ssv = new ClientStringValue( at, "  Test   Test  " );
         
         ssv.normalize();
         String normalized = ssv.getNormalizedValue();
@@ -693,7 +693,7 @@ public class StringValueAttributeTypeTes
         assertEquals( "test test", normalized );
         assertEquals( "  Test   Test  ", ssv.getString() );
         
-        ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+        ClientStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
         assertEquals( ssv, ssvSer );
    }
@@ -705,7 +705,7 @@ public class StringValueAttributeTypeTes
     @Test public void testNoNormalizedStringValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
-        ServerStringValue ssv = new ServerStringValue( at, "test" );
+        ClientStringValue ssv = new ClientStringValue( at, "test" );
         
         ssv.normalize();
         String normalized = ssv.getNormalizedValue();
@@ -713,7 +713,7 @@ public class StringValueAttributeTypeTes
         assertEquals( "test", normalized );
         assertEquals( "test", ssv.getString() );
         
-        ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+        ClientStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
         assertEquals( ssv, ssvSer );
    }
@@ -725,7 +725,7 @@ public class StringValueAttributeTypeTes
     @Test public void testNullStringValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
-        ServerStringValue ssv = new ServerStringValue( at );
+        ClientStringValue ssv = new ClientStringValue( at );
         
         ssv.normalize();
         String normalized = ssv.getNormalizedValue();
@@ -733,7 +733,7 @@ public class StringValueAttributeTypeTes
         assertNull( normalized );
         assertNull( ssv.get() );
         
-        ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+        ClientStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
         assertEquals( ssv, ssvSer );
    }
@@ -745,7 +745,7 @@ public class StringValueAttributeTypeTes
     @Test public void testEmptyStringValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
-        ServerStringValue ssv = new ServerStringValue( at, "" );
+        ClientStringValue ssv = new ClientStringValue( at, "" );
         
         ssv.normalize();
         String normalized = ssv.getNormalizedValue();
@@ -753,7 +753,7 @@ public class StringValueAttributeTypeTes
         assertEquals( "", normalized );
         assertEquals( "", ssv.getString() );
         
-        ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+        ClientStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
         assertEquals( ssv, ssvSer );
     }
@@ -765,11 +765,11 @@ public class StringValueAttributeTypeTes
     @Test public void testStringValueEmptyNormalizedSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
-        ServerStringValue ssv = new ServerStringValue( at, "  " );
+        ClientStringValue ssv = new ClientStringValue( at, "  " );
         
         assertEquals( "  ", ssv.getString() );
         
-        ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+        ClientStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
         assertEquals( ssv, ssvSer );
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java Mon Mar 29 23:25:42 2010
@@ -606,7 +606,7 @@ public class StringValueTest
     @Test
     public void testSerializeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
-        ClientStringValue csv = new ClientStringValue( null );
+        ClientStringValue csv = new ClientStringValue( (String)null );
         csv.setNormalized( true );
         csv.isValid( new Ia5StringSyntaxChecker() );
         csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java Mon Mar 29 23:25:42 2010
@@ -55,7 +55,7 @@ import org.junit.Test;
  */
 public class DefaultClientAttributeTest
 {
-    private static final Value<String> NULL_STRING_VALUE = new ClientStringValue( null );
+    private static final Value<String> NULL_STRING_VALUE = new ClientStringValue( (String)null );
     private static final Value<byte[]> NULL_BINARY_VALUE = new BinaryValue( (byte[])null );
     private static final byte[] BYTES1 = new byte[]{ 'a', 'b' };
     private static final byte[] BYTES2 = new byte[]{ 'b' };
@@ -481,7 +481,7 @@ public class DefaultClientAttributeTest
     {
         EntryAttribute attr1 = new DefaultClientAttribute( "test" );
         
-        int nbAdded = attr1.add( new ClientStringValue( null ) );
+        int nbAdded = attr1.add( new ClientStringValue( (String)null ) );
         assertEquals( 1, nbAdded );
         assertTrue( attr1.isHR() );
         assertEquals( NULL_STRING_VALUE, attr1.get() );
@@ -535,7 +535,7 @@ public class DefaultClientAttributeTest
 
         EntryAttribute attr8 = new DefaultClientAttribute( "test" );
         
-        nbAdded = attr8.add( new ClientStringValue( null ), new BinaryValue( BYTES1 ) );
+        nbAdded = attr8.add( new ClientStringValue( (String)null ), new BinaryValue( BYTES1 ) );
         assertEquals( 2, nbAdded );
         assertTrue( attr8.isHR() );
         assertTrue( attr8.contains( NULL_STRING_VALUE ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java?rev=928938&r1=928937&r2=928938&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java Mon Mar 29 23:25:42 2010
@@ -582,7 +582,7 @@ public class DefaultClientEntryTest
         Value<String> strValue1 = new ClientStringValue( "test1" );
         Value<String> strValue2 = new ClientStringValue( "test2" );
         Value<String> strValue3 = new ClientStringValue( "test3" );
-        Value<String> strNullValue = new ClientStringValue( null);
+        Value<String> strNullValue = new ClientStringValue( (String)null);
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
@@ -942,7 +942,7 @@ public class DefaultClientEntryTest
         Value<String> strValueTop = new ClientStringValue( "top" );
         Value<String> strValuePerson = new ClientStringValue( "person" );
         Value<String> strValueTop2 = new ClientStringValue( "top" );
-        Value<String> strNullValue = new ClientStringValue( null);
+        Value<String> strNullValue = new ClientStringValue( (String)null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
@@ -1138,7 +1138,7 @@ public class DefaultClientEntryTest
         Value<String> strValue1 = new ClientStringValue( "test1" );
         Value<String> strValue2 = new ClientStringValue( "test2" );
         Value<String> strValue3 = new ClientStringValue( "test3" );
-        Value<String> strNullValue = new ClientStringValue( null);
+        Value<String> strNullValue = new ClientStringValue( (String)null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
@@ -1238,7 +1238,7 @@ public class DefaultClientEntryTest
         
         Value<String> strValueTop = new ClientStringValue( "top" );
         Value<String> strValuePerson = new ClientStringValue( "person" );
-        Value<String> strNullValue = new ClientStringValue( null);
+        Value<String> strNullValue = new ClientStringValue( (String)null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );