directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1154690 - in /directory/sandbox/seelmann/hbase-partition: ./ src/main/java/org/apache/directory/server/core/partition/hbase/ src/main/java/org/apache/directory/server/core/partition/hbase/table/ src/test/java/org/apache/directory/server/co...
Date Sun, 07 Aug 2011 10:45:25 GMT
Author: seelmann
Date: Sun Aug  7 10:45:25 2011
New Revision: 1154690

URL: http://svn.apache.org/viewvc?rev=1154690&view=rev
Log:
Removed embedded hbase since it is useless. Fixed tests, basic tests are working now.

Removed:
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.java
Modified:
    directory/sandbox/seelmann/hbase-partition/pom.xml
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseContext.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java

Modified: directory/sandbox/seelmann/hbase-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/pom.xml?rev=1154690&r1=1154689&r2=1154690&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/pom.xml (original)
+++ directory/sandbox/seelmann/hbase-partition/pom.xml Sun Aug  7 10:45:25 2011
@@ -34,12 +34,6 @@
   </description>
 
   <dependencies>
-    <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-      <version>3.2.1</version>
-    </dependency>
-    
     <!-- Dependencies to ApacheDS, for partition implementation -->
     <dependency>
       <groupId>org.apache.directory.shared</groupId>
@@ -49,42 +43,56 @@
       <groupId>org.apache.directory.shared</groupId>
       <artifactId>shared-ldap-schema-data</artifactId>
     </dependency>
-    
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-xdbm-partition</artifactId>
     </dependency>
-    
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-core</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>apacheds-core-annotations</artifactId>
-    </dependency>
-
     <!-- HBase dependencies -->
     <dependency>
-    	<groupId>org.apache.hbase</groupId>
-    	<artifactId>hbase</artifactId>
-    	<version>0.90.3</version>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase</artifactId>
+      <version>0.90.3</version>
     </dependency>
+
+    <!-- HBase testdependencies -->
     <dependency>
-    	<groupId>org.apache.hbase</groupId>
-    	<artifactId>hbase</artifactId>
-    	<version>0.90.3</version>
-    	<classifier>tests</classifier>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase</artifactId>
+      <version>0.90.3</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
     </dependency>
-<!--
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-test</artifactId>
-      <version>0.20.3-append-r964955-1240</version>
+      <version>0.20-append-r1056497</version>
       <scope>test</scope>
     </dependency>
--->
+    <!-- Tests hang without setting those two Jetty dependencies to version 6.1.26. -->
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <version>6.1.26</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>6.1.26</version>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
@@ -124,6 +132,21 @@
       
     </plugins>
   </build>
+  
+  <repositories>
+    <!-- Repo with hadoop 0.20-append-r1056497 -->
+    <repository>
+      <id>temp-thrift</id>
+      <name>Thrift 0.2.0</name>
+      <url>http://people.apache.org/~rawson/repo/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+    </repository>
+  </repositories>
 
 </project>
 

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseContext.java?rev=1154690&r1=1154689&r2=1154690&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseContext.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseContext.java
Sun Aug  7 10:45:25 2011
@@ -6,6 +6,7 @@ import java.util.UUID;
 import org.apache.directory.server.core.partition.hbase.index.HBaseUserIndex;
 import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
 import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
+import org.apache.directory.server.xdbm.IndexNotFoundException;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -25,6 +26,7 @@ public interface HBaseContext extends St
 
     boolean hasUserIndexOn( String attributeId ) throws LdapException;
 
-    HBaseUserIndex<HBaseIndexTable> getIndex( String attributeTypeOid );
+    // TODO: user getIndex(AttributeType)
+    HBaseUserIndex<HBaseIndexTable> getIndex( String attributeTypeOid ) throws LdapException,
IndexNotFoundException;
 
 }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java?rev=1154690&r1=1154689&r2=1154690&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
Sun Aug  7 10:45:25 2011
@@ -42,9 +42,11 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.hbase.xdbmext.ExtendedOptimizer;
 import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition;
 import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexNotFoundException;
 import org.apache.directory.server.xdbm.search.impl.DefaultSearchEngine;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -102,6 +104,7 @@ public class HBaseDistributedPartition e
         searchEngine = new DefaultSearchEngine<UUID>( this, cursorBuilder, evaluatorBuilder,
optimizer );
 
         // initialize the store
+        // TODO: need to find a better way to get the DS instance name
         File partitionDir = new File( getPartitionPath() );
         String directoryServiceInstanceName = partitionDir.getParentFile().getParentFile().getName();
         this.tablePrefix = "apacheds" + "_" + directoryServiceInstanceName + "_" + id + "_";
@@ -117,17 +120,7 @@ public class HBaseDistributedPartition e
             addIndex( index );
         }
 
-        // TODO: this switch doesn't work
-        if ( partitionDir != null )
-        {
-            embeddedHBase = EmbeddedHBase.getInstance( partitionDir );
-            embeddedHBase.start( tablePrefix + HBaseMasterTable.TREE_TABLE );
-            configuration = embeddedHBase.getConfiguration();
-        }
-        else
-        {
-            configuration = HBaseConfiguration.create();
-        }
+        configuration = HBaseConfiguration.create();
         
         super.doInit();
         
@@ -254,6 +247,11 @@ public class HBaseDistributedPartition e
         return ( HBaseMasterTable ) master;
     }
 
+    public void setTablePrefix( String tablePrefix )
+    {
+        this.tablePrefix = tablePrefix;
+    }
+    
     public String getTablePrefix()
     {
         return tablePrefix;
@@ -271,10 +269,10 @@ public class HBaseDistributedPartition e
     }
 
     @Override
-    public HBaseUserIndex<HBaseIndexTable> getIndex( String attributeTypeOid )
+    public HBaseUserIndex<HBaseIndexTable> getIndex( String attributeTypeOid ) throws
LdapException, IndexNotFoundException
     {
-        // TODO Auto-generated method stub
-        return null;
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( attributeTypeOid );
+        return ( HBaseUserIndex<HBaseIndexTable> ) getIndex( at );
     }
 
 }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java?rev=1154690&r1=1154689&r2=1154690&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
Sun Aug  7 10:45:25 2011
@@ -203,7 +203,7 @@ public class HBaseStore //extends Abstra
 //        return id;
 //    }
 
-
+/*
     public Entry lookup( UUID id ) throws Exception
     {
         Entry entry = getMasterTable().fetchEntry( id );
@@ -250,7 +250,7 @@ public class HBaseStore //extends Abstra
         UUID newParentId = newParentDn != null ? getEntryId( newParentDn ) : null;
         getMasterTable().move( id, newParentId, null );
     }
-
+*/
 
 //    public void sync() throws Exception
 //    {

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java?rev=1154690&r1=1154689&r2=1154690&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
(original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
Sun Aug  7 10:45:25 2011
@@ -687,8 +687,9 @@ public class HBaseMasterTable implements
             }
             path.add( 0, parentId );
 
-            int stop = includeChild ? dn.size() : dn.size() - 1;
-            for ( int i = suffixDn.size(); i < stop; i++ )
+            int start = dn.size() - suffixDn.size() - 1;
+            int stop = includeChild ? 0 : 1;
+            for ( int i = start; i >= stop; i-- )
             {
                 Rdn rdn = dn.getRdn( i );
                 MasterTreeInfo mti = new MasterTreeInfo( parentId, rdn.getNormName(), null
);

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=1154690&r1=1154689&r2=1154690&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
Sun Aug  7 10:45:25 2011
@@ -22,20 +22,24 @@ package org.apache.directory.server.core
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
 import java.util.UUID;
 
-import org.apache.directory.server.core.partition.hbase.HBaseStore;
-import org.apache.directory.shared.ldap.csn.CsnFactory;
+import org.apache.directory.shared.ldap.model.csn.CsnFactory;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.ldap.model.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.model.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
-import org.apache.directory.shared.ldap.model.schema.loader.ldif.LdifSchemaLoader;
-import org.apache.directory.shared.ldap.model.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.util.LdapExceptionUtils;
+import org.apache.directory.shared.ldap.schemaextractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
 
@@ -47,16 +51,21 @@ import org.junit.BeforeClass;
  */
 public abstract class AbstractHBaseTableTest
 {
-    protected static final String TABLE_PREFIX = "apacheds_test_";
+    protected static final String PARTITION_ID = "test";
+    protected static final String INSTANCE_NAME = "testinstance";
+    protected static final String TABLE_PREFIX = "apacheds_"+INSTANCE_NAME+"_"+PARTITION_ID+"_";
     protected static final CsnFactory CSN_FACTORY = new CsnFactory( 0 );
     protected static SchemaManager schemaManager;
     protected static Dn suffixDn;
     protected static String workingDirectory;
+    protected static String instanceDirectory;
+    protected static String partitionsDirectory;
 
     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"
);
 
+    protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
 
     /**
      * Init schema manager and suffix
@@ -72,6 +81,9 @@ public abstract class AbstractHBaseTable
             int targetPos = path.indexOf( "target" );
             workingDirectory = path.substring( 0, targetPos + 6 );
         }
+        
+        instanceDirectory = new File(workingDirectory, INSTANCE_NAME).getAbsolutePath();
+        partitionsDirectory = new File(instanceDirectory, "partitions").getAbsolutePath();
 
         File schemaRepository = new File( workingDirectory, "schema" );
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
@@ -83,11 +95,34 @@ public abstract class AbstractHBaseTable
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors()
) );
+            fail( "Schema load failed : " + Strings.listToString( schemaManager.getErrors()
) );
         }
 
-        suffixDn = new Dn( "o=Good Times Co." );
-        suffixDn.normalize( schemaManager.getNormalizerMapping() );
+        suffixDn = new Dn( schemaManager, "o=Good Times Co." );
+    }
+
+
+    @BeforeClass
+    public static void startHBaseCluster() throws Exception
+    {
+        // clear test directory system property
+        System.clearProperty(HBaseTestingUtility.TEST_DIRECTORY_KEY);
+            
+        // start the cluster
+        UTIL.startMiniCluster();
+
+        // write configuration to file, this is read from the partition implementation
+        URL resource = AbstractHBaseTableTest.class.getResource( "/hbase-site.xml" );
+        FileOutputStream fos = new FileOutputStream( resource.getFile() );
+        UTIL.getConfiguration().writeXml( fos );
+        fos.close();
+    }
+
+
+    @AfterClass
+    public static void stopHBaseCluser() throws IOException
+    {
+        UTIL.shutdownMiniCluster();
     }
 
 
@@ -106,8 +141,7 @@ public abstract class AbstractHBaseTable
 
     protected Entry buildOuSalesEntry() throws LdapException
     {
-        Dn dn = new Dn( "ou=Sales \\E6\\97\\A5\\E6\\9C\\AC,o=Good Times Co." );
-        dn.normalize( schemaManager.getNormalizerMapping() );
+        Dn dn = new Dn( schemaManager, "ou=Sales \\E6\\97\\A5\\E6\\9C\\AC,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn );
         entry.add( "objectClass", "top", "organizationalUnit" );
         entry.add( "ou", "Sales \u65E5\u672C" );
@@ -121,9 +155,8 @@ public abstract class AbstractHBaseTable
 
     protected Entry buildCnJohnnyWalkerEntry() throws LdapException
     {
-        Dn dn = new Dn(
+        Dn dn = new Dn( schemaManager, 
             "cn=JOhnny \\E6\\97\\A5\\E6\\9C\\AC WAlkeR,ou=Sales \\E6\\97\\A5\\E6\\9C\\AC,o=Good
Times Co." );
-        dn.normalize( schemaManager.getNormalizerMapping() );
         Entry entry = new DefaultEntry( schemaManager, dn );
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "ou", "Sales" );

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=1154690&r1=1154689&r2=1154690&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
Sun Aug  7 10:45:25 2011
@@ -29,11 +29,12 @@ import java.util.List;
 import java.util.NavigableMap;
 import java.util.UUID;
 
-import org.apache.directory.server.core.partition.hbase.HBaseStore;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
 import org.apache.directory.server.core.partition.hbase.Utils;
 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.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -62,7 +63,7 @@ public class HBaseIndexTableTest extends
     private HBaseRowIndexTable jpegPhotoIndexTable;
     private HBaseColumnIndexTable cnIndexTable;
     private HBaseColumnIndexTable userCertificateIndexTable;
-    private HBaseStore store;
+    private HBaseDistributedPartition store;
 
 
     /**
@@ -72,34 +73,35 @@ public class HBaseIndexTableTest extends
     @Before
     public void setup() throws Exception
     {
-        store = new HBaseStore();
-        store.setPartitionDir( new File( workingDirectory, "store" ) );
+        store = new HBaseDistributedPartition( schemaManager );
+        store.setPartitionPath( new File( partitionsDirectory, "store" ).toURI() );
         store.setSuffixDn( suffixDn );
         store.setCacheSize( 100 );
         store.setTablePrefix( TABLE_PREFIX );
+        store.setId( PARTITION_ID );
 
         HBaseUserRowIndex index1 = new HBaseUserRowIndex();
         index1.setAttributeId( "2.5.4.0" );
         index1.setCacheSize( 100 );
-        index1.setStore( store );
+        index1.setContext( store );
         store.addIndex( index1 );
 
         HBaseUserRowIndex index2 = new HBaseUserRowIndex();
         index2.setAttributeId( "0.9.2342.19200300.100.1.60" );
-        index2.setStore( store );
+        index2.setContext( store );
         store.addIndex( index2 );
 
         HBaseUserColumnIndex index3 = new HBaseUserColumnIndex();
         index3.setAttributeId( "2.5.4.3" );
-        index3.setStore( store );
+        index3.setContext( store );
         store.addIndex( index3 );
 
         HBaseUserColumnIndex index4 = new HBaseUserColumnIndex();
         index4.setAttributeId( "2.5.4.36" );
-        index4.setStore( store );
+        index4.setContext( store );
         store.addIndex( index4 );
 
-        store.init( schemaManager );
+        store.initialize();
 
         HBaseAdmin admin = new HBaseAdmin( store.getConfiguration() );
         if ( admin.tableExists( CN_INDEX_TABLE_NAME ) )
@@ -128,14 +130,14 @@ public class HBaseIndexTableTest extends
         cnIndexTable = index3.getIndexTable();
         userCertificateIndexTable = index4.getIndexTable();
     }
-
+    
 
     @Test
     public void testAdd() throws Exception
     {
         // 1st entry
         Entry entry = buildContextEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID
);
+        objectClassIndexTable.add( entry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME
);
 
@@ -150,15 +152,18 @@ public class HBaseIndexTableTest extends
 
         // 2nd entry
         entry = buildOuSalesEntry();
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), OU_SALES_ID
);
-        objectClassIndexTable.add( entry.get( "objectClass" ).get( 1 ).getBytes(), OU_SALES_ID
);
+        for ( Value<?> value : entry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), OU_SALES_ID );
+        }
 
         // 3rd entry
         entry = buildCnJohnnyWalkerEntry();
-        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 );
+        for ( Value<?> value : entry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.add( entry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
 
         HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME
);
 
@@ -189,28 +194,32 @@ public class HBaseIndexTableTest extends
     {
         // 1st entry
         Entry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
CONTEXT_ENTRY_ID );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         // 2nd entry
         Entry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
OU_SALES_ID );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
OU_SALES_ID );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), OU_SALES_ID );
+        }
 
         // 3rd entry
         Entry cnEntry = buildCnJohnnyWalkerEntry();
-        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
);
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.add( cnEntry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
 
         HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME
);
         HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME
);
 
         // detete 3rd entry
-        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
);
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.drop( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.drop( cnEntry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
 
         assertTrue( objectClassIndexHTable.exists( new Get( Bytes
             .toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
@@ -228,9 +237,11 @@ public class HBaseIndexTableTest extends
         assertTrue( cnIndexHTable.exists( new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker"
) ) ) );
 
         // detete 2nd and 1st entry
-        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 );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), OU_SALES_ID );
+        }
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         assertTrue( objectClassIndexHTable.exists( new Get( Bytes
             .toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
@@ -254,7 +265,7 @@ public class HBaseIndexTableTest extends
         {
             // add + verify
             Entry entry = buildContextEntry();
-            objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID
);
+            objectClassIndexTable.add( entry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
             HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME
);
 
             Get existsGet = new Get( Bytes.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001"
) );
@@ -266,7 +277,7 @@ public class HBaseIndexTableTest extends
             assertEquals( "e", Bytes.toString( existsInfoMap.get( Bytes.toBytes( "status"
) ) ) );
 
             // delete + verify
-            objectClassIndexTable.drop( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID
);
+            objectClassIndexTable.drop( entry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
             Get deletedGet = new Get( Bytes.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001"
) );
             assertTrue( objectClassIndexHTable.exists( deletedGet ) );
@@ -280,7 +291,7 @@ public class HBaseIndexTableTest extends
         {
             // add + verify
             Entry entry = buildCnJohnnyWalkerEntry();
-            cnIndexTable.add( entry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID
);
+            cnIndexTable.add( entry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
             HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME
);
 
             Get existsGet = new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker" ) );
@@ -292,7 +303,7 @@ public class HBaseIndexTableTest extends
             assertEquals( "e", Bytes.toString( existsInfoMap.get( Utils.toBytes( CN_JOHNNY_WALKER_UUID
) ) ) );
 
             // delete + verify
-            cnIndexTable.drop( entry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID
);
+            cnIndexTable.drop( entry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID
);
 
             Get deletedGet = new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker" ) );
             assertTrue( cnIndexHTable.exists( deletedGet ) );
@@ -316,36 +327,42 @@ public class HBaseIndexTableTest extends
 
         // 1st entry
         Entry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
CONTEXT_ENTRY_ID );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // 2nd entry
         Entry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
OU_SALES_ID );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
OU_SALES_ID );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), OU_SALES_ID );
+        }
 
         assertEquals( 1, objectClassIndexTable.count( "top" ) );
         assertEquals( 1, objectClassIndexTable.count( "organizationalunit" ) );
 
         // 3rd entry
         Entry cnEntry = buildCnJohnnyWalkerEntry();
-        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
);
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.add( cnEntry.get( "cn" ).get().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(), 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 );
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.drop( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.drop( cnEntry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.drop( value.getBytes(), OU_SALES_ID );
+        }        
 
         assertEquals( 0, objectClassIndexTable.count( "organizationalunit" ) );
         assertEquals( 0, objectClassIndexTable.count( "top" ) );
@@ -354,7 +371,7 @@ public class HBaseIndexTableTest extends
         assertEquals( 1, objectClassIndexTable.count( "organization" ) );
 
         // delete 1st
-        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
CONTEXT_ENTRY_ID );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         assertEquals( 0, objectClassIndexTable.count( "organization" ) );
 
@@ -386,36 +403,42 @@ public class HBaseIndexTableTest extends
 
         // 1st entry
         Entry contextEntry = buildContextEntry();
-        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
CONTEXT_ENTRY_ID );
+        objectClassIndexTable.add( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         assertTrue( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
 
         // 2nd entry
         Entry ouSalesEntry = buildOuSalesEntry();
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 0 ).getBytes(),
OU_SALES_ID );
-        objectClassIndexTable.add( ouSalesEntry.get( "objectClass" ).get( 1 ).getBytes(),
OU_SALES_ID );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), OU_SALES_ID );
+        }
 
         assertTrue( objectClassIndexTable.exists( "organizationalunit", OU_SALES_ID ) );
         assertTrue( objectClassIndexTable.exists( "top", OU_SALES_ID ) );
 
         // 3rd entry
         Entry cnEntry = buildCnJohnnyWalkerEntry();
-        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
);
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.add( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.add( cnEntry.get( "cn" ).get().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(), 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 );
+        for ( Value<?> value : cnEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.drop( value.getBytes(), CN_JOHNNY_WALKER_UUID );
+        }
+        cnIndexTable.drop( cnEntry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
+        for ( Value<?> value : ouSalesEntry.get( "objectClass" ) )
+        {
+            objectClassIndexTable.drop( value.getBytes(), OU_SALES_ID );
+        }
 
         assertTrue( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
         assertFalse( objectClassIndexTable.exists( "organizationalunit", OU_SALES_ID ) );
@@ -425,7 +448,7 @@ public class HBaseIndexTableTest extends
         assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", CN_JOHNNY_WALKER_UUID
) );
 
         // delete 1st
-        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get( 0 ).getBytes(),
CONTEXT_ENTRY_ID );
+        objectClassIndexTable.drop( contextEntry.get( "objectClass" ).get().getBytes(), CONTEXT_ENTRY_ID
);
 
         assertFalse( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
 
@@ -526,7 +549,7 @@ public class HBaseIndexTableTest extends
     public void testGetColumnCandidates() throws Exception
     {
         Entry cnEntry = buildCnJohnnyWalkerEntry();
-        cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID
);
+        cnIndexTable.add( cnEntry.get( "cn" ).get().getBytes(), CN_JOHNNY_WALKER_UUID );
 
         List<UUID> 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=1154690&r1=1154689&r2=1154690&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
Sun Aug  7 10:45:25 2011
@@ -28,7 +28,7 @@ import java.io.File;
 import java.util.NavigableMap;
 import java.util.UUID;
 
-import org.apache.directory.server.core.partition.hbase.HBaseStore;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
 import org.apache.directory.server.core.partition.hbase.Utils;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -56,7 +56,7 @@ public class HBaseMasterTableTest extend
 
     private static final String MASTER_TABLE_NAME = TABLE_PREFIX + "master";
     private static final String TREE_TABLE_NAME = TABLE_PREFIX + "tree";
-    private HBaseStore store;
+    private HBaseDistributedPartition store;
     private HBaseMasterTable masterTable;
 
 
@@ -67,12 +67,15 @@ public class HBaseMasterTableTest extend
     @Before
     public void setup() throws Exception
     {
-        store = new HBaseStore();
-        store.setPartitionDir( new File( workingDirectory, "store" ) );
+        store = new HBaseDistributedPartition( schemaManager );
+        store.setPartitionPath( new File( partitionsDirectory, "store" ).toURI() );
         store.setSuffixDn( suffixDn );
         store.setCacheSize( 100 );
         store.setTablePrefix( TABLE_PREFIX );
-        store.init( schemaManager );
+        store.setId( PARTITION_ID );
+        
+        store.initialize();
+        
         masterTable = store.getMasterTable();
 
         HBaseAdmin admin = new HBaseAdmin( store.getConfiguration() );
@@ -200,7 +203,7 @@ public class HBaseMasterTableTest extend
         HTable treeHTable = new HTable( store.getConfiguration(), TREE_TABLE_NAME );
 
         // delete second entry
-        masterTable.delete( OU_SALES_ID, entry );
+        masterTable.remove( OU_SALES_ID, entry );
         Get masterGet = new Get( Bytes.toBytes( OU_SALES_ID.toString() ) );
         assertTrue( masterHTable.exists( masterGet ) );
         Get treeGet = new Get( Bytes.add( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ), Bytes.toBytes(
"," ), Bytes
@@ -209,7 +212,7 @@ public class HBaseMasterTableTest extend
         assertTrue( masterHTable.exists( new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString()
) ) ) );
 
         // delete context entry
-        masterTable.delete( CONTEXT_ENTRY_ID, entry );
+        masterTable.remove( CONTEXT_ENTRY_ID, entry );
         masterGet = new Get( Bytes.toBytes( CONTEXT_ENTRY_ID.toString() ) );
         assertTrue( masterHTable.exists( masterGet ) );
         treeGet = new Get( Bytes.add( Bytes.toBytes( "00000000-0000-0000-0000-000000000000"
), Bytes.toBytes( "," ),
@@ -282,8 +285,7 @@ public class HBaseMasterTableTest extend
         masterTable.add( entry );
 
         // rename
-        Rdn rdn = new Rdn( "ou=SaLeS-US" );
-        rdn.normalize( schemaManager.getNormalizerMapping() );
+        Rdn rdn = new Rdn( schemaManager, "ou=SaLeS-US" );
         masterTable.move( OU_SALES_ID, null, rdn );
 
         HTable masterHTable = new HTable( store.getConfiguration(), MASTER_TABLE_NAME );
@@ -377,7 +379,7 @@ public class HBaseMasterTableTest extend
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        masterTable.remove( OU_SALES_ID, ouSalesEntry );
         assertNull( masterTable.fetchId( ouSalesEntry.getDn() ) );
 
         // fetch entry IDs of non-existing entries
@@ -417,7 +419,7 @@ public class HBaseMasterTableTest extend
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        masterTable.remove( OU_SALES_ID, ouSalesEntry );
         assertNull( masterTable.fetchParentId( OU_SALES_ID ) );
 
         // fetch parent IDs of non-existing entries
@@ -465,7 +467,7 @@ public class HBaseMasterTableTest extend
         assertEquals( 0, count6 - count5 );
 
         // check result after deleting the entry
-        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        masterTable.remove( OU_SALES_ID, ouSalesEntry );
         assertNull( masterTable.fetchEntry( OU_SALES_ID ) );
 
         // fetch non-existing entries
@@ -515,7 +517,7 @@ public class HBaseMasterTableTest extend
         assertEquals( 2, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // delete cn=Jonny Walker entry
-        masterTable.delete( CN_JOHNNY_WALKER_UUID, cnJohnnyWalkerEntry );
+        masterTable.remove( CN_JOHNNY_WALKER_UUID, cnJohnnyWalkerEntry );
 
         // check updated counters of ou=Sales entry
         assertEquals( 0, masterTable.getOneLevelCount( OU_SALES_ID ) );
@@ -526,7 +528,7 @@ public class HBaseMasterTableTest extend
         assertEquals( 1, masterTable.getSubLevelCount( CONTEXT_ENTRY_ID ) );
 
         // delete ou=Sales entry
-        masterTable.delete( OU_SALES_ID, ouSalesEntry );
+        masterTable.remove( OU_SALES_ID, ouSalesEntry );
 
         // check updated counters of context entry
         assertEquals( 0, masterTable.getOneLevelCount( CONTEXT_ENTRY_ID ) );

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=1154690&r1=1154689&r2=1154690&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
Sun Aug  7 10:45:25 2011
@@ -28,7 +28,7 @@ import java.io.File;
 import java.util.NavigableMap;
 import java.util.UUID;
 
-import org.apache.directory.server.core.partition.hbase.HBaseStore;
+import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -53,7 +53,7 @@ public class HBasePresenceIndexTableTest
     private static final String JPEGPHOTO_PRESENCE_INDEX_TABLE_NAME = TABLE_PREFIX + "index_jpegPhoto";
     private HBasePresenceIndexTable objectClassPresenceIndexTable;
     private HBasePresenceIndexTable jpegPhotoPresenceIndexTable;
-    private HBaseStore store;
+    private HBaseDistributedPartition store;
 
 
     /**
@@ -63,12 +63,14 @@ public class HBasePresenceIndexTableTest
     @Before
     public void setup() throws Exception
     {
-        store = new HBaseStore();
-        store.setPartitionDir( new File( workingDirectory, "store" ) );
+        store = new HBaseDistributedPartition( schemaManager );
+        store.setPartitionPath( new File( partitionsDirectory, "store" ).toURI() );
         store.setSuffixDn( suffixDn );
         store.setCacheSize( 100 );
         store.setTablePrefix( TABLE_PREFIX );
-        store.init( schemaManager );
+        store.setId( PARTITION_ID );
+        
+        store.initialize();
 
         HBaseAdmin admin = new HBaseAdmin( store.getConfiguration() );
         if ( admin.tableExists( OBJECTCLASS_PRESENCE_INDEX_TABLE_NAME ) )



Mime
View raw message