You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 18:27:12 UTC

svn commit: r1235364 [6/27] - in /directory/shared/trunk: asn1/api/src/main/java/org/apache/directory/shared/asn1/util/ asn1/api/src/test/java/org/apache/directory/shared/asn1/util/ asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/ asn1/...

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryTest.java Tue Jan 24 17:27:00 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.directory.shared.ldap.entry;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -56,6 +57,7 @@ import org.junit.runner.RunWith;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
+
 /**
  * A test class for the DefaultEntry class
  * 
@@ -66,12 +68,16 @@ import com.mycila.junit.concurrent.Concu
 public class SchemaAwareEntryTest
 {
     private static Dn EXAMPLE_DN;
-    private static final byte[] BYTES1 = new byte[]{ 'a', 'b' };
-    private static final byte[] BYTES2 = new byte[]{ 'b' };
-    private static final byte[] BYTES3 = new byte[]{ 'c' };
-    
+    private static final byte[] BYTES1 = new byte[]
+        { 'a', 'b' };
+    private static final byte[] BYTES2 = new byte[]
+        { 'b' };
+    private static final byte[] BYTES3 = new byte[]
+        { 'c' };
+
     private static SchemaManager schemaManager;
-    
+
+
     /**
      * Helper method which creates an entry with 4 attributes.
      */
@@ -80,14 +86,14 @@ public class SchemaAwareEntryTest
         try
         {
             Entry entry = new DefaultEntry( EXAMPLE_DN );
-            
+
             Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
             Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
             Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
             Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
-            
+
             entry.put( attrOC, attrCN, attrSN, attrPWD );
-            
+
             return entry;
         }
         catch ( LdapException ne )
@@ -130,11 +136,11 @@ public class SchemaAwareEntryTest
                 throw ioe;
             }
         }
-        
+
         return out;
     }
-    
-    
+
+
     /**
      * Deserialize a ClientEntry
      */
@@ -171,7 +177,7 @@ public class SchemaAwareEntryTest
         }
     }
 
-    
+
     /**
      * @throws java.lang.Exception
      */
@@ -190,7 +196,7 @@ public class SchemaAwareEntryTest
     public void testDefaultClientEntry()
     {
         Entry entry = new DefaultEntry();
-        
+
         assertNotNull( entry );
         assertEquals( Dn.EMPTY_DN, entry.getDn() );
         assertEquals( 0, entry.size() );
@@ -203,13 +209,13 @@ public class SchemaAwareEntryTest
     @Test
     public void testDefaultClientEntryLdif() throws Exception
     {
-        Entry entry = new DefaultEntry( 
+        Entry entry = new DefaultEntry(
             "ou=example, dc=com",
             "ObjectClass: top",
             "ObjectClass: person",
             "cn: test",
             "sn: test" );
-        
+
         assertNotNull( entry );
         assertEquals( "ou=example, dc=com", entry.getDn().toString() );
         assertEquals( 3, entry.size() );
@@ -226,7 +232,7 @@ public class SchemaAwareEntryTest
     public void testDefaultClientEntryLdapDN()
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertNotNull( entry );
         assertNotNull( entry.getDn() );
         assertEquals( EXAMPLE_DN, entry.getDn() );
@@ -241,23 +247,23 @@ public class SchemaAwareEntryTest
     public void testAddEntryAttributeArray() throws LdapException
     {
         Entry entry = createEntry();
-        
+
         assertEquals( 4, entry.size() );
         assertTrue( entry.containsAttribute( "ObjectClass" ) );
         assertTrue( entry.containsAttribute( "CN" ) );
         assertTrue( entry.containsAttribute( "  sn  " ) );
         assertTrue( entry.containsAttribute( "userPassword" ) );
-    
+
         Attribute attr = entry.get( "objectclass" );
         assertEquals( 2, attr.size() );
-        
+
         Attribute attrCN2 = new DefaultAttribute( "cn", "test1", "test3" );
         entry.add( attrCN2 );
         assertEquals( 4, entry.size() );
         attr = entry.get( "cn" );
         assertEquals( 3, attr.size() );
         assertTrue( attr.contains( "test1", "test2", "test3" ) );
-        
+
         // Check adding some byte[] values (they will not be transformed to Strings)
         attrCN2.clear();
         attrCN2.add( BYTES1, BYTES2 );
@@ -277,14 +283,14 @@ public class SchemaAwareEntryTest
     public void testAddStringByteArrayArray() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        
-        entry.add( "userPassword", (byte[])null );
+
+        entry.add( "userPassword", ( byte[] ) null );
         assertEquals( 1, entry.size() );
         Attribute attributePWD = entry.get( "userPassword" );
         assertEquals( 1, attributePWD.size() );
         assertNotNull( attributePWD.get() );
         assertNull( attributePWD.get().getValue() );
-        
+
         entry.add( "jpegPhoto", BYTES1, BYTES1, BYTES2 );
         assertEquals( 2, entry.size() );
         Attribute attributeJPG = entry.get( "jpegPhoto" );
@@ -302,14 +308,14 @@ public class SchemaAwareEntryTest
     public void testAddStringStringArray() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        
-        entry.add( "cn", (String)null );
+
+        entry.add( "cn", ( String ) null );
         assertEquals( 1, entry.size() );
         Attribute attributeCN = entry.get( "cn" );
         assertEquals( 1, attributeCN.size() );
         assertNotNull( attributeCN.get() );
         assertNull( attributeCN.get().getValue() );
-        
+
         entry.add( "sn", "test", "test", "TEST" );
         assertEquals( 2, entry.size() );
         Attribute attributeSN = entry.get( "sn" );
@@ -327,16 +333,16 @@ public class SchemaAwareEntryTest
     public void testAddStringValueArray() throws LdapException
     {
         Entry entry = new DefaultEntry();
-        
-        Value<String> value = new StringValue( (String)null );
-        
+
+        Value<String> value = new StringValue( ( String ) null );
+
         entry.add( "cn", value );
         assertEquals( 1, entry.size() );
         Attribute attributeCN = entry.get( "cn" );
         assertEquals( 1, attributeCN.size() );
         assertNotNull( attributeCN.get() );
         assertNull( attributeCN.get().getValue() );
-        
+
         Value<String> value1 = new StringValue( "test1" );
         Value<String> value2 = new StringValue( "test2" );
         Value<String> value3 = new StringValue( "test1" );
@@ -348,7 +354,7 @@ public class SchemaAwareEntryTest
         assertNotNull( attributeSN.get() );
         assertTrue( attributeSN.contains( value1 ) );
         assertTrue( attributeSN.contains( value2 ) );
-        
+
         Value<byte[]> value4 = new BinaryValue( BYTES1 );
         entry.add( "l", value1, value4 );
         assertEquals( 3, entry.size() );
@@ -356,14 +362,12 @@ public class SchemaAwareEntryTest
         assertEquals( 2, attributeL.size() );
         assertNotNull( attributeL.get() );
         assertTrue( attributeL.contains( value1 ) );
-        
+
         // The byte[] value must have been transformed to a String
         assertTrue( attributeL.contains( "ab" ) );
     }
 
 
-
-
     /**
      * Test method for clear()
      */
@@ -371,17 +375,17 @@ public class SchemaAwareEntryTest
     public void testClear() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertEquals( 0, entry.size() );
         assertNull( entry.get( "ObjectClass" ) );
         entry.clear();
         assertEquals( 0, entry.size() );
         assertNull( entry.get( "ObjectClass" ) );
-        
+
         entry.add( "ObjectClass", "top", "person" );
         assertEquals( 1, entry.size() );
         assertNotNull( entry.get( "ObjectClass" ) );
-        
+
         entry.clear();
         assertEquals( 0, entry.size() );
         assertNull( entry.get( "ObjectClass" ) );
@@ -395,33 +399,33 @@ public class SchemaAwareEntryTest
     public void testClone() throws LdapException
     {
         Entry entry1 = new DefaultEntry();
-        
+
         Entry entry2 = entry1.clone();
-        
+
         assertEquals( entry1, entry2 );
         entry2.setDn( EXAMPLE_DN );
-        
+
         assertEquals( Dn.EMPTY_DN, entry1.getDn() );
-        
+
         entry1.setDn( EXAMPLE_DN );
         entry2 = entry1.clone();
         assertEquals( entry1, entry2 );
-        
+
         entry1.add( "objectClass", "top", "person" );
         entry1.add( "cn", "test1", "test2" );
-        
+
         entry2 = entry1.clone();
         assertEquals( entry1, entry2 );
-        
+
         entry1.add( "cn", "test3" );
         assertEquals( 2, entry2.get( "cn" ).size() );
         assertFalse( entry2.contains( "cn", "test3" ) );
-        
-        entry1.add( "sn", (String)null );
+
+        entry1.add( "sn", ( String ) null );
         assertFalse( entry2.containsAttribute( "sn" ) );
     }
 
-    
+
     /**
      * Test method for contains( EntryAttribute... )
      */
@@ -429,19 +433,19 @@ public class SchemaAwareEntryTest
     public void testContainsEntryAttributeArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
 
         assertFalse( entry.contains( attrOC, attrCN ) );
-        
+
         entry.add( attrOC, attrCN );
 
         assertTrue( entry.contains( attrOC, attrCN ) );
         assertFalse( entry.contains( attrOC, attrCN, attrSN ) );
-        
+
         entry.add( attrSN, attrPWD );
 
         assertTrue( entry.contains( attrSN, attrPWD ) );
@@ -455,16 +459,16 @@ public class SchemaAwareEntryTest
     public void testContainsStringByteArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertFalse( entry.containsAttribute( "objectClass" ) );
-        
-        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, (byte[])null, BYTES2 );
+
+        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
 
         entry.add( attrPWD );
-        
+
         assertTrue( entry.contains( "  userPASSWORD  ", BYTES1, BYTES2 ) );
-        assertTrue( entry.contains( "  userPASSWORD  ", (byte[])null ) );
-        
+        assertTrue( entry.contains( "  userPASSWORD  ", ( byte[] ) null ) );
+
         // We can search for byte[] using Strings. the strings will be converted to byte[]
         assertTrue( entry.contains( "  userPASSWORD  ", "ab", "b" ) );
 
@@ -479,25 +483,25 @@ public class SchemaAwareEntryTest
     public void testContainsStringStringArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertFalse( entry.containsAttribute( "objectClass" ) );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
-        Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2", (String)null );
+        Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2", ( String ) null );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
 
         entry.add( attrOC, attrCN, attrSN, attrPWD );
-        
+
         assertTrue( entry.contains( "OBJECTCLASS", "top", "person" ) );
         assertTrue( entry.contains( " cn ", "test1", "test2" ) );
-        assertTrue( entry.contains( "Sn", "Test1", "Test2", (String)null ) );
+        assertTrue( entry.contains( "Sn", "Test1", "Test2", ( String ) null ) );
         assertTrue( entry.contains( "  userPASSWORD  ", "ab", "b" ) );
-        
+
         assertFalse( entry.contains( "OBJECTCLASS", "PERSON" ) );
         assertFalse( entry.contains( " cn ", "test1", "test3" ) );
         assertFalse( entry.contains( "Sn", "Test" ) );
-        assertFalse( entry.contains( "  userPASSWORD  ", (String)null ) );
+        assertFalse( entry.contains( "  userPASSWORD  ", ( String ) null ) );
     }
 
 
@@ -508,27 +512,27 @@ public class SchemaAwareEntryTest
     public void testContainsStringValueArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertFalse( entry.containsAttribute( "objectClass" ) );
-        
-        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", (String)null );
-        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, (byte[])null );
+
+        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", ( String ) null );
+        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, ( byte[] ) null );
 
         entry.add( attrCN, attrPWD );
-        
+
         Value<String> strValue1 = new StringValue( "test1" );
         Value<String> strValue2 = new StringValue( "test2" );
         Value<String> strValue3 = new StringValue( "test3" );
-        Value<String> strNullValue = new StringValue( (String)null);
+        Value<String> strNullValue = new StringValue( ( String ) null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
         Value<byte[]> binValue3 = new BinaryValue( BYTES3 );
-        Value<byte[]> binNullValue = new BinaryValue( (byte[])null );
+        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
 
         assertTrue( entry.contains( "CN", strValue1, strValue2, strNullValue ) );
         assertTrue( entry.contains( "userpassword", binValue1, binValue2, binNullValue ) );
-        
+
         assertFalse( entry.contains( "cn", strValue3 ) );
         assertFalse( entry.contains( "UserPassword", binValue3 ) );
     }
@@ -541,21 +545,21 @@ public class SchemaAwareEntryTest
     public void testContainsAttribute() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertFalse( entry.containsAttribute( "objectClass" ) );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
 
         entry.add( attrOC, attrCN, attrSN, attrPWD );
-        
+
         assertTrue( entry.containsAttribute( "OBJECTCLASS" ) );
         assertTrue( entry.containsAttribute( " cn " ) );
         assertTrue( entry.containsAttribute( "Sn" ) );
         assertTrue( entry.containsAttribute( "  userPASSWORD  " ) );
-        
+
         entry.clear();
 
         assertFalse( entry.containsAttribute( "OBJECTCLASS" ) );
@@ -573,12 +577,12 @@ public class SchemaAwareEntryTest
     {
         Entry entry1 = new DefaultEntry();
         Entry entry2 = new DefaultEntry();
-        
+
         assertEquals( entry1, entry2 );
-        
+
         entry1.setDn( EXAMPLE_DN );
         assertNotSame( entry1, entry2 );
-        
+
         entry2.setDn( EXAMPLE_DN );
         assertEquals( entry1, entry2 );
 
@@ -586,21 +590,21 @@ public class SchemaAwareEntryTest
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
-        
+
         entry1.put( attrOC, attrCN, attrSN, attrPWD );
         entry2.put( attrOC, attrCN, attrSN );
         assertNotSame( entry1, entry2 );
-        
+
         entry2.put( attrPWD );
         assertEquals( entry1, entry2 );
-        
+
         Attribute attrL1 = new DefaultAttribute( "l", "Paris", "New-York" );
         Attribute attrL2 = new DefaultAttribute( "l", "Paris", "Tokyo" );
-        
+
         entry1.put( attrL1 );
         entry2.put( attrL1 );
         assertEquals( entry1, entry2 );
-        
+
         entry1.add( "l", "London" );
         assertNotSame( entry1, entry2 );
 
@@ -620,22 +624,22 @@ public class SchemaAwareEntryTest
     public void testGet() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertNull( entry.get( "objectClass" ) );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
 
         entry.add( attrOC, attrCN, attrSN, attrPWD );
-        
+
         assertNotNull( entry.get( "  CN  " ) );
         Attribute attribute = entry.get( "cN" );
-        
+
         assertEquals( attribute, attrCN );
-        
-        assertNull( entry.get( (String)null ) );
+
+        assertNull( entry.get( ( String ) null ) );
         assertNull( entry.get( "  " ) );
         assertNull( entry.get( "l" ) );
     }
@@ -645,15 +649,15 @@ public class SchemaAwareEntryTest
      * Test method for getDN()
      */
     @Test
-    public void testGetDn() throws LdapException 
+    public void testGetDn() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertEquals( EXAMPLE_DN, entry.getDn() );
-        
+
         Dn testDn = new Dn( "cn=test" );
         entry.setDn( testDn );
-        
+
         assertEquals( testDn, entry.getDn() );
     }
 
@@ -666,16 +670,15 @@ public class SchemaAwareEntryTest
     {
         Entry entry1 = new DefaultEntry( EXAMPLE_DN );
         Entry entry2 = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertEquals( entry1.hashCode(), entry2.hashCode() );
-        
+
         entry2.setDn( new Dn( "ou=system,dc=com" ) );
         assertNotSame( entry1.hashCode(), entry2.hashCode() );
-        
+
         entry2.setDn( EXAMPLE_DN );
         assertEquals( entry1.hashCode(), entry2.hashCode() );
-        
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
@@ -685,14 +688,14 @@ public class SchemaAwareEntryTest
         entry2.add( attrOC, attrCN, attrSN, attrPWD );
 
         assertEquals( entry1.hashCode(), entry2.hashCode() );
-        
+
         Entry entry3 = new DefaultEntry( EXAMPLE_DN );
         entry3.add( attrOC, attrSN, attrCN, attrPWD );
 
         assertEquals( entry1.hashCode(), entry3.hashCode() );
     }
 
-    
+
     /**
      * Test method for hasObjectClass( String )
      */
@@ -700,20 +703,20 @@ public class SchemaAwareEntryTest
     public void testHasObjectClass() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertFalse( entry.containsAttribute( "objectClass" ) );
         assertFalse( entry.hasObjectClass( "top" ) );
-        
+
         entry.add( new DefaultAttribute( "objectClass", "top", "person" ) );
-        
+
         assertTrue( entry.hasObjectClass( "top" ) );
         assertTrue( entry.hasObjectClass( "person" ) );
         assertFalse( entry.hasObjectClass( "inetorgperson" ) );
-        assertFalse( entry.hasObjectClass( (String)null ) );
+        assertFalse( entry.hasObjectClass( ( String ) null ) );
         assertFalse( entry.hasObjectClass( "" ) );
     }
 
-    
+
     /**
      * Test method for Iterator()
      */
@@ -721,30 +724,30 @@ public class SchemaAwareEntryTest
     public void testIterator() throws LdapException
     {
         Entry entry = createEntry();
-        
+
         Iterator<Attribute> iterator = entry.iterator();
-        
+
         assertTrue( iterator.hasNext() );
-        
+
         Set<String> expectedIds = new HashSet<String>();
         expectedIds.add( "objectclass" );
         expectedIds.add( "cn" );
         expectedIds.add( "sn" );
         expectedIds.add( "userpassword" );
-        
+
         while ( iterator.hasNext() )
         {
             Attribute attribute = iterator.next();
-            
+
             String id = attribute.getId();
             assertTrue( expectedIds.contains( id ) );
             expectedIds.remove( id );
         }
-        
+
         assertEquals( 0, expectedIds.size() );
     }
 
-    
+
     /**
      * Test method for put( EntryAttribute... )
      */
@@ -752,21 +755,21 @@ public class SchemaAwareEntryTest
     public void testPutEntryAttributeArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
-        
+
         List<Attribute> removed = entry.put( attrOC, attrCN, attrSN, attrPWD );
-        
+
         assertEquals( 4, entry.size() );
         assertEquals( 0, removed.size() );
         assertTrue( entry.containsAttribute( "ObjectClass" ) );
         assertTrue( entry.containsAttribute( "CN" ) );
         assertTrue( entry.containsAttribute( "  sn  " ) );
         assertTrue( entry.containsAttribute( "userPassword" ) );
-        
+
         Attribute attrCN2 = new DefaultAttribute( "cn", "test3", "test4" );
         removed = entry.put( attrCN2 );
         assertEquals( 4, entry.size() );
@@ -783,34 +786,34 @@ public class SchemaAwareEntryTest
     public void testPutStringByteArrayArray()
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         try
         {
-            entry.put( (String)null, BYTES1 );
+            entry.put( ( String ) null, BYTES1 );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
+
         try
         {
             entry.put( "   ", BYTES1 );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
-        entry.put( "userPassword", (byte[])null );
+
+        entry.put( "userPassword", ( byte[] ) null );
         assertEquals( 1, entry.size() );
         assertNotNull( entry.get( "userPassword" ) );
         assertEquals( 1, entry.get( "userPassword" ).size() );
         assertNull( entry.get( "userPassword" ).get().getValue() );
-        
-        entry.put(  "jpegPhoto", BYTES1, BYTES2, BYTES1 );
+
+        entry.put( "jpegPhoto", BYTES1, BYTES2, BYTES1 );
         assertEquals( 2, entry.size() );
         assertNotNull( entry.get( "jpegPhoto" ) );
         assertEquals( 2, entry.get( "JPEGPhoto" ).size() );
@@ -829,34 +832,34 @@ public class SchemaAwareEntryTest
     public void testPutStringStringArray()
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         try
         {
-            entry.put( (String)null, "a" );
+            entry.put( ( String ) null, "a" );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
+
         try
         {
             entry.put( "   ", "a" );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
-        entry.put( "sn", (String)null );
+
+        entry.put( "sn", ( String ) null );
         assertEquals( 1, entry.size() );
         assertNotNull( "sn", entry.get( "sn" ) );
         assertEquals( 1, entry.get( "sn" ).size() );
         assertNull( entry.get( "sn" ).get().getValue() );
-        
-        entry.put(  "ObjectClass", "top", "person", "top" );
+
+        entry.put( "ObjectClass", "top", "person", "top" );
         assertEquals( 2, entry.size() );
         assertNotNull( "objectclass", entry.get( "sn" ) );
         assertEquals( 2, entry.get( "OBJECTCLASS" ).size() );
@@ -875,74 +878,74 @@ public class SchemaAwareEntryTest
     public void testPutStringValueArray()
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         Value<String> strValueTop = new StringValue( "top" );
         Value<String> strValuePerson = new StringValue( "person" );
         Value<String> strValueTop2 = new StringValue( "top" );
-        Value<String> strNullValue = new StringValue( (String)null );
+        Value<String> strNullValue = new StringValue( ( String ) null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
         Value<byte[]> binValue3 = new BinaryValue( BYTES1 );
-        Value<byte[]> binNullValue = new BinaryValue( (byte[])null );
+        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
 
         try
         {
-            entry.put( (String)null, strValueTop );
+            entry.put( ( String ) null, strValueTop );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
+
         try
         {
             entry.put( "   ", strValueTop );
             fail();
         }
-        catch ( IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
             assertTrue( true );
         }
-        
+
         entry.put( "sn", strNullValue );
         assertEquals( 1, entry.size() );
         assertNotNull( "sn", entry.get( "sn" ) );
         assertEquals( 1, entry.get( "sn" ).size() );
         assertNull( entry.get( "sn" ).get().getValue() );
-        
+
         entry.clear();
-        
-        entry.put(  "ObjectClass", strValueTop, strValuePerson, strValueTop2, strNullValue );
+
+        entry.put( "ObjectClass", strValueTop, strValuePerson, strValueTop2, strNullValue );
         assertEquals( 1, entry.size() );
         assertNotNull( "objectclass", entry.get( "objectclass" ) );
         assertEquals( 3, entry.get( "OBJECTCLASS" ).size() );
         Attribute attribute = entry.get( "objectClass" );
         assertTrue( attribute.contains( "top" ) );
         assertTrue( attribute.contains( "person" ) );
-        assertTrue( attribute.contains( (String)null ) );
+        assertTrue( attribute.contains( ( String ) null ) );
         assertEquals( "objectclass", attribute.getId() );
         assertEquals( "ObjectClass", attribute.getUpId() );
 
         entry.clear();
-        
+
         entry.put( "userpassword", strNullValue );
         assertEquals( 1, entry.size() );
         assertNotNull( "userpassword", entry.get( "userpassword" ) );
         assertEquals( 1, entry.get( "userpassword" ).size() );
         assertNull( entry.get( "userpassword" ).get().getValue() );
-        
+
         entry.clear();
-        
-        entry.put(  "userPassword", binValue1, binValue2, binValue3, binNullValue );
+
+        entry.put( "userPassword", binValue1, binValue2, binValue3, binNullValue );
         assertEquals( 1, entry.size() );
         assertNotNull( "userpassword", entry.get( "userpassword" ) );
         assertEquals( 3, entry.get( "userpassword" ).size() );
         attribute = entry.get( "userpassword" );
         assertTrue( attribute.contains( BYTES1 ) );
         assertTrue( attribute.contains( BYTES2 ) );
-        assertTrue( attribute.contains( (byte[])null ) );
+        assertTrue( attribute.contains( ( byte[] ) null ) );
         assertEquals( "userpassword", attribute.getId() );
         assertEquals( "userPassword", attribute.getUpId() );
     }
@@ -960,22 +963,22 @@ public class SchemaAwareEntryTest
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
-        
+
         entry.put( attrOC, attrCN, attrSN, attrPWD );
-        
+
         entry.removeAttributes( "CN", "SN" );
-        
+
         assertFalse( entry.containsAttribute( "cn", "sn" ) );
         assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) );
-        
+
         List<Attribute> removed = entry.removeAttributes( "badId" );
         assertNull( removed );
-        
-        removed = entry.removeAttributes( (String )null );
+
+        removed = entry.removeAttributes( ( String ) null );
         assertNull( removed );
     }
-    
-    
+
+
     /**
      * Test method for remove( EntryAttribute... )
      */
@@ -983,17 +986,17 @@ public class SchemaAwareEntryTest
     public void testRemoveEntryAttributeArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
         Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
         Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
         Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
-        
+
         entry.put( attrOC, attrCN, attrSN, attrPWD );
-        
+
         List<Attribute> removed = entry.remove( attrSN, attrPWD );
-        
-        assertEquals( 2, removed.size() ); 
+
+        assertEquals( 2, removed.size() );
         assertEquals( 2, entry.size() );
         assertTrue( removed.contains( attrSN ) );
         assertTrue( removed.contains( attrPWD ) );
@@ -1003,7 +1006,7 @@ public class SchemaAwareEntryTest
         assertFalse( entry.containsAttribute( "userPassword" ) );
 
         removed = entry.remove( attrSN, attrPWD );
-        
+
         assertEquals( 0, removed.size() );
     }
 
@@ -1015,21 +1018,21 @@ public class SchemaAwareEntryTest
     public void testRemoveStringByteArrayArray() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
-        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, (byte[])null, BYTES2 );
+
+        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
 
         entry.put( attrPWD );
-        assertTrue( entry.remove( "userPassword", (byte[])null ) );
+        assertTrue( entry.remove( "userPassword", ( byte[] ) null ) );
         assertTrue( entry.remove( "userPassword", BYTES1, BYTES2 ) );
         assertFalse( entry.containsAttribute( "userPassword" ) );
-        
-        entry.add( "userPassword", BYTES1, (byte[])null, BYTES2 );
-        assertTrue( entry.remove( "userPassword", (byte[])null ) );
+
+        entry.add( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
+        assertTrue( entry.remove( "userPassword", ( byte[] ) null ) );
         assertEquals( 2, entry.get( "userPassword" ).size() );
         assertTrue( entry.remove( "userPassword", BYTES1, BYTES3 ) );
         assertEquals( 1, entry.get( "userPassword" ).size() );
         assertTrue( Arrays.equals( BYTES2, entry.get( "userPassword" ).getBytes() ) );
-        
+
         assertFalse( entry.remove( "userPassword", BYTES3 ) );
         assertFalse( entry.remove( "void", "whatever" ) );
     }
@@ -1042,18 +1045,18 @@ public class SchemaAwareEntryTest
     public void testRemoveStringStringArray() throws LdapException
     {
         Entry entry = createEntry();
-        
+
         assertTrue( entry.remove( "cn", "test1" ) );
         assertTrue( entry.remove( "cn", "test2" ) );
         assertFalse( entry.containsAttribute( "cn" ) );
-        
-        entry.add( "cn", "test1", (String)null, "test2" );
-        assertTrue( entry.remove( "cn", (String)null ) );
+
+        entry.add( "cn", "test1", ( String ) null, "test2" );
+        assertTrue( entry.remove( "cn", ( String ) null ) );
         assertEquals( 2, entry.get( "cn" ).size() );
         assertTrue( entry.remove( "cn", "test1", "test3" ) );
         assertEquals( 1, entry.get( "cn" ).size() );
         assertEquals( "test2", entry.get( "cn" ).get().getString() );
-        
+
         assertFalse( entry.remove( "cn", "test3" ) );
         assertFalse( entry.remove( "void", "whatever" ) );
     }
@@ -1067,21 +1070,21 @@ public class SchemaAwareEntryTest
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
 
-        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", (String)null );
-        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, (byte[])null );
+        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", ( String ) null );
+        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, ( byte[] ) null );
 
         entry.add( attrCN, attrPWD );
-        
+
         Value<String> strValue1 = new StringValue( "test1" );
         Value<String> strValue2 = new StringValue( "test2" );
         Value<String> strValue3 = new StringValue( "test3" );
-        Value<String> strNullValue = new StringValue( (String)null );
+        Value<String> strNullValue = new StringValue( ( String ) null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
         Value<byte[]> binValue3 = new BinaryValue( BYTES3 );
-        Value<byte[]> binNullValue = new BinaryValue( (byte[])null );
-        
+        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
+
         assertTrue( entry.remove( "cn", strValue1, strNullValue ) );
         assertTrue( entry.contains( "cn", strValue2 ) );
         assertFalse( entry.remove( "cn", strValue3 ) );
@@ -1096,8 +1099,8 @@ public class SchemaAwareEntryTest
         assertTrue( entry.remove( "userpassword", binValue2 ) );
         assertFalse( entry.containsAttribute( "userpassword" ) );
     }
-    
-    
+
+
     /**
      * Test method for setDN( Dn )
      */
@@ -1105,14 +1108,14 @@ public class SchemaAwareEntryTest
     public void testSetDn()
     {
         Entry entry = new DefaultEntry();
-        
+
         assertEquals( Dn.EMPTY_DN, entry.getDn() );
-        
+
         entry.setDn( EXAMPLE_DN );
         assertEquals( EXAMPLE_DN, entry.getDn() );
     }
-    
-    
+
+
     /**
      * Test method for size()
      */
@@ -1120,19 +1123,19 @@ public class SchemaAwareEntryTest
     public void testSize() throws LdapException
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertEquals( 0, entry.size() );
         entry.add( "ObjectClass", "top", "person" );
         entry.add( "cn", "test" );
         entry.add( "sn", "Test" );
-        
+
         assertEquals( 3, entry.size() );
-       
+
         entry.clear();
         assertEquals( 0, entry.size() );
     }
 
-    
+
     /**
      * Test method for for {@link org.apache.directory.shared.ldap.model.entry.DefaultEntry#toString()}.
      */
@@ -1140,34 +1143,34 @@ public class SchemaAwareEntryTest
     public void testToString()
     {
         Entry entry = new DefaultEntry( EXAMPLE_DN );
-        
+
         assertEquals( "Entry\n    dn: dc=example,dc=com\n", entry.toString() );
-        
+
         Value<String> strValueTop = new StringValue( "top" );
         Value<String> strValuePerson = new StringValue( "person" );
-        Value<String> strNullValue = new StringValue( (String)null );
+        Value<String> strNullValue = new StringValue( ( String ) null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
-        Value<byte[]> binNullValue = new BinaryValue( (byte[])null );
-        
+        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
+
         entry.put( "ObjectClass", strValueTop, strValuePerson, strNullValue );
         entry.put( "UserPassword", binValue1, binValue2, binNullValue );
 
-        String expected = 
+        String expected =
             "Entry\n" +
-            "    dn: dc=example,dc=com\n" +
-            "    ObjectClass: top\n" +
-            "    ObjectClass: person\n" +
-            "    ObjectClass: ''\n" +
-            "    UserPassword: '0x61 0x62 '\n" +
-            "    UserPassword: '0x62 '\n" +
-            "    UserPassword: ''\n";
+                "    dn: dc=example,dc=com\n" +
+                "    ObjectClass: top\n" +
+                "    ObjectClass: person\n" +
+                "    ObjectClass: ''\n" +
+                "    UserPassword: '0x61 0x62 '\n" +
+                "    UserPassword: '0x62 '\n" +
+                "    UserPassword: ''\n";
 
         assertEquals( expected, entry.toString() );
     }
-    
-    
+
+
     /**
      * Test the serialization of a complete entry
      */
@@ -1175,39 +1178,39 @@ public class SchemaAwareEntryTest
     public void testSerializeCompleteEntry() throws LdapException, IOException, ClassNotFoundException
     {
         Dn dn = new Dn( "ou=system" );
-        
+
         dn.apply( schemaManager );
-        
-        byte[] password = Strings.getBytesUtf8("secret");
-        Entry entry = new DefaultEntry( dn);
+
+        byte[] password = Strings.getBytesUtf8( "secret" );
+        Entry entry = new DefaultEntry( dn );
         entry.add( "ObjectClass", "top", "person" );
         entry.add( "cn", "test1" );
         entry.add( "userPassword", password );
 
         Entry entrySer = deserializeValue( serializeValue( entry ) );
-        
+
         assertEquals( entry, entrySer );
     }
-    
-    
+
+
     /**
      * Test the serialization of an entry with no Dn
      */
     @Test
     public void testSerializeEntryWithNoDN() throws LdapException, IOException, ClassNotFoundException
     {
-        byte[] password = Strings.getBytesUtf8("secret");
+        byte[] password = Strings.getBytesUtf8( "secret" );
         Entry entry = new DefaultEntry();
         entry.add( "ObjectClass", "top", "person" );
         entry.add( "cn", "test1" );
         entry.add( "userPassword", password );
 
         Entry entrySer = deserializeValue( serializeValue( entry ) );
-        
+
         assertEquals( entry, entrySer );
     }
-    
-    
+
+
     /**
      * Test the serialization of an entry with no attribute and no Dn
      */
@@ -1217,11 +1220,11 @@ public class SchemaAwareEntryTest
         Entry entry = new DefaultEntry();
 
         Entry entrySer = deserializeValue( serializeValue( entry ) );
-        
+
         assertEquals( entry, entrySer );
     }
-    
-    
+
+
     /**
      * Test the serialization of an entry with no attribute
      */
@@ -1229,17 +1232,17 @@ public class SchemaAwareEntryTest
     public void testSerializeEntryWithNoAttribute() throws LdapException, IOException, ClassNotFoundException
     {
         Dn dn = new Dn( "ou=system" );
-        
+
         dn.apply( schemaManager );
-        
+
         Entry entry = new DefaultEntry( dn );
 
         Entry entrySer = deserializeValue( serializeValue( entry ) );
-        
+
         assertEquals( entry, entrySer );
     }
-    
-  
+
+
     /**
      * Test method for userCertificate;binary AT
      */
@@ -1251,15 +1254,15 @@ public class SchemaAwareEntryTest
         entry.add( "cn", "test1", "test2" );
         entry.add( "sn", "Test1", "Test2" );
         entry.add( "userPassword", BYTES1, BYTES2 );
-        
+
         entry.add( "userCertificate;binary", Strings.getBytesUtf8( "secret" ) );
         assertTrue( entry.containsAttribute( "userCertificate;binary" ) );
         assertTrue( entry.containsAttribute( "userCertificate" ) );
-        
+
         entry.removeAttributes( "userCertificate;binary" );
         assertFalse( entry.containsAttribute( "userCertificate;binary" ) );
         assertFalse( entry.containsAttribute( "userCertificate" ) );
-        
+
         entry.add( "userCertificate", Strings.getBytesUtf8( "secret" ) );
         assertTrue( entry.containsAttribute( "userCertificate;binary" ) );
         assertTrue( entry.containsAttribute( "userCertificate" ) );

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareModificationSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareModificationSerializationTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareModificationSerializationTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareModificationSerializationTest.java Tue Jan 24 17:27:00 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.entry;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -58,6 +59,7 @@ public class SchemaAwareModificationSeri
     private static SchemaManager schemaManager;
     private static AttributeType CN_AT;
 
+
     /**
      * Initialize OIDs maps for normalization
      */
@@ -68,7 +70,7 @@ public class SchemaAwareModificationSeri
         CN_AT = schemaManager.getAttributeType( "cn" );
     }
 
-    
+
     /**
      * Serialize a DefaultModification
      */
@@ -80,7 +82,7 @@ public class SchemaAwareModificationSeri
         try
         {
             oOut = new ObjectOutputStream( out );
-            
+
             modification.writeExternal( oOut );
         }
         catch ( IOException ioe )
@@ -102,15 +104,16 @@ public class SchemaAwareModificationSeri
                 throw ioe;
             }
         }
-        
+
         return out;
     }
-    
-    
+
+
     /**
      * Deserialize a DefaultModification
      */
-    private Modification deserializeValue( ByteArrayOutputStream out ) throws IOException, ClassNotFoundException, LdapInvalidAttributeValueException
+    private Modification deserializeValue( ByteArrayOutputStream out ) throws IOException, ClassNotFoundException,
+        LdapInvalidAttributeValueException
     {
         ObjectInputStream oIn = null;
         ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -122,11 +125,11 @@ public class SchemaAwareModificationSeri
             modification.readExternal( oIn );
 
             Attribute attribute = modification.getAttribute();
-            
+
             if ( ( attribute != null ) && ( schemaManager != null ) )
             {
                 AttributeType attributeType = schemaManager.getAttributeType( attribute.getId() );
-                
+
                 modification.apply( attributeType );
             }
 
@@ -151,21 +154,21 @@ public class SchemaAwareModificationSeri
             }
         }
     }
-    
-    
-    @Test 
+
+
+    @Test
     public void testCreateServerModification() throws LdapException
     {
         Attribute attribute = new DefaultAttribute( "cn", CN_AT );
         attribute.add( "test1", "test2" );
-        
+
         Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
         Modification clone = mod.clone();
-        
+
         attribute.remove( "test2" );
-        
+
         Attribute clonedAttribute = clone.getAttribute();
-        
+
         assertEquals( 1, mod.getAttribute().size() );
         assertTrue( mod.getAttribute().contains( "TEST1" ) );
 
@@ -173,59 +176,63 @@ public class SchemaAwareModificationSeri
         assertTrue( clone.getAttribute().contains( "test1" ) );
         assertTrue( clone.getAttribute().contains( "test2" ) );
     }
-    
-    
+
+
     @Test
-    public void testSerializationModificationADD() throws ClassNotFoundException, IOException, LdapInvalidAttributeValueException
+    public void testSerializationModificationADD() throws ClassNotFoundException, IOException,
+        LdapInvalidAttributeValueException
     {
         Attribute attribute = new DefaultAttribute( "cn", CN_AT );
         attribute.add( "test1", "test2" );
-        
+
         DefaultModification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
-        
+
         Modification modSer = deserializeValue( serializeValue( mod ) );
-        
+
         assertEquals( mod, modSer );
     }
-    
-    
+
+
     @Test
-    public void testSerializationModificationREPLACE() throws ClassNotFoundException, IOException, LdapInvalidAttributeValueException
+    public void testSerializationModificationREPLACE() throws ClassNotFoundException, IOException,
+        LdapInvalidAttributeValueException
     {
         Attribute attribute = new DefaultAttribute( "cn", CN_AT );
         attribute.add( "test1", "test2" );
-        
+
         DefaultModification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
-        
+
         Modification modSer = deserializeValue( serializeValue( mod ) );
-        
+
         assertEquals( mod, modSer );
     }
-    
-    
+
+
     @Test
-    public void testSerializationModificationREMOVE() throws ClassNotFoundException, IOException, LdapInvalidAttributeValueException
+    public void testSerializationModificationREMOVE() throws ClassNotFoundException, IOException,
+        LdapInvalidAttributeValueException
     {
         Attribute attribute = new DefaultAttribute( "cn", CN_AT );
         attribute.add( "test1", "test2" );
-        
+
         DefaultModification mod = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attribute );
-        
+
         Modification modSer = deserializeValue( serializeValue( mod ) );
-        
+
         assertEquals( mod, modSer );
     }
-    
-    
+
+
     @Test
-    public void testSerializationModificationNoAttribute() throws ClassNotFoundException, IOException, LdapInvalidAttributeValueException
+    public void testSerializationModificationNoAttribute() throws ClassNotFoundException, IOException,
+        LdapInvalidAttributeValueException
     {
         DefaultModification mod = new DefaultModification();
-        
+
         mod.setOperation( ModificationOperation.ADD_ATTRIBUTE );
-        
+
         Modification modSer = deserializeValue( serializeValue( mod ) );
-        
+
         assertEquals( mod, modSer );
     }
 }

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=1235364&r1=1235363&r2=1235364&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 Tue Jan 24 17:27:00 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.entry;
 
+
 import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
@@ -41,6 +42,7 @@ import org.junit.runner.RunWith;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
+
 /**
  * Test the Value Serialization
  * 
@@ -50,7 +52,8 @@ import com.mycila.junit.concurrent.Concu
 @Concurrency()
 public class SchemaAwareValueSerializationTest
 {
-    private static byte[] data = new byte[] {0x01, 0x02, 0x03, 0x04};
+    private static byte[] data = new byte[]
+        { 0x01, 0x02, 0x03, 0x04 };
     private static BinaryValue bv1;
     private static BinaryValue bv2;
     private static BinaryValue bv3;
@@ -63,12 +66,13 @@ public class SchemaAwareValueSerializati
     private static StringValue sv1n;
     private static StringValue sv2n;
     private static StringValue sv3n;
-    
+
     private static SchemaManager schemaManager;
     private static AttributeType cn = null;
     private static AttributeType dc = null;
     private static AttributeType userCertificate = null;
 
+
     /**
      * Initialize OIDs maps for normalization
      */
@@ -79,7 +83,7 @@ public class SchemaAwareValueSerializati
         cn = schemaManager.getAttributeType( "cn" );
         dc = schemaManager.getAttributeType( "dc" );
         userCertificate = schemaManager.getAttributeType( "userCertificate" );
-        
+
         bv1 = new BinaryValue( userCertificate, data );
         bv2 = new BinaryValue( userCertificate, StringConstants.EMPTY_BYTES );
         bv3 = new BinaryValue( userCertificate, null );
@@ -88,13 +92,13 @@ public class SchemaAwareValueSerializati
         bv3n = new BinaryValue( userCertificate, null );
         sv1 = new StringValue( cn, "test" );
         sv2 = new StringValue( dc, "" );
-        sv3 = new StringValue( dc, (String)null );
+        sv3 = new StringValue( dc, ( String ) null );
         sv1n = new StringValue( cn, "test" );
         sv2n = new StringValue( dc, "" );
-        sv3n = new StringValue( dc, (String)null );
+        sv3n = new StringValue( dc, ( String ) null );
     }
 
-    
+
     @Test
     public void testBinaryValueWithDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -102,7 +106,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         bv1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -112,8 +116,8 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv1, bvDeser );
     }
-    
-    
+
+
     @Test
     public void testBinaryValueWithEmptyDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -121,7 +125,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         bv2.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -131,8 +135,8 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv2, bvDeser );
     }
-    
-    
+
+
     @Test
     public void testBinaryValueNoDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -140,7 +144,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         bv3.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -150,8 +154,8 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv3, bvDeser );
     }
-    
-    
+
+
     @Test
     public void testStringValueWithDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -159,7 +163,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         sv1.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -169,8 +173,8 @@ public class SchemaAwareValueSerializati
 
         assertEquals( sv1, svDeser );
     }
-    
-    
+
+
     @Test
     public void testStringValueWithEmptyDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -178,7 +182,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         sv2.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -188,8 +192,8 @@ public class SchemaAwareValueSerializati
 
         assertEquals( sv2, svDeser );
     }
-    
-    
+
+
     @Test
     public void testStringValueNoDataSerialization() throws IOException, ClassNotFoundException
     {
@@ -197,7 +201,7 @@ public class SchemaAwareValueSerializati
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
         sv3.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -207,17 +211,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( sv3, svDeser );
     }
-    
-    
+
+
     @Test
-    public void testBinaryValueWithDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testBinaryValueWithDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         bv1n.apply( userCertificate );
 
         bv1n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -227,17 +232,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv1n, bvDeser );
     }
-    
-    
+
+
     @Test
-    public void testBinaryValueWithEmptyDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testBinaryValueWithEmptyDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         bv2n.apply( userCertificate );
 
         bv2n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -247,17 +253,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv2n, bvDeser );
     }
-    
-    
+
+
     @Test
-    public void testBinaryValueNoDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testBinaryValueNoDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         bv3n.apply( userCertificate );
 
         bv3n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -267,17 +274,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( bv3n, bvDeser );
     }
-    
-    
+
+
     @Test
-    public void testStringValueWithDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testStringValueWithDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         sv1n.apply( cn );
 
         sv1n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -287,17 +295,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( sv1n, svDeser );
     }
-    
-    
+
+
     @Test
-    public void testStringValueWithEmptyDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testStringValueWithEmptyDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         sv2n.apply( dc );
 
         sv2n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();
@@ -307,17 +316,18 @@ public class SchemaAwareValueSerializati
 
         assertEquals( sv2n, svDeser );
     }
-    
-    
+
+
     @Test
-    public void testStringValueNoDataNormalizedSerialization() throws IOException, LdapException, ClassNotFoundException
+    public void testStringValueNoDataNormalizedSerialization() throws IOException, LdapException,
+        ClassNotFoundException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
         sv3n.apply( dc );
 
         sv3n.writeExternal( out );
-        
+
         ObjectInputStream in = null;
 
         byte[] data = baos.toByteArray();

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/TestEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/TestEntryUtils.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/TestEntryUtils.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/TestEntryUtils.java Tue Jan 24 17:27:00 2012
@@ -18,6 +18,8 @@
  *  
  */
 package org.apache.directory.shared.ldap.entry;
+
+
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -32,6 +34,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.util.Strings;
 
+
 /**
  * Some common declaration used by the serverEntry tests.
  *
@@ -46,18 +49,21 @@ public class TestEntryUtils
     {
         private static final long serialVersionUID = 0L;
 
+
         protected AT( String oid )
         {
             super( oid );
         }
     }
 
+
     public static MatchingRule matchingRuleFactory( String oid )
     {
         MatchingRule matchingRule = new MatchingRule( oid );
-        
+
         return matchingRule;
     }
+
     /**
      * A local MatchingRule class for tests
      */
@@ -76,22 +82,25 @@ public class TestEntryUtils
     public static LdapSyntax syntaxFactory( String oid, boolean humanReadable )
     {
         LdapSyntax ldapSyntax = new LdapSyntax( oid );
-        
+
         ldapSyntax.setHumanReadable( humanReadable );
-        
+
         return ldapSyntax;
     }
+
     static class S extends LdapSyntax
     {
         private static final long serialVersionUID = 0L;
 
+
         public S( String oid, boolean humanReadible )
         {
             super( oid, "", humanReadible );
         }
     }
 
-    /* no protection*/ 
+
+    /* no protection*/
     //This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
     @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
     static AttributeType getCaseIgnoringAttributeNoNumbersType()
@@ -109,8 +118,8 @@ public class TestEntryUtils
                 }
 
                 String strval = ( String ) value;
-                
-                for ( char c:strval.toCharArray() )
+
+                for ( char c : strval.toCharArray() )
                 {
                     if ( Character.isDigit( c ) )
                     {
@@ -120,39 +129,39 @@ public class TestEntryUtils
                 return true;
             }
         } );
-        
+
         MatchingRule matchingRule = new MatchingRule( "1.1.2.1" );
         matchingRule.setSyntax( syntax );
 
-
         matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() )
         {
             public int compare( String o1, String o2 )
             {
-                return ( o1 == null ? 
+                return ( o1 == null ?
                     ( o2 == null ? 0 : -1 ) :
                     ( o2 == null ? 1 : o1.compareTo( o2 ) ) );
             }
 
+
             int getValue( String val )
             {
-                if ( val.equals( "LOW" ) ) 
+                if ( val.equals( "LOW" ) )
                 {
                     return 0;
                 }
-                else if ( val.equals( "MEDIUM" ) ) 
+                else if ( val.equals( "MEDIUM" ) )
                 {
                     return 1;
                 }
-                else if ( val.equals( "HIGH" ) ) 
+                else if ( val.equals( "HIGH" ) )
                 {
                     return 2;
                 }
-                
+
                 throw new IllegalArgumentException();
             }
         } );
-        
+
         Normalizer normalizer = new Normalizer( "1.1.1" )
         {
             public Value<?> normalize( Value<?> value ) throws LdapException
@@ -164,24 +173,24 @@ public class TestEntryUtils
 
                 throw new IllegalStateException();
             }
-            
-            
+
+
             public String normalize( String value ) throws LdapException
             {
                 return Strings.toLowerCase( value );
             }
         };
-        
+
         matchingRule.setNormalizer( normalizer );
-        
+
         attributeType.setEquality( matchingRule );
         attributeType.setSyntax( syntax );
-        
+
         return attributeType;
     }
 
 
-    /* no protection*/ static AttributeType getIA5StringAttributeType()
+    /* no protection*/static AttributeType getIA5StringAttributeType()
     {
         AttributeType attributeType = new AttributeType( "1.1" );
         attributeType.addName( "1.1" );
@@ -191,34 +200,33 @@ public class TestEntryUtils
         {
             public boolean isValidSyntax( Object value )
             {
-                return ((String)value == null) || (((String)value).length() < 7) ;
+                return ( ( String ) value == null ) || ( ( ( String ) value ).length() < 7 );
             }
         } );
-        
+
         MatchingRule matchingRule = new MatchingRule( "1.1.2" );
         matchingRule.setSyntax( syntax );
 
-
         matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() )
         {
             public int compare( String o1, String o2 )
             {
-                return ( ( o1 == null ) ? 
+                return ( ( o1 == null ) ?
                     ( o2 == null ? 0 : -1 ) :
                     ( o2 == null ? 1 : o1.compareTo( o2 ) ) );
             }
         } );
-        
+
         matchingRule.setNormalizer( new DeepTrimToLowerNormalizer( matchingRule.getOid() ) );
-        
+
         attributeType.setEquality( matchingRule );
         attributeType.setSyntax( syntax );
-        
+
         return attributeType;
     }
 
 
-    /* No protection */ static AttributeType getBytesAttributeType()
+    /* No protection */static AttributeType getBytesAttributeType()
     {
         AttributeType attributeType = new AttributeType( "1.2" );
         LdapSyntax syntax = new LdapSyntax( "1.2.1", "", true );
@@ -227,7 +235,7 @@ public class TestEntryUtils
         {
             public boolean isValidSyntax( Object value )
             {
-                return ( value == null ) || ( ((byte[])value).length < 5 );
+                return ( value == null ) || ( ( ( byte[] ) value ).length < 5 );
             }
         } );
 
@@ -235,7 +243,7 @@ public class TestEntryUtils
         matchingRule.setSyntax( syntax );
 
         matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
-        
+
         matchingRule.setNormalizer( new Normalizer( "1.1.1" )
         {
             public Value<?> normalize( Value<?> value ) throws LdapException
@@ -243,29 +251,30 @@ public class TestEntryUtils
                 if ( !value.isHumanReadable() )
                 {
                     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();
             }
 
+
             public String normalize( String value ) throws LdapException
             {
                 throw new IllegalStateException();
             }
         } );
-        
+
         attributeType.setEquality( matchingRule );
         attributeType.setSyntax( syntax );
 

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java Tue Jan 24 17:27:00 2012
@@ -47,12 +47,14 @@ public class AvaTest
 
     private static SchemaManager schemaManager;
 
+
     @BeforeClass
     public static void setup() throws Exception
     {
         schemaManager = new DefaultSchemaManager();
     }
-    
+
+
     /**
      * Test a null AttributeTypeAndValue
      */
@@ -73,7 +75,7 @@ public class AvaTest
     {
         try
         {
-            new Ava( schemaManager, null, (String)null );
+            new Ava( schemaManager, null, ( String ) null );
             fail();
         }
         catch ( LdapException ine )
@@ -83,6 +85,7 @@ public class AvaTest
 
     }
 
+
     /**
      * Test an invalid type for an AttributeTypeAndValue
      */
@@ -91,7 +94,7 @@ public class AvaTest
     {
         try
         {
-            new Ava( schemaManager, "  ", (String)null );
+            new Ava( schemaManager, "  ", ( String ) null );
             fail();
         }
         catch ( LdapException ine )
@@ -111,7 +114,7 @@ public class AvaTest
         assertEquals( "CN= ", ava.toString() );
         assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
         assertEquals( "CN= ", ava.getUpName() );
-        
+
         ava = new Ava( schemaManager, "  CN  ", " " );
         assertEquals( "  CN  = ", ava.toString() );
         assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
@@ -121,13 +124,14 @@ public class AvaTest
         assertEquals( "cn= ", ava.toString() );
         assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
         assertEquals( "cn= ", ava.getUpName() );
-        
+
         ava = new Ava( schemaManager, "  cn  ", " " );
         assertEquals( "  cn  = ", ava.toString() );
         assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
         assertEquals( "  cn  = ", ava.getUpName() );
     }
 
+
     /**
      * test an empty AttributeTypeAndValue
      */
@@ -159,8 +163,6 @@ public class AvaTest
     }
 
 
-
-
     /**
      * test a simple AttributeTypeAndValue : a = b
      */

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java Tue Jan 24 17:27:00 2012
@@ -58,6 +58,7 @@ public class DnTest
 {
     private static SchemaManager schemaManager;
 
+
     /**
      * Initialize OIDs maps for normalization
      */
@@ -104,7 +105,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
 
-        assertTrue( Dn.isValid("a = b") );
+        assertTrue( Dn.isValid( "a = b" ) );
         assertEquals( "a = b", dn.getName() );
         assertEquals( "a=b", dn.getNormName() );
     }
@@ -118,7 +119,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b  " );
 
-        assertTrue( Dn.isValid("a = b  ") );
+        assertTrue( Dn.isValid( "a = b  " ) );
         assertEquals( "a = b  ", dn.getName() );
         assertEquals( "a=b", dn.getNormName() );
     }
@@ -132,7 +133,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b, c = d" );
 
-        assertTrue( Dn.isValid("a = b, c = d") );
+        assertTrue( Dn.isValid( "a = b, c = d" ) );
         assertEquals( "a=b,c=d", dn.getNormName() );
         assertEquals( "a = b, c = d", dn.getName() );
     }
@@ -146,7 +147,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b  , c = d" );
 
-        assertTrue( Dn.isValid("a = b  , c = d") );
+        assertTrue( Dn.isValid( "a = b  , c = d" ) );
         assertEquals( "a=b,c=d", dn.getNormName() );
         assertEquals( "a = b  , c = d", dn.getName() );
     }
@@ -160,7 +161,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b, a =b, a= b, a = b, a  =  b" );
 
-        assertTrue( Dn.isValid("a=b, a =b, a= b, a = b, a  =  b") );
+        assertTrue( Dn.isValid( "a=b, a =b, a= b, a = b, a  =  b" ) );
         assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNormName() );
         assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
     }
@@ -175,7 +176,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b;c=d,e=f" );
 
-        assertTrue( Dn.isValid("a=b;c=d,e=f") );
+        assertTrue( Dn.isValid( "a=b;c=d,e=f" ) );
         assertEquals( "a=b,c=d,e=f", dn.getNormName() );
         assertEquals( "a=b;c=d,e=f", dn.getName() );
     }
@@ -189,7 +190,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b + c = d" );
 
-        assertTrue( Dn.isValid("a = b + c = d") );
+        assertTrue( Dn.isValid( "a = b + c = d" ) );
         assertEquals( "a=b+c=d", dn.getNormName() );
         assertEquals( "a = b + c = d", dn.getName() );
     }
@@ -204,7 +205,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b+c=d, e=f + g=h + i=j" );
 
-        assertTrue( Dn.isValid("a=b+c=d, e=f + g=h + i=j") );
+        assertTrue( Dn.isValid( "a=b+c=d, e=f + g=h + i=j" ) );
         assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.getNormName() );
         assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getName() );
     }
@@ -234,7 +235,7 @@ public class DnTest
     {
         Dn dn = new Dn( "OID.12.34.56 = azerty" );
 
-        assertTrue( Dn.isValid("OID.12.34.56 = azerty") );
+        assertTrue( Dn.isValid( "OID.12.34.56 = azerty" ) );
         assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
         assertEquals( "OID.12.34.56 = azerty", dn.getName() );
     }
@@ -248,7 +249,7 @@ public class DnTest
     {
         Dn dn = new Dn( "oid.12.34.56 = azerty" );
 
-        assertTrue( Dn.isValid("oid.12.34.56 = azerty") );
+        assertTrue( Dn.isValid( "oid.12.34.56 = azerty" ) );
         assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
         assertEquals( "oid.12.34.56 = azerty", dn.getName() );
     }
@@ -263,7 +264,7 @@ public class DnTest
     {
         Dn dn = new Dn( "12.34.56 = azerty" );
 
-        assertTrue( Dn.isValid("12.34.56 = azerty") );
+        assertTrue( Dn.isValid( "12.34.56 = azerty" ) );
         assertEquals( "12.34.56=azerty", dn.getNormName() );
         assertEquals( "12.34.56 = azerty", dn.getName() );
     }
@@ -278,7 +279,7 @@ public class DnTest
     {
         Dn dn = new Dn( "12.34.56 = azerty; 7.8 = test" );
 
-        assertTrue( Dn.isValid("12.34.56 = azerty; 7.8 = test") );
+        assertTrue( Dn.isValid( "12.34.56 = azerty; 7.8 = test" ) );
         assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
         assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
     }
@@ -292,7 +293,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" );
 
-        assertTrue( Dn.isValid("a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D") );
+        assertTrue( Dn.isValid( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" ) );
         assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u010D", dn.getNormName() );
         assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D", dn.getName() );
     }
@@ -306,7 +307,7 @@ public class DnTest
     {
         Dn dn = new Dn( "SN=Lu\\C4\\8Di\\C4\\87" );
 
-        assertTrue( Dn.isValid("SN=Lu\\C4\\8Di\\C4\\87") );
+        assertTrue( Dn.isValid( "SN=Lu\\C4\\8Di\\C4\\87" ) );
         assertEquals( "sn=Lu\u010Di\u0107", dn.getNormName() );
         assertEquals( "SN=Lu\\C4\\8Di\\C4\\87", dn.getName() );
     }
@@ -320,7 +321,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = #0010A0AAFF" );
 
-        assertTrue( Dn.isValid("a = #0010A0AAFF") );
+        assertTrue( Dn.isValid( "a = #0010A0AAFF" ) );
         assertEquals( "a=#0010A0AAFF", dn.getNormName() );
         assertEquals( "a = #0010A0AAFF", dn.getName() );
     }
@@ -337,22 +338,22 @@ public class DnTest
     {
         Dn dn = new Dn( "a = \\#123456" );
 
-        assertTrue( Dn.isValid("a = \\#123456") );
+        assertTrue( Dn.isValid( "a = \\#123456" ) );
         assertEquals( "a=\\#123456", dn.getNormName() );
         assertEquals( "a = \\#123456", dn.getName() );
 
         Rdn rdn = dn.getRdn();
         assertEquals( "a = \\#123456", rdn.getName() );
 
-        assertTrue( Dn.isValid("a = \\#00") );
-        assertTrue( Dn.isValid("a = \\#11") );
-        assertTrue( Dn.isValid("a = \\#99") );
-        assertTrue( Dn.isValid("a = \\#AA") );
-        assertTrue( Dn.isValid("a = \\#FF") );
-
-        assertTrue( Dn.isValid("uid=\\#123456") );
-        assertTrue( Dn.isValid("cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE") );
-        assertTrue( Dn.isValid("cn=\\#Abraham") );
+        assertTrue( Dn.isValid( "a = \\#00" ) );
+        assertTrue( Dn.isValid( "a = \\#11" ) );
+        assertTrue( Dn.isValid( "a = \\#99" ) );
+        assertTrue( Dn.isValid( "a = \\#AA" ) );
+        assertTrue( Dn.isValid( "a = \\#FF" ) );
+
+        assertTrue( Dn.isValid( "uid=\\#123456" ) );
+        assertTrue( Dn.isValid( "cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE" ) );
+        assertTrue( Dn.isValid( "cn=\\#Abraham" ) );
     }
 
 
@@ -386,7 +387,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = \\#this is a sharp" );
 
-        assertTrue( Dn.isValid("a = \\#this is a sharp") );
+        assertTrue( Dn.isValid( "a = \\#this is a sharp" ) );
         assertEquals( "a=\\#this is a sharp", dn.getNormName() );
         assertEquals( "a = \\#this is a sharp", dn.getName() );
 
@@ -403,7 +404,7 @@ public class DnTest
     {
         Dn dn = new Dn( "ou = \\#this is a sharp" );
 
-        assertTrue( Dn.isValid("ou = \\#this is a sharp") );
+        assertTrue( Dn.isValid( "ou = \\#this is a sharp" ) );
         assertEquals( "ou=\\#this is a sharp", dn.getNormName() );
         assertEquals( "ou = \\#this is a sharp", dn.getName() );
 
@@ -423,7 +424,7 @@ public class DnTest
     public void testNormalizeDnEscEscHexHex() throws LdapException
     {
         Dn dn = new Dn( "ou = AC\\\\DC" );
-        assertTrue( Dn.isValid("ou = AC\\\\DC") );
+        assertTrue( Dn.isValid( "ou = AC\\\\DC" ) );
         assertEquals( "ou=AC\\\\DC", dn.getNormName() );
         assertEquals( "ou = AC\\\\DC", dn.getName() );
 
@@ -448,7 +449,7 @@ public class DnTest
         catch ( LdapException ine )
         {
 
-            assertFalse( Dn.isValid("a = #0010Z0AAFF") );
+            assertFalse( Dn.isValid( "a = #0010Z0AAFF" ) );
             assertTrue( true );
         }
     }
@@ -467,7 +468,7 @@ public class DnTest
         }
         catch ( LdapException ine )
         {
-            assertFalse( Dn.isValid("a = #AABBCCDD3") );
+            assertFalse( Dn.isValid( "a = #AABBCCDD3" ) );
             assertTrue( true );
         }
     }
@@ -481,7 +482,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = quoted \\\"value\\\"" );
 
-        assertTrue( Dn.isValid("a = quoted \\\"value\\\"") );
+        assertTrue( Dn.isValid( "a = quoted \\\"value\\\"" ) );
         assertEquals( "a=quoted \\\"value\\\"", dn.getNormName() );
         assertEquals( "a = quoted \\\"value\\\"", dn.getName() );
     }
@@ -495,7 +496,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = \\\" quoted value \\\"" );
 
-        assertTrue( Dn.isValid("a = \\\" quoted value \\\"") );
+        assertTrue( Dn.isValid( "a = \\\" quoted value \\\"" ) );
         assertEquals( "a=\\\" quoted value \\\"", dn.getNormName() );
         assertEquals( "a = \\\" quoted value \\\"", dn.getName() );
     }
@@ -507,8 +508,8 @@ public class DnTest
     @Test
     public void testDnComaAtEnd()
     {
-        assertFalse( Dn.isValid("a = b,") );
-        assertFalse( Dn.isValid("a = b, ") );
+        assertFalse( Dn.isValid( "a = b," ) );
+        assertFalse( Dn.isValid( "a = b, " ) );
 
         try
         {
@@ -613,7 +614,7 @@ public class DnTest
     {
         Dn dn = new Dn();
 
-        assertTrue( Dn.isValid("") );
+        assertTrue( Dn.isValid( "" ) );
         assertEquals( 0, dn.size() );
     }
 
@@ -626,7 +627,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b" );
 
-        assertTrue( Dn.isValid("a=b") );
+        assertTrue( Dn.isValid( "a=b" ) );
         assertEquals( 1, dn.size() );
     }
 
@@ -639,7 +640,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b, c=d, e=f" );
 
-        assertTrue( Dn.isValid("a=b, c=d, e=f") );
+        assertTrue( Dn.isValid( "a=b, c=d, e=f" ) );
         assertEquals( 3, dn.size() );
     }
 
@@ -652,7 +653,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a=b+c=d, c=d, e=f" );
 
-        assertTrue( Dn.isValid("a=b+c=d, c=d, e=f") );
+        assertTrue( Dn.isValid( "a=b+c=d, c=d, e=f" ) );
         assertEquals( 3, dn.size() );
     }
 
@@ -903,12 +904,12 @@ public class DnTest
     /**
      * Get the prefix out of bound
      */
-    @Test( expected=LdapInvalidDnException.class)
+    @Test(expected = LdapInvalidDnException.class)
     public void testDnGetPrefixPos4() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
 
-         dn.getAncestorOf( "a=z" );
+        dn.getAncestorOf( "a=z" );
     }
 
 
@@ -1054,7 +1055,7 @@ public class DnTest
     public void testDnStartsWithNull() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.isDescendantOf( (Dn) null ) );
+        assertEquals( true, dn.isDescendantOf( ( Dn ) null ) );
     }
 
 
@@ -1132,12 +1133,10 @@ public class DnTest
     public void testDnEndsWithNull() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.isDescendantOf( (Dn) null ) );
+        assertEquals( true, dn.isDescendantOf( ( Dn ) null ) );
     }
 
 
-
-
     @Test
     public void testAttributeEqualsIsCaseInSensitive() throws Exception
     {
@@ -1169,7 +1168,6 @@ public class DnTest
     }
 
 
-    
     @Test
     public void testAttributeComparisonIsCaseInSensitive() throws Exception
     {
@@ -1220,9 +1218,9 @@ public class DnTest
     {
         Dn dn = new Dn( "cn = John, ou = People, OU = Marketing" );
 
-        byte[] bytes = Dn.getBytes(dn);
+        byte[] bytes = Dn.getBytes( dn );
 
-        assertEquals( 30, Dn.getNbBytes(dn) );
+        assertEquals( 30, Dn.getNbBytes( dn ) );
         assertEquals( "cn=John,ou=People,ou=Marketing", new String( bytes, "UTF-8" ) );
     }
 
@@ -1230,9 +1228,9 @@ public class DnTest
     @Test
     public void testStringParser() throws Exception
     {
-        String dn = Strings.utf8ToString(new byte[]
-                {'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', (byte) 0xc3,
-                        (byte) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y'});
+        String dn = Strings.utf8ToString( new byte[]
+            { 'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', ( byte ) 0xc3,
+                ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y' } );
 
         Dn name = new Dn( dn );
 
@@ -1957,7 +1955,8 @@ public class DnTest
 
         Dn result = name.apply( schemaManager );
 
-        assertEquals( "2.5.4.11=some people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com", result.getNormName() );
+        assertEquals( "2.5.4.11=some people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com",
+            result.getNormName() );
     }
 
 
@@ -2031,7 +2030,7 @@ public class DnTest
         Dn name = new Dn(
             "2.5.4.11= Some   People   + domainComponent=  And   Some anImAls,DomainComponent = eXample,0.9.2342.19200300.100.1.25= cOm" );
 
-        Dn result = name.apply( schemaManager);
+        Dn result = name.apply( schemaManager );
 
         assertTrue( result
             .getNormName()
@@ -2050,11 +2049,12 @@ public class DnTest
     @Test
     public void testLdapNameHashCode() throws Exception
     {
-        Dn name1 = new Dn( schemaManager,
-                    "2.5.4.11= Some   People   + domainComponent=  And   Some anImAls,DomainComponent = eXample,0.9.2342.19200300.100.1.25= cOm" );
+        Dn name1 = new Dn(
+            schemaManager,
+            "2.5.4.11= Some   People   + domainComponent=  And   Some anImAls,DomainComponent = eXample,0.9.2342.19200300.100.1.25= cOm" );
 
         Dn name2 = new Dn( schemaManager,
-                    "2.5.4.11=some people+domainComponent=and some animals,DomainComponent=example,0.9.2342.19200300.100.1.25=com" );
+            "2.5.4.11=some people+domainComponent=and some animals,DomainComponent=example,0.9.2342.19200300.100.1.25=com" );
 
         assertEquals( name1.hashCode(), name2.hashCode() );
     }
@@ -2083,7 +2083,8 @@ public class DnTest
         LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Dn aName = new Dn( "cn=four,cn=three,cn=two,cn=one" );
 
-        assertEquals( jName.getPrefix( 0 ).toString(), aName.getAncestorOf( "cn=four,cn=three,cn=two,cn=one" ).toString() );
+        assertEquals( jName.getPrefix( 0 ).toString(), aName.getAncestorOf( "cn=four,cn=three,cn=two,cn=one" )
+            .toString() );
         assertEquals( jName.getPrefix( 1 ).toString(), aName.getAncestorOf( "cn=four,cn=three,cn=two" ).toString() );
         assertEquals( jName.getPrefix( 2 ).toString(), aName.getAncestorOf( "cn=four,cn=three" ).toString() );
         assertEquals( jName.getPrefix( 3 ).toString(), aName.getAncestorOf( "cn=four" ).toString() );
@@ -2104,7 +2105,8 @@ public class DnTest
         assertEquals( jName.getSuffix( 1 ).toString(), aName.getDescendantOf( "cn=one" ).toString() );
         assertEquals( jName.getSuffix( 2 ).toString(), aName.getDescendantOf( "cn=two,cn=one" ).toString() );
         assertEquals( jName.getSuffix( 3 ).toString(), aName.getDescendantOf( "cn=three,cn=two,cn=one" ).toString() );
-        assertEquals( jName.getSuffix( 4 ).toString(), aName.getDescendantOf( "cn=four,cn=three,cn=two,cn=one" ).toString() );
+        assertEquals( jName.getSuffix( 4 ).toString(), aName.getDescendantOf( "cn=four,cn=three,cn=two,cn=one" )
+            .toString() );
     }
 
 
@@ -2442,24 +2444,24 @@ public class DnTest
     @Test
     public void testIsValid()
     {
-        assertTrue( Dn.isValid("") );
+        assertTrue( Dn.isValid( "" ) );
 
-        assertFalse( Dn.isValid("a") );
-        assertFalse( Dn.isValid("a ") );
+        assertFalse( Dn.isValid( "a" ) );
+        assertFalse( Dn.isValid( "a " ) );
 
-        assertTrue( Dn.isValid("a=") );
-        assertTrue( Dn.isValid("a= ") );
+        assertTrue( Dn.isValid( "a=" ) );
+        assertTrue( Dn.isValid( "a= " ) );
 
-        assertFalse( Dn.isValid("=") );
-        assertFalse( Dn.isValid(" = ") );
-        assertFalse( Dn.isValid(" = a") );
+        assertFalse( Dn.isValid( "=" ) );
+        assertFalse( Dn.isValid( " = " ) );
+        assertFalse( Dn.isValid( " = a" ) );
     }
 
 
     @Test
     public void testCompositeRDN() throws LdapException
     {
-        assertTrue( Dn.isValid("a=b+c=d+e=f,g=h") );
+        assertTrue( Dn.isValid( "a=b+c=d+e=f,g=h" ) );
 
         Dn dn = new Dn( "a=b+c=d+e=f,g=h" );
 
@@ -2471,7 +2473,7 @@ public class DnTest
     public void testCompositeRDNOids() throws LdapException
     {
         assertTrue( Dn
-            .isValid("1.2.3.4.5=0+1.2.3.4.6=0+1.2.3.4.7=omnischmomni,2.5.4.3=subtree,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com") );
+            .isValid( "1.2.3.4.5=0+1.2.3.4.6=0+1.2.3.4.7=omnischmomni,2.5.4.3=subtree,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com" ) );
 
         Dn dn = new Dn(
             "1.2.3.4.5=0+1.2.3.4.6=0+1.2.3.4.7=omnischmomni,2.5.4.3=subtree,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com" );
@@ -2501,7 +2503,7 @@ public class DnTest
         Ava atav3 = dn3.getRdn().getAva();
         assertEquals( "cn", atav3.getUpType() );
         assertEquals( "ABC", atav3.getUpValue().getString() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("ABC"), atav3.getNormValue().getBytes() ) );
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "ABC" ), atav3.getNormValue().getBytes() ) );
 
         // antlr parser:
         Dn dn4 = new Dn( " cn = \\41\\42\\43 , ou=system " );
@@ -2957,16 +2959,16 @@ public class DnTest
 
         assertEquals( dnStr, dn.toString() );
     }
-    
-    
+
+
     @Test
     public void testCreateDnFromRdnParent() throws Exception
     {
         String rdn = "cn=test";
         String parentDn = "ou=apache,ou=org";
-        
+
         Dn dn = new Dn( rdn, parentDn );
-        
+
         assertEquals( "cn=test,ou=apache,ou=org", dn.getName() );
     }
 }

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/MultiThreadedTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/MultiThreadedTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/MultiThreadedTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/MultiThreadedTest.java Tue Jan 24 17:27:00 2012
@@ -56,6 +56,7 @@ public class MultiThreadedTest
 
     private static SchemaManager schemaManager;
 
+
     @BeforeClass
     public static void setup() throws Exception
     {