directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1086419 - in /directory/shared/trunk: integ/src/test/java/org/apache/directory/shared/ldap/entry/ ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter...
Date Mon, 28 Mar 2011 21:59:35 GMT
Author: elecharny
Date: Mon Mar 28 21:59:34 2011
New Revision: 1086419

URL: http://svn.apache.org/viewvc?rev=1086419&view=rev
Log:
Some more cleanup in the Value classes :
o Removed the BinaryValue()/StringValue() constructors
o The BinaryValue(AttributeType)/StringValue(AttributeType) constructors are now package protected
(they are only used by the serialization process
o Added a deserialize() in Value
o Fixed the tests and the code accordingly

Modified:
    directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareValueSerializationTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter/FilterParser.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareValueSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareValueSerializationTest.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareValueSerializationTest.java
(original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareValueSerializationTest.java
Mon Mar 28 21:59:34 2011
@@ -82,16 +82,16 @@ public class SchemaAwareValueSerializati
         
         bv1 = new BinaryValue( userCertificate, data );
         bv2 = new BinaryValue( userCertificate, StringConstants.EMPTY_BYTES );
-        bv3 = new BinaryValue( userCertificate );
+        bv3 = new BinaryValue( userCertificate, null );
         bv1n = new BinaryValue( userCertificate, data );
         bv2n = new BinaryValue( userCertificate, StringConstants.EMPTY_BYTES );
-        bv3n = new BinaryValue( userCertificate );
+        bv3n = new BinaryValue( userCertificate, null );
         sv1 = new StringValue( cn, "test" );
         sv2 = new StringValue( dc, "" );
-        sv3 = new StringValue( cn );
+        sv3 = new StringValue( dc, (String)null );
         sv1n = new StringValue( cn, "test" );
         sv2n = new StringValue( dc, "" );
-        sv3n = new StringValue( dc );
+        sv3n = new StringValue( dc, (String)null );
     }
 
     
@@ -108,8 +108,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( (AttributeType)null );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( in );
 
         assertEquals( bv1, bvDeser );
     }
@@ -128,8 +127,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( (AttributeType)null );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( in );
 
         assertEquals( bv2, bvDeser );
     }
@@ -148,8 +146,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( (AttributeType)null );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( in );
 
         assertEquals( bv3, bvDeser );
     }
@@ -168,8 +165,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( (AttributeType)null );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( in );
 
         assertEquals( sv1, svDeser );
     }
@@ -188,8 +184,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( (AttributeType)null );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( in );
 
         assertEquals( sv2, svDeser );
     }
@@ -208,8 +203,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( (AttributeType)null );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( in );
 
         assertEquals( sv3, svDeser );
     }
@@ -229,8 +223,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( userCertificate );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( userCertificate, in );
 
         assertEquals( bv1n, bvDeser );
     }
@@ -250,8 +243,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( userCertificate );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( userCertificate, in );
 
         assertEquals( bv2n, bvDeser );
     }
@@ -271,8 +263,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        BinaryValue bvDeser = new BinaryValue( userCertificate );
-        bvDeser.readExternal( in );
+        BinaryValue bvDeser = BinaryValue.deserialize( userCertificate, in );
 
         assertEquals( bv3n, bvDeser );
     }
@@ -292,8 +283,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( cn );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( cn, in );
 
         assertEquals( sv1n, svDeser );
     }
@@ -313,8 +303,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( cn );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( cn, in );
 
         assertEquals( sv2n, svDeser );
     }
@@ -334,8 +323,7 @@ public class SchemaAwareValueSerializati
         byte[] data = baos.toByteArray();
         in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        StringValue svDeser = new StringValue( cn );
-        svDeser.readExternal( in );
+        StringValue svDeser = StringValue.deserialize( cn, in );
 
         assertEquals( sv3n, svDeser );
     }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
Mon Mar 28 21:59:34 2011
@@ -49,20 +49,10 @@ public class BinaryValue extends Abstrac
 
     /**
      * Creates a BinaryValue without an initial wrapped value.
-     */
-    public BinaryValue()
-    {
-        wrappedValue = null;
-        normalizedValue = null;
-    }
-
-
-    /**
-     * Creates a BinaryValue without an initial wrapped value.
      *
      * @param attributeType the schema type associated with this BinaryValue
      */
-    public BinaryValue( AttributeType attributeType )
+    /* No protection */ BinaryValue( AttributeType attributeType )
     {
         if ( attributeType != null )
         {
@@ -396,6 +386,42 @@ public class BinaryValue extends Abstrac
 
 
     /**
+     * Deserialize a BinaryValue. It will return a new BinaryValue instance.
+     * 
+     * @param attributeType The AttributeType associated with the Value. Can be null
+     * @param in The input stream
+     * @return A new StringValue instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a BinaryValue
+     */
+    public static BinaryValue deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        BinaryValue value = new BinaryValue( (AttributeType)null );
+        value.readExternal( in );
+
+        return value;
+    }
+
+
+    /**
+     * Deserialize a schema aware BinaryValue. It will return a new BinaryValue instance.
+     * 
+     * @param attributeType The AttributeType associated with the Value. Can be null
+     * @param in The input stream
+     * @return A new StringValue instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a BinaryValue
+     */
+    public static BinaryValue deserialize( AttributeType attributeType, ObjectInput in )
throws IOException, ClassNotFoundException
+    {
+        BinaryValue value = new BinaryValue( attributeType );
+        value.readExternal( in );
+
+        return value;
+    }
+    
+    
+    /**
      * {@inheritDoc}
      */
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
Mon Mar 28 21:59:34 2011
@@ -223,7 +223,7 @@ public class DefaultEntryAttribute imple
         // The value can be null, this is a valid value.
         if ( vals[0] == null )
         {
-             add( new StringValue() );
+             add( new StringValue( (String)null ) );
         }
         else
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java
Mon Mar 28 21:59:34 2011
@@ -51,18 +51,10 @@ public class StringValue extends Abstrac
     // -----------------------------------------------------------------------
     /**
      * Creates a StringValue without an initial wrapped value.
-     */
-    public StringValue()
-    {
-    }
-
-
-    /**
-     * Creates a StringValue without an initial wrapped value.
      *
      * @param attributeType the schema attribute type associated with this StringValue
      */
-    public StringValue( AttributeType attributeType )
+    /* No protection*/ StringValue( AttributeType attributeType )
     {
         if ( attributeType != null )
         {
@@ -395,6 +387,41 @@ public class StringValue extends Abstrac
     
     
     /**
+     * Deserialize a StringValue. It will return a new StringValue instance.
+     * 
+     * @param in The input stream
+     * @return A new StringValue instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a StringValue
+     */
+    public static StringValue deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        StringValue value = new StringValue( (AttributeType)null );
+        value.readExternal( in );
+
+        return value;
+    }
+    
+    
+    /**
+     * Deserialize a schemaAware StringValue. It will return a new StringValue instance.
+     * 
+     * @param attributeType The AttributeType associated with the Value. Can be null
+     * @param in The input stream
+     * @return A new StringValue instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a StringValue
+     */
+    public static StringValue deserialize( AttributeType attributeType, ObjectInput in )
throws IOException, ClassNotFoundException
+    {
+        StringValue value = new StringValue( attributeType );
+        value.readExternal( in );
+
+        return value;
+    }
+    
+    
+    /**
      * {@inheritDoc}
      */
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter/FilterParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter/FilterParser.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter/FilterParser.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/filter/FilterParser.java
Mon Mar 28 21:59:34 2011
@@ -29,7 +29,11 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.util.*;
+import org.apache.directory.shared.util.Chars;
+import org.apache.directory.shared.util.Hex;
+import org.apache.directory.shared.util.Position;
+import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 
 
 /**
@@ -288,7 +292,7 @@ public class FilterParser
         }
         else
         {
-            return new BinaryValue();
+            return new BinaryValue( (byte[])null );
         }
     }
 
@@ -449,7 +453,7 @@ public class FilterParser
                 
                 if ( attributeType != null )
                 {
-                    return new EqualityNode( attributeType, new BinaryValue() );
+                    return new EqualityNode( attributeType, new BinaryValue( (byte[])null
) );
                 }
                 
                 else
@@ -459,7 +463,7 @@ public class FilterParser
             }
             else
             {
-                return new EqualityNode( attribute, new BinaryValue() );
+                return new EqualityNode( attribute, new BinaryValue( (byte[])null ) );
             }
         }
         else

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
Mon Mar 28 21:59:34 2011
@@ -970,18 +970,15 @@ public class Ava implements Externalizab
 
         if ( isHR )
         {
-            upValue = new StringValue( attributeType );
-            normValue = new StringValue( attributeType );
+            upValue = StringValue.deserialize( attributeType, in );
+            normValue = StringValue.deserialize( attributeType, in );
         }
         else
         {
-            upValue = new BinaryValue( attributeType );
-            normValue = new BinaryValue( attributeType );
+            upValue = BinaryValue.deserialize( attributeType, in );
+            normValue = BinaryValue.deserialize( attributeType, in );
         }
 
-        upValue.readExternal( in );
-        normValue.readExternal( in );
-        
         h = in.readInt();
 
         if ( schemaManager != null )

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java
Mon Mar 28 21:59:34 2011
@@ -232,7 +232,7 @@ public class BinaryValueTest
     @Test
     public void testHashCode()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         assertEquals( 0, bv.hashCode() );
         
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
@@ -294,7 +294,7 @@ public class BinaryValueTest
     @Test
     public void testSetByteArray() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         bv = new BinaryValue( BYTES1 );
         
@@ -334,7 +334,7 @@ public class BinaryValueTest
     @Test
     public void testNormalizeNormalizer() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
@@ -363,8 +363,8 @@ public class BinaryValueTest
     @Test
     public void testCompareToValueOfbyte() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue();
-        BinaryValue bv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue( (byte[])null );
+        BinaryValue bv2 = new BinaryValue( (byte[])null );
         
         assertEquals( 0, bv1.compareTo( bv2 ) );
         
@@ -385,8 +385,8 @@ public class BinaryValueTest
     @Test
     public void testEquals() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue();
-        BinaryValue bv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue( (byte[])null );
+        BinaryValue bv2 = new BinaryValue( (byte[])null );
         
         assertEquals( bv1, bv2 );
         
@@ -407,7 +407,7 @@ public class BinaryValueTest
     @Test
     public void testClone()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         BinaryValue copy = bv.clone();
         
         assertEquals( bv, copy );
@@ -428,7 +428,7 @@ public class BinaryValueTest
     @Test
     public void testGetCopy()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertNull( bv.get() );
         
@@ -450,8 +450,8 @@ public class BinaryValueTest
     @Test
     public void testCompareTo() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue();
-        BinaryValue bv2 = new BinaryValue();
+        BinaryValue bv1 = new BinaryValue( (byte[])null );
+        BinaryValue bv2 = new BinaryValue( (byte[])null );
         
         assertEquals( 0, bv1.compareTo( bv2 ) );
         
@@ -481,7 +481,7 @@ public class BinaryValueTest
     @Test
     public void testToString()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertEquals( "null", bv.toString() );
 
@@ -496,7 +496,7 @@ public class BinaryValueTest
     @Test
     public void testGetReference()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertNull( bv.getReference() );
         
@@ -518,7 +518,7 @@ public class BinaryValueTest
     @Test
     public void testGet()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertNull( bv.get() );
         
@@ -540,7 +540,7 @@ public class BinaryValueTest
     @Test
     public void testGetNormalizedValue() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertFalse( bv.isSchemaAware() );
 
@@ -561,7 +561,7 @@ public class BinaryValueTest
     @Test
     public void testGetNormalizedValueReference() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertFalse( bv.isSchemaAware() );
 
@@ -582,7 +582,7 @@ public class BinaryValueTest
     @Test
     public void testIsNull()
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertTrue( bv.isNull() );
         
@@ -597,7 +597,7 @@ public class BinaryValueTest
     @Test
     public void testIsValid() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertTrue( bv.isValid( BINARY_CHECKER ) );
         
@@ -617,7 +617,7 @@ public class BinaryValueTest
     @Test
     public void testIsValidSyntaxChecker() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertTrue( bv.isValid( BINARY_CHECKER ) ) ;
         
@@ -635,7 +635,7 @@ public class BinaryValueTest
     @Test
     public void testNormalize() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
@@ -683,7 +683,7 @@ public class BinaryValueTest
     @Test
     public void testIsNormalized() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         assertFalse( bv.isSchemaAware() );
         
         bv = new BinaryValue( BYTES2 );
@@ -705,7 +705,7 @@ public class BinaryValueTest
     @Test
     public void testSetNormalized() throws LdapException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         
         assertFalse( bv.isSchemaAware() );
         
@@ -727,7 +727,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeStandard() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( BYTES2 );
         bv.apply( at );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
@@ -746,7 +746,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeNotNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( BYTES2 );
         bv.isValid( BINARY_CHECKER );
 
@@ -764,7 +764,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( BYTES2 );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
@@ -783,7 +783,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( (byte[])null );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
@@ -802,7 +802,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
@@ -821,7 +821,7 @@ public class BinaryValueTest
     @Test
     public void testSerializeEmptyValueNotNormalized() throws LdapException, IOException,
ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue();
+        BinaryValue bv = new BinaryValue( (byte[])null );
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.isValid( BINARY_CHECKER );
 

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
Mon Mar 28 21:59:34 2011
@@ -145,7 +145,7 @@ public class StringValueTest
     @Test
     public void testCloneEmptyValue() throws LdapException
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
         StringValue sv1 = (StringValue)sv.clone();
         
@@ -195,7 +195,7 @@ public class StringValueTest
         int hash = "test".hashCode();
         assertEquals( hash, csv.hashCode() );
         
-        csv = new StringValue();
+        csv = new StringValue( (String)null );
         hash = "".hashCode();
         assertEquals( hash, csv.hashCode() );
     }
@@ -207,7 +207,7 @@ public class StringValueTest
     @Test
     public void testClientStringValueNull() throws LdapException
     {
-        StringValue csv = new StringValue();
+        StringValue csv = new StringValue( (String)null );
         
         assertNull( csv.get() );
         assertFalse( csv.isSchemaAware() );
@@ -350,7 +350,7 @@ public class StringValueTest
     @Test
     public void testSetNormalized() throws LdapException
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
         assertFalse( sv.isSchemaAware() );
         
@@ -370,7 +370,7 @@ public class StringValueTest
     @Test
     public void testGetNormalizedValue() throws LdapException
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
         assertEquals( null, sv.getNormValue() );
         
@@ -389,7 +389,7 @@ public class StringValueTest
     @Test
     public void getNormValueCopy() throws LdapException
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
         assertEquals( null, sv.getNormValue() );
         
@@ -408,7 +408,7 @@ public class StringValueTest
     @Test
     public void testNormalize() throws LdapException
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
 
         sv.apply( at );
         assertEquals( null, sv.getNormValue() );
@@ -447,8 +447,8 @@ public class StringValueTest
     @Test
     public void testCompareTo() throws LdapException
     {
-        StringValue sv1 = new StringValue();
-        StringValue sv2 = new StringValue();
+        StringValue sv1 = new StringValue( (String)null );
+        StringValue sv2 = new StringValue( (String)null );
         
         assertEquals( 0, sv1.compareTo( sv2 ) );
         
@@ -481,8 +481,8 @@ public class StringValueTest
     @Test
     public void testEquals() throws LdapException
     {
-        StringValue sv1 = new StringValue();
-        StringValue sv2 = new StringValue();
+        StringValue sv1 = new StringValue( (String)null );
+        StringValue sv2 = new StringValue( (String)null );
         
         assertEquals( sv1, sv2 );
         
@@ -506,7 +506,7 @@ public class StringValueTest
     @Test
     public void testToString()
     {
-        StringValue sv = new StringValue();
+        StringValue sv = new StringValue( (String)null );
         
         assertEquals( "null", sv.toString() );
 

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java?rev=1086419&r1=1086418&r2=1086419&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
Mon Mar 28 21:59:34 2011
@@ -55,16 +55,16 @@ public class ValueSerializationTest
     private static byte[] data = new byte[] {0x01, 0x02, 0x03, 0x04};
     BinaryValue bv1 = new BinaryValue( data );
     BinaryValue bv2 = new BinaryValue( StringConstants.EMPTY_BYTES );
-    BinaryValue bv3 = new BinaryValue();
+    BinaryValue bv3 = new BinaryValue( (byte[])null );
     BinaryValue bv1n = new BinaryValue( data );
     BinaryValue bv2n = new BinaryValue( StringConstants.EMPTY_BYTES );
-    BinaryValue bv3n = new BinaryValue();
+    BinaryValue bv3n = new BinaryValue( (byte[])null );
     StringValue sv1 = new StringValue( "test" );
     StringValue sv2 = new StringValue( "" );
-    StringValue sv3 = new StringValue();
+    StringValue sv3 = new StringValue( (String)null );
     StringValue sv1n = new StringValue( "test" );
     StringValue sv2n = new StringValue( "" );
-    StringValue sv3n = new StringValue();
+    StringValue sv3n = new StringValue( (String)null );
     
     private EntryUtils.S sb;
     private EntryUtils.AT atb;



Mime
View raw message