directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1509635 [2/5] - in /directory/apacheds/trunk: ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ server-integ/src/test/java/org/apache/directory/server/operations/add/ server-integ/src/test/java/org/apache/di...
Date Fri, 02 Aug 2013 11:26:46 GMT
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java?rev=1509635&r1=1509634&r2=1509635&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java Fri Aug  2 11:26:45 2013
@@ -55,7 +55,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.ldif.LdifUtils;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.util.Strings;
-import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
@@ -63,7 +62,6 @@ import org.apache.directory.server.annot
 import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -94,579 +92,536 @@ import org.junit.runner.RunWith;
         "objectClass: person",
         "objectClass: top",
         "cn: Debbie Harry",
-        "sn: Harry"
-})
+        "sn: Harry" })
 //@CreateDS( allowAnonAccess=true, name="BindIT-class")
 @CreateLdapServer(
-transports =
-    {
-        @CreateTransport(protocol = "LDAP")
-})
+    transports =
+        {
+            @CreateTransport(protocol = "LDAP") })
 public class ModifyAddIT extends AbstractLdapTestUnit
 {
-@Rule
-public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
-private static final String BASE = "ou=system";
-private static final String RDN_TORI_AMOS = "cn=Tori Amos";
-private static final String PERSON_DESCRIPTION = "an American singer-songwriter";
-private static final String RDN_DEBBIE_HARRY = "cn=Debbie Harry";
+    private static final String BASE = "ou=system";
+    private static final String RDN_TORI_AMOS = "cn=Tori Amos";
+    private static final String PERSON_DESCRIPTION = "an American singer-songwriter";
+    private static final String RDN_DEBBIE_HARRY = "cn=Debbie Harry";
 
 
-/**
- * Creation of required attributes of a person entry.
- */
-protected Attributes getPersonAttributes( String sn, String cn ) throws LdapException
-{
-    Attributes attributes = LdifUtils.createJndiAttributes(
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: organizationalperson",
-        "objectClass: inetorgperson",
-        "cn", cn,
-        "sn", sn );
-
-    return attributes;
-}
-
+    /**
+     * Creation of required attributes of a person entry.
+     */
+    protected Attributes getPersonAttributes( String sn, String cn ) throws LdapException
+    {
+        Attributes attributes = LdifUtils.createJndiAttributes(
+            "objectClass: top",
+            "objectClass: person",
+            "objectClass: organizationalperson",
+            "objectClass: inetorgperson",
+            "cn", cn,
+            "sn", sn );
 
-/**
- * Add a new attribute to a person entry.
- */
-@Test
-public void testAddNewAttributeValue() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        return attributes;
+    }
 
-    // Add telephoneNumber attribute
-    String newValue = "1234567890";
-    Attributes attrs = new BasicAttributes( "telephoneNumber", newValue, true );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that
-    // - case of attribute description is correct
-    // - attribute value is added
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "telephoneNumber" );
-    assertNotNull( attr );
-    assertEquals( "telephoneNumber", attr.getID() );
-    assertTrue( attr.contains( newValue ) );
-    assertEquals( 1, attr.size() );
-}
 
+    /**
+     * Add a new attribute to a person entry.
+     */
+    @Test
+    public void testAddNewAttributeValue() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-/**
- * Add a new attribute with two values.
- */
-@Test
-public void testAddNewAttributeValues() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        // Add telephoneNumber attribute
+        String newValue = "1234567890";
+        Attributes attrs = new BasicAttributes( "telephoneNumber", newValue, true );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    // Add telephoneNumber attribute
-    String[] newValues =
-        { "1234567890", "999999999" };
-    Attribute attr = new BasicAttribute( "telephoneNumber" );
-    attr.add( newValues[0] );
-    attr.add( newValues[1] );
-    Attributes attrs = new BasicAttributes( true );
-    attrs.put( attr );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that
-    // - case of attribute description is correct
-    // - attribute values are present
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    attr = attrs.get( "telephoneNumber" );
-    assertNotNull( attr );
-    assertEquals( "telephoneNumber", attr.getID() );
-    assertTrue( attr.contains( newValues[0] ) );
-    assertTrue( attr.contains( newValues[1] ) );
-    assertEquals( newValues.length, attr.size() );
-}
+        // Verify, that
+        // - case of attribute description is correct
+        // - attribute value is added
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        Attribute attr = attrs.get( "telephoneNumber" );
+        assertNotNull( attr );
+        assertEquals( "telephoneNumber", attr.getID() );
+        assertTrue( attr.contains( newValue ) );
+        assertEquals( 1, attr.size() );
+    }
 
 
-/**
- * Add an additional value.
- */
-@Test
-public void testAddAdditionalAttributeValue() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+    /**
+     * Add a new attribute with two values.
+     */
+    @Test
+    public void testAddNewAttributeValues() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Add telephoneNumber attribute
+        String[] newValues =
+            { "1234567890", "999999999" };
+        Attribute attr = new BasicAttribute( "telephoneNumber" );
+        attr.add( newValues[0] );
+        attr.add( newValues[1] );
+        Attributes attrs = new BasicAttributes( true );
+        attrs.put( attr );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    // A new description attribute value
-    String newValue = "A new description for this person";
-    assertFalse( newValue.equals( PERSON_DESCRIPTION ) );
-    Attributes attrs = new BasicAttributes( "description", newValue, true );
-
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that attribute value is added
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "description" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( newValue ) );
-    assertTrue( attr.contains( PERSON_DESCRIPTION ) );
-    assertEquals( 2, attr.size() );
-}
+        // Verify, that
+        // - case of attribute description is correct
+        // - attribute values are present
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        attr = attrs.get( "telephoneNumber" );
+        assertNotNull( attr );
+        assertEquals( "telephoneNumber", attr.getID() );
+        assertTrue( attr.contains( newValues[0] ) );
+        assertTrue( attr.contains( newValues[1] ) );
+        assertEquals( newValues.length, attr.size() );
+    }
 
 
-/**
- * Try to add an already existing attribute value.
- *
- * Expected behaviour: Modify operation fails with an
- * AttributeInUseException. Original LDAP Error code: 20 (Indicates that the
- * attribute value specified in a modify or add operation already exists as
- * a value for that attribute).
- */
-@Test
-public void testAddExistingAttributeValue() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+    /**
+     * Add an additional value.
+     */
+    @Test
+    public void testAddAdditionalAttributeValue() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-    // Change description attribute
-    Attributes attrs = new BasicAttributes( "description", PERSON_DESCRIPTION, true );
+        // A new description attribute value
+        String newValue = "A new description for this person";
+        assertFalse( newValue.equals( PERSON_DESCRIPTION ) );
+        Attributes attrs = new BasicAttributes( "description", newValue, true );
 
-    try
-    {
         ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-        fail( "Adding an already existing atribute value should fail." );
-    }
-    catch ( AttributeInUseException e )
-    {
-        // expected behaviour
-    }
 
-    // Verify, that attribute is still there, and is the only one
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "description" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( PERSON_DESCRIPTION ) );
-    assertEquals( 1, attr.size() );
-}
+        // Verify, that attribute value is added
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        Attribute attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValue ) );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
+        assertEquals( 2, attr.size() );
+    }
 
 
-/**
- * Try to add an already existing attribute value.
- *
- * Expected behaviour: Modify operation fails with an
- * AttributeInUseException. Original LDAP Error code: 20 (Indicates that the
- * attribute value specified in a modify or add operation already exists as
- * a value for that attribute).
- *
- * Check for bug DIR_SERVER664
- */
-@Test
-public void testAddExistingNthAttributesDirServer664() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-
-    // Change description attribute
-    Attributes attrs = new BasicAttributes( true );
-    attrs.put( new BasicAttribute( "telephoneNumber", "1" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "2" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "3" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "4" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "5" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "6" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "7" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "8" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "9" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "10" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "11" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "12" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "13" ) );
-    attrs.put( new BasicAttribute( "telephoneNumber", "14" ) );
+    /**
+     * Try to add an already existing attribute value.
+     *
+     * Expected behaviour: Modify operation fails with an
+     * AttributeInUseException. Original LDAP Error code: 20 (Indicates that the
+     * attribute value specified in a modify or add operation already exists as
+     * a value for that attribute).
+     */
+    @Test
+    public void testAddExistingAttributeValue() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-    Attribute attr = new BasicAttribute( "description", PERSON_DESCRIPTION );
+        // Change description attribute
+        Attributes attrs = new BasicAttributes( "description", PERSON_DESCRIPTION, true );
 
-    attrs.put( attr );
+        try
+        {
+            ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
+            fail( "Adding an already existing atribute value should fail." );
+        }
+        catch ( AttributeInUseException e )
+        {
+            // expected behaviour
+        }
 
-    try
-    {
-        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-        fail( "Adding an already existing atribute value should fail." );
-    }
-    catch ( AttributeInUseException e )
-    {
-        // expected behaviour
+        // Verify, that attribute is still there, and is the only one
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        Attribute attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
+        assertEquals( 1, attr.size() );
     }
 
-    // Verify, that attribute is still there, and is the only one
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    attr = attrs.get( "description" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( PERSON_DESCRIPTION ) );
-    assertEquals( 1, attr.size() );
-}
 
+    /**
+     * Try to add an already existing attribute value.
+     *
+     * Expected behaviour: Modify operation fails with an
+     * AttributeInUseException. Original LDAP Error code: 20 (Indicates that the
+     * attribute value specified in a modify or add operation already exists as
+     * a value for that attribute).
+     *
+     * Check for bug DIR_SERVER664
+     */
+    @Test
+    public void testAddExistingNthAttributesDirServer664() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Change description attribute
+        Attributes attrs = new BasicAttributes( true );
+        attrs.put( new BasicAttribute( "telephoneNumber", "1" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "2" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "3" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "4" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "5" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "6" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "7" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "8" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "9" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "10" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "11" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "12" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "13" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber", "14" ) );
 
-/**
- * Check for DIR_SERVER_643
- */
-@Test
-public void testTwoDescriptionDirServer643() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-
-    // Change description attribute
-    Attributes attrs = new BasicAttributes( true );
-    Attribute attr = new BasicAttribute( "description",
-        "a British singer-songwriter with an expressive four-octave voice" );
-    attr.add( "one of the most influential female artists of the twentieth century" );
-    attrs.put( attr );
-
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that attribute is still there, and is the only one
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    attr = attrs.get( "description" );
-    assertNotNull( attr );
-    assertEquals( 3, attr.size() );
-    assertTrue( attr.contains( "a British singer-songwriter with an expressive four-octave voice" ) );
-    assertTrue( attr.contains( "one of the most influential female artists of the twentieth century" ) );
-    assertTrue( attr.contains( PERSON_DESCRIPTION ) );
-}
+        Attribute attr = new BasicAttribute( "description", PERSON_DESCRIPTION );
 
+        attrs.put( attr );
 
-/**
- * Try to add a duplicate attribute value to an entry, where this attribute
- * is already present (objectclass in this case). Expected behaviour is that
- * the modify operation causes an error (error code 20, "Attribute or value
- * exists").
- */
-@Test
-public void testAddDuplicateValueToExistingAttribute() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        try
+        {
+            ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
+            fail( "Adding an already existing atribute value should fail." );
+        }
+        catch ( AttributeInUseException e )
+        {
+            // expected behaviour
+        }
 
-    // modify object classes, add a new value twice
-    Attribute ocls = new BasicAttribute( "objectClass", "organizationalPerson" );
-    ModificationItem[] modItems = new ModificationItem[2];
-    modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
-    modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
-    try
-    {
-        ctx.modifyAttributes( RDN_TORI_AMOS, modItems );
-        fail( "Adding a duplicate attribute value should cause an error." );
-    }
-    catch ( AttributeInUseException ex )
-    {
+        // Verify, that attribute is still there, and is the only one
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
+        assertEquals( 1, attr.size() );
     }
 
-    // Check, whether attribute objectClass is unchanged
-    Attributes attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    ocls = attrs.get( "objectClass" );
-    assertEquals( ocls.size(), 4 );
-    assertTrue( ocls.contains( "top" ) );
-    assertTrue( ocls.contains( "person" ) );
-}
 
+    /**
+     * Check for DIR_SERVER_643
+     */
+    @Test
+    public void testTwoDescriptionDirServer643() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Change description attribute
+        Attributes attrs = new BasicAttributes( true );
+        Attribute attr = new BasicAttribute( "description",
+            "a British singer-songwriter with an expressive four-octave voice" );
+        attr.add( "one of the most influential female artists of the twentieth century" );
+        attrs.put( attr );
 
-/**
- * Try to add a duplicate attribute value to an entry, where this attribute
- * is not present. Expected behaviour is that the modify operation causes an
- * error (error code 20, "Attribute or value exists").
- */
-@Test
-public void testAddDuplicateValueToNewAttribute() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    // add the same description value twice
-    Attribute desc = new BasicAttribute( "description", "another description value besides songwriter" );
-    ModificationItem[] modItems = new ModificationItem[2];
-    modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
-    modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
-    try
-    {
-        ctx.modifyAttributes( RDN_TORI_AMOS, modItems );
-        fail( "Adding a duplicate attribute value should cause an error." );
-    }
-    catch ( AttributeInUseException ex )
-    {
+        // Verify, that attribute is still there, and is the only one
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertEquals( 3, attr.size() );
+        assertTrue( attr.contains( "a British singer-songwriter with an expressive four-octave voice" ) );
+        assertTrue( attr.contains( "one of the most influential female artists of the twentieth century" ) );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
     }
 
-    // Check, whether attribute description is still not present
-    Attributes attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    assertEquals( 1, attrs.get( "description" ).size() );
-}
 
+    /**
+     * Try to add a duplicate attribute value to an entry, where this attribute
+     * is already present (objectclass in this case). Expected behaviour is that
+     * the modify operation causes an error (error code 20, "Attribute or value
+     * exists").
+     */
+    @Test
+    public void testAddDuplicateValueToExistingAttribute() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // modify object classes, add a new value twice
+        Attribute ocls = new BasicAttribute( "objectClass", "organizationalPerson" );
+        ModificationItem[] modItems = new ModificationItem[2];
+        modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
+        modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
+        try
+        {
+            ctx.modifyAttributes( RDN_TORI_AMOS, modItems );
+            fail( "Adding a duplicate attribute value should cause an error." );
+        }
+        catch ( AttributeInUseException ex )
+        {
+        }
 
-/**
- * Modify the entry with a bad attribute : this should fail
- */
-@Test
-public void testSearchBadAttribute() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        // Check, whether attribute objectClass is unchanged
+        Attributes attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        ocls = attrs.get( "objectClass" );
+        assertEquals( ocls.size(), 4 );
+        assertTrue( ocls.contains( "top" ) );
+        assertTrue( ocls.contains( "person" ) );
+    }
 
-    // Add a not existing attribute
-    String newValue = "unbelievable";
-    Attributes attrs = new BasicAttributes( "voice", newValue, true );
 
-    try
-    {
-        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-    }
-    catch ( NoSuchAttributeException nsae )
-    {
-        // We have a failure : the attribute is unknown in the schema
-        assertTrue( true );
-        return;
+    /**
+     * Try to add a duplicate attribute value to an entry, where this attribute
+     * is not present. Expected behaviour is that the modify operation causes an
+     * error (error code 20, "Attribute or value exists").
+     */
+    @Test
+    public void testAddDuplicateValueToNewAttribute() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // add the same description value twice
+        Attribute desc = new BasicAttribute( "description", "another description value besides songwriter" );
+        ModificationItem[] modItems = new ModificationItem[2];
+        modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
+        modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
+        try
+        {
+            ctx.modifyAttributes( RDN_TORI_AMOS, modItems );
+            fail( "Adding a duplicate attribute value should cause an error." );
+        }
+        catch ( AttributeInUseException ex )
+        {
+        }
+
+        // Check, whether attribute description is still not present
+        Attributes attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        assertEquals( 1, attrs.get( "description" ).size() );
     }
 
-    fail( "Cannot reach this point" );
-}
 
+    /**
+     * Modify the entry with a bad attribute : this should fail
+     */
+    @Test
+    public void testSearchBadAttribute() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-/**
- * Create a person entry and perform a modify op, in which
- * we modify an attribute two times.
- */
-@Test
-public void testAttributeValueMultiMofificationDIRSERVER_636() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        // Add a not existing attribute
+        String newValue = "unbelievable";
+        Attributes attrs = new BasicAttributes( "voice", newValue, true );
 
-    // Create a person entry
-    Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
-    String rdn = "cn=Kate Bush";
-    ctx.createSubcontext( rdn, attrs );
-
-    // Add a description with two values
-    String[] descriptions =
-        {
-            "Kate Bush is a British singer-songwriter.",
-            "She has become one of the most influential female artists of the twentieth century." };
-    Attribute desc1 = new BasicAttribute( "description" );
-    desc1.add( descriptions[0] );
-    desc1.add( descriptions[1] );
-
-    ModificationItem addModOp = new ModificationItem(
-        DirContext.ADD_ATTRIBUTE, desc1 );
-
-    Attribute desc2 = new BasicAttribute( "description" );
-    desc2.add( descriptions[1] );
-    ModificationItem delModOp = new ModificationItem(
-        DirContext.REMOVE_ATTRIBUTE, desc2 );
-
-    ctx.modifyAttributes( rdn, new ModificationItem[]
-        { addModOp,
-            delModOp } );
-
-    SearchControls sctls = new SearchControls();
-    sctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-    String filter = "(cn=*Bush)";
-    String base = "";
-
-    // Check entry
-    NamingEnumeration<SearchResult> enm = ctx.search( base, filter, sctls );
-    assertTrue( enm.hasMore() );
-
-    while ( enm.hasMore() )
-    {
-        SearchResult sr = enm.next();
-        attrs = sr.getAttributes();
-        Attribute desc = sr.getAttributes().get( "description" );
-        assertEquals( 1, desc.size() );
-        assertTrue( desc.contains( descriptions[0] ) );
+        try
+        {
+            ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
+        }
+        catch ( NoSuchAttributeException nsae )
+        {
+            // We have a failure : the attribute is unknown in the schema
+            assertTrue( true );
+            return;
+        }
+
+        fail( "Cannot reach this point" );
     }
 
-    // Remove the person entry
-    ctx.destroySubcontext( rdn );
-}
 
+    /**
+     * Create a person entry and perform a modify op, in which
+     * we modify an attribute two times.
+     */
+    @Test
+    public void testAttributeValueMultiMofificationDIRSERVER_636() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Create a person entry
+        Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
+        String rdn = "cn=Kate Bush";
+        ctx.createSubcontext( rdn, attrs );
+
+        // Add a description with two values
+        String[] descriptions =
+            {
+                "Kate Bush is a British singer-songwriter.",
+                "She has become one of the most influential female artists of the twentieth century." };
+        Attribute desc1 = new BasicAttribute( "description" );
+        desc1.add( descriptions[0] );
+        desc1.add( descriptions[1] );
+
+        ModificationItem addModOp = new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, desc1 );
+
+        Attribute desc2 = new BasicAttribute( "description" );
+        desc2.add( descriptions[1] );
+        ModificationItem delModOp = new ModificationItem(
+            DirContext.REMOVE_ATTRIBUTE, desc2 );
 
-/**
- * Try to add subschemaSubentry attribute to an entry
- */
-@Test
-public void testModifyOperationalAttributeAdd() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        ctx.modifyAttributes( rdn, new ModificationItem[]
+            { addModOp,
+                delModOp } );
 
-    ModificationItem modifyOp = new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute(
-        "subschemaSubentry", "cn=anotherSchema" ) );
+        SearchControls sctls = new SearchControls();
+        sctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        String filter = "(cn=*Bush)";
+        String base = "";
+
+        // Check entry
+        NamingEnumeration<SearchResult> enm = ctx.search( base, filter, sctls );
+        assertTrue( enm.hasMore() );
 
-    try
-    {
-        ctx.modifyAttributes( RDN_DEBBIE_HARRY, new ModificationItem[]
-            { modifyOp } );
+        while ( enm.hasMore() )
+        {
+            SearchResult sr = enm.next();
+            attrs = sr.getAttributes();
+            Attribute desc = sr.getAttributes().get( "description" );
+            assertEquals( 1, desc.size() );
+            assertTrue( desc.contains( descriptions[0] ) );
+        }
 
-        fail( "modification of entry should fail" );
-    }
-    catch ( InvalidAttributeValueException e )
-    {
-        // Expected result
-    }
-    catch ( NoPermissionException e )
-    {
-        // Expected result
+        // Remove the person entry
+        ctx.destroySubcontext( rdn );
     }
-}
 
 
-/**
- * Create a person entry and perform a modify op on an
- * attribute which is part of the Dn. This is not allowed.
- *
- * A JIRA has been created for this bug : DIRSERVER_687
- */
-@Test
-public void testDNAttributeMemberModificationDIRSERVER_687() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-
-    // Create a person entry
-    Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
-    String rdn = "cn=Kate Bush";
-    ctx.createSubcontext( rdn, attrs );
+    /**
+     * Try to add subschemaSubentry attribute to an entry
+     */
+    @Test
+    public void testModifyOperationalAttributeAdd() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-    // Try to modify the cn attribute
-    Attribute desc1 = new BasicAttribute( "cn", "Georges Bush" );
+        ModificationItem modifyOp = new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute(
+            "subschemaSubentry", "cn=anotherSchema" ) );
 
-    ModificationItem addModOp = new ModificationItem(
-        DirContext.REPLACE_ATTRIBUTE, desc1 );
+        try
+        {
+            ctx.modifyAttributes( RDN_DEBBIE_HARRY, new ModificationItem[]
+                { modifyOp } );
 
-    try
-    {
-        ctx.modifyAttributes( rdn, new ModificationItem[]
-            { addModOp } );
-        fail();
-    }
-    catch ( AttributeModificationException ame )
-    {
-        assertTrue( true );
-        // Remove the person entry
-        ctx.destroySubcontext( rdn );
+            fail( "modification of entry should fail" );
+        }
+        catch ( InvalidAttributeValueException e )
+        {
+            // Expected result
+        }
+        catch ( NoPermissionException e )
+        {
+            // Expected result
+        }
     }
-    catch ( NamingException ne )
+
+
+    /**
+     * Create a person entry and perform a modify op on an
+     * attribute which is part of the Dn. This is not allowed.
+     *
+     * A JIRA has been created for this bug : DIRSERVER_687
+     */
+    @Test
+    public void testDNAttributeMemberModificationDIRSERVER_687() throws Exception
     {
-        assertTrue( true );
-        // Remove the person entry
-        ctx.destroySubcontext( rdn );
-    }
-}
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
+        // Create a person entry
+        Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
+        String rdn = "cn=Kate Bush";
+        ctx.createSubcontext( rdn, attrs );
 
-/**
- * Try to modify an entry adding invalid number of values for a single-valued atribute
- *
- * @see <a href="http://issues.apache.org/jira/browse/DIRSERVER-614">DIRSERVER-614</a>
- */
-@Test
-public void testModifyAddWithInvalidNumberOfAttributeValues() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        // Try to modify the cn attribute
+        Attribute desc1 = new BasicAttribute( "cn", "Georges Bush" );
 
-    Attributes attrs = new BasicAttributes( true );
-    Attribute ocls = new BasicAttribute( "objectClass" );
-    ocls.add( "top" );
-    ocls.add( "inetOrgPerson" );
-    attrs.put( ocls );
-    attrs.put( "cn", "Fiona Apple" );
-    attrs.put( "sn", "Apple" );
-    ctx.createSubcontext( "cn=Fiona Apple", attrs );
-
-    // add two displayNames to an inetOrgPerson
-    attrs = new BasicAttributes( true );
-    Attribute displayName = new BasicAttribute( "displayName" );
-    displayName.add( "Fiona" );
-    displayName.add( "Fiona A." );
-    attrs.put( displayName );
+        ModificationItem addModOp = new ModificationItem(
+            DirContext.REPLACE_ATTRIBUTE, desc1 );
 
-    try
-    {
-        ctx.modifyAttributes( "cn=Fiona Apple", DirContext.ADD_ATTRIBUTE, attrs );
-        fail( "modification of entry should fail" );
+        try
+        {
+            ctx.modifyAttributes( rdn, new ModificationItem[]
+                { addModOp } );
+            fail();
+        }
+        catch ( AttributeModificationException ame )
+        {
+            assertTrue( true );
+            // Remove the person entry
+            ctx.destroySubcontext( rdn );
+        }
+        catch ( NamingException ne )
+        {
+            assertTrue( true );
+            // Remove the person entry
+            ctx.destroySubcontext( rdn );
+        }
     }
-    catch ( InvalidAttributeValueException e )
-    {
 
-    }
-}
 
+    /**
+     * Try to modify an entry adding invalid number of values for a single-valued atribute
+     *
+     * @see <a href="http://issues.apache.org/jira/browse/DIRSERVER-614">DIRSERVER-614</a>
+     */
+    @Test
+    public void testModifyAddWithInvalidNumberOfAttributeValues() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        Attributes attrs = new BasicAttributes( true );
+        Attribute ocls = new BasicAttribute( "objectClass" );
+        ocls.add( "top" );
+        ocls.add( "inetOrgPerson" );
+        attrs.put( ocls );
+        attrs.put( "cn", "Fiona Apple" );
+        attrs.put( "sn", "Apple" );
+        ctx.createSubcontext( "cn=Fiona Apple", attrs );
+
+        // add two displayNames to an inetOrgPerson
+        attrs = new BasicAttributes( true );
+        Attribute displayName = new BasicAttribute( "displayName" );
+        displayName.add( "Fiona" );
+        displayName.add( "Fiona A." );
+        attrs.put( displayName );
 
-/**
- * Add a new binary attribute to a person entry.
- */
-@Test
-public void testAddNewBinaryAttributeValue() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+        try
+        {
+            ctx.modifyAttributes( "cn=Fiona Apple", DirContext.ADD_ATTRIBUTE, attrs );
+            fail( "modification of entry should fail" );
+        }
+        catch ( InvalidAttributeValueException e )
+        {
 
-    // Add a binary attribute
-    byte[] newValue = new byte[]
-        { 0x00, 0x01, 0x02, 0x03 };
-    Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue, true );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that attribute value is added
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "userCertificate" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( newValue ) );
-    byte[] certificate = ( byte[] ) attr.get();
-    assertTrue( Arrays.equals( newValue, certificate ) );
-    assertEquals( 1, attr.size() );
-}
+        }
+    }
 
 
-/**
- * Add a new attribute to a person entry.
- */
-@Test
-public void testAddNewBinaryAttributeValueAbove0x80() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+    /**
+     * Add a new binary attribute to a person entry.
+     */
+    @Test
+    public void testAddNewBinaryAttributeValue() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-    // Add a binary attribute
-    byte[] newValue = new byte[]
-        { ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83 };
-    Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue, true );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that attribute value is added
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "userCertificate" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( newValue ) );
-    byte[] certificate = ( byte[] ) attr.get();
-    assertTrue( Arrays.equals( newValue, certificate ) );
-    assertEquals( 1, attr.size() );
-}
+        // Add a binary attribute
+        byte[] newValue = new byte[]
+            { 0x00, 0x01, 0x02, 0x03 };
+        Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue, true );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
+        // Verify, that attribute value is added
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        Attribute attr = attrs.get( "userCertificate" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValue ) );
+        byte[] certificate = ( byte[] ) attr.get();
+        assertTrue( Arrays.equals( newValue, certificate ) );
+        assertEquals( 1, attr.size() );
+    }
 
-/**
- * Add a new binary attribute to a person entry.
- */
-@Test
-public void testRetrieveEntryWithBinaryAttributeValue() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
 
-    // Add a ;binary attribute
-    byte[] newValue = new byte[]
-        { 0x00, 0x01, 0x02, 0x03 };
-    Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Search entry an request ;binary attribute
-    SearchControls sctls = new SearchControls();
-    sctls.setSearchScope( SearchControls.OBJECT_SCOPE );
-    sctls.setReturningAttributes( new String[]
-        { "userCertificate;binary" } );
-    String filter = "(objectClass=*)";
-    String base = RDN_TORI_AMOS;
-
-    // Test that ;binary attribute is present
-    NamingEnumeration<SearchResult> enm = ctx.search( base, filter, sctls );
-    assertTrue( enm.hasMore() );
+    /**
+     * Add a new attribute to a person entry.
+     */
+    @Test
+    public void testAddNewBinaryAttributeValueAbove0x80() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Add a binary attribute
+        byte[] newValue = new byte[]
+            { ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83 };
+        Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue, true );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    while ( enm.hasMore() )
-    {
-        SearchResult sr = enm.next();
-        attrs = sr.getAttributes();
+        // Verify, that attribute value is added
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
         Attribute attr = attrs.get( "userCertificate" );
         assertNotNull( attr );
         assertTrue( attr.contains( newValue ) );
@@ -675,134 +630,173 @@ public void testRetrieveEntryWithBinaryA
         assertEquals( 1, attr.size() );
     }
 
-}
-
 
-/**
- * Add a new ;binary attribute with bytes greater than 0x80
- * to a person entry.
- * Test for DIRSERVER-1146
- *
- * @throws NamingException
- */
-public void testAddNewBinaryAttributeValue0x80() throws Exception
-{
-    DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+    /**
+     * Add a new binary attribute to a person entry.
+     */
+    @Test
+    public void testRetrieveEntryWithBinaryAttributeValue() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Add a ;binary attribute
+        byte[] newValue = new byte[]
+            { 0x00, 0x01, 0x02, 0x03 };
+        Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    // Add a ;binary attribute with high-bytes
-    byte[] newValue = new byte[]
-        { ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83 };
-    Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue );
-    ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-
-    // Verify, that attribute value is added
-    attrs = ctx.getAttributes( RDN_TORI_AMOS );
-    Attribute attr = attrs.get( "userCertificate" );
-    assertNotNull( attr );
-    assertTrue( attr.contains( newValue ) );
-    byte[] certificate = ( byte[] ) attr.get();
-    assertTrue( Arrays.equals( newValue, certificate ) );
-    assertEquals( 1, attr.size() );
-}
+        // Search entry an request ;binary attribute
+        SearchControls sctls = new SearchControls();
+        sctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        sctls.setReturningAttributes( new String[]
+            { "userCertificate;binary" } );
+        String filter = "(objectClass=*)";
+        String base = RDN_TORI_AMOS;
+
+        // Test that ;binary attribute is present
+        NamingEnumeration<SearchResult> enm = ctx.search( base, filter, sctls );
+        assertTrue( enm.hasMore() );
 
+        while ( enm.hasMore() )
+        {
+            SearchResult sr = enm.next();
+            attrs = sr.getAttributes();
+            Attribute attr = attrs.get( "userCertificate" );
+            assertNotNull( attr );
+            assertTrue( attr.contains( newValue ) );
+            byte[] certificate = ( byte[] ) attr.get();
+            assertTrue( Arrays.equals( newValue, certificate ) );
+            assertEquals( 1, attr.size() );
+        }
 
-@Test
-public void testModifyAddWithNullValues() throws LdapException, IOException
-{
-    LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
-    connection.setTimeOut( 0L );
+    }
 
-    // Use the client API
-    connection.bind( "uid=admin,ou=system", "secret" );
 
-    // Add a new entry with some null values
-    Entry entry = new DefaultEntry( "uid=12345,ou=system",
-        "ObjectClass: top",
-        "ObjectClass: person",
-        "ObjectClass: person",
-        "ObjectClass: OrganizationalPerson",
-        "ObjectClass: inetOrgPerson",
-        "uid: 12345",
-        "cn: test",
-        "sn: Test",
-        "userPassword: 12345" );
-
-    connection.add( entry );
-
-    // Now modify the entry : we should add two null values
-    connection.modify( new Dn( "uid=12345,ou=system" ),
-        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
-        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
-        );
-
-    // Get back the entry
-    Entry found = connection.lookup( "uid=12345,ou=system" );
-
-    assertNotNull( found );
-    assertNotNull( found.get( "mail" ) );
-    assertNotNull( found.get( "userPassword" ) );
-    assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
-    assertTrue( found.contains( "userPassword", "12345", "" ) );
+    /**
+     * Add a new ;binary attribute with bytes greater than 0x80
+     * to a person entry.
+     * Test for DIRSERVER-1146
+     *
+     * @throws NamingException
+     */
+    public void testAddNewBinaryAttributeValue0x80() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+
+        // Add a ;binary attribute with high-bytes
+        byte[] newValue = new byte[]
+            { ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0x82, ( byte ) 0x83 };
+        Attributes attrs = new BasicAttributes( "userCertificate;binary", newValue );
+        ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
 
-    connection.close();
-}
+        // Verify, that attribute value is added
+        attrs = ctx.getAttributes( RDN_TORI_AMOS );
+        Attribute attr = attrs.get( "userCertificate" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValue ) );
+        byte[] certificate = ( byte[] ) attr.get();
+        assertTrue( Arrays.equals( newValue, certificate ) );
+        assertEquals( 1, attr.size() );
+    }
 
 
-@Test
-public void testModifyReplaceWithNullValues() throws LdapException, IOException
-{
-    LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
-    connection.setTimeOut( 0L );
+    @Test
+    public void testModifyAddWithNullValues() throws LdapException, IOException
+    {
+        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        connection.setTimeOut( 0L );
 
-    // Use the client API
-    connection.bind( "uid=admin,ou=system", "secret" );
+        // Use the client API
+        connection.bind( "uid=admin,ou=system", "secret" );
 
-    // Add a new entry with some null values
-    Entry entry = new DefaultEntry( "uid=12345,ou=system",
-        "ObjectClass: top",
-        "ObjectClass: person",
-        "ObjectClass: person",
-        "ObjectClass: OrganizationalPerson",
-        "ObjectClass: inetOrgPerson",
-        "uid: 12345",
-        "cn: test",
-        "sn: Test",
-        "userPassword: 12345" );
-
-    connection.add( entry );
-
-    // Now modify the entry : we should replace the password with a null value
-    // and add a mail Attribute with a null value
-    connection.modify( new Dn( "uid=12345,ou=system" ),
-        new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
-        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
-        );
-
-    // Get back the entry
-    Entry found = connection.lookup( "uid=12345,ou=system" );
-
-    assertNotNull( found );
-    assertNotNull( found.get( "mail" ) );
-    assertNotNull( found.get( "userPassword" ) );
-    assertEquals( 1, found.get( "mail" ).size() );
-    assertEquals( 1, found.get( "userPassword" ).size() );
-    assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
-    assertTrue( found.contains( "userPassword", "" ) );
-
-    // Now, do a replace with no value. We should not anymore have a mail
-    connection.modify( new Dn( "uid=12345,ou=system" ),
-        new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "mail" )
-        );
-
-    // Get back the entry
-    found = connection.lookup( "uid=12345,ou=system" );
-
-    assertNotNull( found );
-    assertNull( found.get( "mail" ) );
-    assertNotNull( found.get( "userPassword" ) );
-    assertEquals( 1, found.get( "userPassword" ).size() );
-    assertTrue( found.contains( "userPassword", "" ) );
+        // Add a new entry with some null values
+        Entry entry = new DefaultEntry( "uid=12345,ou=system",
+            "ObjectClass: top",
+            "ObjectClass: person",
+            "ObjectClass: person",
+            "ObjectClass: OrganizationalPerson",
+            "ObjectClass: inetOrgPerson",
+            "uid: 12345",
+            "cn: test",
+            "sn: Test",
+            "userPassword: 12345" );
+
+        connection.add( entry );
+
+        // Now modify the entry : we should add two null values
+        connection.modify( new Dn( "uid=12345,ou=system" ),
+            new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
+            new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
+            );
+
+        // Get back the entry
+        Entry found = connection.lookup( "uid=12345,ou=system" );
+
+        assertNotNull( found );
+        assertNotNull( found.get( "mail" ) );
+        assertNotNull( found.get( "userPassword" ) );
+        assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
+        assertTrue( found.contains( "userPassword", "12345", "" ) );
+
+        connection.close();
+    }
+
+
+    @Test
+    public void testModifyReplaceWithNullValues() throws LdapException, IOException
+    {
+        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        connection.setTimeOut( 0L );
+
+        // Use the client API
+        connection.bind( "uid=admin,ou=system", "secret" );
+
+        // Add a new entry with some null values
+        Entry entry = new DefaultEntry( "uid=12345,ou=system",
+            "ObjectClass: top",
+            "ObjectClass: person",
+            "ObjectClass: person",
+            "ObjectClass: OrganizationalPerson",
+            "ObjectClass: inetOrgPerson",
+            "uid: 12345",
+            "cn: test",
+            "sn: Test",
+            "userPassword: 12345" );
+
+        connection.add( entry );
+
+        // Now modify the entry : we should replace the password with a null value
+        // and add a mail Attribute with a null value
+        connection.modify( new Dn( "uid=12345,ou=system" ),
+            new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
+            new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
+            );
+
+        // Get back the entry
+        Entry found = connection.lookup( "uid=12345,ou=system" );
+
+        assertNotNull( found );
+        assertNotNull( found.get( "mail" ) );
+        assertNotNull( found.get( "userPassword" ) );
+        assertEquals( 1, found.get( "mail" ).size() );
+        assertEquals( 1, found.get( "userPassword" ).size() );
+        assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
+        assertTrue( found.contains( "userPassword", "" ) );
+
+        // Now, do a replace with no value. We should not anymore have a mail
+        connection.modify( new Dn( "uid=12345,ou=system" ),
+            new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "mail" )
+            );
+
+        // Get back the entry
+        found = connection.lookup( "uid=12345,ou=system" );
+
+        assertNotNull( found );
+        assertNull( found.get( "mail" ) );
+        assertNotNull( found.get( "userPassword" ) );
+        assertEquals( 1, found.get( "userPassword" ).size() );
+        assertTrue( found.contains( "userPassword", "" ) );
 
-    connection.close();
-}
+        connection.close();
+    }
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyMultipleChangesIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyMultipleChangesIT.java?rev=1509635&r1=1509634&r2=1509635&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyMultipleChangesIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyMultipleChangesIT.java Fri Aug  2 11:26:45 2013
@@ -23,7 +23,6 @@ package org.apache.directory.server.oper
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import javax.naming.NamingEnumeration;
@@ -36,19 +35,11 @@ import javax.naming.directory.Modificati
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.directory.api.ldap.model.entry.DefaultEntry;
-import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.util.Strings;
-import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
-import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -83,16 +74,13 @@ import org.junit.runner.RunWith;
         "objectClass: person",
         "objectClass: top",
         "cn: Debbie Harry",
-        "sn: Harry"
-})
+        "sn: Harry" })
 public class ModifyMultipleChangesIT extends AbstractLdapTestUnit
 {
-    @Rule
-    public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
     private static final String BASE = "ou=system";
     private static final String RDN_TORI_AMOS = "cn=Tori Amos";
-    
-    
+
+
     /**
      * Creation of required attributes of a person entry.
      */
@@ -107,11 +95,11 @@ public class ModifyMultipleChangesIT ext
         attributes.put( attribute );
         attributes.put( "cn", cn );
         attributes.put( "sn", sn );
-    
+
         return attributes;
     }
-    
-    
+
+
     /**
      * Add a new attribute with two values.
      */
@@ -119,7 +107,7 @@ public class ModifyMultipleChangesIT ext
     public void testAddNewAttributeValues() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Add telephoneNumber attribute
         String[] newValues =
             { "1234567890", "999999999" };
@@ -129,7 +117,7 @@ public class ModifyMultipleChangesIT ext
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
         ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
-    
+
         // Verify, that
         // - case of attribute description is correct
         // - attribute values are present
@@ -141,8 +129,8 @@ public class ModifyMultipleChangesIT ext
         assertTrue( attr.contains( newValues[1] ) );
         assertEquals( newValues.length, attr.size() );
     }
-    
-    
+
+
     /**
      * Create a person entry and perform a modify op, in which
      * we modify an attribute two times.
@@ -151,12 +139,12 @@ public class ModifyMultipleChangesIT ext
     public void testAttributeValueMultiMofificationDIRSERVER_636() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create a person entry
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
+
         // Add a description with two values
         String[] descriptions =
             {
@@ -165,28 +153,28 @@ public class ModifyMultipleChangesIT ext
         Attribute desc1 = new BasicAttribute( "description" );
         desc1.add( descriptions[0] );
         desc1.add( descriptions[1] );
-    
+
         ModificationItem addModOp = new ModificationItem(
             DirContext.ADD_ATTRIBUTE, desc1 );
-    
+
         Attribute desc2 = new BasicAttribute( "description" );
         desc2.add( descriptions[1] );
         ModificationItem delModOp = new ModificationItem(
             DirContext.REMOVE_ATTRIBUTE, desc2 );
-    
+
         ctx.modifyAttributes( rdn, new ModificationItem[]
             { addModOp,
                 delModOp } );
-    
+
         SearchControls sctls = new SearchControls();
         sctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         String filter = "(cn=*Bush)";
         String base = "";
-    
+
         // Check entry
         NamingEnumeration<SearchResult> enm = ctx.search( base, filter, sctls );
         assertTrue( enm.hasMore() );
-    
+
         while ( enm.hasMore() )
         {
             SearchResult sr = enm.next();
@@ -195,7 +183,7 @@ public class ModifyMultipleChangesIT ext
             assertEquals( 1, desc.size() );
             assertTrue( desc.contains( descriptions[0] ) );
         }
-    
+
         // Remove the person entry
         ctx.destroySubcontext( rdn );
     }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java?rev=1509635&r1=1509634&r2=1509635&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java Fri Aug  2 11:26:45 2013
@@ -39,7 +39,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaITImpl;
 import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
@@ -47,7 +46,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.operations.compare.CompareIT;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -106,15 +104,12 @@ import org.slf4j.LoggerFactory;
         "uid: akarasuluref",
         "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
         "ref: ldap://foo:10389/uid=akarasulu,ou=users,ou=system",
-        "ref: ldap://bar:10389/uid=akarasulu,ou=users,ou=system"
-})
+        "ref: ldap://bar:10389/uid=akarasulu,ou=users,ou=system" })
 public class ModifyReferralIT extends AbstractLdapTestUnit
 {
-    @Rule
-    public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
     private static final Logger LOG = LoggerFactory.getLogger( CompareIT.class );
-    
-    
+
+
     /**
      * Tests modify operation on referral entry with the ManageDsaIT control.
      */
@@ -122,24 +117,24 @@ public class ModifyReferralIT extends Ab
     public void testOnReferralWithManageDsaITControl() throws Exception
     {
         LdapConnection conn = getWiredConnection( getLdapServer() );
-    
+
         ManageDsaIT manageDSAIT = new ManageDsaITImpl();
         manageDSAIT.setCritical( true );
-    
+
         // modify success
         ModifyRequest modifyRequest = new ModifyRequestImpl();
         modifyRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
         modifyRequest.add( "description", "referral to akarasulu" );
         modifyRequest.addControl( manageDSAIT );
-    
+
         conn.modify( modifyRequest );
-    
+
         assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", "description", "referral to akarasulu" ) );
-    
+
         conn.close();
     }
-    
-    
+
+
     /**
      * Tests modify operation on referral entries without the
      * ManageDsaIT control. Referrals are sent back to the client with a
@@ -149,28 +144,28 @@ public class ModifyReferralIT extends Ab
     public void testOnReferral() throws Exception
     {
         LdapConnection conn = getWiredConnection( getLdapServer() );
-    
+
         // referrals failure
         // modify success
         ModifyRequest modifyRequest = new ModifyRequestImpl();
         modifyRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
         modifyRequest.add( "description", "referral to akarasulu" );
-    
+
         ModifyResponse modifyResponse = conn.modify( modifyRequest );
-    
+
         assertEquals( ResultCodeEnum.REFERRAL, modifyResponse.getLdapResult().getResultCode() );
-    
+
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
-    
+
         conn.close();
     }
-    
-    
+
+
     /**
      * Tests modify operation on normal and referral entries without the
      * ManageDsaIT control using JNDI instead of the Netscape API. Referrals
@@ -180,11 +175,11 @@ public class ModifyReferralIT extends Ab
     public void testThrowOnReferralWithJndi() throws Exception
     {
         LdapContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
-    
+
         // modify failure
         Attribute attr = new BasicAttribute( "description", "referral to akarasulu" );
         ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
-    
+
         try
         {
             ctx.modifyAttributes( "uid=akarasuluref,ou=users,ou=system", new ModificationItem[]
@@ -195,11 +190,11 @@ public class ModifyReferralIT extends Ab
             // seems JNDI only returns the first referral URL and not all so we test for it
             assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
         }
-    
+
         ctx.close();
     }
-    
-    
+
+
     /**
      * Tests referral handling when an ancestor is a referral.
      */
@@ -207,25 +202,25 @@ public class ModifyReferralIT extends Ab
     public void testAncestorReferral() throws Exception
     {
         LOG.debug( "" );
-    
+
         LdapConnection conn = getWiredConnection( getLdapServer() );
-    
+
         // referrals failure
         ModifyRequest modifyRequest = new ModifyRequestImpl();
         modifyRequest.setName( new Dn( "ou=Computers,uid=akarasuluref,ou=users,ou=system" ) );
         modifyRequest.add( "ou", "Machines" );
-    
+
         ModifyResponse modifyResponse = conn.modify( modifyRequest );
-    
+
         assertEquals( ResultCodeEnum.REFERRAL, modifyResponse.getLdapResult().getResultCode() );
-    
+
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
         assertTrue( modifyResponse.getLdapResult().getReferral().getLdapUrls()
             .contains( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
-    
+
         conn.close();
     }
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java?rev=1509635&r1=1509634&r2=1509635&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java Fri Aug  2 11:26:45 2013
@@ -42,14 +42,12 @@ import javax.naming.directory.SchemaViol
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -75,16 +73,13 @@ import org.junit.runner.RunWith;
         "objectClass: top",
         "description: an American singer-songwriter",
         "cn: Tori Amos",
-        "sn: Amos"
-})
+        "sn: Amos" })
 public class ModifyRemoveIT extends AbstractLdapTestUnit
 {
-    @Rule
-    public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
     private static final String BASE = "ou=system";
     private static final String RDN = "cn=Tori Amos";
-    
-    
+
+
     /**
      * Enable the krb5kdc schema.
      */
@@ -92,20 +87,20 @@ public class ModifyRemoveIT extends Abst
     public void setUp() throws Exception
     {
         DirContext schemaRoot = ( DirContext ) getWiredContext( getLdapServer() ).lookup( "ou=schema" );
-    
+
         // -------------------------------------------------------------------
         // Enable the krb5kdc schema
         // -------------------------------------------------------------------
-    
+
         // check if krb5kdc is disabled
         Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=Krb5kdc" );
         boolean isKrb5KdcDisabled = false;
-    
+
         if ( krb5kdcAttrs.get( "m-disabled" ) != null )
         {
             isKrb5KdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
         }
-    
+
         // if krb5kdc is disabled then enable it
         if ( isKrb5KdcDisabled )
         {
@@ -115,8 +110,8 @@ public class ModifyRemoveIT extends Abst
             schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
         }
     }
-    
-    
+
+
     /**
      * Creation of required attributes of a person entry.
      */
@@ -129,11 +124,11 @@ public class ModifyRemoveIT extends Abst
         attributes.put( attribute );
         attributes.put( "cn", cn );
         attributes.put( "sn", sn );
-    
+
         return attributes;
     }
-    
-    
+
+
     /**
      * Creation of required attributes of an inetOrgPerson entry.
      */
@@ -148,11 +143,11 @@ public class ModifyRemoveIT extends Abst
         attrs.put( ocls );
         attrs.put( "cn", cn );
         attrs.put( "sn", sn );
-    
+
         return attrs;
     }
-    
-    
+
+
     /**
      * Remove a value which does not exist in an attribute making sure
      * it does not remove other values in that attribute.  Tests if the
@@ -164,7 +159,7 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveAttemptWithoutChange() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Get the attributes and check the contents
         Attributes tori = ctx.getAttributes( RDN );
         assertNotNull( tori.get( "objectClass" ) );
@@ -172,7 +167,7 @@ public class ModifyRemoveIT extends Abst
         assertEquals( 1, tori.get( "cn" ).size() );
         assertEquals( "Tori Amos", tori.get( "cn" ).get() );
         assertNotNull( tori.get( "sn" ) );
-    
+
         // Test an add operation first
         ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "cn", "foo" ) );
         ctx.modifyAttributes( RDN, new ModificationItem[]
@@ -184,7 +179,7 @@ public class ModifyRemoveIT extends Abst
         assertEquals( "Tori Amos", tori.get( "cn" ).get( 0 ) );
         assertEquals( "foo", tori.get( "cn" ).get( 1 ) );
         assertNotNull( tori.get( "sn" ) );
-    
+
         // Now test remove of value ( bar ) that does not exist in cn
         mod = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute( "cn", "bar" ) );
         try
@@ -197,7 +192,7 @@ public class ModifyRemoveIT extends Abst
         {
             assertTrue( true );
         }
-    
+
         tori = ctx.getAttributes( RDN );
         assertNotNull( tori.get( "objectClass" ) );
         assertNotNull( tori.get( "cn" ) );
@@ -206,8 +201,8 @@ public class ModifyRemoveIT extends Abst
         assertEquals( "foo", tori.get( "cn" ).get( 1 ) );
         assertNotNull( tori.get( "sn" ) );
     }
-    
-    
+
+
     /**
      * Remove an attribute, which is not required.
      * 
@@ -218,20 +213,20 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveNotRequiredAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove description Attribute
         Attribute attr = new BasicAttribute( "description" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
         ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
-    
+
         // Verify, that attribute is deleted
         attrs = ctx.getAttributes( RDN );
         attr = attrs.get( "description" );
         assertNull( attr );
     }
-    
-    
+
+
     /**
      * Remove two not required attributes.
      * 
@@ -242,17 +237,17 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveTwoNotRequiredAttributes() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // add telephoneNumber to entry
         Attributes tn = new BasicAttributes( "telephoneNumber", "12345678", true );
         ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, tn );
-    
+
         // Remove description and telephoneNumber to Attribute
         Attributes attrs = new BasicAttributes( true );
         attrs.put( new BasicAttribute( "description" ) );
         attrs.put( new BasicAttribute( "telephoneNumber" ) );
         ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
-    
+
         // Verify, that attributes are deleted
         attrs = ctx.getAttributes( RDN );
         assertNull( attrs.get( "description" ) );
@@ -260,8 +255,8 @@ public class ModifyRemoveIT extends Abst
         assertNotNull( attrs.get( "cn" ) );
         assertNotNull( attrs.get( "sn" ) );
     }
-    
-    
+
+
     /**
      * Remove a required attribute. The sn attribute of the person entry is used
      * here.
@@ -272,12 +267,12 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveRequiredAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove sn attribute
         Attribute attr = new BasicAttribute( "sn" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
@@ -288,8 +283,8 @@ public class ModifyRemoveIT extends Abst
             // expected behaviour
         }
     }
-    
-    
+
+
     /**
      * Remove a required attribute from Rdn.
      * 
@@ -299,12 +294,12 @@ public class ModifyRemoveIT extends Abst
     public void testRemovePartOfRdn() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove sn attribute
         Attribute attr = new BasicAttribute( "cn" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
@@ -315,8 +310,8 @@ public class ModifyRemoveIT extends Abst
             // expected behaviour
         }
     }
-    
-    
+
+
     /**
      * Remove a not required attribute from Rdn.
      * 
@@ -326,17 +321,17 @@ public class ModifyRemoveIT extends Abst
     public void testRemovePartOfRdnNotRequired() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Change Rdn to another attribute
         String newRdn = "description=an American singer-songwriter";
         ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
         ctx.rename( RDN, newRdn );
-    
+
         // Remove description, which is now Rdn attribute
         Attribute attr = new BasicAttribute( "description" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         try
         {
             ctx.modifyAttributes( newRdn, DirContext.REMOVE_ATTRIBUTE, attrs );
@@ -346,13 +341,13 @@ public class ModifyRemoveIT extends Abst
         {
             // expected behaviour
         }
-    
+
         // Change Rdn back to original
         ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
         ctx.rename( newRdn, RDN );
     }
-    
-    
+
+
     /**
      * Remove a an attribute which is not present on the entry, but in the
      * schema.
@@ -363,12 +358,12 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveAttributeNotPresent() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove telephoneNumber Attribute
         Attribute attr = new BasicAttribute( "telephoneNumber" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
@@ -380,8 +375,8 @@ public class ModifyRemoveIT extends Abst
             // expected behaviour
         }
     }
-    
-    
+
+
     /**
      * Remove a an attribute value which is not present in the entry
      * 
@@ -391,20 +386,20 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveAttributeValueNotPresent() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove telephoneNumber Attribute
         Attribute attr = new BasicAttribute( "telephoneNumber", "12345" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         // Inject the new attribute
         ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
-    
+
         // Now try to remove a value which is not present
         Attribute attr2 = new BasicAttribute( "telephoneNumber", "7890" );
         Attributes attrs2 = new BasicAttributes( true );
         attrs2.put( attr2 );
-    
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs2 );
@@ -416,8 +411,8 @@ public class ModifyRemoveIT extends Abst
             assertTrue( true );
         }
     }
-    
-    
+
+
     /**
      * Remove a an attribute which is not present in the schema.
      * 
@@ -427,12 +422,12 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveAttributeNotValid() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Remove phantasy attribute
         Attribute attr = new BasicAttribute( "XXX" );
         Attributes attrs = new BasicAttributes( true );
         attrs.put( attr );
-    
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
@@ -447,8 +442,8 @@ public class ModifyRemoveIT extends Abst
             // expected behaviour
         }
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove an attribute value
      */
@@ -456,19 +451,19 @@ public class ModifyRemoveIT extends Abst
     public void testReplaceNonExistingAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getInetOrgPersonAttributes( "Bush", "Kate Bush" );
         attrs.put( "givenname", "Kate" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
+
         // replace attribute givenName with empty value (=> deletion)
         Attribute attr = new BasicAttribute( "givenname" );
         ModificationItem item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
         ctx.modifyAttributes( rdn, new ModificationItem[]
             { item } );
-    
+
         SearchControls sctls = new SearchControls();
         sctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         String filter = "(cn=Kate Bush)";
@@ -481,7 +476,7 @@ public class ModifyRemoveIT extends Abst
             Attribute cn = sr.getAttributes().get( "cn" );
             assertNotNull( cn );
             assertTrue( cn.contains( "Kate Bush" ) );
-    
+
             // Check whether attribute has been removed
             Attribute givenName = sr.getAttributes().get( "givenname" );
             assertNull( givenName );
@@ -490,11 +485,11 @@ public class ModifyRemoveIT extends Abst
         {
             fail( "entry not found" );
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove an attribute value from the Rdn
      * by Replacement
@@ -503,16 +498,16 @@ public class ModifyRemoveIT extends Abst
     public void testReplaceRdnByEmptyValueAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
+
         // replace attribute cn with empty value (=> deletion)
         Attribute attr = new BasicAttribute( "cn" );
         ModificationItem item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
-    
+
         try
         {
             ctx.modifyAttributes( rdn, new ModificationItem[]
@@ -523,11 +518,11 @@ public class ModifyRemoveIT extends Abst
         {
             // Expected behaviour
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove an attribute from the Rdn
      */
@@ -535,16 +530,16 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveRdnAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
+
         // replace attribute cn with empty value (=> deletion)
         Attribute attr = new BasicAttribute( "cn" );
         ModificationItem item = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
-    
+
         try
         {
             ctx.modifyAttributes( rdn, new ModificationItem[]
@@ -555,11 +550,11 @@ public class ModifyRemoveIT extends Abst
         {
             // Expected behaviour
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove an attribute from the Rdn
      */
@@ -567,16 +562,16 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveRdnAttributeValue() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
+
         // replace attribute cn with empty value (=> deletion)
         Attribute attr = new BasicAttribute( "cn", "Kate Bush" );
         ModificationItem item = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
-    
+
         try
         {
             ctx.modifyAttributes( rdn, new ModificationItem[]
@@ -587,11 +582,11 @@ public class ModifyRemoveIT extends Abst
         {
             // Expected behaviour
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove objectClass attribute
      */
@@ -599,15 +594,16 @@ public class ModifyRemoveIT extends Abst
     public void testDeleteOclAttrWithTopPersonOrganizationalpersonInetorgperson() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getInetOrgPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
-        ModificationItem delModOp = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute( "objectclass",
+
+        ModificationItem delModOp = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute(
+            "objectclass",
             "" ) );
-    
+
         try
         {
             ctx.modifyAttributes( rdn, new ModificationItem[]
@@ -630,11 +626,11 @@ public class ModifyRemoveIT extends Abst
         {
             e.printStackTrace();
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Create a person entry and try to remove objectClass attribute. A variant
      * which works.
@@ -643,14 +639,15 @@ public class ModifyRemoveIT extends Abst
     public void testDeleteOclAttrWithTopPersonOrganizationalpersonInetorgpersonVariant() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // Create an entry
         Attributes attrs = getInetOrgPersonAttributes( "Bush", "Kate Bush" );
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
-    
-        ModificationItem delModOp = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute( "objectclass" ) );
-    
+
+        ModificationItem delModOp = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute(
+            "objectclass" ) );
+
         try
         {
             ctx.modifyAttributes( rdn, new ModificationItem[]
@@ -661,11 +658,11 @@ public class ModifyRemoveIT extends Abst
         {
             // expected
         }
-    
+
         ctx.destroySubcontext( rdn );
     }
-    
-    
+
+
     /**
      * Test for DIRSERVER-1308:
      * Remove an objectClass and a mandatory attribute.
@@ -677,19 +674,19 @@ public class ModifyRemoveIT extends Abst
     public void testRemoveObjectClassAndMandatoryAttribute() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
-    
+
         // add objectClass:krb5Principal and krb5PrincipalName:test to entry
         Attributes tn = new BasicAttributes( true );
         tn.put( new BasicAttribute( "objectClass", "krb5Principal", true ) );
         tn.put( new BasicAttribute( "krb5PrincipalName", "test", true ) );
         ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, tn );
-    
+
         // remove objectClass:krb5Principal and krb5PrincipalName
         Attributes attrs = new BasicAttributes( true );
         attrs.put( new BasicAttribute( "objectClass", "krb5Principal", true ) );
         attrs.put( new BasicAttribute( "krb5PrincipalName" ) );
         ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
-    
+
         // Verify, that attributes are deleted
         attrs = ctx.getAttributes( RDN );
         assertNotNull( attrs.get( "objectClass" ) );



Mime
View raw message