directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r905194 [2/2] - 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 Feb 2010 07:08:24 GMT
Copied: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedRunner.java
(from r902620, directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseRunner.java)
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedRunner.java?p2=directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedRunner.java&p1=directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseRunner.java&r1=902620&r2=905194&rev=905194&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseRunner.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedRunner.java
Mon Feb  1 07:08:23 2010
@@ -21,11 +21,15 @@
 
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.junit.Ignore;
+import org.apache.directory.server.core.partition.hbase.it.AbstractHBasePartitionIT;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -47,19 +51,47 @@
         @CreatePartition(
             name = "hbase", 
             suffix = "o=hbase", 
-            type = HBasePartition.class
+            type = HBaseDistributedPartition.class
         ),
         @CreatePartition(
             name = "sevenSeas", 
             suffix = "o=sevenSeas", 
-            type = HBasePartition.class
+            type = HBaseDistributedPartition.class
         ) 
     })
 @CreateLdapServer(transports =
-    { @CreateTransport(protocol = "LDAP", port = 10389) })
-@Ignore
-public class HBaseRunner extends AbstractLdapTestUnit
+    { @CreateTransport(protocol = "LDAP", port = 10389, nbThreads=48) })
+//@Ignore
+public class HBaseDistributedRunner extends AbstractLdapTestUnit
 {
+    protected CoreSession session;
+
+
+    @Before
+    public void initTestData() throws Exception
+    {
+        session = ldapServer.getDirectoryService().getAdminSession();
+
+        if ( !session.exists( new LdapDN( "o=hbase" ) ) || !session.exists( new LdapDN( "ou=test-ou,o=hbase"
) )
+            || !session.exists( new LdapDN( "cn=test-person,ou=test-ou,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createBasicTestData( ldapServer );
+        }
+        if ( !session.exists( new LdapDN( "ou=test1000,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createTestData( 1000, "000", ldapServer );
+        }
+        if ( !session.exists( new LdapDN( "ou=test10000,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createTestData( 10000, "0000", ldapServer );
+        }
+        if ( !session.exists( new LdapDN( "ou=test100000,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createTestData( 100000, "00000", ldapServer );
+        }
+        AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
+    }
+
 
     @Test
     public void runServer() throws Exception

Added: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedRunner.java?rev=905194&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedRunner.java
(added)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedRunner.java
Mon Feb  1 07:08:23 2010
@@ -0,0 +1,122 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.server.core.partition.hbase;
+
+import java.util.Set;
+
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
+import org.apache.directory.server.core.partition.hbase.it.AbstractHBasePartitionIT;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Starts up an ApacheDS LDAP server with an HBase partition.
+ * The partition starts up an embedded HBase partition.  
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith(FrameworkRunner.class)
+@CreateDS(
+    name = "hbase", 
+    enableChangeLog = false,
+    partitions =
+    { 
+        @CreatePartition(
+            name = "hbase", 
+            suffix = "o=hbase",
+            type = HBaseEmbeddedPartition.class,
+            cacheSize=1000,
+            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
),
+            }
+        )
+//        ,
+//        @CreatePartition(
+//            name = "sevenSeas", 
+//            suffix = "o=sevenSeas", 
+//            type = HBaseEmbeddedPartition.class
+//        ) 
+    })
+@CreateLdapServer(transports =
+    { @CreateTransport(protocol = "LDAP", port = 10389, nbThreads=16) })
+//@Ignore
+public class HBaseEmbeddedRunner extends AbstractLdapTestUnit
+{
+    protected CoreSession session;
+
+
+    @Before
+    public void initTestData() throws Exception
+    {
+        session = ldapServer.getDirectoryService().getAdminSession();
+        Set<? extends Partition> partitions = ldapServer.getDirectoryService().getPartitions();
+        System.out.println(partitions);
+
+        if ( !session.exists( new LdapDN( "o=hbase" ) ) || !session.exists( new LdapDN( "ou=test-ou,o=hbase"
) )
+            || !session.exists( new LdapDN( "cn=test-person,ou=test-ou,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createBasicTestData( ldapServer );
+        }
+        if ( !session.exists( new LdapDN( "ou=test1000,o=hbase" ) ) )
+        {
+            AbstractHBasePartitionIT.createTestData( 1000, "000", ldapServer );
+        }
+//        if ( !session.exists( new LdapDN( "ou=test10000,o=hbase" ) ) )
+//        {
+//            AbstractHBasePartitionIT.createTestData( 10000, "0000", ldapServer );
+//        }
+//        if ( !session.exists( new LdapDN( "ou=test100000,o=hbase" ) ) )
+//        {
+//            AbstractHBasePartitionIT.createTestData( 100000, "00000", ldapServer );
+//        }
+        AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
+    }
+
+
+    @Test
+    public void runServer() throws Exception
+    {
+        System.out.println( "ApacheDS started on port " + ldapServer.getPort() + ", press
any key to shutdown..." );
+        System.in.read();
+    }
+
+}
\ No newline at end of file

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java?rev=905194&r1=905193&r2=905194&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
Mon Feb  1 07:08:23 2010
@@ -28,10 +28,10 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.partition.hbase.HBaseClusterTestCaseAdapter;
-import org.apache.directory.server.core.partition.hbase.table.HBaseTableHelper;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -75,7 +75,7 @@
             "apacheds_hbase_index_cn" };
 
 
-    public void createBasicTestData( LdapServer ldapServer ) throws Exception
+    public static void createBasicTestData( LdapServer ldapServer ) throws Exception
     {
         CoreSession session = ldapServer.getDirectoryService().getAdminSession();
         SchemaManager schemaManager = ldapServer.getDirectoryService().getSchemaManager();
@@ -115,13 +115,13 @@
     }
 
 
-    public void createTestData( int number, String pattern, LdapServer ldapServer ) throws
Exception
+    public static void createTestData( int number, String pattern, LdapServer ldapServer
) throws Exception
     {
         createTestData( number, 0, number, pattern, ldapServer );
     }
 
 
-    public void createTestData( int number, int start, int stop, String pattern, LdapServer
ldapServer )
+    public static void createTestData( int number, int start, int stop, String pattern, LdapServer
ldapServer )
         throws Exception
     {
         CoreSession session = ldapServer.getDirectoryService().getAdminSession();
@@ -169,9 +169,9 @@
     }
 
 
-    public void compactDatabase() throws Exception
+    public static void compactDatabase( HBaseConfiguration conf ) throws Exception
     {
-        HBaseAdmin admin = new HBaseAdmin( HBaseTableHelper.getHBaseConfiguration() );
+        HBaseAdmin admin = new HBaseAdmin( conf );
         for ( String table : TABLES )
         {
             if ( admin.tableExists( table ) )

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=905194&r1=905193&r2=905194&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 Feb  1 07:08:23 2010
@@ -39,12 +39,15 @@
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.apache.directory.server.core.partition.hbase.HBasePartition;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
@@ -68,7 +71,15 @@
         @CreatePartition(
             name = "hbase", 
             suffix = "o=hbase", 
-            type = HBasePartition.class
+            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 =

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=905194&r1=905193&r2=905194&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 Feb  1 07:08:23 2010
@@ -32,13 +32,16 @@
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.apache.directory.server.core.partition.hbase.HBasePartition;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -57,7 +60,15 @@
         @CreatePartition(
             name = "hbase", 
             suffix = "o=hbase", 
-            type = HBasePartition.class
+            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 =
@@ -83,7 +94,7 @@
 
             // Flush and compact the database, otherwise the tests
             // would run very slow and an OOM exception could occur.
-            compactDatabase();
+            compactDatabase( adapter.getHBaseConfigurtion() );
         }
     }
 

Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBaseRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBaseRunner.java?rev=905194&r1=905193&r2=905194&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBaseRunner.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBaseRunner.java
Mon Feb  1 07:08:23 2010
@@ -23,9 +23,12 @@
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.apache.directory.server.core.partition.hbase.HBasePartition;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -42,8 +45,25 @@
  * @version $Rev$, $Date$
  */
 @RunWith(FrameworkRunner.class)
-@CreateDS(name = "hbase", enableChangeLog = false, partitions =
-    { @CreatePartition(name = "hbase", suffix = "o=hbase", type = HBasePartition.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") })
 @Ignore
@@ -66,7 +86,7 @@
         {
             createTestData( 10000, "0000", ldapServer );
         }
-        compactDatabase();
+        compactDatabase( adapter.getHBaseConfigurtion() );
     }
 
 

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=905194&r1=905193&r2=905194&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 Feb  1 07:08:23 2010
@@ -88,10 +88,12 @@
             }
         }
 
-        objectClassIndexTable = new HBaseRowIndexTable( "2.5.4.0", schemaManager, TABLE_PREFIX
);
-        jpegPhotoIndexTable = new HBaseRowIndexTable( "0.9.2342.19200300.100.1.60", schemaManager,
TABLE_PREFIX );
-        cnIndexTable = new HBaseColumnIndexTable( "2.5.4.3", schemaManager, TABLE_PREFIX
);
-        userCertificateIndexTable = new HBaseColumnIndexTable( "2.5.4.36", schemaManager,
TABLE_PREFIX );
+        objectClassIndexTable = new HBaseRowIndexTable( "2.5.4.0", schemaManager, TABLE_PREFIX,
adapter.conf, 100 );
+        jpegPhotoIndexTable = new HBaseRowIndexTable( "0.9.2342.19200300.100.1.60", schemaManager,
TABLE_PREFIX,
+            adapter.conf, 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 );
     }
 
 
@@ -99,8 +101,7 @@
     public void first() throws Exception
     {
         DefaultServerEntry entry = buildContextEntry();
-        //cnIndexTable.add( entry.get( "cn" ), 1L );
-        objectClassIndexTable.add( entry.get( "objectClass" ), 1L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
     }
 
 
@@ -109,7 +110,7 @@
     {
         // 1st entry
         DefaultServerEntry entry = buildContextEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ), 1L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 1L );
 
         HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
 
@@ -133,12 +134,15 @@
 
         // 2nd entry
         entry = buildOuSalesEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ), 2L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), 2L );
+        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), 2L );
 
         // 3rd entry
         entry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ), 3L );
-        cnIndexTable.add( entry.get( "cn" ), 3L );
+        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 );
 
         HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
 
@@ -183,23 +187,28 @@
     {
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
1L );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
2L );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ), 3L );
+        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 );
 
         HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
         HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
 
         // detete 3rd entry
-        objectClassIndexTable.delete( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.delete( cnEntry.get( "cn" ), 3L );
+        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 ) ) ) ) ) ) );
@@ -235,8 +244,9 @@
         assertEquals( 0L, Bytes.toLong( cnCountInfoMap.get( Bytes.toBytes( "count" ) ) )
);
 
         // detete 2nd and 1st entry
-        objectClassIndexTable.delete( ouSalesEntry.get( "objectClass" ), 2L );
-        objectClassIndexTable.delete( contextEntry.get( "objectClass" ), 1L );
+        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 ) ) ) ) ) ) );
@@ -264,30 +274,36 @@
 
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
1L );
 
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
2L );
 
         assertEquals( 1, objectClassIndexTable.count( "top" ) );
         assertEquals( 1, objectClassIndexTable.count( "organizationalunit" ) );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ), 3L );
+        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 );
 
         assertEquals( 2, objectClassIndexTable.count( "top" ) );
         assertEquals( 1, objectClassIndexTable.count( "person" ) );
         assertEquals( 1, cnIndexTable.count( "johnny \u65E5\u672C walker" ) );
 
         // delete 3rd and 2nd
-        objectClassIndexTable.delete( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.delete( cnEntry.get( "cn" ), 3L );
-        objectClassIndexTable.delete( ouSalesEntry.get( "objectClass" ), 2L );
+        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 );
 
         assertEquals( 0, objectClassIndexTable.count( "organizationalunit" ) );
         assertEquals( 0, objectClassIndexTable.count( "top" ) );
@@ -296,7 +312,7 @@
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // delete 1st
-        objectClassIndexTable.delete( contextEntry.get( "objectClass" ), 1L );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
1L );
 
         assertEquals( 0, objectClassIndexTable.count( "organization" ) );
 
@@ -328,30 +344,36 @@
 
         // 1st entry
         DefaultServerEntry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ), 1L );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
1L );
 
         assertTrue( objectClassIndexTable.exists( "organization", 1L ) );
 
         // 2nd entry
         DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ), 2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
2L );
+        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
2L );
 
         assertTrue( objectClassIndexTable.exists( "organizationalunit", 2L ) );
         assertTrue( objectClassIndexTable.exists( "top", 2L ) );
 
         // 3rd entry
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        objectClassIndexTable.add( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.add( cnEntry.get( "cn" ), 3L );
+        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 ) );
 
         // delete 3rd and 2nd
-        objectClassIndexTable.delete( cnEntry.get( "objectClass" ), 3L );
-        cnIndexTable.delete( cnEntry.get( "cn" ), 3L );
-        objectClassIndexTable.delete( ouSalesEntry.get( "objectClass" ), 2L );
+        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 ) );
@@ -361,7 +383,7 @@
         assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", 3L ) );
 
         // delete 1st
-        objectClassIndexTable.delete( contextEntry.get( "objectClass" ), 1L );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
1L );
 
         assertFalse( objectClassIndexTable.exists( "organization", 1L ) );
 
@@ -459,7 +481,7 @@
     public void testGetColumnCandidates() throws Exception
     {
         DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
-        cnIndexTable.add( cnEntry.get( "cn" ), 3L );
+        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), 3L );
 
         List<Long> candidates = cnIndexTable.getColumnCandidates( "johnny \u65E5\u672C
walker" );
         assertNotNull( candidates );

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=905194&r1=905193&r2=905194&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 Feb  1 07:08:23 2010
@@ -28,6 +28,7 @@
 import java.util.NavigableMap;
 
 import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
@@ -84,7 +85,13 @@
             }
         }
 
-        masterTable = new HBaseMasterTable( schemaManager, suffixDn, TABLE_PREFIX );
+        HBaseStore store = new HBaseStore();
+        store.setSuffixDn( suffixDn.getName() );
+        store.setCacheSize( 100 );
+        store.setTablePrefix( TABLE_PREFIX );
+        store.init( schemaManager );
+        
+        masterTable = new HBaseMasterTable( store );
     }
 
 

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=905194&r1=905193&r2=905194&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 Feb  1 07:08:23 2010
@@ -82,9 +82,10 @@
             }
         }
 
-        objectClassPresenceIndexTable = new HBasePresenceIndexTable( "2.5.4.0", schemaManager,
TABLE_PREFIX );
+        objectClassPresenceIndexTable = new HBasePresenceIndexTable( "2.5.4.0", schemaManager,
TABLE_PREFIX,
+            adapter.conf, 100 );
         jpegPhotoPresenceIndexTable = new HBasePresenceIndexTable( "0.9.2342.19200300.100.1.60",
schemaManager,
-            TABLE_PREFIX );
+            TABLE_PREFIX, adapter.conf, 100 );
     }
 
 
@@ -172,8 +173,8 @@
         HTable jpegPhotoPresenceIndexHTable = new HTable( JPEGPHOTO_PRESENCE_INDEX_TABLE_NAME
);
 
         // detete 3rd entry
-        objectClassPresenceIndexTable.delete( 3L );
-        jpegPhotoPresenceIndexTable.delete( 3L );
+        objectClassPresenceIndexTable.drop( 3L );
+        jpegPhotoPresenceIndexTable.drop( 3L );
 
         assertTrue( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes(
"*" ), Bytes
             .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
@@ -201,8 +202,8 @@
         assertEquals( 0L, Bytes.toLong( countInfoMap.get( Bytes.toBytes( "count" ) ) ) );
 
         // detete 2nd and 1st entry
-        objectClassPresenceIndexTable.delete( 2L );
-        objectClassPresenceIndexTable.delete( 1L );
+        objectClassPresenceIndexTable.drop( 2L );
+        objectClassPresenceIndexTable.drop( 1L );
 
         assertFalse( objectClassPresenceIndexHTable.exists( new Get( Bytes.add( Bytes.toBytes(
"*" ), Bytes
             .toBytes( Base64.encodeBytes( Bytes.toBytes( 1L ) ) ) ) ) ) );
@@ -238,15 +239,15 @@
         assertEquals( 1, jpegPhotoPresenceIndexTable.count() );
 
         // delete 3rd and 2nd
-        objectClassPresenceIndexTable.delete( 3L );
-        jpegPhotoPresenceIndexTable.delete( 3L );
-        objectClassPresenceIndexTable.delete( 2L );
+        objectClassPresenceIndexTable.drop( 3L );
+        jpegPhotoPresenceIndexTable.drop( 3L );
+        objectClassPresenceIndexTable.drop( 2L );
 
         assertEquals( 1, objectClassPresenceIndexTable.count() );
         assertEquals( 0, jpegPhotoPresenceIndexTable.count() );
 
         // delete 1st
-        objectClassPresenceIndexTable.delete( 1L );
+        objectClassPresenceIndexTable.drop( 1L );
 
         assertEquals( 0, objectClassPresenceIndexTable.count() );
     }
@@ -277,9 +278,9 @@
         assertTrue( jpegPhotoPresenceIndexTable.exists( 3L ) );
 
         // delete 3rd and 2nd
-        objectClassPresenceIndexTable.delete( 3L );
-        jpegPhotoPresenceIndexTable.delete( 3L );
-        objectClassPresenceIndexTable.delete( 2L );
+        objectClassPresenceIndexTable.drop( 3L );
+        jpegPhotoPresenceIndexTable.drop( 3L );
+        objectClassPresenceIndexTable.drop( 2L );
 
         assertTrue( objectClassPresenceIndexTable.exists( 1L ) );
         assertFalse( objectClassPresenceIndexTable.exists( 2L ) );
@@ -287,7 +288,7 @@
         assertFalse( jpegPhotoPresenceIndexTable.exists( 3L ) );
 
         // delete 1st
-        objectClassPresenceIndexTable.delete( 1L );
+        objectClassPresenceIndexTable.drop( 1L );
 
         assertFalse( objectClassPresenceIndexTable.exists( 1L ) );
     }



Mime
View raw message