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/20 21:32:02 UTC
svn commit: r987611 [5/13] - in /directory/apacheds/trunk: ./ all/
core-annotations/ core-api/
core-api/src/main/java/org/apache/directory/server/core/
core-api/src/main/java/org/apache/directory/server/core/event/
core-api/src/main/java/org/apache/dir...
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -29,10 +29,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -47,7 +43,11 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.ldif.LdapLdifException;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.AddResponse;
+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.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -60,34 +60,26 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
public class CollectiveAttributeServiceIT extends AbstractLdapTestUnit
{
private static LdapConnection connection;
+
private Entry getTestEntry( String dn, String cn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: person",
- "cn", cn ,
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: person", "cn", cn,
"sn: testentry" );
return subentry;
}
- private Entry getTestSubentry( String dn ) throws LdapLdifException, LdapException
+ private Entry getTestSubentry( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-ou: configuration",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-ou: configuration",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry" );
return subentry;
}
@@ -95,14 +87,9 @@ public class CollectiveAttributeServiceI
private Entry getTestSubentry2( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-ou: configuration2",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry2" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-ou: configuration2",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry2" );
return subentry;
}
@@ -110,14 +97,9 @@ public class CollectiveAttributeServiceI
private Entry getTestSubentry3( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-st: FL",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry3" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-st: FL",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry3" );
return subentry;
}
@@ -135,16 +117,16 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+", "*" );
+ Cursor<Response> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+",
+ "*" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ Response result = cursor.get();
if ( result instanceof SearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( SearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -157,16 +139,15 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );
+ Cursor<Response> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ Response result = cursor.get();
if ( result instanceof SearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( SearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -179,16 +160,16 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "c-ou", "c-st" );
+ Cursor<Response> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE,
+ "c-ou", "c-st" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ Response result = cursor.get();
if ( result instanceof SearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( SearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -225,8 +206,8 @@ public class CollectiveAttributeServiceI
// test an entry that should show the collective attribute c-ou
// -------------------------------------------------------------------
- SearchResponse response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- Entry entry = ((SearchResultEntry)response).getEntry();
+ Response response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+ Entry entry = ( ( SearchResultEntry ) response ).getEntry();
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
assertEquals( "configuration", c_ou.getString() );
@@ -236,7 +217,7 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
response = connection.lookup( "ou=users,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNull( "the c-ou collective attribute should not be present", c_ou );
@@ -249,7 +230,7 @@ public class CollectiveAttributeServiceI
// entry should not show the c-ou collective attribute anymore
response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -262,7 +243,7 @@ public class CollectiveAttributeServiceI
connection.add( subentry2 );
response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -272,7 +253,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 = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -281,7 +262,7 @@ public class CollectiveAttributeServiceI
// request the collective attribute specifically
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "c-ou" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -290,7 +271,7 @@ public class CollectiveAttributeServiceI
// unspecify the collective attribute in the returning attribute list
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "objectClass" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNull( "a collective c-ou attribute should not be present", c_ou );
@@ -302,7 +283,7 @@ public class CollectiveAttributeServiceI
// 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 = ( ( SearchResultEntry ) response ).getEntry();
EntryAttribute c_st = entry.get( "c-st" );
assertNotNull( "a collective c-st attribute should be present", c_st );
@@ -310,7 +291,7 @@ public class CollectiveAttributeServiceI
// 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 = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -324,13 +305,13 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// now modify an entry to exclude all collective attributes
// -------------------------------------------------------------------
- modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
- new DefaultEntryAttribute( "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
- connection.modify( "ou=interceptors,ou=configuration, ou=system" , modification );
+ modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
+ "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
+ 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 = ( ( SearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -368,12 +349,12 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// Test searching for subtypes
// -------------------------------------------------------------------
- Cursor<SearchResponse> responses = connection.search( "ou=services,ou=configuration,ou=system", "(ObjectClass=*)",
- SearchScope.OBJECT, "ou" );
+ Cursor<Response> responses = connection.search( "ou=services,ou=configuration,ou=system",
+ "(ObjectClass=*)", SearchScope.OBJECT, "ou" );
while ( responses.next() )
{
- SearchResultEntry resultEntry = (SearchResultEntry)responses.get();
+ SearchResultEntry resultEntry = ( SearchResultEntry ) responses.get();
entry = resultEntry.getEntry();
assertEquals( 2, entry.size() );
@@ -463,8 +444,8 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// now modify an entry to exclude all collective attributes
// -------------------------------------------------------------------
- modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
- new DefaultEntryAttribute( "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
+ modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
+ "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
connection.modify( "ou=interceptors,ou=configuration, ou=system", modification );
entries = getAllEntries();
@@ -522,9 +503,8 @@ public class CollectiveAttributeServiceI
Entry entry = getTestEntry( "cn=Ersin Er,ou=system", "Ersin Er" );
connection.add( entry );
- ModifyResponse response = connection.modify( "cn=Ersin Er,ou=system",
- new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
- new DefaultEntryAttribute( "c-l", "Turkiye" ) ) );
+ ModifyResponse response = connection.modify( "cn=Ersin Er,ou=system", new DefaultModification(
+ ModificationOperation.ADD_ATTRIBUTE, new DefaultEntryAttribute( "c-l", "Turkiye" ) ) );
assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, response.getLdapResult().getResultCode() );
}
@@ -541,9 +521,9 @@ public class CollectiveAttributeServiceI
connection.add( subentry );
// request the collective attribute's super type specifically
- SearchResponse response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
+ Response response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
- Entry entry = ((SearchResultEntry)response).getEntry();
+ Entry entry = ( ( SearchResultEntry ) response ).getEntry();
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
Propchange: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 20 19:31:58 2010
@@ -1,5 +1,7 @@
+/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:982369-987590
/directory/apacheds/branches/apacheds-dnfactory-experiment/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:980138-980934
/directory/apacheds/branches/apacheds-replication/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:749790-764110
/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:806623-896441
/directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:965202-966561
+/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:599654-600228
/directory/apacheds/branches/xdbm-refactoring/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:945827-946347
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -28,13 +28,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.DeleteResponse;
-import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
-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.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -46,7 +39,15 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.AddResponse;
+import org.apache.directory.shared.ldap.message.DeleteResponse;
+import org.apache.directory.shared.ldap.message.ModifyDnResponse;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
+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.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.junit.After;
@@ -59,16 +60,16 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS( name="ExceptionServiceIT-DS" )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "ExceptionServiceIT-DS")
public class ExceptionServiceIT extends AbstractLdapTestUnit
{
-
+
private AddResponse createSubContext( String type, String value ) throws Exception
{
return createSubContext( new DN( ServerDNConstants.SYSTEM_DN ), type, value );
}
-
+
private AddResponse createSubContext( DN parent, String type, String value ) throws Exception
{
@@ -79,9 +80,9 @@ public class ExceptionServiceIT extends
entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalPerson" );
entry.add( SchemaConstants.CN_AT, value );
entry.add( SchemaConstants.SN_AT, value );
-
+
AddResponse resp = getAdminConnection( service ).add( entry );
-
+
return resp;
}
@@ -97,7 +98,6 @@ public class ExceptionServiceIT extends
// Search Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test search operation failure when the search base is non-existant.
*
@@ -106,7 +106,8 @@ public class ExceptionServiceIT extends
@Test
public void testFailSearchNoSuchObject() throws Exception
{
- Cursor<SearchResponse> cursor = getAdminConnection( service ).search( "ou=blah", "(objectClass=*)", SearchScope.ONELEVEL, "*" );
+ Cursor<Response> cursor = getAdminConnection( service ).search( "ou=blah", "(objectClass=*)",
+ SearchScope.ONELEVEL, "*" );
assertFalse( cursor.next() );
}
@@ -120,7 +121,8 @@ public class ExceptionServiceIT extends
@Test
public void testSearchControl() throws Exception
{
- Cursor<SearchResponse> cursor = getAdminConnection( service ).search( "ou=users,ou=system", "(objectClass=*)", SearchScope.ONELEVEL, "*" );
+ Cursor<Response> cursor = getAdminConnection( service ).search( "ou=users,ou=system", "(objectClass=*)",
+ SearchScope.ONELEVEL, "*" );
assertFalse( cursor.next() );
}
@@ -143,7 +145,7 @@ public class ExceptionServiceIT extends
Entry entry = new DefaultEntry( new DN( "ou=users,ou=groups,ou=system" ) );
entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
entry.add( SchemaConstants.OU_AT, "users" );
-
+
connection.add( entry );
ModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
@@ -151,9 +153,9 @@ public class ExceptionServiceIT extends
Entry userzEntry = new DefaultEntry( new DN( "ou=userz,ou=groups,ou=system" ) );
userzEntry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
userzEntry.add( SchemaConstants.OU_AT, "userz" );
-
+
connection.add( userzEntry );
-
+
ModifyDnResponse modResp = connection.rename( "ou=userz,ou=groups,ou=system", "ou=users", true );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, modResp.getLdapResult().getResultCode() );
}
@@ -192,7 +194,7 @@ public class ExceptionServiceIT extends
Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=groups,ou=system" ) ).getEntry();
assertNotNull( entry );
- SearchResponse res = connection.lookup( "ou=users,ou=system" );
+ Response res = connection.lookup( "ou=users,ou=system" );
assertNull( res );
}
@@ -201,7 +203,6 @@ public class ExceptionServiceIT extends
// ModifyRdn Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test modifyRdn operation failure when the object renamed is non-existant.
*
@@ -254,7 +255,6 @@ public class ExceptionServiceIT extends
// Modify Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test modify operation failure when the object modified is non-existant.
*
@@ -265,9 +265,10 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- ModifyRequest modReq = new ModifyRequest( new DN( "ou=blah,ou=system" ) );
+ ModifyRequest modReq = new ModifyRequestImpl();
+ modReq.setName( new DN( "ou=blah,ou=system" ) );
modReq.add( SchemaConstants.OU_AT, "another-value" );
-
+
ModifyResponse modResp = connection.modify( modReq );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, modResp.getLdapResult().getResultCode() );
}
@@ -284,9 +285,10 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- ModifyRequest modReq = new ModifyRequest( new DN( "ou=users,ou=system" ) );
+ ModifyRequest modReq = new ModifyRequestImpl();
+ modReq.setName( new DN( "ou=users,ou=system" ) );
modReq.add( SchemaConstants.OU_AT, "dummyValue" );
-
+
connection.modify( modReq );
Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
EntryAttribute ou = entry.get( "ou" );
@@ -299,7 +301,6 @@ public class ExceptionServiceIT extends
// Lookup Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test lookup operation failure when the object looked up is non-existant.
*
@@ -335,7 +336,6 @@ public class ExceptionServiceIT extends
// List Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test list operation failure when the base searched is non-existant.
*
@@ -386,7 +386,6 @@ public class ExceptionServiceIT extends
// Add Operation Tests
// ------------------------------------------------------------------------
-
/**
* Tests for add operation failure when the parent of the entry to add does
* not exist.
@@ -421,9 +420,9 @@ public class ExceptionServiceIT extends
@Test
public void testFailAddEntryAlreadyExists() throws Exception
{
- createSubContext( "ou", "blah");
+ createSubContext( "ou", "blah" );
- AddResponse resp = createSubContext( "ou", "blah");
+ AddResponse resp = createSubContext( "ou", "blah" );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
}
@@ -438,8 +437,8 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- AddResponse resp = createSubContext( "ou", "blah");
- resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx");
+ 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();
assertNotNull( entry );
}
@@ -449,7 +448,6 @@ public class ExceptionServiceIT extends
// Delete Operation Tests
// ------------------------------------------------------------------------
-
/**
* Tests for delete failure when the entry to be deleted has child entires.
*
@@ -461,7 +459,7 @@ public class ExceptionServiceIT extends
LdapConnection connection = getAdminConnection( service );
AddResponse resp = createSubContext( "ou", "blah" );
- resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
+ resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
DeleteResponse delResp = connection.delete( "ou=blah,ou=system" );
assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, delResp.getLdapResult().getResultCode() );
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -29,9 +29,6 @@ import static org.junit.Assert.assertTru
import javax.naming.NamingException;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -46,7 +43,10 @@ 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.ldif.LdifUtils;
+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.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.After;
@@ -61,22 +61,17 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
@CreateDS(name = "OperationalDS")
@ApplyLdifs(
- {
- "dn: cn=Kate Bush,ou=system",
- "objectClass: top",
- "objectClass: person",
- "cn: Bush",
- "sn: Kate Bush"
- })
+ { "dn: cn=Kate Bush,ou=system", "objectClass: top", "objectClass: person", "cn: Bush", "sn: Kate Bush" })
public class OperationalAttributeServiceIT extends AbstractLdapTestUnit
{
private static final String DN_KATE_BUSH = "cn=Kate Bush,ou=system";
private LdapConnection connection;
+
@Before
public void setup() throws Exception
{
@@ -94,20 +89,15 @@ public class OperationalAttributeService
@Test
public void testBinaryAttributeFilterExtension() throws Exception
{
- Entry entry = LdifUtils.createEntry(
- new DN( "ou=test,ou=system" ),
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "ou", "test",
- "cn", "test",
- "sn", "test" );
+ Entry entry = LdifUtils
+ .createEntry( new DN( "ou=test,ou=system" ), "objectClass: top", "objectClass: person",
+ "objectClass: organizationalPerson", "objectClass: inetOrgPerson", "ou", "test", "cn", "test", "sn",
+ "test" );
- connection.add(entry );
+ connection.add( entry );
// test without turning on the property
- SearchResultEntry response = (SearchResultEntry)connection.lookup( "ou=test,ou=system" );
+ SearchResultEntry response = ( SearchResultEntry ) connection.lookup( "ou=test,ou=system" );
Entry result = response.getEntry();
EntryAttribute ou = result.get( "ou" );
Object value = ou.getString();
@@ -115,19 +105,21 @@ public class OperationalAttributeService
// try jpegPhoto which should be binary automatically - use ou as control
byte[] keyValue = new byte[]
- { (byte)0xFF, (byte)0xD8, (byte)0xFF, (byte)0xE0, 0x01, 0x02, 'J', 'F', 'I', 'F', 0x00, 0x45, 0x23, 0x7d, 0x7f };
+ { ( byte ) 0xFF, ( byte ) 0xD8, ( byte ) 0xFF, ( byte ) 0xE0, 0x01, 0x02, 'J', 'F', 'I', 'F', 0x00, 0x45,
+ 0x23, 0x7d, 0x7f };
entry.put( "jpegPhoto", keyValue );
entry.setDn( new DN( "ou=anothertest,ou=system" ) );
entry.set( "ou", "anothertest" );
connection.add( entry );
- response = (SearchResultEntry)connection.lookup( "ou=anothertest,ou=system" );
+ response = ( SearchResultEntry ) connection.lookup( "ou=anothertest,ou=system" );
ou = response.getEntry().get( "ou" );
value = ou.getString();
assertEquals( "anothertest", value );
EntryAttribute jpegPhoto = response.getEntry().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.dumpBytes( ( byte[] ) value ) );
+ assertEquals( "0xFF 0xD8 0xFF 0xE0 0x01 0x02 0x4A 0x46 0x49 0x46 0x00 0x45 0x23 0x7D 0x7F ", StringTools
+ .dumpBytes( ( byte[] ) value ) );
}
@@ -137,15 +129,12 @@ public class OperationalAttributeService
/*
* create ou=testing00,ou=system
*/
- Entry entry = LdifUtils.createEntry(
- new DN( "ou=testing00,ou=system" ),
- "objectClass: top",
- "objectClass: organizationalUnit",
- "ou", "testing00" );
+ Entry entry = LdifUtils.createEntry( new DN( "ou=testing00,ou=system" ), "objectClass: top",
+ "objectClass: organizationalUnit", "ou", "testing00" );
- connection.add(entry );
+ connection.add( entry );
- SearchResultEntry response = (SearchResultEntry)connection.lookup( "ou=testing00,ou=system" );
+ SearchResultEntry response = ( SearchResultEntry ) connection.lookup( "ou=testing00,ou=system" );
assertNotNull( response );
entry = response.getEntry();
@@ -158,9 +147,10 @@ public class OperationalAttributeService
assertNull( entry.get( "createTimestamp" ) );
assertNull( entry.get( "creatorsName" ) );
- Cursor<SearchResponse> responses = connection.search( "ou=testing00,ou=system", "(ou=testing00)", SearchScope.SUBTREE, "ou", "createTimestamp", "creatorsName" );
+ Cursor<Response> responses = connection.search( "ou=testing00,ou=system", "(ou=testing00)",
+ SearchScope.SUBTREE, "ou", "createTimestamp", "creatorsName" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ SearchResultEntry result = ( SearchResultEntry ) responses.get();
assertNotNull( result.getEntry().get( "ou" ) );
assertNotNull( result.getEntry().get( "creatorsName" ) );
@@ -183,9 +173,10 @@ public class OperationalAttributeService
@Test
public void testSystemContextRoot() throws Exception
{
- Cursor<SearchResponse> responses = connection.search( "ou=system", "(objectClass=*)", SearchScope.OBJECT, "*" );
+ Cursor<Response> responses = connection
+ .search( "ou=system", "(objectClass=*)", SearchScope.OBJECT, "*" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ SearchResultEntry result = ( SearchResultEntry ) responses.get();
// test to make sure op attribute do not occur - this is the control
Entry entry = result.getEntry();
@@ -193,9 +184,10 @@ public class OperationalAttributeService
assertNull( entry.get( "createTimestamp" ) );
// now we ask for all the op attributes and check to get them
- responses = connection.search( "ou=system", "(objectClass=*)", SearchScope.OBJECT, "creatorsName", "createTimestamp" );
+ responses = connection.search( "ou=system", "(objectClass=*)", SearchScope.OBJECT, "creatorsName",
+ "createTimestamp" );
responses.next();
- result = (SearchResultEntry)responses.get();
+ result = ( SearchResultEntry ) responses.get();
entry = result.getEntry();
assertNotNull( entry.get( "creatorsName" ) );
@@ -222,28 +214,16 @@ public class OperationalAttributeService
@Test
public void testConfirmNonAdminUserDnIsCreatorsName() throws Exception
{
- Entry entry = LdifUtils.createEntry(
- new DN( "uid=akarasulu,ou=users,ou=system" ),
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "ou: Engineering",
- "ou: People",
- "uid: akarasulu",
- "l", "Bogusville",
- "cn: Alex Karasulu",
- "sn: Karasulu",
- "givenName",
- "mail: akarasulu@apache.org",
- "telephoneNumber: +1 408 555 4798",
- "facsimileTelephoneNumber: +1 408 555 9751",
- "roomnumber: 4612",
- "userPassword: test" );
+ Entry entry = LdifUtils.createEntry( new DN( "uid=akarasulu,ou=users,ou=system" ), "objectClass: top",
+ "objectClass: person", "objectClass: organizationalPerson", "objectClass: inetOrgPerson",
+ "ou: Engineering", "ou: People", "uid: akarasulu", "l", "Bogusville", "cn: Alex Karasulu", "sn: Karasulu",
+ "givenName", "mail: akarasulu@apache.org", "telephoneNumber: +1 408 555 4798",
+ "facsimileTelephoneNumber: +1 408 555 9751", "roomnumber: 4612", "userPassword: test" );
- connection.add(entry );
+ connection.add( entry );
- SearchResultEntry response = (SearchResultEntry)connection.lookup( "uid=akarasulu,ou=users,ou=system", "creatorsName" );
+ SearchResultEntry response = ( SearchResultEntry ) connection.lookup(
+ "uid=akarasulu,ou=users,ou=system", "creatorsName" );
Entry result = response.getEntry();
assertFalse( "uid=akarasulu,ou=users,ou=system".equals( result.get( "creatorsName" ).getString() ) );
@@ -263,9 +243,10 @@ public class OperationalAttributeService
connection.modify( DN_KATE_BUSH, modifyOp );
- Cursor<SearchResponse> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT, "modifiersName", "modifyTimestamp" );
+ Cursor<Response> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT,
+ "modifiersName", "modifyTimestamp" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ SearchResultEntry result = ( SearchResultEntry ) responses.get();
assertNotNull( result.getEntry().get( "modifiersName" ) );
assertNotNull( result.getEntry().get( "modifyTimestamp" ) );
@@ -288,9 +269,10 @@ public class OperationalAttributeService
connection.modify( DN_KATE_BUSH, modifyAddOp );
// Determine modifyTimestamp
- Cursor<SearchResponse> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT, "modifyTimestamp" );
+ Cursor<Response> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT,
+ "modifyTimestamp" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ SearchResultEntry result = ( SearchResultEntry ) responses.get();
EntryAttribute modifyTimestamp = result.getEntry().get( "modifyTimestamp" );
assertNotNull( modifyTimestamp );
@@ -308,7 +290,7 @@ public class OperationalAttributeService
// Determine modifyTimestamp after modification
responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT, "modifyTimestamp" );
responses.next();
- result = (SearchResultEntry)responses.get();
+ result = ( SearchResultEntry ) responses.get();
modifyTimestamp = result.getEntry().get( "modifyTimestamp" );
assertNotNull( modifyTimestamp );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java Fri Aug 20 19:31:58 2010
@@ -41,7 +41,6 @@ import javax.naming.directory.SearchCont
import javax.naming.directory.SearchResult;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.BindResponse;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -49,6 +48,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.jndi.CoreContextFactory;
import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.BindResponse;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.junit.Test;
import org.junit.runner.RunWith;
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java Fri Aug 20 19:31:58 2010
@@ -19,8 +19,8 @@
*/
package org.apache.directory.server.core.operations.compare;
+
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.CompareResponse;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreateIndex;
@@ -30,6 +30,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.entry.DefaultEntry;
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.message.CompareResponse;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,29 +41,14 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS(
- name="ComparePerfDS",
- 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", cacheSize = 1000 ),
- @CreateIndex( attribute = "sn", cacheSize = 1000 ),
- @CreateIndex( attribute = "cn", cacheSize = 1000 )
- } )
-
- },
- enableChangeLog = false )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "ComparePerfDS", 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", cacheSize = 1000), @CreateIndex(attribute = "sn", cacheSize = 1000),
+ @CreateIndex(attribute = "cn", cacheSize = 1000) })
+
+ }, enableChangeLog = false)
public class ComparePerfIT extends AbstractLdapTestUnit
{
/**
@@ -72,20 +58,20 @@ public class ComparePerfIT extends Abstr
public void testComparePerf() throws Exception
{
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
-
+
DN dn = new DN( "cn=test,dc=example,dc=com" );
Entry entry = new DefaultEntry( service.getSchemaManager(), dn );
entry.add( "ObjectClass", "top", "person" );
entry.add( "sn", "TEST" );
entry.add( "cn", "test" );
-
- connection.add(entry );
+
+ connection.add( entry );
int nbIterations = 150000;
-
+
long t0 = System.currentTimeMillis();
long t00 = 0L;
long tt0 = System.currentTimeMillis();
-
+
for ( int i = 0; i < nbIterations; i++ )
{
if ( i % 1000 == 0 )
@@ -100,16 +86,17 @@ public class ComparePerfIT extends Abstr
{
t00 = System.currentTimeMillis();
}
-
+
CompareResponse response = connection.compare( dn, "sn", "TEST" );
-
+
//assertEquals( ResultCodeEnum.COMPARE_TRUE, response.getLdapResult().getResultCode() );
}
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta compare: " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta compare: " + deltaWarmed + "( "
+ + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
connection.close();
}
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -19,18 +19,19 @@
*/
package org.apache.directory.server.core.operations.lookup;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
@@ -43,19 +44,17 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@ApplyLdifs( {
+@RunWith(FrameworkRunner.class)
+@ApplyLdifs(
+ {
// Entry # 1
- "dn: cn=test,ou=system",
- "objectClass: person",
- "cn: test",
- "sn: sn_test"
-})
+ "dn: cn=test,ou=system", "objectClass: person", "cn: test", "sn: sn_test" })
public class LookupIT extends AbstractLdapTestUnit
{
/** The ldap connection */
private LdapConnection connection;
+
@Before
public void setup() throws Exception
{
@@ -76,7 +75,7 @@ public class LookupIT extends AbstractLd
@Test
public void testLookupStar() throws Exception
{
- SearchResultEntry result = (SearchResultEntry)connection.lookup( "cn=test,ou=system", "*" );
+ SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system", "*" );
Entry entry = result.getEntry();
assertNotNull( entry );
@@ -99,7 +98,7 @@ public class LookupIT extends AbstractLd
public void testLookupPlus() throws Exception
{
service.setDenormalizeOpAttrsEnabled( true );
- SearchResultEntry result = (SearchResultEntry)connection.lookup( "cn=test,ou=system", "+" );
+ SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system", "+" );
Entry entry = result.getEntry();
assertNotNull( entry );
@@ -126,7 +125,8 @@ public class LookupIT extends AbstractLd
@Test
public void testLookupEmptyAtrid() throws Exception
{
- SearchResultEntry result = (SearchResultEntry)connection.lookup( "cn=test,ou=system", (String[])null );
+ SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system",
+ ( String[] ) null );
Entry entry = result.getEntry();
assertNotNull( entry );
@@ -147,7 +147,7 @@ public class LookupIT extends AbstractLd
@Test
public void testLookup() throws Exception
{
- SearchResultEntry result = (SearchResultEntry)connection.lookup( "cn=test,ou=system" );
+ SearchResultEntry result = ( SearchResultEntry ) connection.lookup( "cn=test,ou=system" );
Entry entry = result.getEntry();
assertNotNull( entry );
@@ -169,7 +169,8 @@ public class LookupIT extends AbstractLd
@Ignore
public void testLookupWithAttrs() throws Exception
{
- SearchResultEntry result = (SearchResultEntry)connection.lookup( "cn=test,ou=system", "name" );
+ SearchResultEntry result = ( SearchResultEntry ) connection
+ .lookup( "cn=test,ou=system", "name" );
Entry entry = result.getEntry();
assertNotNull( entry );
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -19,19 +19,20 @@
*/
package org.apache.directory.server.core.operations.lookup;
+
import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
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.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.authz.AutzIntegUtils;
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.entry.Entry;
+import org.apache.directory.shared.ldap.message.Response;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.Before;
import org.junit.Ignore;
@@ -44,14 +45,11 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@ApplyLdifs( {
+@RunWith(FrameworkRunner.class)
+@ApplyLdifs(
+ {
// Entry # 1
- "dn: cn=test,ou=system",
- "objectClass: person",
- "cn: test",
- "sn: sn_test"
-})
+ "dn: cn=test,ou=system", "objectClass: person", "cn: test", "sn: sn_test" })
public class LookupPerfIT extends AbstractLdapTestUnit
{
/**
@@ -63,17 +61,17 @@ public class LookupPerfIT extends Abstra
{
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
- SearchResponse response = connection.lookup( "cn=test,ou=system", "+" );
+ Response response = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( response );
assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = (SearchResultEntry)response;
+
+ SearchResultEntry result = ( SearchResultEntry ) response;
assertNotNull( result );
-
+
Entry entry = result.getEntry();
-
+
assertNotNull( entry );
int nbIterations = 150000;
@@ -99,11 +97,12 @@ public class LookupPerfIT extends Abstra
connection.lookup( "cn=test,ou=system", "+" );
}
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed )
+ + " per s ) /" + ( t1 - t0 ) );
connection.close();
}
@@ -114,7 +113,7 @@ public class LookupPerfIT extends Abstra
AutzIntegUtils.service = service;
}
-
+
/**
* Test a lookup( DN ) operation with the ACI subsystem enabled
*/
@@ -124,37 +123,25 @@ public class LookupPerfIT extends Abstra
service.setAccessControlEnabled( true );
DN dn = new DN( "cn=test,ou=system" );
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
-
- createAccessControlSubentry(
- "anybodySearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
-
- SearchResponse response = connection.lookup( "cn=test,ou=system", "+" );
+
+ createAccessControlSubentry( "anybodySearch", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
+
+ Response response = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( response );
assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = (SearchResultEntry)response;
+
+ SearchResultEntry result = ( SearchResultEntry ) response;
assertNotNull( result );
-
+
Entry entry = result.getEntry();
-
+
assertNotNull( entry );
int nbIterations = 1500000;
@@ -180,13 +167,14 @@ public class LookupPerfIT extends Abstra
connection.lookup( "cn=test,ou=system", "+" );
}
-
+
assertNotNull( entry );
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta Authz : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta Authz : " + deltaWarmed + "( "
+ + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
connection.close();
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyPerfIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyPerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyPerfIT.java Fri Aug 20 19:31:58 2010
@@ -21,7 +21,6 @@ package org.apache.directory.server.core
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.ModifyRequest;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreateIndex;
@@ -36,6 +35,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -94,7 +95,8 @@ public class ModifyPerfIT extends Abstra
t00 = System.currentTimeMillis();
}
- ModifyRequest modRequest = new ModifyRequest( dn );
+ ModifyRequest modRequest = new ModifyRequestImpl();
+ modRequest.setName( dn );
Modification modification = new DefaultModification();
EntryAttribute attribute = new DefaultEntryAttribute( "sn" );
@@ -113,7 +115,8 @@ public class ModifyPerfIT extends Abstra
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 5000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 5000 ) * 1000 ) / deltaWarmed )
+ + " per s ) /" + ( t1 - t0 ) );
connection.close();
}
}
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -19,11 +19,11 @@
*/
package org.apache.directory.server.core.operations.moveAndRename;
+
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreateIndex;
@@ -33,6 +33,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.entry.DefaultEntry;
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.message.Response;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,27 +46,11 @@ import org.junit.runner.RunWith;
* @version $Rev$
*/
@RunWith(FrameworkRunner.class)
-@CreateDS(name = "MovePerfDS",
- 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", cacheSize = 1000),
- @CreateIndex(attribute = "sn", cacheSize = 1000),
- @CreateIndex(attribute = "cn", cacheSize = 1000)
- })
- },
- enableChangeLog = false)
+@CreateDS(name = "MovePerfDS", 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", cacheSize = 1000), @CreateIndex(attribute = "sn", cacheSize = 1000),
+ @CreateIndex(attribute = "cn", cacheSize = 1000) }) }, enableChangeLog = false)
public class MoveAndRenamePerfIT extends AbstractLdapTestUnit
{
/**
@@ -90,7 +75,7 @@ public class MoveAndRenamePerfIT extends
long t0 = System.currentTimeMillis();
long t00 = 0L;
long tt0 = System.currentTimeMillis();
-
+
for ( int i = 0; i < nbIterations; i++ )
{
if ( i % 100 == 0 )
@@ -107,12 +92,12 @@ public class MoveAndRenamePerfIT extends
}
long ttt0 = System.nanoTime();
-
+
connection.moveAndRename( oldDn, newDn );
-
- SearchResponse oldEntry = connection.lookup( oldDn.getName() );
- SearchResponse newEntry = connection.lookup( newDn.getName() );
-
+
+ Response oldEntry = connection.lookup( oldDn.getName() );
+ Response newEntry = connection.lookup( newDn.getName() );
+
assertNull( oldEntry );
assertNotNull( newEntry );
long ttt1 = System.nanoTime();
@@ -121,14 +106,15 @@ public class MoveAndRenamePerfIT extends
DN tmpDn = newDn;
newDn = oldDn;
oldDn = tmpDn;
-
+
//System.out.println("added " + i + ", delta = " + (ttt1-ttt0)/1000);
}
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 15000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 15000 ) * 1000 ) / deltaWarmed )
+ + " per s ) /" + ( t1 - t0 ) );
connection.close();
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java Fri Aug 20 19:31:58 2010
@@ -23,7 +23,6 @@ package org.apache.directory.server.core
import static org.junit.Assert.assertEquals;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
@@ -34,6 +33,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.Response;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -44,88 +44,30 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS(
- name="AddPerfDS",
- 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", cacheSize = 1000 ),
- @CreateIndex( attribute = "sn", cacheSize = 1000 ),
- @CreateIndex(attribute = "cn", cacheSize = 1000),
- @CreateIndex( attribute = "userCertificate", cacheSize = 1000 )
- } )
-
- },
- enableChangeLog = false )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "AddPerfDS", 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", cacheSize = 1000), @CreateIndex(attribute = "sn", cacheSize = 1000),
+ @CreateIndex(attribute = "cn", cacheSize = 1000),
+ @CreateIndex(attribute = "userCertificate", cacheSize = 1000) })
+
+ }, enableChangeLog = false)
@ApplyLdifs(
- {
- "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
- "objectclass: metaAttributeType",
- "objectclass: metaTop",
- "objectclass: top",
- "m-oid: 2.2.0",
- "m-name: binaryAttribute",
- "m-description: an attribute storing binary values",
- "m-equality: octetStringMatch",
- "m-ordering: octetStringOrderingMatch",
- "m-substr: octetStringSubstringsMatch",
- "m-syntax: 1.3.6.1.4.1.1466.115.121.1.40",
- "m-length: 0",
- "",
- "dn: ou=testingBin,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testingBin",
- "binaryAttribute:: AQIDBA==",
- "",
- "dn: cn=testing00,ou=system",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "cn: testing00",
- "sn: Testing 0",
- "userCertificate:: AQIDBA==",
- "",
- "dn: cn=testing01,ou=system",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "cn: testing01",
- "sn: Testing 1",
- "",
- "dn: cn=testing02,ou=system",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "cn: testing02",
- "sn: Testing 2",
- "userCertificate:: CQoLD==",
- "",
- "dn: cn=testing03,ou=system",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "cn: testing03",
- "sn: Testing 3",
- "userCertificate:: AQIDBA=="
- }
- )
+ { "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema", "objectclass: metaAttributeType",
+ "objectclass: metaTop", "objectclass: top", "m-oid: 2.2.0", "m-name: binaryAttribute",
+ "m-description: an attribute storing binary values", "m-equality: octetStringMatch",
+ "m-ordering: octetStringOrderingMatch", "m-substr: octetStringSubstringsMatch",
+ "m-syntax: 1.3.6.1.4.1.1466.115.121.1.40", "m-length: 0", "", "dn: ou=testingBin,ou=system",
+ "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testingBin",
+ "binaryAttribute:: AQIDBA==", "", "dn: cn=testing00,ou=system", "objectClass: top", "objectClass: person",
+ "objectClass: organizationalPerson", "objectClass: inetOrgPerson", "cn: testing00", "sn: Testing 0",
+ "userCertificate:: AQIDBA==", "", "dn: cn=testing01,ou=system", "objectClass: top", "objectClass: person",
+ "objectClass: organizationalPerson", "objectClass: inetOrgPerson", "cn: testing01", "sn: Testing 1", "",
+ "dn: cn=testing02,ou=system", "objectClass: top", "objectClass: person", "objectClass: organizationalPerson",
+ "objectClass: inetOrgPerson", "cn: testing02", "sn: Testing 2", "userCertificate:: CQoLD==", "",
+ "dn: cn=testing03,ou=system", "objectClass: top", "objectClass: person", "objectClass: organizationalPerson",
+ "objectClass: inetOrgPerson", "cn: testing03", "sn: Testing 3", "userCertificate:: AQIDBA==" })
public class SearchBinaryIT extends AbstractLdapTestUnit
{
/**
@@ -137,8 +79,8 @@ public class SearchBinaryIT extends Abst
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
// Do a search with a filter based on certificate, get back all the entries
- Cursor<SearchResponse> responses = connection.search( "ou=system", "(userCertificate=*)", SearchScope.SUBTREE,
- "*" );
+ Cursor<Response> responses = connection.search( "ou=system", "(userCertificate=*)",
+ SearchScope.SUBTREE, "*" );
int i = 0;
@@ -154,8 +96,7 @@ public class SearchBinaryIT extends Abst
assertEquals( 4, i );
// Now, filter the entry with a cn starting with testing, and a certificate
- responses = connection.search( "ou=system", "(&(cn=testing*)(userCertificate=*))",
- SearchScope.SUBTREE, "*" );
+ responses = connection.search( "ou=system", "(&(cn=testing*)(userCertificate=*))", SearchScope.SUBTREE, "*" );
i = 0;
@@ -202,17 +143,20 @@ public class SearchBinaryIT extends Abst
connection.close();
}
+
/**
* Test search on a binary attribute
*/
@Test
- @Ignore // This test fails atm. Cf DIRSERVER-1389
+ @Ignore
+ // This test fails atm. Cf DIRSERVER-1389
public void testSearchSubstrOnBinaryAttribute() throws Exception
{
LdapConnection connection = IntegrationUtils.getAdminConnection( service );
// Check that searching for an entry using a valid SUBSTR filter works
- Cursor<SearchResponse> responses = connection.search( "ou=system", "(binaryAttribute=\\01\\02*)", SearchScope.SUBTREE, "*" );
+ Cursor<Response> responses = connection.search( "ou=system", "(binaryAttribute=\\01\\02*)",
+ SearchScope.SUBTREE, "*" );
int i = 0;
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=987611&r1=987610&r2=987611&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 Fri Aug 20 19:31:58 2010
@@ -47,8 +47,6 @@ import javax.naming.directory.SearchResu
import javax.naming.ldap.LdapContext;
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.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -68,6 +66,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.Response;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.junit.Before;
@@ -83,83 +83,25 @@ import org.junit.runner.RunWith;
@RunWith(FrameworkRunner.class)
@CreateDS(name = "SearchDS")
@ApplyLdifs(
- {
- "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
- "objectclass: metaAttributeType",
- "objectclass: metaTop",
- "objectclass: top",
- "m-oid: 2.2.0",
- "m-name: integerAttribute",
- "m-description: the precursor for all integer attributes",
- "m-equality: integerMatch",
- "m-ordering: integerOrderingMatch",
- "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
- "m-length: 0",
- "",
- "dn: ou=testing00,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing00",
- "integerAttribute: 0",
- "",
- "dn: ou=testing01,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing01",
- "integerAttribute: 1",
- "",
- "dn: ou=testing02,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing02",
- "integerAttribute: 2",
- "",
- "dn: ou=testing03,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing03",
- "integerAttribute: 3",
- "",
- "dn: ou=testing04,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing04",
- "integerAttribute: 4",
- "",
- "dn: ou=testing05,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "objectClass: extensibleObject",
- "ou: testing05",
- "integerAttribute: 5",
- "",
- "dn: ou=subtest,ou=testing01,ou=system",
- "objectClass: top",
- "objectClass: organizationalUnit",
- "ou: subtest",
- "",
- "dn: cn=Heather Nova, ou=system",
- "objectClass: top",
- "objectClass: person",
- "cn: Heather Nova",
- "sn: Nova",
- "telephoneNumber: 1 801 555 1212 ",
- "",
- "dn: cn=with-dn, ou=system",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetorgPerson",
- "cn: singer",
- "sn: manager",
- "telephoneNumber: 1 801 555 1212 ",
- "manager: cn=Heather Nova, ou=system"
- })
+ { "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema", "objectclass: metaAttributeType",
+ "objectclass: metaTop", "objectclass: top", "m-oid: 2.2.0", "m-name: integerAttribute",
+ "m-description: the precursor for all integer attributes", "m-equality: integerMatch",
+ "m-ordering: integerOrderingMatch", "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27", "m-length: 0", "",
+ "dn: ou=testing00,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+ "objectClass: extensibleObject", "ou: testing00", "integerAttribute: 0", "", "dn: ou=testing01,ou=system",
+ "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing01",
+ "integerAttribute: 1", "", "dn: ou=testing02,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+ "objectClass: extensibleObject", "ou: testing02", "integerAttribute: 2", "", "dn: ou=testing03,ou=system",
+ "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing03",
+ "integerAttribute: 3", "", "dn: ou=testing04,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+ "objectClass: extensibleObject", "ou: testing04", "integerAttribute: 4", "", "dn: ou=testing05,ou=system",
+ "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing05",
+ "integerAttribute: 5", "", "dn: ou=subtest,ou=testing01,ou=system", "objectClass: top",
+ "objectClass: organizationalUnit", "ou: subtest", "", "dn: cn=Heather Nova, ou=system", "objectClass: top",
+ "objectClass: person", "cn: Heather Nova", "sn: Nova", "telephoneNumber: 1 801 555 1212 ", "",
+ "dn: cn=with-dn, ou=system", "objectClass: top", "objectClass: person", "objectClass: organizationalPerson",
+ "objectClass: inetorgPerson", "cn: singer", "sn: manager", "telephoneNumber: 1 801 555 1212 ",
+ "manager: cn=Heather Nova, ou=system" })
public class SearchIT extends AbstractLdapTestUnit
{
private static final String RDN = "cn=Heather Nova";
@@ -280,10 +222,7 @@ public class SearchIT extends AbstractLd
*/
private static DirContext addNisPosixGroup( String name, int gid ) throws Exception
{
- Attributes attrs = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: posixGroup",
- "cn", name,
+ Attributes attrs = LdifUtils.createAttributes( "objectClass: top", "objectClass: posixGroup", "cn", name,
"gidNumber", String.valueOf( gid ) );
return getSystemContext( service ).createSubcontext( "cn=" + name + ",ou=groups", attrs );
@@ -680,12 +619,8 @@ public class SearchIT extends AbstractLd
*/
protected Attributes getPersonAttributes( String sn, String cn ) throws LdapException
{
- Attributes attributes = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: top",
- "objectClass: person",
- "cn", cn,
- "sn", sn );
+ Attributes attributes = LdifUtils.createAttributes( "objectClass: top", "objectClass: top",
+ "objectClass: person", "cn", cn, "sn", sn );
return attributes;
}
@@ -1277,12 +1212,8 @@ public class SearchIT extends AbstractLd
public void testSearchWithEscapedCharsInFilter() throws Exception
{
// Create entry cn=Sid Vicious, ou=system
- Attributes vicious = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: person",
- "cn: Sid Vicious",
- "sn: Vicious",
- "description: (sex*pis\\tols)" );
+ Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn: Sid Vicious",
+ "sn: Vicious", "description: (sex*pis\\tols)" );
DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
assertNotNull( ctx );
@@ -1327,12 +1258,8 @@ public class SearchIT extends AbstractLd
public void testSubstringSearchWithEscapedCharsInFilter() throws Exception
{
// Create entry cn=Sid Vicious, ou=system
- Attributes vicious = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: person",
- "cn: Sid Vicious",
- "sn: Vicious",
- "description: (sex*pis\\tols)" );
+ Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn: Sid Vicious",
+ "sn: Vicious", "description: (sex*pis\\tols)" );
DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
assertNotNull( ctx );
@@ -1379,12 +1306,8 @@ public class SearchIT extends AbstractLd
@Test
public void testSubstringSearchWithEscapedAsterisksInFilter_DIRSERVER_1181() throws Exception
{
- Attributes vicious = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: person",
- "cn: x*y*z*",
- "sn: x*y*z*",
- "description: (sex*pis\\tols)" );
+ Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn: x*y*z*",
+ "sn: x*y*z*", "description: (sex*pis\\tols)" );
sysRoot.createSubcontext( "cn=x*y*z*", vicious );
@@ -1605,11 +1528,8 @@ public class SearchIT extends AbstractLd
.getJndiValue() );
// Create an entry which does not match
- Attributes attrs = LdifUtils.createAttributes(
- "objectClass: top",
- "objectClass: groupOfUniqueNames",
- "cn: testGroup3",
- "uniqueMember: uid=admin,ou=system" );
+ Attributes attrs = LdifUtils.createAttributes( "objectClass: top", "objectClass: groupOfUniqueNames",
+ "cn: testGroup3", "uniqueMember: uid=admin,ou=system" );
getSystemContext( service ).createSubcontext( "cn=testGroup3,ou=groups", attrs );
@@ -1848,26 +1768,26 @@ public class SearchIT extends AbstractLd
DN dn = new DN( "cn=testLowerCsnAdd,ou=system" );
Entry entry = new DefaultEntry( dn );
- entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
- entry.add( SchemaConstants.CN_AT, "testLowerCsnAdd_cn" );
- entry.add( SchemaConstants.SN_AT, "testLowerCsnAdd_sn" );
+ entry.add( "objectClass", SchemaConstants.PERSON_OC );
+ entry.add( "cn", "testLowerCsnAdd_cn" );
+ entry.add( "sn", "testLowerCsnAdd_sn" );
connection.add( entry );
// add an entry to have a entry with higher CSN value
DN dn2 = new DN( "cn=testHigherCsnAdd,ou=system" );
Entry entry2 = new DefaultEntry( dn2 );
- entry2.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
- entry2.add( SchemaConstants.CN_AT, "testHigherCsnAdd_cn" );
- entry2.add( SchemaConstants.SN_AT, "testHigherCsnAdd_sn" );
+ entry2.add( "objectClass", SchemaConstants.PERSON_OC );
+ entry2.add( "cn", "testHigherCsnAdd_cn" );
+ entry2.add( "sn", "testHigherCsnAdd_sn" );
connection.add( entry2 );
entry = ( ( SearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
entry2 = ( ( SearchResultEntry ) connection.lookup( dn2.getName(), "+" ) ).getEntry();
- String lowerCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
- String higherCsn = entry2.get( SchemaConstants.ENTRY_CSN_AT ).getString();
+ String lowerCsn = entry.get( "entryCsn" ).getString();
+ String higherCsn = entry2.get( "entryCsn" ).getString();
// usecases
// 1.1 Less than or Equal ( with the lower csn value)
@@ -1907,8 +1827,7 @@ public class SearchIT extends AbstractLd
Entry loadedEntry = null;
Set<String> csnSet = new HashSet<String>( expectedCsns.length );
- Cursor<SearchResponse> cursor = connection.search( "ou=system", filter.toString(), SearchScope.ONELEVEL, "*",
- "+" );
+ Cursor<Response> cursor = connection.search( "ou=system", filter.toString(), SearchScope.ONELEVEL, "*", "+" );
while ( cursor.next() )
{
loadedEntry = ( ( SearchResultEntry ) cursor.get() ).getEntry();