directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r930141 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/entry/ main/java/org/apache/directory/shared/ldap/entry/client/ test/java/org/apache/directory/shared/ldap/entry/
Date Fri, 02 Apr 2010 00:30:10 GMT
Author: elecharny
Date: Fri Apr  2 00:30:09 2010
New Revision: 930141

URL: http://svn.apache.org/viewvc?rev=930141&view=rev
Log:
o Moved the get() method to the String/BinaryValue classes
o getCopy() has been removed, as it's a duplication of get()
o isSame() is not anymore in the interface
o Removed the set() method
o Fixed the tests accordingly
o Minor other refactorings

Modified:
    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/BinaryValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/StringValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.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/BinaryValueAttributeTypeTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractValue.java?rev=930141&r1=930140&r2=930141&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractValue.java Fri Apr  2 00:30:09 2010
@@ -245,18 +245,6 @@ public abstract class AbstractValue<T> i
 
 
     /**
-     * Gets a copy of the wrapped binary value.
-     * 
-     * @return a copy of the binary value that is wrapped
-     */
-    public T get()
-    {
-        // Just call the specific Client copy method.
-        return getCopy();
-    }
-
-    
-    /**
      * Gets the normalized (canonical) representation for the wrapped value.
      * If the wrapped value is null, null is returned, otherwise the normalized
      * form is returned.  If the normalized Value is null, then the wrapped 
@@ -273,7 +261,7 @@ public abstract class AbstractValue<T> i
 
         if ( normalizedValue == null )
         {
-            return getCopy();
+            return get();
         }
 
         return getNormalizedValueCopy();
@@ -315,9 +303,11 @@ public abstract class AbstractValue<T> i
     
     
     /**
+     * This method is only used for serialization/deserialization
+     * 
      * @return Tells if the wrapped value and the normalized value are the same 
      */
-    public final boolean isSame()
+    /* no qualifier */ final boolean isSame()
     {
         return same;
     }
@@ -390,14 +380,6 @@ public abstract class AbstractValue<T> i
 
 
     /**
-     * Sets this value's wrapped value to a copy of the src array.
-     *
-     * @param wrapped the byte array to use as the wrapped value
-     */
-    public abstract void set( T wrapped );
-
-    
-    /**
      * Tells if the value has already be normalized or not.
      *
      * @return <code>true</code> if the value has already been normalized.

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java?rev=930141&r1=930140&r2=930141&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java Fri Apr  2 00:30:09 2010
@@ -132,48 +132,6 @@ public class BinaryValue extends Abstrac
     }
 
 
-    // -----------------------------------------------------------------------
-    // Value<String> Methods
-    // -----------------------------------------------------------------------
-    /*
-     * Sets the wrapped binary value.  Has the side effect of setting the
-     * normalizedValue and the valid flags to null if the wrapped value is
-     * different than what is already set.  These cached values must be
-     * recomputed to be correct with different values.
-     *
-     * @see ServerValue#set(Object)
-     */
-    public final void set( byte[] value )
-    {
-        // Why should we invalidate the normalized value if it's we're setting the
-        // wrapper to it's current value?
-        if ( wrappedValue != null )
-        {
-            if ( Arrays.equals( value, wrappedValue ) )
-            {
-                return;
-            }
-        }
-
-        normalizedValue = null;
-        normalized = false;
-        valid = null;
-        
-        if ( value == null )
-        {
-            this.wrappedValue = null;
-        }
-        else
-        {
-            this.wrappedValue = new byte[ value.length ];
-            System.arraycopy( value, 0, this.wrappedValue, 0, value.length );
-        }
-    }
-
-
-    // -----------------------------------------------------------------------
-    // ServerValue<String> Methods
-    // -----------------------------------------------------------------------
     /**
      * Gets a direct reference to the normalized representation for the
      * wrapped value of this ServerValue wrapper. Implementations will most
@@ -533,20 +491,18 @@ public class BinaryValue extends Abstrac
 
 
     /**
-     * Gets a copy of the binary value.
-     *
-     * @return a copy of the binary value
+     * {@inheritDoc}
      */
-    public byte[] getCopy()
+    public byte[] get()
     {
         if ( wrappedValue == null )
         {
             return null;
         }
-
         
         final byte[] copy = new byte[ wrappedValue.length ];
         System.arraycopy( wrappedValue, 0, copy, 0, wrappedValue.length );
+        
         return copy;
     }
     
@@ -579,7 +535,7 @@ public class BinaryValue extends Abstrac
      */
     public byte[] getBytes()
     {
-        return getCopy();
+        return get();
     }
     
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/StringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/StringValue.java?rev=930141&r1=930140&r2=930141&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/StringValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/StringValue.java Fri Apr  2 00:30:09 2010
@@ -128,7 +128,7 @@ public class StringValue extends Abstrac
      *
      * @return A copy of the stored value.
      */
-    public String getCopy()
+    public String get()
     {
         // The String is immutable, we can safely return the internal
         // object without copying it.
@@ -137,30 +137,6 @@ public class StringValue extends Abstrac
     
     
     /**
-     * Sets the wrapped String value.  Has the side effect of setting the
-     * normalizedValue and the valid flags to null if the wrapped value is
-     * different than what is already set.  These cached values must be
-     * recomputed to be correct with different values.
-     *
-     * @see ServerValue#set(Object)
-     */
-    public final void set( String value )
-    {
-        // Why should we invalidate the normalized value if it's we're setting the
-        // wrapper to it's current value?
-        if ( !StringTools.isEmpty( value ) && value.equals( getString() ) )
-        {
-            return;
-        }
-
-        normalizedValue = null;
-        normalized = false;
-        valid = null;
-        this.wrappedValue = value;
-    }
-
-
-    /**
      * Gets the normalized (canonical) representation for the wrapped string.
      * If the wrapped String is null, null is returned, otherwise the normalized
      * form is returned.  If the normalizedValue is null, then this method
@@ -667,7 +643,7 @@ public class StringValue extends Abstrac
         // If the value is null, the flag will be set to false
         if ( !in.readBoolean() )
         {
-            set( null );
+            wrappedValue = null;
             normalizedValue = null;
             return;
         }
@@ -675,7 +651,7 @@ public class StringValue extends Abstrac
         // Read the value
         String wrapped = in.readUTF();
         
-        set( wrapped );
+        wrappedValue = wrapped;
         
         // Read the normalized flag
         normalized = in.readBoolean();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java?rev=930141&r1=930140&r2=930141&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java Fri Apr  2 00:30:09 2010
@@ -50,23 +50,9 @@ public interface Value<T> extends Clonea
     
     
     /**
-     * @return Tells if the wrapped value and the normalized value are the same 
-     */
-    boolean isSame();
-
-    
-    /**
-     * Sets the wrapped value.
-     *
-     * @param wrapped the value to set: either a String, URI, or a byte[]
-     */
-    void set( T wrapped );
-    
-
-    /**
-     * Get the wrapped value.
+     * Get the wrapped value. It will return a copy, not a reference.
      *
-     * @return the wrapped value
+     * @return a copy of the wrapped value
      */
     T get();
     
@@ -99,14 +85,6 @@ public interface Value<T> extends Clonea
     
     
     /**
-     * Get a copy of the stored value.
-     *
-     * @return a copy of the stored value.
-     */
-    T getCopy();
-    
-    
-    /**
      * Tells if the value has already be normalized or not.
      *
      * @return <code>true</code> if the value has already been normalized.

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=930141&r1=930140&r2=930141&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 Fri Apr  2 00:30:09 2010
@@ -561,12 +561,11 @@ public class DefaultClientAttribute impl
                     {
                         // The attributeType is binary, convert the
                         // value to a BinaryValue
-                        BinaryValue cbv = new BinaryValue();
-                        cbv.set( val.getBytes() );
+                        BinaryValue bv = new BinaryValue( val.getBytes() );
                         
-                        if ( !contains( cbv ) )
+                        if ( !contains( bv ) )
                         {
-                            values.add( cbv );
+                            values.add( bv );
                             nbAdded++;
                         }
                     }
@@ -603,12 +602,11 @@ public class DefaultClientAttribute impl
                     {
                         // The attribute Type is HR, convert the
                         // value to a StringValue
-                        StringValue csv = new StringValue();
-                        csv.set( val.getString() );
+                        StringValue sv = new StringValue( val.getString() );
                         
-                        if ( !contains( csv ) )
+                        if ( !contains( sv ) )
                         {
-                            values.add( csv );
+                            values.add( sv );
                             nbAdded++;
                         }
                     }

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=930141&r1=930140&r2=930141&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 Fri Apr  2 00:30:09 2010
@@ -261,12 +261,12 @@ public class BinaryValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
         byte[] val = new byte[]{0x01};
-        BinaryValue value = new BinaryValue( attribute );
+        BinaryValue bv = new BinaryValue( attribute );
         
-        value.set( val );
-        assertTrue( Arrays.equals( val, value.getReference() ) );
-        assertFalse( value.isNull() );
-        assertTrue( Arrays.equals( val, value.getCopy() ) );
+        bv = new BinaryValue( val );
+        assertTrue( Arrays.equals( val, bv.getReference() ) );
+        assertFalse( bv.isNull() );
+        assertTrue( Arrays.equals( val, bv.get() ) );
     }
     
     
@@ -281,7 +281,7 @@ public class BinaryValueAttributeTypeTes
         
         assertTrue( Arrays.equals( val, value.getReference() ) );
         assertFalse( value.isNull() );
-        assertTrue( Arrays.equals( val, value.getCopy() ) );
+        assertTrue( Arrays.equals( val, value.get() ) );
     }
     
     
@@ -292,27 +292,26 @@ public class BinaryValueAttributeTypeTes
     public void testClone() throws LdapException
     {
         AttributeType at1 = EntryUtils.getBytesAttributeType();
-        BinaryValue sbv = new BinaryValue( at1, null );
+        BinaryValue bv = new BinaryValue( at1, null );
+        BinaryValue bv1 = bv.clone();
         
-        BinaryValue sbv1 = sbv.clone();
+        assertEquals( bv, bv1 );
         
-        assertEquals( sbv, sbv1 );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
         
-        sbv.set( StringTools.EMPTY_BYTES );
+        assertNotSame( bv, bv1 );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getBytes() ) );
         
-        assertNotSame( sbv, sbv1 );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.getBytes() ) );
+        bv = new BinaryValue( BYTES2 );
+        bv1 = bv.clone();
         
-        sbv.set(  BYTES2 );
-        sbv1 = sbv.clone();
+        assertEquals( bv, bv1 );
         
-        assertEquals( sbv, sbv1 );
-        
-        sbv.normalize();
+        bv.normalize();
         
         // Even if we didn't normalized sbv2, it should be equal to sbv,
         // as if they have the same AT, and the same value, they are equal.
-        assertEquals( sbv, sbv1 );
+        assertEquals( bv, bv1 );
     }
     
 
@@ -470,22 +469,22 @@ public class BinaryValueAttributeTypeTes
     public void testSame() throws LdapException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        BinaryValue sbv = new BinaryValue( attribute );
+        BinaryValue bv = new BinaryValue( attribute );
 
-        sbv.normalize();
-        assertTrue( sbv.isSame() );
+        bv.normalize();
+        assertTrue( bv.isSame() );
         
-        sbv.set( StringTools.EMPTY_BYTES );
-        sbv.normalize();
-        assertTrue( sbv.isSame() );
-
-        sbv.set( BYTES1 );
-        sbv.normalize();
-        assertTrue( sbv.isSame() );
-
-        sbv.set( BYTES2 );
-        sbv.normalize();
-        assertFalse( sbv.isSame() );
+        bv = new BinaryValue( attribute, StringTools.EMPTY_BYTES );
+        bv.normalize();
+        assertTrue( bv.isSame() );
+
+        bv = new BinaryValue( attribute, BYTES1 );
+        bv.normalize();
+        assertTrue( bv.isSame() );
+
+        bv = new BinaryValue( attribute, BYTES2 );
+        bv.normalize();
+        assertFalse( bv.isSame() );
     }
     
     
@@ -513,18 +512,18 @@ public class BinaryValueAttributeTypeTes
     public void testNormalize() throws LdapException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        BinaryValue sbv = new BinaryValue( attribute );
+        BinaryValue bv = new BinaryValue( attribute );
 
-        sbv.normalize();
-        assertEquals( null, sbv.getNormalizedValue() );
+        bv.normalize();
+        assertEquals( null, bv.getNormalizedValue() );
         
-        sbv.set( StringTools.EMPTY_BYTES );
-        sbv.normalize();
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.getNormalizedValue() ) );
-
-        sbv.set( BYTES2 );
-        sbv.normalize();
-        assertTrue( Arrays.equals( BYTES1, sbv.getNormalizedValue() ) );
+        bv = new BinaryValue( attribute, StringTools.EMPTY_BYTES );
+        bv.normalize();
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getNormalizedValue() ) );
+
+        bv = new BinaryValue( attribute, BYTES2 );
+        bv.normalize();
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
     }
     
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java?rev=930141&r1=930140&r2=930141&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java Fri Apr  2 00:30:09 2010
@@ -200,16 +200,16 @@ public class BinaryValueTest
     @Test
     public void testHashCode()
     {
-        BinaryValue cbv = new BinaryValue();
-        assertEquals( 0, cbv.hashCode() );
+        BinaryValue bv = new BinaryValue();
+        assertEquals( 0, bv.hashCode() );
         
-        cbv.set( StringTools.EMPTY_BYTES );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
         int h = Arrays.hashCode( StringTools.EMPTY_BYTES );
-        assertEquals( h, cbv.hashCode() );
+        assertEquals( h, bv.hashCode() );
         
         h = Arrays.hashCode( BYTES1 );
-        cbv.set( BYTES1 );
-        assertEquals( h, cbv.hashCode() );
+        bv = new BinaryValue( BYTES1 );
+        assertEquals( h, bv.hashCode() );
     }
 
 
@@ -232,7 +232,7 @@ public class BinaryValueTest
         BinaryValue cbv = new BinaryValue( StringTools.EMPTY_BYTES );
         
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getCopy() ) );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.get() ) );
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getReference() ) );
         assertFalse( cbv.isNormalized() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
@@ -249,7 +249,7 @@ public class BinaryValueTest
         BinaryValue cbv = new BinaryValue( BYTES1 );
         
         assertTrue( Arrays.equals( BYTES1, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( BYTES1, cbv.getCopy() ) );
+        assertTrue( Arrays.equals( BYTES1, cbv.get() ) );
         assertTrue( Arrays.equals( BYTES1, cbv.getReference() ) );
         assertFalse( cbv.isNormalized() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
@@ -262,18 +262,18 @@ public class BinaryValueTest
     @Test
     public void testSetByteArray() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        cbv.set( BYTES1 );
+        bv = new BinaryValue( BYTES1 );
         
-        assertTrue( Arrays.equals( BYTES1, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( BYTES1, cbv.getCopy() ) );
-        assertTrue( Arrays.equals( BYTES1, cbv.getReference() ) );
-        assertFalse( cbv.isNormalized() );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
-        assertFalse( cbv.isNull() );
-        assertNotNull( cbv.getNormalizedValue() );
-        assertTrue( Arrays.equals( BYTES1, cbv.getNormalizedValue() ) );
+        assertTrue( Arrays.equals( BYTES1, bv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES1, bv.get() ) );
+        assertTrue( Arrays.equals( BYTES1, bv.getReference() ) );
+        assertFalse( bv.isNormalized() );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
+        assertFalse( bv.isNull() );
+        assertNotNull( bv.getNormalizedValue() );
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
     }
 
 
@@ -283,7 +283,7 @@ public class BinaryValueTest
         BinaryValue cbv = new BinaryValue( BYTES2 );
         
         assertTrue( Arrays.equals( BYTES2, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( BYTES2, cbv.getCopy() ) );
+        assertTrue( Arrays.equals( BYTES2, cbv.get() ) );
         assertTrue( Arrays.equals( BYTES2, cbv.getReference() ) );
         assertFalse( cbv.isNormalized() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
@@ -302,93 +302,93 @@ public class BinaryValueTest
     @Test
     public void testNormalizeNormalizer() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        cbv.normalize( BINARY_NORMALIZER );
-        assertTrue( cbv.isNormalized() );
-        assertEquals( null, cbv.getNormalizedValue() );
-        
-        cbv.set( StringTools.EMPTY_BYTES );
-        cbv.normalize( BINARY_NORMALIZER );
-        assertTrue( cbv.isNormalized() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getNormalizedValue() ) );
-        
-        cbv.set( BYTES1 );
-        cbv.normalize( BINARY_NORMALIZER );
-        assertTrue( cbv.isNormalized() );
-        assertTrue( Arrays.equals( BYTES1, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( BYTES1, cbv.getNormalizedValue() ) );
-
-        cbv.set( BYTES2 );
-        cbv.normalize( BINARY_NORMALIZER );
-        assertTrue( cbv.isNormalized() );
-        assertTrue( Arrays.equals( BYTES2, cbv.getBytes() ) );
-        assertTrue( Arrays.equals( BYTES1, cbv.getNormalizedValue() ) );
+        bv.normalize( BINARY_NORMALIZER );
+        assertTrue( bv.isNormalized() );
+        assertEquals( null, bv.getNormalizedValue() );
+        
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        bv.normalize( BINARY_NORMALIZER );
+        assertTrue( bv.isNormalized() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getBytes() ) );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getNormalizedValue() ) );
+        
+        bv = new BinaryValue( BYTES1 );
+        bv.normalize( BINARY_NORMALIZER );
+        assertTrue( bv.isNormalized() );
+        assertTrue( Arrays.equals( BYTES1, bv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
+
+        bv = new BinaryValue( BYTES2 );
+        bv.normalize( BINARY_NORMALIZER );
+        assertTrue( bv.isNormalized() );
+        assertTrue( Arrays.equals( BYTES2, bv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
     }
 
 
     @Test
     public void testCompareToValueOfbyte() throws LdapException
     {
-        BinaryValue cbv1 = new BinaryValue();
-        BinaryValue cbv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue();
+        BinaryValue bv2 = new BinaryValue();
         
-        assertEquals( 0, cbv1.compareTo( cbv2 ) );
+        assertEquals( 0, bv1.compareTo( bv2 ) );
         
-        cbv1.set(  BYTES1 );
-        assertEquals( 1, cbv1.compareTo( cbv2 ) );
+        bv1 = new BinaryValue( BYTES1 );
+        assertEquals( 1, bv1.compareTo( bv2 ) );
 
-        cbv2.set(  BYTES2 );
-        assertEquals( 1, cbv1.compareTo( cbv2 ) );
+        bv2 = new BinaryValue( BYTES2 );
+        assertEquals( 1, bv1.compareTo( bv2 ) );
         
-        cbv2.normalize( BINARY_NORMALIZER );
-        assertEquals( 0, cbv1.compareTo( cbv2 ) );
+        bv2.normalize( BINARY_NORMALIZER );
+        assertEquals( 0, bv1.compareTo( bv2 ) );
         
-        cbv1.set( BYTES2 );
-        assertEquals( -1, cbv1.compareTo( cbv2 ) );
+        bv1 = new BinaryValue( BYTES2 );
+        assertEquals( -1, bv1.compareTo( bv2 ) );
     }
 
 
     @Test
     public void testEquals() throws LdapException
     {
-        BinaryValue cbv1 = new BinaryValue();
-        BinaryValue cbv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue();
+        BinaryValue bv2 = new BinaryValue();
         
-        assertEquals( cbv1, cbv2 );
+        assertEquals( bv1, bv2 );
         
-        cbv1.set(  BYTES1 );
-        assertNotSame( cbv1, cbv2 );
+        bv1 = new BinaryValue( BYTES1 );
+        assertNotSame( bv1, bv2 );
 
-        cbv2.set(  BYTES2 );
-        assertNotSame( cbv1, cbv2 );
+        bv2 = new BinaryValue( BYTES2 );
+        assertNotSame( bv1, bv2 );
         
-        cbv2.normalize( BINARY_NORMALIZER );
-        assertEquals( cbv1, cbv2 );
+        bv2.normalize( BINARY_NORMALIZER );
+        assertEquals( bv1, bv2 );
         
-        cbv1.set( BYTES2 );
-        assertNotSame( cbv1, cbv2 );
+        bv1 = new BinaryValue( BYTES2 );
+        assertNotSame( bv1, bv2 );
     }
 
 
     @Test
     public void testClone()
     {
-        BinaryValue cbv = new BinaryValue();
-        BinaryValue copy = cbv.clone();
+        BinaryValue bv = new BinaryValue();
+        BinaryValue copy = bv.clone();
         
-        assertEquals( cbv, copy );
+        assertEquals( bv, copy );
         
-        cbv.set( BYTES1 );
-        assertNotSame( cbv, copy );
+        bv = new BinaryValue( BYTES1 );
+        assertNotSame( bv, copy );
         
-        copy = cbv.clone();
-        assertEquals( cbv, copy );
+        copy = bv.clone();
+        assertEquals( bv, copy );
 
-        cbv.getReference()[0] = 0x11;
+        bv.getReference()[0] = 0x11;
         
-        assertTrue( Arrays.equals( BYTES_MOD, cbv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
         assertTrue( Arrays.equals( BYTES1, copy.getBytes() ) );
     }
 
@@ -396,132 +396,132 @@ public class BinaryValueTest
     @Test
     public void testGetCopy()
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertNull( cbv.getCopy() );
+        assertNull( bv.get() );
         
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertNotNull( cbv.getCopy() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getCopy() ) );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertNotNull( bv.get() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.get() ) );
         
-        cbv.set( BYTES1 );
-        byte[] copy = cbv.getCopy();
+        bv = new BinaryValue( BYTES1 );
+        byte[] copy = bv.get();
         
         assertTrue( Arrays.equals( BYTES1, copy ) );
 
-        cbv.getReference()[0] = 0x11;
+        bv.getReference()[0] = 0x11;
         assertTrue( Arrays.equals( BYTES1, copy ) );
-        assertTrue( Arrays.equals( BYTES_MOD, cbv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
     }
 
 
     @Test
     public void testCompareTo() throws LdapException
     {
-        BinaryValue cbv1 = new BinaryValue();
-        BinaryValue cbv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue();
+        BinaryValue bv2 = new BinaryValue();
         
-        assertEquals( 0, cbv1.compareTo( cbv2 ) );
+        assertEquals( 0, bv1.compareTo( bv2 ) );
         
-        cbv1.set( BYTES1 );
-        assertEquals( 1, cbv1.compareTo( cbv2 ) );
-        assertEquals( -1, cbv2.compareTo( cbv1 ) );
+        bv1 = new BinaryValue( BYTES1 );
+        assertEquals( 1, bv1.compareTo( bv2 ) );
+        assertEquals( -1, bv2.compareTo( bv1 ) );
         
-        cbv2.set( BYTES1 );
-        assertEquals( 0, cbv1.compareTo( cbv2 ) );
+        bv2 = new BinaryValue( BYTES1 );
+        assertEquals( 0, bv1.compareTo( bv2 ) );
 
         // Now check that the equals method works on normalized values.
-        cbv1.set( BYTES2 );
-        cbv2.set( BYTES1 );
-        cbv1.normalize( BINARY_NORMALIZER );
-        assertEquals( 0, cbv1.compareTo( cbv2 ) );
-        
-        cbv1.set( BYTES1 );
-        cbv2.set( BYTES2 );
-        assertEquals( 1, cbv1.compareTo( cbv2 ) );
-
-        cbv1.set( BYTES2 );
-        cbv2.set( BYTES1 );
-        assertEquals( -1, cbv1.compareTo( cbv2 ) );
+        bv1 = new BinaryValue( BYTES2 );
+        bv2 = new BinaryValue( BYTES1 );
+        bv1.normalize( BINARY_NORMALIZER );
+        assertEquals( 0, bv1.compareTo( bv2 ) );
+        
+        bv1 = new BinaryValue( BYTES1 );
+        bv2 = new BinaryValue( BYTES2 );
+        assertEquals( 1, bv1.compareTo( bv2 ) );
+
+        bv1 = new BinaryValue( BYTES2 );
+        bv2 = new BinaryValue( BYTES1 );
+        assertEquals( -1, bv1.compareTo( bv2 ) );
     }
 
 
     @Test
     public void testToString()
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertEquals( "null", cbv.toString() );
+        assertEquals( "null", bv.toString() );
 
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertEquals( "''", cbv.toString() );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertEquals( "''", bv.toString() );
 
-        cbv.set( BYTES1 );
-        assertEquals( "'0x01 0x02 0x03 0x04 '", cbv.toString() );
+        bv = new BinaryValue( BYTES1 );
+        assertEquals( "'0x01 0x02 0x03 0x04 '", bv.toString() );
     }
 
 
     @Test
     public void testGetReference()
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertNull( cbv.getReference() );
+        assertNull( bv.getReference() );
         
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertNotNull( cbv.getReference() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getReference() ) );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertNotNull( bv.getReference() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getReference() ) );
         
-        cbv.set( BYTES1 );
-        byte[] reference = cbv.getReference();
+        bv = new BinaryValue( BYTES1 );
+        byte[] reference = bv.getReference();
         
         assertTrue( Arrays.equals( BYTES1, reference ) );
 
-        cbv.getReference()[0] = 0x11;
+        bv.getReference()[0] = 0x11;
         assertTrue( Arrays.equals( BYTES_MOD, reference ) );
-        assertTrue( Arrays.equals( BYTES_MOD, cbv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
     }
 
 
     @Test
     public void testGet()
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertNull( cbv.get() );
+        assertNull( bv.get() );
         
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertNotNull( cbv.get() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getBytes() ) );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertNotNull( bv.get() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getBytes() ) );
         
-        cbv.set( BYTES1 );
-        byte[] get = cbv.getBytes();
+        bv = new BinaryValue( BYTES1 );
+        byte[] get = bv.getBytes();
         
         assertTrue( Arrays.equals( BYTES1, get ) );
 
-        cbv.getReference()[0] = 0x11;
+        bv.getReference()[0] = 0x11;
         assertTrue( Arrays.equals( BYTES1, get ) );
-        assertTrue( Arrays.equals( BYTES_MOD, cbv.getBytes() ) );
+        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
     }
 
 
     @Test
     public void testGetNormalizedValue() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertFalse( cbv.isNormalized() );
+        assertFalse( bv.isNormalized() );
 
-        cbv.normalize( BINARY_NORMALIZER );
-        byte[] value = cbv.getNormalizedValue();
+        bv.normalize( BINARY_NORMALIZER );
+        byte[] value = bv.getNormalizedValue();
         assertNull( value );
-        assertTrue( cbv.isNormalized() );
+        assertTrue( bv.isNormalized() );
         
-        cbv.set( BYTES2 );
-        cbv.normalize( BINARY_NORMALIZER );
-        value = cbv.getNormalizedValue();
+        bv = new BinaryValue( BYTES2 );
+        bv.normalize( BINARY_NORMALIZER );
+        value = bv.getNormalizedValue();
         assertTrue( Arrays.equals( BYTES1, value ) );
-        cbv.getNormalizedValueReference()[0]=0x11;
+        bv.getNormalizedValueReference()[0]=0x11;
         assertFalse( Arrays.equals( BYTES_MOD, value ) );
     }
 
@@ -529,20 +529,20 @@ public class BinaryValueTest
     @Test
     public void testGetNormalizedValueReference() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertFalse( cbv.isNormalized() );
+        assertFalse( bv.isNormalized() );
 
-        cbv.normalize( BINARY_NORMALIZER );
-        byte[] value = cbv.getNormalizedValueReference();
+        bv.normalize( BINARY_NORMALIZER );
+        byte[] value = bv.getNormalizedValueReference();
         assertNull( value );
-        assertTrue( cbv.isNormalized() );
+        assertTrue( bv.isNormalized() );
         
-        cbv.set( BYTES2 );
-        cbv.normalize( BINARY_NORMALIZER );
-        value = cbv.getNormalizedValueReference();
+        bv = new BinaryValue( BYTES2 );
+        bv.normalize( BINARY_NORMALIZER );
+        value = bv.getNormalizedValueReference();
         assertTrue( Arrays.equals( BYTES1, value ) );
-        cbv.getNormalizedValueReference()[0]=0x11;
+        bv.getNormalizedValueReference()[0]=0x11;
         assertTrue( Arrays.equals( BYTES_MOD, value ) );
     }
 
@@ -550,156 +550,154 @@ public class BinaryValueTest
     @Test
     public void testIsNull()
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertTrue( cbv.isNull() );
+        assertTrue( bv.isNull() );
         
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertFalse( cbv.isNull() );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertFalse( bv.isNull() );
         
-        cbv.set( BYTES1 );
-        assertFalse( cbv.isNull() );
+        bv = new BinaryValue( BYTES1 );
+        assertFalse( bv.isNull() );
     }
 
 
     @Test
     public void testIsValid() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertFalse( cbv.isValid() );
-        cbv.isValid( BINARY_CHECKER );
-        assertTrue( cbv.isValid() );
-        
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertFalse( cbv.isValid() );
-        cbv.isValid( BINARY_CHECKER );
-        assertTrue( cbv.isValid() );
-        
-        cbv.set( BYTES1 );
-        assertFalse( cbv.isNull() );
-        cbv.isValid( BINARY_CHECKER );
-        assertTrue( cbv.isValid() );
-
-        cbv.set( INVALID_BYTES );
-        assertFalse( cbv.isNull() );
-        cbv.isValid( BINARY_CHECKER );
-        assertFalse( cbv.isValid() );
+        assertFalse( bv.isValid() );
+        bv.isValid( BINARY_CHECKER );
+        assertTrue( bv.isValid() );
+        
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertFalse( bv.isValid() );
+        bv.isValid( BINARY_CHECKER );
+        assertTrue( bv.isValid() );
+        
+        bv = new BinaryValue( BYTES1 );
+        assertFalse( bv.isNull() );
+        bv.isValid( BINARY_CHECKER );
+        assertTrue( bv.isValid() );
+
+        bv = new BinaryValue( INVALID_BYTES );
+        assertFalse( bv.isNull() );
+        bv.isValid( BINARY_CHECKER );
+        assertFalse( bv.isValid() );
     }
 
 
     @Test
     public void testIsValidSyntaxChecker() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertTrue( cbv.isValid( BINARY_CHECKER ) ) ;
+        assertTrue( bv.isValid( BINARY_CHECKER ) ) ;
         
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
         
-        cbv.set( BYTES1 );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
+        bv = new BinaryValue( BYTES1 );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
 
-        cbv.set( INVALID_BYTES );
-        assertFalse( cbv.isValid( BINARY_CHECKER ) );
+        bv = new BinaryValue( INVALID_BYTES );
+        assertFalse( bv.isValid( BINARY_CHECKER ) );
     }
 
 
     @Test
     public void testNormalize() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        cbv.normalize();
-        assertTrue( cbv.isNormalized() );
-        assertEquals( null, cbv.getNormalizedValue() );
-        
-        cbv.set( StringTools.EMPTY_BYTES );
-        cbv.normalize();
-        assertTrue( cbv.isNormalized() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getNormalizedValue() ) );
-        
-        cbv.set( BYTES2 );
-        cbv.normalize();
-        assertTrue( cbv.isNormalized() );
-        assertTrue( Arrays.equals( BYTES2, cbv.getNormalizedValue() ) );
+        bv.normalize();
+        assertTrue( bv.isNormalized() );
+        assertEquals( null, bv.getNormalizedValue() );
+        
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        bv.normalize();
+        assertTrue( bv.isNormalized() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getNormalizedValue() ) );
+        
+        bv = new BinaryValue( BYTES2 );
+        bv.normalize();
+        assertTrue( bv.isNormalized() );
+        assertTrue( Arrays.equals( BYTES2, bv.getNormalizedValue() ) );
     }
 
 
     @Test
     public void testSet() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
-        cbv.set( null );
-        assertNull( cbv.get() );
-        assertFalse( cbv.isNormalized() );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
-        assertTrue( cbv.isNull() );
-
-        cbv.set( StringTools.EMPTY_BYTES );
-        assertNotNull( cbv.get() );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, cbv.getBytes() ) );
-        assertFalse( cbv.isNormalized() );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
-        assertFalse( cbv.isNull() );
-
-        cbv.set( BYTES1 );
-        assertNotNull( cbv.get() );
-        assertTrue( Arrays.equals( BYTES1, cbv.getBytes() ) );
-        assertFalse( cbv.isNormalized() );
-        assertTrue( cbv.isValid( BINARY_CHECKER ) );
-        assertFalse( cbv.isNull() );
+        assertNull( bv.get() );
+        assertFalse( bv.isNormalized() );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
+        assertTrue( bv.isNull() );
+
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        assertNotNull( bv.get() );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, bv.getBytes() ) );
+        assertFalse( bv.isNormalized() );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
+        assertFalse( bv.isNull() );
+
+        bv = new BinaryValue( BYTES1 );
+        assertNotNull( bv.get() );
+        assertTrue( Arrays.equals( BYTES1, bv.getBytes() ) );
+        assertFalse( bv.isNormalized() );
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
+        assertFalse( bv.isNull() );
     }
 
 
     @Test
     public void testIsNormalized() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
+        assertFalse( bv.isNormalized() );
         
-        assertFalse( cbv.isNormalized() );
+        bv = new BinaryValue( BYTES2 );
+        assertFalse( bv.isNormalized() );
         
-        cbv.set( BYTES2 );
-        assertFalse( cbv.isNormalized() );
+        bv.normalize( BINARY_NORMALIZER );
         
-        cbv.normalize( BINARY_NORMALIZER );
-        
-        assertTrue( Arrays.equals( BYTES1, cbv.getNormalizedValue() ) );
-        assertTrue( cbv.isNormalized() );
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
+        assertTrue( bv.isNormalized() );
         
-        cbv.set( BYTES2 );
-        assertTrue( cbv.isNormalized() );
+        bv = new BinaryValue( BYTES2 );
+        assertFalse( bv.isNormalized() );
 
-        cbv.set( BYTES_MOD );
-        assertFalse( cbv.isNormalized() );
+        bv = new BinaryValue( BYTES_MOD );
+        assertFalse( bv.isNormalized() );
     }
 
 
     @Test
     public void testSetNormalized() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue();
+        BinaryValue bv = new BinaryValue();
         
-        assertFalse( cbv.isNormalized() );
+        assertFalse( bv.isNormalized() );
         
-        cbv.setNormalized( true );
-        assertTrue( cbv.isNormalized() );
+        bv.setNormalized( true );
+        assertTrue( bv.isNormalized() );
         
-        cbv.set( BYTES2 );
-        assertFalse( cbv.isNormalized() );
+        bv = new BinaryValue( BYTES2 );
+        assertFalse( bv.isNormalized() );
         
-        cbv.normalize( BINARY_NORMALIZER );
+        bv.normalize( BINARY_NORMALIZER );
         
-        assertTrue( Arrays.equals( BYTES1, cbv.getNormalizedValue() ) );
-        assertTrue( cbv.isNormalized() );
+        assertTrue( Arrays.equals( BYTES1, bv.getNormalizedValue() ) );
+        assertTrue( bv.isNormalized() );
         
-        cbv.setNormalized( false );
-        assertTrue( Arrays.equals( BYTES2, cbv.getNormalizedValue() ) );
-        assertTrue( cbv.isNormalized() );
+        bv.setNormalized( false );
+        assertTrue( Arrays.equals( BYTES2, bv.getNormalizedValue() ) );
+        assertTrue( bv.isNormalized() );
 
-        cbv.normalize( BINARY_NORMALIZER );
+        bv.normalize( BINARY_NORMALIZER );
     }
     
     
@@ -709,16 +707,16 @@ public class BinaryValueTest
     @Test
     public void testSerializeStandard() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( true );
-        cbv.set( BYTES2 );
-        cbv.normalize( BINARY_NORMALIZER );
-        cbv.isValid( BINARY_CHECKER );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( true );
+        bv = new BinaryValue( BYTES2 );
+        bv.normalize( BINARY_NORMALIZER );
+        bv.isValid( BINARY_CHECKER );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }
@@ -730,15 +728,15 @@ public class BinaryValueTest
     @Test
     public void testSerializeNotNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( false );
-        cbv.set( BYTES2 );
-        cbv.isValid( BINARY_CHECKER );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( false );
+        bv = new BinaryValue( BYTES2 );
+        bv.isValid( BINARY_CHECKER );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }
@@ -750,16 +748,16 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( true );
-        cbv.set( BYTES2 );
-        cbv.isValid( BINARY_CHECKER );
-        cbv.normalize( BINARY_NORMALIZER_EMPTY );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( true );
+        bv = new BinaryValue( BYTES2 );
+        bv.isValid( BINARY_CHECKER );
+        bv.normalize( BINARY_NORMALIZER_EMPTY );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }
@@ -771,16 +769,16 @@ public class BinaryValueTest
     @Test
     public void testSerializeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( true );
-        cbv.set( null );
-        cbv.isValid( BINARY_CHECKER );
-        cbv.normalize( BINARY_NORMALIZER );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( true );
+        bv = new BinaryValue( (byte[])null );
+        bv.isValid( BINARY_CHECKER );
+        bv.normalize( BINARY_NORMALIZER );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }
@@ -792,16 +790,16 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( true );
-        cbv.set( StringTools.EMPTY_BYTES );
-        cbv.isValid( BINARY_CHECKER );
-        cbv.normalize( BINARY_NORMALIZER );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( true );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        bv.isValid( BINARY_CHECKER );
+        bv.normalize( BINARY_NORMALIZER );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }
@@ -813,15 +811,15 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyValueNotNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue cbv = new BinaryValue();
-        cbv.setNormalized( false );
-        cbv.set( StringTools.EMPTY_BYTES );
-        cbv.isValid( BINARY_CHECKER );
-
-        BinaryValue cbvSer = deserializeValue( serializeValue( cbv ) );
-         assertNotSame( cbv, cbvSer );
-         assertTrue( Arrays.equals( cbv.getReference(), cbvSer.getReference() ) );
-         assertTrue( Arrays.equals( cbv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
+        BinaryValue bv = new BinaryValue();
+        bv.setNormalized( false );
+        bv = new BinaryValue( StringTools.EMPTY_BYTES );
+        bv.isValid( BINARY_CHECKER );
+
+        BinaryValue cbvSer = deserializeValue( serializeValue( bv ) );
+         assertNotSame( bv, cbvSer );
+         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
+         assertTrue( Arrays.equals( bv.getNormalizedValueReference(), cbvSer.getNormalizedValueReference() ) );
          assertTrue( cbvSer.isNormalized() );
          assertFalse( cbvSer.isValid() );
     }

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=930141&r1=930140&r2=930141&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 Fri Apr  2 00:30:09 2010
@@ -189,21 +189,21 @@ public class StringValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
-        StringValue value = new StringValue( attribute, null );
+        StringValue sv = new StringValue( attribute, null );
         
-        assertFalse( value.isNormalized() );
-        assertNull( value.getNormalizedValue() );
-        assertTrue( value.isNormalized() );
-
-        value.set( "" );
-        assertFalse( value.isNormalized() );
-        assertEquals( "", value.getNormalizedValue() );
-        assertTrue( value.isNormalized() );
-
-        value.set( "TEST" );
-        assertFalse( value.isNormalized() );
-        assertEquals( "test", value.getNormalizedValue() );
-        assertTrue( value.isNormalized() );
+        assertFalse( sv.isNormalized() );
+        assertNull( sv.getNormalizedValue() );
+        assertTrue( sv.isNormalized() );
+
+        sv = new StringValue( attribute, "" );
+        assertFalse( sv.isNormalized() );
+        assertEquals( "", sv.getNormalizedValue() );
+        assertTrue( sv.isNormalized() );
+
+        sv = new StringValue( attribute, "TEST" );
+        assertFalse( sv.isNormalized() );
+        assertEquals( "test", sv.getNormalizedValue() );
+        assertTrue( sv.isNormalized() );
     }
     
 
@@ -216,17 +216,17 @@ public class StringValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
-        StringValue value = new StringValue( attribute, null );
-        assertTrue( value.isValid() );
+        StringValue sv = new StringValue( attribute, null );
+        assertTrue( sv.isValid() );
 
-        value.set( "" );
-        assertTrue( value.isValid() );
+        sv = new StringValue( attribute, "" );
+        assertTrue( sv.isValid() );
 
-        value.set( "TEST" );
-        assertTrue( value.isValid() );
+        sv = new StringValue( attribute, "TEST" );
+        assertTrue( sv.isValid() );
 
-        value.set( "testlong" );
-        assertFalse( value.isValid() );
+        sv = new StringValue( attribute, "testlong" );
+        assertFalse( sv.isValid() );
     }
     
     
@@ -237,18 +237,18 @@ public class StringValueAttributeTypeTes
     public void testNormalize() throws LdapException
     {
         AttributeType attribute = EntryUtils.getIA5StringAttributeType();
-        StringValue ssv = new StringValue( attribute );
+        StringValue sv = new StringValue( attribute );
 
-        ssv.normalize();
-        assertEquals( null, ssv.getNormalizedValue() );
+        sv.normalize();
+        assertEquals( null, sv.getNormalizedValue() );
         
-        ssv.set( "" );
-        ssv.normalize();
-        assertEquals( "", ssv.getNormalizedValue() );
+        sv = new StringValue( attribute, "" );
+        sv.normalize();
+        assertEquals( "", sv.getNormalizedValue() );
 
-        ssv.set(  "  This is    a   TEST  " );
-        ssv.normalize();
-        assertEquals( "this is a test", ssv.getNormalizedValue() );
+        sv = new StringValue( attribute, "  This is    a   TEST  " );
+        sv.normalize();
+        assertEquals( "this is a test", sv.getNormalizedValue() );
     }
     
 
@@ -416,12 +416,12 @@ public class StringValueAttributeTypeTes
         
         assertEquals( sv, sv1 );
         
-        sv.set( "" );
+        sv = new StringValue( "" );
         
         assertNotSame( sv, sv1 );
         assertEquals( "", sv.getString() );
         
-        sv.set(  "  This is    a   TEST  " );
+        sv = new StringValue( "  This is    a   TEST  " );
         sv1 = sv.clone();
         
         assertEquals( sv, sv1 );

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=930141&r1=930140&r2=930141&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 Fri Apr  2 00:30:09 2010
@@ -32,11 +32,8 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
 import org.apache.directory.shared.ldap.exception.LdapException;
-import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.Ia5StringSyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -140,11 +137,11 @@ public class StringValueTest
         
         assertEquals( sv, sv1 );
         
-        sv.set( "" );
+        StringValue sv2 = new StringValue( "" );
         
-        assertNotSame( sv, sv1 );
+        assertNotSame( sv2, sv1 );
         assertNull( sv1.get() );
-        assertEquals( "", sv.getString() );
+        assertEquals( "", sv2.getString() );
     }
 
 
@@ -247,12 +244,11 @@ public class StringValueTest
     @Test
     public void testGet()
     {
-        StringValue csv = new StringValue( "test" );
+        StringValue sv = new StringValue( "test" );
+        assertEquals( "test", sv.get() );
         
-        assertEquals( "test", csv.get() );
-        
-        csv.set( "" );
-        assertEquals( "", csv.get() );
+        StringValue sv2 = new StringValue( "" );
+        assertEquals( "", sv2.get() );
     }
 
 
@@ -262,12 +258,12 @@ public class StringValueTest
     @Test
     public void testGetCopy()
     {
-        StringValue csv = new StringValue( "test" );
+        StringValue sv = new StringValue( "test" );
         
-        assertEquals( "test", csv.getCopy() );
+        assertEquals( "test", sv.get() );
         
-        csv.set( "" );
-        assertEquals( "", csv.getCopy() );
+        StringValue sv2 = new StringValue( "" );
+        assertEquals( "", sv2.get() );
     }
 
 
@@ -277,27 +273,26 @@ public class StringValueTest
     @Test
     public void testSet() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
-        csv.set( null );
-        assertNull( csv.get() );
-        assertFalse( csv.isNormalized() );
-        assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
-        assertTrue( csv.isNull() );
-
-        csv.set( "" );
-        assertNotNull( csv.get() );
-        assertEquals( "", csv.get() );
-        assertFalse( csv.isNormalized() );
-        assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
-        assertFalse( csv.isNull() );
-
-        csv.set( "Test" );
-        assertNotNull( csv.get() );
-        assertEquals( "Test", csv.get() );
-        assertFalse( csv.isNormalized() );
-        assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
-        assertFalse( csv.isNull() );
+        assertNull( sv.get() );
+        assertFalse( sv.isNormalized() );
+        assertTrue( sv.isValid( new Ia5StringSyntaxChecker() ) );
+        assertTrue( sv.isNull() );
+
+        sv = new StringValue( "" );
+        assertNotNull( sv.get() );
+        assertEquals( "", sv.get() );
+        assertFalse( sv.isNormalized() );
+        assertTrue( sv.isValid( new Ia5StringSyntaxChecker() ) );
+        assertFalse( sv.isNull() );
+
+        sv = new StringValue( "Test" );
+        assertNotNull( sv.get() );
+        assertEquals( "Test", sv.get() );
+        assertFalse( sv.isNormalized() );
+        assertTrue( sv.isValid( new Ia5StringSyntaxChecker() ) );
+        assertFalse( sv.isNull() );
     }
 
 
@@ -307,13 +302,11 @@ public class StringValueTest
     @Test
     public void testIsNull()
     {
-        StringValue csv = new StringValue();
-        
-        csv.set( null );
-        assertTrue( csv.isNull() );
+        StringValue sv = new StringValue( (String)null );
+        assertTrue( sv.isNull() );
         
-        csv.set( "test" );
-        assertFalse( csv.isNull() );
+        sv = new StringValue( "test" );
+        assertFalse( sv.isNull() );
     }
 
     
@@ -323,20 +316,17 @@ public class StringValueTest
     @Test
     public void testIsNormalized() throws LdapException
     {
-        StringValue csv = new StringValue();
-        
-        assertFalse( csv.isNormalized() );
+        StringValue sv = new StringValue( "  This is    a   TEST  " );
         
-        csv.set(  "  This is    a   TEST  " );
-        assertFalse( csv.isNormalized() );
+        assertFalse( sv.isNormalized() );
         
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
         
-        assertEquals( "this is a test", csv.getNormalizedValue() );
-        assertTrue( csv.isNormalized() );
+        assertEquals( "this is a test", sv.getNormalizedValue() );
+        assertTrue( sv.isNormalized() );
         
-        csv.set( "test" );
-        assertFalse( csv.isNormalized() );
+        sv = new StringValue( "test" );
+        assertFalse( sv.isNormalized() );
     }
 
 
@@ -346,26 +336,26 @@ public class StringValueTest
     @Test
     public void testSetNormalized() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue();
         
-        assertFalse( csv.isNormalized() );
+        assertFalse( sv.isNormalized() );
         
-        csv.setNormalized( true );
-        assertTrue( csv.isNormalized() );
+        sv.setNormalized( true );
+        assertTrue( sv.isNormalized() );
         
-        csv.set(  "  This is    a   TEST  " );
-        assertFalse( csv.isNormalized() );
+        sv = new StringValue( "  This is    a   TEST  " );
+        assertFalse( sv.isNormalized() );
         
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
         
-        assertEquals( "this is a test", csv.getNormalizedValue() );
-        assertTrue( csv.isNormalized() );
+        assertEquals( "this is a test", sv.getNormalizedValue() );
+        assertTrue( sv.isNormalized() );
         
-        csv.setNormalized( false );
-        assertEquals( "this is a test", csv.getNormalizedValue() );
-        assertFalse( csv.isNormalized() );
+        sv.setNormalized( false );
+        assertEquals( "this is a test", sv.getNormalizedValue() );
+        assertFalse( sv.isNormalized() );
 
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
     }
 
 
@@ -375,16 +365,16 @@ public class StringValueTest
     @Test
     public void testGetNormalizedValue() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue();
         
-        assertEquals( null, csv.getNormalizedValue() );
+        assertEquals( null, sv.getNormalizedValue() );
         
-        csv.set(  "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", csv.getNormalizedValue() );
+        sv = new StringValue( "  This is    a   TEST  " );
+        assertEquals( "  This is    a   TEST  ", sv.getNormalizedValue() );
         
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
         
-        assertEquals( "this is a test", csv.getNormalizedValue() );
+        assertEquals( "this is a test", sv.getNormalizedValue() );
     }
 
 
@@ -394,16 +384,16 @@ public class StringValueTest
     @Test
     public void getNormalizedValueCopy() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue();
         
-        assertEquals( null, csv.getNormalizedValueCopy() );
+        assertEquals( null, sv.getNormalizedValueCopy() );
         
-        csv.set(  "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", csv.getNormalizedValueCopy() );
+        sv = new StringValue( "  This is    a   TEST  " );
+        assertEquals( "  This is    a   TEST  ", sv.getNormalizedValueCopy() );
         
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
         
-        assertEquals( "this is a test", csv.getNormalizedValueCopy() );
+        assertEquals( "this is a test", sv.getNormalizedValueCopy() );
     }
 
     
@@ -413,21 +403,21 @@ public class StringValueTest
     @Test
     public void testNormalize() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue();
 
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
-        assertEquals( null, csv.getNormalizedValue() );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        assertEquals( null, sv.getNormalizedValue() );
         
-        csv.set( "" );
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
-        assertEquals( "", csv.getNormalizedValue() );
+        sv = new StringValue( "" );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        assertEquals( "", sv.getNormalizedValue() );
 
-        csv.set(  "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", csv.getNormalizedValue() );
+        sv = new StringValue(  "  This is    a   TEST  " );
+        assertEquals( "  This is    a   TEST  ", sv.getNormalizedValue() );
         
-        csv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        sv.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
         
-        assertEquals( "this is a test", csv.getNormalizedValue() );
+        assertEquals( "this is a test", sv.getNormalizedValue() );
     }
 
 
@@ -437,12 +427,12 @@ public class StringValueTest
     @Test
     public void testIsValid() throws LdapException
     {
-        StringValue csv = new StringValue( "Test" );
+        StringValue sv = new StringValue( "Test" );
         
-        assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
+        assertTrue( sv.isValid( new Ia5StringSyntaxChecker() ) );
         
-        csv.set(  "é" );
-        assertFalse( csv.isValid( new Ia5StringSyntaxChecker() ) );
+        sv = new StringValue( "é" );
+        assertFalse( sv.isValid( new Ia5StringSyntaxChecker() ) );
     }
 
 
@@ -452,31 +442,31 @@ public class StringValueTest
     @Test
     public void testCompareTo() throws LdapException
     {
-        StringValue csv1 = new StringValue();
-        StringValue csv2 = new StringValue();
+        StringValue sv1 = new StringValue();
+        StringValue sv2 = new StringValue();
         
-        assertEquals( 0, csv1.compareTo( csv2 ) );
+        assertEquals( 0, sv1.compareTo( sv2 ) );
         
-        csv1.set( "Test" );
-        assertEquals( 1, csv1.compareTo( csv2 ) );
-        assertEquals( -1, csv2.compareTo( csv1 ) );
+        sv1 = new StringValue( "Test" );
+        assertEquals( 1, sv1.compareTo( sv2 ) );
+        assertEquals( -1, sv2.compareTo( sv1 ) );
         
-        csv2.set( "Test" );
-        assertEquals( 0, csv1.compareTo( csv2 ) );
+        sv2 = new StringValue( "Test" );
+        assertEquals( 0, sv1.compareTo( sv2 ) );
 
         // Now check that the equals method works on normalized values.
-        csv1.set(  "  This is    a TEST   " );
-        csv2.set( "this is a test" );
-        csv1.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
-        assertEquals( 0, csv1.compareTo( csv2 ) );
-        
-        csv1.set( "a" );
-        csv2.set( "b" );
-        assertEquals( -1, csv1.compareTo( csv2 ) );
-
-        csv1.set( "b" );
-        csv2.set( "a" );
-        assertEquals( 1, csv1.compareTo( csv2 ) );
+        sv1 = new StringValue(  "  This is    a TEST   " );
+        sv2 = new StringValue( "this is a test" );
+        sv1.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        assertEquals( 0, sv1.compareTo( sv2 ) );
+        
+        sv1 = new StringValue( "a" );
+        sv2 = new StringValue( "b" );
+        assertEquals( -1, sv1.compareTo( sv2 ) );
+
+        sv1 = new StringValue( "b" );
+        sv2 = new StringValue( "a" );
+        assertEquals( 1, sv1.compareTo( sv2 ) );
     }
 
 
@@ -486,22 +476,22 @@ public class StringValueTest
     @Test
     public void testEquals() throws LdapException
     {
-        StringValue csv1 = new StringValue();
-        StringValue csv2 = new StringValue();
+        StringValue sv1 = new StringValue();
+        StringValue sv2 = new StringValue();
         
-        assertEquals( csv1, csv2 );
+        assertEquals( sv1, sv2 );
         
-        csv1.set( "Test" );
-        assertNotSame( csv1, csv2 );
+        sv1 = new StringValue( "Test" );
+        assertNotSame( sv1, sv2 );
         
-        csv2.set( "Test" );
-        assertEquals( csv1, csv2 );
+        sv2 = new StringValue( "Test" );
+        assertEquals( sv1, sv2 );
 
         // Now check that the equals method works on normalized values.
-        csv1.set(  "  This is    a TEST   " );
-        csv2.set( "this is a test" );
-        csv1.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
-        assertEquals( csv1, csv2 );
+        sv1 = new StringValue( "  This is    a TEST   " );
+        sv2 = new StringValue( "this is a test" );
+        sv1.normalize( new DeepTrimToLowerNormalizer( "1.1.1" ) );
+        assertEquals( sv1, sv2 );
     }
 
 
@@ -511,15 +501,15 @@ public class StringValueTest
     @Test
     public void testToString()
     {
-        StringValue csv = new StringValue();
+        StringValue sv = new StringValue();
         
-        assertEquals( "null", csv.toString() );
+        assertEquals( "null", sv.toString() );
 
-        csv.set( "" );
-        assertEquals( "", csv.toString() );
+        sv = new StringValue( "" );
+        assertEquals( "", sv.toString() );
 
-        csv.set( "Test" );
-        assertEquals( "Test", csv.toString() );
+        sv = new StringValue( "Test" );
+        assertEquals( "Test", sv.toString() );
     }
     
     



Mime
View raw message