Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D03B9DBB for ; Wed, 11 Apr 2012 12:52:23 +0000 (UTC) Received: (qmail 27372 invoked by uid 500); 11 Apr 2012 12:52:23 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 27278 invoked by uid 500); 11 Apr 2012 12:52:22 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 27254 invoked by uid 99); 11 Apr 2012 12:52:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2012 12:52:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2012 12:52:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7B9BA238897A for ; Wed, 11 Apr 2012 12:51:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1324744 [2/5] - in /directory/apacheds/trunk: ./ all/ apache-felix/ core-annotations/ core-api/ core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/filtering/ core-api/sr... Date: Wed, 11 Apr 2012 12:51:51 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120411125157.7B9BA238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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=1324744&r1=1324743&r2=1324744&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 Wed Apr 11 12:51:45 2012 @@ -303,6 +303,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 9, map.size() ); assertTrue( map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( map.containsKey( "ou=testing01,ou=system" ) ); @@ -328,6 +330,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect", 14, map.size() ); assertTrue( map.containsKey( "ou=system" ) ); assertTrue( map.containsKey( "ou=testing00,ou=system" ) ); @@ -358,6 +362,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect", 1, map.size() ); assertTrue( map.containsKey( "ou=testing02,ou=system" ) ); Attributes attrs = map.get( "ou=testing02,ou=system" ); @@ -383,6 +389,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + // 16 because it also matches organizationalPerson which the admin is assertEquals( "Expected number of results returned was incorrect", 17, map.size() ); assertTrue( map.containsKey( "ou=system" ) ); @@ -415,25 +423,37 @@ public class SearchIT extends AbstractLd NamingEnumeration e = sysRoot.search( "", "(bogusAttribute=abc123)", cons ); assertNotNull( e ); + e.close(); + e = sysRoot.search( "", "(!(bogusAttribute=abc123))", cons ); assertNotNull( e ); assertFalse( e.hasMore() ); + e.close(); + e = sysRoot.search( "", "(|(bogusAttribute=abc123)(bogusAttribute=abc123))", cons ); assertNotNull( e ); assertFalse( e.hasMore() ); + e.close(); + e = sysRoot.search( "", "(|(bogusAttribute=abc123)(ou=abc123))", cons ); assertNotNull( e ); assertFalse( e.hasMore() ); + e.close(); + e = sysRoot.search( "", "(OBJECTclass=*)", cons ); assertNotNull( e ); assertTrue( e.hasMore() ); + e.close(); + e = sysRoot.search( "", "(objectclass=*)", cons ); assertNotNull( e ); + e.close(); + getService().setAllowAnonymousAccess( oldSetAllowAnnonymousAccess ); } @@ -457,6 +477,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 2, map.size() ); assertTrue( map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( map.containsKey( "ou=testing01,ou=system" ) ); @@ -480,6 +502,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); map.put( result.getName(), result.getAttributes() ); } + + list.close(); assertEquals( "size of results", 1, map.size() ); assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); @@ -504,6 +528,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "size of results", 23, map.size() ); assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); @@ -543,6 +569,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "size of results", 2, map.size() ); assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); @@ -567,6 +595,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "size of results", 6, map.size() ); assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); @@ -600,6 +630,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "size of results", 6, map.size() ); assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); @@ -630,6 +662,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); assertTrue( map.containsKey( "ou=testing00,ou=system" ) ); Attributes attrs = map.get( "ou=testing00,ou=system" ); @@ -659,6 +693,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); assertTrue( map.containsKey( "ou=testing00,ou=system" ) ); Attributes attrs = map.get( "ou=testing00,ou=system" ); @@ -705,6 +741,9 @@ public class SearchIT extends AbstractLd SearchResult sr = enm.next(); assertNotNull( sr ); assertFalse( enm.hasMore() ); + + enm.close(); + assertEquals( "cn=Kate Bush,ou=system", sr.getName() ); enm = sysRoot.search( "", "(userCertificate=\\34\\56\\4E\\5F)", controls ); @@ -713,6 +752,8 @@ public class SearchIT extends AbstractLd assertNotNull( sr ); assertFalse( enm.hasMore() ); assertEquals( "cn=Kate Bush,ou=system", sr.getName() ); + + enm.close(); } @@ -736,6 +777,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -767,6 +810,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -798,6 +843,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -829,6 +876,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -860,6 +909,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -891,6 +942,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -1067,6 +1120,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); results.add( result.getName() ); } + + list.close(); return results; } @@ -1106,6 +1161,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); results.add( result.getName() ); } + + list.close(); return results; } @@ -1135,6 +1192,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); results.add( result.getName() ); } + + list.close(); return results; } @@ -1301,6 +1360,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "cn=Sid Vicious,ou=system" ); @@ -1338,6 +1399,7 @@ public class SearchIT extends AbstractLd String[] filters = new String[] { "(description=*\\28*)", "(description=*\\29*)", "(description=*\\2A*)", "(description=*\\5C*)" }; + for ( String filter : filters ) { HashMap map = new HashMap(); @@ -1349,6 +1411,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "cn=Sid Vicious,ou=system" ); @@ -1378,11 +1442,15 @@ public class SearchIT extends AbstractLd assertEquals( "x*y*z*", res.next().getAttributes().get( "cn" ).get() ); assertFalse( res.hasMore() ); + res.close(); + res = sysRoot.search( "", "(cn=*{0}*)", new String[] { "x*y*z*" }, controls ); assertTrue( res.hasMore() ); assertEquals( "x*y*z*", res.next().getAttributes().get( "cn" ).get() ); assertFalse( res.hasMore() ); + + res.close(); } @@ -1545,6 +1613,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 2, map.size() ); assertTrue( map.containsKey( "cn=Heather Nova, ou=system" ) || map.containsKey( "cn=Heather Nova,ou=system" ) ); } @@ -1569,6 +1639,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect", 1, map.size() ); assertTrue( map.containsKey( "cn=with-dn, ou=system" ) || map.containsKey( "cn=with-dn,ou=system" ) ); } @@ -1598,6 +1670,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); map.put( result.getName(), result.getAttributes() ); } + + list.close(); assertEquals( "size of results", 5, map.size() ); assertTrue( map.containsKey( "cn=testGroup0,ou=groups,ou=system" ) ); @@ -1634,6 +1708,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -1667,6 +1743,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -1702,6 +1780,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); Attributes attrs = map.get( "ou=testing01,ou=system" ); @@ -1735,6 +1815,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( 2, map.size() ); assertTrue( map.containsKey( "ou=system" ) ); @@ -1760,6 +1842,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertTrue( map.size() > 2 ); assertTrue( map.containsKey( "ou=system" ) ); @@ -1785,6 +1869,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( 0, map.size() ); assertFalse( map.containsKey( "ou=system" ) ); @@ -1810,6 +1896,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( 0, map.size() ); assertFalse( map.containsKey( "ou=system" ) ); @@ -1832,10 +1920,10 @@ public class SearchIT extends AbstractLd // 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( "objectClass", SchemaConstants.PERSON_OC ); - entry2.add( "cn", "testHigherCsnAdd_cn" ); - entry2.add( "sn", "testHigherCsnAdd_sn" ); + Entry entry2 = new DefaultEntry( dn2, + "objectClass :person", + "cn: testHigherCsnAdd_cn", + "sn: testHigherCsnAdd_sn" ); connection.add( entry2 ); @@ -1920,6 +2008,8 @@ public class SearchIT extends AbstractLd SearchResult result = list.next(); map.put( result.getName(), result.getAttributes() ); } + + list.close(); assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); assertTrue( map.containsKey( "ou=testing01,ou=system" ) ); @@ -1944,6 +2034,8 @@ public class SearchIT extends AbstractLd map.put( result.getName(), result.getAttributes() ); } + list.close(); + assertEquals( "Expected number of results returned was incorrect!", 0, map.size() ); } } Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesIT.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesIT.java (original) +++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesIT.java Wed Apr 11 12:51:45 2012 @@ -136,6 +136,8 @@ public class SearchWithIndicesIT extends { results.add( cursor.get().getDn().getName() ); } + + cursor.close(); return results; } @@ -248,6 +250,8 @@ public class SearchWithIndicesIT extends assertEquals( "ou=testPresence,ou=system", cursor.get().getDn().toString() ); } + cursor.close(); + // Modify the entry to remove the description connection.modify( "ou=testPresence,ou=system", new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "description" ) ); @@ -259,5 +263,7 @@ public class SearchWithIndicesIT extends { fail( "The search should not return any entry" ); } + + cursor.close(); } } Propchange: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:r1304337-1324714 Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java (original) +++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java Wed Apr 11 12:51:45 2012 @@ -244,6 +244,8 @@ public class SchemaServiceIT extends Abs persons.put( result.getName(), result.getAttributes() ); } + results.close(); + // admin is extra assertEquals( 4, persons.size() ); @@ -288,6 +290,8 @@ public class SchemaServiceIT extends Abs orgPersons.put( result.getName(), result.getAttributes() ); } + results.close(); + // admin is extra assertEquals( 3, orgPersons.size() ); @@ -325,6 +329,8 @@ public class SchemaServiceIT extends Abs inetOrgPersons.put( result.getName(), result.getAttributes() ); } + results.close(); + // admin is extra assertEquals( 2, inetOrgPersons.size() ); @@ -355,6 +361,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -392,6 +400,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -422,6 +432,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -474,6 +486,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -520,6 +534,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have no entry in the result assertEquals( 0, subSchemaEntry.size() ); } @@ -543,6 +559,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -597,6 +615,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have only one entry in the result assertEquals( 1, subSchemaEntry.size() ); @@ -648,6 +668,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have no entry in the result assertEquals( 0, subSchemaEntry.size() ); } @@ -671,6 +693,8 @@ public class SchemaServiceIT extends Abs subSchemaEntry.put( result.getName(), result.getAttributes() ); } + results.close(); + // We should have no entry in the result assertEquals( 0, subSchemaEntry.size() ); } @@ -696,6 +720,8 @@ public class SchemaServiceIT extends Abs persons.put( result.getName(), result.getAttributes() ); } + results.close(); + // admin is extra assertEquals( 1, persons.size() ); @@ -740,6 +766,8 @@ public class SchemaServiceIT extends Abs persons.put( result.getName(), result.getAttributes() ); } + results.close(); + // admin is extra assertEquals( 4, persons.size() ); @@ -789,6 +817,8 @@ public class SchemaServiceIT extends Abs SearchResult result = results.next(); persons.put( result.getName(), result.getAttributes() ); } + + results.close(); // admin is extra assertEquals( 4, persons.size() ); @@ -839,6 +869,8 @@ public class SchemaServiceIT extends Abs SearchResult result = results.next(); persons.put( result.getName(), result.getAttributes() ); } + + results.close(); // admin is extra assertEquals( 4, persons.size() ); @@ -889,6 +921,8 @@ public class SchemaServiceIT extends Abs SearchResult result = results.next(); persons.put( result.getName(), result.getAttributes() ); } + + results.close(); assertEquals( 3, persons.size() ); @@ -933,16 +967,18 @@ public class SchemaServiceIT extends Abs controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); NamingEnumeration results = schemaRoot.search( "", "(objectClass=top)", controls ); assertTrue( "Expected some results", results.hasMore() ); + results.close(); controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); results = schemaRoot.search( "", "(objectClass=metaAttributeType)", controls ); assertTrue( "Expected some results", results.hasMore() ); + results.close(); controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); results = schemaRoot.search( "", "(objectClass=metaTop)", controls ); assertTrue( "Expected some results", results.hasMore() ); + results.close(); } - } Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java (original) +++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java Wed Apr 11 12:51:45 2012 @@ -37,6 +37,7 @@ import org.apache.directory.server.core. import org.apache.directory.server.core.exception.ExceptionServiceIT; import org.apache.directory.server.core.integ.FrameworkSuite; import org.apache.directory.server.core.operations.add.PasswordHashingInterceptorTest; +import org.apache.directory.server.core.operations.move.MoveIT; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -71,8 +72,10 @@ import org.junit.runners.Suite; SearchAuthorizationIT.class, // exception - ExceptionServiceIT.class - + ExceptionServiceIT.class, + + // Operations + MoveIT.class }) public class MigratedStockCoreISuite { Propchange: directory/apacheds/trunk/core-jndi/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/core-jndi:r1304337-1324714 Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed Apr 11 12:51:45 2012 @@ -1206,6 +1206,17 @@ public class DefaultDirectoryService imp { throw new LdapOperationException( e.getMessage(), e ); } + finally + { + try + { + cursor.close(); + } + catch ( Exception e ) + { + throw new LdapOperationException( e.getMessage(), e ); + } + } return changeLog.getCurrentRevision(); } Propchange: directory/apacheds/trunk/http-integration/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/http-integration:r1304337-1324714 Propchange: directory/apacheds/trunk/i18n/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/i18n:r1304337-1324714 Propchange: directory/apacheds/trunk/installers/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/installers:r1304337-1324714 Propchange: directory/apacheds/trunk/installers-maven-plugin/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/installers-maven-plugin:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptor-kerberos/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptor-kerberos:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/authn/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/authn:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/authz/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/authz:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/changelog/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/changelog:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/collective/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/collective:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/event/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/event:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/exception/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/exception:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/journal/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/journal:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/operational/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/operational:r1304337-1324714 Propchange: directory/apacheds/trunk/interceptors/subtree/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/subtree:r1304337-1324714 Modified: directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original) +++ directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Apr 11 12:51:45 2012 @@ -386,6 +386,7 @@ public class SubentryInterceptor extends nexus.modify( new ModifyOperationContext( session, candidateDn, modifications ) ); } } + subentries.close(); } catch ( Exception e ) Propchange: directory/apacheds/trunk/interceptors/trigger/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/interceptors/trigger:r1304337-1324714 Propchange: directory/apacheds/trunk/jdbm-partition/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/jdbm-partition:r1304337-1324714 Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Wed Apr 11 12:51:45 2012 @@ -29,6 +29,8 @@ import org.apache.directory.server.i18n. import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.apache.directory.shared.ldap.model.cursor.Tuple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -41,6 +43,9 @@ import org.apache.directory.shared.ldap. */ public class DupsContainerCursor extends AbstractCursor>> { + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + /** The JDBM table we are building a cursor over */ private final JdbmTable table; @@ -68,6 +73,8 @@ public class DupsContainerCursor e */ public DupsContainerCursor( JdbmTable table ) throws IOException { + LOG_CURSOR.debug( "Creating DupsContainerCursor {}", this ); + if ( !table.isDupsEnabled() ) { throw new IllegalStateException( I18n.err( I18n.ERR_572 ) ); @@ -376,8 +383,9 @@ public class DupsContainerCursor e @Override public void close() throws Exception { + LOG_CURSOR.debug( "Closing DupsContainerCursor {}", this ); super.close(); - this.closeBrowser( browser ); + closeBrowser( browser ); } @@ -387,8 +395,9 @@ public class DupsContainerCursor e @Override public void close( Exception cause ) throws Exception { + LOG_CURSOR.debug( "Closing DupsContainerCursor {}", this ); super.close( cause ); - this.closeBrowser( browser ); + closeBrowser( browser ); } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java Wed Apr 11 12:51:45 2012 @@ -41,6 +41,9 @@ class DupsCursor extends AbstractC { private static final Logger LOG = LoggerFactory.getLogger( DupsCursor.class.getSimpleName() ); + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + /** * The JDBM backed table this Cursor traverses over. */ @@ -83,6 +86,7 @@ class DupsCursor extends AbstractC public DupsCursor( JdbmTable table ) throws Exception { + LOG_CURSOR.debug( "Creating DupsCursor {}", this ); this.table = table; this.containerCursor = new DupsContainerCursor( table ); LOG.debug( "Created on table {}", table ); @@ -281,6 +285,7 @@ class DupsCursor extends AbstractC valueAvailable = true; returnedTuple.setKey( containerTuple.getKey() ); returnedTuple.setValue( dupsCursor.get() ); + return true; } @@ -319,6 +324,7 @@ class DupsCursor extends AbstractC valueAvailable = true; returnedTuple.setKey( containerTuple.getKey() ); returnedTuple.setValue( dupsCursor.get() ); + return true; } @@ -343,6 +349,11 @@ class DupsCursor extends AbstractC */ if ( null == dupsCursor || !dupsCursor.previous() ) { + if ( dupsCursor != null ) + { + dupsCursor.close(); + } + /* * If the wrappedCursor cursor has more elements we get the previous * key/AvlTree Tuple to work with and get a cursor over it's @@ -382,6 +393,7 @@ class DupsCursor extends AbstractC returnedTuple.setKey( containerTuple.getKey() ); returnedTuple.setValue( dupsCursor.get() ); + return valueAvailable = true; } @@ -393,8 +405,13 @@ class DupsCursor extends AbstractC * If the iterator over the values of the current key is null or is * extinguished then we need to advance to the next key. */ - if ( null == dupsCursor || !dupsCursor.next() ) + if ( ( null == dupsCursor ) || !dupsCursor.next() ) { + if ( dupsCursor != null ) + { + dupsCursor.close(); + } + /* * If the wrappedCursor cursor has more elements we get the next * key/AvlTree Tuple to work with and get a cursor over it. @@ -440,6 +457,7 @@ class DupsCursor extends AbstractC */ returnedTuple.setKey( containerTuple.getKey() ); returnedTuple.setValue( dupsCursor.get() ); + return valueAvailable = true; } @@ -463,8 +481,14 @@ class DupsCursor extends AbstractC @Override public void close() throws Exception { + LOG_CURSOR.debug( "Closing DupsCursor {}", this ); super.close(); containerCursor.close(); + + if ( dupsCursor != null ) + { + dupsCursor.close(); + } } @@ -474,7 +498,13 @@ class DupsCursor extends AbstractC @Override public void close( Exception cause ) throws Exception { + LOG_CURSOR.debug( "Closing DupsCursor {}", this ); super.close( cause ); containerCursor.close( cause ); + + if ( dupsCursor != null ) + { + dupsCursor.close( cause ); + } } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Wed Apr 11 12:51:45 2012 @@ -424,6 +424,8 @@ public class JdbmIndex extends Abs // Remove the Key -> entryId from the index forward.remove( values.get().getValue(), entryId ); } + + values.close(); // Remove the id -> key from the reverse index if ( withReverse ) Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java Wed Apr 11 12:51:45 2012 @@ -106,6 +106,7 @@ public class JdbmRdnIndex extends Jdb // finally write a text file in the format -.txt FileWriter fw = new FileWriter( new File( path + "-" + attributeType.getName() + ".txt" ) ); + // write the AttributeType description fw.write( attributeType.toString() ); fw.close(); @@ -160,6 +161,7 @@ public class JdbmRdnIndex extends Jdb public void drop( ParentIdAndRdn rdn, Long id ) throws Exception { long val = forward.get( rdn ); + if ( val == id ) { forward.remove( rdn ); Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Wed Apr 11 12:51:45 2012 @@ -64,9 +64,6 @@ public class JdbmTable extends Abs /** the JDBM record manager for the file this table is managed in */ private final RecordManager recMan; - /** whether or not this table allows for duplicates */ - private final boolean allowsDuplicates; - /** the wrappedCursor JDBM btree used in this Table */ private BTree bt; @@ -315,6 +312,7 @@ public class JdbmTable extends Abs } DupsContainer values = getDupsContainer( ( byte[] ) bt.find( key ) ); + if ( values.isArrayTree() ) { ArrayTree set = values.getArrayTree(); @@ -1072,6 +1070,8 @@ public class JdbmTable extends Abs { bTree.insert( keys.get(), ( K ) StringConstants.EMPTY_BYTES, true ); } + + keys.close(); return bTree; } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Wed Apr 11 12:51:45 2012 @@ -27,6 +27,8 @@ import jdbm.helper.TupleBrowser; import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -37,6 +39,9 @@ import org.apache.directory.shared.ldap. */ public class KeyBTreeCursor extends AbstractCursor { + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + private final Tuple tuple = new Tuple(); private final BTree btree; @@ -54,6 +59,7 @@ public class KeyBTreeCursor extends A */ public KeyBTreeCursor( BTree btree, Comparator comparator ) throws Exception { + LOG_CURSOR.debug( "Creating KeyBTreeCursor {}", this ); this.btree = btree; this.comparator = comparator; } @@ -218,6 +224,7 @@ public class KeyBTreeCursor extends A @Override public void close() throws Exception { + LOG_CURSOR.debug( "Closing KeyBTreeCursor {}", this ); super.close(); this.closeBrowser( browser ); } @@ -229,6 +236,7 @@ public class KeyBTreeCursor extends A @Override public void close( Exception cause ) throws Exception { + LOG_CURSOR.debug( "Closing KeyBTreeCursor {}", this ); super.close( cause ); this.closeBrowser( browser ); } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java Wed Apr 11 12:51:45 2012 @@ -25,6 +25,8 @@ import org.apache.directory.server.i18n. import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.apache.directory.shared.ldap.model.cursor.Tuple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -36,6 +38,9 @@ import org.apache.directory.shared.ldap. */ public class KeyTupleArrayCursor extends AbstractCursor> { + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + private final ArrayTreeCursor wrapped; private final K key; @@ -51,6 +56,7 @@ public class KeyTupleArrayCursor e */ public KeyTupleArrayCursor( ArrayTree arrayTree, K key ) { + LOG_CURSOR.debug( "Creating KeyTupleArrayCursor {}", this ); this.key = key; this.wrapped = new ArrayTreeCursor( arrayTree ); } @@ -206,4 +212,36 @@ public class KeyTupleArrayCursor e throw new InvalidCursorPositionException(); } + + + /** + * {@inheritDoc} + */ + public void close() throws Exception + { + LOG_CURSOR.debug( "Closing KeyTupleArrayCursor {}", this ); + + if ( wrapped != null ) + { + wrapped.close(); + } + + super.close(); + } + + + /** + * {@inheritDoc} + */ + public void close( Exception reason ) throws Exception + { + LOG_CURSOR.debug( "Closing KeyTupleArrayCursor {}", this ); + + if ( wrapped != null ) + { + wrapped.close( reason ); + } + + super.close( reason ); + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Wed Apr 11 12:51:45 2012 @@ -28,6 +28,8 @@ import org.apache.directory.server.i18n. import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.apache.directory.shared.ldap.model.cursor.Tuple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -39,6 +41,9 @@ import org.apache.directory.shared.ldap. */ public class KeyTupleBTreeCursor extends AbstractCursor> { + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + private final Comparator comparator; private final BTree btree; private final K key; @@ -59,6 +64,7 @@ public class KeyTupleBTreeCursor e */ public KeyTupleBTreeCursor( BTree btree, K key, Comparator comparator ) throws Exception { + LOG_CURSOR.debug( "Creating KeyTupleBTreeCursor {}", this ); this.key = key; this.btree = btree; this.comparator = comparator; @@ -321,8 +327,9 @@ public class KeyTupleBTreeCursor e @Override public void close() throws Exception { + LOG_CURSOR.debug( "Closing KeyTupleBTreeCursor {}", this ); super.close(); - this.closeBrowser( browser ); + closeBrowser( browser ); } @@ -332,8 +339,9 @@ public class KeyTupleBTreeCursor e @Override public void close( Exception cause ) throws Exception { + LOG_CURSOR.debug( "Closing KeyTupleBTreeCursor {}", this ); super.close( cause ); - this.closeBrowser( browser ); + closeBrowser( browser ); } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Wed Apr 11 12:51:45 2012 @@ -27,6 +27,8 @@ import org.apache.directory.server.i18n. import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.apache.directory.shared.ldap.model.cursor.Tuple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -39,6 +41,9 @@ import org.apache.directory.shared.ldap. */ class NoDupsCursor extends AbstractCursor> { + /** A dedicated log for cursors */ + private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); + private final JdbmTable table; private jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple(); @@ -55,6 +60,7 @@ class NoDupsCursor extends Abstrac */ public NoDupsCursor( JdbmTable table ) throws IOException { + LOG_CURSOR.debug( "Creating NoDupsCursor {}", this ); this.table = table; } @@ -255,8 +261,9 @@ class NoDupsCursor extends Abstrac @Override public void close() throws Exception { + LOG_CURSOR.debug( "Closing NoDupsCursor {}", this ); super.close(); - this.closeBrowser( browser ); + closeBrowser( browser ); } @@ -266,8 +273,9 @@ class NoDupsCursor extends Abstrac @Override public void close( Exception cause ) throws Exception { + LOG_CURSOR.debug( "Closing NoDupsCursor {}", this ); super.close( cause ); - this.closeBrowser( browser ); + closeBrowser( browser ); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java Wed Apr 11 12:51:45 2012 @@ -147,13 +147,13 @@ public class DupsContainerCursorTest comparator.setSchemaManager( schemaManager ); table = new JdbmTable( schemaManager, "test", recman, comparator, null, null ); - Cursor>> cursor = - new DupsContainerCursor( table ); - assertNotNull( cursor ); + Cursor>> cursor = null; + + cursor = new DupsContainerCursor( table ); } - @Test(expected = InvalidCursorPositionException.class) + @Test public void testEmptyTable() throws Exception { Cursor>> cursor = @@ -162,15 +162,27 @@ public class DupsContainerCursorTest assertFalse( cursor.available() ); assertFalse( cursor.isClosed() ); + cursor.close(); cursor = new DupsContainerCursor( table ); assertFalse( cursor.previous() ); + cursor.close(); cursor = new DupsContainerCursor( table ); assertFalse( cursor.next() ); cursor.after( new Tuple>( "7", null ) ); - cursor.get(); + + try + { + cursor.get(); + fail(); + } + catch ( InvalidCursorPositionException icpe ) + { + // Expected + cursor.close(); + } } @@ -189,6 +201,7 @@ public class DupsContainerCursorTest cursor.beforeFirst(); assertFalse( cursor.previous() ); assertTrue( cursor.next() ); + cursor.close(); } @@ -245,6 +258,7 @@ public class DupsContainerCursorTest tuple = cursor.get(); assertEquals( "2", tuple.getKey() ); assertEquals( "2", tuple.getValue().getArrayTree().getFirst() ); + cursor.close(); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java Wed Apr 11 12:51:45 2012 @@ -150,6 +150,8 @@ public class DupsCursorTest assertFalse( cursor.first() ); assertFalse( cursor.last() ); + + cursor.close(); } @@ -174,6 +176,8 @@ public class DupsCursorTest assertEquals( i, Integer.parseInt( tuple.getValue() ) ); i++; } + + cursor.close(); } @@ -197,6 +201,8 @@ public class DupsCursorTest assertEquals( i, Integer.parseInt( tuple.getValue() ) ); i--; } + + cursor.close(); } @@ -238,6 +244,8 @@ public class DupsCursorTest i++; } + + cursor.close(); } @@ -281,6 +289,8 @@ public class DupsCursorTest i--; } + + cursor.close(); } @@ -411,6 +421,8 @@ public class DupsCursorTest i--; } + + cursor.close(); } @@ -544,6 +556,8 @@ public class DupsCursorTest i--; } + + cursor.close(); } @@ -674,6 +688,8 @@ public class DupsCursorTest i--; } + + cursor.close(); } @@ -807,6 +823,8 @@ public class DupsCursorTest i--; } + + cursor.close(); } @@ -819,6 +837,8 @@ public class DupsCursorTest cursor.before( new Tuple( "1", "2" ) ); assertFalse( cursor.available() ); + + cursor.close(); } @@ -842,6 +862,8 @@ public class DupsCursorTest cursor.before( new Tuple( "7", "2" ) ); assertFalse( cursor.available() ); + + cursor.close(); } @@ -865,6 +887,8 @@ public class DupsCursorTest cursor.before( new Tuple( "7", "2" ) ); assertFalse( cursor.available() ); + + cursor.close(); } @@ -917,6 +941,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test before to advance just before a key with a single value but // with a null tuple value which should not advance the dupsCursor @@ -933,6 +959,7 @@ public class DupsCursorTest } Tuple tuple = cursor.get(); + if ( i > 12 && i < 17 ) { assertEquals( 13, Integer.parseInt( tuple.getKey() ) ); @@ -945,6 +972,8 @@ public class DupsCursorTest } i++; } + + cursor.close(); // test before to advance just before a key value pair where the key // does not exist - using value so we hit check for key equality @@ -975,11 +1004,15 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just after the end cursor = table.cursor(); cursor.after( new Tuple( "111", null ) ); assertFalse( cursor.next() ); + + cursor.close(); // test after to advance just before a key with a single value i = 6; @@ -1009,6 +1042,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test before to advance just before a key & value with multiple // values for the key - we should advance just before the value @@ -1042,6 +1077,8 @@ public class DupsCursorTest } i++; } + + cursor.close(); // test after to advance just before a key & value with multiple // values for the key - we should advance just before the value @@ -1077,6 +1114,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just before a key that does not exist cursor = table.cursor(); @@ -1111,6 +1150,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just before a key and value where the key // does not exist - used to force key comparison in after() @@ -1146,6 +1187,8 @@ public class DupsCursorTest i++; } + + cursor.close(); } @@ -1198,6 +1241,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test before to advance just before a key with a single value but // with a null tuple value which should not advance the dupsCursor @@ -1227,6 +1272,8 @@ public class DupsCursorTest } i++; } + + cursor.close(); // test before to advance just before a key value pair where the key // does not exist - using value so we hit check for key equality @@ -1259,11 +1306,15 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just after the end cursor = table.cursor(); cursor.after( new Tuple( "111", null ) ); assertFalse( cursor.next() ); + + cursor.close(); // test after to advance just before a key with a single value i = 6; @@ -1293,6 +1344,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test before to advance just before a key & value with multiple // values for the key - we should advance just before the value @@ -1328,6 +1381,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just before a key & value with multiple // values for the key - we should advance just before the value @@ -1363,6 +1418,8 @@ public class DupsCursorTest i++; } + + cursor.close(); // test after to advance just before a key that does not exist cursor = table.cursor(); @@ -1395,6 +1452,8 @@ public class DupsCursorTest } i++; } + + cursor.close(); // test after to advance just before a key and value where the key // does not exist - used to force key comparison in after() @@ -1430,6 +1489,8 @@ public class DupsCursorTest i++; } + + cursor.close(); } @@ -1446,6 +1507,7 @@ public class DupsCursorTest } catch ( InvalidCursorPositionException e ) { + cursor.close(); } } } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Wed Apr 11 12:51:45 2012 @@ -259,6 +259,7 @@ public class JdbmIndexTest // initialized index initIndex(); + try { ( ( JdbmIndex ) idx ).setNumDupLimit( 30 ); @@ -267,6 +268,7 @@ public class JdbmIndexTest catch ( Exception e ) { } + assertEquals( JdbmIndex.DEFAULT_DUPLICATE_LIMIT, ( ( JdbmIndex ) idx ).getNumDupLimit() ); } @@ -331,6 +333,7 @@ public class JdbmIndexTest { idx.add( String.valueOf( ch ), ( long ) ch ); } + assertEquals( 26, idx.greaterThanCount( "a" ) ); } @@ -345,6 +348,7 @@ public class JdbmIndexTest { idx.add( String.valueOf( ch ), ( long ) ch ); } + assertEquals( 26, idx.lessThanCount( "z" ) ); } @@ -539,6 +543,8 @@ public class JdbmIndexTest IndexEntry e3 = cursor.get(); assertEquals( 1234L, ( long ) e3.getId() ); assertEquals( "foo", e3.getValue() ); + + cursor.close(); // use reverse index's cursor cursor = idx.reverseCursor(); @@ -558,6 +564,8 @@ public class JdbmIndexTest e3 = cursor.get(); assertEquals( 1234L, ( long ) e3.getId() ); assertEquals( "foo", e3.getValue() ); + + cursor.close(); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java Wed Apr 11 12:51:45 2012 @@ -367,6 +367,8 @@ public class JdbmRdnIndexTest assertEquals( 2, ( long ) e3.getId() ); assertEquals( "cn=key2", e3.getValue().getRdns()[0].getName() ); assertEquals( 2, e3.getValue().getParentId().longValue() ); + + cursor.close(); } // @Test Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Wed Apr 11 12:51:45 2012 @@ -211,11 +211,13 @@ public class JdbmStoreTest // inject context entry Dn suffixDn = new Dn( schemaManager, "dc=example,dc=com" ); - Entry entry = new DefaultEntry( schemaManager, suffixDn ); - entry.add( "objectClass", "top", "domain" ); - entry.add( "dc", "example" ); - entry.add( SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString() ); - entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, suffixDn, + "objectClass: top", + "objectClass: domain", + "dc: example", + SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString(), + SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() ); + store2.add( new AddOperationContext( null, entry ) ); // lookup the context entry @@ -247,11 +249,6 @@ public class JdbmStoreTest jdbmPartition.addIndex( new JdbmIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) ); assertNotNull( jdbmPartition.getPresenceIndex() ); - assertNull( jdbmPartition.getOneLevelIndex() ); - ( ( Store ) jdbmPartition ).addIndex( new JdbmIndex( - ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) ); - assertNotNull( jdbmPartition.getOneLevelIndex() ); - assertNull( jdbmPartition.getSubLevelIndex() ); ( ( Store ) jdbmPartition ).addIndex( new JdbmIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) ); @@ -331,16 +328,6 @@ public class JdbmStoreTest { } - assertNotNull( store.getOneLevelIndex() ); - try - { - store.addIndex( new JdbmIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) ); - fail(); - } - catch ( IllegalStateException e ) - { - } - assertNotNull( store.getSubLevelIndex() ); try { @@ -405,7 +392,7 @@ public class JdbmStoreTest Iterator systemIndices = store.getSystemIndices(); - for ( int ii = 0; ii < 10; ii++ ) + for ( int ii = 0; ii < 9; ii++ ) { assertTrue( systemIndices.hasNext() ); assertNotNull( systemIndices.next() ); @@ -453,6 +440,7 @@ public class JdbmStoreTest assertNotNull( userIndices.next() ); assertFalse( userIndices.hasNext() ); assertNotNull( store.getUserIndex( OU_AT ) ); + try { store.getUserIndex( SN_AT ); @@ -515,8 +503,15 @@ public class JdbmStoreTest assertNotNull( cursor ); cursor.beforeFirst(); assertTrue( cursor.next() ); - assertEquals( 2L, ( long ) cursor.get().getId() ); + assertEquals( 3L, ( long ) cursor.get().getId() ); + assertTrue( cursor.next() ); + assertEquals( 4L, ( long ) cursor.get().getId() ); assertTrue( cursor.next() ); + assertEquals( 2L, ( long ) cursor.get().getId() ); + assertFalse( cursor.next() ); + + cursor.close(); + assertEquals( 3, store.getChildCount( 1L ) ); store.delete( 2L ); @@ -525,19 +520,20 @@ public class JdbmStoreTest // add an alias and delete to test dropAliasIndices method Dn dn = new Dn( schemaManager, "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "objectClass", "top", "alias", "extensibleObject" ); - entry.add( "ou", "Apache" ); - entry.add( "commonName", "Jack Daniels" ); - entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, dn, + "objectClass: top", + "objectClass: alias", + "objectClass: extensibleObject", + "ou: Apache", + "commonName: Jack Daniels", + "aliasedObjectName: cn=Jack Daniels,ou=Engineering,o=Good Times Co.", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); store.delete( 12L ); // drops the alias indices - } @@ -563,6 +559,8 @@ public class JdbmStoreTest idx.drop( 5L ); + cursor.close(); + cursor = idx.forwardCursor( 2L ); assertTrue( cursor.next() ); @@ -573,14 +571,18 @@ public class JdbmStoreTest assertFalse( cursor.next() ); + cursor.close(); + // dn id 12 Dn martinDn = new Dn( schemaManager, "cn=Marting King,ou=Sales,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, martinDn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "ou", "Sales" ); - entry.add( "cn", "Martin King" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, martinDn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou: Sales", + "cn: Martin King", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); @@ -588,6 +590,8 @@ public class JdbmStoreTest cursor.afterLast(); assertTrue( cursor.previous() ); assertEquals( 12, ( long ) cursor.get().getId() ); + + cursor.close(); Dn newParentDn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." ); @@ -599,24 +603,29 @@ public class JdbmStoreTest assertTrue( cursor.previous() ); assertEquals( 12, ( long ) cursor.get().getId() ); + cursor.close(); + // dn id 13 Dn marketingDn = new Dn( schemaManager, "ou=Marketing,ou=Sales,o=Good Times Co." ); - entry = new DefaultEntry( schemaManager, marketingDn ); - entry.add( "objectClass", "top", "organizationalUnit" ); - entry.add( "ou", "Marketing" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + entry = new DefaultEntry( schemaManager, marketingDn, + "objectClass: top", + "objectClass: organizationalUnit", + "ou: Marketing", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); addContext = new AddOperationContext( null, entry ); store.add( addContext ); // dn id 14 Dn jimmyDn = new Dn( schemaManager, "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good Times Co." ); - entry = new DefaultEntry( schemaManager, jimmyDn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "ou", "Marketing" ); - entry.add( "cn", "Jimmy Wales" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + entry = new DefaultEntry( schemaManager, jimmyDn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou", "Marketing", + "cn", "Jimmy Wales", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); addContext = new AddOperationContext( null, entry ); store.add( addContext ); @@ -649,6 +658,8 @@ public class JdbmStoreTest assertEquals( 3, ( long ) cursor.get().getId() ); assertFalse( cursor.previous() ); + + cursor.close(); } @@ -656,10 +667,12 @@ public class JdbmStoreTest public void testAddWithoutParentId() throws Exception { Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "ou", "Not Present" ); - entry.add( "cn", "Martin King" ); + Entry entry = new DefaultEntry( schemaManager, dn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou: Not Present", + "cn: Martin King" ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); } @@ -669,9 +682,9 @@ public class JdbmStoreTest public void testAddWithoutObjectClass() throws Exception { Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "ou", "Sales" ); - entry.add( "cn", "Martin King" ); + Entry entry = new DefaultEntry( schemaManager, dn, + "ou: Sales", + "cn: Martin King" ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); } @@ -695,12 +708,14 @@ public class JdbmStoreTest public void testRename() throws Exception { Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "ou", "Engineering" ); - entry.add( "cn", "Private Ryan" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, dn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou: Engineering", + "cn: Private Ryan", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); @@ -720,12 +735,14 @@ public class JdbmStoreTest public void testRenameEscaped() throws Exception { Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "ou", "Engineering" ); - entry.add( "cn", "Private Ryan" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, dn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou: Engineering", + "cn: Private Ryan", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); @@ -746,12 +763,14 @@ public class JdbmStoreTest public void testMove() throws Exception { Dn childDn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co." ); - Entry childEntry = new DefaultEntry( schemaManager, childDn ); - childEntry.add( "objectClass", "top", "person", "organizationalPerson" ); - childEntry.add( "ou", "Engineering" ); - childEntry.add( "cn", "Private Ryan" ); - childEntry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - childEntry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry childEntry = new DefaultEntry( schemaManager, childDn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "ou", "Engineering", + "cn", "Private Ryan", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, childEntry ); store.add( addContext ); @@ -855,11 +874,13 @@ public class JdbmStoreTest public void testModifyReplaceNonExistingIndexAttribute() throws Exception { Dn dn = new Dn( schemaManager, "cn=Tim B,ou=Sales,o=Good Times Co." ); - Entry entry = new DefaultEntry( schemaManager, dn ); - entry.add( "objectClass", "top", "person", "organizationalPerson" ); - entry.add( "cn", "Tim B" ); - entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); - entry.add( "entryUUID", UUID.randomUUID().toString() ); + Entry entry = new DefaultEntry( schemaManager, dn, + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "cn", "Tim B", + "entryCSN", new CsnFactory( 1 ).newInstance().toString(), + "entryUUID", UUID.randomUUID().toString() ); AddOperationContext addContext = new AddOperationContext( null, entry ); store.add( addContext ); Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java Wed Apr 11 12:51:45 2012 @@ -319,6 +319,7 @@ public class JdbmTableNoDuplicatesTest String istr = Integer.toString( i ); table.put( istr, istr ); } + assertEquals( SIZE, table.count() ); assertFalse( table.has( "-1" ) ); Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java Wed Apr 11 12:51:45 2012 @@ -383,6 +383,8 @@ public class JdbmTableWithDuplicatesTest { //System.out.println( cursor.get() ); } + + cursor.close(); assertFalse( table.hasLessOrEqual( "1" ) ); assertFalse( table.hasLessOrEqual( "1", "10" ) ); Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java Wed Apr 11 12:51:45 2012 @@ -106,6 +106,8 @@ public class KeyBTreeCursorTest new File( fileToDelete + ".lg" ).delete(); dbFile = null; + + cursor.close(); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java Wed Apr 11 12:51:45 2012 @@ -106,6 +106,8 @@ public class KeyCursorTest new File( fileToDelete + ".lg" ).delete(); dbFile = null; + + cursor.close(); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java Wed Apr 11 12:51:45 2012 @@ -28,6 +28,7 @@ import java.util.Comparator; import org.apache.directory.server.core.avltree.ArrayTree; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.apache.directory.shared.ldap.model.cursor.Tuple; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -70,6 +71,13 @@ public class KeyTupleArrayCursorTest cursor = new KeyTupleArrayCursor( tree, KEY ); } + + + @After + public void cleanup() throws Exception + { + cursor.close(); + } @Test(expected = InvalidCursorPositionException.class) Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java Wed Apr 11 12:51:45 2012 @@ -137,6 +137,7 @@ public class KeyTupleBTreeCursorTest new File( fileToDelete + ".lg" ).delete(); dbFile = null; + cursor.close(); } @@ -166,7 +167,7 @@ public class KeyTupleBTreeCursorTest table.put( KEY, "30" ); table.put( KEY, "25" ); - cursor = new KeyTupleBTreeCursor( getDupsContainer(), KEY, comparator ); + KeyTupleBTreeCursor cursor = new KeyTupleBTreeCursor( getDupsContainer(), KEY, comparator ); cursor.before( new Tuple( KEY, "3" ) ); assertTrue( cursor.next() ); @@ -202,6 +203,7 @@ public class KeyTupleBTreeCursorTest assertTrue( cursor.next() ); assertEquals( "30", cursor.get().getValue() ); + cursor.close(); } Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java?rev=1324744&r1=1324743&r2=1324744&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java Wed Apr 11 12:51:45 2012 @@ -132,7 +132,7 @@ public class NoDupsCursorTest } - @Test(expected = InvalidCursorPositionException.class) + @Test public void testEmptyTable() throws Exception { Cursor> cursor = table.cursor(); @@ -140,15 +140,28 @@ public class NoDupsCursorTest assertFalse( cursor.available() ); assertFalse( cursor.isClosed() ); + + cursor.close(); cursor = table.cursor(); assertFalse( cursor.previous() ); + + cursor.close(); cursor = table.cursor(); assertFalse( cursor.next() ); cursor.after( new Tuple( "7", "7" ) ); - cursor.get(); + + try + { + cursor.get(); + fail(); + } + catch ( InvalidCursorPositionException icpe ) + { + cursor.close(); + } } @@ -166,6 +179,8 @@ public class NoDupsCursorTest cursor.beforeFirst(); assertFalse( cursor.previous() ); assertTrue( cursor.next() ); + + cursor.close(); } @@ -182,7 +197,7 @@ public class NoDupsCursorTest cursor.after( new Tuple( "2", "2" ) ); assertTrue( cursor.next() ); - + Tuple tuple = cursor.get(); assertEquals( "3", tuple.getKey() ); assertEquals( "3", tuple.getValue() ); @@ -220,6 +235,8 @@ public class NoDupsCursorTest tuple = cursor.get(); assertEquals( "1", tuple.getKey() ); assertEquals( "1", tuple.getValue() ); + + cursor.close(); } @@ -279,7 +296,8 @@ public class NoDupsCursorTest assertTrue( cursor.previous() ); assertEquals( "1", cursor.get().getKey() ); - + + cursor.close(); } Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/ ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:r1304337-1324714 Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java ------------------------------------------------------------------------------ Merged /directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:r1304337-1324714