directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1180652 [5/6] - in /directory/apacheds/branches/one-sub-level-index-removal: ./ all/ benchmarks/ core-annotations/ core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-api/ core-api/src/main/java/org/apache/directo...
Date Sun, 09 Oct 2011 17:03:58 GMT
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddingEntriesWithSpecialCharactersInRDNIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddingEntriesWithSpecialCharactersInRDNIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddingEntriesWithSpecialCharactersInRDNIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddingEntriesWithSpecialCharactersInRDNIT.java Sun Oct  9 17:03:52 2011
@@ -41,6 +41,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 
 
 /**
@@ -83,7 +84,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithHashRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry personEntry = getPersonEntry( "Bush", "Kate#Bush" );
         String dn = "cn=Kate\\#Bush,ou=system";
@@ -120,7 +121,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithCommaInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getPersonEntry( "Bush", "Bush, Kate" );
         String dn = "cn=Bush\\, Kate,ou=system";
@@ -156,7 +157,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithQuotesInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getPersonEntry( "Messer", "Mackie \"The Knife\" Messer" );
         String dn = "cn=Mackie \\\"The Knife\\\" Messer,ou=system";
@@ -190,7 +191,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithBackslashInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getOrgUnitEntry( "AC\\DC" );
         String dn = "ou=AC\\\\DC,ou=system";
@@ -225,7 +226,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithGreaterSignInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getOrgUnitEntry( "East -> West" );
         String dn = "ou=East -\\> West,ou=system";
@@ -263,7 +264,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithLessSignInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getOrgUnitEntry( "Scissors 8<" );
         String dn = "ou=Scissors 8\\<,ou=system";
@@ -301,7 +302,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithSemicolonInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getOrgUnitEntry( "semicolon group;" );
         String dn = "ou=semicolon group\\;,ou=system";
@@ -339,7 +340,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddingWithEqualsInRdn() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
 
         Entry entry = getOrgUnitEntry( "nomen=omen" );
         String dn = "ou=nomen\\=omen,ou=system";
@@ -371,7 +372,7 @@ public class AddingEntriesWithSpecialCha
     @Test
     public void testAddRdnWithEscapedSpaces() throws Exception 
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
         connection.setTimeOut( -1 );
 
         Entry entry = new DefaultEntry( 

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java Sun Oct  9 17:03:52 2011
@@ -20,13 +20,10 @@
 package org.apache.directory.server.operations.bind;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import javax.naming.AuthenticationException;
-import javax.naming.InvalidNameException;
-
 import netscape.ldap.LDAPConnection;
 import netscape.ldap.LDAPConstraints;
 import netscape.ldap.LDAPControl;
@@ -39,6 +36,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
+import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -96,32 +95,22 @@ public class BindIT extends AbstractLdap
      * 
      * @throws Exception 
      */
-    @Test
+    @Test( expected=LdapAuthenticationException.class )
     public void testBadBindDnNotInContext() throws Exception
     {
-        try
-        {
-            getWiredContext( getLdapServer(), "cn=bogus", "blah" );
-            fail( "should never get here due to a " );
-        }
-        catch ( AuthenticationException e )
-        {
-        }
+        getWiredConnection( getLdapServer(), "cn=bogus", "blah" );
+        fail( "should never get here due to a " );
     }
 
 
     /**
      * Test bind with malformed bind Dn.
      */
-    @Test
+    @Test( expected=LdapInvalidDnException.class )
     public void testBadBindDnMalformed() throws Exception
     {
-        try
-        {
-            getWiredContext( getLdapServer(), "system", "blah" );
-            fail( "should never get here due to a " );
-        }
-        catch ( InvalidNameException e ){}
+        getWiredConnection( getLdapServer(), "system", "blah" );
+        fail( "should never get here due to a " );
     }
 
     /**
@@ -129,17 +118,11 @@ public class BindIT extends AbstractLdap
      * 
      * @throws Exception 
      */
-    @Test
+    @Test( expected=LdapAuthenticationException.class )
     public void testBadBindDnInContext() throws Exception
     {
-        try
-        {
-            getWiredContext( getLdapServer(), "cn=bogus,ou=system", "blah" );
-            fail( "should never get here due to a " );
-        }
-        catch ( AuthenticationException e )
-        {
-        }
+        getWiredConnection( getLdapServer(), "cn=bogus,ou=system", "blah" );
+        fail( "should never get here due to a " );
     }
 
 

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java Sun Oct  9 17:03:52 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.server.operations.compare;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
 import static org.junit.Assert.assertEquals;
@@ -34,21 +34,23 @@ import javax.naming.directory.SearchCont
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 
-import netscape.ldap.LDAPAttribute;
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPConstraints;
-import netscape.ldap.LDAPControl;
-import netscape.ldap.LDAPException;
-import netscape.ldap.LDAPResponse;
-import netscape.ldap.LDAPResponseListener;
-
 import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
+import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
 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.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
+import org.apache.directory.shared.ldap.model.message.CompareRequest;
+import org.apache.directory.shared.ldap.model.message.CompareRequestImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
+import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -93,7 +95,7 @@ public class CompareIT extends AbstractL
     @Test
     public void testNormalCompare() throws Exception
     {
-        LdapConnection conn = getClientApiConnection( getLdapServer() );
+        LdapConnection conn = getAdminConnection( getLdapServer() );
 
         // comparison success
         boolean response = conn.compare( "uid=akarasulu,ou=users,ou=system", "sn", "karasulu" );
@@ -116,26 +118,23 @@ public class CompareIT extends AbstractL
     @Test
     public void testNormalCompareMissingAttribute() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // comparison success
-        LDAPAttribute attribute = new LDAPAttribute( "sn", "karasulu" );
-        assertTrue( conn.compare( "uid=akarasulu,ou=users,ou=system", attribute ) );
+        assertTrue( conn.compare( "uid=akarasulu,ou=users,ou=system", "sn", "karasulu" ) );
 
         // non-existing attribute
-        attribute = new LDAPAttribute( "mail", "akarasulu@apache.org" );
-
         try
         {
-            conn.compare( "uid=akarasulu,ou=users,ou=system", attribute );
+            conn.compare( "uid=akarasulu,ou=users,ou=system", "mail", "akarasulu@apache.org" );
             fail( "Should never get here" );
         }
-        catch ( LDAPException e )
+        catch ( LdapOperationException e )
         {
-            assertEquals( ResultCodeEnum.NO_SUCH_ATTRIBUTE.getValue(), e.getLDAPResultCode() );
+            assertEquals( ResultCodeEnum.NO_SUCH_ATTRIBUTE, e.getResultCode() );
         }
 
-        conn.disconnect();
+        conn.close();
     }
 
 
@@ -145,21 +144,24 @@ public class CompareIT extends AbstractL
     @Test
     public void testOnReferralWithManageDsaITControl() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( 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 );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // comparison success
-        LDAPAttribute attribute = new LDAPAttribute( "uid", "akarasuluref" );
-        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
+        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", "uid", "akarasuluref" ) );
 
         // comparison failure
-        attribute = new LDAPAttribute( "uid", "elecharny" );
-        assertFalse( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
+        CompareRequest compareRequest = new CompareRequestImpl();
+        compareRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        compareRequest.setAttributeId( "uid" );
+        compareRequest.setAssertionValue( "elecharny" );
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( true );
+        compareRequest.addControl( manageDSAIT );
+        
+        CompareResponse compareResponse = conn.compare( compareRequest );
+        assertEquals( ResultCodeEnum.COMPARE_FALSE, compareResponse.getLdapResult().getResultCode() );
 
-        conn.disconnect();
+        conn.close();
     }
 
 
@@ -171,29 +173,34 @@ public class CompareIT extends AbstractL
     @Test
     public void testOnReferral() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
-
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+        
         // comparison success
-        LDAPAttribute attribute = new LDAPAttribute( "uid", "akarasulu" );
-        assertTrue( conn.compare( "uid=akarasulu,ou=users,ou=system", attribute, constraints ) );
+        CompareRequest compareRequest = new CompareRequestImpl();
+        compareRequest.setName( new Dn( "uid=akarasulu,ou=users,ou=system" ) );
+        compareRequest.setAttributeId( "uid" );
+        compareRequest.setAssertionValue( "akarasulu" );
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( false );
+        compareRequest.addControl( manageDSAIT );
+
+        CompareResponse compareResponse = conn.compare( compareRequest );
+        assertEquals( ResultCodeEnum.COMPARE_TRUE, compareResponse.getLdapResult().getResultCode() );
 
         // referrals failure
-        attribute = new LDAPAttribute( "uid", "akarasulu" );
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, 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] );
+        compareRequest = new CompareRequestImpl();
+        compareRequest.setName( new Dn( "uid=akarasuluREF,ou=users,ou=system" ) );
+        compareRequest.setAttributeId( "uid" );
+        compareRequest.setAssertionValue( "akarasulu" );
+
+        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" ) );
 
-        conn.disconnect();
+        conn.close();
     }
 
 
@@ -239,25 +246,16 @@ public class CompareIT extends AbstractL
     /**
      * Check that operation are not executed if we are now allowed to bind
      * anonymous
-     * @throws LDAPException
+     * @throws LdapException
      */
-    @Test
-    public void testCompareWithoutAuthentication() throws LDAPException
+    @Test( expected=InvalidConnectionException.class )
+    public void testCompareWithoutAuthentication() throws LdapException
     {
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
-        LDAPConnection conn = new LDAPConnection();
-        conn.connect( "localhost", getLdapServer().getPort() );
-        LDAPAttribute attr = new LDAPAttribute( "uid", "admin" );
+        LdapConnection conn = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
 
-        try
-        {
-            conn.compare( "uid=admin,ou=system", attr );
-            fail( "Compare success without authentication" );
-        }
-        catch ( LDAPException e )
-        {
-            assertEquals( "no permission exception", 50, e.getLDAPResultCode() );
-        }
+        conn.compare( "uid=admin,ou=system", "uid", "admin" );
+        fail( "Compare success without authentication" );
     }
 
 
@@ -269,24 +267,21 @@ public class CompareIT extends AbstractL
     {
         LOG.debug( "" );
 
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // referrals failure
-        LDAPAttribute attribute = new LDAPAttribute( "ou", "Computers" );
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.compare( "ou=Computers,uid=akarasuluref,ou=users,ou=system", attribute, 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] );
+        CompareRequest compareRequest = new CompareRequestImpl();
+        compareRequest.setName( new Dn( "ou=Computers,uid=akarasuluref,ou=users,ou=system" ) );
+        compareRequest.setAttributeId( "ou" );
+        compareRequest.setAssertionValue( "Computers" );
+
+        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" ) );
 
-        conn.disconnect();
+        conn.close();
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteAliasIT.java Sun Oct  9 17:03:52 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.server.operations.delete;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
@@ -55,7 +55,7 @@ public class DeleteAliasIT extends Abstr
     @Before
     public void setup() throws Exception
     {
-        conn = getClientApiConnection( getLdapServer() );
+        conn = getAdminConnection( getLdapServer() );
         
         if ( conn.lookup( "cn=foo,ou=system" ) == null )
         {
@@ -107,7 +107,7 @@ public class DeleteAliasIT extends Abstr
     @Test
     public void testDeleteEntryThenAlias() throws Exception
     {
-        conn = getClientApiConnection( getLdapServer() );
+        conn = getAdminConnection( getLdapServer() );
 
         // Delete the entry
         assertNotNull( conn.lookup( "cn=foo,ou=system" ) );

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java Sun Oct  9 17:03:52 2011
@@ -20,25 +20,18 @@
 package org.apache.directory.server.operations.delete;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import javax.naming.NameNotFoundException;
 import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPConstraints;
-import netscape.ldap.LDAPControl;
-import netscape.ldap.LDAPException;
-import netscape.ldap.LDAPResponse;
-import netscape.ldap.LDAPResponseListener;
-import netscape.ldap.LDAPSearchConstraints;
-
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
@@ -47,7 +40,15 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.model.exception.LdapContextNotEmptyException;
 import org.apache.directory.shared.ldap.model.exception.LdapNoSuchObjectException;
+import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.DeleteRequest;
+import org.apache.directory.shared.ldap.model.message.DeleteRequestImpl;
+import org.apache.directory.shared.ldap.model.message.DeleteResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
+import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -94,7 +95,7 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testNormalDeleteFailContextNotEmpty() throws Exception
     {
-        LdapConnection conn = getClientApiConnection( getLdapServer() );
+        LdapConnection conn = getAdminConnection( getLdapServer() );
 
         // delete failure on non-leaf entry
         try
@@ -119,7 +120,7 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testNormalDelete() throws Exception
     {
-        LdapConnection conn = getClientApiConnection( getLdapServer() );
+        LdapConnection conn = getAdminConnection( getLdapServer() );
 
         // delete success
         conn.delete( "ou=computers,uid=akarasulu,ou=users,ou=system" );
@@ -147,7 +148,7 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testDeleteNonExistent() throws Exception
     {
-        LdapConnection conn = getClientApiConnection( getLdapServer() );
+        LdapConnection conn = getAdminConnection( getLdapServer() );
 
         // delete failure non-existent entry
         try
@@ -171,26 +172,20 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testOnReferralWithManageDsaITControl() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( 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 );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( true );
 
         // delete success
-        conn.delete( "uid=akarasuluref,ou=users,ou=system", constraints );
+        DeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        deleteRequest.addControl( manageDSAIT );
+        conn.delete( deleteRequest );
 
-        try
-        {
-            conn.read( "uid=akarasuluref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
-            fail( "Should never get here." );
-        }
-        catch ( LDAPException e )
-        {
-            assertEquals( ResultCodeEnum.NO_SUCH_OBJECT.getValue(), e.getLDAPResultCode() );
-        }
+        assertNull( conn.lookup( "uid=akarasuluref,ou=users,ou=system", new Control[]{ manageDSAIT } ) );
 
-        conn.disconnect();
+        conn.close();
     }
 
 
@@ -202,24 +197,20 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testOnReferral() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
-
-        // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.delete( "uid=akarasuluref,ou=users,ou=system", 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] );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+
+        // delete success
+        DeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        DeleteResponse deleteResponse = conn.delete( deleteRequest );
+
+        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" ) );
 
-        conn.disconnect();
+        conn.close();
     }
 
 
@@ -269,24 +260,20 @@ public class DeleteIT extends AbstractLd
     {
         LOG.debug( "" );
 
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
-
-        // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
-
-        listener = conn.delete( "ou=Computers,uid=akarasuluref,ou=users,ou=system", 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] );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
-        conn.disconnect();
+        // delete success
+        DeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( new Dn( "ou=Computers,uid=akarasuluref,ou=users,ou=system" ) );
+        DeleteResponse deleteResponse = conn.delete( deleteRequest );
+
+        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" ) );
+
+        conn.close();
     }
 
 
@@ -297,7 +284,7 @@ public class DeleteIT extends AbstractLd
     @Test
     public void testDeleteWithIllegalName() throws Exception
     {
-        LdapConnection conn = getClientApiConnection( getLdapServer() );
+        LdapConnection conn = getAdminConnection( getLdapServer() );
 
         try
         {

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupIT.java Sun Oct  9 17:03:52 2011
@@ -50,7 +50,7 @@ public class LookupIT extends AbstractLd
     @Test
     public void testLookupPerfAPI() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = ServerIntegrationUtils.getAdminConnection( getLdapServer() );
 
         Entry entry = connection.lookup( "uid=admin,ou=system", "name" );
         assertNotNull( entry );

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java Sun Oct  9 17:03:52 2011
@@ -61,7 +61,7 @@ public class LookupPerfIT extends Abstra
     @Test
     public void testLookupPerfAPI() throws Exception
     {
-        LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+        LdapConnection connection = ServerIntegrationUtils.getAdminConnection( getLdapServer() );
 
         Entry entry = connection.lookup( "uid=admin,ou=system" );
         assertNotNull( entry );

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java Sun Oct  9 17:03:52 2011
@@ -20,15 +20,10 @@
 package org.apache.directory.server.operations.modify;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import netscape.ldap.LDAPAttribute;
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPEntry;
-import netscape.ldap.LDAPException;
-import netscape.ldap.LDAPModification;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
@@ -36,7 +31,11 @@ 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.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.Modification;
+import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.ModifyRequest;
 import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
@@ -82,7 +81,7 @@ public class IllegalModificationIT exten
     @Test
     public void testIllegalModification() throws Exception
     {
-        LdapConnection con = getClientApiConnection( getLdapServer() );
+        LdapConnection con = getAdminConnection( getLdapServer() );
 
         ModifyRequest modReq = new ModifyRequestImpl();
         modReq.setName( new Dn( DN ) );
@@ -101,28 +100,26 @@ public class IllegalModificationIT exten
     @Test
     public void testIllegalModification2() throws Exception
     {
-        LDAPConnection con = getWiredConnection( getLdapServer() );
+        LdapConnection con = getWiredConnection( getLdapServer() );
 
         // first a valid attribute
-        LDAPAttribute attr = new LDAPAttribute( "description", "The description" );
-        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attr );
+        Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "description", "The description" );
         // then an invalid one without any value
-        attr = new LDAPAttribute( "displayName" );
-        LDAPModification mod2 = new LDAPModification( LDAPModification.ADD, attr );
+        Modification mod2 = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "displayName" );
 
         try
         {
-            con.modify( "cn=Kate Bush,ou=system", new LDAPModification[]
+            con.modify( "cn=Kate Bush,ou=system", new Modification[]
                 { mod, mod2 } );
             fail( "error expected due to empty attribute value" );
         }
-        catch ( LDAPException e )
+        catch ( LdapException e )
         {
             // expected
         }
 
         // Check whether entry is unmodified, i.e. no displayName
-        LDAPEntry entry = con.read( DN );
-        assertEquals( "displayName exists?", null, entry.getAttribute( "displayName" ) );
+        Entry entry = con.lookup( DN );
+        assertEquals( "displayName exists?", null, entry.get( "displayName" ) );
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java Sun Oct  9 17:03:52 2011
@@ -32,21 +32,20 @@ import javax.naming.directory.DirContext
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.LdapContext;
 
-import netscape.ldap.LDAPAttribute;
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPConstraints;
-import netscape.ldap.LDAPControl;
-import netscape.ldap.LDAPModification;
-import netscape.ldap.LDAPResponse;
-import netscape.ldap.LDAPResponseListener;
-
+import org.apache.directory.ldap.client.api.LdapConnection;
 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.apache.directory.server.operations.compare.CompareIT;
+import org.apache.directory.shared.ldap.model.message.ModifyRequest;
+import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
+import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
+import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -118,20 +117,23 @@ public class ModifyReferralIT extends Ab
     @Test
     public void testOnReferralWithManageDsaITControl() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( 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 );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+        
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( true );
+
         
         // 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 );
+        ModifyRequest modifyRequest = new ModifyRequestImpl();
+        modifyRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        modifyRequest.add( "description", "referral to akarasulu" );
+        modifyRequest.addControl( manageDSAIT );
         
-        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
+        conn.modify( modifyRequest );
         
-        conn.disconnect();
+        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", "description", "referral to akarasulu" ) );
+        
+        conn.close();
     }
     
     
@@ -143,25 +145,23 @@ public class ModifyReferralIT extends Ab
     @Test
     public void testOnReferral() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
         
         // 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] );
+        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 );
 
-        conn.disconnect();
+        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();
     }
     
     
@@ -201,24 +201,21 @@ public class ModifyReferralIT extends Ab
     {
         LOG.debug( "" );
 
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // 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] );
+        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.disconnect();
+        conn.close();
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyDnReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyDnReferralIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyDnReferralIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyDnReferralIT.java Sun Oct  9 17:03:52 2011
@@ -24,26 +24,29 @@ import static org.apache.directory.serve
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPConstraints;
-import netscape.ldap.LDAPControl;
-import netscape.ldap.LDAPEntry;
-import netscape.ldap.LDAPException;
-import netscape.ldap.LDAPResponse;
-import netscape.ldap.LDAPResponseListener;
-import netscape.ldap.LDAPSearchConstraints;
-
+import org.apache.directory.ldap.client.api.LdapConnection;
 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.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.model.message.ModifyDnRequestImpl;
+import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -110,19 +113,24 @@ public class ModifyDnReferralIT extends 
     @Test
     public void testOnReferralWithManageDsaITControl() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( 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 );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+        
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( true );
         
         // 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 );
+        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();
+        modifyDnRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        modifyDnRequest.setNewRdn( new Rdn( "uid=ref" ) );
+        modifyDnRequest.setDeleteOldRdn( true );
+        modifyDnRequest.addControl( manageDSAIT );
+        
+        conn.modifyDn( modifyDnRequest );
+        Entry entry = conn.lookup( "uid=ref,ou=users,ou=system", new Control[]{ manageDSAIT } );
         assertNotNull( entry );
-        assertEquals( "uid=ref,ou=users,ou=system", entry.getDN() );
+        assertEquals( "uid=ref,ou=users,ou=system", entry.getDn().getName() );
         
-        conn.disconnect();
+        conn.close();
     }
     
     
@@ -133,24 +141,29 @@ public class ModifyDnReferralIT extends 
     @Test
     public void testNewSuperiorOnReferralWithManageDsaITControl() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( 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 );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
+
+        ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+        manageDSAIT.setCritical( true );
         
+        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();
+        modifyDnRequest.setName( new Dn( "uid=elecharny,ou=users,ou=system" ) );
+        modifyDnRequest.setNewRdn( new Rdn( "uid=newuser" ) );
+        modifyDnRequest.setNewSuperior( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        modifyDnRequest.setDeleteOldRdn( true );
+        modifyDnRequest.addControl( manageDSAIT );
+
         // ModifyDN success
         try
         {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "uid=newuser", 
-                "uid=akarasuluref,ou=users,ou=system", true, constraints );
+            conn.modifyDn( modifyDnRequest );
         }
-        catch ( LDAPException le )
+        catch ( LdapOperationException le )
         {
-            assertEquals ( LDAPException.AFFECTS_MULTIPLE_DSAS, le.getLDAPResultCode() );
+            assertEquals ( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS, le.getResultCode() );
         }
         
-        conn.disconnect();
+        conn.close();
     }
     
     
@@ -162,24 +175,23 @@ public class ModifyDnReferralIT extends 
     @Test
     public void testOnReferral() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
         
         // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
+        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();
+        modifyDnRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
+        modifyDnRequest.setNewRdn( new Rdn( "uid=ref" ) );
+        modifyDnRequest.setDeleteOldRdn( true );
 
-        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] );
+        ModifyDnResponse modifyDnResponse = conn.modifyDn( modifyDnRequest );
 
-        conn.disconnect();
+        assertEquals( ResultCodeEnum.REFERRAL, modifyDnResponse.getLdapResult().getResultCode() );
+
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system" ) );
+
+        conn.close();
     }
     
     
@@ -189,25 +201,21 @@ public class ModifyDnReferralIT extends 
      * non-success result code.
      */
     @Test
-    public void testNewSupierorOnReferral() throws Exception
+    public void testNewSuperiorOnReferral() throws Exception
     {
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        constraints.setReferrals( false );
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
         
         // referrals failure
         try
         {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "uid=ref", 
-                "uid=akarasuluref,ou=users,ou=system", true, constraints );
+            conn.moveAndRename( "uid=elecharny,ou=users,ou=system", "uid=ref,uid=akarasuluref,ou=users,ou=system", true );
         }
-        catch ( LDAPException e )
+        catch ( LdapOperationException e )
         {
-            assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
+            assertEquals( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS, e.getResultCode() );
         }
 
-        conn.disconnect();
+        conn.close();
     }
     
     
@@ -245,23 +253,23 @@ public class ModifyDnReferralIT extends 
     {
         LOG.debug( "" );
 
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // referrals failure
-        LDAPResponseListener listener = null;
-        LDAPResponse response = null;
+        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();
+        modifyDnRequest.setName( new Dn( "ou=Computers,uid=akarasuluref,ou=users,ou=system" ) );
+        modifyDnRequest.setNewRdn( new Rdn( "ou=Machines" ) );
+        modifyDnRequest.setDeleteOldRdn( true );
+
+        ModifyDnResponse modifyDnResponse = conn.modifyDn( modifyDnRequest );
+
+        assertEquals( ResultCodeEnum.REFERRAL, modifyDnResponse.getLdapResult().getResultCode() );
 
-        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() );
-
-        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] );
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( modifyDnResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
 
-        conn.disconnect();
+        conn.close();
     }
     
     
@@ -273,22 +281,19 @@ public class ModifyDnReferralIT extends 
     {
         LOG.debug( "" );
 
-        LDAPConnection conn = getWiredConnection( getLdapServer() );
-        LDAPConstraints constraints = new LDAPConstraints();
-        conn.setConstraints( constraints );
+        LdapConnection conn = getWiredConnection( getLdapServer() );
 
         // referrals failure
         try
         {
-            conn.rename( "uid=elecharny,ou=users,ou=system", "ou=Machines", 
-                "ou=Computers,uid=akarasuluref,ou=users,ou=system", true, constraints );
+            conn.moveAndRename( "uid=elecharny,ou=users,ou=system", "ou=Machines,ou=Computers,uid=akarasuluref,ou=users,ou=system", true );
             fail( "Should never get here to affectsMultipleDSA error result code" );
         }
-        catch ( LDAPException e )
+        catch ( LdapOperationException e )
         {
-            assertEquals( LDAPException.AFFECTS_MULTIPLE_DSAS, e.getLDAPResultCode() );
+            assertEquals( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS, e.getResultCode() );
         }
 
-        conn.disconnect();
+        conn.close();
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java Sun Oct  9 17:03:52 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.server.operations.modifydn;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -119,7 +119,7 @@ public class MoveIT extends AbstractLdap
     public void testIllegalMove() throws Exception
     {
 
-        LdapConnection con = getClientApiConnection( getLdapServer() );
+        LdapConnection con = getAdminConnection( getLdapServer() );
 
         //now do something bad: make the parent a child of its own child 
         try
@@ -139,7 +139,7 @@ public class MoveIT extends AbstractLdap
     @Test
     public void testIllegalMoveToSameDN() throws Exception
     {
-        LdapConnection con = getClientApiConnection( getLdapServer() );
+        LdapConnection con = getAdminConnection( getLdapServer() );
 
         //now do something bad: try to move the entry to the same Dn
         try

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java Sun Oct  9 17:03:52 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.server.operations.search;
 
 
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -1671,7 +1671,7 @@ public class SearchIT extends AbstractLd
     public void testSearchSizeLimit() throws Exception
     {
         long sizeLimit = 7;
-        LdapConnection connection = getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
         SearchRequest req = new org.apache.directory.shared.ldap.model.message.SearchRequestImpl();
         req.setBase( new Dn( "ou=system" ) );
         req.setFilter( "(ou=*)" );
@@ -1696,7 +1696,7 @@ public class SearchIT extends AbstractLd
     @Ignore("This test is failing because of the timing issue. Note that the SearchHandler handles time based searches correctly, this is just the below test's problem")
     public void testSearchTimeLimit() throws Exception, InterruptedException
     {
-        LdapConnection connection = getClientApiConnection( getLdapServer() );
+        LdapConnection connection = getAdminConnection( getLdapServer() );
         SearchRequest req = new SearchRequestImpl();
         req.setBase( new Dn( "ou=schema" ) );
         req.setFilter( "(objectClass=*)" );

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Sun Oct  9 17:03:52 2011
@@ -60,8 +60,6 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Tests for replication subsystem in client-server mode.
@@ -70,7 +68,6 @@ import org.slf4j.LoggerFactory;
  */
 public class ClientServerReplicationIT
 {
-    private static final Logger CONSUMER_LOG = LoggerFactory.getLogger( "CONSUMER_LOG" );
     private static LdapServer providerServer;
 
     private static LdapServer consumerServer;
@@ -111,8 +108,8 @@ public class ClientServerReplicationIT
             searchRequest.setScope( SearchScope.SUBTREE );
             searchRequest.addAttributes( "entryUuid" );
             
-            CONSUMER_LOG.debug( "-----------> Dumping the server <-----------" );
-            CONSUMER_LOG.debug( "-----------> Looking for " + entryDn.getNormName() + " <-----------" );
+            System.out.println( "-----------> Dumping the server <-----------" );
+            System.out.println( "-----------> Looking for " + entryDn.getNormName() + " <-----------" );
             
             EntryFilteringCursor cursor = session.search( searchRequest );
             
@@ -122,18 +119,17 @@ public class ClientServerReplicationIT
                 
                 if ( entry.getDn().equals( entryDn ) )
                 {
-                    CONSUMER_LOG.debug( "The searched entry exists !!!" );
-                    CONSUMER_LOG.debug( "found Entry " + entry.getDn().getNormName() + " exists, entrtyUuid = " + entry.get( "entryUuid" ) );
+                    System.out.println( "The searched entry exists !!!" );
+                    System.out.println( "found Entry " + entry.getDn().getNormName() + " exists, entrtyUuid = " + entry.get( "entryUuid" ) );
                     continue;
                 }
                 
-                CONSUMER_LOG.debug( "Entry " + entry.getDn().getNormName() + " exists, entrtyUuid = " + entry.get( "entryUuid" ) );
+                System.out.println( "Entry " + entry.getDn().getNormName() + " exists, entrtyUuid = " + entry.get( "entryUuid" ) );
             }
             
             cursor.close();
 
-            CONSUMER_LOG.debug( "-----------> Dump done <-----------" );
-            //new Exception().printStackTrace();
+            System.out.println( "-----------> Dump done <-----------" );
         }
         catch ( Exception le )
         {
@@ -303,10 +299,10 @@ public class ClientServerReplicationIT
     
     
     @Test
-    @Ignore
+    @Ignore( "Run this test alone, otherwise it conflicts with moddn" )
     public void testModDnLoop() throws Exception
     {
-        for ( int i = 0; i < 10000; i++ )
+        for ( int i = 0; i < 10; i++ )
         {
             System.out.println( ">>>>>> loop " + ( i + 1 ) + " <<<<<<" );
             Entry newuser = createEntry();
@@ -395,20 +391,17 @@ public class ClientServerReplicationIT
     private Entry restartConsumer( Entry provUser ) throws Exception
     {
         // Now stop the consumer
-        CONSUMER_LOG.debug( "--------------------------------------------------------------" );
-        CONSUMER_LOG.debug( "----> 1 Stopping the consumer --------------------------------" );
-        CONSUMER_LOG.debug( "--------------------------------------------------------------" );
         consumerServer.stop();
         
         // And delete the entry in the provider
         Dn deletedUserDn = provUser.getDn();
-        //System.out.println( "----> 5 deleting entry " + deletedUserDn + " from provider --------------------------------" );
+
         providerSession.delete( deletedUserDn );
         
         // Create a new entry
         provUser = createEntry();
         Dn addedUserDn = provUser.getDn();
-        //System.out.println( "----> 6 adding entry " + provUser.getDn() + " into provider --------------------------------" );
+
         providerSession.add( provUser );
         
         // let the provider log the events before the consumer sends a request
@@ -417,57 +410,37 @@ public class ClientServerReplicationIT
         Thread.sleep( 1000 );
         
         // Restart the consumer
-        CONSUMER_LOG.debug( "--------------------------------------------------------------" );
-        CONSUMER_LOG.debug( "----> 2 Restarting the consumer --------------------------------" );
-        CONSUMER_LOG.debug( "--------------------------------------------------------------" );
         consumerServer.start();
         
-        //assertTrue( consumerSession.exists( deletedUserDn ) );
-        //System.out.println( "----> 7bis entry " + deletedUserDn + " is still present in consumer --------------------------------" );
-        
         assertTrue( checkEntryDeletion( consumerSession, deletedUserDn ) );
-        //System.out.println( "----> 8 Entry " + deletedUserDn + " deleted from consumer --------------------------------" );
         
         assertTrue( checkEntryExistence( consumerSession, addedUserDn ) );
         waitAndCompareEntries( addedUserDn );
-        //System.out.println( "----> 8 Entry " + addedUserDn + " added into consumer --------------------------------" );
 
         return provUser;
     }
     
     
     @Test
-    @Ignore( "we have some random failures" )
     public void testRebootConsumer() throws Exception
     {
-        System.out.println( "----> 1 testRebootConsumer started --------------------------------" );
         Entry provUser = createEntry();
         
         assertFalse( providerSession.exists(provUser.getDn() ) );
         assertFalse( consumerSession.exists(provUser.getDn() ) );
         
-        System.out.println( "----> 2 Adding entry " + provUser.getDn() +" in provider --------------------------------" );
         providerSession.add( provUser );
         
         assertTrue( checkEntryExistence( consumerSession, provUser.getDn() ) );
         waitAndCompareEntries( provUser.getDn() );
 
-        System.out.println( "----> 3 entry " + provUser.getDn() +" present in consumer --------------------------------" );
-
         assertTrue( providerSession.exists(provUser.getDn() ) );
         assertTrue( consumerSession.exists(provUser.getDn() ) );
         
-        for ( int i = 0; i < 1000; i++ )
+        for ( int i = 0; i < 10; i++ )
         {
-            CONSUMER_LOG.debug( "=============================== Loop " + i );
-            System.out.println( "=============================== Loop " + i );
             provUser = restartConsumer( provUser );
         }
-        
-        CONSUMER_LOG.debug( "===========> Dumping the provider <===========" );
-        dump( providerSession, Dn.ROOT_DSE );
-        CONSUMER_LOG.debug( "===========> Dumping the consumer <===========" );
-        dump( consumerSession, Dn.ROOT_DSE );
     }
     
     

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/schema/SchemaIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/schema/SchemaIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/schema/SchemaIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/schema/SchemaIT.java Sun Oct  9 17:03:52 2011
@@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
+import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -75,6 +76,93 @@ public class SchemaIT extends AbstractLd
      * @throws Exception on error
      */
     @Test
+    @CreateDS( name="SchemaAddAT-test" )
+    @ApplyLdifs(
+        {
+            // Inject an AT
+            "dn: m-oid=1.3.6.1.4.1.18060.0.4.1.2.999,ou=attributeTypes,cn=other,ou=schema",
+            "m-usage: USER_APPLICATIONS",
+            "m-equality: integerOrderingMatch",
+            "objectClass: metaAttributeType",
+            "objectClass: metaTop",
+            "objectClass: top",
+            "m-name: numberOfGuns",
+            "m-oid: 1.3.6.1.4.1.18060.0.4.1.2.999",
+            "m-singleValue: TRUE",
+            "m-description: Number of guns of a ship",
+            "m-collective: FALSE",
+            "m-obsolete: FALSE",
+            "m-noUserModification: FALSE",
+            "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
+            
+            // Inject an OC
+            "dn: m-oid=1.3.6.1.4.1.18060.0.4.1.1.999,ou=objectClasses,cn=other,ou=schema",
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaObjectclass",
+            "m-supObjectClass: top",
+            "m-oid: 1.3.6.1.4.1.18060.0.4.1.2.999",
+            "m-name: ship",
+            "m-must: cn",
+            "m-may: numberOfGuns",
+            "m-may: description",
+            "m-typeObjectClass: STRUCTURAL",
+            "m-obsolete: FALSE",
+            "m-description: A ship"
+        }
+        )
+    public void testAddAttributeTypeObjectClass() throws Exception
+    {
+        checkAttributeTypePresent( "1.3.6.1.4.1.18060.0.4.1.2.999", "other", true );
+        checkObjectClassPresent( "1.3.6.1.4.1.18060.0.4.1.1.999", "other", true );
+        
+        // sync operation happens anyway on shutdowns but just to make sure we can do it again
+        getService().sync();
+
+        getService().shutdown();
+        getService().startup();
+
+        checkAttributeTypePresent( "1.3.6.1.4.1.18060.0.4.1.2.999", "other", true );
+        checkObjectClassPresent( "1.3.6.1.4.1.18060.0.4.1.1.999", "other", true );
+    }
+    
+    
+    @Test
+    @CreateDS( name="SchemaAddAT-test" )
+    @ApplyLdifs(
+        {
+            // Inject an AT
+            "dn: cn=schema",
+            "changetype: modify",
+            "add: attributeTypes",
+            "attributeTypes: ( 1.3.6.1.4.1.65536.0.4.3.2.1 NAME 'templateData' DESC 'template data' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE X-SCHEMA 'other' )",
+            "-",
+            
+            // Inject an OC
+            "dn: cn=schema",
+            "changetype: modify",
+            "add: objectClasses",
+            "objectClasses: ( 1.3.6.1.4.1.65536.0.4.3.2.2 NAME 'templateObject' DESC 'test OC' SUP top STRUCTURAL MUST ( templateData $ cn ) X-SCHEMA 'other' )",
+            "-"
+        }
+        )
+    public void testAddAttributeTypeObjectClassSubSchemaSubEntry() throws Exception
+    {
+        checkAttributeTypePresent( "1.3.6.1.4.1.65536.0.4.3.2.1", "other", true );
+        checkObjectClassPresent( "1.3.6.1.4.1.65536.0.4.3.2.2", "other", true );
+        
+        // sync operation happens anyway on shutdowns but just to make sure we can do it again
+        getService().sync();
+
+        getService().shutdown();
+        getService().startup();
+
+        checkAttributeTypePresent( "1.3.6.1.4.1.65536.0.4.3.2.1", "other", true );
+        checkObjectClassPresent( "1.3.6.1.4.1.65536.0.4.3.2.2", "other", true );
+    }
+
+    
+    @Test
     public void testAddBinaryAttributeType() throws Exception
     {
         List<String> descriptions = new ArrayList<String>();
@@ -103,7 +191,7 @@ public class SchemaIT extends AbstractLd
             " MUST ( templateData $ cn ) " +
             " X-SCHEMA 'other' )");
 
-         modify( DirContext.ADD_ATTRIBUTE, descriptions, "objectClasses" );
+        modify( DirContext.ADD_ATTRIBUTE, descriptions, "objectClasses" );
 
         checkAttributeTypePresent( "1.3.6.1.4.1.65536.0.4.3.2.1", "other", true );
         checkObjectClassPresent( "1.3.6.1.4.1.65536.0.4.3.2.2", "other", true );

Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-jndi/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct  9 17:03:52 2011
@@ -4,5 +4,5 @@
 /directory/apacheds/branches/apacheds-jdbm/server-jndi:1160768-1164092
 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-jndi:1040956-1043765
 /directory/apacheds/branches/milestones/server-jndi:1072812-1075328
-/directory/apacheds/trunk/server-jndi:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-jndi:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
 /directory/studio/trunk/server-jndi:1067786-1067997

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-jndi/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-jndi/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-jndi/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-jndi/pom.xml Sun Oct  9 17:03:52 2011
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.directory.server</groupId>
     <artifactId>apacheds-parent</artifactId>
-    <version>2.0.0-M3-SNAPSHOT</version>
+    <version>2.0.0-M4-SNAPSHOT</version>
   </parent>
   
   <artifactId>apacheds-server-jndi</artifactId>

Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-replication/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct  9 17:03:52 2011
@@ -3,5 +3,5 @@
 /directory/apacheds/branches/apacheds-dnfactory-experiment/server-replication:980138-980937
 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-replication:1040956-1043765
 /directory/apacheds/branches/milestones/server-replication:1072812-1075328
-/directory/apacheds/trunk/server-replication:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-replication:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
 /directory/studio/trunk/server-replication:1067786-1067997

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-replication/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-replication/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-replication/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-replication/pom.xml Sun Oct  9 17:03:52 2011
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.directory.server</groupId>
     <artifactId>apacheds-parent</artifactId>
-    <version>2.0.0-M3-SNAPSHOT</version>
+    <version>2.0.0-M4-SNAPSHOT</version>
   </parent>
   
   <artifactId>apacheds-server-replication</artifactId>

Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-tools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct  9 17:03:52 2011
@@ -3,5 +3,5 @@
 /directory/apacheds/branches/apacheds-dnfactory-experiment/server-tools:980138-980937
 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-tools:1040956-1043765
 /directory/apacheds/branches/milestones/server-tools:1072812-1075328
-/directory/apacheds/trunk/server-tools:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-tools:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
 /directory/studio/trunk/server-tools:1067786-1067997

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-tools/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-tools/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-tools/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-tools/pom.xml Sun Oct  9 17:03:52 2011
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.directory.server</groupId>
     <artifactId>apacheds-parent</artifactId>
-    <version>1.5.8-SNAPSHOT</version>
+    <version>2.0.0-M3-SNAPSHOT</version>
   </parent>
   
   <artifactId>apacheds-server-tools</artifactId>

Modified: directory/apacheds/branches/one-sub-level-index-removal/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-tools/src/main/resources/config/config/ou%3Dconfig/ou%3Dservers/ads-serverid%3Dldapserver/ou%3Dextendedoperatiohandlers/ads-id%3Dlaunchdiagnosticuihandler.ldif?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif Sun Oct  9 17:03:52 2011
@@ -1,3 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+#   EXAMPLE.COM is reserved for testing according to this RFC:
+#
+#   http://www.rfc-editor.org/rfc/rfc2606.txt
+#
+
 version: 1
 dn: ads-Id=launchdiagnosticuihandler,ou=extendedoperationhandlers,ads-serverId=ld
  apServer,ou=servers,ou=config

Propchange: directory/apacheds/branches/one-sub-level-index-removal/service/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct  9 17:03:52 2011
@@ -7,5 +7,5 @@
 /directory/apacheds/branches/apacheds-subtree/service:965203-965686
 /directory/apacheds/branches/milestones/service:1072812-1075328
 /directory/apacheds/branches/xdbm-refactoring/service:945827-946347
-/directory/apacheds/trunk/service:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/service:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
 /directory/studio/trunk/service:1067786-1067997

Propchange: directory/apacheds/branches/one-sub-level-index-removal/service-builder/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct  9 17:03:52 2011
@@ -1,4 +1,4 @@
 /directory/apacheds/branches/antoine/service-builder:1038305-1044163
 /directory/apacheds/branches/milestones/service-builder:1072812-1075328
-/directory/apacheds/trunk/service-builder:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/service-builder:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
 /directory/studio/trunk/service-builder:1067786-1067997

Modified: directory/apacheds/branches/one-sub-level-index-removal/service-builder/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/service-builder/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/service-builder/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/service-builder/pom.xml Sun Oct  9 17:03:52 2011
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.directory.server</groupId>
     <artifactId>apacheds-parent</artifactId>
-    <version>2.0.0-M3-SNAPSHOT</version>
+    <version>2.0.0-M4-SNAPSHOT</version>
   </parent>
 
   <artifactId>apacheds-service-builder</artifactId>



Mime
View raw message