You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/02/26 03:46:39 UTC
[3/5] hbase git commit: HBASE-13106 Ensure endpoint-only table
coprocessors can be dynamically loaded
HBASE-13106 Ensure endpoint-only table coprocessors can be dynamically loaded
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bcf14c84
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bcf14c84
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bcf14c84
Branch: refs/heads/0.98
Commit: bcf14c84397040822a4be783e059448a3e480be7
Parents: 2d7f60c
Author: Andrew Purtell <ap...@apache.org>
Authored: Wed Feb 25 18:05:14 2015 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Wed Feb 25 18:05:14 2015 -0800
----------------------------------------------------------------------
.../coprocessor/TestCoprocessorEndpoint.java | 6 ++++--
.../TestCoprocessorTableEndpoint.java | 19 +++++++++----------
2 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/bcf14c84/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
index 72e9e4f..3c78390 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
@@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.coprocessor.Batch;
@@ -90,7 +91,8 @@ public class TestCoprocessorEndpoint {
conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ProtobufCoprocessorService.class.getName());
util.startMiniCluster(2);
- HBaseAdmin admin = new HBaseAdmin(conf);
+
+ HBaseAdmin admin = util.getHBaseAdmin();
HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
@@ -99,7 +101,7 @@ public class TestCoprocessorEndpoint {
HTable table = new HTable(conf, TEST_TABLE);
for (int i = 0; i < ROWSIZE; i++) {
Put put = new Put(ROWS[i]);
- put.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(i));
+ put.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(i));
table.put(put);
}
table.close();
http://git-wip-us.apache.org/repos/asf/hbase/blob/bcf14c84/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorTableEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorTableEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorTableEndpoint.java
index 7695361..5c91d2a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorTableEndpoint.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorTableEndpoint.java
@@ -23,9 +23,8 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
-import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.ByteStringer;
import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -44,7 +43,7 @@ import org.junit.experimental.categories.Category;
import com.google.protobuf.ServiceException;
-@Category({CoprocessorTests.class, MediumTests.class})
+@Category(MediumTests.class)
public class TestCoprocessorTableEndpoint {
private static final byte[] TEST_FAMILY = Bytes.toBytes("TestFamily");
@@ -102,7 +101,7 @@ public class TestCoprocessorTableEndpoint {
return ret;
}
- private static Map<byte [], Long> sum(final Table table, final byte [] family,
+ private static Map<byte [], Long> sum(final HTable table, final byte [] family,
final byte [] qualifier, final byte [] start, final byte [] end)
throws ServiceException, Throwable {
return table.coprocessorService(ColumnAggregationProtos.ColumnAggregationService.class,
@@ -126,14 +125,14 @@ public class TestCoprocessorTableEndpoint {
}
private static final void createTable(HTableDescriptor desc) throws Exception {
- Admin admin = TEST_UTIL.getHBaseAdmin();
+ HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
TEST_UTIL.waitUntilAllRegionsAssigned(desc.getTableName());
- Table table = TEST_UTIL.getConnection().getTable(desc.getTableName());
+ HTable table = new HTable(TEST_UTIL.getConfiguration(), desc.getTableName());
try {
for (int i = 0; i < ROWSIZE; i++) {
Put put = new Put(ROWS[i]);
- put.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(i));
+ put.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(i));
table.put(put);
}
} finally {
@@ -142,14 +141,14 @@ public class TestCoprocessorTableEndpoint {
}
private static void updateTable(HTableDescriptor desc) throws Exception {
- Admin admin = TEST_UTIL.getHBaseAdmin();
+ HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
admin.disableTable(desc.getTableName());
admin.modifyTable(desc.getTableName(), desc);
admin.enableTable(desc.getTableName());
}
private static final void verifyTable(TableName tableName) throws Throwable {
- Table table = TEST_UTIL.getConnection().getTable(tableName);
+ HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
try {
Map<byte[], Long> results = sum(table, TEST_FAMILY, TEST_QUALIFIER, ROWS[0],
ROWS[ROWS.length-1]);