Author: seelmann
Date: Fri Nov 5 22:17:01 2010
New Revision: 1031855
URL: http://svn.apache.org/viewvc?rev=1031855&view=rev
Log:
o Let HBase partition build with current trunk
o Use latest HBase snapshot version (0.89.0)
Added:
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockCoreISuite.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockServerISuite.java
Removed:
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseClusterTestCaseAdapter.java
Modified:
directory/sandbox/seelmann/hbase-partition-test/pom.xml
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPT.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseDistributedRunner.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseEmbeddedRunner.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseRunner.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/RemoteRunner.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java
directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTableTest.java
directory/sandbox/seelmann/hbase-partition-test/src/test/resources/log4j.properties
Modified: directory/sandbox/seelmann/hbase-partition-test/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/pom.xml?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/pom.xml (original)
+++ directory/sandbox/seelmann/hbase-partition-test/pom.xml Fri Nov 5 22:17:01 2010
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>1.5.6-SNAPSHOT</version>
+ <version>1.5.8-SNAPSHOT</version>
</parent>
<artifactId>apacheds-hbase-partition-test</artifactId>
<name>ApacheDS HBase Partition Test</name>
@@ -35,9 +35,9 @@
<dependencies>
<dependency>
- <groupId>${pom.groupId}</groupId>
<artifactId>apacheds-hbase-partition</artifactId>
- <version>${pom.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
<dependency>
@@ -48,97 +48,63 @@
<!-- Dependencies to ApacheDS, for partition implementation -->
<dependency>
- <groupId>${pom.groupId}</groupId>
<artifactId>apacheds-core</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-xdbm-base</artifactId>
- <version>${pom.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
+
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-xdbm-search</artifactId>
- <version>${pom.version}</version>
+ <artifactId>apacheds-xdbm-partition</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
<!-- ApacheDS integration test framework -->
<dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-integ</artifactId>
- <version>${pom.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
+
<dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-integ</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <!-- HBase dependencies -->
- <!--
- Unfortunately HBase artifacts are not yet available in public maven repo.
- So I created a private repo under p.a.o/~seelmann and use groupId
- "org.apache.directory.hbase" to avoid conflicts.
- -->
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>hbase</artifactId>
- <version>0.20.3-RC3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>hadoop-core</artifactId>
- <version>0.20.1-hdfs127</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
- <!-- HBase test dependencies -->
- <!--
- Unfortunately HBase artifacts are not yet available in public maven repo.
- So I created a private repo under p.a.o/~seelmann and use groupId
- "org.apache.directory.hbase" to avoid conflicts.
- -->
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>hadoop-test</artifactId>
- <version>0.20.1</version>
- </dependency>
<dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>hbase-test</artifactId>
- <version>0.20.3-RC3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.2.2</version>
+ <artifactId>apacheds-core-integ</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
+ <classifier>tests</classifier>
</dependency>
- <!-- HBase transitive test depencencies -->
+
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
+ <artifactId>apacheds-server-integ</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
+ <classifier>tests</classifier>
</dependency>
+
+ <!-- HBase dependencies -->
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0.1</version>
+ <artifactId>hbase</artifactId>
+ <groupId>org.apache.hbase</groupId>
+ <version>0.89.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
+ <artifactId>hbase</artifactId>
+ <groupId>org.apache.hbase</groupId>
+ <version>0.89.0-SNAPSHOT</version>
+ <classifier>tests</classifier>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.14</version>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-test</artifactId>
+ <version>0.20.3-append-r964955-1240</version>
+ <scope>test</scope>
</dependency>
+
</dependencies>
<build>
@@ -163,10 +129,11 @@
<configuration>
<includes>
<include>**/*Test.java</include>
- <include>**/*IT.java</include>
</includes>
<excludes>
+ <include>**/*IT.java</include>
<exclude>**/*PT.java</exclude>
+ <exclude>**/Stock*ISuite.java</exclude>
</excludes>
<systemPropertyVariables>
<apacheds.partition.factory>org.apache.directory.server.core.partition.hbase.HBaseEmbeddedPartitionFactory</apacheds.partition.factory>
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java Fri Nov 5 22:17:01 2010
@@ -20,18 +20,20 @@
package org.apache.directory.server.core.partition.hbase.it;
+import java.io.FileOutputStream;
+import java.net.URL;
import java.text.DecimalFormat;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-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.AbstractHBaseTableTest;
import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.junit.AfterClass;
import org.junit.Before;
@@ -44,22 +46,26 @@ public abstract class AbstractHBaseParti
{
private static final Logger LOG = LoggerFactory.getLogger( AbstractHBasePartitionIT.class );
- protected static HBaseClusterTestCaseAdapter adapter;
+ protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
protected CoreSession session;
@BeforeClass
public static void before() throws Exception
{
- adapter = new HBaseClusterTestCaseAdapter( AbstractHBasePartitionIT.class, true );
- adapter.setUp();
+ TEST_UTIL.startMiniCluster(1);
+
+ URL resource = AbstractHBaseTableTest.class.getResource( "/hbase-site.xml" );
+ FileOutputStream fos = new FileOutputStream( resource.getFile() );
+ TEST_UTIL.getConfiguration().writeXml( fos );
+ fos.close();
}
@AfterClass
public static void after() throws Exception
{
- adapter.tearDown();
+ TEST_UTIL.shutdownMiniCluster();
}
@@ -84,7 +90,7 @@ public abstract class AbstractHBaseParti
if ( !session.exists( new DN( "o=hbase" ) ) )
{
- ServerEntry entry = new DefaultServerEntry( schemaManager, new DN( "o=hbase" ) );
+ Entry entry = new DefaultEntry( schemaManager, new DN( "o=hbase" ) );
entry.add( "objectClass", "top", "organization" );
entry.add( "o", "hbase" );
session.add( entry );
@@ -93,7 +99,7 @@ public abstract class AbstractHBaseParti
if ( !session.exists( new DN( "ou=test-ou,o=hbase" ) ) )
{
- ServerEntry entry = new DefaultServerEntry( schemaManager, new DN( "ou=test-ou,o=hbase" ) );
+ Entry entry = new DefaultEntry( schemaManager, new DN( "ou=test-ou,o=hbase" ) );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "test-ou" );
session.add( entry );
@@ -102,7 +108,7 @@ public abstract class AbstractHBaseParti
if ( !session.exists( new DN( "cn=test-person,ou=test-ou,o=hbase" ) ) )
{
- ServerEntry entry = new DefaultServerEntry( schemaManager, new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
+ Entry entry = new DefaultEntry( schemaManager, new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
entry.add( "objectClass", "top", "person" );
entry.add( "cn", "test-person" );
entry.add( "Sn", "test-person" );
@@ -132,7 +138,7 @@ public abstract class AbstractHBaseParti
DN dn = new DN( "ou=test" + number + ",o=hbase" );
if ( !session.exists( dn ) )
{
- ServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+ Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "test" + number );
session.add( entry );
@@ -149,7 +155,7 @@ public abstract class AbstractHBaseParti
continue;
}
- ServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+ Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "organizationalPerson", "inetOrgPerson" );
entry.add( "cn", "test" + s );
entry.add( "Sn", "test" + s );
@@ -169,9 +175,8 @@ public abstract class AbstractHBaseParti
}
- public static void compactDatabase( HBaseConfiguration conf ) throws Exception
+ public static void compactDatabase( HBaseAdmin admin ) throws Exception
{
- HBaseAdmin admin = new HBaseAdmin( conf );
for ( String table : TABLES )
{
if ( admin.tableExists( table ) )
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java Fri Nov 5 22:17:01 2010
@@ -42,20 +42,19 @@ import org.apache.directory.server.annot
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.HBaseDistributedPartition;
import org.apache.directory.server.core.partition.hbase.SingleColumnQualifierFilter;
+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.server.core.partition.hbase.table.HBaseMasterTable;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.entry.DefaultModification;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.client.ClientModification;
-import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
import org.apache.directory.shared.ldap.filter.FilterParser;
import org.apache.directory.shared.ldap.filter.SearchScope;
@@ -63,17 +62,18 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.apache.directory.shared.ldap.util.StringTools;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.HTable;
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.filter.BinaryComparator;
+import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterList;
-import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
-import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.FilterList.Operator;
+import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
+import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -110,116 +110,208 @@ public class HBasePartitionIT extends Ab
@Test
- public void first() throws Exception
- {
- }
-
-
- @Test
@Ignore
public void testScannerFilter() throws Exception
{
- System.out.println("testScannerFiler");
- HBaseConfiguration conf = adapter.getHBaseConfigurtion();
- HTable table = new HTable( conf, "apacheds_hbase_tree" );
-
- {
- Scan scan = new Scan();
- ResultScanner scanner = table.getScanner( scan );
- Iterator<Result> iterator = scanner.iterator();
- int count = 0;
- while ( iterator.hasNext() )
- {
- iterator.next();
- count++;
- }
- System.out.println( "Full scan before delete " + count );
- }
-
- {
- Scan scan = new Scan();
- scan.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
- Filter filter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
- HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
- scan.setFilter( filter );
- ResultScanner scanner = table.getScanner( scan );
- Iterator<Result> iterator = scanner.iterator();
- int count = 0;
- while ( iterator.hasNext() )
- {
- iterator.next();
- count++;
- }
- System.out.println( "Filtered scan before delete " + count );
- }
-
- session.delete( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
- session.delete( new DN( "ou=test-ou,o=hbase" ) );
-
- {
- Scan scan = new Scan();
- ResultScanner scanner = table.getScanner( scan );
- Iterator<Result> iterator = scanner.iterator();
- int count = 0;
- while ( iterator.hasNext() )
- {
- iterator.next();
- count++;
- }
- System.out.println( "Full scan after delete " + count );
- }
+ System.out.println("testScannerFilter");
+ Configuration conf = TEST_UTIL.getConfiguration();
+ HTable table = new HTable( conf, "apacheds_partitions_hbase_tree" );
+
+// {
+// Scan scan = new Scan();
+// ResultScanner scanner = table.getScanner( scan );
+// Iterator<Result> iterator = scanner.iterator();
+// int count = 0;
+// while ( iterator.hasNext() )
+// {
+// iterator.next();
+// count++;
+// }
+// System.out.println( "Full scan before delete " + count );
+// }
+//
+// {
+// Scan scan = new Scan();
+// scan.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
+// Filter filter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
+// HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
+// scan.setFilter( filter );
+// ResultScanner scanner = table.getScanner( scan );
+// Iterator<Result> iterator = scanner.iterator();
+// int count = 0;
+// while ( iterator.hasNext() )
+// {
+// iterator.next();
+// count++;
+// }
+// System.out.println( "Filtered scan before delete " + count );
+// }
+//
+// session.delete( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
+// session.delete( new DN( "ou=test-ou,o=hbase" ) );
+//
+// {
+// Scan scan = new Scan();
+// ResultScanner scanner = table.getScanner( scan );
+// Iterator<Result> iterator = scanner.iterator();
+// int count = 0;
+// while ( iterator.hasNext() )
+// {
+// iterator.next();
+// count++;
+// }
+// System.out.println( "Full scan after delete " + count );
+// }
+// dump();
{
Scan scan = new Scan();
scan.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
scan.addFamily( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY );
- Filter mainFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
+ Filter existsFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
+ BinaryComparator comparator1 = new BinaryComparator(
+ Bytes.toBytes( "2.5.4.4" + HBaseMasterTable.NORM_ATTRIBUTE_DELIMITER + "test999" ) );
+ Filter mainFilter = new SingleColumnQualifierFilter( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY,
+ CompareOp.EQUAL, comparator1 );
+// SingleColumnValueFilter mainFilter = new SingleColumnValueFilter(
+// HBaseMasterTable.NORM_ATTRIBUTES_FAMILY, Bytes.toBytes( "2.5.4.4=test999" ),
+// CompareOp.EQUAL, Bytes.toBytes( 0 ));
+// mainFilter.setFilterIfMissing( true );
Filter filter = null;
+
if ( mainFilter != null )
{
- FilterList filterList = new FilterList( Operator.MUST_PASS_ONE );
- filterList.addFilter( mainFilter );
+ // we need to get two kind of entries:
+ // - all entries that match the filter
+ // - all entries that have children, i.e. oneLevelCount > 0
+ // hence we use an or filter here
BinaryComparator comparator = new BinaryComparator( HBaseMasterTable.ONE_LEVEL_COUNT_QUALIFIER );
SingleColumnQualifierFilter countFilter = new SingleColumnQualifierFilter(
HBaseMasterTable.TREE_INFO_FAMILY, CompareOp.EQUAL, comparator );
- //SingleColumnValueFilter countFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY, HBaseMasterTable.ONE_LEVEL_COUNT_QUALIFIER, CompareOp.GREATER, Bytes.toBytes( 0L ) );
- filterList.addFilter( countFilter );
- filter = filterList;
- }
- Filter existsFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
- HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
- if(filter != null)
- {
- FilterList filterList = new FilterList( Operator.MUST_PASS_ALL );
- filterList.addFilter( filter );
- filterList.addFilter( existsFilter );
- filter = filterList;
+// SingleColumnValueFilter countFilter = new SingleColumnValueFilter(
+// HBaseMasterTable.TREE_INFO_FAMILY, HBaseMasterTable.ONE_LEVEL_COUNT_QUALIFIER,
+// CompareOp.EQUAL, Bytes.toBytes( 1000L ));
+// countFilter.setFilterIfMissing( true );
+
+
+ // TODO: OR-filter geht nicht!!!
+ FilterList innerFilerList = new FilterList( Operator.MUST_PASS_ONE );
+ innerFilerList.addFilter( mainFilter );
+ innerFilerList.addFilter( countFilter );
+
+ FilterList outerFilterList = new FilterList( Operator.MUST_PASS_ALL );
+ outerFilterList.addFilter( innerFilerList );
+ outerFilterList.addFilter( existsFilter );
+ filter = outerFilterList;
}
else
{
filter = existsFilter;
}
+
+
System.out.println(filter);
scan.setFilter( filter );
-
ResultScanner scanner = table.getScanner( scan );
Iterator<Result> iterator = scanner.iterator();
int count = 0;
while ( iterator.hasNext() )
{
- iterator.next();
+ Result next = iterator.next();
+ System.out.println(new String(next.getRow()));
count++;
}
System.out.println( "Filtered scan after delete " + count );
}
-
+
+
+// {
+// Scan scan = new Scan();
+// scan.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
+// scan.addFamily( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY );
+//
+// Filter mainFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
+// HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
+// Filter filter = null;
+// if ( mainFilter != null )
+// {
+// FilterList filterList = new FilterList( Operator.MUST_PASS_ONE );
+// filterList.addFilter( mainFilter );
+// BinaryComparator comparator = new BinaryComparator( HBaseMasterTable.ONE_LEVEL_COUNT_QUALIFIER );
+// SingleColumnQualifierFilter countFilter = new SingleColumnQualifierFilter(
+// HBaseMasterTable.TREE_INFO_FAMILY, CompareOp.EQUAL, comparator );
+// //SingleColumnValueFilter countFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY, HBaseMasterTable.ONE_LEVEL_COUNT_QUALIFIER, CompareOp.GREATER, Bytes.toBytes( 0L ) );
+// filterList.addFilter( countFilter );
+// filter = filterList;
+// }
+// Filter existsFilter = new SingleColumnValueFilter( HBaseMasterTable.TREE_INFO_FAMILY,
+// HBaseMasterTable.STATUS_QUALIFIER, CompareOp.EQUAL, HBaseMasterTable.EXISTS );
+// if(filter != null)
+// {
+// FilterList filterList = new FilterList( Operator.MUST_PASS_ALL );
+// filterList.addFilter( filter );
+// filterList.addFilter( existsFilter );
+// filter = filterList;
+// }
+// else
+// {
+// filter = existsFilter;
+// }
+// System.out.println(filter);
+// scan.setFilter( filter );
+//
+//
+// ResultScanner scanner = table.getScanner( scan );
+// Iterator<Result> iterator = scanner.iterator();
+// int count = 0;
+// while ( iterator.hasNext() )
+// {
+// iterator.next();
+// count++;
+// }
+// System.out.println( "Filtered scan after delete " + count );
+// }
+
+ }
+
+ private void dump() throws Exception
+ {
+ HTable masterHTable = new HTable( "apacheds_partitions_hbase_master" );
+ ResultScanner masterScanner = masterHTable.getScanner( new Scan() );
+ Result masterResult;
+ while ( ( masterResult = masterScanner.next() ) != null )
+ {
+ System.out.println( "master: " + Utils.getPrintableString( masterResult.getRow() ) );
+ }
+
+ HTable treeHTable = new HTable( "apacheds_partitions_hbase_tree" );
+ ResultScanner treeScanner = treeHTable.getScanner( new Scan() );
+ Result treeResult;
+ while ( ( treeResult = treeScanner.next() ) != null )
+ {
+ byte[] status = treeResult.getValue( Bytes.toBytes( "treeInfo" ), Bytes.toBytes("status") );
+ byte[] olc = treeResult.getValue( Bytes.toBytes( "treeInfo" ), Bytes.toBytes("oneLevelCount") );
+ System.out.println( "tree: " + Utils.getPrintableString( treeResult.getRow() ) + " - " + Bytes.toString( status ) + " - " + (olc!=null?Bytes.toLong( olc ):"-") );
+ }
+
+ HTable ouHTable = new HTable( "apacheds_partitions_hbase_index_ou" );
+ ResultScanner ouScanner = ouHTable.getScanner( new Scan() );
+ Result ouResult;
+ while ( ( ouResult = ouScanner.next() ) != null )
+ {
+ byte[] status = ouResult.getValue( Bytes.toBytes( "info" ), Bytes.toBytes("status") );
+ System.out.println( "ou: " + Utils.getPrintableString( ouResult.getRow() ) + " - " + Bytes.toString( status ) );
+ }
+
+
}
@Test
+ //@Ignore
public void testDelete() throws Exception
{
session.delete( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
@@ -237,18 +329,18 @@ public class HBasePartitionIT extends Ab
{
// reset initial values
List<Modification> resetMods = new ArrayList<Modification>();
- resetMods.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
+ resetMods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
"telephoneNumber" ) ) );
- resetMods.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
+ resetMods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
"description", "description1", "description2" ) ) );
- resetMods.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
+ resetMods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
"seeAlso", "uid=admin,ou=system" ) ) );
- resetMods.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
+ resetMods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
"userPassword", "secret1" ) ) );
session.modify( new DN( "cn=test-person,ou=test-ou,o=hbase" ), resetMods );
// assert initial values
- ClonedServerEntry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
assertNotNull( entry );
assertNull( entry.get( "telephoneNumber" ) );
assertNotNull( entry.get( "description" ) );
@@ -260,13 +352,13 @@ public class HBasePartitionIT extends Ab
// apply modifications
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add( new ClientModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultClientAttribute(
+ modifications.add( new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultEntryAttribute(
"telephoneNumber", "123", "456" ) ) );
- modifications.add( new ClientModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultClientAttribute(
+ modifications.add( new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultEntryAttribute(
"description", "description1" ) ) );
- modifications.add( new ClientModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultClientAttribute(
+ modifications.add( new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultEntryAttribute(
"seeAlso" ) ) );
- modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
+ modifications.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
"userPassword", "secret2" ) ) );
session.modify( new DN( "cn=test-person,ou=test-ou,o=hbase" ), modifications );
@@ -288,7 +380,7 @@ public class HBasePartitionIT extends Ab
session.rename( new DN( "cn=test-person,ou=test-ou,o=hbase" ), new RDN( "cn=Test-Person2" ), false );
assertFalse( session.exists( new DN( "cn=test-person,ou=test-ou,o=hbase" ) ) );
assertTrue( session.exists( new DN( "cn=Test-Person2,ou=test-ou,o=hbase" ) ) );
- ClonedServerEntry entry = session.lookup( new DN( "cn=Test-Person2,ou=test-ou,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "cn=Test-Person2,ou=test-ou,o=hbase" ) );
assertNotNull( entry );
assertNotNull( entry.get( "cn" ) );
assertEquals( 2, entry.get( "cn" ).size() );
@@ -307,13 +399,14 @@ public class HBasePartitionIT extends Ab
@Test
+ //@Ignore
public void testRenameBranch() throws Exception
{
session.rename( new DN( "ou=test-ou,o=hbase" ), new RDN( "OU=Test-Ou2" ), false );
assertFalse( session.exists( new DN( "ou=test-ou,o=hbase" ) ) );
assertTrue( session.exists( new DN( "ou=test-ou2,o=hbase" ) ) );
assertTrue( session.exists( new DN( "cn=test-person,ou=test-ou2,o=hbase" ) ) );
- ClonedServerEntry entry = session.lookup( new DN( "ou=test-ou2,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "ou=test-ou2,o=hbase" ) );
assertNotNull( entry );
assertNotNull( entry.get( "ou" ) );
assertEquals( 2, entry.get( "ou" ).size() );
@@ -329,6 +422,20 @@ public class HBasePartitionIT extends Ab
assertNotNull( entry.get( "ou" ) );
assertEquals( 1, entry.get( "ou" ).size() );
assertEquals( "test-ou", entry.get( "ou" ).getString() );
+
+ EntryFilteringCursor cursor = session.search( new DN( "o=hbase" ), SearchScope.ONELEVEL, FilterParser
+ .parse( "(ou=test-ou*)" ), AliasDerefMode.DEREF_ALWAYS, null );
+
+ assertNotNull( cursor );
+ cursor.beforeFirst();
+
+ List<String> actualDns = new ArrayList<String>();
+ while ( cursor.next() )
+ {
+ actualDns.add( cursor.get().getDn().getName() );
+ }
+ assertEquals(""+actualDns, 1, actualDns.size());
+ assertTrue( actualDns.contains( "ou=test-ou,o=hbase" ) );
}
@@ -350,7 +457,7 @@ public class HBasePartitionIT extends Ab
@Test
public void testLookup1() throws Exception
{
- ClonedServerEntry entry = session.lookup( new DN( "o=hbase" ) );
+ Entry entry = session.lookup( new DN( "o=hbase" ) );
assertNotNull( entry );
assertEquals( "2.5.4.10=hbase", entry.getDn().getNormName() );
}
@@ -359,7 +466,7 @@ public class HBasePartitionIT extends Ab
@Test
public void testLookup2() throws Exception
{
- ClonedServerEntry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
assertNotNull( entry );
assertEquals( "2.5.4.3=test-person,2.5.4.11=test-ou,2.5.4.10=hbase", entry.getDn().getNormName() );
}
@@ -614,8 +721,8 @@ public class HBasePartitionIT extends Ab
.parse( "(ou=test-*)" ), AliasDerefMode.DEREF_ALWAYS, null );
assertNotNull( cursor );
-
cursor.beforeFirst();
+
assertTrue( cursor.next() );
Entry entry = cursor.get();
assertNotNull( entry );
@@ -720,7 +827,7 @@ public class HBasePartitionIT extends Ab
cursor.beforeFirst();
assertTrue( cursor.next() );
- ServerEntry entry = cursor.get();
+ Entry entry = cursor.get();
assertNotNull( entry );
assertEquals( "cn=test999,ou=test1000,o=hbase", entry.getDn().getName() );
assertEquals( "test999", entry.get( "cn" ).get( 0 ).getString() );
@@ -739,7 +846,7 @@ public class HBasePartitionIT extends Ab
cursor.beforeFirst();
assertTrue( cursor.next() );
- ServerEntry entry = cursor.get();
+ Entry entry = cursor.get();
assertNotNull( entry );
assertEquals( "cn=test999,ou=test1000,o=hbase", entry.getDn().getName() );
assertEquals( "test999", entry.get( "cn" ).get( 0 ).getString() );
@@ -1134,10 +1241,4 @@ public class HBasePartitionIT extends Ab
}
}
-
- @Test
- public void last() throws Exception
- {
- }
-
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPT.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPT.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPT.java Fri Nov 5 22:17:01 2010
@@ -34,14 +34,13 @@ import org.apache.directory.server.annot
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.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.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.FilterParser;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -94,25 +93,19 @@ public class HBasePartitionPT extends Ab
// Flush and compact the database, otherwise the tests
// would run very slow and an OOM exception could occur.
- compactDatabase( adapter.getHBaseConfigurtion() );
+ compactDatabase( TEST_UTIL.getHBaseAdmin() );
}
}
@Test
- public void first() throws Exception
- {
- }
-
-
- @Test
public void testAddDeletePerformance() throws Exception
{
long t0 = System.currentTimeMillis();
SchemaManager schemaManager = ldapServer.getDirectoryService().getSchemaManager();
DN dn = new DN( "cn=test000,ou=test-ou,o=hbase" );
- ServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+ Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person" );
entry.add( "cn", "test000" );
entry.add( "sn", "test000" );
@@ -136,7 +129,7 @@ public class HBasePartitionPT extends Ab
for ( int i = 0; i < 1000; i++ )
{
String s = df.format( i );
- ServerEntry entry = new DefaultServerEntry( schemaManager, new DN( "cn=test" + s
+ Entry entry = new DefaultEntry( schemaManager, new DN( "cn=test" + s
+ ",ou=test-ou,o=hbase" ) );
entry.add( "objectClass", "top", "person" );
entry.add( "cn", "test" + s );
@@ -171,7 +164,7 @@ public class HBasePartitionPT extends Ab
long t0 = System.currentTimeMillis();
for ( int i = 0; i < 1000; i++ )
{
- ClonedServerEntry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "cn=test-person,ou=test-ou,o=hbase" ) );
assertNotNull( entry );
assertEquals( "2.5.4.3=test-person,2.5.4.11=test-ou,2.5.4.10=hbase", entry.getDn().getNormName() );
}
@@ -188,7 +181,7 @@ public class HBasePartitionPT extends Ab
for ( int i = 0; i < 1000; i++ )
{
String cn = RandomStringUtils.randomNumeric( 4 );
- ClonedServerEntry entry = session.lookup( new DN( "cn=test" + cn + ",ou=test10000,o=hbase" ) );
+ Entry entry = session.lookup( new DN( "cn=test" + cn + ",ou=test10000,o=hbase" ) );
assertNotNull( entry );
assertEquals( "2.5.4.3=test" + cn + ",2.5.4.11=test10000,2.5.4.10=hbase", entry.getDn().getNormName() );
}
@@ -228,7 +221,7 @@ public class HBasePartitionPT extends Ab
{
// TODO: slow
long t0 = System.currentTimeMillis();
- for ( int i = 0; i < 1; i++ )
+ for ( int i = 0; i < 10; i++ )
{
EntryFilteringCursor cursor = session.search( new DN( "ou=test1000,o=hbase" ), SearchScope.ONELEVEL,
FilterParser.parse( "(objectClass=person)" ), AliasDerefMode.DEREF_ALWAYS, null );
@@ -301,7 +294,7 @@ public class HBasePartitionPT extends Ab
public void testSearchOneLevelPresenceFilterPerformance() throws Exception
{
long t0 = System.currentTimeMillis();
- for ( int i = 0; i < 10; i++ ) // TODO
+ for ( int i = 0; i < 1000; i++ )
{
EntryFilteringCursor cursor = session.search( new DN( "o=hbase" ), SearchScope.ONELEVEL, FilterParser
.parse( "(objectClass=*)" ), AliasDerefMode.DEREF_ALWAYS, null );
@@ -328,7 +321,7 @@ public class HBasePartitionPT extends Ab
public void testSearchOneLevelSubstringInitialFilterPerformance() throws Exception
{
long t0 = System.currentTimeMillis();
- for ( int i = 0; i < 10; i++ ) // TODO
+ for ( int i = 0; i < 1000; i++ )
{
EntryFilteringCursor cursor = session.search( new DN( "o=hbase" ), SearchScope.ONELEVEL, FilterParser
.parse( "(objectClass=org*)" ), AliasDerefMode.DEREF_ALWAYS, null );
@@ -353,7 +346,7 @@ public class HBasePartitionPT extends Ab
public void testSearchOneLevelSubstringAnyFilterPerformance() throws Exception
{
long t0 = System.currentTimeMillis();
- for ( int i = 0; i < 10; i++ ) // TODO
+ for ( int i = 0; i < 1000; i++ )
{
EntryFilteringCursor cursor = session.search( new DN( "o=hbase" ), SearchScope.ONELEVEL, FilterParser
.parse( "(objectClass=*org*)" ), AliasDerefMode.DEREF_ALWAYS, null );
@@ -451,7 +444,7 @@ public class HBasePartitionPT extends Ab
public void testRandomSearchSubLevelSubstringInitialFilterUsingUserIndexPerformance() throws Exception
{
long t0 = System.currentTimeMillis();
- for ( int i = 0; i < 10; i++ ) // TODO
+ for ( int i = 0; i < 100; i++ )
{
String cn = RandomStringUtils.randomNumeric( 4 );
String filter = "(cn=test" + cn + "*)";
@@ -474,9 +467,8 @@ public class HBasePartitionPT extends Ab
public void testRandomSearchSubLevelSubstringInitialFilterUsingSubscopeIndexPerformance() throws Exception
{
// 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++ ) // TODO
+ for ( int i = 0; i < 1000; i++ )
{
String cn = RandomStringUtils.randomNumeric( 4 );
//String cn = "9999";
@@ -546,10 +538,4 @@ public class HBasePartitionPT extends Ab
System.out.println( "testRandomSearchSubLevelSubstringAnyFilterPerformance: " + t );
}
-
- @Test
- public void last() throws Exception
- {
- }
-
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseDistributedRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseDistributedRunner.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseDistributedRunner.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseDistributedRunner.java Fri Nov 5 22:17:01 2010
@@ -29,7 +29,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.partition.hbase.HBaseDistributedPartition;
import org.apache.directory.server.core.partition.hbase.it.AbstractHBasePartitionIT;
import org.apache.directory.shared.ldap.name.DN;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -91,7 +90,7 @@ public class HBaseDistributedRunner exte
{
AbstractHBasePartitionIT.createTestData( 100000, "00000", ldapServer );
}
- AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
+ //AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseEmbeddedRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseEmbeddedRunner.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseEmbeddedRunner.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseEmbeddedRunner.java Fri Nov 5 22:17:01 2010
@@ -32,7 +32,6 @@ import org.apache.directory.server.core.
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.DN;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -41,7 +40,7 @@ import org.junit.runner.RunWith;
/**
* Starts up an ApacheDS LDAP server with two HBase partitions.
- * The partitions starts up one embedded HBase partition.
+ * For both partitions one embedded HBase cluster is started.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -105,7 +104,7 @@ public class HBaseEmbeddedRunner extends
// {
// AbstractHBasePartitionIT.createTestData( 100000, "00000", ldapServer );
// }
- AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
+ //AbstractHBasePartitionIT.compactDatabase( new HBaseConfiguration() );
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseRunner.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseRunner.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/HBaseRunner.java Fri Nov 5 22:17:01 2010
@@ -38,9 +38,10 @@ import org.junit.runner.RunWith;
/**
- * Starts up an ApacheDS LDAP server with an HBase partition.
- * Also starts up up an embedded HDFS and HBase Mini Cluster and
+ * Starts up up an embedded HDFS and HBase Mini Cluster and
* adds some test data. Note that the data is transient!
+ * Then starts up an ApacheDS LDAP server with an HBase partition
+ * which uses the previously started HBase cluster.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -66,7 +67,7 @@ import org.junit.runner.RunWith;
)
})
@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
+ { @CreateTransport(protocol = "LDAP", port = 10389) })
@Ignore
public class HBaseRunner extends AbstractHBasePartitionIT
{
@@ -87,7 +88,7 @@ public class HBaseRunner extends Abstrac
{
createTestData( 10000, "0000", ldapServer );
}
- compactDatabase( adapter.getHBaseConfigurtion() );
+ //compactDatabase( adapter.getHBaseConfigurtion() );
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/RemoteRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/RemoteRunner.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/RemoteRunner.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/runner/RemoteRunner.java Fri Nov 5 22:17:01 2010
@@ -71,7 +71,7 @@ public class RemoteRunner
public static void main( String[] args ) throws Exception
{
DirectoryService service = DSAnnotationProcessor.getDirectoryService();
- LdapServer ldapServer = ServerAnnotationProcessor.getLdapServer( service, 10389 );
+ LdapServer ldapServer = ServerAnnotationProcessor.createLdapServer( service, 10389 );
System.out.println( "ApacheDS started on port " + ldapServer.getPort() + ", press any key to shutdown..." );
System.in.read();
ldapServer.stop();
Added: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockCoreISuite.java?rev=1031855&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockCoreISuite.java (added)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockCoreISuite.java Fri Nov 5 22:17:01 2010
@@ -0,0 +1,167 @@
+/*
+ * 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.suites;
+
+
+import org.apache.directory.server.core.authz.AuthorizationServiceAsNonAdminIT;
+import org.apache.directory.server.core.collective.CollectiveAttributeServiceIT;
+import org.apache.directory.server.core.configuration.PartitionConfigurationIT;
+import org.apache.directory.server.core.event.EventServiceIT;
+import org.apache.directory.server.core.integ.FrameworkSuite;
+import org.apache.directory.server.core.jndi.AddIT;
+import org.apache.directory.server.core.jndi.CreateContextIT;
+import org.apache.directory.server.core.jndi.DIRSERVER169IT;
+import org.apache.directory.server.core.jndi.DIRSERVER783IT;
+import org.apache.directory.server.core.jndi.DIRSERVER791IT;
+import org.apache.directory.server.core.jndi.DestroyContextIT;
+import org.apache.directory.server.core.jndi.ExtensibleObjectIT;
+import org.apache.directory.server.core.jndi.ListIT;
+import org.apache.directory.server.core.jndi.ModifyContextIT;
+import org.apache.directory.server.core.jndi.ObjStateFactoryIT;
+import org.apache.directory.server.core.jndi.RFC2713IT;
+import org.apache.directory.server.core.jndi.ReferralIT;
+import org.apache.directory.server.core.jndi.RootDSEIT;
+import org.apache.directory.server.core.jndi.UniqueMemberIT;
+import org.apache.directory.server.core.jndi.referral.AddReferralIT;
+import org.apache.directory.server.core.jndi.referral.CompareReferralIT;
+import org.apache.directory.server.core.jndi.referral.DeleteReferralIT;
+import org.apache.directory.server.core.jndi.referral.ModifyReferralIT;
+import org.apache.directory.server.core.jndi.referral.MoveAndRenameReferralIT;
+import org.apache.directory.server.core.jndi.referral.MoveReferralIT;
+import org.apache.directory.server.core.jndi.referral.RenameReferralIT;
+import org.apache.directory.server.core.jndi.referral.SearchReferralIT;
+import org.apache.directory.server.core.normalization.NormalizationServiceIT;
+import org.apache.directory.server.core.operational.OperationalAttributeServiceIT;
+import org.apache.directory.server.core.operations.bind.SimpleBindIT;
+import org.apache.directory.server.core.operations.compare.CompareDirserver1139IT;
+import org.apache.directory.server.core.operations.lookup.LookupIT;
+import org.apache.directory.server.core.operations.modify.ModifyAddIT;
+import org.apache.directory.server.core.operations.modify.ModifyDelIT;
+import org.apache.directory.server.core.operations.modify.ModifyMultipleChangesIT;
+import org.apache.directory.server.core.operations.search.AliasSearchIT;
+import org.apache.directory.server.core.operations.search.DIRSERVER759IT;
+import org.apache.directory.server.core.operations.search.SearchIT;
+import org.apache.directory.server.core.partition.PartitionIT;
+import org.apache.directory.server.core.prefs.PreferencesIT;
+import org.apache.directory.server.core.schema.MetaAttributeTypeHandlerIT;
+import org.apache.directory.server.core.schema.MetaComparatorHandlerIT;
+import org.apache.directory.server.core.schema.MetaMatchingRuleHandlerIT;
+import org.apache.directory.server.core.schema.MetaNormalizerHandlerIT;
+import org.apache.directory.server.core.schema.MetaObjectClassHandlerIT;
+import org.apache.directory.server.core.schema.MetaSchemaHandlerIT;
+import org.apache.directory.server.core.schema.MetaSyntaxCheckerHandlerIT;
+import org.apache.directory.server.core.schema.MetaSyntaxHandlerIT;
+import org.apache.directory.server.core.schema.ObjectClassCreateIT;
+import org.apache.directory.server.core.schema.SchemaServiceIT;
+import org.apache.directory.server.core.schema.SubschemaSubentryIT;
+import org.apache.directory.server.core.sp.LdapClassLoaderIT;
+import org.apache.directory.server.core.subtree.BadSubentryServiceIT;
+import org.apache.directory.server.core.subtree.SubentryServiceEntryModificationHandlingIT;
+import org.apache.directory.server.core.subtree.SubentryServiceIT;
+import org.apache.directory.server.core.subtree.SubentryServiceObjectClassChangeHandlingIT;
+import org.apache.directory.server.core.trigger.SubentryServiceForTriggersIT;
+import org.apache.directory.server.core.trigger.TriggerInterceptorIT;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith ( FrameworkSuite.class )
+@Suite.SuiteClasses ( {
+ CollectiveAttributeServiceIT.class,
+ EventServiceIT.class,
+ AddIT.class,
+
+ CreateContextIT.class,
+ DestroyContextIT.class,
+
+ DIRSERVER169IT.class,
+ DIRSERVER759IT.class,
+ DIRSERVER783IT.class,
+ DIRSERVER791IT.class,
+
+ ListIT.class,
+ ObjStateFactoryIT.class,
+ ExtensibleObjectIT.class,
+ RFC2713IT.class,
+ RootDSEIT.class,
+ SearchIT.class,
+ AliasSearchIT.class,
+ UniqueMemberIT.class,
+ PreferencesIT.class,
+ TriggerInterceptorIT.class,
+ LdapClassLoaderIT.class,
+ NormalizationServiceIT.class,
+ //DefaultChangeLogIT.class, - shutdown()/startup()
+ CompareDirserver1139IT.class,
+
+ ModifyContextIT.class,
+ ModifyDelIT.class,
+ ModifyAddIT.class,
+ ModifyMultipleChangesIT.class,
+
+ LookupIT.class,
+ SimpleBindIT.class,
+
+ MoveAndRenameReferralIT.class,
+ DeleteReferralIT.class,
+ SearchReferralIT.class,
+ CompareReferralIT.class,
+ MoveReferralIT.class,
+ ModifyReferralIT.class,
+ RenameReferralIT.class,
+ AddReferralIT.class,
+ ReferralIT.class,
+
+ AuthorizationServiceAsNonAdminIT.class,
+
+ //SchemaPersistenceIT.class, - shutdown()/startup()
+ SubschemaSubentryIT.class,
+ SubentryServiceForTriggersIT.class,
+ BadSubentryServiceIT.class,
+ SubentryServiceEntryModificationHandlingIT.class,
+ SubentryServiceObjectClassChangeHandlingIT.class,
+ SubentryServiceIT.class,
+
+ MetaNormalizerHandlerIT.class,
+ MetaSchemaHandlerIT.class,
+ MetaMatchingRuleHandlerIT.class,
+ MetaAttributeTypeHandlerIT.class,
+ MetaSyntaxHandlerIT.class,
+ MetaComparatorHandlerIT.class,
+ MetaSyntaxCheckerHandlerIT.class,
+ MetaObjectClassHandlerIT.class,
+
+ ObjectClassCreateIT.class,
+
+ SchemaServiceIT.class,
+
+ PartitionIT.class,
+ PartitionConfigurationIT.class,
+
+ OperationalAttributeServiceIT.class
+ } )
+public class StockCoreISuite
+{
+}
Added: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockServerISuite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockServerISuite.java?rev=1031855&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockServerISuite.java (added)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/suites/StockServerISuite.java Fri Nov 5 22:17:01 2010
@@ -0,0 +1,138 @@
+/*
+ * 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.suites;
+
+
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.annotations.ContextEntry;
+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.FrameworkSuite;
+import org.apache.directory.server.operations.add.AddIT;
+import org.apache.directory.server.operations.add.AddingEntriesWithSpecialCharactersInRDNIT;
+import org.apache.directory.server.operations.bind.BindIT;
+import org.apache.directory.server.operations.bind.MiscBindIT;
+import org.apache.directory.server.operations.bind.SaslBindIT;
+import org.apache.directory.server.operations.bind.SimpleBindIT;
+import org.apache.directory.server.operations.compare.CompareIT;
+import org.apache.directory.server.operations.compare.MatchingRuleCompareIT;
+import org.apache.directory.server.operations.delete.DeleteIT;
+import org.apache.directory.server.operations.extended.ExtendedIT;
+import org.apache.directory.server.operations.extended.StoredProcedureIT;
+import org.apache.directory.server.operations.modify.IllegalModificationIT;
+import org.apache.directory.server.operations.modify.ModifyAddIT;
+import org.apache.directory.server.operations.modify.ModifyMultipleChangesIT;
+import org.apache.directory.server.operations.modify.ModifyReferralIT;
+import org.apache.directory.server.operations.modify.ModifyRemoveIT;
+import org.apache.directory.server.operations.modify.ModifyReplaceIT;
+import org.apache.directory.server.operations.modifydn.ModifyDnReferralIT;
+import org.apache.directory.server.operations.modifydn.ModifyRdnIT;
+import org.apache.directory.server.operations.modifydn.MoveIT;
+import org.apache.directory.server.operations.search.IndexedNegationSearchIT;
+import org.apache.directory.server.operations.search.NegationSearchIT;
+import org.apache.directory.server.operations.search.PagedSearchIT;
+import org.apache.directory.server.operations.search.PersistentSearchIT;
+import org.apache.directory.server.operations.search.ReferralSearchIT;
+import org.apache.directory.server.operations.search.SchemaSearchIT;
+import org.apache.directory.server.operations.search.SearchIT;
+import org.apache.directory.server.operations.search.SearchLimitsIT;
+import org.apache.directory.server.ssl.LdapsIT;
+import org.apache.directory.server.ssl.StartTlsIT;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+/**
+ * Stock (default configuration) server integration test suite.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith ( FrameworkSuite.class )
+@Suite.SuiteClasses ( {
+ AddingEntriesWithSpecialCharactersInRDNIT.class,
+ AddIT.class,
+
+ BindIT.class,
+ MiscBindIT.class,
+ SaslBindIT.class,
+ SimpleBindIT.class,
+
+ CompareIT.class,
+ MatchingRuleCompareIT.class,
+
+ DeleteIT.class,
+ ExtendedIT.class,
+ StoredProcedureIT.class,
+
+ IllegalModificationIT.class,
+ ModifyAddIT.class,
+ ModifyMultipleChangesIT.class,
+ ModifyReferralIT.class,
+ ModifyRemoveIT.class,
+ ModifyReplaceIT.class,
+
+ ModifyDnReferralIT.class,
+ ModifyRdnIT.class,
+ MoveIT.class,
+
+ IndexedNegationSearchIT.class,
+ NegationSearchIT.class,
+ PagedSearchIT.class,
+ PersistentSearchIT.class,
+ ReferralSearchIT.class,
+ SchemaSearchIT.class,
+ SearchIT.class,
+ SearchLimitsIT.class,
+
+ LdapsIT.class,
+ StartTlsIT.class
+ } )
+@CreateDS(
+ name = "SuiteDS",
+ partitions =
+ {
+ @CreatePartition(
+ name = "example",
+ suffix = "dc=example,dc=com",
+ contextEntry = @ContextEntry(
+ entryLdif =
+ "dn: dc=example,dc=com\n" +
+ "dc: example\n" +
+ "objectClass: top\n" +
+ "objectClass: domain\n\n" ),
+ indexes =
+ {
+ @CreateIndex( attribute = "objectClass" ),
+ @CreateIndex( attribute = "dc" ),
+ @CreateIndex( attribute = "ou" )
+ } )
+ } )
+@CreateLdapServer (
+ transports =
+ {
+ @CreateTransport( protocol = "LDAP" ),
+ @CreateTransport( protocol = "LDAPS" )
+ })
+public class StockServerISuite
+{
+}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/AbstractHBaseTableTest.java Fri Nov 5 22:17:01 2010
@@ -24,11 +24,10 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.util.UUID;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.partition.hbase.HBaseClusterTestCaseAdapter;
import org.apache.directory.server.core.partition.hbase.HBaseStore;
-import org.apache.directory.server.core.partition.hbase.it.AbstractHBasePartitionIT;
import org.apache.directory.shared.ldap.csn.CsnFactory;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -36,8 +35,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.junit.AfterClass;
+import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
import org.junit.BeforeClass;
@@ -51,35 +49,14 @@ public abstract class AbstractHBaseTable
{
protected static final String TABLE_PREFIX = "apacheds_test_";
protected static final CsnFactory CSN_FACTORY = new CsnFactory( 0 );
- protected static HBaseClusterTestCaseAdapter adapter;
protected static SchemaManager schemaManager;
- protected static HBaseStore store;
protected static DN suffixDn;
+ protected static String workingDirectory;
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.
- */
- @BeforeClass
- public static void statupMiniCluster() throws Exception
- {
- adapter = new HBaseClusterTestCaseAdapter( AbstractHBasePartitionIT.class, false );
- adapter.setUp();
- }
-
-
- /**
- * Shutdown mini HBase cluster.
- */
- @AfterClass
- public static void shutdownMiniCluster() throws Exception
- {
- adapter.tearDown();
- }
-
/**
* Init schema manager and suffix
@@ -87,7 +64,7 @@ public abstract class AbstractHBaseTable
@BeforeClass
public static void initSchemaManager() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -106,23 +83,17 @@ public abstract class AbstractHBaseTable
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+ fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
suffixDn = new DN( "o=Good Times Co." );
suffixDn.normalize( schemaManager.getNormalizerMapping() );
-
- store = new HBaseStore();
- store.setSuffixDn( suffixDn.getName() );
- store.setCacheSize( 100 );
- store.setTablePrefix( TABLE_PREFIX );
- store.init( schemaManager );
}
- protected DefaultServerEntry buildContextEntry() throws LdapException
+ protected Entry buildContextEntry() throws LdapException
{
- DefaultServerEntry entry = new DefaultServerEntry( schemaManager, suffixDn );
+ Entry entry = new DefaultEntry( schemaManager, suffixDn );
entry.add( "objectClass", "organization" );
entry.add( "o", "Good Times Co." );
entry.add( "postalCode", "1" );
@@ -133,11 +104,11 @@ public abstract class AbstractHBaseTable
}
- protected DefaultServerEntry buildOuSalesEntry() throws LdapException
+ 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() );
- DefaultServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+ Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Sales \u65E5\u672C" );
entry.add( "postalCode", "1" );
@@ -148,12 +119,12 @@ public abstract class AbstractHBaseTable
}
- protected DefaultServerEntry buildCnJohnnyWalkerEntry() throws LdapException
+ protected Entry buildCnJohnnyWalkerEntry() throws LdapException
{
DN dn = new DN(
"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() );
- DefaultServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+ Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "organizationalPerson" );
entry.add( "ou", "Sales" );
entry.add( "cn", "JOhnny \u65E5\u672C WAlkeR" );
@@ -161,10 +132,21 @@ public abstract class AbstractHBaseTable
entry.add( "postalCode", "3" );
entry.add( "postOfficeBox", "3" );
entry.add( "jpegPhoto", new byte[]
- { 0x00, 0x01, 0x7F, ( byte ) 0x80, ( byte ) 0x81, ( byte ) 0xFF, } );
+ {
+ (byte)0xFF,
+ (byte)0xD8,
+ (byte)0xFF,
+ (byte)0xE0,
+ 0x00,
+ 0x10,
+ 'J',
+ 'F',
+ 'I',
+ 'F',
+ 0x00
+ } );
entry.add( "entryCsn", CSN_FACTORY.newInstance().toString() );
entry.add( "entryUUID", CN_JOHNNY_WALKER_UUID.toString() );
return entry;
}
-
}
Modified: directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java?rev=1031855&r1=1031854&r2=1031855&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition-test/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java Fri Nov 5 22:17:01 2010
@@ -24,14 +24,16 @@ import static org.junit.Assert.assertFal
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.io.File;
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.HBaseStore;
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.entry.Entry;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -60,6 +62,7 @@ public class HBaseIndexTableTest extends
private HBaseRowIndexTable jpegPhotoIndexTable;
private HBaseColumnIndexTable cnIndexTable;
private HBaseColumnIndexTable userCertificateIndexTable;
+ private HBaseStore store;
/**
@@ -69,10 +72,39 @@ public class HBaseIndexTableTest extends
@Before
public void setup() throws Exception
{
- HBaseAdmin admin = new HBaseAdmin( adapter.getHBaseConfigurtion() );
+ store = new HBaseStore();
+ store.setPartitionDir( new File( workingDirectory, "store" ) );
+ store.setSuffixDn( suffixDn );
+ store.setCacheSize( 100 );
+ store.setTablePrefix( TABLE_PREFIX );
+
+ HBaseUserRowIndex index1 = new HBaseUserRowIndex();
+ index1.setAttributeId( "2.5.4.0" );
+ index1.setCacheSize( 100 );
+ index1.setStore( store );
+ store.addIndex( index1 );
+
+ HBaseUserRowIndex index2 = new HBaseUserRowIndex();
+ index2.setAttributeId( "0.9.2342.19200300.100.1.60" );
+ index2.setStore( store );
+ store.addIndex( index2 );
+
+ HBaseUserColumnIndex index3 = new HBaseUserColumnIndex();
+ index3.setAttributeId( "2.5.4.3" );
+ index3.setStore( store );
+ store.addIndex( index3 );
+
+ HBaseUserColumnIndex index4 = new HBaseUserColumnIndex();
+ index4.setAttributeId( "2.5.4.36" );
+ index4.setStore( store );
+ store.addIndex( index4 );
+
+ store.init( schemaManager );
+
+ HBaseAdmin admin = new HBaseAdmin( store.getConfiguration() );
if ( admin.tableExists( CN_INDEX_TABLE_NAME ) )
{
- HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
+ HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME );
ResultScanner masterScanner = cnIndexHTable.getScanner( new Scan() );
Result masterResult;
while ( ( masterResult = masterScanner.next() ) != null )
@@ -82,7 +114,7 @@ public class HBaseIndexTableTest extends
}
if ( admin.tableExists( OBJECTCLASS_INDEX_TABLE_NAME ) )
{
- HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
+ HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME );
ResultScanner treeScanner = objectClassIndexHTable.getScanner( new Scan() );
Result treeResult;
while ( ( treeResult = treeScanner.next() ) != null )
@@ -91,45 +123,10 @@ public class HBaseIndexTableTest extends
}
}
- // 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 );
-
- }
-
-
- @Test
- public void first() throws Exception
- {
- DefaultServerEntry entry = buildContextEntry();
- objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
+ objectClassIndexTable = index1.getIndexTable();
+ jpegPhotoIndexTable = index2.getIndexTable();
+ cnIndexTable = index3.getIndexTable();
+ userCertificateIndexTable = index4.getIndexTable();
}
@@ -137,10 +134,10 @@ public class HBaseIndexTableTest extends
public void testAdd() throws Exception
{
// 1st entry
- DefaultServerEntry entry = buildContextEntry();
+ Entry entry = buildContextEntry();
objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
- HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
+ HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME );
Get equalGet = new Get( Bytes.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) );
assertTrue( objectClassIndexHTable.exists( equalGet ) );
@@ -163,7 +160,7 @@ public class HBaseIndexTableTest extends
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 );
+ HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME );
assertTrue( objectClassIndexHTable.exists( new Get( Bytes
.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) ) ) );
@@ -191,23 +188,23 @@ public class HBaseIndexTableTest extends
public void testDelete() throws Exception
{
// 1st entry
- DefaultServerEntry contextEntry = buildContextEntry();
+ Entry contextEntry = buildContextEntry();
objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
// 2nd entry
- DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
+ 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 );
// 3rd entry
- DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
+ 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 );
- HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
- HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
+ 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 );
@@ -253,12 +250,12 @@ public class HBaseIndexTableTest extends
@Test
public void testAddDelete() throws Exception
{
- for ( int i = 0; i < 500; i++ )
+ for ( int i = 0; i < 100; i++ )
{
// add + verify
- DefaultServerEntry entry = buildContextEntry();
+ Entry entry = buildContextEntry();
objectClassIndexTable.add( entry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
- HTable objectClassIndexHTable = new HTable( OBJECTCLASS_INDEX_TABLE_NAME );
+ HTable objectClassIndexHTable = new HTable( store.getConfiguration(), OBJECTCLASS_INDEX_TABLE_NAME );
Get existsGet = new Get( Bytes.toBytes( "=organization\u000000000000-0000-0000-0000-000000000001" ) );
assertTrue( objectClassIndexHTable.exists( existsGet ) );
@@ -279,12 +276,12 @@ public class HBaseIndexTableTest extends
assertEquals( 1, deletedInfoMap.size() );
assertEquals( "d", Bytes.toString( deletedInfoMap.get( Bytes.toBytes( "status" ) ) ) );
}
- for ( int i = 0; i < 500; i++ )
+ for ( int i = 0; i < 100; i++ )
{
// add + verify
- DefaultServerEntry entry = buildCnJohnnyWalkerEntry();
+ Entry entry = buildCnJohnnyWalkerEntry();
cnIndexTable.add( entry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
- HTable cnIndexHTable = new HTable( CN_INDEX_TABLE_NAME );
+ HTable cnIndexHTable = new HTable( store.getConfiguration(), CN_INDEX_TABLE_NAME );
Get existsGet = new Get( Bytes.toBytes( "=johnny \u65E5\u672C walker" ) );
assertTrue( cnIndexHTable.exists( existsGet ) );
@@ -305,7 +302,6 @@ public class HBaseIndexTableTest extends
assertEquals( 1, deletedInfoMap.size() );
assertEquals( "d", Bytes.toString( deletedInfoMap.get( Utils.toBytes( CN_JOHNNY_WALKER_UUID ) ) ) );
}
-
}
@@ -319,13 +315,13 @@ public class HBaseIndexTableTest extends
assertEquals( 0, cnIndexTable.count( "johnny \u65E5\u672C walker" ) );
// 1st entry
- DefaultServerEntry contextEntry = buildContextEntry();
+ Entry contextEntry = buildContextEntry();
objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
assertEquals( 1, objectClassIndexTable.count( "organization" ) );
// 2nd entry
- DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
+ 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 );
@@ -333,7 +329,7 @@ public class HBaseIndexTableTest extends
assertEquals( 1, objectClassIndexTable.count( "organizationalunit" ) );
// 3rd entry
- DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
+ 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 );
@@ -389,13 +385,13 @@ public class HBaseIndexTableTest extends
assertFalse( cnIndexTable.exists( "johnny \u65E5\u672C walker", CN_JOHNNY_WALKER_UUID ) );
// 1st entry
- DefaultServerEntry contextEntry = buildContextEntry();
+ Entry contextEntry = buildContextEntry();
objectClassIndexTable.add( contextEntry.get( "objectClass" ).get( 0 ).getBytes(), CONTEXT_ENTRY_ID );
assertTrue( objectClassIndexTable.exists( "organization", CONTEXT_ENTRY_ID ) );
// 2nd entry
- DefaultServerEntry ouSalesEntry = buildOuSalesEntry();
+ 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 );
@@ -403,7 +399,7 @@ public class HBaseIndexTableTest extends
assertTrue( objectClassIndexTable.exists( "top", OU_SALES_ID ) );
// 3rd entry
- DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
+ 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 );
@@ -529,7 +525,7 @@ public class HBaseIndexTableTest extends
@Test
public void testGetColumnCandidates() throws Exception
{
- DefaultServerEntry cnEntry = buildCnJohnnyWalkerEntry();
+ Entry cnEntry = buildCnJohnnyWalkerEntry();
cnIndexTable.add( cnEntry.get( "cn" ).get( 0 ).getBytes(), CN_JOHNNY_WALKER_UUID );
List<UUID> candidates = cnIndexTable.getColumnCandidates( "johnny \u65E5\u672C walker" );
@@ -538,10 +534,4 @@ public class HBaseIndexTableTest extends
assertTrue( candidates.contains( CN_JOHNNY_WALKER_UUID ) );
}
-
- @Test
- public void last() throws Exception
- {
- }
-
}
|