directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r917770 [3/4] - in /directory/sandbox/seelmann/hbase-partition/src: main/java/org/apache/directory/server/core/partition/hbase/ main/java/org/apache/directory/server/core/partition/hbase/cursor/ main/java/org/apache/directory/server/core/pa...
Date Mon, 01 Mar 2010 22:45:48 GMT
Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java Mon Mar  1 22:45:47 2010
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.partition.hbase.it;
 
+
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -62,26 +63,16 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+
 @RunWith(FrameworkRunner.class)
-@CreateDS(
-    name = "hbase", 
-    enableChangeLog = false,
-    partitions =
-    { 
-        @CreatePartition(
-            name = "hbase", 
-            suffix = "o=hbase", 
-            type = HBaseDistributedPartition.class,
-            indexes = {
-                @CreateIndex( attribute="cn", cacheSize=100, type = HBaseUserColumnIndex.class ),
-                @CreateIndex( attribute="uid", cacheSize=100, type = HBaseUserColumnIndex.class ),
-                @CreateIndex( attribute="dc", cacheSize=10, type = HBaseUserRowIndex.class ),
-                @CreateIndex( attribute="o", cacheSize=10, type = HBaseUserRowIndex.class ),
-                @CreateIndex( attribute="ou", cacheSize=100, type = HBaseUserRowIndex.class ),
-                @CreateIndex( attribute="objectClass", cacheSize=100, type = HBaseUserRowIndex.class )
-            }
-        ) 
-    })
+@CreateDS(name = "hbase", enableChangeLog = false, partitions =
+    { @CreatePartition(name = "hbase", suffix = "o=hbase", type = HBaseDistributedPartition.class, indexes =
+        { @CreateIndex(attribute = "cn", cacheSize = 100, type = HBaseUserColumnIndex.class),
+            @CreateIndex(attribute = "uid", cacheSize = 100, type = HBaseUserColumnIndex.class),
+            @CreateIndex(attribute = "dc", cacheSize = 10, type = HBaseUserRowIndex.class),
+            @CreateIndex(attribute = "o", cacheSize = 10, type = HBaseUserRowIndex.class),
+            @CreateIndex(attribute = "ou", cacheSize = 100, type = HBaseUserRowIndex.class),
+            @CreateIndex(attribute = "objectClass", cacheSize = 100, type = HBaseUserRowIndex.class) }) })
 @CreateLdapServer(transports =
     { @CreateTransport(protocol = "LDAP") })
 public class HBasePartitionIT extends AbstractHBasePartitionIT

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPerformanceIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPerformanceIT.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPerformanceIT.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPerformanceIT.java Mon Mar  1 22:45:47 2010
@@ -476,10 +476,10 @@
         // subtree scan: sub count of ou=test10000,o=hbase < cn index count
         // TODO: doesn't scale!!!
         long t0 = System.currentTimeMillis();
-        for ( int i = 0; i < 10; i++ )
+        for ( int i = 0; i < 1000; i++ )
         {
-            //String cn = RandomStringUtils.randomNumeric( 4 );
-            String cn = "9999";
+            String cn = RandomStringUtils.randomNumeric( 4 );
+            //String cn = "9999";
             String filter = "(cn=test" + cn + "*)";
             EntryFilteringCursor cursor = session.search( new LdapDN( "ou=test10000,o=hbase" ), SearchScope.SUBTREE,
                 FilterParser.parse( filter ), AliasDerefMode.DEREF_ALWAYS, null );

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/LdifImportAndIndexIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/LdifImportAndIndexIT.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/LdifImportAndIndexIT.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/LdifImportAndIndexIT.java Mon Mar  1 22:45:47 2010
@@ -34,6 +34,7 @@
 import org.apache.directory.server.core.partition.hbase.mapreduce.IndexBuilder;
 import org.apache.directory.server.core.partition.hbase.mapreduce.LdifImporter;
 import org.apache.directory.server.core.partition.hbase.mapreduce.LdifInputFormat;
+import org.apache.directory.server.core.partition.hbase.mapreduce.TreeTableBuilder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.client.Get;
@@ -81,7 +82,7 @@
             conf.set( LdifImporter.SUFFIX, "dc=example,dc=com" );
             conf.set( LdifImporter.TABLE_PREFIX, "apacheds_example_" );
 
-            Job job = new Job( conf, "LDIF Import" );
+            Job job = new Job( conf, "Import LDIF" );
             job.setJarByClass( LdifImporter.class );
 
             FileInputFormat.addInputPath(job, new Path("src/test/resources/testdata-5.ldif"));
@@ -95,42 +96,69 @@
             boolean status = job.waitForCompletion( true );
             long t1 = System.currentTimeMillis();
             long t = t1 - t0;
-            System.out.println( "Import " + status + " in " + t + "ms." );
+            System.out.println( "Import LDIF " + status + " in " + t + "ms." );
+            //System.out.println( job.getCounters() );
+            System.out.println();
+        }
+        
+        // build tree table
+        {
+            long t0 = System.currentTimeMillis();
+            Configuration conf = new Configuration();
+            //conf.set( LdifImporter.NAME_COMPONENT_COUNT, ""+i );
+            conf.set( TreeTableBuilder.SUFFIX, "dc=example,dc=com" );
+            conf.set( TreeTableBuilder.TABLE_PREFIX, "apacheds_example_" );
+    
+            Job job = new Job( conf, "Build Tree Table" );
+            job.setJarByClass( TreeTableBuilder.class );
+    
+            TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan(),
+                TreeTableBuilder.class, null, null, job );
+            job.setOutputFormatClass( NullOutputFormat.class );
+            job.setNumReduceTasks( 0 );
+    
+            boolean status = job.waitForCompletion( true );
+            long t1 = System.currentTimeMillis();
+            long t = t1 - t0;
+            System.out.println( "Build Tree Table " + status + " in " + t + "ms." );
             //System.out.println( job.getCounters() );
             System.out.println();
         }
 
         // build indices
-        long t0 = System.currentTimeMillis();
-        Configuration conf = new Configuration();
-        //conf.set( LdifImporter.NAME_COMPONENT_COUNT, ""+i );
-        conf.set( IndexBuilder.SUFFIX, "dc=example,dc=com" );
-        conf.set( IndexBuilder.TABLE_PREFIX, "apacheds_example_" );
-        conf.set( IndexBuilder.COLUMN_INDICES, "cn,uid" );
-        conf.set( IndexBuilder.ROW_INDICES, "dc,o,ou,objectClass" );
-
-        Job job = new Job( conf, "Indexing" );
-        job.setJarByClass( IndexBuilder.class );
-
-        TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan( Bytes.toBytes( 1L ) ),
-            IndexBuilder.class, null, null, job );
-        job.setOutputFormatClass( NullOutputFormat.class );
-        job.setNumReduceTasks( 0 );
-
-        boolean status = job.waitForCompletion( true );
-        long t1 = System.currentTimeMillis();
-        long t = t1 - t0;
-        System.out.println( "Index " + status + " in " + t + "ms." );
-        //System.out.println( job.getCounters() );
-        System.out.println();
+        {
+            long t0 = System.currentTimeMillis();
+            Configuration conf = new Configuration();
+            //conf.set( LdifImporter.NAME_COMPONENT_COUNT, ""+i );
+            conf.set( IndexBuilder.SUFFIX, "dc=example,dc=com" );
+            conf.set( IndexBuilder.TABLE_PREFIX, "apacheds_example_" );
+            conf.set( IndexBuilder.COLUMN_INDICES, "cn,uid" );
+            conf.set( IndexBuilder.ROW_INDICES, "dc,o,ou,objectClass" );
+    
+            Job job = new Job( conf, "Build Index" );
+            job.setJarByClass( IndexBuilder.class );
+    
+            TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan(),
+                IndexBuilder.class, null, null, job );
+            job.setOutputFormatClass( NullOutputFormat.class );
+            job.setNumReduceTasks( 0 );
+    
+            boolean status = job.waitForCompletion( true );
+            long t1 = System.currentTimeMillis();
+            long t = t1 - t0;
+            System.out.println( "Build Index " + status + " in " + t + "ms." );
+            //System.out.println( job.getCounters() );
+            System.out.println();
+        }
 
         //
         //        ClonedServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
         //            new LdapDN( "dc=example,dc=com" ) );
         //        assertNotNull( entry );
         //
-        //        System.out.println( "ApacheDS started on port " + ldapServer.getPort() + ", press any key to shutdown..." );
-        //        System.in.read();
+        dump();
+        System.out.println( "ApacheDS started on port " + ldapServer.getPort() + ", press any key to shutdown..." );
+        System.in.read();
     }
 
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteLdifImport.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteLdifImport.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteLdifImport.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteLdifImport.java Mon Mar  1 22:45:47 2010
@@ -27,6 +27,7 @@
 import org.apache.directory.server.core.partition.hbase.mapreduce.IndexBuilder;
 import org.apache.directory.server.core.partition.hbase.mapreduce.LdifImporter;
 import org.apache.directory.server.core.partition.hbase.mapreduce.LdifInputFormat;
+import org.apache.directory.server.core.partition.hbase.mapreduce.TreeTableBuilder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -34,7 +35,6 @@
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
@@ -50,6 +50,10 @@
 
     public static void main( String[] args ) throws Exception
     {
+        cleanMasterTable();
+        cleanTreeTable();
+        cleanIndexTables();
+
         importLdif( "/user/stefan/input/ldif/com-example-10000.ldif", 2 );
         importLdif( "/user/stefan/input/ldif/com-example-10000.ldif", 3 );
         importLdif( "/user/stefan/input/ldif/com-example-10000.ldif", 4 );
@@ -58,8 +62,10 @@
         importLdif( "/user/stefan/input/ldif/com-example-1000000.ldif", 3 );
         importLdif( "/user/stefan/input/ldif/com-example-1000000.ldif", 4 );
 
-        cleanIndexTables();
+        cleanTreeTable();
+        buildTreeTable();
 
+        cleanIndexTables();
         buildIndices();
     }
 
@@ -72,11 +78,11 @@
         conf.set( LdifImporter.NAME_COMPONENT_COUNT, "" + nameComponentCount );
         conf.set( LdifImporter.SUFFIX, "dc=example,dc=com" );
         conf.set( LdifImporter.TABLE_PREFIX, "apacheds_example_" );
-        
+
         conf.set( "mapred.map.max.attempts", "1" );
         conf.set( "mapred.map.tasks.speculative.execution", "false" );
 
-        Job job = new Job( conf, "LDIF Import" );
+        Job job = new Job( conf, "Import LDIF" );
         job.setJarByClass( LdifImporter.class );
 
         FileInputFormat.addInputPath( job, new Path( file ) );
@@ -89,33 +95,38 @@
         boolean status = job.waitForCompletion( true );
         long t1 = System.currentTimeMillis();
         long t = t1 - t0;
-        System.out.println( "Import " + status + " in " + t + "ms." );
+        System.out.println( "Import LDIF " + status + " in " + t + "ms." );
         System.out.println( job.getCounters() );
         System.out.println();
     }
 
 
-    private static void cleanIndexTables() throws MasterNotRunningException, IOException
+    private static void buildTreeTable() throws IOException, InterruptedException, ClassNotFoundException
     {
-        // delete tree and index tables
-        List<String> tableNames = new ArrayList<String>();
-        tableNames.add( "apacheds_example_tree" );
-        tableNames.add( "apacheds_example_index_cn" );
-        tableNames.add( "apacheds_example_index_uid" );
-        tableNames.add( "apacheds_example_index_dc" );
-        tableNames.add( "apacheds_example_index_o" );
-        tableNames.add( "apacheds_example_index_ou" );
-        tableNames.add( "apacheds_example_index_objectClass" );
-        HBaseAdmin admin = new HBaseAdmin( new HBaseConfiguration() );
-        for ( String tableName : tableNames )
-        {
-            System.out.println( "Deleting table " + tableName );
-            if ( admin.tableExists( tableName ) )
-            {
-                admin.disableTable( tableName );
-                admin.deleteTable( tableName );
-            }
-        }
+        // build indices
+        long t0 = System.currentTimeMillis();
+        Configuration conf = new Configuration();
+        //conf.set( LdifImporter.NAME_COMPONENT_COUNT, ""+i );
+        conf.set( TreeTableBuilder.SUFFIX, "dc=example,dc=com" );
+        conf.set( TreeTableBuilder.TABLE_PREFIX, "apacheds_example_" );
+
+        conf.set( "mapred.map.max.attempts", "1" );
+        conf.set( "mapred.map.tasks.speculative.execution", "false" );
+
+        Job job = new Job( conf, "Build Tree Table" );
+        job.setJarByClass( TreeTableBuilder.class );
+
+        TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan(), TreeTableBuilder.class, null,
+            null, job );
+        job.setOutputFormatClass( NullOutputFormat.class );
+        job.setNumReduceTasks( 0 );
+
+        boolean status = job.waitForCompletion( true );
+        long t1 = System.currentTimeMillis();
+        long t = t1 - t0;
+        System.out.println( "Build Tree Table " + status + " in " + t + "ms." );
+        System.out.println( job.getCounters() );
+        System.out.println();
     }
 
 
@@ -133,20 +144,64 @@
         conf.set( "mapred.map.max.attempts", "1" );
         conf.set( "mapred.map.tasks.speculative.execution", "false" );
 
-        Job job = new Job( conf, "Indexing" );
+        Job job = new Job( conf, "Build Index" );
         job.setJarByClass( IndexBuilder.class );
 
-        TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan( Bytes.toBytes( 1L ) ),
-            IndexBuilder.class, null, null, job );
+        TableMapReduceUtil.initTableMapperJob( "apacheds_example_master", new Scan(), IndexBuilder.class, null, null,
+            job );
         job.setOutputFormatClass( NullOutputFormat.class );
         job.setNumReduceTasks( 0 );
 
         boolean status = job.waitForCompletion( true );
         long t1 = System.currentTimeMillis();
         long t = t1 - t0;
-        System.out.println( "Index " + status + " in " + t + "ms." );
+        System.out.println( "Build Index " + status + " in " + t + "ms." );
         System.out.println( job.getCounters() );
         System.out.println();
     }
 
+
+    private static void cleanMasterTable() throws MasterNotRunningException, IOException
+    {
+        List<String> tableNames = new ArrayList<String>();
+        tableNames.add( "apacheds_example_master" );
+        cleanTables( tableNames );
+    }
+
+
+    private static void cleanTreeTable() throws MasterNotRunningException, IOException
+    {
+        List<String> tableNames = new ArrayList<String>();
+        tableNames.add( "apacheds_example_tree" );
+        cleanTables( tableNames );
+    }
+
+
+    private static void cleanIndexTables() throws MasterNotRunningException, IOException
+    {
+        List<String> tableNames = new ArrayList<String>();
+        tableNames.add( "apacheds_example_index_cn" );
+        tableNames.add( "apacheds_example_index_uid" );
+        tableNames.add( "apacheds_example_index_dc" );
+        tableNames.add( "apacheds_example_index_o" );
+        tableNames.add( "apacheds_example_index_ou" );
+        tableNames.add( "apacheds_example_index_objectClass" );
+        cleanTables( tableNames );
+    }
+
+
+    private static void cleanTables( List<String> tableNames ) throws MasterNotRunningException, IOException
+    {
+        HBaseAdmin admin = new HBaseAdmin( new HBaseConfiguration() );
+        for ( String tableName : tableNames )
+        {
+            System.out.println( "Deleting table " + tableName );
+            if ( admin.tableExists( tableName ) )
+            {
+                admin.disableTable( tableName );
+                admin.deleteTable( tableName );
+            }
+        }
+    }
+
 }
\ No newline at end of file

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteRunner.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteRunner.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/mapreduce/RemoteRunner.java Mon Mar  1 22:45:47 2010
@@ -50,6 +50,7 @@
             name = "example", 
             suffix = "dc=example,dc=com",
             type = HBaseDistributedPartition.class,
+            cacheSize = 10,
             indexes = {
                 @CreateIndex( attribute="cn", type = HBaseUserColumnIndex.class ),
                 @CreateIndex( attribute="uid", type = HBaseUserColumnIndex.class ),

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java Mon Mar  1 22:45:47 2010
@@ -58,6 +58,9 @@
     protected static HBaseStore store;
     protected static LdapDN suffixDn;
 
+    protected static final UUID CONTEXT_ENTRY_ID = UUID.fromString( "00000000-0000-0000-0000-000000000001" );
+    protected static final UUID OU_SALES_ID = UUID.fromString( "00000000-0000-0000-0000-000000000002" );
+    protected static final UUID CN_JOHNNY_WALKER_UUID = UUID.fromString( "00000000-0000-0000-0000-000000000003" );
 
     /**
      * Startup mini HBase cluster.
@@ -127,7 +130,7 @@
         entry.add( "postalCode", "1" );
         entry.add( "postOfficeBox", "1" );
         entry.add( "entryCsn", CSN_FACTORY.newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        entry.add( "entryUUID", CONTEXT_ENTRY_ID.toString() );
         return entry;
     }
 
@@ -142,7 +145,7 @@
         entry.add( "postalCode", "1" );
         entry.add( "postOfficeBox", "1" );
         entry.add( "entryCsn", CSN_FACTORY.newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        entry.add( "entryUUID", OU_SALES_ID.toString() );
         return entry;
     }
 
@@ -162,7 +165,7 @@
         entry.add( "jpegPhoto", new byte[]
             { 0x00, 0x01, 0x7F, ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0xFF, } );
         entry.add( "entryCsn", CSN_FACTORY.newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        entry.add( "entryUUID", CN_JOHNNY_WALKER_UUID.toString() );
         return entry;
     }
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java Mon Mar  1 22:45:47 2010
@@ -26,6 +26,7 @@
 
 import java.util.List;
 import java.util.NavigableMap;
+import java.util.UUID;
 
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
@@ -37,7 +38,6 @@
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Before;
 import org.junit.Test;
@@ -90,38 +90,37 @@
             }
         }
 
-//        objectClassIndexTable = new HBaseRowIndexTable( "2.5.4.0", store, 100 );
-//        jpegPhotoIndexTable = new HBaseRowIndexTable( "0.9.2342.19200300.100.1.60", store, 100 );
-//        cnIndexTable = new HBaseColumnIndexTable( "2.5.4.3", schemaManager, TABLE_PREFIX, adapter.conf, 100 );
-//        userCertificateIndexTable = new HBaseColumnIndexTable( "2.5.4.36", schemaManager, TABLE_PREFIX, adapter.conf,
-//            100 );
-        
+        //        objectClassIndexTable = new HBaseRowIndexTable( "2.5.4.0", store, 100 );
+        //        jpegPhotoIndexTable = new HBaseRowIndexTable( "0.9.2342.19200300.100.1.60", store, 100 );
+        //        cnIndexTable = new HBaseColumnIndexTable( "2.5.4.3", schemaManager, TABLE_PREFIX, adapter.conf, 100 );
+        //        userCertificateIndexTable = new HBaseColumnIndexTable( "2.5.4.36", schemaManager, TABLE_PREFIX, adapter.conf,
+        //            100 );
+
         HBaseUserRowIndex index = new HBaseUserRowIndex();
         index.setAttributeId( "2.5.4.0" );
         index.setCacheSize( 100 );
         index.setStore( store );
         objectClassIndexTable = index.getIndexTable();
         store.addIndex( index );
-        
+
         index = new HBaseUserRowIndex();
         index.setAttributeId( "0.9.2342.19200300.100.1.60" );
         index.setStore( store );
         jpegPhotoIndexTable = index.getIndexTable();
         store.addIndex( index );
-        
+
         HBaseUserColumnIndex index2 = new HBaseUserColumnIndex();
         index2.setAttributeId( "2.5.4.3" );
         index2.setStore( store );
         cnIndexTable = index2.getIndexTable();
         store.addIndex( index );
-        
+
         index2 = new HBaseUserColumnIndex();
         index2.setAttributeId( "2.5.4.36" );
         index2.setStore( store );
         userCertificateIndexTable = index2.getIndexTable();
         store.addIndex( index );
-        
-        
+
     }
 
 
@@ -129,7 +128,7 @@
     public void first() throws Exception
     {
         DefaultServerEntry entry = buildContextEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
     }
 
 
@@ -138,46 +137,46 @@
     {
         // 1st entry
         DefaultServerEntry entry = buildContextEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
         HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
 
-        Get equalGet = new Get( Bytes.add( Bytes.toBytes( "=organization" ), Bytes.toBytes( Base64.encodeBytes( Bytes
-            .toBytes( 1L ) ) ) ) );
+        Get equalGet = new Get( Bytes.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) );
         assertTrue( objectClassIndexHTable.exists( equalGet ) );
         Result equalResult = objectClassIndexHTable.get( equalGet );
 
         NavigableMap<byte[], byte[]> equalInfoMap = equalResult.getFamilyMap( Bytes.toBytes( "info" ) );
         assertNotNull( equalInfoMap );
         assertEquals( 1, equalInfoMap.size() );
-        assertEquals( 1L, Bytes.toLong( equalInfoMap.get( Bytes.toBytes( "id" ) ) ) );
+        assertEquals( "00000000-0000-0000-0000-000000000001", Bytes
+            .toString( equalInfoMap.get( Bytes.toBytes( "id" ) ) ) );
 
         // 2nd entry
         entry = buildOuSalesEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
 
         // 3rd entry
         entry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.add( entry.get( "cn" ).get( 0 ).getBytes(), 3L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.add( entry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
 
         HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
 
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organization" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalunit" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalperson" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=person" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalunit\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=person\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalperson\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000003" ) ) ) );
 
         assertTrue( cnIndexHTable.exists( new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker" ) ) ) );
 
@@ -193,66 +192,66 @@
     {
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
 
         HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
         HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
 
         // detete 3rd entry
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
-
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organization" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalunit" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertTrue( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalperson" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=person" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalunit\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertTrue( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=person\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalperson\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000003" ) ) ) );
 
         assertFalse( cnIndexHTable.exists( new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker" ) ) ) );
 
         // detete 2nd and 1st entry
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
-        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
-
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organization" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalunit" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=organizationalperson" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=person" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
-        assertFalse( objectClassIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "=top" ), Bytes.toBytes( Base64
-            .encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
+
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalunit\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000002" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=person\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=organizationalperson\u000000000000-0000-0000-0000-000000000003" ) ) ) );
+        assertFalse( objectClassIndexHTable.exists( new Get( Bytes
+            .toBytes( "=top\u000000000000-0000-0000-0000-000000000003" ) ) ) );
     }
 
 
     @Test
-    public void testCount() throws Exception
+    public void testCounts() throws Exception
     {
         assertEquals( 0, objectClassIndexTable.count( "organization" ) );
         assertEquals( 0, objectClassIndexTable.count( "organizationalunit" ) );
@@ -262,36 +261,36 @@
 
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
 
         assertEquals( 1, objectClassIndexTable.count( "top" ) );
         assertEquals( 1, objectClassIndexTable.count( "organizationalunit" ) );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
 
         assertEquals( 2, objectClassIndexTable.count( "top" ) );
         assertEquals( 1, objectClassIndexTable.count( "person" ) );
         assertEquals( 1, cnIndexTable.count( "johnny \u65E5\u672C walker" ) );
 
         // delete 3rd and 2nd
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
 
         assertEquals( 0, objectClassIndexTable.count( "organizationalunit" ) );
         assertEquals( 0, objectClassIndexTable.count( "top" ) );
@@ -300,7 +299,7 @@
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // delete 1st
-        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
         assertEquals( 0, objectClassIndexTable.count( "organization" ) );
 
@@ -323,127 +322,132 @@
     @Test
     public void testExists() throws Exception
     {
-        assertFalse( objectClassIndexTable.exists( "organization", 1L ) );
-        assertFalse( objectClassIndexTable.exists( "organizationalunit", 2L ) );
-        assertFalse( objectClassIndexTable.exists( "top", 2L ) );
-        assertFalse( objectClassIndexTable.exists( "top", 3L ) );
-        assertFalse( objectClassIndexTable.exists( "person", 3L ) );
-        assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", 3L ) );
+        assertFalse( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
+        assertFalse( objectClassIndexTable.exists( "organizationalunit", OU_SALES_ID ) );
+        assertFalse( objectClassIndexTable.exists( "top", OU_SALES_ID ) );
+        assertFalse( objectClassIndexTable.exists( "top", CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( objectClassIndexTable.exists( "person", CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", CN_JOHNNY_WALKER_UUID ) );
 
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
-        assertTrue( objectClassIndexTable.exists( "organization", 1L ) );
+        assertTrue( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
 
-        assertTrue( objectClassIndexTable.exists( "organizationalunit", 2L ) );
-        assertTrue( objectClassIndexTable.exists( "top", 2L ) );
+        assertTrue( objectClassIndexTable.exists( "organizationalunit", OU_SALES_ID ) );
+        assertTrue( objectClassIndexTable.exists( "top", OU_SALES_ID ) );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
-
-        assertTrue( objectClassIndexTable.exists( "top", 3L ) );
-        assertTrue( objectClassIndexTable.exists( "person", 3L ) );
-        assertTrue( cnIndexTable.exists( "johnny \u65E5\u672C walker", 3L ) );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.add( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+
+        assertTrue( objectClassIndexTable.exists( "top", CN_JOHNNY_WALKER_UUID ) );
+        assertTrue( objectClassIndexTable.exists( "person", CN_JOHNNY_WALKER_UUID ) );
+        assertTrue( cnIndexTable.exists( "johnny \u65E5\u672C walker", CN_JOHNNY_WALKER_UUID ) );
 
         // delete 3rd and 2nd
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), 3L );
-        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), 3L );
-        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
-        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
-
-        assertTrue( objectClassIndexTable.exists( "organization", 1L ) );
-        assertFalse( objectClassIndexTable.exists( "organizationalunit", 2L ) );
-        assertFalse( objectClassIndexTable.exists( "top", 2L ) );
-        assertFalse( objectClassIndexTable.exists( "top", 3L ) );
-        assertFalse( objectClassIndexTable.exists( "person", 3L ) );
-        assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", 3L ) );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 1 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( cnEntry.get( "objectClass" ).get( 2 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        cnIndexTable.drop( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID );
+        objectClassIndexTable.drop( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID );
+
+        assertTrue( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
+        assertFalse( objectClassIndexTable.exists( "organizationalunit", OU_SALES_ID ) );
+        assertFalse( objectClassIndexTable.exists( "top", OU_SALES_ID ) );
+        assertFalse( objectClassIndexTable.exists( "top", CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( objectClassIndexTable.exists( "person", CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", CN_JOHNNY_WALKER_UUID ) );
 
         // delete 1st
-        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
 
-        assertFalse( objectClassIndexTable.exists( "organization", 1L ) );
+        assertFalse( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
 
         // test non-existing values
         assertFalse( objectClassIndexTable.exists( null, null ) );
         assertFalse( cnIndexTable.exists( null, null ) );
-        assertFalse( objectClassIndexTable.exists( "", -1L ) );
-        assertFalse( cnIndexTable.exists( "", -1L ) );
-        assertFalse( objectClassIndexTable.exists( "abc", 0L ) );
-        assertFalse( cnIndexTable.exists( "abc", 0L ) );
-        assertFalse( objectClassIndexTable.exists( "\u65E5\u672C", Long.MAX_VALUE ) );
-        assertFalse( cnIndexTable.exists( "\u65E5\u672C", Long.MAX_VALUE ) );
+        assertFalse( objectClassIndexTable.exists( "", UUID.fromString( "ffffffff-ffff-ffff-ffff-ffffffffffff" ) ) );
+        assertFalse( cnIndexTable.exists( "", UUID.fromString( "ffffffff-ffff-ffff-ffff-ffffffffffff" ) ) );
+        assertFalse( objectClassIndexTable.exists( "abc", UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertFalse( cnIndexTable.exists( "abc", UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertFalse( objectClassIndexTable.exists( "\u65E5\u672C", null ) );
+        assertFalse( cnIndexTable.exists( "\u65E5\u672C", null ) );
         assertFalse( objectClassIndexTable.exists( new byte[]
-            { 0x00, 0x01, 0x02 }, 10L ) );
+            { 0x00, 0x01, 0x02 }, null ) );
         assertFalse( cnIndexTable.exists( new byte[]
-            { 0x00, 0x01, 0x02 }, 10L ) );
+            { 0x00, 0x01, 0x02 }, null ) );
     }
 
 
     @Test
     public void testGetScanKey() throws Exception
     {
-        byte[] scanKey = objectClassIndexTable.getScanKey( "bar", Bytes.toBytes( 0L ) );
-        assertEquals( "=barAAAAAAAAAAA=", Bytes.toString( scanKey ) );
+        byte[] scanKey = objectClassIndexTable.getScanKey( "bar", HBaseIndexTable.DELIMITER, UUID
+            .fromString( "00000000-0000-0000-0000-000000000000" ) );
+        assertEquals( "=bar\u000000000000-0000-0000-0000-000000000000", Bytes.toString( scanKey ) );
+
+        scanKey = objectClassIndexTable.getScanKey( "foo", HBaseIndexTable.DELIMITER, UUID
+            .fromString( "ffffffff-ffff-ffff-ffff-ffffffffffff" ) );
+        assertEquals( "=foo\u0000ffffffff-ffff-ffff-ffff-ffffffffffff", Bytes.toString( scanKey ) );
+
+        scanKey = objectClassIndexTable.getScanKey( "foobar", HBaseIndexTable.DELIMITER, null );
+        assertEquals( "=foobar\u0000", Bytes.toString( scanKey ) );
+
+        scanKey = objectClassIndexTable.getScanKey( "", HBaseIndexTable.DELIMITER, UUID
+            .fromString( "d3afbeaf-6a4f-448a-a542-2ef0bde880a5" ) );
+        assertEquals( "=\u0000d3afbeaf-6a4f-448a-a542-2ef0bde880a5", Bytes.toString( scanKey ) );
 
-        scanKey = objectClassIndexTable.getScanKey( "foo", Bytes.toBytes( Long.MAX_VALUE ) );
-        assertEquals( "=foof/////////8=", Bytes.toString( scanKey ) );
-
-        scanKey = objectClassIndexTable.getScanKey( "foobar", null );
-        assertEquals( "=foobar", Bytes.toString( scanKey ) );
-
-        scanKey = objectClassIndexTable.getScanKey( "", Bytes.toBytes( 1L ) );
-        assertEquals( "=AAAAAAAAAAE=", Bytes.toString( scanKey ) );
-
-        scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, HBaseIndexTable.VALUE_SCAN_START );
+        scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, null, null );
         assertTrue( Bytes.equals( new byte[]
-            { '=', 0x00, 0x00 }, scanKey ) );
+            { '=', 0x00 }, scanKey ) );
 
-        scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, HBaseIndexTable.VALUE_SCAN_STOP );
+        scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, null, null );
         assertTrue( Bytes.equals( new byte[]
-            { '=', ( byte ) 0xFF, ( byte ) 0xFF }, scanKey ) );
+            { '=', ( byte ) 0xFF }, scanKey ) );
 
-        scanKey = cnIndexTable.getScanKey( "bar", Bytes.toBytes( 0L ) );
+        scanKey = cnIndexTable.getScanKey( "bar" );
         assertEquals( "=bar", Bytes.toString( scanKey ) );
 
-        scanKey = cnIndexTable.getScanKey( "foo", Bytes.toBytes( Long.MAX_VALUE ) );
+        scanKey = cnIndexTable.getScanKey( "foo" );
         assertEquals( "=foo", Bytes.toString( scanKey ) );
 
-        scanKey = cnIndexTable.getScanKey( "foobar", null );
-        assertEquals( "=foobar", Bytes.toString( scanKey ) );
-
-        scanKey = cnIndexTable.getScanKey( "", Bytes.toBytes( 1L ) );
+        scanKey = cnIndexTable.getScanKey( "" );
         assertEquals( "=", Bytes.toString( scanKey ) );
 
-        scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, HBaseIndexTable.VALUE_SCAN_START );
+        scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START );
         assertTrue( Bytes.equals( new byte[]
-            { '=', 0x00, 0x00 }, scanKey ) );
+            { '=', 0x00 }, scanKey ) );
 
-        scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, HBaseIndexTable.VALUE_SCAN_STOP );
+        scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
         assertTrue( Bytes.equals( new byte[]
-            { '=', ( byte ) 0xFF, ( byte ) 0xFF }, scanKey ) );
+            { '=', ( byte ) 0xFF }, scanKey ) );
     }
 
 
     @Test
     public void testGetValue() throws Exception
     {
-        Object value = objectClassIndexTable.getValueFromEqualsKey( Bytes.toBytes( "=barAAAAAAAAAAA=" ) );
+        byte[] bytes = Bytes.toBytes( "=bar\u000000000000-0000-0000-0000-000000000000" );
+        assertEquals( 41, bytes.length );
+        Object value = objectClassIndexTable.extractValueFromEqualsKey( bytes );
         assertEquals( "bar", value );
 
-        value = jpegPhotoIndexTable.getValueFromEqualsKey( new byte[]
-            { '=', 0x00, 0x01, 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', '=' } );
+        bytes = new byte[]
+            { '=', 0x00, 0x01, 0x00, '0', '0', '0', '0', '0', '0', '0', '0', '-', '0', '0', '0', '0', '-', '0', '0',
+                '0', '0', '-', '0', '0', '0', '0', '-', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' };
+        assertEquals( 40, bytes.length );
+        value = jpegPhotoIndexTable.extractValueFromEqualsKey( bytes );
         assertTrue( Bytes.equals( new byte[]
             { 0x00, 0x01 }, ( byte[] ) value ) );
 
@@ -461,12 +465,12 @@
     public void testGetColumnCandidates() throws Exception
     {
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
+        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
 
-        List<Long> candidates = cnIndexTable.getColumnCandidates( "johnny \u65E5\u672C walker" );
+        List<UUID> candidates = cnIndexTable.getColumnCandidates( "johnny \u65E5\u672C walker" );
         assertNotNull( candidates );
         assertEquals( 1, candidates.size() );
-        assertTrue( candidates.contains( 3L ) );
+        assertTrue( candidates.contains( CN_JOHNNY_WALKER_UUID ) );
     }
 
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java Mon Mar  1 22:45:47 2010
@@ -26,6 +26,7 @@
 import static org.junit.Assert.assertTrue;
 
 import java.util.NavigableMap;
+import java.util.UUID;
 
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
@@ -90,7 +91,7 @@
         store.setCacheSize( 100 );
         store.setTablePrefix( TABLE_PREFIX );
         store.init( schemaManager );
-        
+
         masterTable = new HBaseMasterTable( store );
     }
 
@@ -121,18 +122,19 @@
         HTable treeHTable = new HTable( TREE_TABLE_NAME );
 
         // check state in HBase table 'master' 
-        Get masterGet = new Get( Bytes.toBytes( 1L ) );
+        Get masterGet = new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) );
         assertTrue( masterHTable.exists( masterGet ) );
         Result masterResult = masterHTable.get( masterGet );
 
-        assertEquals( 1L, Bytes.toLong( masterResult.getRow() ) );
+        assertEquals( "00000000-0000-0000-0000-000000000001", Bytes.toString( masterResult.getRow() ) );
 
         NavigableMap<byte[], byte[]> treeInfoMap = masterResult.getFamilyMap( Bytes.toBytes( "treeInfo" ) );
         assertNotNull( treeInfoMap );
         assertEquals( 3, treeInfoMap.size() );
         assertEquals( "o=Good Times Co.", Bytes.toString( treeInfoMap.get( Bytes.toBytes( "upRdn" ) ) ) );
         assertEquals( "2.5.4.10=good times co.", Bytes.toString( treeInfoMap.get( Bytes.toBytes( "normRdn" ) ) ) );
-        assertEquals( 0L, Bytes.toLong( treeInfoMap.get( Bytes.toBytes( "parentId" ) ) ) );
+        assertEquals( "00000000-0000-0000-0000-000000000000", Bytes.toString( treeInfoMap.get( Bytes
+            .toBytes( "parentId" ) ) ) );
 
         NavigableMap<byte[], byte[]> upAttributesMap = masterResult.getFamilyMap( Bytes.toBytes( "upAttributes" ) );
         assertNotNull( upAttributesMap );
@@ -151,8 +153,8 @@
             .toBytes( "entryCsn" ), Bytes.toBytes( 0 ) ) ) ) );
 
         // check state in HBase table 'tree' 
-        Get treeGet = new Get( Bytes.add( Bytes.toBytes( 0L ), Bytes.toBytes( "," ), Bytes
-            .toBytes( "2.5.4.10=good times co." ) ) );
+        Get treeGet = new Get( Bytes.add( Bytes.toBytes( "00000000-0000-0000-0000-000000000000" ),
+            Bytes.toBytes( "," ), Bytes.toBytes( "2.5.4.10=good times co." ) ) );
         Result treeResult = treeHTable.get( treeGet );
 
         //assertEquals( "", Bytes.toLong( treeResult.getRow() ));
@@ -160,7 +162,7 @@
         NavigableMap<byte[], byte[]> infoMap = treeResult.getFamilyMap( Bytes.toBytes( "treeInfo" ) );
         assertNotNull( infoMap );
         assertEquals( 1, infoMap.size() );
-        assertEquals( 1L, Bytes.toLong( infoMap.get( Bytes.toBytes( "id" ) ) ) );
+        assertEquals( "00000000-0000-0000-0000-000000000001", Bytes.toString( infoMap.get( Bytes.toBytes( "id" ) ) ) );
         // no oneLevelCount and subLevelCount column yet
 
         NavigableMap<byte[], byte[]> normAttributesMap = treeResult.getFamilyMap( Bytes.toBytes( "normAttributes" ) );
@@ -178,9 +180,9 @@
         masterTable.add( entry );
 
         // check in HBase tables
-        masterGet = new Get( Bytes.toBytes( 2L ) );
+        masterGet = new Get( Bytes.toBytes( OU_SALES_ID.toString() ) );
         assertTrue( masterHTable.exists( masterGet ) );
-        treeGet = new Get( Bytes.add( Bytes.toBytes( 1L ), Bytes.toBytes( "," ), Bytes
+        treeGet = new Get( Bytes.add( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ), Bytes.toBytes( "," ), Bytes
             .toBytes( "2.5.4.11=sales \u65E5\u672C" ) ) );
         assertTrue( treeHTable.exists( treeGet ) );
     }
@@ -201,17 +203,17 @@
         HTable treeHTable = new HTable( TREE_TABLE_NAME );
 
         // delete second entry
-        masterTable.delete( 2L, entry );
+        masterTable.delete( OU_SALES_ID, entry );
         Get masterGet = new Get( Bytes.toBytes( 2L ) );
         assertFalse( masterHTable.exists( masterGet ) );
         Get treeGet = new Get( Bytes.add( Bytes.toBytes( 1L ), Bytes.toBytes( "," ), Bytes
             .toBytes( "2.5.4.11=sales \u65E5\u672C" ) ) );
         assertFalse( treeHTable.exists( treeGet ) );
-        assertTrue( masterHTable.exists( new Get( Bytes.toBytes( 1L ) ) ) );
+        assertTrue( masterHTable.exists( new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) ) ) );
 
         // delete context entry
-        masterTable.delete( 1L, entry );
-        masterGet = new Get( Bytes.toBytes( 1L ) );
+        masterTable.delete( CONTEXT_ENTRY_ID, entry );
+        masterGet = new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) );
         assertFalse( masterHTable.exists( masterGet ) );
         treeGet = new Get( Bytes.add( Bytes.toBytes( 0L ), Bytes.toBytes( "," ), Bytes
             .toBytes( "2.5.4.10=good times co." ) ) );
@@ -230,22 +232,23 @@
         entry.get( "objectClass" ).add( "top" );
         entry.removeAttributes( "postalCode" );
         entry.get( "postOfficeBox" ).put( "2" );
-        masterTable.modify( 1L, entry );
+        masterTable.modify( CONTEXT_ENTRY_ID, entry );
 
         // check state in HBase table 'master' 
         HTable masterHTable = new HTable( MASTER_TABLE_NAME );
-        Get masterGet = new Get( Bytes.toBytes( 1L ) );
+        Get masterGet = new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) );
         assertTrue( masterHTable.exists( masterGet ) );
         Result masterResult = masterHTable.get( masterGet );
 
-        assertEquals( 1L, Bytes.toLong( masterResult.getRow() ) );
+        assertEquals( "00000000-0000-0000-0000-000000000001", Bytes.toString( masterResult.getRow() ) );
 
         NavigableMap<byte[], byte[]> treeInfoMap = masterResult.getFamilyMap( Bytes.toBytes( "treeInfo" ) );
         assertNotNull( treeInfoMap );
         assertEquals( 3, treeInfoMap.size() );
         assertEquals( "o=Good Times Co.", Bytes.toString( treeInfoMap.get( Bytes.toBytes( "upRdn" ) ) ) );
         assertEquals( "2.5.4.10=good times co.", Bytes.toString( treeInfoMap.get( Bytes.toBytes( "normRdn" ) ) ) );
-        assertEquals( 0L, Bytes.toLong( treeInfoMap.get( Bytes.toBytes( "parentId" ) ) ) );
+        assertEquals( "00000000-0000-0000-0000-000000000000", Bytes.toString( treeInfoMap.get( Bytes
+            .toBytes( "parentId" ) ) ) );
 
         NavigableMap<byte[], byte[]> upAttributesMap = masterResult.getFamilyMap( Bytes.toBytes( "upAttributes" ) );
         assertNotNull( upAttributesMap );
@@ -274,7 +277,7 @@
 
         // fetch norm attributes
         long count1 = HBaseTableHelper.RPC_COUNT;
-        NavigableMap<byte[], byte[]> normAttributesMap = masterTable.fetchNormAttributes( 1L );
+        NavigableMap<byte[], byte[]> normAttributesMap = masterTable.fetchNormAttributes( CONTEXT_ENTRY_ID );
         assertNotNull( normAttributesMap );
         assertEquals( 6, normAttributesMap.size() );
         assertEquals( 0, Bytes.toInt( normAttributesMap.get( Bytes.toBytes( "2.5.4.0=organization" ) ) ) );
@@ -287,7 +290,7 @@
 
         // fetch again, this time we hit the cache
         long count5 = HBaseTableHelper.RPC_COUNT;
-        normAttributesMap = masterTable.fetchNormAttributes( 1L );
+        normAttributesMap = masterTable.fetchNormAttributes( CONTEXT_ENTRY_ID );
         long count6 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count6 - count5 ); // normAttributes from tree table
     }
@@ -302,7 +305,7 @@
 
         // fetch ID
         long count1 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 1L, masterTable.fetchId( contextEntry.getDn() ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000001", masterTable.fetchId( contextEntry.getDn() ).toString() );
         long count2 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count2 - count1 );
 
@@ -312,19 +315,19 @@
 
         // fetch entry ID
         long count3 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 2L, masterTable.fetchId( ouSalesEntry.getDn() ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000002", masterTable.fetchId( ouSalesEntry.getDn() ).toString() );
         long count4 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count4 - count3 );
 
         // fetch IDs again, this time we hit the cache
         long count5 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 1L, masterTable.fetchId( contextEntry.getDn() ).longValue() );
-        assertEquals( 2L, masterTable.fetchId( ouSalesEntry.getDn() ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000001", masterTable.fetchId( contextEntry.getDn() ).toString() );
+        assertEquals( "00000000-0000-0000-0000-000000000002", masterTable.fetchId( ouSalesEntry.getDn() ).toString() );
         long count6 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( 2L, ouSalesEntry );
+        masterTable.delete( OU_SALES_ID, ouSalesEntry );
         assertNull( masterTable.fetchId( ouSalesEntry.getDn() ) );
 
         // fetch entry IDs of non-existing entries
@@ -342,7 +345,7 @@
 
         // fetch parent ID
         long count1 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 0L, masterTable.fetchParentId( 1L ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000000", masterTable.fetchParentId( CONTEXT_ENTRY_ID ).toString() );
         long count2 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count2 - count1 );
 
@@ -352,26 +355,25 @@
 
         // fetch parent ID
         long count3 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 1L, masterTable.fetchParentId( 2L ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000001", masterTable.fetchParentId( OU_SALES_ID ).toString() );
         long count4 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count4 - count3 );
 
         // fetch parents again, this time we hit the cache
         long count5 = HBaseTableHelper.RPC_COUNT;
-        assertEquals( 0L, masterTable.fetchParentId( 1L ).longValue() );
-        assertEquals( 1L, masterTable.fetchParentId( 2L ).longValue() );
+        assertEquals( "00000000-0000-0000-0000-000000000000", masterTable.fetchParentId( CONTEXT_ENTRY_ID ).toString() );
+        assertEquals( "00000000-0000-0000-0000-000000000001", masterTable.fetchParentId( OU_SALES_ID ).toString() );
         long count6 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( 2L, ouSalesEntry );
-        assertNull( masterTable.fetchParentId( 2L ) );
+        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        assertNull( masterTable.fetchParentId( OU_SALES_ID ) );
 
         // fetch parent IDs of non-existing entries
         assertNull( masterTable.fetchParentId( null ) );
-        assertNull( masterTable.fetchParentId( 0L ) );
-        assertNull( masterTable.fetchParentId( 10L ) );
-        assertNull( masterTable.fetchParentId( -1L ) );
+        assertNull( masterTable.fetchParentId( UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertNull( masterTable.fetchParentId( UUID.randomUUID() ) );
     }
 
 
@@ -384,9 +386,9 @@
 
         // fetch first entry
         long count1 = HBaseTableHelper.RPC_COUNT;
-        assertNotNull( masterTable.fetchEntry( 1L ) );
-        assertEquals( "o=Good Times Co.", masterTable.fetchEntry( 1L ).getDn().getName() );
-        assertEquals( contextEntry, masterTable.fetchEntry( 1L ) );
+        assertNotNull( masterTable.fetchEntry( CONTEXT_ENTRY_ID ) );
+        assertEquals( "o=Good Times Co.", masterTable.fetchEntry( CONTEXT_ENTRY_ID ).getDn().getName() );
+        assertEquals( contextEntry, masterTable.fetchEntry( CONTEXT_ENTRY_ID ) );
         long count2 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count2 - count1 );
 
@@ -396,31 +398,30 @@
 
         // fetch second entry
         long count3 = HBaseTableHelper.RPC_COUNT;
-        assertNotNull( masterTable.fetchEntry( 2L ) );
-        assertEquals( "ou=Sales \\E6\\97\\A5\\E6\\9C\\AC,o=Good Times Co.", masterTable.fetchEntry( 2L ).getDn()
-            .getName() );
-        assertEquals( "2.5.4.11=sales \u65E5\u672C,2.5.4.10=good times co.", masterTable.fetchEntry( 2L ).getDn()
-            .getNormName() );
-        assertEquals( ouSalesEntry, masterTable.fetchEntry( 2L ) );
+        assertNotNull( masterTable.fetchEntry( OU_SALES_ID ) );
+        assertEquals( "ou=Sales \\E6\\97\\A5\\E6\\9C\\AC,o=Good Times Co.", masterTable.fetchEntry( OU_SALES_ID )
+            .getDn().getName() );
+        assertEquals( "2.5.4.11=sales \u65E5\u672C,2.5.4.10=good times co.", masterTable.fetchEntry( OU_SALES_ID )
+            .getDn().getNormName() );
+        assertEquals( ouSalesEntry, masterTable.fetchEntry( OU_SALES_ID ) );
         long count4 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 1, count4 - count3 );
 
         // fetch entries again, this time we hit the cache
         long count5 = HBaseTableHelper.RPC_COUNT;
-        assertNotNull( masterTable.fetchEntry( 1L ) );
-        assertNotNull( masterTable.fetchEntry( 2L ) );
+        assertNotNull( masterTable.fetchEntry( CONTEXT_ENTRY_ID ) );
+        assertNotNull( masterTable.fetchEntry( OU_SALES_ID ) );
         long count6 = HBaseTableHelper.RPC_COUNT;
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( 2L, ouSalesEntry );
-        assertNull( masterTable.fetchEntry( 2L ) );
+        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        assertNull( masterTable.fetchEntry( OU_SALES_ID ) );
 
         // fetch non-existing entries
         assertNull( masterTable.fetchEntry( null ) );
-        assertNull( masterTable.fetchEntry( 0L ) );
-        assertNull( masterTable.fetchEntry( 10L ) );
-        assertNull( masterTable.fetchEntry( -1L ) );
+        assertNull( masterTable.fetchEntry( UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertNull( masterTable.fetchEntry( UUID.randomUUID() ) );
     }
 
 
@@ -432,64 +433,62 @@
         masterTable.add( contextEntry );
 
         // check counters
-        assertEquals( 0, masterTable.getOneLevelCount( 1L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 1L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );
+        assertEquals( 0, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // add ou=Sales entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
         masterTable.add( ouSalesEntry );
 
         // check counters
-        assertEquals( 0, masterTable.getOneLevelCount( 2L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 2L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( OU_SALES_ID ) );
+        assertEquals( 0, masterTable.getSubLevelCount( OU_SALES_ID ) );
 
         // check updated counters of context entry
-        assertEquals( 1, masterTable.getOneLevelCount( 1L ) );
-        assertEquals( 1, masterTable.getSubLevelCount( 1L ) );
+        assertEquals( 1, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );
+        assertEquals( 1, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // add cn=Jonny Walker entry
         DefaultServerEntry cnJohnnyWalkerEntry = buildCnJohnnyWalkerEntry();
         masterTable.add( cnJohnnyWalkerEntry );
 
         // check counters
-        assertEquals( 0, masterTable.getOneLevelCount( 3L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 3L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( CN_JOHNNY_WALKER_UUID ) );
+        assertEquals( 0, masterTable.getSubLevelCount( CN_JOHNNY_WALKER_UUID ) );
 
         // check updated counters of ou=Sales entry
-        assertEquals( 1, masterTable.getOneLevelCount( 2L ) );
-        assertEquals( 1, masterTable.getSubLevelCount( 2L ) );
+        assertEquals( 1, masterTable.getOneLevelCount( OU_SALES_ID ) );
+        assertEquals( 1, masterTable.getSubLevelCount( OU_SALES_ID ) );
 
         // check updated counters of context entry
-        assertEquals( 1, masterTable.getOneLevelCount( 1L ) );
-        assertEquals( 2, masterTable.getSubLevelCount( 1L ) );
+        assertEquals( 1, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );
+        assertEquals( 2, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // delete cn=Jonny Walker entry
-        masterTable.delete( 3L, cnJohnnyWalkerEntry );
+        masterTable.delete( CN_JOHNNY_WALKER_UUID, cnJohnnyWalkerEntry );
 
         // check updated counters of ou=Sales entry
-        assertEquals( 0, masterTable.getOneLevelCount( 2L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 2L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( OU_SALES_ID ) );
+        assertEquals( 0, masterTable.getSubLevelCount( OU_SALES_ID ) );
 
         // check updated counters of context entry
-        assertEquals( 1, masterTable.getOneLevelCount( 1L ) );
-        assertEquals( 1, masterTable.getSubLevelCount( 1L ) );
+        assertEquals( 1, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );
+        assertEquals( 1, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // delete ou=Sales entry
-        masterTable.delete( 2L, ouSalesEntry );
+        masterTable.delete( OU_SALES_ID, ouSalesEntry );
 
         // check updated counters of context entry
-        assertEquals( 0, masterTable.getOneLevelCount( 1L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 1L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );
+        assertEquals( 0, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // test counts for non-existing entries
         assertEquals( 0, masterTable.getOneLevelCount( null ) );
         assertEquals( 0, masterTable.getSubLevelCount( null ) );
-        assertEquals( 0, masterTable.getOneLevelCount( 0L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 0L ) );
-        assertEquals( 0, masterTable.getOneLevelCount( 10L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( 10L ) );
-        assertEquals( 0, masterTable.getOneLevelCount( -1L ) );
-        assertEquals( 0, masterTable.getSubLevelCount( -1L ) );
+        assertEquals( 0, masterTable.getOneLevelCount( UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertEquals( 0, masterTable.getSubLevelCount( UUID.fromString( "00000000-0000-0000-0000-000000000000" ) ) );
+        assertEquals( 0, masterTable.getOneLevelCount( UUID.randomUUID() ) );
+        assertEquals( 0, masterTable.getSubLevelCount( UUID.randomUUID() ) );
     }
 
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java Mon Mar  1 22:45:47 2010
@@ -25,6 +25,7 @@
 import static org.junit.Assert.assertTrue;
 
 import java.util.NavigableMap;
+import java.util.UUID;
 
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
@@ -33,7 +34,6 @@
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Before;
 import org.junit.Test;
@@ -90,7 +90,7 @@
     @Test
     public void first() throws Exception
     {
-        objectClassPresenceIndexTable.add( 1L );
+        objectClassPresenceIndexTable.add( CONTEXT_ENTRY_ID );
     }
 
 
@@ -98,37 +98,37 @@
     public void testAdd() throws Exception
     {
         // 1st entry
-        objectClassPresenceIndexTable.add( 1L );
+        objectClassPresenceIndexTable.add( CONTEXT_ENTRY_ID );
 
         HTable objectClassPresenceIndexHTable = new HTable( OBJECTCLASS_PRESENCE_INDEX_TABLE_NAME );
 
-        Get presenceGet = new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes.toBytes( Base64.encodeBytes( Bytes
-            .toBytes( 1L ) ) ) ) );
+        Get presenceGet = new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) ) );
         assertTrue( objectClassPresenceIndexHTable.exists( presenceGet ) );
         Result presenceResult = objectClassPresenceIndexHTable.get( presenceGet );
 
         NavigableMap<byte[], byte[]> presenceInfoMap = presenceResult.getFamilyMap( Bytes.toBytes( "info" ) );
         assertNotNull( presenceInfoMap );
         assertEquals( 1, presenceInfoMap.size() );
-        assertEquals( 1L, Bytes.toLong( presenceInfoMap.get( Bytes.toBytes( "id" ) ) ) );
+        assertEquals( "00000000-0000-0000-0000-000000000001", Bytes.toString( presenceInfoMap
+            .get( Bytes.toBytes( "id" ) ) ) );
 
         // 2nd entry
-        objectClassPresenceIndexTable.add( 2L );
+        objectClassPresenceIndexTable.add( OU_SALES_ID );
 
         // 3rd entry
-        objectClassPresenceIndexTable.add( 3L );
-        jpegPhotoPresenceIndexTable.add( 3L );
+        objectClassPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
 
         HTable jpegPhotoPresenceIndexHTable = new HTable( JPEGPHOTO_PRESENCE_INDEX_TABLE_NAME );
 
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
+            .toBytes( CONTEXT_ENTRY_ID.toString() ) ) ) ) );
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
+            .toBytes( OU_SALES_ID.toString() ) ) ) ) );
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
         assertTrue( jpegPhotoPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
     }
 
 
@@ -136,76 +136,76 @@
     public void testDelete() throws Exception
     {
         // 1st entry
-        objectClassPresenceIndexTable.add( 1L );
+        objectClassPresenceIndexTable.add( CONTEXT_ENTRY_ID );
         // 2nd entry
-        objectClassPresenceIndexTable.add( 2L );
+        objectClassPresenceIndexTable.add( OU_SALES_ID );
         // 3rd entry
-        objectClassPresenceIndexTable.add( 3L );
-        jpegPhotoPresenceIndexTable.add( 3L );
+        objectClassPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
 
         HTable objectClassPresenceIndexHTable = new HTable( OBJECTCLASS_PRESENCE_INDEX_TABLE_NAME );
         HTable jpegPhotoPresenceIndexHTable = new HTable( JPEGPHOTO_PRESENCE_INDEX_TABLE_NAME );
 
         // detete 3rd entry
-        objectClassPresenceIndexTable.drop( 3L );
-        jpegPhotoPresenceIndexTable.drop( 3L );
+        objectClassPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
 
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
+            .toBytes( CONTEXT_ENTRY_ID.toString() ) ) ) ) );
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
+            .toBytes( OU_SALES_ID.toString() ) ) ) ) );
         assertFalse( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
         assertFalse( jpegPhotoPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
 
         // detete 2nd and 1st entry
-        objectClassPresenceIndexTable.drop( 2L );
-        objectClassPresenceIndexTable.drop( 1L );
+        objectClassPresenceIndexTable.drop( OU_SALES_ID );
+        objectClassPresenceIndexTable.drop( CONTEXT_ENTRY_ID );
 
         assertFalse( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
+            .toBytes( CONTEXT_ENTRY_ID.toString() ) ) ) ) );
         assertFalse( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 2L ) ) ) ) ) ) );
+            .toBytes( OU_SALES_ID.toString() ) ) ) ) );
         assertFalse( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
         assertFalse( jpegPhotoPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes( "*" ), Bytes
-            .toBytes( Base64.encodeBytes( Bytes.toBytes( 3L ) ) ) ) ) ) );
+            .toBytes( CN_JOHNNY_WALKER_UUID.toString() ) ) ) ) );
     }
 
 
     @Test
-    public void testCount() throws Exception
+    public void testCounts() throws Exception
     {
         assertEquals( 0, objectClassPresenceIndexTable.count() );
 
         // 1st entry
-        objectClassPresenceIndexTable.add( 1L );
+        objectClassPresenceIndexTable.add( CONTEXT_ENTRY_ID );
 
         assertEquals( 1, objectClassPresenceIndexTable.count() );
 
         // 2nd entry
-        objectClassPresenceIndexTable.add( 2L );
+        objectClassPresenceIndexTable.add( OU_SALES_ID );
 
         assertEquals( 2, objectClassPresenceIndexTable.count() );
 
         // 3rd entry
-        objectClassPresenceIndexTable.add( 3L );
-        jpegPhotoPresenceIndexTable.add( 3L );
+        objectClassPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
 
         assertEquals( 3, objectClassPresenceIndexTable.count() );
         assertEquals( 1, jpegPhotoPresenceIndexTable.count() );
 
         // delete 3rd and 2nd
-        objectClassPresenceIndexTable.drop( 3L );
-        jpegPhotoPresenceIndexTable.drop( 3L );
-        objectClassPresenceIndexTable.drop( 2L );
+        objectClassPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
+        objectClassPresenceIndexTable.drop( OU_SALES_ID );
 
         assertEquals( 1, objectClassPresenceIndexTable.count() );
         assertEquals( 0, jpegPhotoPresenceIndexTable.count() );
 
         // delete 1st
-        objectClassPresenceIndexTable.drop( 1L );
+        objectClassPresenceIndexTable.drop( CONTEXT_ENTRY_ID );
 
         assertEquals( 0, objectClassPresenceIndexTable.count() );
     }
@@ -214,63 +214,63 @@
     @Test
     public void testExists() throws Exception
     {
-        assertFalse( objectClassPresenceIndexTable.exists( 1L ) );
-        assertFalse( objectClassPresenceIndexTable.exists( 2L ) );
-        assertFalse( objectClassPresenceIndexTable.exists( 3L ) );
-        assertFalse( jpegPhotoPresenceIndexTable.exists( 3L ) );
+        assertFalse( objectClassPresenceIndexTable.exists( CONTEXT_ENTRY_ID ) );
+        assertFalse( objectClassPresenceIndexTable.exists( OU_SALES_ID ) );
+        assertFalse( objectClassPresenceIndexTable.exists( CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( jpegPhotoPresenceIndexTable.exists( CN_JOHNNY_WALKER_UUID ) );
 
         // 1st entry
-        objectClassPresenceIndexTable.add( 1L );
+        objectClassPresenceIndexTable.add( CONTEXT_ENTRY_ID );
 
-        assertTrue( objectClassPresenceIndexTable.exists( 1L ) );
+        assertTrue( objectClassPresenceIndexTable.exists( CONTEXT_ENTRY_ID ) );
 
         // 2nd entry
-        objectClassPresenceIndexTable.add( 2L );
+        objectClassPresenceIndexTable.add( OU_SALES_ID );
 
-        assertTrue( objectClassPresenceIndexTable.exists( 2L ) );
+        assertTrue( objectClassPresenceIndexTable.exists( OU_SALES_ID ) );
 
         // 3rd entry
-        objectClassPresenceIndexTable.add( 3L );
-        jpegPhotoPresenceIndexTable.add( 3L );
-        assertTrue( objectClassPresenceIndexTable.exists( 3L ) );
-        assertTrue( jpegPhotoPresenceIndexTable.exists( 3L ) );
+        objectClassPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.add( CN_JOHNNY_WALKER_UUID );
+        assertTrue( objectClassPresenceIndexTable.exists( CN_JOHNNY_WALKER_UUID ) );
+        assertTrue( jpegPhotoPresenceIndexTable.exists( CN_JOHNNY_WALKER_UUID ) );
 
         // delete 3rd and 2nd
-        objectClassPresenceIndexTable.drop( 3L );
-        jpegPhotoPresenceIndexTable.drop( 3L );
-        objectClassPresenceIndexTable.drop( 2L );
-
-        assertTrue( objectClassPresenceIndexTable.exists( 1L ) );
-        assertFalse( objectClassPresenceIndexTable.exists( 2L ) );
-        assertFalse( objectClassPresenceIndexTable.exists( 3L ) );
-        assertFalse( jpegPhotoPresenceIndexTable.exists( 3L ) );
+        objectClassPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
+        jpegPhotoPresenceIndexTable.drop( CN_JOHNNY_WALKER_UUID );
+        objectClassPresenceIndexTable.drop( OU_SALES_ID );
+
+        assertTrue( objectClassPresenceIndexTable.exists( CONTEXT_ENTRY_ID ) );
+        assertFalse( objectClassPresenceIndexTable.exists( OU_SALES_ID ) );
+        assertFalse( objectClassPresenceIndexTable.exists( CN_JOHNNY_WALKER_UUID ) );
+        assertFalse( jpegPhotoPresenceIndexTable.exists( CONTEXT_ENTRY_ID ) );
 
         // delete 1st
-        objectClassPresenceIndexTable.drop( 1L );
+        objectClassPresenceIndexTable.drop( CONTEXT_ENTRY_ID );
 
-        assertFalse( objectClassPresenceIndexTable.exists( 1L ) );
+        assertFalse( objectClassPresenceIndexTable.exists( CONTEXT_ENTRY_ID ) );
     }
 
 
     @Test
-    public void testGetScanKey() throws Exception
+    public void testGetPresenceKey() throws Exception
     {
-        byte[] scanKey = objectClassPresenceIndexTable.getPresenceKey( Bytes.toBytes( 0L ) );
-        assertEquals( "*AAAAAAAAAAA=", Bytes.toString( scanKey ) );
-
-        scanKey = objectClassPresenceIndexTable.getPresenceKey( Bytes.toBytes( Long.MAX_VALUE ) );
-        assertEquals( "*f/////////8=", Bytes.toString( scanKey ) );
+        byte[] scanKey = objectClassPresenceIndexTable.getPresenceKey( UUID
+            .fromString( "00000000-0000-0000-0000-000000000000" ) );
+        assertEquals( "*00000000-0000-0000-0000-000000000000", Bytes.toString( scanKey ) );
+
+        UUID uuid = UUID.randomUUID();
+        scanKey = objectClassPresenceIndexTable.getPresenceKey( uuid );
+        assertEquals( "*" + uuid.toString(), Bytes.toString( scanKey ) );
 
         scanKey = objectClassPresenceIndexTable.getPresenceKey( null );
         assertEquals( "*", Bytes.toString( scanKey ) );
 
         scanKey = objectClassPresenceIndexTable.getPresenceKey( HBasePresenceIndexTable.VALUE_SCAN_FIRST_ENTRYID );
-        assertTrue( Bytes.equals( new byte[]
-            { '*', 0x00 }, scanKey ) );
+        assertEquals( "*00000000-0000-0000-0000-000000000000", Bytes.toString( scanKey ) );
 
         scanKey = objectClassPresenceIndexTable.getPresenceKey( HBasePresenceIndexTable.VALUE_SCAN_LAST_ENTRYID );
-        assertTrue( Bytes.equals( new byte[]
-            { '*', ( byte ) 0xFF }, scanKey ) );
+        assertEquals( "*ffffffff-ffff-ffff-ffff-ffffffffffff", Bytes.toString( scanKey ) );
     }
 
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/resources/hbase-site.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/resources/hbase-site.xml?rev=917770&r1=917769&r2=917770&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/resources/hbase-site.xml (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/resources/hbase-site.xml Mon Mar  1 22:45:47 2010
@@ -10,6 +10,11 @@
     <name>mapred.job.tracker</name>
     <value>hadoop1:9001</value>
   </property>
+  
+  <property>
+    <name>org.apache.directory.compression.algorithm</name>
+    <value>LZO</value>
+  </property>
  -->
   
 </configuration>



Mime
View raw message