directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1378574 [4/6] - in /directory/apacheds/branches/apacheds-mvbt/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...
Date Wed, 29 Aug 2012 14:23:11 GMT
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java Wed Aug 29 14:23:08 2012
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
@@ -40,6 +41,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -56,7 +58,7 @@ import org.junit.Test;
 public class AvlRdnIndexTest
 {
     private static File dbFileDir;
-    Index<ParentIdAndRdn<Long>, Entry, Long> idx;
+    Index<ParentIdAndRdn<UUID>, Entry, UUID> idx;
     private static SchemaManager schemaManager;
 
 
@@ -187,23 +189,23 @@ public class AvlRdnIndexTest
         initIndex();
         assertEquals( 0, idx.count() );
 
-        ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+        ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );
 
-        idx.add( key, 0l );
+        idx.add( key, Strings.getUUID( 0L ) );
         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<UUID>( Strings.getUUID( 1L ), new Rdn( "cn=key" ) );
 
-        idx.add( key, 1l );
+        idx.add( key, Strings.getUUID( 1L ) );
         assertEquals( 2, idx.count() );
 
         //count shouldn't get affected cause of inserting the same key
-        idx.add( key, 2l );
+        idx.add( key, Strings.getUUID( 2L ) );
         assertEquals( 2, idx.count() );
 
-        key = new ParentIdAndRdn<Long>( 2L, new Rdn( "cn=key" ) );
-        idx.add( key, 3l );
+        key = new ParentIdAndRdn<UUID>( Strings.getUUID( 2L ), new Rdn( "cn=key" ) );
+        idx.add( key, Strings.getUUID( 3L ) );
         assertEquals( 3, idx.count() );
     }
 
@@ -213,11 +215,11 @@ public class AvlRdnIndexTest
     {
         initIndex();
 
-        ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+        ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );
 
         assertEquals( 0, idx.count( key ) );
 
-        idx.add( key, 0l );
+        idx.add( key, Strings.getUUID( 0L ) );
         assertEquals( 1, idx.count( key ) );
     }
 
@@ -231,13 +233,13 @@ public class AvlRdnIndexTest
     {
         initIndex();
 
-        ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+        ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Strings.getUUID( 0L ), 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, Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( key ) );
+        assertEquals( key, idx.reverseLookup( Strings.getUUID( 0L ) ) );
     }
 
 
@@ -246,17 +248,17 @@ public class AvlRdnIndexTest
     {
         initIndex();
 
-        ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+        ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Strings.getUUID( 0L ), 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, Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( key ) );
 
-        idx.drop( key, 0l );
+        idx.drop( key, Strings.getUUID( 0L ) );
         assertNull( idx.forwardLookup( key ) );
-        assertNull( idx.reverseLookup( 0l ) );
+        assertNull( idx.reverseLookup( Strings.getUUID( 0L ) ) );
     }
 
 
@@ -269,43 +271,43 @@ public class AvlRdnIndexTest
     {
         initIndex();
 
-        ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
+        ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );
 
         assertEquals( 0, idx.count() );
 
-        idx.add( key, 0l );
+        idx.add( key, Strings.getUUID( 0L ) );
         assertEquals( 1, idx.count() );
 
         for ( long i = 1; i < 5; i++ )
         {
-            key = new ParentIdAndRdn<Long>( i, new Rdn( "cn=key" + i ) );
+            key = new ParentIdAndRdn<UUID>( Strings.getUUID( i ), new Rdn( "cn=key" + i ) );
 
-            idx.add( key, i );
+            idx.add( key, Strings.getUUID( i ) );
         }
 
         assertEquals( 5, idx.count() );
 
         // use forward index's cursor
-        Cursor<IndexEntry<ParentIdAndRdn<Long>, Long>> cursor = idx.forwardCursor();
+        Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = idx.forwardCursor();
         cursor.beforeFirst();
 
         cursor.next();
-        IndexEntry<ParentIdAndRdn<Long>, Long> e1 = cursor.get();
-        assertEquals( 0, ( long ) e1.getId() );
+        IndexEntry<ParentIdAndRdn<UUID>, UUID> e1 = cursor.get();
+        assertEquals( Strings.getUUID( 0L ), e1.getId() );
         assertEquals( "cn=key", e1.getKey().getRdns()[0].getName() );
-        assertEquals( 0, e1.getKey().getParentId().longValue() );
+        assertEquals( Strings.getUUID( 0L ), e1.getKey().getParentId() );
 
         cursor.next();
-        IndexEntry<ParentIdAndRdn<Long>, Long> e2 = cursor.get();
-        assertEquals( 1, ( long ) e2.getId() );
+        IndexEntry<ParentIdAndRdn<UUID>, UUID> e2 = cursor.get();
+        assertEquals( Strings.getUUID( 1L ), e2.getId() );
         assertEquals( "cn=key1", e2.getKey().getRdns()[0].getName() );
-        assertEquals( 1, e2.getKey().getParentId().longValue() );
+        assertEquals( Strings.getUUID( 1L ), e2.getKey().getParentId() );
 
         cursor.next();
-        IndexEntry<ParentIdAndRdn<Long>, Long> e3 = cursor.get();
-        assertEquals( 2, ( long ) e3.getId() );
+        IndexEntry<ParentIdAndRdn<UUID>, UUID> e3 = cursor.get();
+        assertEquals( Strings.getUUID( 2L ), e3.getId() );
         assertEquals( "cn=key2", e3.getKey().getRdns()[0].getName() );
-        assertEquals( 2, e3.getKey().getParentId().longValue() );
+        assertEquals( Strings.getUUID( 2L ), e3.getKey().getParentId() );
 
         cursor.close();
     }

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Wed Aug 29 14:23:08 2012
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.api.partition.Partition;
@@ -57,6 +58,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -77,7 +79,7 @@ public class AndCursorTest
     private static final Logger LOG = LoggerFactory.getLogger( AndCursorTest.class.getSimpleName() );
 
     File wkdir;
-    Store<Entry, Long> store;
+    Store<Entry> store;
     EvaluatorBuilder evaluatorBuilder;
     CursorBuilder cursorBuilder;
     private static SchemaManager schemaManager;
@@ -180,23 +182,23 @@ public class AndCursorTest
 
         ExprNode exprNode = FilterParser.parse( schemaManager, filter );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
 
         cursor.beforeFirst();
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8 ), cursor.get().getId() );
         assertEquals( "jack daniels", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 6, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6 ), cursor.get().getId() );
         assertEquals( "jim bean", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5 ), cursor.get().getId() );
         assertEquals( "johnny walker", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -212,12 +214,12 @@ public class AndCursorTest
     {
         AndNode andNode = new AndNode();
 
-        List<Evaluator<? extends ExprNode, Long>> evaluators = new ArrayList<Evaluator<? extends ExprNode, Long>>();
-        Evaluator<? extends ExprNode, 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 );
-        Cursor<IndexEntry<?, Long>> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+        Cursor<IndexEntry<String, UUID>> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
 
         /* adding this results in NPE  adding Presence evaluator not 
          Substring evaluator but adding Substring cursor as wrapped cursor */
@@ -237,19 +239,19 @@ public class AndCursorTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8 ), cursor.get().getId() );
         assertEquals( "jack daniels", cursor.get().getKey() );
 
         cursor.first();
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 6, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6 ), cursor.get().getId() );
         assertEquals( "jim bean", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5 ), cursor.get().getId() );
         assertEquals( "johnny walker", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -259,19 +261,19 @@ public class AndCursorTest
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 5, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5 ), cursor.get().getId() );
         assertEquals( "johnny walker", cursor.get().getKey() );
 
         cursor.last();
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 6, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6 ), cursor.get().getId() );
         assertEquals( "jim bean", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 8, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8 ), cursor.get().getId() );
         assertEquals( "jack daniels", cursor.get().getKey() );
 
         assertFalse( cursor.previous() );

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Wed Aug 29 14:23:08 2012
@@ -63,6 +63,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -82,7 +83,7 @@ public class GreaterEqTest
     public static final Logger LOG = LoggerFactory.getLogger( GreaterEqTest.class );
 
     File wkdir;
-    Store<Entry, Long> store;
+    Store<Entry> store;
     static SchemaManager schemaManager = null;
 
 
@@ -172,7 +173,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() );
@@ -195,22 +196,22 @@ public class GreaterEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 6L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6L ), cursor.get().getId() );
         assertEquals( "4", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -225,22 +226,22 @@ public class GreaterEqTest
         cursor.first();
 
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 6L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6L ), cursor.get().getId() );
         assertEquals( "4", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -257,22 +258,22 @@ public class GreaterEqTest
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 6L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6L ), cursor.get().getId() );
         assertEquals( "4", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.previous() );
@@ -287,22 +288,22 @@ public class GreaterEqTest
         cursor.last();
 
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 6L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 6L ), cursor.get().getId() );
         assertEquals( "4", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.previous() );
@@ -313,7 +314,7 @@ public class GreaterEqTest
         // ---------- test before() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "5" );
 
         assertFalse( cursor.available() );
@@ -322,12 +323,12 @@ public class GreaterEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -336,29 +337,29 @@ public class GreaterEqTest
         assertTrue( cursor.isClosed() );
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "7" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
         cursor.close();
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "3" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.next() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
 
         // ---------- test after() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "4" );
 
         assertFalse( cursor.available() );
@@ -367,12 +368,12 @@ public class GreaterEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 7L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "5", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -381,22 +382,22 @@ public class GreaterEqTest
         assertTrue( cursor.isClosed() );
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "7" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 8L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 8L ), cursor.get().getId() );
         assertEquals( "6", cursor.get().getKey() );
         cursor.close();
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "3" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
     }
@@ -408,7 +409,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() );
@@ -426,20 +427,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().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), 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", Strings.getUUID( 5L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "4", Strings.getUUID( 6L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "5", Strings.getUUID( 7L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "6", Strings.getUUID( 8L ) ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -454,18 +455,18 @@ public class GreaterEqTest
         cursor.first();
 
         assertTrue( cursor.available() );
-        set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+        set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
 
         while ( cursor.next() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), 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", Strings.getUUID( 5L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "4", Strings.getUUID( 6L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "5", Strings.getUUID( 7L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "6", Strings.getUUID( 8L ) ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -483,13 +484,13 @@ public class GreaterEqTest
         while ( cursor.previous() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), 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", Strings.getUUID( 5L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "4", Strings.getUUID( 6L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "5", Strings.getUUID( 7L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "6", Strings.getUUID( 8L ) ) ) );
 
         assertFalse( cursor.previous() );
         assertFalse( cursor.available() );
@@ -503,18 +504,18 @@ public class GreaterEqTest
         cursor.last();
 
         assertTrue( cursor.available() );
-        set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+        set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
 
         while ( cursor.previous() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), 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", Strings.getUUID( 5L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "4", Strings.getUUID( 6L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "5", Strings.getUUID( 7L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "6", Strings.getUUID( 8L ) ) ) );
 
         assertFalse( cursor.previous() );
         assertFalse( cursor.available() );
@@ -524,9 +525,9 @@ public class GreaterEqTest
         // ---------- test before() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "2" );
-        
+
         try
         {
             cursor.before( indexEntry );
@@ -541,7 +542,7 @@ public class GreaterEqTest
         // ---------- test after() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "2" );
         try
         {
@@ -566,41 +567,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, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( Partition.DEFAULT_ID );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 4L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 4L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 5L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 5L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 6L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 6L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 7L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 7L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 8L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 8L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 9L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 9L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 10L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 10L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 
@@ -611,7 +612,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, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
@@ -624,12 +625,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", Strings.getUUID( 12L ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, attrs );
         ( ( Partition ) store ).add( addContext );
 
-        indexEntry.setId( 12L );
+        indexEntry.setId( new UUID( 0L, 12L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
     }
 
@@ -641,13 +642,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, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( Partition.DEFAULT_ID );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 
@@ -659,41 +660,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, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( new UUID( 0L, 1L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 4L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 4L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 5L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 5L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 6L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 6L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 7L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 7L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 8L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 8L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 9L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 9L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 10L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( new UUID( 0L, 10L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Wed Aug 29 14:23:08 2012
@@ -63,6 +63,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -82,7 +83,7 @@ public class LessEqTest
     public static final Logger LOG = LoggerFactory.getLogger( LessEqTest.class );
 
     File wkdir;
-    Store<Entry, Long> store;
+    Store<Entry> store;
     static SchemaManager schemaManager = null;
 
 
@@ -174,7 +175,7 @@ public class LessEqTest
         AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
         LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        LessEqCursor<String, Long> cursor = new LessEqCursor<String, Long>( store, evaluator );
+        LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator );
         assertNotNull( cursor );
         assertFalse( cursor.available() );
         assertFalse( cursor.isClosed() );
@@ -197,27 +198,27 @@ public class LessEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 1L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 1L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 2L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 2L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 3L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 3L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -232,27 +233,27 @@ public class LessEqTest
         cursor.first();
 
         assertTrue( cursor.available() );
-        assertEquals( 1L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 1L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 2L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 2L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 3L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 3L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -269,27 +270,27 @@ public class LessEqTest
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 3L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 3L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 2L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 2L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 1L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 1L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertFalse( cursor.previous() );
@@ -304,27 +305,27 @@ public class LessEqTest
         cursor.last();
 
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 3L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 3L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 2L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 2L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertTrue( cursor.previous() );
         assertTrue( cursor.available() );
-        assertEquals( 1L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 1L ), cursor.get().getId() );
         assertEquals( "1", cursor.get().getKey() );
 
         assertFalse( cursor.previous() );
@@ -335,7 +336,7 @@ public class LessEqTest
         // ---------- test before() ----------
 
         cursor = new LessEqCursor( store, evaluator );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "2" );
 
         assertFalse( cursor.available() );
@@ -344,12 +345,12 @@ public class LessEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -358,29 +359,29 @@ public class LessEqTest
         assertTrue( cursor.isClosed() );
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "7" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "3" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.next() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
 
         // ---------- test after() ----------
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "1" );
 
         assertFalse( cursor.available() );
@@ -389,12 +390,12 @@ public class LessEqTest
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 4L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 4L ), cursor.get().getId() );
         assertEquals( "2", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -403,22 +404,22 @@ public class LessEqTest
         assertTrue( cursor.isClosed() );
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "7" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "3" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
         assertTrue( cursor.previous() );
-        assertEquals( 5L, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "3", cursor.get().getKey() );
         cursor.close();
     }
@@ -430,7 +431,7 @@ public class LessEqTest
         AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
         LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        LessEqCursor<String, Long> cursor = new LessEqCursor<String, Long>( store, evaluator );
+        LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator );
         assertNotNull( cursor );
         assertFalse( cursor.available() );
         assertFalse( cursor.isClosed() );
@@ -447,22 +448,22 @@ public class LessEqTest
 
         // ---------- 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().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
         }
-        
+
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 1L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 2L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 3L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "2", 4L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 1L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 2L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 3L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "2", Strings.getUUID( 4L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "3", Strings.getUUID( 5L ) ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -476,20 +477,20 @@ public class LessEqTest
         cursor.first();
 
         assertTrue( cursor.available() );
-        set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+        set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
 
         while ( cursor.next() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
         }
-        
+
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 1L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 2L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 3L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "2", 4L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 1L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 2L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 3L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "2", Strings.getUUID( 4L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "3", Strings.getUUID( 5L ) ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -506,15 +507,15 @@ public class LessEqTest
         while ( cursor.previous() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
         }
-        
+
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 1L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 2L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 3L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "2", 4L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 1L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 2L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 3L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "2", Strings.getUUID( 4L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "3", Strings.getUUID( 5L ) ) ) );
 
         assertFalse( cursor.previous() );
         assertFalse( cursor.available() );
@@ -528,20 +529,20 @@ public class LessEqTest
         cursor.last();
 
         assertTrue( cursor.available() );
-        set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+        set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
 
         while ( cursor.previous() )
         {
             assertTrue( cursor.available() );
-            set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
+            set.add( new Tuple<String, UUID>( cursor.get().getKey(), cursor.get().getId() ) );
         }
-        
+
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 1L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 2L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "1", 3L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "2", 4L ) ) );
-        assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 1L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 2L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "1", Strings.getUUID( 3L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "2", Strings.getUUID( 4L ) ) ) );
+        assertTrue( set.contains( new Tuple<String, UUID>( "3", Strings.getUUID( 5L ) ) ) );
 
         assertFalse( cursor.previous() );
         assertFalse( cursor.available() );
@@ -551,9 +552,9 @@ public class LessEqTest
         // ---------- test before() ----------
 
         cursor = new LessEqCursor( store, evaluator );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "2" );
-        
+
         try
         {
             cursor.before( indexEntry );
@@ -568,7 +569,7 @@ public class LessEqTest
         // ---------- test after() ----------
 
         cursor = new LessEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String, Long>();
+        indexEntry = new ForwardIndexEntry<String, UUID>();
         indexEntry.setKey( "2" );
         try
         {
@@ -594,41 +595,41 @@ public class LessEqTest
         LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
 
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( Strings.getUUID( 1L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 4L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 4L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 5L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 5L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 6L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 6L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 7L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 7L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 8L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 8L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 9L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 9L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 10L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 10L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 
@@ -640,7 +641,7 @@ public class LessEqTest
         LessEqNode node = new LessEqNode( at, new StringValue( at, "2" ) );
 
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
@@ -653,12 +654,12 @@ public class LessEqTest
         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", Strings.getUUID( 12L ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, attrs );
         ( ( Partition ) store ).add( addContext );
 
-        indexEntry.setId( 12L );
+        indexEntry.setId( Strings.getUUID( 12L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
     }
 
@@ -670,13 +671,13 @@ public class LessEqTest
         LessEqNode node = new LessEqNode( at, new StringValue( at, "2" ) );
 
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( Strings.getUUID( 1L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 
@@ -688,41 +689,41 @@ public class LessEqTest
         LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
 
         LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
-        ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
+        ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
-        indexEntry.setId( 1L );
+        indexEntry.setId( Strings.getUUID( 1L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 4L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 4L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 5L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 5L ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 6L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 6L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 7L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 7L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 8L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 8L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 9L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 9L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String, Long>();
-        indexEntry.setId( 10L );
+        indexEntry = new ForwardIndexEntry<String, UUID>();
+        indexEntry.setId( Strings.getUUID( 10L ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Wed Aug 29 14:23:08 2012
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.api.partition.Partition;
@@ -51,6 +52,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -71,7 +73,7 @@ public class NestedFilterTest
     private static final Logger LOG = LoggerFactory.getLogger( NestedFilterTest.class.getSimpleName() );
 
     File wkdir;
-    Store<Entry, Long> store;
+    Store<Entry> store;
     static SchemaManager schemaManager = null;
     EvaluatorBuilder evaluatorBuilder;
     CursorBuilder cursorBuilder;
@@ -176,21 +178,21 @@ public class NestedFilterTest
         exprNode.accept( visitor );
         optimizer.annotate( exprNode );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "walker", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 7, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 7L ), cursor.get().getId() );
         assertEquals( "apache", cursor.get().getKey() );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 9, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 9L ), cursor.get().getId() );
         assertEquals( "apache", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -206,11 +208,11 @@ public class NestedFilterTest
         ExprNode exprNode = FilterParser.parse( schemaManager, filter );
         optimizer.annotate( exprNode );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
 
         assertTrue( cursor.next() );
         assertTrue( cursor.available() );
-        assertEquals( 5, ( long ) cursor.get().getId() );
+        assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
         assertEquals( "walker", cursor.get().getKey() );
 
         assertFalse( cursor.next() );
@@ -228,20 +230,23 @@ public class NestedFilterTest
         ExprNode exprNode = FilterParser.parse( schemaManager, filter );
         optimizer.annotate( exprNode );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
 
-        Set<Long> set = new HashSet<Long>();
+        Set<UUID> set = new HashSet<UUID>();
 
         while ( cursor.next() )
         {
             assertTrue( cursor.available() );
-            set.add( cursor.get().getId() );
-            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
+
+            IndexEntry<?, UUID> elem = cursor.get();
+
+            set.add( elem.getId() );
+            assertTrue( uuidSynChecker.isValidSyntax( elem.getKey() ) );
         }
 
         assertEquals( 2, set.size() );
-        assertTrue( set.contains( 7L ) );
-        assertTrue( set.contains( 8L ) );
+        assertTrue( set.contains( Strings.getUUID( 7L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 8L ) ) );
 
         assertFalse( cursor.next() );
         cursor.close();
@@ -256,7 +261,7 @@ public class NestedFilterTest
         ExprNode exprNode = FilterParser.parse( schemaManager, filter );
         optimizer.annotate( exprNode );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
         cursor.close();
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Wed Aug 29 14:23:08 2012
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.api.partition.Partition;
@@ -55,6 +56,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -77,7 +79,7 @@ public class NotCursorTest
     UuidSyntaxChecker uuidSynChecker = new UuidSyntaxChecker();
 
     File wkdir;
-    Store<Entry, Long> store;
+    Store<Entry> store;
     static SchemaManager schemaManager = null;
     EvaluatorBuilder evaluatorBuilder;
     CursorBuilder cursorBuilder;
@@ -176,13 +178,13 @@ public class NotCursorTest
 
         ExprNode exprNode = FilterParser.parse( schemaManager, filter );
 
-        Cursor<IndexEntry<?, Long>> cursor = cursorBuilder.build( exprNode );
+        Cursor<IndexEntry<?, UUID>> cursor = cursorBuilder.build( exprNode );
 
         assertFalse( cursor.available() );
 
         cursor.beforeFirst();
 
-        Set<Long> set = new HashSet<Long>();
+        Set<UUID> set = new HashSet<UUID>();
 
         while ( cursor.next() )
         {
@@ -192,11 +194,11 @@ public class NotCursorTest
         }
 
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( 1L ) );
-        assertTrue( set.contains( 2L ) );
-        assertTrue( set.contains( 3L ) );
-        assertTrue( set.contains( 4L ) );
-        assertTrue( set.contains( 7L ) );
+        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 7L ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -212,14 +214,14 @@ public class NotCursorTest
         NotNode notNode = new NotNode();
 
         ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
-        Evaluator<? extends ExprNode, Long> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
+        Evaluator<? extends ExprNode> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
             schemaManager );
         notNode.addNode( exprNode );
 
-        NotCursor<String, Long> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
+        NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
         cursor.beforeFirst();
 
-        Set<Long> set = new HashSet<Long>();
+        Set<UUID> set = new HashSet<UUID>();
 
         while ( cursor.next() )
         {
@@ -229,11 +231,11 @@ public class NotCursorTest
         }
 
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( 1L ) );
-        assertTrue( set.contains( 2L ) );
-        assertTrue( set.contains( 3L ) );
-        assertTrue( set.contains( 4L ) );
-        assertTrue( set.contains( 7L ) );
+        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 7L ) ) );
 
         assertFalse( cursor.next() );
         assertFalse( cursor.available() );
@@ -250,11 +252,11 @@ public class NotCursorTest
         }
 
         assertEquals( 5, set.size() );
-        assertTrue( set.contains( 1L ) );
-        assertTrue( set.contains( 2L ) );
-        assertTrue( set.contains( 3L ) );
-        assertTrue( set.contains( 4L ) );
-        assertTrue( set.contains( 7L ) );
+        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
+        assertTrue( set.contains( Strings.getUUID( 7L ) ) );
 
         assertFalse( cursor.previous() );
         assertFalse( cursor.available() );
@@ -270,7 +272,7 @@ public class NotCursorTest
 
         try
         {
-            cursor.after( new ForwardIndexEntry<String, Long>() );
+            cursor.after( new ForwardIndexEntry<String, UUID>() );
             fail( "should fail with UnsupportedOperationException " );
         }
         catch ( UnsupportedOperationException uoe )
@@ -279,7 +281,7 @@ public class NotCursorTest
 
         try
         {
-            cursor.before( new ForwardIndexEntry<String, Long>() );
+            cursor.before( new ForwardIndexEntry<String, UUID>() );
             fail( "should fail with UnsupportedOperationException " );
         }
         catch ( UnsupportedOperationException uoe )



Mime
View raw message