You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/08/23 12:25:26 UTC
svn commit: r988061 - in /directory:
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/
apacheds/trunk/core-integ/src/test/java/org/apache/dire...
Author: kayyagari
Date: Mon Aug 23 10:25:25 2010
New Revision: 988061
URL: http://svn.apache.org/viewvc?rev=988061&view=rev
Log:
o updated lookup() method to return Entry (DIRAPI-8)
o updated tests
Modified:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java Mon Aug 23 10:25:25 2010
@@ -23,6 +23,7 @@ package org.apache.directory.server.core
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -37,9 +38,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.AddResponse;
import org.apache.directory.shared.ldap.message.ModifyDnResponse;
import org.apache.directory.shared.ldap.message.ModifyResponse;
-import org.apache.directory.shared.ldap.message.Response;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -74,13 +73,11 @@ public class AdministrativePointServiceI
private Entry getAdminRole( String dn ) throws Exception
{
- Response lookup = connection.lookup( dn, "administrativeRole" );
+ Entry lookup = connection.lookup( dn, "administrativeRole" );
- assertTrue( lookup instanceof SearchResultEntry );
+ assertNotNull( lookup );
- Entry entry = ( ( SearchResultEntry ) lookup ).getEntry();
-
- return entry;
+ return lookup;
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java Mon Aug 23 10:25:25 2010
@@ -39,7 +39,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.After;
@@ -91,7 +90,7 @@ public class SimpleAuthenticationIT exte
String userDn = "uid=admin,ou=system";
LdapConnection connection = getConnectionAs( service, userDn, "secret" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
performAdminAccountChecks( entry );
assertTrue( ArrayUtils.isEquals( entry.get( "userPassword" ).get().getBytes(), StringTools
.getBytesUtf8( "secret" ) ) );
@@ -101,7 +100,7 @@ public class SimpleAuthenticationIT exte
service.startup();
connection = getConnectionAs( service, userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
performAdminAccountChecks( entry );
assertTrue( ArrayUtils.isEquals( entry.get( "userPassword" ).get().getBytes(), StringTools
.getBytesUtf8( "secret" ) ) );
@@ -116,7 +115,7 @@ public class SimpleAuthenticationIT exte
String userDn = "uid=akarasulu,ou=users,ou=system";
LdapConnection connection = getConnectionAs( service, userDn, "test" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
EntryAttribute ou = entry.get( "ou" );
assertTrue( ou.contains( "Engineering" ) );
assertTrue( ou.contains( "People" ) );
@@ -181,7 +180,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );
EntryAttribute ou = entry.get( "ou" );
assertTrue( ou.contains( "Engineering" ) );
assertTrue( ou.contains( "People" ) );
@@ -217,7 +216,7 @@ public class SimpleAuthenticationIT exte
// close and try again now with new password (should succeed)
connection.bind( userDn, "newpwd" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
ou = entry.get( "ou" );
assertTrue( ou.contains( "Engineering" ) );
assertTrue( ou.contains( "People" ) );
@@ -249,7 +248,7 @@ public class SimpleAuthenticationIT exte
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -268,7 +267,7 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "secret" );
assertTrue( connection.isAuthenticated() );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -277,7 +276,7 @@ public class SimpleAuthenticationIT exte
connection.close();
connection.bind( userDn, "secret" );
assertTrue( connection.isAuthenticated() );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
@@ -291,7 +290,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -309,7 +308,7 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -317,7 +316,7 @@ public class SimpleAuthenticationIT exte
// cache is updated (should be successfull)
connection.close();
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
@@ -331,7 +330,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -349,7 +348,7 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "test123" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -357,7 +356,7 @@ public class SimpleAuthenticationIT exte
// cache is updated (should be successfull)
connection.close();
connection.bind( userDn, "test123" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
@@ -371,7 +370,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -389,7 +388,7 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -398,7 +397,7 @@ public class SimpleAuthenticationIT exte
connection.close();
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
@@ -412,7 +411,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -430,7 +429,7 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -438,7 +437,7 @@ public class SimpleAuthenticationIT exte
// cache is updated (should be successfull)
connection.close();
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
@@ -452,7 +451,7 @@ public class SimpleAuthenticationIT exte
LdapConnection connection = getConnectionAs( service, userDn, "test" );
// Check that we can get the attributes
- Entry entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ Entry entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
@@ -470,14 +469,14 @@ public class SimpleAuthenticationIT exte
// try again now with new password (should be successful)
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
// try again now with new password, to check that the
// cache is updated (should be successfull)
connection.bind( userDn, "secret" );
- entry = ( ( SearchResultEntry ) connection.lookup( userDn ) ).getEntry();
+ entry = connection.lookup( userDn );;
assertNotNull( entry );
assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java Mon Aug 23 10:25:25 2010
@@ -31,7 +31,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.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -65,8 +65,7 @@ public class AdministratorsGroupIT exten
boolean canReadAdministrators( LdapConnection connection ) throws Exception
{
- SearchResultEntry res = ( SearchResultEntry ) connection
- .lookup( "cn=Administrators,ou=groups,ou=system" );
+ Entry res = connection.lookup( "cn=Administrators,ou=groups,ou=system" );
if ( res == null )
{
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java Mon Aug 23 10:25:25 2010
@@ -120,7 +120,7 @@ public class AuthorizationServiceAsAdmin
connection.close();
connection = getConnectionAs( adminDn, newPwd );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( adminDn.getName() ) ).getEntry();
+ Entry entry = connection.lookup( adminDn.getName() );
assertTrue( ArrayUtils.isEquals( StringTools.getBytesUtf8( newPwd ), entry.get( "userPassword" ).get()
.getBytes() ) );
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java Mon Aug 23 10:25:25 2010
@@ -32,7 +32,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.entry.Entry;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -79,7 +78,7 @@ public class AuthzAuthnIT extends Abstra
DN userName = new DN( "uid=billyd,ou=users,ou=system" );
// Authenticate to RootDSE
LdapConnection connection = getConnectionAs( userName, "billyd" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "" ) ).getEntry();
+ Entry entry = connection.lookup( "" );
assertNotNull( entry );
assertEquals( 0, entry.getDn().size() );
}
@@ -98,7 +97,7 @@ public class AuthzAuthnIT extends Abstra
DN userName = new DN( "uid=billyd,ou=users,ou=system" );
LdapConnection connection = getConnectionAs( userName, "billyd" );
- SearchResultEntry entry = ( SearchResultEntry ) connection.lookup( "ou=system" );
+ Entry entry = connection.lookup( "ou=system" );
assertNull( entry );
}
@@ -131,7 +130,7 @@ public class AuthzAuthnIT extends Abstra
DN userName = new DN( "uid=billyd,ou=users,ou=system" );
LdapConnection connection = getConnectionAs( userName, "billyd" );
- SearchResultEntry entry = ( SearchResultEntry ) connection.lookup( "ou=system" );
+ Entry entry = connection.lookup( "ou=system" );
assertNull( entry );
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java Mon Aug 23 10:25:25 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
@@ -236,8 +235,7 @@ public class AutzIntegUtils
{
LdapConnection connection = getAdminConnection();
- Entry systemEntry = ( ( SearchResultEntry ) connection.lookup( ServerDNConstants.SYSTEM_DN, "+", "*" ) )
- .getEntry();
+ Entry systemEntry = connection.lookup( ServerDNConstants.SYSTEM_DN, "+", "*" );
// modify ou=system to be an AP for an A/C AA if it is not already
EntryAttribute administrativeRole = systemEntry.get( "administrativeRole" );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Mon Aug 23 10:25:25 2010
@@ -359,7 +359,7 @@ public class SearchAuthorizationIT exten
assertEquals( 10, counter );
recursivelyDelete( base );
- SearchResultEntry entry = ( SearchResultEntry ) connection.lookup( base.getName() );
+ Entry entry = connection.lookup( base.getName() );
assertNull( entry );
}
@@ -844,7 +844,7 @@ public class SearchAuthorizationIT exten
LdapConnection userCtx = getConnectionAs( "uid=billyd,ou=users,ou=system", "billyd" );
// we should not see ou=groups,ou=system for the remaining name
- SearchResultEntry entry = ( SearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
+ Entry entry = userCtx.lookup( "cn=blah,ou=groups" );
assertNull( entry );
// now delete and replace subentry with one that does not excluse ou=groups,ou=system
@@ -857,7 +857,7 @@ public class SearchAuthorizationIT exten
+ " grantDiscloseOnError " + " } " + " } " + " } " + " } " + "}" );
// now try a lookup of a non-existant entry under ou=groups,ou=system again
- entry = ( SearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
+ entry = userCtx.lookup( "cn=blah,ou=groups" );
assertNull( entry );
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java Mon Aug 23 10:25:25 2010
@@ -40,7 +40,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Test;
@@ -295,7 +294,7 @@ public class DefaultChangeLogIT extends
modReq.add( "description", "a desc value" );
sysRoot.modify( modReq );
- Entry resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ Entry resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
EntryAttribute description = resusitated.get( "description" );
assertNotNull( description );
@@ -303,7 +302,7 @@ public class DefaultChangeLogIT extends
// now revert and assert that the added entry re-appears
service.revert( t0.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
assertNull( resusitated.get( "description" ) );
@@ -316,7 +315,7 @@ public class DefaultChangeLogIT extends
modReq.setName( resusitated.getDn() );
modReq.add( "description", "old value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -329,7 +328,7 @@ public class DefaultChangeLogIT extends
modReq.replace( "description", "new value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -337,7 +336,7 @@ public class DefaultChangeLogIT extends
// now revert and assert the old value is now reverted
service.revert( t1.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -353,14 +352,14 @@ public class DefaultChangeLogIT extends
modReq.remove( "description", "old value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNull( description );
// now revert and assert the old value is now reverted
service.revert( t2.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -375,7 +374,7 @@ public class DefaultChangeLogIT extends
modReq.setName( resusitated.getDn() );
modReq.add( "userPassword", "to be replaced" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertPassword( resusitated, "to be replaced" );
modReq = new ModifyRequestImpl();
@@ -389,7 +388,7 @@ public class DefaultChangeLogIT extends
// now make the modification and check that description is gone,
// seeAlso is added, and that the userPassword has been replaced
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNull( description );
@@ -400,7 +399,7 @@ public class DefaultChangeLogIT extends
// now we revert and make sure the old values are as they were
service.revert( t3.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = sysRoot.lookup( "ou=test5,ou=system" );
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -421,14 +420,14 @@ public class DefaultChangeLogIT extends
private void assertNotPresent( LdapConnection connection, String dn ) throws LdapException
{
- SearchResultEntry se = ( SearchResultEntry ) connection.lookup( dn );
+ Entry se = connection.lookup( dn );
assertNull( se );
}
private void assertPresent( LdapConnection connection, String dn ) throws LdapException
{
- Entry entry = ( ( SearchResultEntry ) connection.lookup( dn ) ).getEntry();
+ Entry entry = connection.lookup( dn );
assertNotNull( entry );
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java Mon Aug 23 10:25:25 2010
@@ -206,8 +206,7 @@ public class CollectiveAttributeServiceI
// test an entry that should show the collective attribute c-ou
// -------------------------------------------------------------------
- Response response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- Entry entry = ( ( SearchResultEntry ) response ).getEntry();
+ Entry entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
assertEquals( "configuration", c_ou.getString() );
@@ -216,8 +215,7 @@ public class CollectiveAttributeServiceI
// test an entry that should not show the collective attribute
// -------------------------------------------------------------------
- response = connection.lookup( "ou=users,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=users,ou=system" );
c_ou = entry.get( "c-ou" );
assertNull( "the c-ou collective attribute should not be present", c_ou );
@@ -229,8 +227,7 @@ public class CollectiveAttributeServiceI
connection.modify( "ou=services,ou=configuration, ou=system", modification );
// entry should not show the c-ou collective attribute anymore
- response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -242,8 +239,7 @@ public class CollectiveAttributeServiceI
Entry subentry2 = getTestSubentry2( "cn=testsubentry2,ou=system" );
connection.add( subentry2 );
- response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -252,8 +248,7 @@ public class CollectiveAttributeServiceI
}
// entries without the collectiveExclusion should still show both values of c-ou
- response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -261,8 +256,7 @@ public class CollectiveAttributeServiceI
assertTrue( c_ou.contains( "configuration2" ) );
// request the collective attribute specifically
- response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "c-ou" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "c-ou" );
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -270,8 +264,7 @@ public class CollectiveAttributeServiceI
assertTrue( c_ou.contains( "configuration2" ) );
// unspecify the collective attribute in the returning attribute list
- response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "objectClass" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "objectClass" );
c_ou = entry.get( "c-ou" );
assertNull( "a collective c-ou attribute should not be present", c_ou );
@@ -282,16 +275,14 @@ public class CollectiveAttributeServiceI
connection.add( getTestSubentry3( "cn=testsubentry3,ou=system" ) );
// the new attribute c-st should appear in the node with the c-ou exclusion
- response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
EntryAttribute c_st = entry.get( "c-st" );
assertNotNull( "a collective c-st attribute should be present", c_st );
assertTrue( c_st.contains( "FL" ) );
// in node without exclusions both values of c-ou should appear with c-st value
- response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -310,8 +301,7 @@ public class CollectiveAttributeServiceI
connection.modify( "ou=interceptors,ou=configuration, ou=system", modification );
// none of the attributes should appear any longer
- response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ( ( SearchResultEntry ) response ).getEntry();
+ entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -521,9 +511,7 @@ public class CollectiveAttributeServiceI
connection.add( subentry );
// request the collective attribute's super type specifically
- Response response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
-
- Entry entry = ( ( SearchResultEntry ) response ).getEntry();
+ Entry entry = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java Mon Aug 23 10:25:25 2010
@@ -191,11 +191,11 @@ public class ExceptionServiceIT extends
LdapConnection connection = getAdminConnection( service );
connection.move( "ou=users,ou=system", "ou=groups,ou=system" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=groups,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "ou=users,ou=groups,ou=system" );
assertNotNull( entry );
- Response res = connection.lookup( "ou=users,ou=system" );
- assertNull( res );
+ entry = connection.lookup( "ou=users,ou=system" );
+ assertNull( entry );
}
@@ -290,7 +290,7 @@ public class ExceptionServiceIT extends
modReq.add( SchemaConstants.OU_AT, "dummyValue" );
connection.modify( modReq );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "ou=users,ou=system" );
EntryAttribute ou = entry.get( "ou" );
assertTrue( ou.contains( "users" ) );
assertTrue( ou.contains( "dummyValue" ) );
@@ -326,7 +326,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "ou=users,ou=system" );
assertNotNull( entry );
assertEquals( "users", entry.get( "ou" ).getString() );
}
@@ -439,7 +439,7 @@ public class ExceptionServiceIT extends
AddResponse resp = createSubContext( "ou", "blah" );
resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=subctx,ou=blah,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "ou=subctx,ou=blah,ou=system" );
assertNotNull( entry );
}
@@ -494,7 +494,7 @@ public class ExceptionServiceIT extends
AddResponse resp = createSubContext( "ou", "blah" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=blah,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "ou=blah,ou=system" );
assertNotNull( entry );
connection.delete( entry.getDn() );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java Mon Aug 23 10:25:25 2010
@@ -97,8 +97,7 @@ public class OperationalAttributeService
connection.add( entry );
// test without turning on the property
- SearchResultEntry response = ( SearchResultEntry ) connection.lookup( "ou=test,ou=system" );
- Entry result = response.getEntry();
+ Entry result = connection.lookup( "ou=test,ou=system" );
EntryAttribute ou = result.get( "ou" );
Object value = ou.getString();
assertTrue( value instanceof String );
@@ -111,11 +110,11 @@ public class OperationalAttributeService
entry.setDn( new DN( "ou=anothertest,ou=system" ) );
entry.set( "ou", "anothertest" );
connection.add( entry );
- response = ( SearchResultEntry ) connection.lookup( "ou=anothertest,ou=system" );
- ou = response.getEntry().get( "ou" );
+ Entry loadedEntry = connection.lookup( "ou=anothertest,ou=system" );
+ ou = loadedEntry.get( "ou" );
value = ou.getString();
assertEquals( "anothertest", value );
- EntryAttribute jpegPhoto = response.getEntry().get( "jpegPhoto" );
+ EntryAttribute jpegPhoto = loadedEntry.get( "jpegPhoto" );
value = jpegPhoto.getBytes();
assertTrue( value instanceof byte[] );
assertEquals( "0xFF 0xD8 0xFF 0xE0 0x01 0x02 0x4A 0x46 0x49 0x46 0x00 0x45 0x23 0x7D 0x7F ", StringTools
@@ -134,10 +133,9 @@ public class OperationalAttributeService
connection.add( entry );
- SearchResultEntry response = ( SearchResultEntry ) connection.lookup( "ou=testing00,ou=system" );
- assertNotNull( response );
+ entry = connection.lookup( "ou=testing00,ou=system" );
+ assertNotNull( entry );
- entry = response.getEntry();
assertNotNull( entry );
assertEquals( "testing00", entry.get( "ou" ).getString() );
EntryAttribute attribute = entry.get( "objectClass" );
@@ -222,9 +220,7 @@ public class OperationalAttributeService
connection.add( entry );
- SearchResultEntry response = ( SearchResultEntry ) connection.lookup(
- "uid=akarasulu,ou=users,ou=system", "creatorsName" );
- Entry result = response.getEntry();
+ Entry result = connection.lookup( "uid=akarasulu,ou=users,ou=system", "creatorsName" );
assertFalse( "uid=akarasulu,ou=users,ou=system".equals( result.get( "creatorsName" ).getString() ) );
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Mon Aug 23 10:25:25 2010
@@ -75,9 +75,7 @@ public class LookupIT extends AbstractLd
@Test
public void testLookupStar() throws Exception
{
- SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system", "*" );
- Entry entry = result.getEntry();
-
+ Entry entry = connection.lookup( "cn=test,ou=system", "*" );
assertNotNull( entry );
// Check that we don't have any operational attributes :
@@ -98,9 +96,7 @@ public class LookupIT extends AbstractLd
public void testLookupPlus() throws Exception
{
service.setDenormalizeOpAttrsEnabled( true );
- SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system", "+" );
- Entry entry = result.getEntry();
-
+ Entry entry = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( entry );
// We should have 5 attributes
@@ -125,10 +121,7 @@ public class LookupIT extends AbstractLd
@Test
public void testLookupEmptyAtrid() throws Exception
{
- SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system",
- ( String[] ) null );
- Entry entry = result.getEntry();
-
+ Entry entry = connection.lookup( "cn=test,ou=system", ( String[] ) null );
assertNotNull( entry );
// We should have 3 attributes
@@ -147,8 +140,7 @@ public class LookupIT extends AbstractLd
@Test
public void testLookup() throws Exception
{
- SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system" );
- Entry entry = result.getEntry();
+ Entry entry = connection.lookup( "cn=test,ou=system" );
assertNotNull( entry );
@@ -169,10 +161,7 @@ public class LookupIT extends AbstractLd
@Ignore
public void testLookupWithAttrs() throws Exception
{
- SearchResultEntry result = ( SearchResultEntry ) connection
- .lookup( "cn=test,ou=system", "name" );
- Entry entry = result.getEntry();
-
+ Entry entry = connection.lookup( "cn=test,ou=system", "name" );
assertNotNull( entry );
// We should have 3 attributes
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java Mon Aug 23 10:25:25 2010
@@ -61,16 +61,7 @@ public class LookupPerfIT extends Abstra
{
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
- Response response = connection.lookup( "cn=test,ou=system", "+" );
-
- assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = ( SearchResultEntry ) response;
-
- assertNotNull( result );
-
- Entry entry = result.getEntry();
+ Entry entry = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( entry );
@@ -131,16 +122,7 @@ public class LookupPerfIT extends Abstra
+ " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ "}" );
- Response response = connection.lookup( "cn=test,ou=system", "+" );
-
- assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = ( SearchResultEntry ) response;
-
- assertNotNull( result );
-
- Entry entry = result.getEntry();
+ Entry entry = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( entry );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java Mon Aug 23 10:25:25 2010
@@ -95,8 +95,8 @@ public class MoveAndRenamePerfIT extends
connection.moveAndRename( oldDn, newDn );
- Response oldEntry = connection.lookup( oldDn.getName() );
- Response newEntry = connection.lookup( newDn.getName() );
+ Entry oldEntry = connection.lookup( oldDn.getName() );
+ Entry newEntry = connection.lookup( newDn.getName() );
assertNull( oldEntry );
assertNotNull( newEntry );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java Mon Aug 23 10:25:25 2010
@@ -1783,8 +1783,8 @@ public class SearchIT extends AbstractLd
connection.add( entry2 );
- entry = ( ( SearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
- entry2 = ( ( SearchResultEntry ) connection.lookup( dn2.getName(), "+" ) ).getEntry();
+ entry = connection.lookup( dn.getName(), "+" );
+ entry2 = connection.lookup( dn2.getName(), "+" );
String lowerCsn = entry.get( "entryCsn" ).getString();
String higherCsn = entry2.get( "entryCsn" ).getString();
Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Mon Aug 23 10:25:25 2010
@@ -35,6 +35,7 @@ import org.apache.directory.ldap.client.
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -42,6 +43,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.StringValue;
import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.BindResponse;
@@ -136,27 +138,34 @@ public class LdapConnectionTest extends
}
+ @ApplyLdifs({
+ "dn: uid=kayyagari,ou=system",
+ "objectClass: extensibleObject",
+ "objectClass: uidObject",
+ "objectClass: referral",
+ "objectClass: top",
+ "uid: kayyagari",
+ "ref: ldap://ad.example.com/uid=kayyagari,ou=system"
+ })
@Test
public void testLookup() throws Exception
{
- Response resp = connection.lookup( ADMIN_DN );
- assertNotNull( resp );
-
- Entry entry = ( ( SearchResultEntry ) resp ).getEntry();
+ Entry entry = connection.lookup( ADMIN_DN );
assertNull( entry.get( SchemaConstants.ENTRY_UUID_AT ) );
// perform lookup with operational attributes
- resp = connection.lookup( ADMIN_DN, "+", "*" );
- entry = ( ( SearchResultEntry ) resp ).getEntry();
+ entry = connection.lookup( ADMIN_DN, "+", "*" );
assertNotNull( entry.get( SchemaConstants.ENTRY_UUID_AT ) );
+
+ entry = connection.lookup( "uid=kayyagari,ou=system" );
+ assertNull( entry );
}
@Test
public void searchByEntryUuid() throws Exception
{
- Response resp = connection.lookup( ADMIN_DN, "+" );
- Entry entry = ( ( SearchResultEntry ) resp ).getEntry();
+ Entry entry = connection.lookup( ADMIN_DN, "+" );
String uuid = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
@@ -175,12 +184,12 @@ public class LdapConnectionTest extends
@Test
public void testRetrieveBinaryAttibute() throws Exception
{
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "uid=admin,ou=system" ) ).getEntry();
+ Entry entry = connection.lookup( "uid=admin,ou=system" );
assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isBinary() );
connection.loadSchema();
- entry = ( ( SearchResultEntry ) connection.lookup( "uid=admin,ou=system" ) ).getEntry();
+ entry = connection.lookup( "uid=admin,ou=system" );
assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isBinary() );
}
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Mon Aug 23 10:25:25 2010
@@ -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 = con.lookup( dn );
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 = con.lookup( dn );
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 = con.lookup( dn );
assertNotNull( kateReloaded );
EntryAttribute attr = kateReloaded.get( "description" );
assertNotNull( attr );
@@ -1205,8 +1205,7 @@ public class AddIT extends AbstractLdapT
con.add( entry );
// Analyze entry and description attribute
- SearchResultEntry resp = ( SearchResultEntry ) con.lookup( dn, "*", "+" );
- Entry addedEntry = resp.getEntry();
+ Entry addedEntry = con.lookup( dn, "*", "+" );
assertNotNull( addedEntry );
EntryAttribute attr = addedEntry.get( SchemaConstants.ENTRY_UUID_AT );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java Mon Aug 23 10:25:25 2010
@@ -68,17 +68,9 @@ public class LookupPerfIT extends Abstra
{
LdapConnection connection = getClientApiConnection( ldapServer );
- Response response = connection.lookup( "uid=admin,ou=system" );;
- assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = ( SearchResultEntry ) response;
-
- assertNotNull( result );
-
- Entry entry = result.getEntry();
-
+ Entry entry = connection.lookup( "uid=admin,ou=system" );;
assertNotNull( entry );
+ assertTrue( entry instanceof SearchResultEntry );
long t0 = System.currentTimeMillis();
@@ -86,7 +78,7 @@ public class LookupPerfIT extends Abstra
{
for ( int j = 0; j < 10000; j++ )
{
- response = connection.lookup( "uid=admin,ou=system", "+" );
+ entry = connection.lookup( "uid=admin,ou=system", "+" );
}
System.out.print( "." );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java Mon Aug 23 10:25:25 2010
@@ -93,7 +93,7 @@ public class IllegalModificationIT exten
assertEquals( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, resp.getLdapResult().getResultCode() );
// Check whether entry is unmodified, i.e. no description
- Entry entry = ( ( SearchResultEntry ) con.lookup( DN ) ).getEntry();
+ Entry entry = con.lookup( DN );
assertEquals( "description exists?", null, entry.get( "description" ) );
}
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java Mon Aug 23 10:25:25 2010
@@ -531,13 +531,13 @@ public interface LdapConnection
/**
* @see #lookup(DN, String...)
*/
- public abstract Response lookup( DN dn ) throws LdapException;
+ public abstract Entry lookup( DN dn ) throws LdapException;
/**
* @see #lookup(String, String...)
*/
- public abstract Response lookup( String dn ) throws LdapException;
+ public abstract Entry lookup( String dn ) throws LdapException;
/**
@@ -546,20 +546,15 @@ public interface LdapConnection
* @param dn the DN of the entry to be fetched
* @param attributes the attributes to be returned along with entry
* @return the Entry with the given DN or null if no entry exists with that DN
- * @throws LdapException in case of any problems while searching for the DN
+ * @throws LdapException in case of any problems while searching for the DN or if the returned response contains a referral
*/
- public abstract Response lookup( DN dn, String... attributes ) throws LdapException;
+ public abstract Entry lookup( DN dn, String... attributes ) throws LdapException;
/**
- * searches for an entry having the given DN
- *
- * @param dn the DN of the entry to be fetched
- * @param attributes the attributes to be returned along with entry
- * @return the Entry with the given DN or null if no entry exists with that DN
- * @throws LdapException in case of any problems while searching for the DN
+ * @see #lookup(DN, String...)
*/
- public abstract Response lookup( String dn, String... attributes ) throws LdapException;
+ public abstract Entry lookup( String dn, String... attributes ) throws LdapException;
/**
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=988061&r1=988060&r2=988061&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java Mon Aug 23 10:25:25 2010
@@ -66,6 +66,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AbandonRequest;
import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
@@ -2713,7 +2714,7 @@ public class LdapNetworkConnection exten
/**
* {@inheritDoc}
*/
- public Response lookup( DN dn ) throws LdapException
+ public Entry lookup( DN dn ) throws LdapException
{
return lookup( dn, SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
}
@@ -2722,7 +2723,7 @@ public class LdapNetworkConnection exten
/**
* {@inheritDoc}
*/
- public Response lookup( String dn ) throws LdapException
+ public Entry lookup( String dn ) throws LdapException
{
return lookup( dn, SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
}
@@ -2731,9 +2732,9 @@ public class LdapNetworkConnection exten
/**
* {@inheritDoc}
*/
- public Response lookup( DN dn, String... attributes ) throws LdapException
+ public Entry lookup( DN dn, String... attributes ) throws LdapException
{
- Response resp = null;
+ Entry entry = null;
try
{
@@ -2742,7 +2743,8 @@ public class LdapNetworkConnection exten
// Read the response
if ( cursor.next() )
{
- resp = cursor.get();
+ // cursor will always hold SearchResultEntry objects cause there is no ManageDsaITControl passed with search request
+ entry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
}
// Pass through the SaerchResultDone, or stop
@@ -2757,14 +2759,14 @@ public class LdapNetworkConnection exten
throw new LdapException( e );
}
- return resp;
+ return entry;
}
/**
* {@inheritDoc}
*/
- public Response lookup( String dn, String... attributes ) throws LdapException
+ public Entry lookup( String dn, String... attributes ) throws LdapException
{
return lookup( new DN( dn ), attributes );
}