You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/11/09 18:04:47 UTC
svn commit: r1199852 [2/5] - in
/directory/apacheds/branches/apacheds-txns/xdbm-partition/src:
main/java/org/apache/directory/server/core/partition/impl/avl/
main/java/org/apache/directory/server/core/partition/impl/btree/
main/java/org/apache/director...
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java Wed Nov 9 17:04:46 2011
@@ -30,6 +30,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.util.Iterator;
+import java.util.UUID;
import net.sf.ehcache.store.AbstractStore;
@@ -126,9 +127,9 @@ public class PartitionTest
partition.setId( "example" );
partition.setSyncOnWrite( false );
- partition.addIndex( new AvlIndex<String, Entry>( SchemaConstants.OU_AT_OID ) );
- partition.addIndex( new AvlIndex<String, Entry>( SchemaConstants.UID_AT_OID ) );
- partition.addIndex( new AvlIndex<String, Entry>( SchemaConstants.CN_AT_OID ) );
+ partition.addIndex( new AvlIndex<String>( SchemaConstants.OU_AT_OID ) );
+ partition.addIndex( new AvlIndex<String>( SchemaConstants.UID_AT_OID ) );
+ partition.addIndex( new AvlIndex<String>( SchemaConstants.CN_AT_OID ) );
partition.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
partition.initialize();
@@ -191,7 +192,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: no "uidObject" tuple in objectClass index
@@ -221,11 +222,11 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "sales" tuple in ou index
- Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) partition.getUserIndex( OU_AT );
+ Index<String> ouIndex = ( Index<String> ) partition.getUserIndex( OU_AT );
assertTrue( ouIndex.forward( "sales", entryId ) );
assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
@@ -250,11 +251,11 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "sales" tuple in ou index
- Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) partition.getUserIndex( OU_AT );
+ Index<String> ouIndex = ( Index<String> ) partition.getUserIndex( OU_AT );
assertTrue( partition.getPresenceIndex().forward( SchemaConstants.OU_AT_OID, entryId ) );
assertTrue( ouIndex.forward( "sales", entryId ) );
assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
@@ -285,7 +286,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "person" tuple in objectClass index
@@ -313,7 +314,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "person" tuple in objectClass index
@@ -344,7 +345,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
assertNotSame( csn, lookedup.get( csnAt ).getString() );
@@ -382,7 +383,7 @@ public class PartitionTest
entry.add( "sn", "user sn" );
// add
- StoreUtils.injectEntryInStore( partition, entry );
+ StoreUtils.injectEntryInStore( partition, entry, 12 );
verifyParentId( dn );
// move
@@ -403,9 +404,9 @@ public class PartitionTest
private Entry verifyParentId( Dn dn ) throws Exception
{
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry entry = partition.lookup( entryId );
- Long parentId = partition.getParentId( entryId );
+ UUID parentId = partition.getParentId( entryId );
Attribute parentIdAt = entry.get( SchemaConstants.ENTRY_PARENT_ID_AT );
assertNotNull( parentIdAt );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java Wed Nov 9 17:04:46 2011
@@ -42,7 +42,8 @@ public class StoreUtils
/** CSN factory instance */
private static final CsnFactory CSN_FACTORY = new CsnFactory( 0 );
-
+
+
/**
* Initializes and loads a store with the example data shown in
* <a href="http://cwiki.apache.org/confluence/display/DIRxSRVx11/Structure+and+Organization">
@@ -57,8 +58,9 @@ public class StoreUtils
*/
//This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
- public static void loadExampleData( Store<Entry, Long> store, SchemaManager schemaManager ) throws Exception
+ public static void loadExampleData( Store store, SchemaManager schemaManager ) throws Exception
{
+ int idx = 1;
Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
// Entry #1
@@ -67,7 +69,7 @@ public class StoreUtils
entry.add( "o", "Good Times Co." );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #2
Dn dn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
@@ -76,7 +78,7 @@ public class StoreUtils
entry.add( "ou", "Sales" );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #3
dn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
@@ -85,7 +87,7 @@ public class StoreUtils
entry.add( "ou", "Board of Directors" );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #4
dn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
@@ -94,7 +96,7 @@ public class StoreUtils
entry.add( "ou", "Engineering" );
entry.add( "postalCode", "2" );
entry.add( "postOfficeBox", "2" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #5
dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
@@ -105,7 +107,7 @@ public class StoreUtils
entry.add( "sn", "WAlkeR" );
entry.add( "postalCode", "3" );
entry.add( "postOfficeBox", "3" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #6
dn = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
@@ -116,7 +118,7 @@ public class StoreUtils
entry.add( "surName", "BEAN" );
entry.add( "postalCode", "4" );
entry.add( "postOfficeBox", "4" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #7
dn = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
@@ -125,7 +127,7 @@ public class StoreUtils
entry.add( "ou", "Apache" );
entry.add( "postalCode", "5" );
entry.add( "postOfficeBox", "5" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #8
dn = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
@@ -136,7 +138,7 @@ public class StoreUtils
entry.add( "SN", "Daniels" );
entry.add( "postalCode", "6" );
entry.add( "postOfficeBox", "6" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// aliases -------------
@@ -147,7 +149,7 @@ public class StoreUtils
entry.add( "ou", "Apache" );
entry.add( "commonName", "Jim Bean" );
entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #10
dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
@@ -155,7 +157,7 @@ public class StoreUtils
entry.add( "objectClass", "top", "alias", "extensibleObject" );
entry.add( "commonName", "Jim Bean" );
entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
// Entry #11
dn = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
@@ -164,7 +166,7 @@ public class StoreUtils
entry.add( "ou", "Engineering" );
entry.add( "2.5.4.3", "Johnny Walker" );
entry.add( "aliasedObjectName", "cn=Johnny Walker,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, idx++ );
}
@@ -176,14 +178,27 @@ public class StoreUtils
* @param store the store
* @param dn the normalized Dn
* @param entry the server entry
+ * @param idx index used to build the entry uuid
* @throws Exception in case of any problems in adding the entry to the store
*/
- public static void injectEntryInStore( Store<Entry, Long> store, Entry entry ) throws Exception
+ public static void injectEntryInStore( Store store, Entry entry, int idx ) throws Exception
{
entry.add( SchemaConstants.ENTRY_CSN_AT, CSN_FACTORY.newInstance().toString() );
- entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+ entry.add( SchemaConstants.ENTRY_UUID_AT, getUUIDString( idx ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
((Partition)store).add( addContext );
}
+
+ public static UUID getUUIDString( int idx )
+ {
+ /** UUID string */
+ UUID baseUUID = UUID.fromString( "00000000-0000-0000-0000-000000000000" );
+
+ long low = baseUUID.getLeastSignificantBits();
+ long high = baseUUID.getMostSignificantBits();
+ low = low + idx;
+
+ return new UUID( high, low );
+ }
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java Wed Nov 9 17:04:46 2011
@@ -164,21 +164,21 @@ public class AvlPartitionTest
avlPartition.setSyncOnWrite( true ); // for code coverage
assertNull( avlPartition.getAliasIndex() );
- avlPartition.addIndex( new AvlIndex<String, Entry>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<String>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
assertNotNull( avlPartition.getAliasIndex() );
assertEquals( 0, avlPartition.getCacheSize() );
assertNull( avlPartition.getPresenceIndex() );
- avlPartition.addIndex( new AvlIndex<String, Entry>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<String>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) );
assertNotNull( avlPartition.getPresenceIndex() );
assertNull( avlPartition.getOneLevelIndex() );
- avlPartition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
assertNotNull( avlPartition.getOneLevelIndex() );
assertNull( avlPartition.getSubLevelIndex() );
- avlPartition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
assertNotNull( avlPartition.getSubLevelIndex() );
assertNull( avlPartition.getId() );
@@ -190,11 +190,11 @@ public class AvlPartitionTest
assertNotNull( avlPartition.getRdnIndex() );
assertNull( avlPartition.getOneAliasIndex() );
- avlPartition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
assertNotNull( avlPartition.getOneAliasIndex() );
assertNull( avlPartition.getSubAliasIndex() );
- avlPartition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) );
+ avlPartition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) );
assertNotNull( avlPartition.getSubAliasIndex() );
assertNull( avlPartition.getSuffixDn() );
@@ -204,7 +204,7 @@ public class AvlPartitionTest
assertNotNull( avlPartition.getSuffixDn() );
assertFalse( avlPartition.getUserIndices().hasNext() );
- avlPartition.addIndex( new AvlIndex<Object, Entry>( "2.5.4.3" ) );
+ avlPartition.addIndex( new AvlIndex<Object>( "2.5.4.3" ) );
assertTrue( avlPartition.getUserIndices().hasNext() );
assertNull( avlPartition.getPartitionPath() );
@@ -228,7 +228,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<String, Entry>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
+ partition.addIndex( new AvlIndex<String>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -240,7 +240,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<String, Entry>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) );
+ partition.addIndex( new AvlIndex<String>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -251,7 +251,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
+ partition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -262,7 +262,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
+ partition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -296,7 +296,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
+ partition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -307,7 +307,7 @@ public class AvlPartitionTest
try
{
- partition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) );
+ partition.addIndex( new AvlIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) );
//fail();
}
catch ( IllegalStateException e )
@@ -398,34 +398,34 @@ public class AvlPartitionTest
public void testFreshStore() throws Exception
{
Dn dn = new Dn( schemaManager, "o=Good Times Co." );
- assertEquals( 1L, ( long ) partition.getEntryId( dn ) );
+ assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000001" ), partition.getEntryId( dn ) );
assertEquals( 11, partition.count() );
// note that the suffix entry returns 0 for it's parent which does not exist
- assertEquals( 0L, ( long ) partition.getParentId( partition.getEntryId( dn ) ) );
- assertNull( partition.getParentId( 0L ) );
+ assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000000" ), partition.getParentId( partition.getEntryId( dn ) ) );
+ assertNull( partition.getParentId( UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
// should be allowed
- partition.delete( 1L );
+ partition.delete( UUID.fromString( "00000000-0000-0000-0000-000000000001" ) );
}
@Test
public void testEntryOperations() throws Exception
{
- assertEquals( 3, partition.getChildCount( 1L ) );
+ assertEquals( 3, partition.getChildCount( UUID.fromString( "00000000-0000-0000-0000-000000000001" ) ) );
- Cursor<IndexEntry<Long, Long>> cursor = partition.list( 1L );
+ Cursor<IndexEntry<UUID>> cursor = partition.list( UUID.fromString( "00000000-0000-0000-0000-000000000001" ) );
assertNotNull( cursor );
cursor.beforeFirst();
assertTrue( cursor.next() );
- assertEquals( 2L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 2 ), cursor.get().getId() );
assertTrue( cursor.next() );
- assertEquals( 3, partition.getChildCount( 1L ) );
+ assertEquals( 3, partition.getChildCount( StoreUtils.getUUIDString( 1 ) ) );
- partition.delete( 2L );
+ partition.delete( StoreUtils.getUUIDString( 2 ) );
- assertEquals( 2, partition.getChildCount( 1L ) );
+ assertEquals( 2, partition.getChildCount( StoreUtils.getUUIDString( 1 ) ) );
assertEquals( 10, partition.count() );
// add an alias and delete to test dropAliasIndices method
@@ -436,12 +436,12 @@ public class AvlPartitionTest
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.add( "entryUUID", StoreUtils.getUUIDString( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
- partition.delete( 12L );
+ partition.delete( StoreUtils.getUUIDString( 12 ) );
}
@@ -452,28 +452,28 @@ public class AvlPartitionTest
assertEquals( 19, idx.count() );
- Cursor<IndexEntry<Long, Long>> cursor = idx.forwardCursor( 2L );
+ Cursor<IndexEntry<UUID>> cursor = idx.forwardCursor( StoreUtils.getUUIDString( 2 ) );
assertTrue( cursor.next() );
- assertEquals( 2, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 2 ), cursor.get().getId() );
assertTrue( cursor.next() );
- assertEquals( 5, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertTrue( cursor.next() );
- assertEquals( 6, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertFalse( cursor.next() );
- idx.drop( 5L );
+ idx.drop( StoreUtils.getUUIDString( 5 ) );
- cursor = idx.forwardCursor( 2L );
+ cursor = idx.forwardCursor( StoreUtils.getUUIDString( 2 ) );
assertTrue( cursor.next() );
- assertEquals( 2, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 2 ), cursor.get().getId() );
assertTrue( cursor.next() );
- assertEquals( 6, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertFalse( cursor.next() );
@@ -484,25 +484,25 @@ public class AvlPartitionTest
entry.add( "ou", "Sales" );
entry.add( "cn", "Martin King" );
entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- entry.add( "entryUUID", UUID.randomUUID().toString() );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
- cursor = idx.forwardCursor( 2L );
+ cursor = idx.forwardCursor( StoreUtils.getUUIDString( 2 ) );
cursor.afterLast();
assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 12 ), cursor.get().getId() );
Dn newParentDn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
Dn newDn = newParentDn.add( martinDn.getRdn() );
partition.move( martinDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
- cursor = idx.forwardCursor( 3L );
+ cursor = idx.forwardCursor( StoreUtils.getUUIDString( 3 ) );
cursor.afterLast();
assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 12 ), cursor.get().getId() );
// dn id 13
Dn marketingDn = new Dn( schemaManager, "ou=Marketing,ou=Sales,o=Good Times Co." );
@@ -510,7 +510,7 @@ public class AvlPartitionTest
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Marketing" );
entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- entry.add( "entryUUID", UUID.randomUUID().toString() );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 13 ).toString() );
addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -522,7 +522,7 @@ public class AvlPartitionTest
entry.add( "ou", "Marketing" );
entry.add( "cn", "Jimmy Wales" );
entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- entry.add( "entryUUID", UUID.randomUUID().toString() );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 14 ).toString() );
addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -530,29 +530,29 @@ public class AvlPartitionTest
newDn = newParentDn.add( marketingDn.getRdn() );
partition.move( marketingDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
- cursor = idx.forwardCursor( 3L );
+ cursor = idx.forwardCursor( StoreUtils.getUUIDString( 3 ) );
cursor.afterLast();
assertTrue( cursor.previous() );
- assertEquals( 14, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 14 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 13, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 13 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 12 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 10, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 10 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 9, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 9 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 7, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertTrue( cursor.previous() );
- assertEquals( 3, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 3 ), cursor.get().getId() );
assertFalse( cursor.previous() );
}
@@ -580,6 +580,7 @@ public class AvlPartitionTest
entry.add( "objectClass", "top", "person", "organizationalPerson" );
entry.add( "ou", "Not Present" );
entry.add( "cn", "Martin King" );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 15 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -593,6 +594,7 @@ public class AvlPartitionTest
DefaultEntry entry = new DefaultEntry( schemaManager, dn );
entry.add( "ou", "Sales" );
entry.add( "cn", "Martin King" );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 16 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -622,7 +624,7 @@ public class AvlPartitionTest
entry.add( "ou", "Engineering" );
entry.add( "cn", "Private Ryan" );
entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- entry.add( "entryUUID", UUID.randomUUID().toString() );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 17 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -642,7 +644,7 @@ public class AvlPartitionTest
entry.add( "ou", "Engineering" );
entry.add( "cn", "Private Ryan" );
entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- entry.add( "entryUUID", UUID.randomUUID().toString() );
+ entry.add( "entryUUID", StoreUtils.getUUIDString( 18 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
@@ -652,7 +654,7 @@ public class AvlPartitionTest
partition.rename( dn, rdn, true, null );
Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
- Long id = partition.getEntryId( dn2 );
+ UUID id = partition.getEntryId( dn2 );
assertNotNull( id );
Entry entry2 = partition.lookup( id );
assertEquals( "ja+es", entry2.get( "sn" ).getString() );
@@ -668,7 +670,7 @@ public class AvlPartitionTest
childEntry.add( "ou", "Engineering" );
childEntry.add( "cn", "Private Ryan" );
childEntry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- childEntry.add( "entryUUID", UUID.randomUUID().toString() );
+ childEntry.add( "entryUUID", StoreUtils.getUUIDString( 19 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, childEntry );
partition.add( addContext );
@@ -777,7 +779,7 @@ public class AvlPartitionTest
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.add( "entryUUID", StoreUtils.getUUIDString( 20 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java Wed Nov 9 17:04:46 2011
@@ -32,6 +32,7 @@ import org.apache.directory.server.const
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
import org.apache.directory.server.core.api.partition.index.ParentIdAndRdn;
+import org.apache.directory.server.xdbm.StoreUtils;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.name.Rdn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -55,7 +56,7 @@ import org.junit.Test;
public class AvlRdnIndexTest
{
private static File dbFileDir;
- Index<ParentIdAndRdn<Long>, Long, Long> idx;
+ Index<ParentIdAndRdn> idx;
private static SchemaManager schemaManager;
@@ -186,23 +187,23 @@ public class AvlRdnIndexTest
initIndex();
assertEquals( 0, idx.count() );
- ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+ ParentIdAndRdn key = new ParentIdAndRdn( StoreUtils.getUUIDString( 0 ), new Rdn( "cn=key" ) );
- idx.add( key, 0l );
+ idx.add( key, StoreUtils.getUUIDString( 0 ) );
assertEquals( 1, idx.count() );
// setting a different parentId should make this key a different key
- key = new ParentIdAndRdn<Long>( 1L, new Rdn( "cn=key" ) );
+ key = new ParentIdAndRdn( StoreUtils.getUUIDString( 1 ), new Rdn( "cn=key" ) );
- idx.add( key, 1l );
+ idx.add( key, StoreUtils.getUUIDString( 1 ) );
assertEquals( 2, idx.count() );
//count shouldn't get affected cause of inserting the same key
- idx.add( key, 2l );
+ idx.add( key, StoreUtils.getUUIDString( 2 ) );
assertEquals( 2, idx.count() );
- key = new ParentIdAndRdn<Long>( 2L, new Rdn( "cn=key" ) );
- idx.add( key, 3l );
+ key = new ParentIdAndRdn( StoreUtils.getUUIDString( 2 ), new Rdn( "cn=key" ) );
+ idx.add( key, StoreUtils.getUUIDString( 3 ) );
assertEquals( 3, idx.count() );
}
@@ -212,11 +213,11 @@ public class AvlRdnIndexTest
{
initIndex();
- ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+ ParentIdAndRdn key = new ParentIdAndRdn( StoreUtils.getUUIDString( 0 ), new Rdn( "cn=key" ) );
assertEquals( 0, idx.count( key ) );
- idx.add( key, 0l );
+ idx.add( key, StoreUtils.getUUIDString( 0 ) );
assertEquals( 1, idx.count( key ) );
}
@@ -230,13 +231,13 @@ public class AvlRdnIndexTest
{
initIndex();
- ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+ ParentIdAndRdn key = new ParentIdAndRdn( StoreUtils.getUUIDString( 0 ), new Rdn( "cn=key" ) );
assertNull( idx.forwardLookup( key ) );
- idx.add( key, 0l );
- assertEquals( 0, ( long ) idx.forwardLookup( key ) );
- assertEquals( key, idx.reverseLookup( 0l ) );
+ idx.add( key, StoreUtils.getUUIDString( 1 ) );
+ assertEquals( StoreUtils.getUUIDString( 1 ), idx.forwardLookup( key ) );
+ assertEquals( key, idx.reverseLookup( StoreUtils.getUUIDString( 1 ) ) );
}
@@ -245,17 +246,17 @@ public class AvlRdnIndexTest
{
initIndex();
- ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+ ParentIdAndRdn key = new ParentIdAndRdn( StoreUtils.getUUIDString( 0 ), new Rdn( "cn=key" ) );
assertNull( idx.forwardLookup( key ) );
// test add/drop without adding any duplicates
- idx.add( key, 0l );
- assertEquals( 0, ( long ) idx.forwardLookup( key ) );
+ idx.add( key, StoreUtils.getUUIDString( 1 ) );
+ assertEquals( StoreUtils.getUUIDString( 1 ), idx.forwardLookup( key ) );
- idx.drop( key, 0l );
+ idx.drop( key, StoreUtils.getUUIDString( 1 ) );
assertNull( idx.forwardLookup( key ) );
- assertNull( idx.reverseLookup( 0l ) );
+ assertNull( idx.reverseLookup( StoreUtils.getUUIDString( 1 ) ) );
}
@@ -268,43 +269,43 @@ public class AvlRdnIndexTest
{
initIndex();
- ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+ ParentIdAndRdn key = new ParentIdAndRdn( StoreUtils.getUUIDString( 0 ), new Rdn( "cn=key" ) );
assertEquals( 0, idx.count() );
- idx.add( key, 0l );
+ idx.add( key, StoreUtils.getUUIDString( 0 ) );
assertEquals( 1, idx.count() );
for ( long i = 1; i < 5; i++ )
{
- key = new ParentIdAndRdn<Long>( i, new Rdn( "cn=key" + i ) );
+ key = new ParentIdAndRdn( StoreUtils.getUUIDString( ( int )i ), new Rdn( "cn=key" + i ) );
- idx.add( key, ( long ) i );
+ idx.add( key, StoreUtils.getUUIDString( ( int ) i ) );
}
assertEquals( 5, idx.count() );
// use forward index's cursor
- Cursor<IndexEntry<ParentIdAndRdn<Long>, Long>> cursor = idx.forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn>> cursor = idx.forwardCursor();
cursor.beforeFirst();
cursor.next();
- IndexEntry<ParentIdAndRdn<Long>, Long> e1 = cursor.get();
- assertEquals( 0, ( long ) e1.getId() );
+ IndexEntry<ParentIdAndRdn> e1 = cursor.get();
+ assertEquals( StoreUtils.getUUIDString( 0 ), e1.getId() );
assertEquals( "cn=key", e1.getValue().getRdns()[0].getName() );
- assertEquals( 0, e1.getValue().getParentId().longValue() );
+ assertEquals( StoreUtils.getUUIDString( 0 ), e1.getValue().getParentId() );
cursor.next();
- IndexEntry<ParentIdAndRdn<Long>, Long> e2 = cursor.get();
- assertEquals( 1, ( long ) e2.getId() );
+ IndexEntry<ParentIdAndRdn> e2 = cursor.get();
+ assertEquals( StoreUtils.getUUIDString( 1 ), e2.getId() );
assertEquals( "cn=key1", e2.getValue().getRdns()[0].getName() );
- assertEquals( 1, e2.getValue().getParentId().longValue() );
+ assertEquals( StoreUtils.getUUIDString( 1 ), e2.getValue().getParentId() );
cursor.next();
- IndexEntry<ParentIdAndRdn<Long>, Long> e3 = cursor.get();
- assertEquals( 2, ( long ) e3.getId() );
+ IndexEntry<ParentIdAndRdn> e3 = cursor.get();
+ assertEquals( StoreUtils.getUUIDString( 2 ), e3.getId() );
assertEquals( "cn=key2", e3.getValue().getRdns()[0].getName() );
- assertEquals( 2, e3.getValue().getParentId().longValue() );
+ assertEquals( StoreUtils.getUUIDString( 2 ), e3.getValue().getParentId() );
}
// @Test
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Wed Nov 9 17:04:46 2011
@@ -72,7 +72,7 @@ public class AndCursorTest
private static final Logger LOG = LoggerFactory.getLogger( AndCursorTest.class.getSimpleName() );
File wkdir;
- Store<Entry, Long> store;
+ Store store;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
private static SchemaManager schemaManager;
@@ -175,23 +175,23 @@ public class AndCursorTest
ExprNode exprNode = FilterParser.parse(schemaManager, filter);
- IndexCursor<?, Entry, Long> cursor = cursorBuilder.build( exprNode );
+ IndexCursor<?> cursor = cursorBuilder.build( exprNode );
cursor.beforeFirst();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 6, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 5, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -207,12 +207,12 @@ public class AndCursorTest
{
AndNode andNode = new AndNode();
- List<Evaluator<? extends ExprNode, Entry, Long>> evaluators = new ArrayList<Evaluator<? extends ExprNode, Entry, Long>>();
- Evaluator<? extends ExprNode, Entry, Long> eval;
+ List<Evaluator<? extends ExprNode>> evaluators = new ArrayList<Evaluator<? extends ExprNode>>();
+ Evaluator<? extends ExprNode> eval;
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
eval = new SubstringEvaluator( (SubstringNode) exprNode, store, schemaManager );
- IndexCursor<?, Entry, Long> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+ IndexCursor<?> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
/* adding this results in NPE adding Presence evaluator not
Substring evaluator but adding Substring cursor as wrapped cursor */
@@ -226,25 +226,25 @@ public class AndCursorTest
andNode.addNode( exprNode );
- IndexCursor<?, Entry, Long> cursor = new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode );
+ IndexCursor<?> cursor = new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode );
cursor.beforeFirst();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
cursor.first();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 6, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 5, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -254,19 +254,19 @@ public class AndCursorTest
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 5, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
cursor.last();
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 6, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 8, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
assertFalse( cursor.previous() );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Wed Nov 9 17:04:46 2011
@@ -79,7 +79,7 @@ public class GreaterEqTest
public static final Logger LOG = LoggerFactory.getLogger( GreaterEqTest.class );
File wkdir;
- Store<Entry, Long> store;
+ Store store;
static SchemaManager schemaManager = null;
@@ -169,7 +169,7 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- GreaterEqCursor<String, Long> cursor = new GreaterEqCursor<String, Long>( store, evaluator );
+ GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -192,22 +192,22 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 6L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "4", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -222,22 +222,22 @@ public class GreaterEqTest
cursor.first();
assertTrue( cursor.available() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 6L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "4", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -254,22 +254,22 @@ public class GreaterEqTest
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 6L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "4", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
assertFalse( cursor.previous() );
@@ -284,22 +284,22 @@ public class GreaterEqTest
cursor.last();
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 6L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 6 ), cursor.get().getId() );
assertEquals( "4", cursor.get().getValue() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
assertFalse( cursor.previous() );
@@ -310,7 +310,7 @@ public class GreaterEqTest
// ---------- test before() ----------
cursor = new GreaterEqCursor( store, evaluator );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "5" );
assertFalse( cursor.available() );
@@ -319,12 +319,12 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -333,29 +333,29 @@ public class GreaterEqTest
assertTrue( cursor.isClosed() );
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
cursor.close();
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.next() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
cursor.close();
// ---------- test after() ----------
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "4" );
assertFalse( cursor.available() );
@@ -364,12 +364,12 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 7L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 7 ), cursor.get().getId() );
assertEquals( "5", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
assertFalse( cursor.next() );
@@ -378,22 +378,22 @@ public class GreaterEqTest
assertTrue( cursor.isClosed() );
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
- assertEquals( 8L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 8 ), cursor.get().getId() );
assertEquals( "6", cursor.get().getValue() );
cursor.close();
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( StoreUtils.getUUIDString( 5 ), cursor.get().getId() );
assertEquals( "3", cursor.get().getValue() );
cursor.close();
}
@@ -405,7 +405,7 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- GreaterEqCursor<String, Long> cursor = new GreaterEqCursor<String, Long>( store, evaluator );
+ GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -423,20 +423,20 @@ public class GreaterEqTest
// ---------- test beforeFirst() ----------
- Set<Tuple<String, Long>> set = new HashSet<Tuple<String, Long>>();
+ Set<Tuple<String, UUID>> set = new HashSet<Tuple<String, UUID>>();
cursor.beforeFirst();
assertFalse( cursor.available() );
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
- assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "4", 6L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "5", 7L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "6", 8L ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "3", StoreUtils.getUUIDString( 5 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "4", StoreUtils.getUUIDString( 6 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "5", StoreUtils.getUUIDString( 7 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "6", StoreUtils.getUUIDString( 8 ) ) ) );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -451,18 +451,18 @@ public class GreaterEqTest
cursor.first();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
- assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "4", 6L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "5", 7L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "6", 8L ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "3", StoreUtils.getUUIDString( 5 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "4", StoreUtils.getUUIDString( 6 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "5", StoreUtils.getUUIDString( 7 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "6", StoreUtils.getUUIDString( 8 ) ) ) );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -480,13 +480,13 @@ public class GreaterEqTest
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
- assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "4", 6L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "5", 7L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "6", 8L ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "3", StoreUtils.getUUIDString( 5 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "4", StoreUtils.getUUIDString( 6 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "5", StoreUtils.getUUIDString( 7 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "6", StoreUtils.getUUIDString( 8 ) ) ) );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -498,18 +498,18 @@ public class GreaterEqTest
cursor.last();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, UUID>( cursor.get().getValue(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
- assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "4", 6L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "5", 7L ) ) );
- assertTrue( set.contains( new Tuple<String, Long>( "6", 8L ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "3", StoreUtils.getUUIDString( 5 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "4", StoreUtils.getUUIDString( 6 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "5", StoreUtils.getUUIDString( 7 ) ) ) );
+ assertTrue( set.contains( new Tuple<String, UUID>( "6", StoreUtils.getUUIDString( 8 ) ) ) );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -517,7 +517,7 @@ public class GreaterEqTest
// ---------- test before() ----------
cursor = new GreaterEqCursor( store, evaluator );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
{
@@ -531,7 +531,7 @@ public class GreaterEqTest
// ---------- test after() ----------
cursor = new GreaterEqCursor( store, evaluator );
- indexEntry = new ForwardIndexEntry<String, Long>();
+ indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
{
@@ -554,41 +554,41 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
assertNotNull( evaluator.getNormalizer() );
assertNotNull( evaluator.getComparator() );
- indexEntry.setId( 1L );
+ indexEntry.setId( StoreUtils.getUUIDString( 1 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 4L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 4 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 5L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 5 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 6L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 6 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 7L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 7 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 8L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 8 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 9L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 9 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 10L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 10 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
}
@@ -599,7 +599,7 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "2" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
assertNotNull( evaluator.getNormalizer() );
@@ -612,12 +612,12 @@ public class GreaterEqTest
attrs.add( "cn", "jane doe" );
attrs.add( "sn", "doe" );
attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
- attrs.add( "entryUUID", UUID.randomUUID().toString() );
+ attrs.add( "entryUUID", StoreUtils.getUUIDString( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, attrs );
((Partition)store).add( addContext );
- indexEntry.setId( 12L );
+ indexEntry.setId( StoreUtils.getUUIDString( 12 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
}
@@ -629,13 +629,13 @@ public class GreaterEqTest
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "2" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
assertNotNull( evaluator.getNormalizer() );
assertNotNull( evaluator.getComparator() );
- indexEntry.setId( 1L );
+ indexEntry.setId( StoreUtils.getUUIDString( 1 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
}
@@ -647,41 +647,41 @@ public class GreaterEqTest
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+ ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
assertNotNull( evaluator.getNormalizer() );
assertNotNull( evaluator.getComparator() );
- indexEntry.setId( 1L );
+ indexEntry.setId( StoreUtils.getUUIDString( 1 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 4L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 4 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 5L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 5 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 6L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 6 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 7L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 7 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 8L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 8 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 9L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 9 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 10L );
+ indexEntry = new ForwardIndexEntry<String>();
+ indexEntry.setId( StoreUtils.getUUIDString( 10 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
}