Author: elecharny
Date: Mon Jan 2 13:21:20 2012
New Revision: 1226411
URL: http://svn.apache.org/viewvc?rev=1226411&view=rev
Log:
Fixed some more NPE in perf tests
Modified:
directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/list/ListPerfIT.java
Modified: directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java?rev=1226411&r1=1226410&r2=1226411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
Mon Jan 2 13:21:20 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.operations.hasEntry;
+
import static org.junit.Assert.assertTrue;
import org.apache.directory.server.core.api.OperationEnum;
@@ -35,7 +36,7 @@ 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 hasEntryPerfIT extends AbstractLdapTestUnit
{
/**
@@ -45,7 +46,8 @@ public class hasEntryPerfIT extends Abst
public void testPerfHasEntry() throws Exception
{
Dn adminDn = new Dn( "uid=admin, ou=system" );
- HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( getService().getAdminSession(),
adminDn );
+ HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( getService().getAdminSession(),
+ adminDn );
hasEntryContext.setInterceptors( getService().getInterceptors( OperationEnum.HAS_ENTRY
) );
boolean hasEntry = getService().getOperationManager().hasEntry( hasEntryContext );
@@ -55,7 +57,7 @@ public class hasEntryPerfIT extends Abst
long t0 = System.currentTimeMillis();
long t00 = 0L;
long tt0 = System.currentTimeMillis();
-
+
for ( int i = 0; i < nbIterations; i++ )
{
if ( i % 1000 == 0 )
@@ -71,12 +73,14 @@ public class hasEntryPerfIT extends Abst
t00 = System.currentTimeMillis();
}
+ hasEntryContext.setCurrentInterceptor( 0 );
hasEntry = getService().getOperationManager().hasEntry( hasEntryContext );
}
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta hasEntry: " + deltaWarmed + "( " + ( ( ( nbIterations
- 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta hasEntry: " + deltaWarmed + "( "
+ + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1
- t0 ) );
}
}
Modified: directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/list/ListPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/list/ListPerfIT.java?rev=1226411&r1=1226410&r2=1226411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/list/ListPerfIT.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/operations/list/ListPerfIT.java
Mon Jan 2 13:21:20 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.operations.list;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -38,7 +39,7 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
public class ListPerfIT extends AbstractLdapTestUnit
{
/**
@@ -47,30 +48,31 @@ public class ListPerfIT extends Abstract
@Test
public void testPerfList() throws Exception
{
- ListOperationContext listContext = new ListOperationContext( getService().getAdminSession(),
new Dn( "ou=system" ) );
+ ListOperationContext listContext = new ListOperationContext( getService().getAdminSession(),
new Dn(
+ "ou=system" ) );
EntryFilteringCursor cursor = getService().getOperationManager().list( listContext
);
assertNotNull( cursor );
int nb = 0;
-
+
while ( cursor.next() )
{
Entry entry = cursor.get();
nb++;
-
+
assertNotNull( entry );
}
-
+
cursor.close();
-
+
assertEquals( 5, nb );
-
+
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 )
@@ -87,24 +89,26 @@ public class ListPerfIT extends Abstract
}
nb = 0;
+ listContext.setCurrentInterceptor( 0 );
cursor = getService().getOperationManager().list( listContext );
while ( cursor.next() )
{
Entry entry = cursor.get();
nb++;
-
+
assertNotNull( entry );
}
-
+
cursor.close();
-
+
assertEquals( 5, nb );
}
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
- System.out.println( "Delta list: " + deltaWarmed + "( " + ( ( ( nbIterations - 50000
) * 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+ System.out.println( "Delta list: " + deltaWarmed + "( " + ( ( ( nbIterations - 50000
) * 1000 ) / deltaWarmed )
+ + " per s ) /" + ( t1 - t0 ) );
}
}
|