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 17:22:36 UTC

svn commit: r1235328 [4/12] - in /directory/apacheds/trunk: server-annotations/src/main/java/org/apache/directory/server/annotations/ server-annotations/src/main/java/org/apache/directory/server/factory/ server-annotations/src/test/java/org/apache/dire...

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java Tue Jan 24 16:22:33 2012
@@ -68,19 +68,27 @@ import org.slf4j.LoggerFactory;
 @ApplyLdifs(
     {
         // Entry # 1
-        "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person",
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
         "objectClass: top",
         "uid: akarasulu",
         "cn: Alex Karasulu",
         "sn: karasulu",
         // Entry # 2
-        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system", "objectClass: organizationalUnit", "objectClass: top",
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
         "ou: computers",
         "description: Computers for Alex",
         "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
         // Entry # 3
-        "dn: uid=akarasuluref,ou=users,ou=system", "objectClass: uidObject", "objectClass: referral",
-        "objectClass: top", "uid: akarasuluref", "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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" })
 public class CompareIT extends AbstractLdapTestUnit
@@ -157,7 +165,7 @@ public class CompareIT extends AbstractL
         ManageDsaIT manageDSAIT = new ManageDsaITImpl();
         manageDSAIT.setCritical( true );
         compareRequest.addControl( manageDSAIT );
-        
+
         CompareResponse compareResponse = conn.compare( compareRequest );
         assertEquals( ResultCodeEnum.COMPARE_FALSE, compareResponse.getLdapResult().getResultCode() );
 
@@ -174,7 +182,7 @@ public class CompareIT extends AbstractL
     public void testOnReferral() throws Exception
     {
         LdapConnection conn = getWiredConnection( getLdapServer() );
-        
+
         // comparison success
         CompareRequest compareRequest = new CompareRequestImpl();
         compareRequest.setName( new Dn( "uid=akarasulu,ou=users,ou=system" ) );
@@ -196,9 +204,12 @@ public class CompareIT extends AbstractL
         compareResponse = conn.compare( compareRequest );
         assertEquals( ResultCodeEnum.REFERRAL, compareResponse.getLdapResult().getResultCode() );
 
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
 
         conn.close();
     }
@@ -248,7 +259,7 @@ public class CompareIT extends AbstractL
      * anonymous
      * @throws LdapException
      */
-    @Test( expected=InvalidConnectionException.class )
+    @Test(expected = InvalidConnectionException.class)
     public void testCompareWithoutAuthentication() throws LdapException
     {
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
@@ -278,9 +289,12 @@ public class CompareIT extends AbstractL
         CompareResponse compareResponse = conn.compare( compareRequest );
         assertEquals( ResultCodeEnum.REFERRAL, compareResponse.getLdapResult().getResultCode() );
 
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( compareResponse.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/compare/MatchingRuleCompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/MatchingRuleCompareIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/MatchingRuleCompareIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/MatchingRuleCompareIT.java Tue Jan 24 16:22:33 2012
@@ -45,115 +45,115 @@ import org.junit.runner.RunWith;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class ) 
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" )
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(
+    transports =
+        {
+            @CreateTransport(protocol = "LDAP")
     })
-@ApplyLdifs( {
-    // Entry # 1
-    "dn: cn=Tori Amos,ou=system",
-    "objectClass: person",
-    "objectClass: top",
-    "telephoneNumber: 1234567890",
-    "userPassword: Secret1!",
-    "cn: Tori Amos",
-    "sn: Amos", 
-    // Entry # 2
-    "dn: cn=Artists,ou=system",
-    "objectClass: groupOfNames",
-    "objectClass: top",
-    "cn: Artists",
-    "member: cn=Tori Amos,ou=system"
-    }
-)
+@ApplyLdifs(
+    {
+        // Entry # 1
+        "dn: cn=Tori Amos,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "telephoneNumber: 1234567890",
+        "userPassword: Secret1!",
+        "cn: Tori Amos",
+        "sn: Amos",
+        // Entry # 2
+        "dn: cn=Artists,ou=system",
+        "objectClass: groupOfNames",
+        "objectClass: top",
+        "cn: Artists",
+        "member: cn=Tori Amos,ou=system"
+})
 public class MatchingRuleCompareIT extends AbstractLdapTestUnit
 {
-    public static final String PERSON_CN = "Tori Amos";
-    public static final String PERSON_SN = "Amos";
-    public static final String PERSON_RDN = "cn=" + PERSON_CN;
-    public static final String PERSON_TELEPHONE = "1234567890";
-    public static final String PERSON_PWD = "Secret1!";
-
-    public static final String GROUP_CN = "Artists";
-    public static final String GROUP_RDN = "cn=" + GROUP_CN;
-
-
-    /**
-     * Compare with caseIgnoreMatch matching rule.
-     * 
-     * @throws org.apache.directory.shared.ldap.model.exception.LdapException
-     */
-    @Test
-    public void testCaseIgnoreMatch() throws Exception
-    {
-        DirContext ctx = ( DirContext ) ServerIntegrationUtils.getWiredContext( getLdapServer() ).lookup( "ou=system" );
-        
-        // Setting up search controls for compare op
-        SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes( new String[]
-            {} ); // no attributes
-        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
-        String[] values =
-            { PERSON_SN, PERSON_SN.toUpperCase(), Strings.toLowerCase( PERSON_SN ), PERSON_SN + "X" };
-        boolean[] expected =
-            { true, true, true, false };
+public static final String PERSON_CN = "Tori Amos";
+public static final String PERSON_SN = "Amos";
+public static final String PERSON_RDN = "cn=" + PERSON_CN;
+public static final String PERSON_TELEPHONE = "1234567890";
+public static final String PERSON_PWD = "Secret1!";
 
-        for ( int i = 0; i < values.length; i++ )
-        {
-            String value = values[i];
+public static final String GROUP_CN = "Artists";
+public static final String GROUP_RDN = "cn=" + GROUP_CN;
 
-            NamingEnumeration<SearchResult> enumeration = ctx.search( PERSON_RDN, "sn={0}", new String[]
-                { value }, ctls );
-            boolean result = enumeration.hasMore();
 
-            assertEquals( "compare sn value '" + PERSON_SN + "' with '" + value + "'", expected[i], result );
+/**
+ * Compare with caseIgnoreMatch matching rule.
+ * 
+ * @throws org.apache.directory.shared.ldap.model.exception.LdapException
+ */
+@Test
+public void testCaseIgnoreMatch() throws Exception
+{
+    DirContext ctx = ( DirContext ) ServerIntegrationUtils.getWiredContext( getLdapServer() ).lookup( "ou=system" );
+
+    // Setting up search controls for compare op
+    SearchControls ctls = new SearchControls();
+    ctls.setReturningAttributes( new String[]
+        {} ); // no attributes
+    ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+    String[] values =
+        { PERSON_SN, PERSON_SN.toUpperCase(), Strings.toLowerCase( PERSON_SN ), PERSON_SN + "X" };
+    boolean[] expected =
+        { true, true, true, false };
+
+    for ( int i = 0; i < values.length; i++ )
+    {
+        String value = values[i];
 
-            enumeration.close();
-        }
+        NamingEnumeration<SearchResult> enumeration = ctx.search( PERSON_RDN, "sn={0}", new String[]
+            { value }, ctls );
+        boolean result = enumeration.hasMore();
+
+        assertEquals( "compare sn value '" + PERSON_SN + "' with '" + value + "'", expected[i], result );
+
+        enumeration.close();
     }
+}
 
 
-    //
+//
 
-    /**
-     * Compare with distinguishedNameMatch matching rule.
-     * 
-     * @throws org.apache.directory.shared.ldap.model.exception.LdapException
-     */
-    @Test
-    public void testDistinguishedNameMatch() throws Exception
-    {
-        DirContext ctx = ( DirContext ) ServerIntegrationUtils.getWiredContext( getLdapServer() ).lookup( "ou=system" );
-        
-        // determine member Dn of person
-        DirContext member = ( DirContext ) ctx.lookup( PERSON_RDN );
-        String memberDN = member.getNameInNamespace();
-
-        // Setting up search controls for compare op
-        SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes( new String[]
-            {} ); // no attributes
-        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
-        String[] values =
-            { "", memberDN, "cn=nobody", memberDN, PERSON_RDN + " , " + ctx.getNameInNamespace() };
-        boolean[] expected =
-            { false, true, false, true, true };
+/**
+ * Compare with distinguishedNameMatch matching rule.
+ * 
+ * @throws org.apache.directory.shared.ldap.model.exception.LdapException
+ */
+@Test
+public void testDistinguishedNameMatch() throws Exception
+{
+    DirContext ctx = ( DirContext ) ServerIntegrationUtils.getWiredContext( getLdapServer() ).lookup( "ou=system" );
 
-        for ( int i = 0; i < values.length; i++ )
-        {
-            String value = values[i];
+    // determine member Dn of person
+    DirContext member = ( DirContext ) ctx.lookup( PERSON_RDN );
+    String memberDN = member.getNameInNamespace();
+
+    // Setting up search controls for compare op
+    SearchControls ctls = new SearchControls();
+    ctls.setReturningAttributes( new String[]
+        {} ); // no attributes
+    ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+    String[] values =
+        { "", memberDN, "cn=nobody", memberDN, PERSON_RDN + " , " + ctx.getNameInNamespace() };
+    boolean[] expected =
+        { false, true, false, true, true };
 
-            NamingEnumeration<SearchResult> enumeration = ctx.search( GROUP_RDN, "member={0}", new Object[]
-                { value }, ctls );
-            boolean result = enumeration.hasMore();
+    for ( int i = 0; i < values.length; i++ )
+    {
+        String value = values[i];
 
-            assertEquals( "compare '" + memberDN + "' with '" + value + "'", expected[i], result );
+        NamingEnumeration<SearchResult> enumeration = ctx.search( GROUP_RDN, "member={0}", new Object[]
+            { value }, ctls );
+        boolean result = enumeration.hasMore();
 
-            enumeration.close();
-        }
+        assertEquals( "compare '" + memberDN + "' with '" + value + "'", expected[i], result );
+
+        enumeration.close();
     }
 }
+}

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java Tue Jan 24 16:22:33 2012
@@ -42,25 +42,25 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(FrameworkRunner.class)
-@CreateDS( 
+@CreateDS(
     enableChangeLog = false,
-    name = "DSDeleteAlias" )
+    name = "DSDeleteAlias")
 @CreateLdapServer(transports =
     { @CreateTransport(protocol = "LDAP") })
 public class DeleteAliasIT extends AbstractLdapTestUnit
 {
     private LdapConnection conn;
 
-    
+
     @Before
     public void setup() throws Exception
     {
         conn = getAdminConnection( getLdapServer() );
-        
+
         if ( conn.lookup( "cn=foo,ou=system" ) == null )
         {
-            conn.add( new DefaultEntry( 
-                "cn=foo,ou=system", 
+            conn.add( new DefaultEntry(
+                "cn=foo,ou=system",
                 "objectClass: person",
                 "objectClass: top",
                 "cn: foo",
@@ -69,17 +69,18 @@ public class DeleteAliasIT extends Abstr
 
         if ( conn.lookup( "ou=alias,ou=users,ou=system" ) == null )
         {
-            conn.add( new DefaultEntry( 
-                "ou=alias,ou=users,ou=system", 
+            conn.add( new DefaultEntry(
+                "ou=alias,ou=users,ou=system",
                 "objectClass: top",
                 "objectClass: extensibleObject",
                 "objectClass: alias",
-                "ou: alias" ,
+                "ou: alias",
                 "aliasedObjectName: cn=foo,ou=system",
                 "description: alias to sibling (branch)" ) );
         }
     }
 
+
     /**
      * Tests normal delete operation of the alias and then the entry
      */
@@ -95,7 +96,7 @@ public class DeleteAliasIT extends Abstr
         assertNotNull( conn.lookup( "cn=foo,ou=system" ) );
         conn.delete( "cn=foo,ou=system" );
         assertNull( conn.lookup( "cn=foo,ou=system" ) );
-        
+
         conn.unBind();
         conn.close();
     }
@@ -113,7 +114,7 @@ public class DeleteAliasIT extends Abstr
         assertNotNull( conn.lookup( "cn=foo,ou=system" ) );
         conn.delete( "cn=foo,ou=system" );
         assertNull( conn.lookup( "cn=foo,ou=system" ) );
-        
+
         // Now, delete the alias
         //assertNotNull( conn.lookup( "ou=alias,ou=users,ou=system" ) );
         conn.delete( "ou=alias,ou=users,ou=system" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java Tue Jan 24 16:22:33 2012
@@ -66,21 +66,29 @@ import org.slf4j.LoggerFactory;
 @ApplyLdifs(
     {
         // Entry # 1
-        "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person",
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
         "objectClass: top",
         "uid: akarasulu",
         "cn: Alex Karasulu",
         "sn: karasulu",
 
         // Entry # 2
-        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system", "objectClass: organizationalUnit", "objectClass: top",
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
         "ou: computers",
         "description: Computers for Alex",
         "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
 
         // Entry # 3
-        "dn: uid=akarasuluref,ou=users,ou=system", "objectClass: uidObject", "objectClass: referral",
-        "objectClass: top", "uid: akarasuluref", "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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" })
 public class DeleteIT extends AbstractLdapTestUnit
@@ -127,7 +135,7 @@ public class DeleteIT extends AbstractLd
 
         // delete failure non-existant entry
         try
-        { 
+        {
             conn.delete( "uid=elecharny,ou=users,ou=system" );
             fail();
         }
@@ -152,7 +160,7 @@ public class DeleteIT extends AbstractLd
 
         // delete failure non-existent entry
         try
-        { 
+        {
             conn.delete( "uid=elecharny,ou=users,ou=system" );
             fail();
         }
@@ -183,7 +191,8 @@ public class DeleteIT extends AbstractLd
         deleteRequest.addControl( manageDSAIT );
         conn.delete( deleteRequest );
 
-        assertNull( conn.lookup( "uid=akarasuluref,ou=users,ou=system", new Control[]{ manageDSAIT } ) );
+        assertNull( conn.lookup( "uid=akarasuluref,ou=users,ou=system", new Control[]
+            { manageDSAIT } ) );
 
         conn.close();
     }
@@ -206,9 +215,12 @@ public class DeleteIT extends AbstractLd
 
         assertEquals( ResultCodeEnum.REFERRAL, deleteResponse.getLdapResult().getResultCode() );
 
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
 
         conn.close();
     }
@@ -269,9 +281,12 @@ public class DeleteIT extends AbstractLd
 
         assertEquals( ResultCodeEnum.REFERRAL, deleteResponse.getLdapResult().getResultCode() );
 
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system") );
-        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( deleteResponse.getLdapResult().getReferral().getLdapUrls()
+            .contains( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
 
         conn.close();
     }
@@ -295,7 +310,7 @@ public class DeleteIT extends AbstractLd
         {
             // expected
         }
-        
+
         conn.close();
     }
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java Tue Jan 24 16:22:33 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.operations.extended;
 
+
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -29,7 +30,8 @@ import org.slf4j.LoggerFactory;
 public class DITUtilitiesSP
 {
     private static final Logger log = LoggerFactory.getLogger( DITUtilitiesSP.class );
-    
+
+
     /**
      * Recursively deletes a subtree including the apex given.
      * 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java Tue Jan 24 16:22:33 2012
@@ -42,11 +42,11 @@ import org.junit.runner.RunWith;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class ) 
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" )
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(
+    transports =
+        {
+            @CreateTransport(protocol = "LDAP")
     })
 public class ExtendedIT extends AbstractLdapTestUnit
 {
@@ -73,7 +73,6 @@ public class ExtendedIT extends Abstract
         }
     }
 
-    
     /**
      * Class for the request of an extended operation which does not exist.
      */

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/HelloWorldProcedure.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/HelloWorldProcedure.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/HelloWorldProcedure.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/HelloWorldProcedure.java Tue Jan 24 16:22:33 2012
@@ -26,7 +26,8 @@ public class HelloWorldProcedure
     {
         return "Hello World!";
     }
-    
+
+
     public static String sayHelloTo( String name )
     {
         return "Hello " + name + "!";

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java Tue Jan 24 16:22:33 2012
@@ -120,10 +120,10 @@ import org.slf4j.LoggerFactory;
                     "objectClass: top\n" +
                     "objectClass: domain\n\n"),
             indexes =
-            {
-                @CreateIndex(attribute = "objectClass"),
-                @CreateIndex(attribute = "dc"),
-                @CreateIndex(attribute = "ou")
+                {
+                    @CreateIndex(attribute = "objectClass"),
+                    @CreateIndex(attribute = "dc"),
+                    @CreateIndex(attribute = "ou")
             }),
 
         @CreatePartition(
@@ -135,13 +135,13 @@ import org.slf4j.LoggerFactory;
                     "objectClass: top\n" +
                     "objectClass: domain\n\n"),
             indexes =
-            {
-                @CreateIndex(attribute = "objectClass"),
-                @CreateIndex(attribute = "dc"),
-                @CreateIndex(attribute = "ou")
+                {
+                    @CreateIndex(attribute = "objectClass"),
+                    @CreateIndex(attribute = "dc"),
+                    @CreateIndex(attribute = "ou")
             }) })
-@CreateLdapServer( name = "ADDIT",  transports =
-    { @CreateTransport(protocol = "LDAP", port = -1 ) })
+@CreateLdapServer(name = "ADDIT", transports =
+    { @CreateTransport(protocol = "LDAP", port = -1) })
 @ApplyLdifs(
     {
         // Entry # 0
@@ -200,7 +200,7 @@ public class AddIT extends AbstractLdapT
 
         // modify object classes, add two more
         Attributes attributes = LdifUtils.createJndiAttributes( "objectClass: organizationalPerson",
-                "objectClass: inetOrgPerson" );
+            "objectClass: inetOrgPerson" );
 
         DirContext person = ( DirContext ) ctx.lookup( RDN );
         person.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, attributes );
@@ -907,7 +907,7 @@ public class AddIT extends AbstractLdapT
         attrs.put( "cn", "Jim, Bean" );
 
         DirContext jimBeanCtx = ctx.createSubcontext( "cn=\"Jim, Bean\"", attrs );
-        
+
         assertNotNull( jimBeanCtx );
     }
 
@@ -1350,10 +1350,10 @@ public class AddIT extends AbstractLdapT
      * @throws NamingException 
      */
     @Test
-    @CreateDS( 
+    @CreateDS(
         enableChangeLog = false,
-        name = "DSAlias" )
-    @CreateLdapServer( name = "DSAlias", transports =
+        name = "DSAlias")
+    @CreateLdapServer(name = "DSAlias", transports =
         { @CreateTransport(protocol = "LDAP", port = -1) })
     public void test_DIRSERVER_1357() throws Exception
     {
@@ -1388,6 +1388,7 @@ public class AddIT extends AbstractLdapT
         ctx.destroySubcontext( "cn=alias,ou=engineering" );
     }
 
+
     /**
      * Adding an entry with a non existing attribute type.
      * 
@@ -1410,9 +1411,9 @@ public class AddIT extends AbstractLdapT
         try
         {
             connection.add( personEntry );
-            fail("should throw LdapNoSuchAttributeException");
+            fail( "should throw LdapNoSuchAttributeException" );
         }
-        catch( LdapNoSuchAttributeException e )
+        catch ( LdapNoSuchAttributeException e )
         {
             //expected exception
         }
@@ -1429,7 +1430,7 @@ public class AddIT extends AbstractLdapT
      * 
      * @throws Exception 
      */
-    @Test( expected = LdapOperationException.class )
+    @Test(expected = LdapOperationException.class)
     public void testAddEntryNonExistingOC() throws Exception
     {
         LdapConnection connection = getAdminConnection( getLdapServer() );
@@ -1451,41 +1452,41 @@ public class AddIT extends AbstractLdapT
      * 
      * @throws Exception 
      */
-    @Test( expected = LdapException.class )
+    @Test(expected = LdapException.class)
     public void testAddEntry100KData() throws Exception
     {
         LdapConnection connection = getAdminConnection( getLdapServer() );
 
-        int size = 100*1024;
+        int size = 100 * 1024;
         byte[] dataBytes = new byte[size];
-        
-        for ( int i = 0; i < size; i++)
+
+        for ( int i = 0; i < size; i++ )
         {
             dataBytes[i] = 'A';
         }
-        
+
         String data = Strings.utf8ToString( dataBytes );
 
         Dn dn = new Dn( "cn=Kate Bush," + BASE );
-        
+
         Entry personEntry = new DefaultEntry( "cn=Kate Bush," + BASE,
-        "objectClass: top",
-        "objectClass: person",
-        "cn: Kate Bush",
-        "sn: Bush",
-        "description", data );
+            "objectClass: top",
+            "objectClass: person",
+            "cn: Kate Bush",
+            "sn: Bush",
+            "description", data );
 
         connection.add( personEntry );
-        
+
         // Check that the entry has been stored 
         Entry entry = connection.lookup( dn, "description", "cn", "sn" );
-        
+
         String description = entry.get( "description" ).getString();
-        
+
         assertNotNull( description );
         assertTrue( description.startsWith( "AAA" ) );
         assertEquals( size, description.length() );
-        
+
         for ( int i = 0; i < size; i++ )
         {
             assertEquals( 'A', description.charAt( i ) );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java Tue Jan 24 16:22:33 2012
@@ -81,8 +81,8 @@ import org.junit.runner.RunWith;
 @CreateDS(allowAnonAccess = true, name = "BindIT-class")
 @CreateLdapServer(
     transports =
-    {
-        @CreateTransport(protocol = "LDAP")
+        {
+            @CreateTransport(protocol = "LDAP")
     })
 public class BindIT extends AbstractLdapTestUnit
 {
@@ -121,9 +121,12 @@ public class BindIT extends AbstractLdap
             getWiredContext( getLdapServer(), "system", "blah" );
             fail( "should never get here due to a " );
         }
-        catch ( InvalidNameException e ){}
+        catch ( InvalidNameException e )
+        {
+        }
     }
 
+
     /**
      * Test with bindDn that is under a naming context but points to non-existant user.
      * 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java Tue Jan 24 16:22:33 2012
@@ -1,4 +1,3 @@
-
 /*
  *   Licensed to the Apache Software Foundation (ASF) under one
  *   or more contributor license agreements.  See the NOTICE file
@@ -67,19 +66,27 @@ import org.slf4j.LoggerFactory;
 @ApplyLdifs(
     {
         // Entry # 1
-        "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person",
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
         "objectClass: top",
         "uid: akarasulu",
         "cn: Alex Karasulu",
         "sn: karasulu",
         // Entry # 2
-        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system", "objectClass: organizationalUnit", "objectClass: top",
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
         "ou: computers",
         "description: Computers for Alex",
         "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
         // Entry # 3
-        "dn: uid=akarasuluref,ou=users,ou=system", "objectClass: uidObject", "objectClass: referral",
-        "objectClass: top", "uid: akarasuluref", "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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" })
 public class CompareIT extends AbstractLdapTestUnit

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/DeleteIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/DeleteIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/DeleteIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/DeleteIT.java Tue Jan 24 16:22:33 2012
@@ -65,21 +65,29 @@ import org.slf4j.LoggerFactory;
 @ApplyLdifs(
     {
         // Entry # 1
-        "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person",
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
         "objectClass: top",
         "uid: akarasulu",
         "cn: Alex Karasulu",
         "sn: karasulu",
 
         // Entry # 2
-        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system", "objectClass: organizationalUnit", "objectClass: top",
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
         "ou: computers",
         "description: Computers for Alex",
         "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
 
         // Entry # 3
-        "dn: uid=akarasuluref,ou=users,ou=system", "objectClass: uidObject", "objectClass: referral",
-        "objectClass: top", "uid: akarasuluref", "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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" })
 public class DeleteIT extends AbstractLdapTestUnit
@@ -126,7 +134,7 @@ public class DeleteIT extends AbstractLd
 
         // delete failure non-existant entry
         try
-        { 
+        {
             conn.delete( "uid=elecharny,ou=users,ou=system" );
             fail();
         }
@@ -151,7 +159,7 @@ public class DeleteIT extends AbstractLd
 
         // delete failure non-existent entry
         try
-        { 
+        {
             conn.delete( "uid=elecharny,ou=users,ou=system" );
             fail();
         }
@@ -308,7 +316,7 @@ public class DeleteIT extends AbstractLd
         {
             // expected
         }
-        
+
         conn.close();
     }
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/IllegalModificationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/IllegalModificationIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/IllegalModificationIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/IllegalModificationIT.java Tue Jan 24 16:22:33 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.operations.ldapsdk;
 
+
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getNsdkWiredConnection;
 import static org.junit.Assert.assertEquals;
@@ -71,8 +72,12 @@ import org.junit.runner.RunWith;
     { @CreateTransport(protocol = "LDAP") })
 @ApplyLdifs(
     {
-    // Entry # 1
-        "dn: cn=Kate Bush,ou=system", "objectClass: person", "objectClass: top", "cn: Kate Bush", "sn: Bush" })
+        // Entry # 1
+        "dn: cn=Kate Bush,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "cn: Kate Bush",
+        "sn: Bush" })
 public class IllegalModificationIT extends AbstractLdapTestUnit
 {
     private static final String DN = "cn=Kate Bush,ou=system";

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyDnReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyDnReferralIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyDnReferralIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyDnReferralIT.java Tue Jan 24 16:22:33 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.operations.ldapsdk;
 
+
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getNsdkWiredConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
 import static org.junit.Assert.assertEquals;
@@ -54,240 +55,240 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class ) 
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" )
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(
+    transports =
+        {
+            @CreateTransport(protocol = "LDAP")
     })
-@ApplyLdifs( {
-    // Entry # 1
-    "dn: uid=akarasulu,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: person",
-    "objectClass: top",
-    "uid: akarasulu",
-    "cn: Alex Karasulu",
-    "sn: karasulu", 
-    
-    // Entry # 2
-    "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
-    "objectClass: organizationalUnit",
-    "objectClass: top",
-    "ou: computers",
-    "description: Computers for Alex",
-    "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system", 
-    
-    // Entry # 3
-    "dn: uid=akarasuluref,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: referral",
-    "objectClass: top",
-    "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",
-    
-    // Entry # 4
-    "dn: uid=elecharny,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: person",
-    "objectClass: top",
-    "uid: elecharny",
-    "cn: Emmanuel Lecharny",
-    "sn: lecharny"
-    }
-)
+@ApplyLdifs(
+    {
+        // Entry # 1
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
+        "objectClass: top",
+        "uid: akarasulu",
+        "cn: Alex Karasulu",
+        "sn: karasulu",
+
+        // Entry # 2
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
+        "ou: computers",
+        "description: Computers for Alex",
+        "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
+
+        // Entry # 3
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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",
+
+        // Entry # 4
+        "dn: uid=elecharny,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
+        "objectClass: top",
+        "uid: elecharny",
+        "cn: Emmanuel Lecharny",
+        "sn: lecharny"
+})
 public class ModifyDnReferralIT extends AbstractLdapTestUnit
 {
-    private static final Logger LOG = LoggerFactory.getLogger( ModifyDnReferralIT.class );
-    
+private static final Logger LOG = LoggerFactory.getLogger( ModifyDnReferralIT.class );
+
+
+/**
+ * Tests ModifyDN operation on referral entry with the ManageDsaIT control.
+ */
+@Test
+public void testOnReferralWithManageDsaITControl() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPSearchConstraints();
+    constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    conn.setConstraints( constraints );
+
+    // ModifyDN success
+    conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, constraints );
+    LDAPEntry entry = conn.read( "uid=ref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
+    assertNotNull( entry );
+    assertEquals( "uid=ref,ou=users,ou=system", entry.getDN() );
+
+    conn.disconnect();
+}
 
-    /**
-     * Tests ModifyDN operation on referral entry with the ManageDsaIT control.
-     */
-    @Test
-    public void testOnReferralWithManageDsaITControl() throws Exception
+
+/**
+ * Tests ModifyDN operation with newSuperior on referral entry with the 
+ * ManageDsaIT control.
+ */
+@Test
+public void testNewSuperiorOnReferralWithManageDsaITControl() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPSearchConstraints();
+    constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    conn.setConstraints( constraints );
+
+    // ModifyDN success
+    try
     {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPSearchConstraints();
-        constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        conn.setConstraints( constraints );
-        
-        // ModifyDN success
-        conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, constraints );
-        LDAPEntry entry = conn.read( "uid=ref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
-        assertNotNull( entry );
-        assertEquals( "uid=ref,ou=users,ou=system", entry.getDN() );
-        
-        conn.disconnect();
+        conn.rename( "uid=elecharny,ou=users,ou=system", "uid=newuser",
+            "uid=akarasuluref,ou=users,ou=system", true, constraints );
     }
-    
-    
-    /**
-     * Tests ModifyDN operation with newSuperior on referral entry with the 
-     * ManageDsaIT control.
-     */
-    @Test
-    public void testNewSuperiorOnReferralWithManageDsaITControl() throws Exception
+    catch ( LDAPException le )
     {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPSearchConstraints();
-        constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        conn.setConstraints( constraints );
-        
-        // ModifyDN success
-        try
-        {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "uid=newuser", 
-                "uid=akarasuluref,ou=users,ou=system", true, constraints );
-        }
-        catch ( LDAPException le )
-        {
-            assertEquals ( LDAPException.AFFECTS_MULTIPLE_DSAS, le.getLDAPResultCode() );
-        }
-        
-        conn.disconnect();
+        assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, le.getLDAPResultCode() );
     }
-    
-    
-    /**
-     * Tests ModifyDN operation on normal and referral entries without the 
-     * ManageDsaIT control. Referrals are sent back to the client with a
-     * non-success result code.
-     */
-    @Test
-    public void testOnReferral() throws Exception
-    {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
-        
-        // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, null, constraints );
-        response = listener.getResponse();
-        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
-
-        assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
-        assertEquals( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
-        assertEquals( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
 
-        conn.disconnect();
-    }
-    
-    
-    /**
-     * Tests ModifyDN operation on normal and referral entries without the 
-     * ManageDsaIT control. Referrals are sent back to the client with a
-     * non-success result code.
-     */
-    @Test
-    public void testNewSupierorOnReferral() throws Exception
-    {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
-        
-        // referrals failure
-        try
-        {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "uid=ref", 
-                "uid=akarasuluref,ou=users,ou=system", true, constraints );
-        }
-        catch ( LDAPException e )
-        {
-            assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
-        }
+    conn.disconnect();
+}
+
+
+/**
+ * Tests ModifyDN operation on normal and referral entries without the 
+ * ManageDsaIT control. Referrals are sent back to the client with a
+ * non-success result code.
+ */
+@Test
+public void testOnReferral() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    constraints.setReferrals( false );
+    conn.setConstraints( constraints );
+
+    // referrals failure
+    LDAPResponseListener listener = null;
+    LDAPResponse response = null;
+
+    listener = conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, null, constraints );
+    response = listener.getResponse();
+    assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
+
+    assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
+    assertEquals( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
+    assertEquals( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
+
+    conn.disconnect();
+}
 
-        conn.disconnect();
+
+/**
+ * Tests ModifyDN operation on normal and referral entries without the 
+ * ManageDsaIT control. Referrals are sent back to the client with a
+ * non-success result code.
+ */
+@Test
+public void testNewSupierorOnReferral() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    constraints.setReferrals( false );
+    conn.setConstraints( constraints );
+
+    // referrals failure
+    try
+    {
+        conn.rename( "uid=elecharny,ou=users,ou=system", "uid=ref",
+            "uid=akarasuluref,ou=users,ou=system", true, constraints );
     }
-    
-    
-    /**
-     * Tests ModifyDN operation on normal and referral entries without the 
-     * ManageDsaIT control using JNDI instead of the Netscape API. Referrals 
-     * are sent back to the client with a non-success result code.
-     */
-    @Test
-    public void testThrowOnReferralWithJndi() throws Exception
+    catch ( LDAPException e )
     {
-        LdapContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
-        
-        // ModifyDN referrals failure
-        try
-        {
-            ctx.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref,ou=users,ou=system" ); 
-            fail( "Should never get here due to ModifyDN failure on ReferralException" );
-        }
-        catch ( ReferralException e )
-        {
-            // 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() );
-        }
+        assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
+    }
+
+    conn.disconnect();
+}
+
+
+/**
+ * Tests ModifyDN operation on normal and referral entries without the 
+ * ManageDsaIT control using JNDI instead of the Netscape API. Referrals 
+ * are sent back to the client with a non-success result code.
+ */
+@Test
+public void testThrowOnReferralWithJndi() throws Exception
+{
+    LdapContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
 
-        ctx.close();
+    // ModifyDN referrals failure
+    try
+    {
+        ctx.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref,ou=users,ou=system" );
+        fail( "Should never get here due to ModifyDN failure on ReferralException" );
     }
-    
-    
-    /**
-     * Tests referral handling when an ancestor is a referral.
-     */
-    @Test 
-    public void testAncestorReferral() throws Exception
+    catch ( ReferralException e )
     {
-        LOG.debug( "" );
+        // 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() );
+    }
 
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+    ctx.close();
+}
 
-        // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
 
-        listener = conn.rename( "ou=Computers,uid=akarasuluref,ou=users,ou=system", "ou=Machines", true, null, constraints );
-        response = listener.getResponse();
-        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
+/**
+ * Tests referral handling when an ancestor is a referral.
+ */
+@Test
+public void testAncestorReferral() throws Exception
+{
+    LOG.debug( "" );
 
-        assertEquals( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
-        assertEquals( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
-        assertEquals( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    conn.setConstraints( constraints );
 
-        conn.disconnect();
-    }
-    
-    
-    /**
-     * Tests referral handling when an ancestor is a referral.
-     */
-    @Test 
-    public void testNewSuperiorAncestorReferral() throws Exception
-    {
-        LOG.debug( "" );
+    // referrals failure
+    LDAPResponseListener listener = null;
+    LDAPResponse response = null;
 
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+    listener = conn.rename( "ou=Computers,uid=akarasuluref,ou=users,ou=system", "ou=Machines", true, null, constraints );
+    response = listener.getResponse();
+    assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
 
-        // referrals failure
-        try
-        {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "ou=Machines", 
-                "ou=Computers,uid=akarasuluref,ou=users,ou=system", true, constraints );
-            fail( "Should never get here to affectsMultipleDSA error result code" );
-        }
-        catch ( LDAPException e )
-        {
-            assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
-        }
+    assertEquals( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
+    assertEquals( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
+    assertEquals( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
 
-        conn.disconnect();
+    conn.disconnect();
+}
+
+
+/**
+ * Tests referral handling when an ancestor is a referral.
+ */
+@Test
+public void testNewSuperiorAncestorReferral() throws Exception
+{
+    LOG.debug( "" );
+
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    conn.setConstraints( constraints );
+
+    // referrals failure
+    try
+    {
+        conn.rename( "uid=elecharny,ou=users,ou=system", "ou=Machines",
+            "ou=Computers,uid=akarasuluref,ou=users,ou=system", true, constraints );
+        fail( "Should never get here to affectsMultipleDSA error result code" );
     }
+    catch ( LDAPException e )
+    {
+        assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
+    }
+
+    conn.disconnect();
+}
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyReferralIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyReferralIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/ModifyReferralIT.java Tue Jan 24 16:22:33 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.operations.ldapsdk;
 
+
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getNsdkWiredConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
 import static org.junit.Assert.assertEquals;
@@ -72,152 +73,153 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class ) 
+@RunWith(FrameworkRunner.class)
 //@CreateDS( name="ModifyReferralIT-class", enableChangeLog=false )
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" )
+@CreateLdapServer(
+    transports =
+        {
+            @CreateTransport(protocol = "LDAP")
     })
-@ApplyLdifs( {
-    // Entry # 1
-    "dn: uid=akarasulu,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: person",
-    "objectClass: top",
-    "uid: akarasulu",
-    "cn: Alex Karasulu",
-    "sn: karasulu", 
-    // Entry # 2
-    "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
-    "objectClass: organizationalUnit",
-    "objectClass: top",
-    "ou: computers",
-    "description: Computers for Alex",
-    "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system", 
-    // Entry # 3
-    "dn: uid=akarasuluref,ou=users,ou=system",
-    "objectClass: extensibleObject",
-    "objectClass: referral",
-    "objectClass: top",
-    "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"
-    }
-)
-public class ModifyReferralIT extends AbstractLdapTestUnit 
+@ApplyLdifs(
+    {
+        // Entry # 1
+        "dn: uid=akarasulu,ou=users,ou=system",
+        "objectClass: uidObject",
+        "objectClass: person",
+        "objectClass: top",
+        "uid: akarasulu",
+        "cn: Alex Karasulu",
+        "sn: karasulu",
+        // Entry # 2
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
+        "objectClass: organizationalUnit",
+        "objectClass: top",
+        "ou: computers",
+        "description: Computers for Alex",
+        "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
+        // Entry # 3
+        "dn: uid=akarasuluref,ou=users,ou=system",
+        "objectClass: extensibleObject",
+        "objectClass: referral",
+        "objectClass: top",
+        "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"
+})
+public class ModifyReferralIT extends AbstractLdapTestUnit
+{
+private static final Logger LOG = LoggerFactory.getLogger( CompareIT.class );
+
+
+/**
+ * Tests modify operation on referral entry with the ManageDsaIT control.
+ */
+@Test
+public void testOnReferralWithManageDsaITControl() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
+    conn.setConstraints( constraints );
+
+    // modify success
+    LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
+    LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
+    conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, constraints );
+
+    assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
+
+    conn.disconnect();
+}
+
+
+/**
+ * Tests modify operation on referral entries without the 
+ * ManageDsaIT control. Referrals are sent back to the client with a
+ * non-success result code.
+ */
+@Test
+public void testOnReferral() throws Exception
+{
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    constraints.setReferrals( false );
+    conn.setConstraints( constraints );
+
+    // referrals failure
+    // modify success
+    LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
+    LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
+    LDAPResponseListener listener = conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
+    LDAPResponse response = listener.getResponse();
+
+    assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
+
+    assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
+    assertEquals( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
+    assertEquals( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
+
+    conn.disconnect();
+}
+
+
+/**
+ * Tests modify operation on normal and referral entries without the 
+ * ManageDsaIT control using JNDI instead of the Netscape API. Referrals 
+ * are sent back to the client with a non-success result code.
+ */
+@Test
+public void testThrowOnReferralWithJndi() throws Exception
 {
-    private static final Logger LOG = LoggerFactory.getLogger( CompareIT.class );
-    
+    LdapContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
+
+    // modify failure
+    Attribute attr = new BasicAttribute( "description", "referral to akarasulu" );
+    ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
 
-    /**
-     * Tests modify operation on referral entry with the ManageDsaIT control.
-     */
-    @Test
-    public void testOnReferralWithManageDsaITControl() throws Exception
+    try
     {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
-        conn.setConstraints( constraints );
-        
-        // modify success
-        LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
-        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
-        conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, constraints );
-        
-        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
-        
-        conn.disconnect();
+        ctx.modifyAttributes( "uid=akarasuluref,ou=users,ou=system", new ModificationItem[]
+            { mod } );
     }
-    
-    
-    /**
-     * Tests modify operation on referral entries without the 
-     * ManageDsaIT control. Referrals are sent back to the client with a
-     * non-success result code.
-     */
-    @Test
-    public void testOnReferral() throws Exception
+    catch ( ReferralException e )
     {
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
-        
-        // referrals failure
-        // modify success
-        LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
-        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
-        LDAPResponseListener listener = conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
-        LDAPResponse response = listener.getResponse();
-        
-        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
-
-        assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
-        assertEquals( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
-        assertEquals( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
-
-        conn.disconnect();
+        // 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() );
     }
-    
-    
-    /**
-     * Tests modify operation on normal and referral entries without the 
-     * ManageDsaIT control using JNDI instead of the Netscape API. Referrals 
-     * are sent back to the client with a non-success result code.
-     */
-    @Test
-    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[] { mod } );
-        }
-        catch ( ReferralException e )
-        {
-            // 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.
-     */
-    @Test 
-    public void testAncestorReferral() throws Exception
-    {
-        LOG.debug( "" );
+    ctx.close();
+}
 
-        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
-
-        // referrals failure
-        LDAPAttribute attribute = new LDAPAttribute( "ou", "Machines" );
-        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.modify( "ou=Computers,uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
-        response = listener.getResponse();
-        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
-
-        assertEquals( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
-        assertEquals( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
-        assertEquals( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
 
-        conn.disconnect();
-    }
+/**
+ * Tests referral handling when an ancestor is a referral.
+ */
+@Test
+public void testAncestorReferral() throws Exception
+{
+    LOG.debug( "" );
+
+    LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
+    LDAPConstraints constraints = new LDAPConstraints();
+    conn.setConstraints( constraints );
+
+    // referrals failure
+    LDAPAttribute attribute = new LDAPAttribute( "ou", "Machines" );
+    LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
+    LDAPResponseListener listener = null;
+    LDAPResponse response = null;
+
+    listener = conn.modify( "ou=Computers,uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
+    response = listener.getResponse();
+    assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
+
+    assertEquals( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
+    assertEquals( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
+    assertEquals( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
+
+    conn.disconnect();
+}
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java Tue Jan 24 16:22:33 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.operations.lookup;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java Tue Jan 24 16:22:33 2012
@@ -94,7 +94,7 @@ public class LookupPerfIT extends Abstra
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
 
-        return new InitialLdapContext( env, JndiUtils.toJndiControls( 
+        return new InitialLdapContext( env, JndiUtils.toJndiControls(
             ldapServer.getDirectoryService().getLdapCodecService(),
             controls ) );
     }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java?rev=1235328&r1=1235327&r2=1235328&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java Tue Jan 24 16:22:33 2012
@@ -71,8 +71,12 @@ import org.junit.runner.RunWith;
     { @CreateTransport(protocol = "LDAP") })
 @ApplyLdifs(
     {
-    // Entry # 1
-        "dn: cn=Kate Bush,ou=system", "objectClass: person", "objectClass: top", "cn: Kate Bush", "sn: Bush" })
+        // Entry # 1
+        "dn: cn=Kate Bush,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "cn: Kate Bush",
+        "sn: Bush" })
 public class IllegalModificationIT extends AbstractLdapTestUnit
 {
     private static final String DN = "cn=Kate Bush,ou=system";
@@ -103,7 +107,8 @@ public class IllegalModificationIT exten
         LdapConnection con = getWiredConnection( getLdapServer() );
 
         // first a valid attribute
-        Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "description", "The description" );
+        Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "description",
+            "The description" );
         // then an invalid one without any value
         Modification mod2 = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "displayName" );