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 2012/04/11 00:45:16 UTC
svn commit: r1312031 -
/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
Author: elecharny
Date: Tue Apr 10 22:45:15 2012
New Revision: 1312031
URL: http://svn.apache.org/viewvc?rev=1312031&view=rev
Log:
Closed many cursors
Modified:
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
Modified: directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java Tue Apr 10 22:45:15 2012
@@ -147,13 +147,13 @@ public class DupsContainerCursorTest
comparator.setSchemaManager( schemaManager );
table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
- Cursor<Tuple<String, DupsContainer<String>>> cursor =
- new DupsContainerCursor<String, String>( table );
- assertNotNull( cursor );
+ Cursor<Tuple<String, DupsContainer<String>>> cursor = null;
+
+ cursor = new DupsContainerCursor<String, String>( table );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testEmptyTable() throws Exception
{
Cursor<Tuple<String, DupsContainer<String>>> cursor =
@@ -162,15 +162,27 @@ public class DupsContainerCursorTest
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
+ cursor.close();
cursor = new DupsContainerCursor<String, String>( table );
assertFalse( cursor.previous() );
+ cursor.close();
cursor = new DupsContainerCursor<String, String>( table );
assertFalse( cursor.next() );
cursor.after( new Tuple<String, DupsContainer<String>>( "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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java Tue Apr 10 22:45:15 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<String, String>( "1", "2" ) );
assertFalse( cursor.available() );
+
+ cursor.close();
}
@@ -842,6 +862,8 @@ public class DupsCursorTest
cursor.before( new Tuple<String, String>( "7", "2" ) );
assertFalse( cursor.available() );
+
+ cursor.close();
}
@@ -865,6 +887,8 @@ public class DupsCursorTest
cursor.before( new Tuple<String, String>( "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<String, String> 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<String, String>( "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<String, String>( "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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Tue Apr 10 22:45:15 2012
@@ -259,6 +259,7 @@ public class JdbmIndexTest
// initialized index
initIndex();
+
try
{
( ( JdbmIndex<String, Entry> ) idx ).setNumDupLimit( 30 );
@@ -267,6 +268,7 @@ public class JdbmIndexTest
catch ( Exception e )
{
}
+
assertEquals( JdbmIndex.DEFAULT_DUPLICATE_LIMIT, ( ( JdbmIndex<String, Entry> ) 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<String, Long> 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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java Tue Apr 10 22:45:15 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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Tue Apr 10 22:45:15 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
@@ -438,6 +440,7 @@ public class JdbmStoreTest
assertNotNull( userIndices.next() );
assertFalse( userIndices.hasNext() );
assertNotNull( store.getUserIndex( OU_AT ) );
+
try
{
store.getUserIndex( SN_AT );
@@ -507,6 +510,8 @@ public class JdbmStoreTest
assertEquals( 2L, ( long ) cursor.get().getId() );
assertFalse( cursor.next() );
+ cursor.close();
+
assertEquals( 3, store.getChildCount( 1L ) );
store.delete( 2L );
@@ -515,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
-
}
@@ -553,6 +559,8 @@ public class JdbmStoreTest
idx.drop( 5L );
+ cursor.close();
+
cursor = idx.forwardCursor( 2L );
assertTrue( cursor.next() );
@@ -563,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 );
@@ -578,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." );
@@ -589,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 );
@@ -639,6 +658,8 @@ public class JdbmStoreTest
assertEquals( 3, ( long ) cursor.get().getId() );
assertFalse( cursor.previous() );
+
+ cursor.close();
}
@@ -646,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 );
}
@@ -659,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 );
}
@@ -685,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 );
@@ -710,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 );
@@ -736,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 );
@@ -845,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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java Tue Apr 10 22:45:15 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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java Tue Apr 10 22:45:15 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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java Tue Apr 10 22:45:15 2012
@@ -106,6 +106,8 @@ public class KeyBTreeCursorTest
new File( fileToDelete + ".lg" ).delete();
dbFile = null;
+
+ cursor.close();
}
Modified: directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java Tue Apr 10 22:45:15 2012
@@ -106,6 +106,8 @@ public class KeyCursorTest
new File( fileToDelete + ".lg" ).delete();
dbFile = null;
+
+ cursor.close();
}
Modified: directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java Tue Apr 10 22:45:15 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<Integer, Integer>( tree, KEY );
}
+
+
+ @After
+ public void cleanup() throws Exception
+ {
+ cursor.close();
+ }
@Test(expected = InvalidCursorPositionException.class)
Modified: directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java Tue Apr 10 22:45:15 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<String, String>( getDupsContainer(), KEY, comparator );
+ KeyTupleBTreeCursor<String, String> cursor = new KeyTupleBTreeCursor<String, String>( getDupsContainer(), KEY, comparator );
cursor.before( new Tuple<String, String>( 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/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java?rev=1312031&r1=1312030&r2=1312031&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java (original)
+++ directory/apacheds/branches/index-work/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java Tue Apr 10 22:45:15 2012
@@ -132,7 +132,7 @@ public class NoDupsCursorTest
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testEmptyTable() throws Exception
{
Cursor<Tuple<String, String>> 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<String, String>( "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<String, String>( "2", "2" ) );
assertTrue( cursor.next() );
-
+
Tuple<String, String> 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();
}