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 2010/08/14 02:22:40 UTC
svn commit: r985411 [8/11] - in /directory:
apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/
apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/admin/
apacheds...
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java Sat Aug 14 00:22:38 2010
@@ -20,6 +20,7 @@
package org.apache.directory.shared.client.api.operations;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -32,7 +33,6 @@ import org.apache.directory.ldap.client.
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.future.ModifyDnFuture;
import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
-import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.CoreSession;
@@ -40,6 +40,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.junit.After;
@@ -47,32 +48,26 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
/**
* Testcase for modifyDn operation.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@RunWith(FrameworkRunner.class)
-@ApplyLdifs( {
- "dn: cn=modDn,ou=system",
- "objectClass: person",
- "cn: modDn",
- "sn: snModDn"
-})
-@CreateLdapServer (
- transports =
- {
- @CreateTransport( protocol = "LDAP" ),
- @CreateTransport( protocol = "LDAPS" )
- })
+@ApplyLdifs(
+ { "dn: cn=modDn,ou=system", "objectClass: person", "cn: modDn", "sn: snModDn" })
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
public class ClientModifyDnRequestTest extends AbstractLdapTestUnit
{
private LdapAsyncConnection connection;
-
+
private CoreSession session;
-
+
private String dn = "cn=modDn,ou=system";
+
@Before
public void setup() throws Exception
{
@@ -80,11 +75,11 @@ public class ClientModifyDnRequestTest e
DN bindDn = new DN( "uid=admin,ou=system" );
connection.bind( bindDn.getName(), "secret" );
-
+
session = ldapServer.getDirectoryService().getAdminSession();
}
-
+
/**
* Close the LdapConnection
*/
@@ -98,53 +93,53 @@ public class ClientModifyDnRequestTest e
connection.close();
}
}
- catch( Exception ioe )
+ catch ( Exception ioe )
{
fail();
}
}
-
-
+
+
@Test
public void testRename() throws Exception
{
- ModifyDnResponse resp = connection.rename( dn, "cn=modifyDnWithString" );
+ InternalModifyDnResponse resp = connection.rename( dn, "cn=modifyDnWithString" );
assertNotNull( resp );
assertFalse( session.exists( new DN( dn ) ) );
assertTrue( session.exists( new DN( "cn=modifyDnWithString,ou=system" ) ) );
}
-
-
+
+
@Test
public void testRenameWithoutDeleteOldRdn() throws Exception
{
- ModifyDnResponse resp = connection.rename( dn, "cn=modifyDnWithString", false );
+ InternalModifyDnResponse resp = connection.rename( dn, "cn=modifyDnWithString", false );
assertNotNull( resp );
-
+
DN oldDn = new DN( dn );
assertFalse( session.exists( oldDn ) );
-
+
Entry entry = session.lookup( new DN( "cn=modifyDnWithString,ou=system" ) );
assertNotNull( entry );
-
+
RDN oldRdn = oldDn.getRdn();
assertTrue( entry.contains( oldRdn.getUpType(), oldRdn.getNormValue() ) );
}
-
-
+
+
@Test
public void testMove() throws Exception
{
- ModifyDnResponse resp = connection.move( dn, "ou=users,ou=system" );
+ InternalModifyDnResponse resp = connection.move( dn, "ou=users,ou=system" );
assertNotNull( resp );
-
+
DN oldDn = new DN( dn );
assertFalse( session.exists( oldDn ) );
-
+
assertTrue( session.exists( new DN( "cn=modDn,ou=users,ou=system" ) ) );
}
-
-
+
+
@Test
public void testModifyDnAsync() throws Exception
{
@@ -157,11 +152,11 @@ public class ClientModifyDnRequestTest e
modDnReq.setDeleteOldRdn( true );
ModifyDnFuture modifyDnFuture = connection.modifyDnAsync( modDnReq );
-
+
try
{
- ModifyDnResponse response = modifyDnFuture.get( 1000, TimeUnit.MILLISECONDS );
-
+ InternalModifyDnResponse response = modifyDnFuture.get( 1000, TimeUnit.MILLISECONDS );
+
assertNotNull( response );
assertTrue( connection.isAuthenticated() );
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyRequestTest.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyRequestTest.java Sat Aug 14 00:22:38 2010
@@ -34,8 +34,6 @@ import org.apache.directory.ldap.client.
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.future.ModifyFuture;
import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.CoreSession;
@@ -48,6 +46,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.util.DateUtils;
import org.junit.After;
@@ -62,18 +62,15 @@ 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" ),
- @CreateTransport( protocol = "LDAPS" )
- })
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
public class ClientModifyRequestTest extends AbstractLdapTestUnit
{
private LdapAsyncConnection connection;
private CoreSession session;
+
@Before
public void setup() throws Exception
{
@@ -100,7 +97,7 @@ public class ClientModifyRequestTest ext
connection.close();
}
}
- catch( Exception ioe )
+ catch ( Exception ioe )
{
fail();
}
@@ -194,7 +191,7 @@ public class ClientModifyRequestTest ext
try
{
- ModifyResponse response = modifyFuture.get( 1000, TimeUnit.MILLISECONDS );
+ InternalModifyResponse response = modifyFuture.get( 1000, TimeUnit.MILLISECONDS );
assertNotNull( response );
@@ -225,7 +222,7 @@ public class ClientModifyRequestTest ext
ModifyRequest modReq = new ModifyRequest( dn );
modReq.replace( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
- ModifyResponse modResp = connection.modify( modReq );
+ InternalModifyResponse modResp = connection.modify( modReq );
assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, modResp.getLdapResult().getResultCode() );
modReq = new ModifyRequest( dn );
@@ -251,10 +248,10 @@ public class ClientModifyRequestTest ext
modReq.replace( SchemaConstants.MODIFIERS_NAME_AT, modifierName );
modReq.replace( SchemaConstants.MODIFY_TIMESTAMP_AT, modifiedTime );
- ModifyResponse modResp = connection.modify( modReq );
+ InternalModifyResponse modResp = connection.modify( modReq );
assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );
- Entry loadedEntry = ( ( SearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
+ Entry loadedEntry = ( ( InternalSearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
assertEquals( modifierName, loadedEntry.get( SchemaConstants.MODIFIERS_NAME_AT ).getString() );
assertEquals( modifiedTime, loadedEntry.get( SchemaConstants.MODIFY_TIMESTAMP_AT ).getString() );
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java Sat Aug 14 00:22:38 2010
@@ -19,6 +19,7 @@
*/
package org.apache.directory.shared.client.api.operations.bind;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -33,8 +34,6 @@ import org.apache.directory.ldap.client.
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.future.BindFuture;
import org.apache.directory.ldap.client.api.message.BindRequest;
-import org.apache.directory.ldap.client.api.message.BindResponse;
-import org.apache.directory.ldap.client.api.message.LdapResult;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -45,41 +44,33 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.BindOperationContext;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalBindResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
/**
* Test the Simple BindRequest operation
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateLdapServer (
- transports =
- {
- @CreateTransport( protocol = "LDAP" ),
- @CreateTransport( protocol = "LDAPS" )
- })
-@ApplyLdifs( {
- // Entry # 1
- "dn: uid=superuser,ou=system",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "objectClass: top",
- "cn: superuser",
- "sn: administrator",
- "displayName: Directory Superuser",
- "uid: superuser",
- "userPassword: test"
-})
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
+@ApplyLdifs(
+ {
+ // Entry # 1
+ "dn: uid=superuser,ou=system", "objectClass: person", "objectClass: organizationalPerson",
+ "objectClass: inetOrgPerson", "objectClass: top", "cn: superuser", "sn: administrator",
+ "displayName: Directory Superuser", "uid: superuser", "userPassword: test" })
public class SimpleBindRequestTest extends AbstractLdapTestUnit
{
private LdapAsyncConnection connection;
-
+
/**
* Create the LdapConnection
*/
@@ -89,7 +80,7 @@ public class SimpleBindRequestTest exten
connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
}
-
+
/**
* Close the LdapConnection
*/
@@ -103,21 +94,21 @@ public class SimpleBindRequestTest exten
connection.close();
}
}
- catch( Exception ioe )
+ catch ( Exception ioe )
{
fail();
}
}
-
+
/**
* Test a successful synchronous bind request. the server allows it.
*/
@Test
public void testSyncBindRequest() throws Exception
{
- BindResponse bindResponse = connection.bind( "uid=admin,ou=system", "secret" );
-
+ InternalBindResponse bindResponse = connection.bind( "uid=admin,ou=system", "secret" );
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
@@ -125,7 +116,7 @@ public class SimpleBindRequestTest exten
assertTrue( connection.isAuthenticated() );
}
-
+
/**
* Test a successful asynchronous bind request, 10 times.
*/
@@ -135,18 +126,18 @@ public class SimpleBindRequestTest exten
int i = 0;
int nbLoop = 10;
- for ( ; i < nbLoop; i++)
+ for ( ; i < nbLoop; i++ )
{
BindRequest bindRequest = new BindRequest();
bindRequest.setName( "uid=admin,ou=system" );
bindRequest.setCredentials( "secret" );
-
+
BindFuture bindFuture = connection.bindAsync( bindRequest );
-
+
try
{
- BindResponse bindResponse = bindFuture.get( 1000, TimeUnit.MILLISECONDS );
-
+ InternalBindResponse bindResponse = bindFuture.get( 1000, TimeUnit.MILLISECONDS );
+
assertNotNull( bindResponse );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertTrue( connection.isAuthenticated() );
@@ -157,50 +148,50 @@ public class SimpleBindRequestTest exten
}
}
}
-
-
+
+
/**
* Test an Anonymous BindRequest
*/
@Test
public void testSimpleBindAnonymous() throws Exception
{
- for ( int i = 0; i < 5; i++)
+ for ( int i = 0; i < 5; i++ )
{
//System.out.println( "------------------Create connection" + i + "-------------" );
LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
//System.out.println( "------------------Bind" + i + "-------------" );
-
+
// Try with no parameters
- BindResponse bindResponse = connection.bind();
-
+ InternalBindResponse bindResponse = connection.bind();
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 1, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
//System.out.println( "----------------Unbind" + i + "-------------" );
connection.unBind();
assertFalse( connection.isConnected() );
-
+
// Try with empty strings
connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
bindResponse = connection.bind( "", "" );
-
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 1, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
connection.unBind();
assertFalse( connection.isConnected() );
-
+
// Try with null parameters
connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
- bindResponse = connection.bind( (String)null, (String)null );
-
+ bindResponse = connection.bind( ( String ) null, ( String ) null );
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
@@ -212,123 +203,122 @@ public class SimpleBindRequestTest exten
assertFalse( connection.isConnected() );
connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
-
-
+
//System.out.println( "----------------Unbind done" + i + "-------------" );
assertFalse( connection.isConnected() );
//System.out.println( "----------------Unconnected" + i + "-------------" );
-
+
}
}
-
+
/**
* A bind with no name and a password is invalid
*/
@Test
public void testSimpleBindNoNamePassword() throws Exception
{
- BindResponse response = connection.bind((String)null, "abc" );
- LdapResult ldapResult = response.getLdapResult();
+ InternalBindResponse response = connection.bind( ( String ) null, "abc" );
+ InternalLdapResult ldapResult = response.getLdapResult();
assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, ldapResult.getResultCode() );
assertEquals( 1, response.getMessageId() );
assertFalse( connection.isAuthenticated() );
assertTrue( connection.isConnected() );
}
-
+
/**
* Test an unauthenticated bind (name, no password)
*/
@Test
public void testSimpleBindUnauthenticated() throws Exception
{
- BindResponse response = connection.bind( "uid=admin,ou=system", (String)null );
- LdapResult ldapResult = response.getLdapResult();
+ InternalBindResponse response = connection.bind( "uid=admin,ou=system", ( String ) null );
+ InternalLdapResult ldapResult = response.getLdapResult();
assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, ldapResult.getResultCode() );
assertEquals( 1, response.getMessageId() );
assertFalse( connection.isAuthenticated() );
assertTrue( connection.isConnected() );
}
-
+
/**
* Test a valid bind
*/
@Test
public void testSimpleBindValid() throws Exception
{
- BindResponse response = connection.bind( "uid=admin,ou=system", "secret" );
- LdapResult ldapResult = response.getLdapResult();
+ InternalBindResponse response = connection.bind( "uid=admin,ou=system", "secret" );
+ InternalLdapResult ldapResult = response.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult.getResultCode() );
assertEquals( 1, response.getMessageId() );
assertTrue( connection.isAuthenticated() );
}
-
+
/**
* Test a bind with a valid user but a wrong password
*/
@Test
public void testSimpleBindValidUserWrongPassword() throws Exception
{
- BindResponse response = connection.bind( "uid=admin,ou=system", "badpassword" );
- LdapResult ldapResult = response.getLdapResult();
+ InternalBindResponse response = connection.bind( "uid=admin,ou=system", "badpassword" );
+ InternalLdapResult ldapResult = response.getLdapResult();
assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, ldapResult.getResultCode() );
assertEquals( 1, response.getMessageId() );
assertFalse( connection.isAuthenticated() );
assertTrue( connection.isConnected() );
}
-
+
/**
* Test a bind with an invalid user
*/
@Test
public void testSimpleBindInvalidUser() throws Exception
{
- BindResponse response = connection.bind( "uid=wrong,ou=system", "secret" );
- LdapResult ldapResult = response.getLdapResult();
+ InternalBindResponse response = connection.bind( "uid=wrong,ou=system", "secret" );
+ InternalLdapResult ldapResult = response.getLdapResult();
assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, ldapResult.getResultCode() );
assertEquals( 1, response.getMessageId() );
assertFalse( connection.isAuthenticated() );
assertTrue( connection.isConnected() );
}
-
+
/**
* Test a valid bind followed by another valid bind
*/
@Test
public void testDoubleSimpleBindValid() throws Exception
{
- BindResponse response1 = connection.bind( "uid=admin,ou=system", "secret" );
- LdapResult ldapResult1 = response1.getLdapResult();
+ InternalBindResponse response1 = connection.bind( "uid=admin,ou=system", "secret" );
+ InternalLdapResult ldapResult1 = response1.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult1.getResultCode() );
assertEquals( 1, response1.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
// The messageId must have been incremented
- BindResponse response2 = connection.bind( "uid=admin,ou=system", "secret" );
- LdapResult ldapResult2 = response2.getLdapResult();
+ InternalBindResponse response2 = connection.bind( "uid=admin,ou=system", "secret" );
+ InternalLdapResult ldapResult2 = response2.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult2.getResultCode() );
assertEquals( 2, response2.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
// Now, unbind
connection.unBind();
assertFalse( connection.isAuthenticated() );
assertFalse( connection.isConnected() );
-
+
// And Bind again. The messageId should be 1
- BindResponse response3 = connection.bind( "uid=admin,ou=system", "secret" );
- LdapResult ldapResult3 = response3.getLdapResult();
+ InternalBindResponse response3 = connection.bind( "uid=admin,ou=system", "secret" );
+ InternalLdapResult ldapResult3 = response3.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult3.getResultCode() );
assertEquals( 1, response3.getMessageId() );
assertTrue( connection.isAuthenticated() );
}
-
+
/**
* Test that we can't send another request until the BindResponse arrives
*/
@@ -340,7 +330,7 @@ public class SimpleBindRequestTest exten
// Inject the interceptor that waits 1 second when binding
// in order to be able to send a request before we get the response
service.getInterceptorChain().addFirst( new BaseInterceptor()
- {
+ {
/**
* Wait 1 second before going any further
*/
@@ -355,32 +345,32 @@ public class SimpleBindRequestTest exten
{
// Ok, get out
}
-
+
next.bind( bindContext );
}
} );
-
+
// Send another BindRequest
BindRequest bindRequest = new BindRequest();
bindRequest.setName( "uid=admin,ou=system" );
bindRequest.setCredentials( "secret" );
-
+
BindFuture bindFuture = connection.bindAsync( bindRequest );
-
+
// Wait a bit to be sure the server is processing the bind request
Thread.sleep( 200 );
-
+
// It will take 1 seconds to bind, let's send another bind request : it should fail
- BindResponse response = connection.bind( "uid=admin,ou=system", "secret" );
-
+ InternalBindResponse response = connection.bind( "uid=admin,ou=system", "secret" );
+
assertFalse( connection.isAuthenticated() );
assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
-
+
// Now get back the BindResponse
try
{
- BindResponse bindResponse = bindFuture.get( 2000, TimeUnit.MILLISECONDS );
-
+ InternalBindResponse bindResponse = bindFuture.get( 2000, TimeUnit.MILLISECONDS );
+
assertNotNull( bindResponse );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertTrue( connection.isAuthenticated() );
@@ -395,8 +385,8 @@ public class SimpleBindRequestTest exten
service.getInterceptorChain().remove( this.getClass().getName() + "$1" );
}
}
-
-
+
+
/**
* Bind with a new user when the connection is establish with an anonymous authent.
*/
@@ -404,34 +394,34 @@ public class SimpleBindRequestTest exten
public void testBindUserWhenAnonymous() throws Exception
{
// Bind anonymous
- BindResponse bindResponse = connection.bind();
-
+ InternalBindResponse bindResponse = connection.bind();
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 1, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
// Now bind with some credentials
bindResponse = connection.bind( "uid=admin, ou=system", "secret" );
-
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 2, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
//And back to anonymous
bindResponse = connection.bind();
-
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 3, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
}
-
-
+
+
/**
* Bind with a new user when the connection is establish with an anonymous authent.
*/
@@ -439,17 +429,17 @@ public class SimpleBindRequestTest exten
public void testBindUserWhenAlreadyBound() throws Exception
{
// Bind with some credentials
- BindResponse bindResponse = connection.bind( "uid=admin, ou=system", "secret" );
-
+ InternalBindResponse bindResponse = connection.bind( "uid=admin, ou=system", "secret" );
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
assertEquals( 1, bindResponse.getMessageId() );
assertTrue( connection.isAuthenticated() );
-
+
// Bind with another user
- bindResponse = connection.bind( "uid=superuser,ou=system", "test");
-
+ bindResponse = connection.bind( "uid=superuser,ou=system", "test" );
+
assertNotNull( bindResponse );
assertNotNull( bindResponse.getLdapResult() );
assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java Sat Aug 14 00:22:38 2010
@@ -32,9 +32,6 @@ import org.apache.directory.ldap.client.
import org.apache.directory.ldap.client.api.SearchCursor;
import org.apache.directory.ldap.client.api.future.SearchFuture;
import org.apache.directory.ldap.client.api.message.SearchRequest;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultDone;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -46,6 +43,9 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -59,39 +59,26 @@ 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"),
- @CreateTransport(protocol = "LDAPS")
- })
-@ApplyLdifs({
- "dn: cn=user1,ou=users,ou=system",
- "objectClass: person",
- "objectClass: top",
- "sn: user1 sn",
- "cn: user1",
-
- // alias to the above entry
- "dn: cn=user1-alias,ou=users,ou=system",
- "objectClass: alias",
- "objectClass: top",
- "objectClass: extensibleObject",
- "aliasedObjectName: cn=user1,ou=users,ou=system",
- "cn: user1-alias",
-
- // Another user
- "dn: cn=elecharny,ou=users,ou=system",
- "objectClass: person",
- "objectClass: top",
- "sn:: RW1tYW51ZWwgTMOpY2hhcm55",
- "cn: elecharny"
-
-})
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
+@ApplyLdifs(
+ { "dn: cn=user1,ou=users,ou=system", "objectClass: person", "objectClass: top", "sn: user1 sn",
+ "cn: user1",
+
+ // alias to the above entry
+ "dn: cn=user1-alias,ou=users,ou=system", "objectClass: alias", "objectClass: top",
+ "objectClass: extensibleObject", "aliasedObjectName: cn=user1,ou=users,ou=system", "cn: user1-alias",
+
+ // Another user
+ "dn: cn=elecharny,ou=users,ou=system", "objectClass: person", "objectClass: top",
+ "sn:: RW1tYW51ZWwgTMOpY2hhcm55", "cn: elecharny"
+
+ })
public class ClientSearchRequestTest extends AbstractLdapTestUnit
{
private LdapAsyncConnection connection;
+
@Before
public void setup() throws Exception
{
@@ -124,7 +111,8 @@ public class ClientSearchRequestTest ext
@Test
public void testSearch() throws Exception
{
- SearchCursor cursor = ( SearchCursor ) connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL, "*", "+" );
+ SearchCursor cursor = ( SearchCursor ) connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL,
+ "*", "+" );
int count = 0;
while ( cursor.next() )
{
@@ -132,54 +120,54 @@ public class ClientSearchRequestTest ext
count++;
}
- SearchResultDone done = cursor.getSearchDone();
-
+ InternalSearchResultDone done = cursor.getSearchDone();
+
assertNotNull( done );
assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
assertEquals( 5, count );
}
-
+
@Test
public void testSearchEquality() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)", SearchScope.ONELEVEL, "*",
- "+" );
+ Cursor<InternalResponse> cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)",
+ SearchScope.ONELEVEL, "*", "+" );
int count = 0;
while ( cursor.next() )
{
- Entry entry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
- assertNotNull( entry );
+ Entry entry = ( ( InternalSearchResultEntry ) cursor.get() ).getEntry();
+ assertNotNull( entry );
count++;
}
-
+
assertEquals( 4, count );
}
-
-
+
+
@Test
public void testAsyncSearch() throws Exception
{
SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL, "*",
"+" );
int count = 0;
- SearchResponse searchResponse = null;
-
+ InternalResponse searchResponse = null;
+
do
{
- searchResponse = ( SearchResponse ) searchFuture.get( 1000, TimeUnit.MILLISECONDS );
+ searchResponse = ( InternalResponse ) searchFuture.get( 1000, TimeUnit.MILLISECONDS );
assertNotNull( searchResponse );
- if( !( searchResponse instanceof SearchResultDone ) )
+ if ( !( searchResponse instanceof InternalSearchResultDone ) )
{
count++;
}
}
- while ( !( searchResponse instanceof SearchResultDone ) );
+ while ( !( searchResponse instanceof InternalSearchResultDone ) );
assertEquals( 5, count );
}
-
+
/**
* Test a search with a Substring filter
* @throws Exception
@@ -187,27 +175,27 @@ public class ClientSearchRequestTest ext
@Test
public void testSearchPersonSubstring() throws Exception
{
- SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*ers*)", SearchScope.SUBTREE, "*",
- "+" );
+ SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*ers*)", SearchScope.SUBTREE,
+ "*", "+" );
int count = 0;
- SearchResponse searchResponse = null;
-
+ InternalResponse searchResponse = null;
+
do
{
- searchResponse = ( SearchResponse ) searchFuture.get( 100000, TimeUnit.MILLISECONDS );
+ searchResponse = ( InternalResponse ) searchFuture.get( 100000, TimeUnit.MILLISECONDS );
assertNotNull( searchResponse );
-
- if ( !( searchResponse instanceof SearchResultDone ) )
+
+ if ( !( searchResponse instanceof InternalSearchResultDone ) )
{
count++;
}
}
- while ( !( searchResponse instanceof SearchResultDone ) );
+ while ( !( searchResponse instanceof InternalSearchResultDone ) );
assertEquals( 3, count );
}
-
+
@Test
public void testSearchWithDerefAlias() throws Exception
{
@@ -216,32 +204,32 @@ public class ClientSearchRequestTest ext
searchRequest.setFilter( "(objectClass=*)" );
searchRequest.setScope( SearchScope.ONELEVEL );
searchRequest.addAttributes( "*" );
-
+
int count = 0;
- Cursor<SearchResponse> cursor = connection.search( searchRequest );
-
- while( cursor.next() )
+ Cursor<InternalResponse> cursor = connection.search( searchRequest );
+
+ while ( cursor.next() )
{
count++;
}
-
+
// due to dereferencing of aliases we get only one entry
assertEquals( 2, count );
count = 0;
searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
cursor = connection.search( searchRequest );
-
- while( cursor.next() )
+
+ while ( cursor.next() )
{
count++;
}
-
+
assertEquals( 3, count );
}
-
- @Test(expected=LdapException.class)
+
+ @Test(expected = LdapException.class)
public void testSearchUTF8() throws Exception
{
connection.search( "ou=system", "(sn=Emmanuel Lcharny)", SearchScope.ONELEVEL, "*", "+" );
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java Sat Aug 14 00:22:38 2010
@@ -28,8 +28,6 @@ import static org.junit.Assert.fail;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -38,6 +36,8 @@ import org.apache.directory.server.core.
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.AfterClass;
import org.junit.Before;
@@ -51,31 +51,19 @@ 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"),
- @CreateTransport(protocol = "LDAPS")
- })
-@ApplyLdifs({
- "dn: cn=user1,ou=users,ou=system",
- "objectClass: person",
- "objectClass: top",
- "sn: user1 sn",
- "cn: user1",
-
- // alias to the above entry
- "dn: cn=user1-alias,ou=users,ou=system",
- "objectClass: alias",
- "objectClass: top",
- "objectClass: extensibleObject",
- "aliasedObjectName: cn=user1,ou=users,ou=system",
- "cn: user1-alias"
-})
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
+@ApplyLdifs(
+ { "dn: cn=user1,ou=users,ou=system", "objectClass: person", "objectClass: top", "sn: user1 sn", "cn: user1",
+
+ // alias to the above entry
+ "dn: cn=user1-alias,ou=users,ou=system", "objectClass: alias", "objectClass: top",
+ "objectClass: extensibleObject", "aliasedObjectName: cn=user1,ou=users,ou=system", "cn: user1-alias" })
public class SearchRequestReturningAttributesTest extends AbstractLdapTestUnit
{
private static LdapConnection connection;
+
@Before
public void setup() throws Exception
{
@@ -113,11 +101,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchAll() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT, "*",
- "+" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "*", "+" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -127,10 +115,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 7, entry.size() );
assertTrue( entry.containsAttribute( "objectClass" ) );
assertTrue( entry.containsAttribute( "cn" ) );
@@ -150,10 +138,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchAllUsers() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT, "*" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "*" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -163,10 +152,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 3, entry.size() );
assertTrue( entry.containsAttribute( "objectClass" ) );
assertTrue( entry.containsAttribute( "cn" ) );
@@ -182,10 +171,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchAllOperationals() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT, "+" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "+" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -195,10 +185,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 4, entry.size() );
assertTrue( entry.containsAttribute( "creatorsName" ) );
assertTrue( entry.containsAttribute( "createTimestamp" ) );
@@ -215,11 +205,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchAllUsersAndSomeOperationals() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT, "*",
- "entryCSN", "entryUUID" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "*", "entryCSN", "entryUUID" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -229,10 +219,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 5, entry.size() );
assertTrue( entry.containsAttribute( "objectClass" ) );
assertTrue( entry.containsAttribute( "cn" ) );
@@ -250,11 +240,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchAllOperationalAndSomeUsers() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT, "+",
- "cn", "sn" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "+", "cn", "sn" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -264,10 +254,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 6, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
assertTrue( entry.containsAttribute( "sn" ) );
@@ -286,11 +276,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchSomeOpsAndUsers() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "cn", "entryUUID", "sn", "entryCSN" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "cn", "entryUUID", "sn", "entryCSN" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -300,10 +290,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 4, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
assertTrue( entry.containsAttribute( "sn" ) );
@@ -320,11 +310,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchWithDuplicatedAttrs() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "cn", "entryUUID", "cn", "sn", "entryCSN", "entryUUID" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "cn", "entryUUID", "cn", "sn", "entryCSN", "entryUUID" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -334,10 +324,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 4, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
assertTrue( entry.containsAttribute( "sn" ) );
@@ -354,11 +344,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchWithOIDAndtext() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "cn", "1.3.6.1.1.16.4", "surName", "entryCSN", "entryUUID" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "cn", "1.3.6.1.1.16.4", "surName", "entryCSN", "entryUUID" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -368,10 +358,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 4, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
assertTrue( entry.containsAttribute( "sn" ) );
@@ -388,11 +378,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchWithMissingAttributes() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "cn", "1.3.6.1.1.16.4", "gn", "entryCSN", "entryUUID" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "cn", "1.3.6.1.1.16.4", "gn", "entryCSN", "entryUUID" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -402,10 +392,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 3, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
assertTrue( entry.containsAttribute( "entryUUID" ) );
@@ -421,11 +411,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchNoAttributes() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "1.1" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "1.1" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -435,10 +425,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 0, entry.size() );
}
@@ -451,11 +441,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchNoAttributesAndAttributes() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "1.1", "cn" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "1.1", "cn" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -465,10 +455,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
+
assertEquals( 1, entry.size() );
assertTrue( entry.containsAttribute( "cn" ) );
}
@@ -482,11 +472,11 @@ public class SearchRequestReturningAttri
@Test
public void testSearchNoAttributesAllAttributes() throws Exception
{
- Cursor<SearchResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)", SearchScope.OBJECT,
- "1.1", "*", "+" );
+ Cursor<InternalResponse> cursor = connection.search( "cn=user1,ou=users,ou=system", "(objectclass=*)",
+ SearchScope.OBJECT, "1.1", "*", "+" );
int count = 0;
- SearchResponse response = null;
-
+ InternalResponse response = null;
+
while ( cursor.next() )
{
response = cursor.get();
@@ -496,11 +486,10 @@ public class SearchRequestReturningAttri
assertEquals( 1, count );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
- SearchResultEntry resultEntry = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) response;
Entry entry = resultEntry.getEntry();
-
-
+
assertEquals( 7, entry.size() );
assertTrue( entry.containsAttribute( "objectClass" ) );
assertTrue( entry.containsAttribute( "cn" ) );
Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java Sat Aug 14 00:22:38 2010
@@ -30,10 +30,8 @@ import javax.naming.directory.InitialDir
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
-import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ContextEntry;
@@ -44,6 +42,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -57,32 +57,12 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@RunWith(FrameworkRunner.class)
-@CreateDS(
- name = "ClientApiPerfTestDS",
- partitions =
- {
- @CreatePartition(
- name = "example",
- suffix = "dc=example,dc=com",
- contextEntry = @ContextEntry(
- entryLdif =
- "dn: dc=example,dc=com\n" +
- "dc: example\n" +
- "objectClass: top\n" +
- "objectClass: domain\n\n" ),
- indexes =
- {
- @CreateIndex( attribute = "objectClass" ),
- @CreateIndex( attribute = "dc" ),
- @CreateIndex( attribute = "ou" )
- } )
- } )
-@CreateLdapServer (
- transports =
- {
- @CreateTransport( protocol = "LDAP" ),
- @CreateTransport( protocol = "LDAPS" )
- })
+@CreateDS(name = "ClientApiPerfTestDS", partitions =
+ { @CreatePartition(name = "example", suffix = "dc=example,dc=com", contextEntry = @ContextEntry(entryLdif = "dn: dc=example,dc=com\n"
+ + "dc: example\n" + "objectClass: top\n" + "objectClass: domain\n\n"), indexes =
+ { @CreateIndex(attribute = "objectClass"), @CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou") }) })
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
public class TestClientApiPerf extends AbstractLdapTestUnit
{
@@ -97,12 +77,12 @@ public class TestClientApiPerf extends A
long t2 = System.currentTimeMillis();
- Cursor<SearchResponse> cursor = connection.search( "dc=example,dc=com", "(objectClass=*)", SearchScope.SUBTREE,
- "*" );
+ Cursor<InternalResponse> cursor = connection.search( "dc=example,dc=com", "(objectClass=*)",
+ SearchScope.SUBTREE, "*" );
while ( cursor.next() )
{
- SearchResponse sr = cursor.get();
- SearchResultEntry sre = ( SearchResultEntry ) sr;
+ InternalResponse sr = cursor.get();
+ InternalSearchResultEntry sre = ( InternalSearchResultEntry ) sr;
}
cursor.close();
Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java Sat Aug 14 00:22:38 2010
@@ -26,8 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.LdapCoreSessionConnection;
@@ -44,6 +42,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.slf4j.Logger;
@@ -68,13 +68,14 @@ public class ReplicaDitStoreUtil
private Map<Integer, List<Modification>> modMap = new HashMap<Integer, List<Modification>>();
private LdapCoreSessionConnection coreConnection;
-
+
+
public ReplicaDitStoreUtil( DirectoryService dirService ) throws Exception
{
this.adminSession = dirService.getAdminSession();
this.schemaManager = dirService.getSchemaManager();
coreConnection = new LdapCoreSessionConnection( adminSession );
-
+
init();
}
@@ -93,7 +94,7 @@ public class ReplicaDitStoreUtil
adminSession.add( entry );
}
-
+
}
@@ -106,7 +107,7 @@ public class ReplicaDitStoreUtil
Entry entry = new DefaultEntry( schemaManager );
entry.setDn( new DN( "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN ) );
-
+
entry.add( SchemaConstants.OBJECT_CLASS_AT, "ads-replConsumer" );
entry.add( "ads-dsReplicaId", String.valueOf( replica.getId() ) );
entry.add( "ads-replAliasDerefMode", String
@@ -115,25 +116,26 @@ public class ReplicaDitStoreUtil
entry.add( "ads-replLastSentCsn", replica.getLastSentCsn() );
entry.add( "ads-replSearchScope", String.valueOf( replica.getSearchCriteria().getScope().getScope() ) );
entry.add( "ads-replSearchFilter", replica.getSearchFilter() );
-
+
adminSession.add( entry );
}
public void updateReplicaLastSentCsn( ReplicaEventLog replica ) throws Exception
{
-
+
List<Modification> mods = modMap.get( replica.getId() );
EntryAttribute lastSentCsnAt = null;
- if( mods == null )
+ if ( mods == null )
{
- lastSentCsnAt = new DefaultEntryAttribute( schemaManager.lookupAttributeTypeRegistry( "ads-replLastSentCsn" ) );
+ lastSentCsnAt = new DefaultEntryAttribute( schemaManager
+ .lookupAttributeTypeRegistry( "ads-replLastSentCsn" ) );
lastSentCsnAt.add( replica.getLastSentCsn() );
-
+
Modification mod = new DefaultModification();
mod.setOperation( ModificationOperation.REPLACE_ATTRIBUTE );
mod.setAttribute( lastSentCsnAt );
-
+
mods = new ArrayList<Modification>( 1 );
mods.add( mod );
}
@@ -147,55 +149,57 @@ public class ReplicaDitStoreUtil
DN dn = new DN( "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN );
adminSession.modify( dn, mods );
}
-
-
+
+
public List<ReplicaEventLog> getReplicaConsumers() throws Exception
{
List<ReplicaEventLog> replicas = new ArrayList<ReplicaEventLog>();
-
- Cursor<SearchResponse> cursor = coreConnection.search( REPL_CONSUMER_DN, "(objectClass=ads-replConsumer)", SearchScope.ONELEVEL, "+", "*" );
- while( cursor.next() )
+
+ Cursor<InternalResponse> cursor = coreConnection.search( REPL_CONSUMER_DN, "(objectClass=ads-replConsumer)",
+ SearchScope.ONELEVEL, "+", "*" );
+
+ while ( cursor.next() )
{
- Entry entry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) cursor.get() ).getEntry();
ReplicaEventLog replica = convertEntryToReplica( entry );
replicas.add( replica );
}
cursor.close();
-
+
return replicas;
}
-
+
private ReplicaEventLog convertEntryToReplica( Entry entry ) throws Exception
{
String id = entry.get( "ads-dsReplicaId" ).getString();
ReplicaEventLog replica = new ReplicaEventLog( Integer.parseInt( id ) );
-
+
NotificationCriteria searchCriteria = new NotificationCriteria();
-
+
String aliasMode = entry.get( "ads-replAliasDerefMode" ).getString();
searchCriteria.setAliasDerefMode( AliasDerefMode.getDerefMode( Integer.parseInt( aliasMode ) ) );
-
+
String baseDn = entry.get( "ads-searchBaseDN" ).getString();
searchCriteria.setBase( baseDn );
-
+
String lastSentCsn = entry.get( "ads-replLastSentCsn" ).getString();
replica.setLastSentCsn( lastSentCsn );
-
+
String scope = entry.get( "ads-replSearchScope" ).getString();
searchCriteria.setScope( SearchScope.getSearchScope( Integer.parseInt( scope ) ) );
String filter = entry.get( "ads-replSearchFilter" ).getString();
searchCriteria.setFilter( filter );
replica.setSearchFilter( filter );
-
+
searchCriteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK );
replica.setSearchCriteria( searchCriteria );
-
+
// explicitly mark the replica as not-dirty, cause we just loaded it from
// the store, this prevents updating the replica info immediately after loading
replica.setDirty( false );
-
+
return replica;
}
}
Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java Sat Aug 14 00:22:38 2010
@@ -35,14 +35,7 @@ import java.util.Set;
import org.apache.directory.ldap.client.api.ConnectionClosedEventListener;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.future.SearchFuture;
-import org.apache.directory.ldap.client.api.message.BindResponse;
-import org.apache.directory.ldap.client.api.message.LdapResult;
-import org.apache.directory.ldap.client.api.message.SearchIntermediateResponse;
import org.apache.directory.ldap.client.api.message.SearchRequest;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultDone;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
-import org.apache.directory.ldap.client.api.message.SearchResultReference;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ClonedServerEntry;
@@ -79,6 +72,13 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.control.replication.SyncModifyDnType;
import org.apache.directory.shared.ldap.message.control.replication.SyncStateTypeEnum;
import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalBindResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -220,7 +220,7 @@ public class SyncReplConsumer implements
}
// Do a bind
- BindResponse bindResponse = connection.bind( config.getReplUserDn(), config.getReplUserPassword() );
+ InternalBindResponse bindResponse = connection.bind( config.getReplUserDn(), config.getReplUserPassword() );
// Check that it' not null and valid
if ( bindResponse == null )
@@ -230,7 +230,7 @@ public class SyncReplConsumer implements
}
// Now get the result
- LdapResult ldapResult = bindResponse.getLdapResult();
+ InternalLdapResult ldapResult = bindResponse.getLdapResult();
if ( ldapResult.getResultCode() != ResultCodeEnum.SUCCESS )
{
@@ -279,11 +279,11 @@ public class SyncReplConsumer implements
}
- public ResultCodeEnum handleSearchDone( SearchResultDone searchDone )
+ public ResultCodeEnum handleSearchDone( InternalSearchResultDone searchDone )
{
LOG.debug( "///////////////// handleSearchDone //////////////////" );
- Control ctrl = searchDone.getControl( SyncDoneValueControl.CONTROL_OID );
+ Control ctrl = searchDone.getControls().get( SyncDoneValueControl.CONTROL_OID );
SyncDoneValueControl syncDoneCtrl = new SyncDoneValueControl();
try
{
@@ -310,14 +310,14 @@ public class SyncReplConsumer implements
}
- public void handleSearchReference( SearchResultReference searchRef )
+ public void handleSearchReference( InternalSearchResultReference searchRef )
{
// this method won't be called cause the provider will serve the referrals as
// normal entry objects due to the usage of ManageDsaITControl in the search request
}
- public void handleSearchResult( SearchResultEntry syncResult )
+ public void handleSearchResult( InternalSearchResultEntry syncResult )
{
LOG.debug( "------------- starting handleSearchResult ------------" );
@@ -328,7 +328,7 @@ public class SyncReplConsumer implements
{
Entry remoteEntry = syncResult.getEntry();
- Control ctrl = syncResult.getControl( SyncStateValueControl.CONTROL_OID );
+ Control ctrl = syncResult.getControls().get( SyncStateValueControl.CONTROL_OID );
try
{
@@ -380,7 +380,7 @@ public class SyncReplConsumer implements
break;
case MODDN:
- Control adsModDnControl = syncResult.getControl( SyncModifyDnControl.CONTROL_OID );
+ Control adsModDnControl = syncResult.getControls().get( SyncModifyDnControl.CONTROL_OID );
//Apache Directory Server's special control
SyncModifyDnControl syncModDnControl = new SyncModifyDnControl();
@@ -422,7 +422,7 @@ public class SyncReplConsumer implements
/**
* {@inheritDoc}
*/
- public void handleSyncInfo( SearchIntermediateResponse syncInfoResp )
+ public void handleSyncInfo( InternalIntermediateResponse syncInfoResp )
{
try
{
@@ -549,34 +549,34 @@ public class SyncReplConsumer implements
// Do the search
SearchFuture sf = connection.searchAsync( searchRequest );
- SearchResponse resp = sf.get();
+ InternalResponse resp = sf.get();
- while ( !( resp instanceof SearchResultDone ) && !sf.isCancelled() )
+ while ( !( resp instanceof InternalSearchResultDone ) && !sf.isCancelled() )
{
- if ( resp instanceof SearchResultEntry )
+ if ( resp instanceof InternalSearchResultEntry )
{
- handleSearchResult( ( SearchResultEntry ) resp );
+ handleSearchResult( ( InternalSearchResultEntry ) resp );
}
- else if ( resp instanceof SearchResultReference )
+ else if ( resp instanceof InternalSearchResultReference )
{
- handleSearchReference( ( SearchResultReference ) resp );
+ handleSearchReference( ( InternalSearchResultReference ) resp );
}
- else if ( resp instanceof SearchIntermediateResponse )
+ else if ( resp instanceof InternalIntermediateResponse )
{
- handleSyncInfo( ( SearchIntermediateResponse ) resp );
+ handleSyncInfo( ( InternalIntermediateResponse ) resp );
}
resp = sf.get();
}
- ResultCodeEnum resultCode = handleSearchDone( ( SearchResultDone ) resp );
+ ResultCodeEnum resultCode = handleSearchDone( ( InternalSearchResultDone ) resp );
LOG.debug( "sync operation returned result code {}", resultCode );
if ( resultCode == ResultCodeEnum.NO_SUCH_OBJECT )
{
// log the error and handle it appropriately
LOG.warn( "given replication base DN {} is not found on provider", config.getBaseDn() );
- if( syncType == SynchronizationModeEnum.REFRESH_AND_PERSIST )
+ if ( syncType == SynchronizationModeEnum.REFRESH_AND_PERSIST )
{
LOG.warn( "disconnecting the consumer running in refreshAndPersist mode from the provider" );
disconnet();
@@ -589,9 +589,12 @@ public class SyncReplConsumer implements
{
deleteRecursive( new DN( config.getBaseDn() ), null );
}
- catch( Exception e )
+ catch ( Exception e )
{
- LOG.error( "Failed to delete the replica base as part of handling E_SYNC_REFRESH_REQUIRED, disconnecting the consumer", e );
+ LOG
+ .error(
+ "Failed to delete the replica base as part of handling E_SYNC_REFRESH_REQUIRED, disconnecting the consumer",
+ e );
disconnet();
}
Modified: directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Sat Aug 14 00:22:38 2010
@@ -63,7 +63,6 @@ import netscape.ldap.LDAPResponseListene
import netscape.ldap.LDAPSearchConstraints;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.constants.ServerDNConstants;
@@ -87,6 +86,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Test;
@@ -269,7 +269,7 @@ public class AddIT extends AbstractLdapT
con.add( kate );
// Analyze entry and description attribute
- Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
+ Entry kateReloaded = ( ( InternalSearchResultEntry ) con.lookup( dn ) ).getEntry();
assertNotNull( kateReloaded );
EntryAttribute attr = kateReloaded.get( "description" );
assertNotNull( attr );
@@ -309,7 +309,7 @@ public class AddIT extends AbstractLdapT
con.add( kate );
// Analyze entry and description attribute
- Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
+ Entry kateReloaded = ( ( InternalSearchResultEntry ) con.lookup( dn ) ).getEntry();
assertNotNull( kateReloaded );
EntryAttribute attr = kateReloaded.get( "description" );
assertNotNull( attr );
@@ -350,7 +350,7 @@ public class AddIT extends AbstractLdapT
con.add( kate );
// Analyze entry and description attribute
- Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
+ Entry kateReloaded = ( ( InternalSearchResultEntry ) con.lookup( dn ) ).getEntry();
assertNotNull( kateReloaded );
EntryAttribute attr = kateReloaded.get( "description" );
assertNotNull( attr );
@@ -1205,7 +1205,7 @@ public class AddIT extends AbstractLdapT
con.add( entry );
// Analyze entry and description attribute
- SearchResultEntry resp = ( SearchResultEntry ) con.lookup( dn, "*", "+" );
+ InternalSearchResultEntry resp = ( InternalSearchResultEntry ) con.lookup( dn, "*", "+" );
Entry addedEntry = resp.getEntry();
assertNotNull( addedEntry );