directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235374 [15/27] - in /directory/shared/trunk: ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/ ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/ ldap/model/src/main/java/org/apache/directory/sha...
Date Tue, 24 Jan 2012 17:44:32 GMT
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/url/LdapUrl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/url/LdapUrl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/url/LdapUrl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/url/LdapUrl.java Tue Jan 24 17:44:03 2012
@@ -112,7 +112,9 @@ public class LdapUrl
     private boolean forceScopeRendering;
 
     /** A regexp for attributes */
-    private static final Pattern ATTRIBUTE = Pattern.compile( "(?:(?:\\d|[1-9]\\d*)(?:\\.(?:\\d|[1-9]\\d*))+)|(?:[a-zA-Z][a-zA-Z0-9-]*)" );
+    private static final Pattern ATTRIBUTE = Pattern
+        .compile( "(?:(?:\\d|[1-9]\\d*)(?:\\.(?:\\d|[1-9]\\d*))+)|(?:[a-zA-Z][a-zA-Z0-9-]*)" );
+
 
     /**
      * Construct an empty LdapUrl
@@ -160,8 +162,8 @@ public class LdapUrl
         int pos = 0;
 
         // The scheme
-        if ( ( ( pos = Strings.areEquals(chars, 0, LDAP_SCHEME) ) == StringConstants.NOT_EQUAL )
-            && ( ( pos = Strings.areEquals(chars, 0, LDAPS_SCHEME) ) == StringConstants.NOT_EQUAL ) )
+        if ( ( ( pos = Strings.areEquals( chars, 0, LDAP_SCHEME ) ) == StringConstants.NOT_EQUAL )
+            && ( ( pos = Strings.areEquals( chars, 0, LDAPS_SCHEME ) ) == StringConstants.NOT_EQUAL ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04398 ) );
         }
@@ -182,7 +184,7 @@ public class LdapUrl
         }
 
         // An optional '/'
-        if ( !Chars.isCharASCII(chars, pos, '/') )
+        if ( !Chars.isCharASCII( chars, pos, '/' ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04400, pos, chars[pos] ) );
         }
@@ -206,7 +208,7 @@ public class LdapUrl
         }
 
         // Optionals attributes
-        if ( !Chars.isCharASCII(chars, pos, '?') )
+        if ( !Chars.isCharASCII( chars, pos, '?' ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos] ) );
         }
@@ -224,7 +226,7 @@ public class LdapUrl
         }
 
         // Optional scope
-        if ( !Chars.isCharASCII(chars, pos, '?') )
+        if ( !Chars.isCharASCII( chars, pos, '?' ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos] ) );
         }
@@ -242,7 +244,7 @@ public class LdapUrl
         }
 
         // Optional filter
-        if ( !Chars.isCharASCII(chars, pos, '?') )
+        if ( !Chars.isCharASCII( chars, pos, '?' ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos] ) );
         }
@@ -265,7 +267,7 @@ public class LdapUrl
         }
 
         // Optional extensions
-        if ( !Chars.isCharASCII(chars, pos, '?') )
+        if ( !Chars.isCharASCII( chars, pos, '?' ) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos] ) );
         }
@@ -296,7 +298,7 @@ public class LdapUrl
      */
     public LdapUrl( String string ) throws LdapURLEncodingException
     {
-        if (string == null )
+        if ( string == null )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04408 ) );
         }
@@ -350,7 +352,7 @@ public class LdapUrl
         // the end.
         // We will search the end of the host part, and we will check some
         // elements.
-        if ( Chars.isCharASCII(chars, pos, '-') )
+        if ( Chars.isCharASCII( chars, pos, '-' ) )
         {
 
             // We can't have a '-' on first position
@@ -360,7 +362,7 @@ public class LdapUrl
         while ( ( pos < chars.length ) && ( chars[pos] != ':' ) && ( chars[pos] != '/' ) )
         {
 
-            if ( Chars.isCharASCII(chars, pos, '.') )
+            if ( Chars.isCharASCII( chars, pos, '.' ) )
             {
 
                 if ( ( hadMinus ) || ( hadDot ) )
@@ -390,7 +392,7 @@ public class LdapUrl
             else
             {
 
-                if ( hadDot && Chars.isCharASCII(chars, pos, '-') )
+                if ( hadDot && Chars.isCharASCII( chars, pos, '-' ) )
                 {
 
                     // We can't have a '-' just after a '.'
@@ -400,7 +402,7 @@ public class LdapUrl
                 hadDot = false;
             }
 
-            if ( Chars.isDigit(chars, pos) )
+            if ( Chars.isDigit( chars, pos ) )
             {
 
                 if ( isHostNumber && ( nbDots < 4 ) )
@@ -415,11 +417,11 @@ public class LdapUrl
 
                 hadMinus = false;
             }
-            else if ( Chars.isAlphaDigitMinus(chars, pos) )
+            else if ( Chars.isAlphaDigitMinus( chars, pos ) )
             {
                 isHostNumber = false;
 
-                hadMinus = Chars.isCharASCII(chars, pos, '-');
+                hadMinus = Chars.isCharASCII( chars, pos, '-' );
             }
             else
             {
@@ -482,7 +484,7 @@ public class LdapUrl
     private int parsePort( char[] chars, int pos )
     {
 
-        if ( !Chars.isDigit(chars, pos) )
+        if ( !Chars.isDigit( chars, pos ) )
         {
             return -1;
         }
@@ -491,7 +493,7 @@ public class LdapUrl
 
         pos++;
 
-        while ( Chars.isDigit(chars, pos) )
+        while ( Chars.isDigit( chars, pos ) )
         {
             port = ( port * 10 ) + ( chars[pos] - '0' );
 
@@ -528,7 +530,7 @@ public class LdapUrl
         }
 
         // We may have a port.
-        if ( Chars.isCharASCII(chars, pos, ':') )
+        if ( Chars.isCharASCII( chars, pos, ':' ) )
         {
             if ( pos == hostPos )
             {
@@ -551,8 +553,8 @@ public class LdapUrl
 
         return pos;
     }
-    
-    
+
+
     /**
      * Converts the specified string to byte array of ASCII characters.
      *
@@ -687,6 +689,7 @@ public class LdapUrl
         return end;
     }
 
+
     /**
      * Parse the following rule :
      * <pre>
@@ -704,13 +707,14 @@ public class LdapUrl
     private void validateAttribute( String attribute ) throws LdapURLEncodingException
     {
         Matcher matcher = ATTRIBUTE.matcher( attribute );
-        
+
         if ( !matcher.matches() )
         {
             throw new LdapURLEncodingException( "Attribute " + attribute + " is invalid" );
         }
     }
 
+
     /**
      * Parse the attributes part
      *
@@ -731,7 +735,7 @@ public class LdapUrl
             for ( int i = pos; ( i < chars.length ) && ( chars[i] != '?' ); i++ )
             {
 
-                if ( Chars.isCharASCII(chars, i, ',') )
+                if ( Chars.isCharASCII( chars, i, ',' ) )
                 {
                     hadComma = true;
 
@@ -752,7 +756,7 @@ public class LdapUrl
                         {
                             return -1;
                         }
-                        
+
                         // Check that the attribute is valid
                         try
                         {
@@ -879,19 +883,19 @@ public class LdapUrl
     private int parseScope( char[] chars, int pos )
     {
 
-        if ( Chars.isCharASCII(chars, pos, 'b') || Chars.isCharASCII(chars, pos, 'B') )
+        if ( Chars.isCharASCII( chars, pos, 'b' ) || Chars.isCharASCII( chars, pos, 'B' ) )
         {
             pos++;
 
-            if ( Chars.isCharASCII(chars, pos, 'a') || Chars.isCharASCII(chars, pos, 'A') )
+            if ( Chars.isCharASCII( chars, pos, 'a' ) || Chars.isCharASCII( chars, pos, 'A' ) )
             {
                 pos++;
 
-                if ( Chars.isCharASCII(chars, pos, 's') || Chars.isCharASCII(chars, pos, 'S') )
+                if ( Chars.isCharASCII( chars, pos, 's' ) || Chars.isCharASCII( chars, pos, 'S' ) )
                 {
                     pos++;
 
-                    if ( Chars.isCharASCII(chars, pos, 'e') || Chars.isCharASCII(chars, pos, 'E') )
+                    if ( Chars.isCharASCII( chars, pos, 'e' ) || Chars.isCharASCII( chars, pos, 'E' ) )
                     {
                         pos++;
                         scope = SearchScope.OBJECT;
@@ -900,15 +904,15 @@ public class LdapUrl
                 }
             }
         }
-        else if ( Chars.isCharASCII(chars, pos, 'o') || Chars.isCharASCII(chars, pos, 'O') )
+        else if ( Chars.isCharASCII( chars, pos, 'o' ) || Chars.isCharASCII( chars, pos, 'O' ) )
         {
             pos++;
 
-            if ( Chars.isCharASCII(chars, pos, 'n') || Chars.isCharASCII(chars, pos, 'N') )
+            if ( Chars.isCharASCII( chars, pos, 'n' ) || Chars.isCharASCII( chars, pos, 'N' ) )
             {
                 pos++;
 
-                if ( Chars.isCharASCII(chars, pos, 'e') || Chars.isCharASCII(chars, pos, 'E') )
+                if ( Chars.isCharASCII( chars, pos, 'e' ) || Chars.isCharASCII( chars, pos, 'E' ) )
                 {
                     pos++;
 
@@ -917,15 +921,15 @@ public class LdapUrl
                 }
             }
         }
-        else if ( Chars.isCharASCII(chars, pos, 's') || Chars.isCharASCII(chars, pos, 'S') )
+        else if ( Chars.isCharASCII( chars, pos, 's' ) || Chars.isCharASCII( chars, pos, 'S' ) )
         {
             pos++;
 
-            if ( Chars.isCharASCII(chars, pos, 'u') || Chars.isCharASCII(chars, pos, 'U') )
+            if ( Chars.isCharASCII( chars, pos, 'u' ) || Chars.isCharASCII( chars, pos, 'U' ) )
             {
                 pos++;
 
-                if ( Chars.isCharASCII(chars, pos, 'b') || Chars.isCharASCII(chars, pos, 'B') )
+                if ( Chars.isCharASCII( chars, pos, 'b' ) || Chars.isCharASCII( chars, pos, 'B' ) )
                 {
                     pos++;
 
@@ -934,7 +938,7 @@ public class LdapUrl
                 }
             }
         }
-        else if ( Chars.isCharASCII(chars, pos, '?') )
+        else if ( Chars.isCharASCII( chars, pos, '?' ) )
         {
             // An empty scope. This is valid
             return pos;
@@ -980,7 +984,7 @@ public class LdapUrl
         {
             for ( int i = pos; ( i < chars.length ); i++ )
             {
-                if ( Chars.isCharASCII(chars, i, ',') )
+                if ( Chars.isCharASCII( chars, i, ',' ) )
                 {
                     if ( isNewExtension )
                     {
@@ -1010,7 +1014,7 @@ public class LdapUrl
                         value = null;
                     }
                 }
-                else if ( Chars.isCharASCII(chars, i, '=') )
+                else if ( Chars.isCharASCII( chars, i, '=' ) )
                 {
                     if ( hasValue )
                     {
@@ -1030,7 +1034,7 @@ public class LdapUrl
                     hasValue = true;
                     start = i + 1;
                 }
-                else if ( Chars.isCharASCII(chars, i, '!') )
+                else if ( Chars.isCharASCII( chars, i, '!' ) )
                 {
                     if ( hasValue )
                     {
@@ -1130,11 +1134,11 @@ public class LdapUrl
             switch ( c )
 
             {
-                // reserved and unreserved characters:
-                // just append to the buffer
+            // reserved and unreserved characters:
+            // just append to the buffer
 
-                // reserved gen-delims, excluding '?'
-                // gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+            // reserved gen-delims, excluding '?'
+            // gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
                 case ':':
                 case '/':
                 case '#':
@@ -1247,7 +1251,7 @@ public class LdapUrl
                 default:
 
                     // percent encoding
-                    byte[] bytes = Unicode.charToBytes(c);
+                    byte[] bytes = Unicode.charToBytes( c );
                     char[] hex = Strings.toHexString( bytes ).toCharArray();
                     for ( int j = 0; j < hex.length; j++ )
                     {
@@ -1727,7 +1731,6 @@ public class LdapUrl
         this.forceScopeRendering = forceScopeRendering;
     }
 
-
     /**
      * An inner bean to hold extension information.
      *

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/csn/CsnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/csn/CsnTest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/csn/CsnTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/csn/CsnTest.java Tue Jan 24 17:44:03 2012
@@ -47,23 +47,24 @@ import com.mycila.junit.concurrent.Concu
 public class CsnTest
 {
     private static final SimpleDateFormat SDF = new SimpleDateFormat( "yyyyMMddHHmmss.123456'Z'" );
-    
+
     static
     {
         SDF.setTimeZone( DateUtils.UTC_TIME_ZONE );
     }
 
+
     @Test
     public void testCSN()
     {
         synchronized ( SDF )
         {
             long ts = System.currentTimeMillis();
-    
+
             Csn csn = new Csn( SDF.format( new Date( ts ) ) + "#123456#abc#654321" );
-    
-            assertEquals( ts/1000, csn.getTimestamp()/1000 );
-            
+
+            assertEquals( ts / 1000, csn.getTimestamp() / 1000 );
+
             // ALl the value are converted from hex to int
             assertEquals( 1193046, csn.getChangeCount() );
             assertEquals( 6636321, csn.getOperationNumber() );
@@ -77,7 +78,7 @@ public class CsnTest
     {
         try
         {
-            new Csn( (String)null );
+            new Csn( ( String ) null );
             fail();
         }
         catch ( InvalidCSNException ice )
@@ -107,11 +108,11 @@ public class CsnTest
     {
         try
         {
-            synchronized( SDF )
+            synchronized ( SDF )
             {
                 new Csn( SDF.format( new Date( System.currentTimeMillis() ) ) );
             }
-            
+
             fail();
         }
         catch ( InvalidCSNException ice )
@@ -134,7 +135,7 @@ public class CsnTest
         {
             assertTrue( true );
         }
-        
+
         try
         {
             // Missing milliseconds
@@ -234,8 +235,8 @@ public class CsnTest
             assertTrue( true );
         }
     }
-    
-    
+
+
     @Test
     public void testCSNNoReplica()
     {
@@ -249,8 +250,8 @@ public class CsnTest
             assertTrue( true );
         }
     }
-    
-    
+
+
     @Test
     public void testCSNInvalidReplica()
     {
@@ -278,7 +279,7 @@ public class CsnTest
         {
             assertTrue( true );
         }
-        
+
         try
         {
             new Csn( "20010101000000.000000Z#000000#abc#  " );
@@ -344,14 +345,14 @@ public class CsnTest
         byte[] bytes = csn.getBytes();
 
         byte[] expected = new byte[]
-            { 
-                '2', '0', '0', '1', '0', '1', '0', '1', 
+            {
+                '2', '0', '0', '1', '0', '1', '0', '1',
                 '0', '0', '0', '0', '0', '0', '.', '0',
-                '0', '0', '0', '0', '0', 'Z', '#', '0', 
-                '0', '0', '0', '0', '0', '#', 'a', 'b', 
-                'c', '#', '0', '0', '0', '0', '0', '1' 
-            };
-        
+                '0', '0', '0', '0', '0', 'Z', '#', '0',
+                '0', '0', '0', '0', '0', '#', 'a', 'b',
+                'c', '#', '0', '0', '0', '0', '0', '1'
+        };
+
         assertTrue( Arrays.equals( expected, bytes ) );
 
         Csn deserializedCSN = new Csn( bytes );

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/cursor/ListCursorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/cursor/ListCursorTest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/cursor/ListCursorTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/cursor/ListCursorTest.java Tue Jan 24 17:44:03 2012
@@ -70,11 +70,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( Collections.singletonList( "singleton" ), 0 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start = end is senseless
@@ -82,11 +82,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( 1, Collections.singletonList( "singleton" ) );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start > end is senseless
@@ -94,11 +94,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( 5, Collections.singletonList( "singleton" ) );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: end < start is senseless too in another way :)
@@ -106,11 +106,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( Collections.singletonList( "singleton" ), -5 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start out of range
@@ -118,11 +118,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( -5, Collections.singletonList( "singleton" ) );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: end out of range
@@ -130,11 +130,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( Collections.singletonList( "singleton" ), 5 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
     }
 
@@ -169,11 +169,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( list, 0 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start = end is senseless
@@ -181,11 +181,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( 5, list );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start > end is senseless
@@ -193,11 +193,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( 10, list );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: end < start is senseless too in another way :)
@@ -205,11 +205,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( list, -5 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: start out of range
@@ -217,11 +217,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( -5, list );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         // bad bounds: end out of range
@@ -229,11 +229,11 @@ public class ListCursorTest
         {
             cursor = new ListCursor<String>( list, 10 );
             cursor.close();
-            fail("when the start = end bounds this is senseless and should complain");
+            fail( "when the start = end bounds this is senseless and should complain" );
         }
         catch ( IllegalArgumentException e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
     }
 
@@ -246,7 +246,7 @@ public class ListCursorTest
         }
         catch ( Exception e )
         {
-            fail("cursor.isClosed() test should not fail after closing the cursor");
+            fail( "cursor.isClosed() test should not fail after closing the cursor" );
         }
 
         try
@@ -255,78 +255,77 @@ public class ListCursorTest
         }
         catch ( Exception e )
         {
-            fail("cursor.close() after closing the cursor should not fail with exceptions");
+            fail( "cursor.close() after closing the cursor should not fail with exceptions" );
         }
 
-
         try
         {
             cursor.afterLast();
-            fail("cursor.afterLast() after closing the cursor should fail with an IOException");
+            fail( "cursor.afterLast() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.beforeFirst();
-            fail("cursor.beforeFirst() after closing the cursor should fail with an IOException");
+            fail( "cursor.beforeFirst() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.first();
-            fail("cursor.first() after closing the cursor should fail with an IOException");
+            fail( "cursor.first() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.get();
-            fail("cursor.get() after closing the cursor should fail with an IOException");
+            fail( "cursor.get() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.last();
-            fail("cursor.last() after closing the cursor should fail with an IOException");
+            fail( "cursor.last() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.next();
-            fail("cursor.next() after closing the cursor should fail with an IOException");
+            fail( "cursor.next() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
 
         try
         {
             cursor.previous();
-            fail("cursor.previous() after closing the cursor should fail with an IOException");
+            fail( "cursor.previous() after closing the cursor should fail with an IOException" );
         }
         catch ( Exception e )
         {
-            assertNotNull(e);
+            assertNotNull( e );
         }
     }
 }

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java Tue Jan 24 17:44:03 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.model.entry;
 
+
 import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
@@ -34,6 +35,7 @@ import org.junit.runner.RunWith;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
+
 /**
  * Test the EntryAttribute Serialization
  * 
@@ -43,20 +45,24 @@ import com.mycila.junit.concurrent.Concu
 @Concurrency()
 public class AttributeSerializationTest
 {
-    private static byte[] data1 = new byte[] {0x01, 0x02, 0x03, 0x04};
-    private static byte[] data2 = new byte[] {0x05, 0x06, 0x07, 0x08};
-    private static byte[] data3 = new byte[] {0x09, 0x0A, 0x0B, 0x0C};
+    private static byte[] data1 = new byte[]
+        { 0x01, 0x02, 0x03, 0x04 };
+    private static byte[] data2 = new byte[]
+        { 0x05, 0x06, 0x07, 0x08 };
+    private static byte[] data3 = new byte[]
+        { 0x09, 0x0A, 0x0B, 0x0C };
+
 
     @Test
     public void testEntryAttributeNoStringValueSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "CN" );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutput out = new ObjectOutputStream( baos );
-        
+
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -67,18 +73,18 @@ public class AttributeSerializationTest
 
         assertEquals( attribute1, attribute2 );
     }
-    
-    
+
+
     @Test
     public void testEntryAttributeOneStringValueSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "CN", "test" );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -89,18 +95,18 @@ public class AttributeSerializationTest
 
         assertEquals( attribute1, attribute2 );
     }
-    
-    
+
+
     @Test
     public void testEntryAttributeManyStringValuesSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "CN", "test1", "test2", "test3" );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -117,12 +123,12 @@ public class AttributeSerializationTest
     public void testEntryAttributeNoBinaryValueSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "UserCertificate" );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -133,18 +139,18 @@ public class AttributeSerializationTest
 
         assertEquals( attribute1, attribute2 );
     }
-    
-    
+
+
     @Test
     public void testEntryAttributeOneBinaryValueSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "UserCertificate", data1 );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -155,18 +161,18 @@ public class AttributeSerializationTest
 
         assertEquals( attribute1, attribute2 );
     }
-    
-    
+
+
     @Test
     public void testEntryAttributeManyBinaryValuesSerialization() throws IOException, ClassNotFoundException
     {
         Attribute attribute1 = new DefaultAttribute( "UserCertificate", data1, data2, data3 );
-        
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         attribute1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java Tue Jan 24 17:44:03 2012
@@ -51,7 +51,8 @@ public class AttributeUtilsTest
     byte[] byteArrayACopy;
     byte[] byteArrayB;
     byte[] byteArrayC;
-    
+
+
     /**
      * Initialize name instances
      */
@@ -65,7 +66,7 @@ public class AttributeUtilsTest
         byteArrayC = "cc".getBytes();
     }
 
-    
+
     /**
      * Test a addModification applied to an empty entry
      */
@@ -76,7 +77,7 @@ public class AttributeUtilsTest
         Attribute attr = new DefaultAttribute( "cn", "test" );
         Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
         AttributeUtils.applyModification( entry, modification );
-        assertNotNull( entry.get(  "cn" ) );
+        assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
         assertEquals( attr, entry.get( "cn" ) );
     }
@@ -96,7 +97,7 @@ public class AttributeUtilsTest
         Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
 
         AttributeUtils.applyModification( entry, modification );
-        assertNotNull( entry.get(  "cn" ) );
+        assertNotNull( entry.get( "cn" ) );
         assertEquals( 2, entry.size() );
         assertEquals( attr, entry.get( "cn" ) );
     }
@@ -116,26 +117,26 @@ public class AttributeUtilsTest
         Attribute attr = new DefaultAttribute( "cn", "test" );
         Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
         AttributeUtils.applyModification( entry, modification );
-        assertNotNull( entry.get(  "cn" ) );
+        assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
-        
+
         Attribute attribute = entry.get( "cn" );
-        
+
         assertTrue( attribute.size() != 0 );
-        
+
         Set<String> expectedValues = new HashSet<String>();
         expectedValues.add( "apache" );
         expectedValues.add( "test" );
-        
-        for ( Value<?> value:attribute )
+
+        for ( Value<?> value : attribute )
         {
             String valueStr = value.getString();
-            
+
             assertTrue( expectedValues.contains( valueStr ) );
-            
+
             expectedValues.remove( valueStr );
         }
-        
+
         assertEquals( 0, expectedValues.size() );
     }
 
@@ -156,28 +157,28 @@ public class AttributeUtilsTest
         AttributeUtils.applyModification( entry, modification );
         assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
-        
+
         Attribute cnAttr = entry.get( "cn" );
-        
+
         assertTrue( cnAttr.size() != 0 );
-        
+
         Set<String> expectedValues = new HashSet<String>();
         expectedValues.add( "apache" );
         expectedValues.add( "test" );
-        
-        for ( Value<?> value:cnAttr )
+
+        for ( Value<?> value : cnAttr )
         {
             String valueStr = value.getString();
-            
+
             assertTrue( expectedValues.contains( valueStr ) );
-            
+
             expectedValues.remove( valueStr );
         }
-        
+
         assertEquals( 0, expectedValues.size() );
     }
 
-    
+
     /**
      * Test the deletion of an attribute into an empty entry
      */
@@ -205,13 +206,13 @@ public class AttributeUtilsTest
 
         Attribute dc = new DefaultAttribute( "dc", "apache" );
         entry.put( dc );
-        
+
         Attribute cn = new DefaultAttribute( "cn", "test" );
-        
+
         Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, cn );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertNull( entry.get( "cn" ) );
         assertNotNull( entry.get( "dc" ) );
         assertEquals( 1, entry.size() );
@@ -230,13 +231,13 @@ public class AttributeUtilsTest
 
         Attribute cn = new DefaultAttribute( "cn", "apache" );
         entry.put( cn );
-        
+
         Attribute attr = new DefaultAttribute( "cn", "test" );
-        
+
         Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
         assertEquals( cn, entry.get( "cn" ) );
@@ -253,13 +254,13 @@ public class AttributeUtilsTest
     {
         Entry entry = new DefaultEntry();
         entry.put( "cn", "test" );
-        
+
         Attribute attr = new DefaultAttribute( "cn", "test" );
 
         Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertNull( entry.get( "cn" ) );
         assertEquals( 0, entry.size() );
     }
@@ -276,31 +277,32 @@ public class AttributeUtilsTest
     {
         Entry entry = new DefaultEntry();
         entry.put( "cn", "test", "apache" );
-        
+
         Attribute attr = new DefaultAttribute( "cn", "test" );
-        
+
         Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
-        
+
         Attribute modifiedAttr = entry.get( "cn" );
-        
+
         assertTrue( modifiedAttr.size() != 0 );
-        
+
         boolean isFirst = true;
-        
-        for ( Value<?> value:modifiedAttr )
+
+        for ( Value<?> value : modifiedAttr )
         {
             assertTrue( isFirst );
-            
+
             isFirst = false;
             assertEquals( "apache", value.getString() );
         }
     }
-    
+
+
     /**
      * test the addition by modification of an attribute in an empty entry.
      * 
@@ -312,17 +314,16 @@ public class AttributeUtilsTest
     public void testApplyModifyModificationFromEmptyEntry() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        
+
         Attribute attr = new DefaultAttribute( "cn", "test" );
 
-        
         Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
         AttributeUtils.applyModification( entry, modification );
         assertNotNull( entry.get( "cn" ) );
         assertEquals( 1, entry.size() );
     }
 
-    
+
     /**
      * Test the replacement by modification of an attribute in an empty entry.
      * 
@@ -334,7 +335,7 @@ public class AttributeUtilsTest
     public void testApplyModifyEmptyModificationFromEmptyEntry() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        
+
         Attribute attr = new DefaultAttribute( "cn" );
 
         Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
@@ -357,35 +358,35 @@ public class AttributeUtilsTest
         Entry entry = new DefaultEntry();
         entry.put( "cn", "test" );
         entry.put( "ou", "apache", "acme corp" );
-        
+
         Attribute newOu = new DefaultAttribute( "ou", "Big Company", "directory" );
-        
+
         Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, newOu );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertEquals( 2, entry.size() );
-        
+
         assertNotNull( entry.get( "cn" ) );
         assertNotNull( entry.get( "ou" ) );
-        
+
         Attribute modifiedAttr = entry.get( "ou" );
-        
+
         assertTrue( modifiedAttr.size() != 0 );
-        
+
         Set<String> expectedValues = new HashSet<String>();
         expectedValues.add( "Big Company" );
         expectedValues.add( "directory" );
 
-        for ( Value<?> value:modifiedAttr )
+        for ( Value<?> value : modifiedAttr )
         {
             String valueStr = value.getString();
-            
+
             assertTrue( expectedValues.contains( valueStr ) );
-            
+
             expectedValues.remove( valueStr );
         }
-        
+
         assertEquals( 0, expectedValues.size() );
     }
 
@@ -399,19 +400,18 @@ public class AttributeUtilsTest
     public void testApplyModifyModificationRemoveAttribute() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        entry.put(  "cn", "test" );
+        entry.put( "cn", "test" );
         entry.put( "ou", "apache", "acme corp" );
-        
+
         Attribute newOu = new DefaultAttribute( "ou" );
-        
+
         Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, newOu );
-        
+
         AttributeUtils.applyModification( entry, modification );
-        
+
         assertEquals( 1, entry.size() );
-        
+
         assertNotNull( entry.get( "cn" ) );
         assertNull( entry.get( "ou" ) );
     }
 }
-

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java Tue Jan 24 17:44:03 2012
@@ -71,21 +71,25 @@ public class BinaryValueAttributeTypeTes
     private LdapSyntax s;
     private AttributeType at;
     private MatchingRule mr;
-    
-    private static final byte[] BYTES1 = new byte[]{0x01, 0x02, 0x03, 0x04};
-    private static final byte[] BYTES2 = new byte[]{(byte)0x81, (byte)0x82, (byte)0x83, (byte)0x84};
+
+    private static final byte[] BYTES1 = new byte[]
+        { 0x01, 0x02, 0x03, 0x04 };
+    private static final byte[] BYTES2 = new byte[]
+        { ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83, ( byte ) 0x84 };
+
 
     /**
      * Initialize an AttributeType and the associated MatchingRule 
      * and Syntax
      */
-    @Before public void initAT()
+    @Before
+    public void initAT()
     {
         s = EntryUtils.syntaxFactory( "1.1.1.1", false );
         s.setSyntaxChecker( new OctetStringSyntaxChecker() );
         mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
         mr.setSyntax( s );
-        
+
         mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
         mr.setNormalizer( new Normalizer( "1.1.1" )
         {
@@ -95,35 +99,35 @@ public class BinaryValueAttributeTypeTes
                 {
                     byte[] val = value.getBytes();
                     // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[ val.length ];
+                    byte[] newVal = new byte[val.length];
                     int i = 0;
-                    
-                    for ( byte b:val )
+
+                    for ( byte b : val )
                     {
-                        newVal[i++] = (byte)(b & 0x007F); 
+                        newVal[i++] = ( byte ) ( b & 0x007F );
                     }
-                    
-                    return new BinaryValue( Strings.trim(newVal) );
+
+                    return new BinaryValue( Strings.trim( newVal ) );
                 }
 
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
 
-        
+
             public String normalize( String value ) throws LdapException
             {
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
-        });
-        
+        } );
+
         at = new AttributeType( "1.1.3.1" );
         at.setEquality( mr );
         at.setOrdering( mr );
         at.setSubstring( mr );
         at.setSyntax( s );
     }
-    
-    
+
+
     /**
      * Serialize a BinaryValue
      */
@@ -156,15 +160,16 @@ public class BinaryValueAttributeTypeTes
                 throw ioe;
             }
         }
-        
+
         return out;
     }
-    
-    
+
+
     /**
      * Deserialize a BinaryValue
      */
-    private BinaryValue deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
+    private BinaryValue deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException,
+        ClassNotFoundException
     {
         ObjectInputStream oIn = null;
         ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -173,7 +178,7 @@ public class BinaryValueAttributeTypeTes
         {
             oIn = new ObjectInputStream( in );
 
-            BinaryValue value = new BinaryValue( (AttributeType)null );
+            BinaryValue value = new BinaryValue( ( AttributeType ) null );
             value.readExternal( oIn );
 
             return value;
@@ -197,16 +202,17 @@ public class BinaryValueAttributeTypeTes
             }
         }
     }
-    
-    
+
+
     /**
      * Test the constructor with bad AttributeType
      */
-    @Test public void testBadConstructor()
+    @Test
+    public void testBadConstructor()
     {
         // create a AT without no syntax
         AttributeType attribute = new AttributeType( "1.1.3.1" );
-        
+
         try
         {
             new BinaryValue( attribute );
@@ -222,62 +228,68 @@ public class BinaryValueAttributeTypeTes
     /**
      * Test the constructor with a null value
      */
-    @Test public void testServerBinaryValueNullValue() throws LdapInvalidAttributeValueException
+    @Test
+    public void testServerBinaryValueNullValue() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         BinaryValue value = new BinaryValue( attribute, null );
-        
+
         assertNull( value.getReference() );
         assertTrue( value.isNull() );
     }
-    
-    
+
+
     /**
      * Test the constructor with an empty value
      */
-    @Test public void testServerBinaryValueEmptyValue() throws LdapInvalidAttributeValueException
+    @Test
+    public void testServerBinaryValueEmptyValue() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         BinaryValue value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
-        
+
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getReference() ) );
         assertFalse( value.isNull() );
     }
-    
-    
+
+
     /**
      * Test the constructor with a value
      */
-    @Test public void testServerBinaryValueNoValue()
+    @Test
+    public void testServerBinaryValueNoValue()
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        byte[] val = new byte[]{0x01};
+        byte[] val = new byte[]
+            { 0x01 };
         BinaryValue bv = new BinaryValue( attribute );
-        
+
         bv = new BinaryValue( val );
         assertTrue( Arrays.equals( val, bv.getReference() ) );
         assertFalse( bv.isNull() );
         assertTrue( Arrays.equals( val, bv.getValue() ) );
     }
-    
-    
+
+
     /**
      * Test the constructor with a value
      */
-    @Test public void testServerBinaryValue() throws LdapInvalidAttributeValueException
+    @Test
+    public void testServerBinaryValue() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        byte[] val = new byte[]{0x01};
+        byte[] val = new byte[]
+            { 0x01 };
         BinaryValue value = new BinaryValue( attribute, val );
-        
+
         assertTrue( Arrays.equals( val, value.getReference() ) );
         assertFalse( value.isNull() );
         assertTrue( Arrays.equals( val, value.getValue() ) );
     }
-    
-    
+
+
     /**
      * Test the clone method
      */
@@ -287,43 +299,49 @@ public class BinaryValueAttributeTypeTes
         AttributeType at1 = EntryUtils.getBytesAttributeType();
         BinaryValue bv = new BinaryValue( at1, null );
         BinaryValue bv1 = bv.clone();
-        
+
         assertEquals( bv, bv1 );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
-        
+
         assertNotSame( bv, bv1 );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
-        
+
         bv = new BinaryValue( BYTES2 );
         bv1 = bv.clone();
-        
+
         assertEquals( bv, bv1 );
-        
+
         bv.apply( at );
-        
+
         // 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( bv, bv1 );
     }
-    
+
 
     /**
      * Test the equals method
      */
-    @Test public void testEquals() throws LdapInvalidAttributeValueException
+    @Test
+    public void testEquals() throws LdapInvalidAttributeValueException
     {
         AttributeType at1 = EntryUtils.getBytesAttributeType();
-        
-        BinaryValue value1 = new BinaryValue( at1, new byte[]{0x01, (byte)0x02} );
-        BinaryValue value2 = new BinaryValue( at1, new byte[]{0x01, (byte)0x02} );
-        BinaryValue value3 = new BinaryValue( at1, new byte[]{0x01, (byte)0x82} );
-        BinaryValue value4 = new BinaryValue( at1, new byte[]{0x01} );
+
+        BinaryValue value1 = new BinaryValue( at1, new byte[]
+            { 0x01, ( byte ) 0x02 } );
+        BinaryValue value2 = new BinaryValue( at1, new byte[]
+            { 0x01, ( byte ) 0x02 } );
+        BinaryValue value3 = new BinaryValue( at1, new byte[]
+            { 0x01, ( byte ) 0x82 } );
+        BinaryValue value4 = new BinaryValue( at1, new byte[]
+            { 0x01 } );
         BinaryValue value5 = new BinaryValue( at1, null );
-        BinaryValue value6 = new BinaryValue( at, new byte[]{0x01, 0x02} );
+        BinaryValue value6 = new BinaryValue( at, new byte[]
+            { 0x01, 0x02 } );
         StringValue value7 = new StringValue( EntryUtils.getIA5StringAttributeType(),
             "test" );
-        
+
         assertTrue( value1.equals( value1 ) );
         assertTrue( value1.equals( value2 ) );
         assertTrue( value1.equals( value3 ) );
@@ -331,66 +349,69 @@ public class BinaryValueAttributeTypeTes
         assertFalse( value1.equals( value5 ) );
         assertFalse( value1.equals( "test" ) );
         assertFalse( value1.equals( null ) );
-        
+
         assertFalse( value1.equals( value6 ) );
         assertFalse( value1.equals( value7 ) );
     }
 
-    
+
     /**
      * Test the getNormValue method
      */
-    @Test public void testGetNormalizedValue() throws LdapInvalidAttributeValueException
+    @Test
+    public void testGetNormalizedValue() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         BinaryValue value = new BinaryValue( attribute, null );
         assertNull( value.getNormValue() );
 
         value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
-        assertTrue( Arrays.equals(  StringConstants.EMPTY_BYTES, value.getNormValue() ) );
+        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormValue() ) );
 
         value = new BinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormValue() ) );
     }
-    
-    
+
+
     /**
      * Test the getNormValue method
      */
-    @Test public void testGetNormalizedValueCopy() throws LdapInvalidAttributeValueException
+    @Test
+    public void testGetNormalizedValueCopy() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         BinaryValue value = new BinaryValue( attribute, null );
         assertNull( value.getNormValue() );
 
         value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
-        assertTrue( Arrays.equals(  StringConstants.EMPTY_BYTES, value.getNormValue() ) );
+        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormValue() ) );
 
         value = new BinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormValue() ) );
     }
-    
-    
+
+
     /**
      * Test the getNormValue method
      */
-    @Test public void testGetNormalizedValueReference() throws LdapInvalidAttributeValueException
+    @Test
+    public void testGetNormalizedValueReference() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         BinaryValue value = new BinaryValue( attribute, null );
         assertNull( value.getNormReference() );
 
         value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
-        assertTrue( Arrays.equals(  StringConstants.EMPTY_BYTES, value.getNormReference() ) );
+        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormReference() ) );
 
         value = new BinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormReference() ) );
     }
-    
-    
+
+
     /**
      * Test the getAttributeType method
      */
@@ -399,27 +420,30 @@ public class BinaryValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
         BinaryValue sbv = new BinaryValue( attribute );
-        
+
         assertEquals( attribute, sbv.getAttributeType() );
-    }    
+    }
+
 
-    
     /**
      * Test the isValid method
      * 
      * The SyntaxChecker does not accept values longer than 5 chars.
      */
-    @Test public void testIsValid() throws LdapInvalidAttributeValueException
+    @Test
+    public void testIsValid() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        
+
         new BinaryValue( attribute, null );
         new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
-        new BinaryValue( attribute, new byte[]{0x01, 0x02} );
+        new BinaryValue( attribute, new byte[]
+            { 0x01, 0x02 } );
 
         try
         {
-            new BinaryValue( attribute, new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06} );
+            new BinaryValue( attribute, new byte[]
+                { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } );
             fail();
         }
         catch ( LdapInvalidAttributeValueException liave )
@@ -427,18 +451,22 @@ public class BinaryValueAttributeTypeTes
             assertTrue( true );
         }
     }
-    
-    
+
+
     /**
      * Tests to make sure the hashCode method is working properly.
      * @throws Exception on errors
      */
-    @Test public void testHashCode() throws LdapInvalidAttributeValueException
+    @Test
+    public void testHashCode() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
-        BinaryValue v0 = new BinaryValue( attribute, new byte[]{0x01, 0x02} );
-        BinaryValue v1 = new BinaryValue( attribute, new byte[]{(byte)0x81, (byte)0x82} );
-        BinaryValue v2 = new BinaryValue( attribute, new byte[]{0x01, 0x02} );
+        BinaryValue v0 = new BinaryValue( attribute, new byte[]
+            { 0x01, 0x02 } );
+        BinaryValue v1 = new BinaryValue( attribute, new byte[]
+            { ( byte ) 0x81, ( byte ) 0x82 } );
+        BinaryValue v2 = new BinaryValue( attribute, new byte[]
+            { 0x01, 0x02 } );
         assertEquals( v0.hashCode(), v1.hashCode() );
         assertEquals( v1.hashCode(), v2.hashCode() );
         assertEquals( v0.hashCode(), v2.hashCode() );
@@ -446,7 +474,8 @@ public class BinaryValueAttributeTypeTes
         assertEquals( v0, v2 );
         assertEquals( v1, v2 );
 
-        BinaryValue v3 = new BinaryValue( attribute, new byte[]{0x01, 0x03} );
+        BinaryValue v3 = new BinaryValue( attribute, new byte[]
+            { 0x01, 0x03 } );
         assertFalse( v3.equals( v0 ) );
         assertFalse( v3.equals( v1 ) );
         assertFalse( v3.equals( v2 ) );
@@ -461,14 +490,14 @@ public class BinaryValueAttributeTypeTes
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
         BinaryValue sbv = new BinaryValue( attribute );
-        
+
         assertTrue( sbv.isInstanceOf( attribute ) );
-        
+
         attribute = EntryUtils.getIA5StringAttributeType();
-        
+
         assertFalse( sbv.isInstanceOf( attribute ) );
-    }    
-    
+    }
+
 
     /**
      * Test the normalize method
@@ -481,7 +510,7 @@ public class BinaryValueAttributeTypeTes
 
         bv.apply( at );
         assertEquals( null, bv.getNormValue() );
-        
+
         bv = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
         bv.apply( at );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );
@@ -490,7 +519,7 @@ public class BinaryValueAttributeTypeTes
         bv.apply( at );
         assertTrue( Arrays.equals( BYTES1, bv.getNormValue() ) );
     }
-    
+
 
     /**
      * Test the compareTo method
@@ -501,12 +530,12 @@ public class BinaryValueAttributeTypeTes
         AttributeType at1 = EntryUtils.getBytesAttributeType();
         BinaryValue v0 = new BinaryValue( at1, BYTES1 );
         BinaryValue v1 = new BinaryValue( at1, BYTES2 );
-        
+
         assertEquals( 0, v0.compareTo( v1 ) );
         assertEquals( 0, v1.compareTo( v0 ) );
 
         BinaryValue v2 = new BinaryValue( at1, null );
-        
+
         assertEquals( 1, v0.compareTo( v2 ) );
         assertEquals( -1, v2.compareTo( v0 ) );
     }
@@ -515,22 +544,23 @@ public class BinaryValueAttributeTypeTes
     /**
      * Test serialization of a BinaryValue which has a normalized value
      */
-    @Test public void testNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
-        byte[] v1 = Strings.getBytesUtf8("  Test   Test  ");
-        byte[] v1Norm = Strings.getBytesUtf8("Test   Test");
-        
+        byte[] v1 = Strings.getBytesUtf8( "  Test   Test  " );
+        byte[] v1Norm = Strings.getBytesUtf8( "Test   Test" );
+
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at, v1 );
-        
+
         sbv.apply( at );
         byte[] normalized = sbv.getNormReference();
-        
+
         assertTrue( Arrays.equals( v1Norm, normalized ) );
         assertTrue( Arrays.equals( v1, sbv.getReference() ) );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
     }
 
@@ -539,15 +569,16 @@ public class BinaryValueAttributeTypeTes
      * Test serialization of a BinaryValue which normalized value is the same
      * than the value
      */
-    @Test public void testNormalizedBinarySameValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testNormalizedBinarySameValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
-        byte[] v1 = Strings.getBytesUtf8("Test   Test");
-        
+        byte[] v1 = Strings.getBytesUtf8( "Test   Test" );
+
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at, v1 );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
     }
 
@@ -555,85 +586,89 @@ public class BinaryValueAttributeTypeTes
     /**
      * Test serialization of a BinaryValue which does not have a normalized value
      */
-    @Test public void testNoNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testNoNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
-        byte[] v1 = Strings.getBytesUtf8("test");
-        byte[] v1Norm = Strings.getBytesUtf8("test");
+        byte[] v1 = Strings.getBytesUtf8( "test" );
+        byte[] v1Norm = Strings.getBytesUtf8( "test" );
 
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at, v1 );
-        
+
         sbv.apply( at );
         byte[] normalized = sbv.getNormReference();
-        
+
         assertTrue( Arrays.equals( v1Norm, normalized ) );
         assertTrue( Arrays.equals( v1, sbv.getBytes() ) );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
-   }
+    }
 
 
     /**
      * Test serialization of a null BinaryValue
      */
-    @Test public void testNullBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testNullBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at );
-        
+
         sbv.apply( at );
         byte[] normalized = sbv.getNormReference();
-        
+
         assertEquals( null, normalized );
         assertEquals( null, sbv.getValue() );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
-   }
+    }
 
 
     /**
      * Test serialization of an empty BinaryValue
      */
-    @Test public void testEmptyBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testEmptyBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at, StringConstants.EMPTY_BYTES );
-        
+
         sbv.apply( at );
         byte[] normalized = sbv.getNormReference();
-        
+
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, normalized ) );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, sbv.getBytes() ) );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
-   }
+    }
 
 
     /**
      * Test serialization of a BinaryValue which is the same than the value
      */
-    @Test public void testSameNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
+    @Test
+    public void testSameNormalizedBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
     {
-        byte[] v1 = Strings.getBytesUtf8("test");
-        byte[] v1Norm = Strings.getBytesUtf8("test");
+        byte[] v1 = Strings.getBytesUtf8( "test" );
+        byte[] v1Norm = Strings.getBytesUtf8( "test" );
 
         // First check with a value which will be normalized
         BinaryValue sbv = new BinaryValue( at, v1 );
-        
+
         sbv.apply( at );
         byte[] normalized = sbv.getNormReference();
-        
+
         assertTrue( Arrays.equals( v1Norm, normalized ) );
         assertTrue( Arrays.equals( v1, sbv.getBytes() ) );
-        
+
         BinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
-        
+
         assertEquals( sbv, sbvSer );
-   }
+    }
 }
\ No newline at end of file

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=1235374&r1=1235373&r2=1235374&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 Tue Jan 24 17:44:03 2012
@@ -61,25 +61,31 @@ import com.mycila.junit.concurrent.Concu
 @Concurrency()
 public class BinaryValueTest
 {
-    private static final byte[] BYTES1 = new byte[]{0x01, 0x02, 0x03, 0x04};
-    private static final byte[] BYTES2 = new byte[]{(byte)0x81, (byte)0x82, (byte)0x83, (byte)0x84};
-    private static final byte[] INVALID_BYTES = new byte[]{0x01, 0x02, 0x03, 0x04, 0x05};
-    private static final byte[] BYTES_MOD = new byte[]{0x11, 0x02, 0x03, 0x04};
+    private static final byte[] BYTES1 = new byte[]
+        { 0x01, 0x02, 0x03, 0x04 };
+    private static final byte[] BYTES2 = new byte[]
+        { ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83, ( byte ) 0x84 };
+    private static final byte[] INVALID_BYTES = new byte[]
+        { 0x01, 0x02, 0x03, 0x04, 0x05 };
+    private static final byte[] BYTES_MOD = new byte[]
+        { 0x11, 0x02, 0x03, 0x04 };
     private LdapSyntax s;
     private AttributeType at;
     private MatchingRule mr;
-    
+
+
     /**
      * Initialize an AttributeType and the associated MatchingRule 
      * and Syntax
      */
-    @Before public void initAT()
+    @Before
+    public void initAT()
     {
         s = EntryUtils.syntaxFactory( "1.1.1.1", false );
         s.setSyntaxChecker( new OctetStringSyntaxChecker() );
         mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
         mr.setSyntax( s );
-        
+
         mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
         mr.setNormalizer( new Normalizer( "1.1.1" )
         {
@@ -89,27 +95,27 @@ public class BinaryValueTest
                 {
                     byte[] val = value.getBytes();
                     // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[ val.length ];
+                    byte[] newVal = new byte[val.length];
                     int i = 0;
-                    
-                    for ( byte b:val )
+
+                    for ( byte b : val )
                     {
-                        newVal[i++] = (byte)(b & 0x007F); 
+                        newVal[i++] = ( byte ) ( b & 0x007F );
                     }
-                    
-                    return new BinaryValue( Strings.trim(newVal) );
+
+                    return new BinaryValue( Strings.trim( newVal ) );
                 }
 
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
 
-        
+
             public String normalize( String value ) throws LdapException
             {
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
-        });
-        
+        } );
+
         at = new AttributeType( "1.1.3.1" );
         at.setEquality( mr );
         at.setOrdering( mr );
@@ -117,7 +123,6 @@ public class BinaryValueTest
         at.setSyntax( s );
     }
 
-    
     /**
      * A binary normalizer which set the normalized value to a empty byte array
      */
@@ -133,13 +138,13 @@ public class BinaryValueTest
             throw new IllegalStateException( "expected byte[] to normalize" );
         }
 
+
         public String normalize( String value ) throws LdapException
         {
             throw new IllegalStateException( "expected byte[] to normalize" );
         }
     };
 
-    
     private static final SyntaxChecker BINARY_CHECKER = new SyntaxChecker( "1.1.1" )
     {
         public boolean isValidSyntax( Object value )
@@ -148,12 +153,12 @@ public class BinaryValueTest
             {
                 return true;
             }
-            
-            return ((byte[])value).length < 5 ;
+
+            return ( ( byte[] ) value ).length < 5;
         }
     };
-    
-    
+
+
     /**
      * Serialize a BinaryValue
      */
@@ -186,15 +191,16 @@ public class BinaryValueTest
                 throw ioe;
             }
         }
-        
+
         return out;
     }
-    
-    
+
+
     /**
      * Deserialize a BinaryValue
      */
-    private BinaryValue deserializeValue( AttributeType at, ByteArrayOutputStream out ) throws IOException, ClassNotFoundException
+    private BinaryValue deserializeValue( AttributeType at, ByteArrayOutputStream out ) throws IOException,
+        ClassNotFoundException
     {
         ObjectInputStream oIn = null;
         ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -205,7 +211,7 @@ public class BinaryValueTest
 
             BinaryValue value = new BinaryValue( at );
             value.readExternal( oIn );
-            
+
             return value;
         }
         catch ( IOException ioe )
@@ -227,18 +233,18 @@ public class BinaryValueTest
             }
         }
     }
-    
-    
+
+
     @Test
     public void testHashCode()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         assertEquals( 0, bv.hashCode() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         int h = Arrays.hashCode( StringConstants.EMPTY_BYTES );
         assertEquals( h, bv.hashCode() );
-        
+
         h = Arrays.hashCode( BYTES1 );
         bv = new BinaryValue( BYTES1 );
         assertEquals( h, bv.hashCode() );
@@ -248,8 +254,8 @@ public class BinaryValueTest
     @Test
     public void testBinaryValueNull() throws LdapException
     {
-        BinaryValue cbv = new BinaryValue( (byte[])null );
-        
+        BinaryValue cbv = new BinaryValue( ( byte[] ) null );
+
         assertNull( cbv.getValue() );
         assertFalse( cbv.isSchemaAware() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
@@ -262,7 +268,7 @@ public class BinaryValueTest
     public void testBinaryValueEmpty() throws LdapException
     {
         BinaryValue cbv = new BinaryValue( StringConstants.EMPTY_BYTES );
-        
+
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, cbv.getBytes() ) );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, cbv.getValue() ) );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, cbv.getReference() ) );
@@ -279,7 +285,7 @@ public class BinaryValueTest
     public void testBinaryValue() throws LdapException
     {
         BinaryValue cbv = new BinaryValue( BYTES1 );
-        
+
         assertTrue( Arrays.equals( BYTES1, cbv.getBytes() ) );
         assertTrue( Arrays.equals( BYTES1, cbv.getValue() ) );
         assertTrue( Arrays.equals( BYTES1, cbv.getReference() ) );
@@ -294,10 +300,10 @@ public class BinaryValueTest
     @Test
     public void testSetByteArray() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         bv = new BinaryValue( BYTES1 );
-        
+
         assertTrue( Arrays.equals( BYTES1, bv.getBytes() ) );
         assertTrue( Arrays.equals( BYTES1, bv.getValue() ) );
         assertTrue( Arrays.equals( BYTES1, bv.getReference() ) );
@@ -310,10 +316,10 @@ public class BinaryValueTest
 
 
     @Test
-    public void testGetNormalizedValueCopy()  throws LdapException
+    public void testGetNormalizedValueCopy() throws LdapException
     {
         BinaryValue cbv = new BinaryValue( BYTES2 );
-        
+
         assertTrue( Arrays.equals( BYTES2, cbv.getBytes() ) );
         assertTrue( Arrays.equals( BYTES2, cbv.getValue() ) );
         assertTrue( Arrays.equals( BYTES2, cbv.getReference() ) );
@@ -322,11 +328,11 @@ public class BinaryValueTest
         assertFalse( cbv.isNull() );
         assertNotNull( cbv.getNormValue() );
         assertTrue( Arrays.equals( BYTES2, cbv.getNormValue() ) );
-        
+
         cbv.apply( at );
         byte[] copy = cbv.getNormValue();
         assertTrue( Arrays.equals( BYTES1, copy ) );
-        cbv.getNormReference()[0]=0x11;
+        cbv.getNormReference()[0] = 0x11;
         assertTrue( Arrays.equals( BYTES1, copy ) );
     }
 
@@ -334,18 +340,18 @@ public class BinaryValueTest
     @Test
     public void testNormalizeNormalizer() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
         assertEquals( null, bv.getNormValue() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
@@ -363,20 +369,20 @@ public class BinaryValueTest
     @Test
     public void testCompareToValueOfbyte() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue( (byte[])null );
-        BinaryValue bv2 = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv1 = new BinaryValue( ( byte[] ) null );
+        BinaryValue bv2 = new BinaryValue( ( byte[] ) null );
+
         assertEquals( 0, bv1.compareTo( bv2 ) );
-        
+
         bv1 = new BinaryValue( BYTES1 );
         assertEquals( 1, bv1.compareTo( bv2 ) );
 
         bv2 = new BinaryValue( BYTES2 );
         assertEquals( 1, bv1.compareTo( bv2 ) );
-        
+
         bv2.apply( at );
         assertEquals( 0, bv1.compareTo( bv2 ) );
-        
+
         bv1 = new BinaryValue( BYTES2 );
         assertEquals( -1, bv1.compareTo( bv2 ) );
     }
@@ -385,20 +391,20 @@ public class BinaryValueTest
     @Test
     public void testEquals() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue( (byte[])null );
-        BinaryValue bv2 = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv1 = new BinaryValue( ( byte[] ) null );
+        BinaryValue bv2 = new BinaryValue( ( byte[] ) null );
+
         assertEquals( bv1, bv2 );
-        
+
         bv1 = new BinaryValue( BYTES1 );
         assertNotSame( bv1, bv2 );
 
         bv2 = new BinaryValue( BYTES2 );
         assertNotSame( bv1, bv2 );
-        
+
         bv2.apply( at );
         assertEquals( bv1, bv2 );
-        
+
         bv1 = new BinaryValue( BYTES2 );
         assertNotSame( bv1, bv2 );
     }
@@ -407,19 +413,19 @@ public class BinaryValueTest
     @Test
     public void testClone()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         BinaryValue copy = bv.clone();
-        
+
         assertEquals( bv, copy );
-        
+
         bv = new BinaryValue( BYTES1 );
         assertNotSame( bv, copy );
-        
+
         copy = bv.clone();
         assertEquals( bv, copy );
 
         bv.getReference()[0] = 0x11;
-        
+
         assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
         assertTrue( Arrays.equals( BYTES1, copy.getBytes() ) );
     }
@@ -428,17 +434,17 @@ public class BinaryValueTest
     @Test
     public void testGetCopy()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertNull( bv.getValue() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertNotNull( bv.getValue() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getValue() ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         byte[] copy = bv.getValue();
-        
+
         assertTrue( Arrays.equals( BYTES1, copy ) );
 
         bv.getReference()[0] = 0x11;
@@ -450,15 +456,15 @@ public class BinaryValueTest
     @Test
     public void testCompareTo() throws LdapException
     {
-        BinaryValue bv1 = new BinaryValue( (byte[])null );
-        BinaryValue bv2 = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv1 = new BinaryValue( ( byte[] ) null );
+        BinaryValue bv2 = new BinaryValue( ( byte[] ) null );
+
         assertEquals( 0, bv1.compareTo( bv2 ) );
-        
+
         bv1 = new BinaryValue( BYTES1 );
         assertEquals( 1, bv1.compareTo( bv2 ) );
         assertEquals( -1, bv2.compareTo( bv1 ) );
-        
+
         bv2 = new BinaryValue( BYTES1 );
         assertEquals( 0, bv1.compareTo( bv2 ) );
 
@@ -467,7 +473,7 @@ public class BinaryValueTest
         bv2 = new BinaryValue( BYTES1 );
         bv1.apply( at );
         assertEquals( 0, bv1.compareTo( bv2 ) );
-        
+
         bv1 = new BinaryValue( BYTES1 );
         bv2 = new BinaryValue( BYTES2 );
         assertEquals( 1, bv1.compareTo( bv2 ) );
@@ -481,8 +487,8 @@ public class BinaryValueTest
     @Test
     public void testToString()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertEquals( "null", bv.toString() );
 
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
@@ -496,17 +502,17 @@ public class BinaryValueTest
     @Test
     public void testGetReference()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertNull( bv.getReference() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertNotNull( bv.getReference() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getReference() ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         byte[] reference = bv.getReference();
-        
+
         assertTrue( Arrays.equals( BYTES1, reference ) );
 
         bv.getReference()[0] = 0x11;
@@ -518,17 +524,17 @@ public class BinaryValueTest
     @Test
     public void testGet()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertNull( bv.getValue() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertNotNull( bv.getValue() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         byte[] get = bv.getBytes();
-        
+
         assertTrue( Arrays.equals( BYTES1, get ) );
 
         bv.getReference()[0] = 0x11;
@@ -540,20 +546,20 @@ public class BinaryValueTest
     @Test
     public void testGetNormalizedValue() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertFalse( bv.isSchemaAware() );
 
         bv.apply( at );
         byte[] value = bv.getNormValue();
         assertNull( value );
         assertTrue( bv.isSchemaAware() );
-        
+
         bv = new BinaryValue( BYTES2 );
         bv.apply( at );
         value = bv.getNormValue();
         assertTrue( Arrays.equals( BYTES1, value ) );
-        bv.getNormReference()[0]=0x11;
+        bv.getNormReference()[0] = 0x11;
         assertFalse( Arrays.equals( BYTES_MOD, value ) );
     }
 
@@ -561,20 +567,20 @@ public class BinaryValueTest
     @Test
     public void testGetNormalizedValueReference() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertFalse( bv.isSchemaAware() );
 
         bv.apply( at );
         byte[] value = bv.getNormReference();
         assertNull( value );
         assertTrue( bv.isSchemaAware() );
-        
+
         bv = new BinaryValue( BYTES2 );
         bv.apply( at );
         value = bv.getNormReference();
         assertTrue( Arrays.equals( BYTES1, value ) );
-        bv.getNormReference()[0]=0x11;
+        bv.getNormReference()[0] = 0x11;
         assertTrue( Arrays.equals( BYTES_MOD, value ) );
     }
 
@@ -582,13 +588,13 @@ public class BinaryValueTest
     @Test
     public void testIsNull()
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertTrue( bv.isNull() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertFalse( bv.isNull() );
-        
+
         bv = new BinaryValue( BYTES1 );
         assertFalse( bv.isNull() );
     }
@@ -597,13 +603,13 @@ public class BinaryValueTest
     @Test
     public void testIsValid() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertTrue( bv.isValid( BINARY_CHECKER ) );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         assertFalse( bv.isNull() );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
@@ -617,13 +623,13 @@ public class BinaryValueTest
     @Test
     public void testIsValidSyntaxChecker() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
-        assertTrue( bv.isValid( BINARY_CHECKER ) ) ;
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
+        assertTrue( bv.isValid( BINARY_CHECKER ) );
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
-        
+
         bv = new BinaryValue( BYTES1 );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
 
@@ -635,17 +641,17 @@ public class BinaryValueTest
     @Test
     public void testNormalize() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
         assertEquals( null, bv.getNormValue() );
-        
+
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );
-        
+
         bv = new BinaryValue( BYTES2 );
         bv.apply( at );
         assertTrue( bv.isSchemaAware() );
@@ -657,8 +663,8 @@ public class BinaryValueTest
     @Test
     public void testSet() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertNull( bv.getValue() );
         assertFalse( bv.isSchemaAware() );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
@@ -683,17 +689,17 @@ public class BinaryValueTest
     @Test
     public void testIsNormalized() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         assertFalse( bv.isSchemaAware() );
-        
+
         bv = new BinaryValue( BYTES2 );
         assertFalse( bv.isSchemaAware() );
-        
+
         bv.apply( at );
-        
+
         assertTrue( Arrays.equals( BYTES1, bv.getNormValue() ) );
         assertTrue( bv.isSchemaAware() );
-        
+
         bv = new BinaryValue( BYTES2 );
         assertFalse( bv.isSchemaAware() );
 
@@ -705,29 +711,29 @@ public class BinaryValueTest
     @Test
     public void testSetNormalized() throws LdapException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+
         assertFalse( bv.isSchemaAware() );
-        
+
         bv = new BinaryValue( BYTES2 );
         assertFalse( bv.isSchemaAware() );
-        
+
         bv.apply( at );
-        
+
         assertTrue( Arrays.equals( BYTES1, bv.getNormValue() ) );
         assertTrue( bv.isSchemaAware() );
-        
+
         assertTrue( Arrays.equals( BYTES2, bv.getValue() ) );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with a value and a normalized value
      */
     @Test
     public void testSerializeStandard() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         bv = new BinaryValue( BYTES2 );
         bv.apply( at );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
@@ -738,15 +744,15 @@ public class BinaryValueTest
         assertTrue( Arrays.equals( bv.getNormReference(), cbvSer.getNormReference() ) );
         assertTrue( cbvSer.isSchemaAware() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with a value and no normalized value
      */
     @Test
     public void testSerializeNotNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         bv = new BinaryValue( BYTES2 );
         bv.isValid( BINARY_CHECKER );
 
@@ -756,15 +762,15 @@ public class BinaryValueTest
         assertTrue( Arrays.equals( bv.getReference(), cbvSer.getNormReference() ) );
         assertFalse( cbvSer.isSchemaAware() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with a value and an empty normalized value
      */
     @Test
     public void testSerializeEmptyNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         bv = new BinaryValue( BYTES2 );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
@@ -775,16 +781,16 @@ public class BinaryValueTest
         assertTrue( Arrays.equals( bv.getNormReference(), cbvSer.getNormReference() ) );
         assertTrue( cbvSer.isSchemaAware() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with a null value
      */
     @Test
     public void testSerializeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
-        bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
+        bv = new BinaryValue( ( byte[] ) null );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
 
@@ -794,15 +800,15 @@ public class BinaryValueTest
         assertTrue( Arrays.equals( bv.getNormReference(), cbvSer.getNormReference() ) );
         assertTrue( cbvSer.isSchemaAware() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with an empty value
      */
     @Test
     public void testSerializeEmptyValue() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.isValid( BINARY_CHECKER );
         bv.apply( at );
@@ -813,15 +819,15 @@ public class BinaryValueTest
         assertTrue( Arrays.equals( bv.getNormReference(), cbvSer.getNormReference() ) );
         assertTrue( cbvSer.isSchemaAware() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a CBV with an empty value not normalized
      */
     @Test
     public void testSerializeEmptyValueNotNormalized() throws LdapException, IOException, ClassNotFoundException
     {
-        BinaryValue bv = new BinaryValue( (byte[])null );
+        BinaryValue bv = new BinaryValue( ( byte[] ) null );
         bv = new BinaryValue( StringConstants.EMPTY_BYTES );
         bv.isValid( BINARY_CHECKER );
 



Mime
View raw message