From ce67efef6ab2ad2c06b789dbc0c4fa5462614293 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Mon, 22 Feb 2010 15:42:59 -0800 Subject: [PATCH] HBASE-2246 Add a GetConfiguration method to HTableInterface. Signed-off-by: Benoit Sigoure --- .../org/apache/hadoop/hbase/client/HTable.java | 4 ++++ .../hadoop/hbase/client/HTableInterface.java | 8 ++++++++ .../hadoop/hbase/client/TestFromClientSide.java | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/java/org/apache/hadoop/hbase/client/HTable.java b/src/java/org/apache/hadoop/hbase/client/HTable.java index ed9d154..031bbf1 100644 --- a/src/java/org/apache/hadoop/hbase/client/HTable.java +++ b/src/java/org/apache/hadoop/hbase/client/HTable.java @@ -155,6 +155,10 @@ public class HTable implements HTableInterface { new DaemonThreadFactory()); } + public Configuration getConfiguration() { + return configuration; + } + /** * TODO Might want to change this to public, would be nice if the number * of threads would automatically change when servers were added and removed diff --git a/src/java/org/apache/hadoop/hbase/client/HTableInterface.java b/src/java/org/apache/hadoop/hbase/client/HTableInterface.java index e550257..5d4a039 100644 --- a/src/java/org/apache/hadoop/hbase/client/HTableInterface.java +++ b/src/java/org/apache/hadoop/hbase/client/HTableInterface.java @@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.client; import java.io.IOException; import java.util.List; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HTableDescriptor; /** @@ -38,6 +39,13 @@ public interface HTableInterface { byte[] getTableName(); /** + * Gets the configuration of this instance. + * + * @return The configuration. + */ + Configuration getConfiguration(); + + /** * Gets the table descriptor for this table. * * @return table metadata diff --git a/src/test/org/apache/hadoop/hbase/client/TestFromClientSide.java b/src/test/org/apache/hadoop/hbase/client/TestFromClientSide.java index 5227a05..f9bae50 100644 --- a/src/test/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/src/test/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.client; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -107,6 +108,19 @@ public class TestFromClientSide { } /** + * Verifies that getConfiguration returns the same Configuration object used + * to create the HTable instance. + */ + @Test + public void testGetConfiguration() throws Exception { + byte[] TABLE = Bytes.toBytes("testGetConfiguration"); + byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") }; + Configuration conf = TEST_UTIL.getConfiguration(); + HTable table = TEST_UTIL.createTable(TABLE, FAMILIES); + assertSame(conf, table.getConfiguration()); + } + + /** * Test from client side of an involved filter against a multi family that * involves deletes. * -- 1.7.0.50.g50c1