You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/08/14 02:22:40 UTC
svn commit: r985411 [5/11] - in /directory:
apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/
apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/admin/
apacheds...
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java Sat Aug 14 00:22:38 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;
@@ -47,6 +44,9 @@ 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.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.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" );
+ InternalSearchResultEntry response = ( InternalSearchResultEntry ) 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 = ( InternalSearchResultEntry ) 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" );
+ InternalSearchResultEntry response = ( InternalSearchResultEntry ) 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<InternalResponse> responses = connection.search( "ou=testing00,ou=system", "(ou=testing00)",
+ SearchScope.SUBTREE, "ou", "createTimestamp", "creatorsName" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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<InternalResponse> responses = connection
+ .search( "ou=system", "(objectClass=*)", SearchScope.OBJECT, "*" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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 = ( InternalSearchResultEntry ) 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" );
+ InternalSearchResultEntry response = ( InternalSearchResultEntry ) 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<InternalResponse> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT,
+ "modifiersName", "modifyTimestamp" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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<InternalResponse> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT,
+ "modifyTimestamp" );
responses.next();
- SearchResultEntry result = (SearchResultEntry)responses.get();
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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 = ( InternalSearchResultEntry ) responses.get();
modifyTimestamp = result.getEntry().get( "modifyTimestamp" );
assertNotNull( modifyTimestamp );
@@ -345,7 +327,7 @@ public class OperationalAttributeService
Modification modifyOp = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
new DefaultEntryAttribute( "creatorsName" ) );
- ModifyResponse response = connection.modify( DN_KATE_BUSH, modifyOp );
+ InternalModifyResponse response = connection.modify( DN_KATE_BUSH, modifyOp );
assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, response.getLdapResult().getResultCode() );
}
@@ -362,7 +344,7 @@ public class OperationalAttributeService
Modification modifyOp = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultEntryAttribute( "creatorsName", "cn=Tori Amos,dc=example,dc=com" ) );
- ModifyResponse response = connection.modify( DN_KATE_BUSH, modifyOp );
+ InternalModifyResponse response = connection.modify( DN_KATE_BUSH, modifyOp );
assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, response.getLdapResult().getResultCode() );
}
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/bind/SimpleBindIT.java Sat Aug 14 00:22:38 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;
@@ -50,6 +49,7 @@ import org.apache.directory.server.core.
import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalBindResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -373,7 +373,7 @@ public class SimpleBindIT extends Abstra
connection = IntegrationUtils.getConnectionAs( service, "uid=admin,ou=system", "secret" );
- BindResponse bindResp = connection.bind( "uid=admin,ou=system", null );
+ InternalBindResponse bindResp = connection.bind( "uid=admin,ou=system", null );
assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, bindResp.getLdapResult().getResultCode() );
}
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/ComparePerfIT.java Sat Aug 14 00:22:38 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.internal.InternalCompareResponse;
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" );
-
+
+ InternalCompareResponse 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/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Sat Aug 14 00:22:38 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.internal.InternalSearchResultEntry;
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", "*" );
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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", "+" );
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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 );
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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" );
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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" );
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) connection
+ .lookup( "cn=test,ou=system", "name" );
Entry entry = result.getEntry();
assertNotNull( entry );
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java Sat Aug 14 00:22:38 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.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
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", "+" );
+ InternalResponse response = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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 } " + " } " + " } " + " } "
+ + "}" );
+
+ InternalResponse response = connection.lookup( "cn=test,ou=system", "+" );
assertNotNull( response );
- assertTrue( response instanceof SearchResultEntry );
-
- SearchResultEntry result = (SearchResultEntry)response;
+ assertTrue( response instanceof InternalSearchResultEntry );
+
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) 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/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenamePerfIT.java Sat Aug 14 00:22:38 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.internal.InternalResponse;
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() );
-
+
+ InternalResponse oldEntry = connection.lookup( oldDn.getName() );
+ InternalResponse 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/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchBinaryIT.java Sat Aug 14 00:22:38 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.internal.InternalResponse;
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<InternalResponse> 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<InternalResponse> responses = connection.search( "ou=system", "(binaryAttribute=\\01\\02*)",
+ SearchScope.SUBTREE, "*" );
int i = 0;
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java Sat Aug 14 00:22:38 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.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.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 );
@@ -1863,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 = ( ( InternalSearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
+ entry2 = ( ( InternalSearchResultEntry ) connection.lookup( dn2.getName(), "+" ) ).getEntry();
String lowerCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
String higherCsn = entry2.get( SchemaConstants.ENTRY_CSN_AT ).getString();
@@ -1907,11 +1827,11 @@ 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<InternalResponse> cursor = connection.search( "ou=system", filter.toString(), SearchScope.ONELEVEL, "*",
"+" );
while ( cursor.next() )
{
- loadedEntry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+ loadedEntry = ( ( InternalSearchResultEntry ) cursor.get() ).getEntry();
csnSet.add( loadedEntry.get( SchemaConstants.ENTRY_CSN_AT ).getString() );
}
cursor.close();
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java Sat Aug 14 00:22:38 2010
@@ -23,76 +23,79 @@ 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.CreateDS;
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.cursor.Cursor;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
+
/**
* Tests the search() methods of the provider.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS( name="SearchDS" )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "SearchDS")
public class SearchPerfIT extends AbstractLdapTestUnit
{
/**
* A basic search for one single entry
*/
- @Test
- public void testSearchPerf() throws Exception
- {
- LdapConnection connection = IntegrationUtils.getAdminConnection( service );
-
- Cursor<SearchResponse> cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
-
- int i = 0;
-
- while ( cursor.next() )
- {
- SearchResponse response = cursor.get();
- ++i;
- }
-
- cursor.close();
-
- assertEquals( 1, i );
-
- int nbIterations = 1500000;
-
- long t0 = System.currentTimeMillis();
- long t00 = 0L;
- long tt0 = System.currentTimeMillis();
-
- for ( i = 0; i < nbIterations; i++ )
- {
- if ( i % 100000 == 0 )
- {
- long tt1 = System.currentTimeMillis();
-
- System.out.println( i + ", " + ( tt1 - tt0 ) );
- tt0 = tt1;
- }
-
- if ( i == 50000 )
- {
- t00 = System.currentTimeMillis();
- }
-
- cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
- cursor.close();
- }
-
- long t1 = System.currentTimeMillis();
-
- Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
- connection.close();
- }
+ @Test
+ public void testSearchPerf() throws Exception
+ {
+ LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+ Cursor<InternalResponse> cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)",
+ SearchScope.OBJECT, "*" );
+
+ int i = 0;
+
+ while ( cursor.next() )
+ {
+ InternalResponse response = cursor.get();
+ ++i;
+ }
+
+ cursor.close();
+
+ assertEquals( 1, i );
+
+ int nbIterations = 1500000;
+
+ long t0 = System.currentTimeMillis();
+ long t00 = 0L;
+ long tt0 = System.currentTimeMillis();
+
+ for ( i = 0; i < nbIterations; i++ )
+ {
+ if ( i % 100000 == 0 )
+ {
+ long tt1 = System.currentTimeMillis();
+
+ System.out.println( i + ", " + ( tt1 - tt0 ) );
+ tt0 = tt1;
+ }
+
+ if ( i == 50000 )
+ {
+ t00 = System.currentTimeMillis();
+ }
+
+ cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
+ cursor.close();
+ }
+
+ long t1 = System.currentTimeMillis();
+
+ Long deltaWarmed = ( t1 - t00 );
+ System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed )
+ + " per s ) /" + ( t1 - t0 ) );
+ connection.close();
+ }
}