HBASE-17555 Changed calls to deprecated getHBaseAdmin to getAdmin

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Jan Hentschel 2017-01-27 09:06:52 +01:00 committed by Michael Stack
parent 87e1ba9a1a
commit aff8de8397
206 changed files with 649 additions and 648 deletions

View File

@ -58,7 +58,7 @@ public class TestHelloHBase {
final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent"; final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace"; final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
boolean exists; boolean exists;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE); exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
assertEquals("#namespaceExists failed: found nonexistent namespace.", assertEquals("#namespaceExists failed: found nonexistent namespace.",
@ -74,7 +74,7 @@ public class TestHelloHBase {
@Test @Test
public void testCreateNamespaceAndTable() throws Exception { public void testCreateNamespaceAndTable() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
HelloHBase.createNamespaceAndTable(admin); HelloHBase.createNamespaceAndTable(admin);
boolean namespaceExists boolean namespaceExists
@ -93,7 +93,7 @@ public class TestHelloHBase {
@Test @Test
public void testPutRowToTable() throws IOException { public void testPutRowToTable() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createNamespace admin.createNamespace
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build()); (NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
Table table Table table
@ -110,7 +110,7 @@ public class TestHelloHBase {
@Test @Test
public void testDeleteRow() throws IOException { public void testDeleteRow() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createNamespace admin.createNamespace
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build()); (NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
Table table Table table

View File

@ -58,7 +58,7 @@ public class TestHelloHBase {
final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent"; final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace"; final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
boolean exists; boolean exists;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE); exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
assertEquals("#namespaceExists failed: found nonexistent namespace.", assertEquals("#namespaceExists failed: found nonexistent namespace.",
@ -74,7 +74,7 @@ public class TestHelloHBase {
@Test @Test
public void testCreateNamespaceAndTable() throws Exception { public void testCreateNamespaceAndTable() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
HelloHBase.createNamespaceAndTable(admin); HelloHBase.createNamespaceAndTable(admin);
boolean namespaceExists boolean namespaceExists

View File

@ -87,7 +87,7 @@ public class TestBatchCoprocessorEndpoint {
conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ProtobufCoprocessorService.class.getName()); ProtobufCoprocessorService.class.getName());
util.startMiniCluster(2); util.startMiniCluster(2);
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TEST_TABLE); HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
desc.addFamily(new HColumnDescriptor(TEST_FAMILY)); desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]}); admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});

View File

@ -150,7 +150,7 @@ public class TestClassLoading {
// with configuration values // with configuration values
htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 + htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 +
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3"); "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) { if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) { if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName); admin.disableTable(tableName);
@ -231,7 +231,7 @@ public class TestClassLoading {
htd.addFamily(new HColumnDescriptor("test")); htd.addFamily(new HColumnDescriptor("test"));
htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName3 + "|" + htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName3 + "|" +
Coprocessor.PRIORITY_USER); Coprocessor.PRIORITY_USER);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd); admin.createTable(htd);
waitForTable(htd.getTableName()); waitForTable(htd.getTableName());
@ -256,7 +256,7 @@ public class TestClassLoading {
htd.addFamily(new HColumnDescriptor("test")); htd.addFamily(new HColumnDescriptor("test"));
htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName4 + "|" + htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName4 + "|" +
Coprocessor.PRIORITY_USER); Coprocessor.PRIORITY_USER);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd); admin.createTable(htd);
waitForTable(htd.getTableName()); waitForTable(htd.getTableName());
@ -317,7 +317,7 @@ public class TestClassLoading {
htd.addCoprocessor(cpName6, new Path(getLocalPath(jarFile6)), htd.addCoprocessor(cpName6, new Path(getLocalPath(jarFile6)),
Coprocessor.PRIORITY_USER, kvs); Coprocessor.PRIORITY_USER, kvs);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) { if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) { if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName); admin.disableTable(tableName);
@ -408,7 +408,7 @@ public class TestClassLoading {
// with configuration values // with configuration values
htd.setValue("COPROCESSOR$2", jarFileOnHDFS.toString() + "|" + cpName2 + htd.setValue("COPROCESSOR$2", jarFileOnHDFS.toString() + "|" + cpName2 +
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3"); "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) { if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) { if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName); admin.disableTable(tableName);

View File

@ -94,7 +94,7 @@ public class TestCoprocessorEndpoint {
conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ProtobufCoprocessorService.class.getName()); ProtobufCoprocessorService.class.getName());
util.startMiniCluster(2); util.startMiniCluster(2);
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TEST_TABLE); HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
desc.addFamily(new HColumnDescriptor(TEST_FAMILY)); desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]}); admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
@ -296,7 +296,7 @@ public class TestCoprocessorEndpoint {
@Test @Test
public void testMasterCoprocessorService() throws Throwable { public void testMasterCoprocessorService() throws Throwable {
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
final TestProtos.EchoRequestProto request = final TestProtos.EchoRequestProto request =
TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build(); TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service = TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
@ -327,7 +327,7 @@ public class TestCoprocessorEndpoint {
@Test @Test
public void testMasterCoprocessorError() throws Throwable { public void testMasterCoprocessorError() throws Throwable {
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service = TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService()); TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
try { try {

View File

@ -126,7 +126,7 @@ public class TestCoprocessorTableEndpoint {
} }
private static final void createTable(HTableDescriptor desc) throws Exception { private static final void createTable(HTableDescriptor desc) throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]}); admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
TEST_UTIL.waitUntilAllRegionsAssigned(desc.getTableName()); TEST_UTIL.waitUntilAllRegionsAssigned(desc.getTableName());
Table table = TEST_UTIL.getConnection().getTable(desc.getTableName()); Table table = TEST_UTIL.getConnection().getTable(desc.getTableName());
@ -142,7 +142,7 @@ public class TestCoprocessorTableEndpoint {
} }
private static void updateTable(HTableDescriptor desc) throws Exception { private static void updateTable(HTableDescriptor desc) throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.disableTable(desc.getTableName()); admin.disableTable(desc.getTableName());
admin.modifyTable(desc.getTableName(), desc); admin.modifyTable(desc.getTableName(), desc);
admin.enableTable(desc.getTableName()); admin.enableTable(desc.getTableName());

View File

@ -77,7 +77,7 @@ public class TestRegionServerCoprocessorEndpoint {
new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>(); new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service = DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class, ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName)); TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyCall(controller, service.dummyCall(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback); DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(DUMMY_VALUE, rpcCallback.get().getValue()); assertEquals(DUMMY_VALUE, rpcCallback.get().getValue());
@ -95,7 +95,7 @@ public class TestRegionServerCoprocessorEndpoint {
new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>(); new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service = DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class, ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName)); TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyThrow(controller, service.dummyThrow(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback); DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(null, rpcCallback.get()); assertEquals(null, rpcCallback.get());

View File

@ -132,8 +132,8 @@ public class TestRowProcessorEndpoint {
public void prepareTestData() throws Exception { public void prepareTestData() throws Exception {
try { try {
util.getHBaseAdmin().disableTable(TABLE); util.getAdmin().disableTable(TABLE);
util.getHBaseAdmin().deleteTable(TABLE); util.getAdmin().deleteTable(TABLE);
} catch (Exception e) { } catch (Exception e) {
// ignore table not found // ignore table not found
} }

View File

@ -151,7 +151,7 @@ public class IntegrationTestIngest extends IntegrationTestBase {
} }
private void deleteTableIfNecessary() throws IOException { private void deleteTableIfNecessary() throws IOException {
if (util.getHBaseAdmin().tableExists(getTablename())) { if (util.getAdmin().tableExists(getTablename())) {
util.deleteTable(getTablename()); util.deleteTable(getTablename());
} }
} }

View File

@ -93,7 +93,7 @@ public class IntegrationTestIngestWithEncryption extends IntegrationTestIngest {
// Update the test table schema so HFiles from this point will be written with // Update the test table schema so HFiles from this point will be written with
// encryption features enabled. // encryption features enabled.
final Admin admin = util.getHBaseAdmin(); final Admin admin = util.getAdmin();
HTableDescriptor tableDescriptor = HTableDescriptor tableDescriptor =
new HTableDescriptor(admin.getTableDescriptor(getTablename())); new HTableDescriptor(admin.getTableDescriptor(getTablename()));
for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) { for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) {

View File

@ -198,12 +198,12 @@ public class IntegrationTestLazyCfLoading {
} }
int serverCount = util.getHBaseClusterInterface().getClusterStatus().getServersSize(); int serverCount = util.getHBaseClusterInterface().getClusterStatus().getServersSize();
byte[][] splits = new RegionSplitter.HexStringSplit().split(serverCount * REGIONS_PER_SERVER); byte[][] splits = new RegionSplitter.HexStringSplit().split(serverCount * REGIONS_PER_SERVER);
util.getHBaseAdmin().createTable(htd, splits); util.getAdmin().createTable(htd, splits);
LOG.info("Created table"); LOG.info("Created table");
} }
private void deleteTable() throws Exception { private void deleteTable() throws Exception {
if (util.getHBaseAdmin().tableExists(TABLE_NAME)) { if (util.getAdmin().tableExists(TABLE_NAME)) {
LOG.info("Deleting table"); LOG.info("Deleting table");
util.deleteTable(TABLE_NAME); util.deleteTable(TABLE_NAME);
LOG.info("Deleted table"); LOG.info("Deleted table");

View File

@ -85,7 +85,7 @@ public class IntegrationTestManyRegions {
UTIL.initializeCluster(REGION_SERVER_COUNT); UTIL.initializeCluster(REGION_SERVER_COUNT);
LOG.info("Cluster initialized"); LOG.info("Cluster initialized");
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) { if (admin.tableExists(TABLE_NAME)) {
LOG.info(String.format("Deleting existing table %s.", TABLE_NAME)); LOG.info(String.format("Deleting existing table %s.", TABLE_NAME));
if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME); if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME);

View File

@ -271,18 +271,18 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
// create/populate the table, replicas disabled // create/populate the table, replicas disabled
LOG.debug("Populating table."); LOG.debug("Populating table.");
new PerfEvalCallable(util.getHBaseAdmin(), writeOpts).call(); new PerfEvalCallable(util.getAdmin(), writeOpts).call();
// one last sanity check, then send in the clowns! // one last sanity check, then send in the clowns!
assertEquals("Table must be created with DisabledRegionSplitPolicy. Broken test.", assertEquals("Table must be created with DisabledRegionSplitPolicy. Broken test.",
DisabledRegionSplitPolicy.class.getName(), DisabledRegionSplitPolicy.class.getName(),
util.getHBaseAdmin().getTableDescriptor(tableName).getRegionSplitPolicyClassName()); util.getAdmin().getTableDescriptor(tableName).getRegionSplitPolicyClassName());
startMonkey(); startMonkey();
// collect a baseline without region replicas. // collect a baseline without region replicas.
for (int i = 0; i < maxIters; i++) { for (int i = 0; i < maxIters; i++) {
LOG.debug("Launching non-replica job " + (i + 1) + "/" + maxIters); LOG.debug("Launching non-replica job " + (i + 1) + "/" + maxIters);
resultsWithoutReplicas.add(new PerfEvalCallable(util.getHBaseAdmin(), readOpts).call()); resultsWithoutReplicas.add(new PerfEvalCallable(util.getAdmin(), readOpts).call());
// TODO: sleep to let cluster stabilize, though monkey continues. is it necessary? // TODO: sleep to let cluster stabilize, though monkey continues. is it necessary?
Thread.sleep(5000l); Thread.sleep(5000l);
} }
@ -290,14 +290,14 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
// disable monkey, enable region replicas, enable monkey // disable monkey, enable region replicas, enable monkey
cleanUpMonkey("Altering table."); cleanUpMonkey("Altering table.");
LOG.debug("Altering " + tableName + " replica count to " + replicaCount); LOG.debug("Altering " + tableName + " replica count to " + replicaCount);
IntegrationTestingUtility.setReplicas(util.getHBaseAdmin(), tableName, replicaCount); IntegrationTestingUtility.setReplicas(util.getAdmin(), tableName, replicaCount);
setUpMonkey(); setUpMonkey();
startMonkey(); startMonkey();
// run test with region replicas. // run test with region replicas.
for (int i = 0; i < maxIters; i++) { for (int i = 0; i < maxIters; i++) {
LOG.debug("Launching replica job " + (i + 1) + "/" + maxIters); LOG.debug("Launching replica job " + (i + 1) + "/" + maxIters);
resultsWithReplicas.add(new PerfEvalCallable(util.getHBaseAdmin(), replicaReadOpts).call()); resultsWithReplicas.add(new PerfEvalCallable(util.getAdmin(), replicaReadOpts).call());
// TODO: sleep to let cluster stabilize, though monkey continues. is it necessary? // TODO: sleep to let cluster stabilize, though monkey continues. is it necessary?
Thread.sleep(5000l); Thread.sleep(5000l);
} }

View File

@ -138,7 +138,7 @@ public class IntegrationTestingUtility extends HBaseTestingUtility {
ClusterManager clusterManager = ReflectionUtils.newInstance( ClusterManager clusterManager = ReflectionUtils.newInstance(
clusterManagerClass, conf); clusterManagerClass, conf);
setHBaseCluster(new DistributedHBaseCluster(conf, clusterManager)); setHBaseCluster(new DistributedHBaseCluster(conf, clusterManager));
getHBaseAdmin(); getAdmin();
} }
} }

View File

@ -172,12 +172,12 @@ public class StripeCompactionsPerformanceEvaluation extends AbstractHBaseTool {
} }
protected void deleteTable() throws Exception { protected void deleteTable() throws Exception {
if (util.getHBaseAdmin().tableExists(TABLE_NAME)) { if (util.getAdmin().tableExists(TABLE_NAME)) {
LOG.info("Deleting table"); LOG.info("Deleting table");
if (!util.getHBaseAdmin().isTableDisabled(TABLE_NAME)) { if (!util.getAdmin().isTableDisabled(TABLE_NAME)) {
util.getHBaseAdmin().disableTable(TABLE_NAME); util.getAdmin().disableTable(TABLE_NAME);
} }
util.getHBaseAdmin().deleteTable(TABLE_NAME); util.getAdmin().deleteTable(TABLE_NAME);
LOG.info("Deleted table"); LOG.info("Deleted table");
} }
} }
@ -297,7 +297,7 @@ public class StripeCompactionsPerformanceEvaluation extends AbstractHBaseTool {
} }
byte[][] splits = new RegionSplitter.HexStringSplit().split( byte[][] splits = new RegionSplitter.HexStringSplit().split(
util.getHBaseClusterInterface().getClusterStatus().getServersSize()); util.getHBaseClusterInterface().getClusterStatus().getServersSize());
util.getHBaseAdmin().createTable(htd, splits); util.getAdmin().createTable(htd, splits);
} }
public static class SeqShardedDataGenerator extends LoadTestDataGenerator { public static class SeqShardedDataGenerator extends LoadTestDataGenerator {

View File

@ -208,7 +208,7 @@ public class Action {
LOG.info("Moving " + victimRegions.size() + " regions from " + fromServers.size() LOG.info("Moving " + victimRegions.size() + " regions from " + fromServers.size()
+ " servers to " + toServers.size() + " different servers"); + " servers to " + toServers.size() + " different servers");
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
for (byte[] victimRegion : victimRegions) { for (byte[] victimRegion : victimRegions) {
// Don't keep moving regions if we're // Don't keep moving regions if we're
// trying to stop the monkey. // trying to stop the monkey.
@ -221,7 +221,7 @@ public class Action {
} }
protected void forceBalancer() throws Exception { protected void forceBalancer() throws Exception {
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
boolean result = false; boolean result = false;
try { try {
result = admin.balancer(); result = admin.balancer();

View File

@ -40,7 +40,7 @@ public class AddColumnAction extends Action {
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {
super.init(context); super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
} }
@Override @Override

View File

@ -48,7 +48,7 @@ public class ChangeBloomFilterAction extends Action {
public void perform() throws Exception { public void perform() throws Exception {
Random random = new Random(); Random random = new Random();
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Change bloom filter on all columns of table " LOG.info("Performing action: Change bloom filter on all columns of table "
+ tableName); + tableName);

View File

@ -45,7 +45,7 @@ public class ChangeCompressionAction extends Action {
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {
super.init(context); super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
} }
@Override @Override

View File

@ -44,7 +44,7 @@ public class ChangeEncodingAction extends Action {
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {
super.init(context); super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
} }
@Override @Override

View File

@ -46,7 +46,7 @@ public class ChangeSplitPolicyAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Change split policy of table " + tableName); LOG.info("Performing action: Change split policy of table " + tableName);
HTableDescriptor tableDescriptor = admin.getTableDescriptor(tableName); HTableDescriptor tableDescriptor = admin.getTableDescriptor(tableName);

View File

@ -45,7 +45,7 @@ public class ChangeVersionsAction extends Action {
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {
super.init(context); super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
} }
@Override @Override

View File

@ -46,7 +46,7 @@ public class CompactMobAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio; boolean major = RandomUtils.nextInt(100) < majorRatio;
// Don't try the modify if we're stopping // Don't try the modify if we're stopping

View File

@ -50,7 +50,7 @@ public class CompactRandomRegionOfTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio; boolean major = RandomUtils.nextInt(100) < majorRatio;
LOG.info("Performing action: Compact random region of table " LOG.info("Performing action: Compact random region of table "

View File

@ -45,7 +45,7 @@ public class CompactTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio; boolean major = RandomUtils.nextInt(100) < majorRatio;
LOG.info("Performing action: Compact table " + tableName + ", major=" + major); LOG.info("Performing action: Compact table " + tableName + ", major=" + major);

View File

@ -43,7 +43,7 @@ public class DecreaseMaxHFileSizeAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
HTableDescriptor htd = admin.getTableDescriptor(tableName); HTableDescriptor htd = admin.getTableDescriptor(tableName);
// Try and get the current value. // Try and get the current value.

View File

@ -45,7 +45,7 @@ public class FlushRandomRegionOfTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Flush random region of table " + tableName); LOG.info("Performing action: Flush random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -41,7 +41,7 @@ public class FlushTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
// Don't try the flush if we're stopping // Don't try the flush if we're stopping
if (context.isStopping()) { if (context.isStopping()) {

View File

@ -45,7 +45,7 @@ public class MergeRandomAdjacentRegionsOfTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Merge random adjacent regions of table " + tableName); LOG.info("Performing action: Merge random adjacent regions of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -49,7 +49,7 @@ public class MoveRandomRegionOfTableAction extends Action {
} }
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Move random region of table " + tableName); LOG.info("Performing action: Move random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -54,7 +54,7 @@ public class MoveRegionsOfTableAction extends Action {
Thread.sleep(sleepTime); Thread.sleep(sleepTime);
} }
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
Collection<ServerName> serversList = admin.getClusterStatus().getServers(); Collection<ServerName> serversList = admin.getClusterStatus().getServers();
ServerName[] servers = serversList.toArray(new ServerName[serversList.size()]); ServerName[] servers = serversList.toArray(new ServerName[serversList.size()]);

View File

@ -46,7 +46,7 @@ public class RemoveColumnAction extends Action {
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {
super.init(context); super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin(); this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public class SnapshotTableAction extends Action {
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
String snapshotName = tableName + "-it-" + System.currentTimeMillis(); String snapshotName = tableName + "-it-" + System.currentTimeMillis();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
// Don't try the snapshot if we're stopping // Don't try the snapshot if we're stopping
if (context.isStopping()) { if (context.isStopping()) {

View File

@ -46,7 +46,7 @@ public class SplitAllRegionOfTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
// Don't try the split if we're stopping // Don't try the split if we're stopping
if (context.isStopping()) { if (context.isStopping()) {
return; return;

View File

@ -45,7 +45,7 @@ public class SplitRandomRegionOfTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
LOG.info("Performing action: Split random region of table " + tableName); LOG.info("Performing action: Split random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -39,7 +39,7 @@ public class TruncateTableAction extends Action {
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
// Don't try the truncate if we're stopping // Don't try the truncate if we're stopping
if (context.isStopping()) { if (context.isStopping()) {

View File

@ -201,7 +201,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return; if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return;
TableName t = getTablename(); TableName t = getTablename();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
HTableDescriptor desc = admin.getTableDescriptor(t); HTableDescriptor desc = admin.getTableDescriptor(t);
desc.addCoprocessor(SlowMeCoproScanOperations.class.getName()); desc.addCoprocessor(SlowMeCoproScanOperations.class.getName());
HBaseTestingUtility.modifyTableSync(admin, desc); HBaseTestingUtility.modifyTableSync(admin, desc);
@ -231,7 +231,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
} }
private void setupTable() throws IOException, InterruptedException { private void setupTable() throws IOException, InterruptedException {
if (util.getHBaseAdmin().tableExists(getTablename())) { if (util.getAdmin().tableExists(getTablename())) {
util.deleteTable(getTablename()); util.deleteTable(getTablename());
} }
@ -245,7 +245,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return; if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return;
TableName t = getTablename(); TableName t = getTablename();
HBaseTestingUtility.setReplicas(util.getHBaseAdmin(), t, replicaCount); HBaseTestingUtility.setReplicas(util.getAdmin(), t, replicaCount);
} }
private void runLinkedListMRJob(int iteration) throws Exception { private void runLinkedListMRJob(int iteration) throws Exception {
@ -746,7 +746,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
// Scale this up on a real cluster // Scale this up on a real cluster
if (util.isDistributedCluster()) { if (util.isDistributedCluster()) {
util.getConfiguration().setIfUnset(NUM_MAPS_KEY, util.getConfiguration().setIfUnset(NUM_MAPS_KEY,
Integer.toString(util.getHBaseAdmin().getClusterStatus().getServersSize() * 10) Integer.toString(util.getAdmin().getClusterStatus().getServersSize() * 10)
); );
util.getConfiguration().setIfUnset(NUM_IMPORT_ROUNDS_KEY, "5"); util.getConfiguration().setIfUnset(NUM_IMPORT_ROUNDS_KEY, "5");
} else { } else {

View File

@ -223,11 +223,11 @@ public class IntegrationTestMTTR {
loadTableName = TableName.valueOf(util.getConfiguration() loadTableName = TableName.valueOf(util.getConfiguration()
.get("hbase.IntegrationTestMTTR.loadTableName", "IntegrationTestMTTRLoadTestTool")); .get("hbase.IntegrationTestMTTR.loadTableName", "IntegrationTestMTTRLoadTestTool"));
if (util.getHBaseAdmin().tableExists(tableName)) { if (util.getAdmin().tableExists(tableName)) {
util.deleteTable(tableName); util.deleteTable(tableName);
} }
if (util.getHBaseAdmin().tableExists(loadTableName)) { if (util.getAdmin().tableExists(loadTableName)) {
util.deleteTable(loadTableName); util.deleteTable(loadTableName);
} }
@ -240,7 +240,7 @@ public class IntegrationTestMTTR {
HColumnDescriptor descriptor = new HColumnDescriptor(FAMILY); HColumnDescriptor descriptor = new HColumnDescriptor(FAMILY);
descriptor.setMaxVersions(1); descriptor.setMaxVersions(1);
tableDescriptor.addFamily(descriptor); tableDescriptor.addFamily(descriptor);
util.getHBaseAdmin().createTable(tableDescriptor); util.getAdmin().createTable(tableDescriptor);
// Setup the table for LoadTestTool // Setup the table for LoadTestTool
int ret = loadTool.run(new String[]{"-tn", loadTableName.getNameAsString(), "-init_only"}); int ret = loadTool.run(new String[]{"-tn", loadTableName.getNameAsString(), "-init_only"});
@ -557,7 +557,7 @@ public class IntegrationTestMTTR {
protected boolean doAction() throws Exception { protected boolean doAction() throws Exception {
Admin admin = null; Admin admin = null;
try { try {
admin = util.getHBaseAdmin(); admin = util.getAdmin();
ClusterStatus status = admin.getClusterStatus(); ClusterStatus status = admin.getClusterStatus();
return status != null; return status != null;
} finally { } finally {

View File

@ -47,7 +47,7 @@ public class IntegrationTestRSGroup extends TestRSGroupsBase {
TEST_UTIL = new IntegrationTestingUtility(); TEST_UTIL = new IntegrationTestingUtility();
((IntegrationTestingUtility)TEST_UTIL).initializeCluster(NUM_SLAVES_BASE); ((IntegrationTestingUtility)TEST_UTIL).initializeCluster(NUM_SLAVES_BASE);
//set shared configs //set shared configs
admin = TEST_UTIL.getHBaseAdmin(); admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseClusterInterface(); cluster = TEST_UTIL.getHBaseClusterInterface();
rsGroupAdmin = new VerifyingRSGroupAdminClient(rsGroupAdmin.newClient(TEST_UTIL.getConnection()), rsGroupAdmin = new VerifyingRSGroupAdminClient(rsGroupAdmin.newClient(TEST_UTIL.getConnection()),
TEST_UTIL.getConfiguration()); TEST_UTIL.getConfiguration());

View File

@ -538,7 +538,7 @@ public void cleanUpCluster() throws Exception {
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_NAME)); HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_NAME));
htd.addFamily(new HColumnDescriptor(TEST_FAMILY)); htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
Admin admin = getTestingUtil(getConf()).getHBaseAdmin(); Admin admin = getTestingUtil(getConf()).getAdmin();
admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), 40); admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), 40);
doLoad(getConf(), htd); doLoad(getConf(), htd);

View File

@ -159,7 +159,7 @@ public class IntegrationTestTimeBoundedRequestsWithRegionReplicas extends Integr
// flush the table // flush the table
LOG.info("Flushing the table"); LOG.info("Flushing the table");
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
admin.flush(getTablename()); admin.flush(getTablename());
// re-open the regions to make sure that the replicas are up to date // re-open the regions to make sure that the replicas are up to date

View File

@ -94,7 +94,7 @@ public class IntegrationTestSendTraceRequests extends AbstractHBaseTool {
@Test @Test
public void internalDoWork() throws Exception { public void internalDoWork() throws Exception {
util = createUtil(); util = createUtil();
admin = util.getHBaseAdmin(); admin = util.getAdmin();
setupReceiver(); setupReceiver();
deleteTable(); deleteTable();

View File

@ -107,7 +107,7 @@ public class RowResourceBase {
@Before @Before
public void beforeMethod() throws Exception { public void beforeMethod() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) { if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME); TEST_UTIL.deleteTable(TABLE_NAME);
} }
@ -119,7 +119,7 @@ public class RowResourceBase {
@After @After
public void afterMethod() throws Exception { public void afterMethod() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) { if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME); TEST_UTIL.deleteTable(TABLE_NAME);
} }

View File

@ -68,7 +68,7 @@ public class TestGzipFilter {
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration()); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
return; return;
} }

View File

@ -107,7 +107,7 @@ public class TestMultiRowResource {
marshaller = context.createMarshaller(); marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller(); unmarshaller = context.createUnmarshaller();
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())); client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
return; return;
} }

View File

@ -152,7 +152,7 @@ public class TestNamespacesInstanceResource {
Response response; Response response;
// Check that doesn't exist via non-REST call. // Check that doesn't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertNotNull(findNamespace(admin, "default")); assertNotNull(findNamespace(admin, "default"));
assertNotNull(findNamespace(admin, "hbase")); assertNotNull(findNamespace(admin, "hbase"));
@ -168,7 +168,7 @@ public class TestNamespacesInstanceResource {
@Test @Test
public void testGetNamespaceTablesAndCannotDeleteNamespace() throws IOException, JAXBException { public void testGetNamespaceTablesAndCannotDeleteNamespace() throws IOException, JAXBException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
String nsName = "TestNamespacesInstanceResource5"; String nsName = "TestNamespacesInstanceResource5";
Response response; Response response;
@ -251,7 +251,7 @@ public class TestNamespacesInstanceResource {
Response response; Response response;
// Check that namespaces don't exist via non-REST call. // Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE1)); assertNull(findNamespace(admin, NAMESPACE1));
assertNull(findNamespace(admin, NAMESPACE2)); assertNull(findNamespace(admin, NAMESPACE2));
assertNull(findNamespace(admin, NAMESPACE3)); assertNull(findNamespace(admin, NAMESPACE3));
@ -289,7 +289,7 @@ public class TestNamespacesInstanceResource {
Response response; Response response;
// Check that namespaces don't exist via non-REST call. // Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE1)); assertNull(findNamespace(admin, NAMESPACE1));
assertNull(findNamespace(admin, NAMESPACE2)); assertNull(findNamespace(admin, NAMESPACE2));
@ -365,7 +365,7 @@ public class TestNamespacesInstanceResource {
Response response; Response response;
// Check that namespaces don't exist via non-REST call. // Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE3)); assertNull(findNamespace(admin, NAMESPACE3));
assertNull(findNamespace(admin, NAMESPACE4)); assertNull(findNamespace(admin, NAMESPACE4));

View File

@ -101,7 +101,7 @@ public class TestNamespacesResource {
Response response; Response response;
// Check that namespace does not yet exist via non-REST call. // Check that namespace does not yet exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertFalse(doesNamespaceExist(admin, NAMESPACE1)); assertFalse(doesNamespaceExist(admin, NAMESPACE1));
model = testNamespacesModel.buildTestModel(); model = testNamespacesModel.buildTestModel();
testNamespacesModel.checkModel(model); testNamespacesModel.checkModel(model);
@ -159,7 +159,7 @@ public class TestNamespacesResource {
Response response; Response response;
// Check that namespace does not yet exist via non-REST call. // Check that namespace does not yet exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertFalse(doesNamespaceExist(admin, NAMESPACE1)); assertFalse(doesNamespaceExist(admin, NAMESPACE1));
model = testNamespacesModel.buildTestModel(); model = testNamespacesModel.buildTestModel();
testNamespacesModel.checkModel(model); testNamespacesModel.checkModel(model);

View File

@ -175,7 +175,7 @@ public class TestScannerResource {
ScannerModel.class); ScannerModel.class);
marshaller = context.createMarshaller(); marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller(); unmarshaller = context.createUnmarshaller();
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
return; return;
} }

View File

@ -137,7 +137,7 @@ public class TestScannersWithFilters {
unmarshaller = context.createUnmarshaller(); unmarshaller = context.createUnmarshaller();
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (!admin.tableExists(TABLE)) { if (!admin.tableExists(TABLE)) {
HTableDescriptor htd = new HTableDescriptor(TABLE); HTableDescriptor htd = new HTableDescriptor(TABLE);
htd.addFamily(new HColumnDescriptor(FAMILIES[0])); htd.addFamily(new HColumnDescriptor(FAMILIES[0]));

View File

@ -145,7 +145,7 @@ public class TestScannersWithLabels {
ScannerModel.class); ScannerModel.class);
marshaller = context.createMarshaller(); marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller(); unmarshaller = context.createUnmarshaller();
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
return; return;
} }

View File

@ -122,7 +122,7 @@ public class TestSchemaResource {
TableSchemaModel model; TableSchemaModel model;
Response response; Response response;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertFalse(admin.tableExists(TableName.valueOf(TABLE1))); assertFalse(admin.tableExists(TableName.valueOf(TABLE1)));
// create the table // create the table
@ -181,7 +181,7 @@ public class TestSchemaResource {
TableSchemaModel model; TableSchemaModel model;
Response response; Response response;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
assertFalse(admin.tableExists(TableName.valueOf(TABLE2))); assertFalse(admin.tableExists(TableName.valueOf(TABLE2)));
// create the table // create the table

View File

@ -91,7 +91,7 @@ public class TestTableResource {
TableInfoModel.class, TableInfoModel.class,
TableListModel.class, TableListModel.class,
TableRegionModel.class); TableRegionModel.class);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
return; return;
} }

View File

@ -99,7 +99,7 @@ public class TestTableScan {
REST_TEST_UTIL.startServletContainer(conf); REST_TEST_UTIL.startServletContainer(conf);
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (!admin.tableExists(TABLE)) { if (!admin.tableExists(TABLE)) {
HTableDescriptor htd = new HTableDescriptor(TABLE); HTableDescriptor htd = new HTableDescriptor(TABLE);
htd.addFamily(new HColumnDescriptor(CFA)); htd.addFamily(new HColumnDescriptor(CFA));
@ -112,8 +112,8 @@ public class TestTableScan {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
TEST_UTIL.getHBaseAdmin().disableTable(TABLE); TEST_UTIL.getAdmin().disableTable(TABLE);
TEST_UTIL.getHBaseAdmin().deleteTable(TABLE); TEST_UTIL.getAdmin().deleteTable(TABLE);
REST_TEST_UTIL.shutdownServletContainer(); REST_TEST_UTIL.shutdownServletContainer();
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -108,7 +108,7 @@ public class TestRemoteTable {
@Before @Before
public void before() throws Exception { public void before() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) { if (admin.tableExists(TABLE)) {
if (admin.isTableEnabled(TABLE)) admin.disableTable(TABLE); if (admin.isTableEnabled(TABLE)) admin.disableTable(TABLE);
admin.deleteTable(TABLE); admin.deleteTable(TABLE);

View File

@ -80,7 +80,7 @@ public class TestRSGroups extends TestRSGroupsBase {
ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART,
""+NUM_SLAVES_BASE); ""+NUM_SLAVES_BASE);
admin = TEST_UTIL.getHBaseAdmin(); admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseCluster(); cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster(); master = ((MiniHBaseCluster)cluster).getMaster();

View File

@ -35,8 +35,8 @@ import org.apache.hadoop.hbase.RegionLoad;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.constraint.ConstraintException; import org.apache.hadoop.hbase.constraint.ConstraintException;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
@ -68,7 +68,7 @@ public abstract class TestRSGroupsBase {
//shared, cluster type specific //shared, cluster type specific
protected static HBaseTestingUtility TEST_UTIL; protected static HBaseTestingUtility TEST_UTIL;
protected static HBaseAdmin admin; protected static Admin admin;
protected static HBaseCluster cluster; protected static HBaseCluster cluster;
protected static RSGroupAdmin rsGroupAdmin; protected static RSGroupAdmin rsGroupAdmin;
@ -106,13 +106,13 @@ public abstract class TestRSGroupsBase {
} }
protected void deleteTableIfNecessary() throws IOException { protected void deleteTableIfNecessary() throws IOException {
for (HTableDescriptor desc : TEST_UTIL.getHBaseAdmin().listTables(tablePrefix+".*")) { for (HTableDescriptor desc : TEST_UTIL.getAdmin().listTables(tablePrefix+".*")) {
TEST_UTIL.deleteTable(desc.getTableName()); TEST_UTIL.deleteTable(desc.getTableName());
} }
} }
protected void deleteNamespaceIfNecessary() throws IOException { protected void deleteNamespaceIfNecessary() throws IOException {
for (NamespaceDescriptor desc : TEST_UTIL.getHBaseAdmin().listNamespaceDescriptors()) { for (NamespaceDescriptor desc : TEST_UTIL.getAdmin().listNamespaceDescriptors()) {
if(desc.getName().startsWith(tablePrefix)) { if(desc.getName().startsWith(tablePrefix)) {
admin.deleteNamespace(desc.getName()); admin.deleteNamespace(desc.getName());
} }
@ -496,7 +496,7 @@ public abstract class TestRSGroupsBase {
}); });
// Lets move this region to the new group. // Lets move this region to the new group.
TEST_UTIL.getHBaseAdmin().move(Bytes.toBytes(HRegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))), TEST_UTIL.getAdmin().move(Bytes.toBytes(HRegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))),
Bytes.toBytes(targetServer.getServerName())); Bytes.toBytes(targetServer.getServerName()));
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() { TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override @Override

View File

@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.ServerManager; import org.apache.hadoop.hbase.master.ServerManager;
@ -54,7 +54,7 @@ public class TestRSGroupsOfflineMode {
private static final org.apache.commons.logging.Log LOG = private static final org.apache.commons.logging.Log LOG =
LogFactory.getLog(TestRSGroupsOfflineMode.class); LogFactory.getLog(TestRSGroupsOfflineMode.class);
private static HMaster master; private static HMaster master;
private static HBaseAdmin hbaseAdmin; private static Admin hbaseAdmin;
private static HBaseTestingUtility TEST_UTIL; private static HBaseTestingUtility TEST_UTIL;
private static HBaseCluster cluster; private static HBaseCluster cluster;
private static RSGroupAdminEndpoint RSGroupAdminEndpoint; private static RSGroupAdminEndpoint RSGroupAdminEndpoint;
@ -75,7 +75,7 @@ public class TestRSGroupsOfflineMode {
cluster = TEST_UTIL.getHBaseCluster(); cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster(); master = ((MiniHBaseCluster)cluster).getMaster();
master.balanceSwitch(false); master.balanceSwitch(false);
hbaseAdmin = TEST_UTIL.getHBaseAdmin(); hbaseAdmin = TEST_UTIL.getAdmin();
//wait till the balancer is in online mode //wait till the balancer is in online mode
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() { TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override @Override

View File

@ -84,12 +84,12 @@ public class TestAcidGuarantees implements Tool {
} }
if (useMob) { if (useMob) {
HTableDescriptor htd = util.getHBaseAdmin().getTableDescriptor(TABLE_NAME); HTableDescriptor htd = util.getAdmin().getTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = htd.getColumnFamilies()[0]; HColumnDescriptor hcd = htd.getColumnFamilies()[0];
// force mob enabled such that all data is mob data // force mob enabled such that all data is mob data
hcd.setMobEnabled(true); hcd.setMobEnabled(true);
hcd.setMobThreshold(4); hcd.setMobThreshold(4);
util.getHBaseAdmin().modifyColumnFamily(TABLE_NAME, hcd); util.getAdmin().modifyColumnFamily(TABLE_NAME, hcd);
} }
} }
@ -337,7 +337,7 @@ public class TestAcidGuarantees implements Tool {
} }
// Add a flusher // Add a flusher
ctx.addThread(new RepeatingTestThread(ctx) { ctx.addThread(new RepeatingTestThread(ctx) {
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
public void doAnAction() throws Exception { public void doAnAction() throws Exception {
try { try {
admin.flush(TABLE_NAME); admin.flush(TABLE_NAME);

View File

@ -74,7 +74,7 @@ public class TestHColumnDescriptorDefaultVersions {
@Test @Test
public void testCreateTableWithDefault() throws IOException { public void testCreateTableWithDefault() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family // Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME); HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -95,7 +95,7 @@ public class TestHColumnDescriptorDefaultVersions {
TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3); TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3);
TEST_UTIL.startMiniCluster(1); TEST_UTIL.startMiniCluster(1);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family // Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME); HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -117,7 +117,7 @@ public class TestHColumnDescriptorDefaultVersions {
TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3); TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3);
TEST_UTIL.startMiniCluster(1); TEST_UTIL.startMiniCluster(1);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family // Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME); HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -149,7 +149,7 @@ public class TestHColumnDescriptorDefaultVersions {
private void verifyHColumnDescriptor(int expected, final TableName tableName, private void verifyHColumnDescriptor(int expected, final TableName tableName,
final byte[]... families) throws IOException { final byte[]... families) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Verify descriptor from master // Verify descriptor from master
HTableDescriptor htd = admin.getTableDescriptor(tableName); HTableDescriptor htd = admin.getTableDescriptor(tableName);

View File

@ -236,7 +236,7 @@ public class TestMetaTableAccessor {
assertFalse(MetaTableAccessor.tableExists(connection, name)); assertFalse(MetaTableAccessor.tableExists(connection, name));
UTIL.createTable(name, HConstants.CATALOG_FAMILY); UTIL.createTable(name, HConstants.CATALOG_FAMILY);
assertTrue(MetaTableAccessor.tableExists(connection, name)); assertTrue(MetaTableAccessor.tableExists(connection, name));
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.disableTable(name); admin.disableTable(name);
admin.deleteTable(name); admin.deleteTable(name);
assertFalse(MetaTableAccessor.tableExists(connection, name)); assertFalse(MetaTableAccessor.tableExists(connection, name));

View File

@ -73,7 +73,7 @@ public class TestMultiVersions {
@Before @Before
public void before() public void before()
throws MasterNotRunningException, ZooKeeperConnectionException, IOException { throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
this.admin = UTIL.getHBaseAdmin(); this.admin = UTIL.getAdmin();
} }
/** /**

View File

@ -64,7 +64,7 @@ public class TestNamespace {
public static void setUp() throws Exception { public static void setUp() throws Exception {
TEST_UTIL = new HBaseTestingUtility(); TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.startMiniCluster(NUM_SLAVES_BASE); TEST_UTIL.startMiniCluster(NUM_SLAVES_BASE);
admin = TEST_UTIL.getHBaseAdmin(); admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseCluster(); cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster(); master = ((MiniHBaseCluster)cluster).getMaster();
zkNamespaceManager = zkNamespaceManager =

View File

@ -251,7 +251,7 @@ public class TestZooKeeper {
HColumnDescriptor family = new HColumnDescriptor("fam"); HColumnDescriptor family = new HColumnDescriptor("fam");
desc.addFamily(family); desc.addFamily(family);
LOG.info("Creating table " + tableName); LOG.info("Creating table " + tableName);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
try { try {
admin.createTable(desc); admin.createTable(desc);
} finally { } finally {
@ -463,7 +463,7 @@ public class TestZooKeeper {
HMaster m = cluster.getMaster(); HMaster m = cluster.getMaster();
final ZooKeeperWatcher zkw = m.getZooKeeper(); final ZooKeeperWatcher zkw = m.getZooKeeper();
// now the cluster is up. So assign some regions. // now the cluster is up. So assign some regions.
try (Admin admin = TEST_UTIL.getHBaseAdmin()) { try (Admin admin = TEST_UTIL.getAdmin()) {
byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("a"), Bytes.toBytes("b"), byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("a"), Bytes.toBytes("b"),
Bytes.toBytes("c"), Bytes.toBytes("d"), Bytes.toBytes("e"), Bytes.toBytes("f"), Bytes.toBytes("c"), Bytes.toBytes("d"), Bytes.toBytes("e"), Bytes.toBytes("f"),
Bytes.toBytes("g"), Bytes.toBytes("h"), Bytes.toBytes("i"), Bytes.toBytes("j") }; Bytes.toBytes("g"), Bytes.toBytes("h"), Bytes.toBytes("i"), Bytes.toBytes("j") };
@ -527,7 +527,7 @@ public class TestZooKeeper {
cluster.startRegionServer(); cluster.startRegionServer();
HMaster m = cluster.getMaster(); HMaster m = cluster.getMaster();
// now the cluster is up. So assign some regions. // now the cluster is up. So assign some regions.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
Table table = null; Table table = null;
try { try {
byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("1"), Bytes.toBytes("2"), byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("1"), Bytes.toBytes("2"),

View File

@ -119,7 +119,7 @@ public class TestHFileArchiving {
TableName.valueOf("testRemovesRegionDirOnArchive"); TableName.valueOf("testRemovesRegionDirOnArchive");
UTIL.createTable(TABLE_NAME, TEST_FAM); UTIL.createTable(TABLE_NAME, TEST_FAM);
final Admin admin = UTIL.getHBaseAdmin(); final Admin admin = UTIL.getAdmin();
// get the current store files for the region // get the current store files for the region
List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME); List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
@ -250,7 +250,7 @@ public class TestHFileArchiving {
region.waitForFlushesAndCompactions(); region.waitForFlushesAndCompactions();
// disable table to prevent new updates // disable table to prevent new updates
UTIL.getHBaseAdmin().disableTable(TABLE_NAME); UTIL.getAdmin().disableTable(TABLE_NAME);
LOG.debug("Disabled table"); LOG.debug("Disabled table");
// remove all the files from the archive to get a fair comparison // remove all the files from the archive to get a fair comparison
@ -330,7 +330,7 @@ public class TestHFileArchiving {
region.waitForFlushesAndCompactions(); region.waitForFlushesAndCompactions();
// disable table to prevent new updates // disable table to prevent new updates
UTIL.getHBaseAdmin().disableTable(TABLE_NAME); UTIL.getAdmin().disableTable(TABLE_NAME);
LOG.debug("Disabled table"); LOG.debug("Disabled table");
// remove all the files from the archive to get a fair comparison // remove all the files from the archive to get a fair comparison
@ -341,7 +341,7 @@ public class TestHFileArchiving {
List<String> storeFiles = region.getStoreFileList(columns); List<String> storeFiles = region.getStoreFileList(columns);
// then delete the table so the hfiles get archived // then delete the table so the hfiles get archived
UTIL.getHBaseAdmin().deleteColumnFamily(TABLE_NAME, TEST_FAM); UTIL.getAdmin().deleteColumnFamily(TABLE_NAME, TEST_FAM);
assertArchiveFiles(fs, storeFiles, 30000); assertArchiveFiles(fs, storeFiles, 30000);

View File

@ -155,11 +155,11 @@ public class TestBlockEvictionFromClient {
exceptionLatch = null; exceptionLatch = null;
CustomInnerRegionObserver.throwException.set(false); CustomInnerRegionObserver.throwException.set(false);
// Clean up the tables for every test case // Clean up the tables for every test case
TableName[] listTableNames = TEST_UTIL.getHBaseAdmin().listTableNames(); TableName[] listTableNames = TEST_UTIL.getAdmin().listTableNames();
for (TableName tableName : listTableNames) { for (TableName tableName : listTableNames) {
if (!tableName.isSystemTable()) { if (!tableName.isSystemTable()) {
TEST_UTIL.getHBaseAdmin().disableTable(tableName); TEST_UTIL.getAdmin().disableTable(tableName);
TEST_UTIL.getHBaseAdmin().deleteTable(tableName); TEST_UTIL.getAdmin().deleteTable(tableName);
} }
} }
} }

View File

@ -75,7 +75,7 @@ public class TestClientOperationInterrupt {
util = new HBaseTestingUtility(conf); util = new HBaseTestingUtility(conf);
util.startMiniCluster(); util.startMiniCluster();
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
if (admin.tableExists(tableName)) { if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) { if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName); admin.disableTable(tableName);

View File

@ -87,7 +87,7 @@ public class TestCloneSnapshotFromClient {
*/ */
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
this.admin = TEST_UTIL.getHBaseAdmin(); this.admin = TEST_UTIL.getAdmin();
long tid = System.currentTimeMillis(); long tid = System.currentTimeMillis();
tableName = TableName.valueOf("testtb-" + tid); tableName = TableName.valueOf("testtb-" + tid);

View File

@ -82,7 +82,7 @@ public class TestEnableTable {
final TableName tableName = TableName.valueOf("testEnableTableWithNoRegionServers"); final TableName tableName = TableName.valueOf("testEnableTableWithNoRegionServers");
final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
final HMaster m = cluster.getMaster(); final HMaster m = cluster.getMaster();
final Admin admin = TEST_UTIL.getHBaseAdmin(); final Admin admin = TEST_UTIL.getAdmin();
final HTableDescriptor desc = new HTableDescriptor(tableName); final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME)); desc.addFamily(new HColumnDescriptor(FAMILYNAME));
admin.createTable(desc); admin.createTable(desc);
@ -109,10 +109,10 @@ public class TestEnableTable {
cluster.waitForRegionServerToStart(rs2.getRegionServer().getServerName().getHostname(), cluster.waitForRegionServerToStart(rs2.getRegionServer().getServerName().getHostname(),
rs2.getRegionServer().getServerName().getPort(), 60000); rs2.getRegionServer().getServerName().getPort(), 60000);
List<HRegionInfo> regions = TEST_UTIL.getHBaseAdmin().getTableRegions(tableName); List<HRegionInfo> regions = TEST_UTIL.getAdmin().getTableRegions(tableName);
assertEquals(1, regions.size()); assertEquals(1, regions.size());
for (HRegionInfo region : regions) { for (HRegionInfo region : regions) {
TEST_UTIL.getHBaseAdmin().assign(region.getEncodedNameAsBytes()); TEST_UTIL.getAdmin().assign(region.getEncodedNameAsBytes());
} }
LOG.debug("Waiting for table assigned " + tableName); LOG.debug("Waiting for table assigned " + tableName);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName); TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@ -143,7 +143,7 @@ public class TestEnableTable {
public void testDeleteForSureClearsAllTableRowsFromMeta() public void testDeleteForSureClearsAllTableRowsFromMeta()
throws IOException, InterruptedException { throws IOException, InterruptedException {
final TableName tableName = TableName.valueOf("testDeleteForSureClearsAllTableRowsFromMeta"); final TableName tableName = TableName.valueOf("testDeleteForSureClearsAllTableRowsFromMeta");
final Admin admin = TEST_UTIL.getHBaseAdmin(); final Admin admin = TEST_UTIL.getAdmin();
final HTableDescriptor desc = new HTableDescriptor(tableName); final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME)); desc.addFamily(new HColumnDescriptor(FAMILYNAME));
try { try {
@ -223,7 +223,7 @@ public class TestEnableTable {
MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster() MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster()
.getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName()); .getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName());
observer.tableCreationLatch = new CountDownLatch(1); observer.tableCreationLatch = new CountDownLatch(1);
Admin admin = testUtil.getHBaseAdmin(); Admin admin = testUtil.getAdmin();
if (splitKeys != null) { if (splitKeys != null) {
admin.createTable(htd, splitKeys); admin.createTable(htd, splitKeys);
} else { } else {
@ -241,7 +241,7 @@ public class TestEnableTable {
MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster() MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster()
.getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName()); .getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName());
observer.tableDeletionLatch = new CountDownLatch(1); observer.tableDeletionLatch = new CountDownLatch(1);
Admin admin = testUtil.getHBaseAdmin(); Admin admin = testUtil.getAdmin();
try { try {
admin.disableTable(tableName); admin.disableTable(tableName);
} catch (Exception e) { } catch (Exception e) {

View File

@ -105,7 +105,7 @@ public class TestFastFail {
@Ignore ("Can go zombie -- see HBASE-14421; FIX") @Test @Ignore ("Can go zombie -- see HBASE-14421; FIX") @Test
public void testFastFail() throws IOException, InterruptedException { public void testFastFail() throws IOException, InterruptedException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
final String tableName = "testClientRelearningExperiment"; final String tableName = "testClientRelearningExperiment";
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes
@ -295,7 +295,7 @@ public class TestFastFail {
@Test @Test
public void testCallQueueTooBigExceptionDoesntTriggerPffe() throws Exception { public void testCallQueueTooBigExceptionDoesntTriggerPffe() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
final String tableName = "testCallQueueTooBigException"; final String tableName = "testCallQueueTooBigException";
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes

View File

@ -237,7 +237,7 @@ public class TestFromClientSide {
HTableDescriptor desc = new HTableDescriptor(TABLENAME); HTableDescriptor desc = new HTableDescriptor(TABLENAME);
desc.addFamily(hcd); desc.addFamily(hcd);
TEST_UTIL.getHBaseAdmin().createTable(desc); TEST_UTIL.getAdmin().createTable(desc);
Table h = TEST_UTIL.getConnection().getTable(TABLENAME); Table h = TEST_UTIL.getConnection().getTable(TABLENAME);
long ts = System.currentTimeMillis(); long ts = System.currentTimeMillis();
@ -319,14 +319,14 @@ public class TestFromClientSide {
assertNull(result.getValue(FAMILY, COLUMN)); assertNull(result.getValue(FAMILY, COLUMN));
// major compaction, purged future deletes // major compaction, purged future deletes
TEST_UTIL.getHBaseAdmin().flush(TABLENAME); TEST_UTIL.getAdmin().flush(TABLENAME);
TEST_UTIL.getHBaseAdmin().majorCompact(TABLENAME); TEST_UTIL.getAdmin().majorCompact(TABLENAME);
// waiting for the major compaction to complete // waiting for the major compaction to complete
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() { TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
@Override @Override
public boolean evaluate() throws IOException { public boolean evaluate() throws IOException {
return TEST_UTIL.getHBaseAdmin().getCompactionState(TABLENAME) == return TEST_UTIL.getAdmin().getCompactionState(TABLENAME) ==
CompactionState.NONE; CompactionState.NONE;
} }
}); });
@ -646,7 +646,7 @@ public class TestFromClientSide {
private List<HRegionLocation> splitTable(final Table t) private List<HRegionLocation> splitTable(final Table t)
throws IOException, InterruptedException { throws IOException, InterruptedException {
// Split this table in two. // Split this table in two.
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.split(t.getName()); admin.split(t.getName());
admin.close(); admin.close();
List<HRegionLocation> regions = waitOnSplit(t); List<HRegionLocation> regions = waitOnSplit(t);
@ -1756,7 +1756,7 @@ public class TestFromClientSide {
@Test @Test
public void testDeleteFamilyVersion() throws Exception { public void testDeleteFamilyVersion() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
TableName TABLE = TableName.valueOf("testDeleteFamilyVersion"); TableName TABLE = TableName.valueOf("testDeleteFamilyVersion");
byte [][] QUALIFIERS = makeNAscii(QUALIFIER, 1); byte [][] QUALIFIERS = makeNAscii(QUALIFIER, 1);
@ -1801,7 +1801,7 @@ public class TestFromClientSide {
byte [][] VALUES = makeN(VALUE, 5); byte [][] VALUES = makeN(VALUE, 5);
long [] ts = {1000, 2000, 3000, 4000, 5000}; long [] ts = {1000, 2000, 3000, 4000, 5000};
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
Table ht = TEST_UTIL.createTable(TABLE, FAMILY, 5); Table ht = TEST_UTIL.createTable(TABLE, FAMILY, 5);
Put put = null; Put put = null;
Result result = null; Result result = null;
@ -3668,7 +3668,7 @@ public class TestFromClientSide {
TableName TABLE = TableName.valueOf("testUpdatesWithMajorCompaction"); TableName TABLE = TableName.valueOf("testUpdatesWithMajorCompaction");
Table hTable = TEST_UTIL.createTable(TABLE, FAMILY, 10); Table hTable = TEST_UTIL.createTable(TABLE, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Write a column with values at timestamp 1, 2 and 3 // Write a column with values at timestamp 1, 2 and 3
byte[] row = Bytes.toBytes("row2"); byte[] row = Bytes.toBytes("row2");
@ -3729,7 +3729,7 @@ public class TestFromClientSide {
TableName tableName = TableName.valueOf("testMajorCompactionBetweenTwoUpdates"); TableName tableName = TableName.valueOf("testMajorCompactionBetweenTwoUpdates");
Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10); Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// Write a column with values at timestamp 1, 2 and 3 // Write a column with values at timestamp 1, 2 and 3
byte[] row = Bytes.toBytes("row3"); byte[] row = Bytes.toBytes("row3");
@ -4094,7 +4094,7 @@ public class TestFromClientSide {
for (int i = 0; i < tables.length; i++) { for (int i = 0; i < tables.length; i++) {
TEST_UTIL.createTable(tables[i], FAMILY); TEST_UTIL.createTable(tables[i], FAMILY);
} }
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
HTableDescriptor[] ts = admin.listTables(); HTableDescriptor[] ts = admin.listTables();
HashSet<HTableDescriptor> result = new HashSet<HTableDescriptor>(ts.length); HashSet<HTableDescriptor> result = new HashSet<HTableDescriptor>(ts.length);
Collections.addAll(result, ts); Collections.addAll(result, ts);
@ -4209,7 +4209,7 @@ public class TestFromClientSide {
// to be reloaded. // to be reloaded.
// Test user metadata // Test user metadata
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
// make a modifiable descriptor // make a modifiable descriptor
HTableDescriptor desc = new HTableDescriptor(a.getTableDescriptor()); HTableDescriptor desc = new HTableDescriptor(a.getTableDescriptor());
// offline the table // offline the table
@ -5143,7 +5143,7 @@ public class TestFromClientSide {
byte [] family1 = Bytes.toBytes("f1"); byte [] family1 = Bytes.toBytes("f1");
byte [] family2 = Bytes.toBytes("f2"); byte [] family2 = Bytes.toBytes("f2");
try (Table table = TEST_UTIL.createTable(TABLE, new byte[][] {family1, family2}, 10); try (Table table = TEST_UTIL.createTable(TABLE, new byte[][] {family1, family2}, 10);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(TABLE)) { RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(TABLE)) {
List<HRegionLocation> allRegionLocations = locator.getAllRegionLocations(); List<HRegionLocation> allRegionLocations = locator.getAllRegionLocations();
assertEquals(1, allRegionLocations.size()); assertEquals(1, allRegionLocations.size());
@ -6159,7 +6159,7 @@ public class TestFromClientSide {
HColumnDescriptor fam = new HColumnDescriptor(FAMILY); HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam); htd.addFamily(fam);
byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE; byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd, KEYS); admin.createTable(htd, KEYS);
List<HRegionInfo> regions = admin.getTableRegions(htd.getTableName()); List<HRegionInfo> regions = admin.getTableRegions(htd.getTableName());
@ -6210,7 +6210,7 @@ public class TestFromClientSide {
HColumnDescriptor fam = new HColumnDescriptor(FAMILY); HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam); htd.addFamily(fam);
byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE; byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE;
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd, KEYS); admin.createTable(htd, KEYS);
HRegionLocator locator = HRegionLocator locator =
(HRegionLocator) admin.getConnection().getRegionLocator(htd.getTableName()); (HRegionLocator) admin.getConnection().getRegionLocator(htd.getTableName());

View File

@ -117,7 +117,7 @@ public class TestFromClientSide3 {
*/ */
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
for (HTableDescriptor htd: TEST_UTIL.getHBaseAdmin().listTables()) { for (HTableDescriptor htd: TEST_UTIL.getAdmin().listTables()) {
LOG.info("Tear down, remove table=" + htd.getTableName()); LOG.info("Tear down, remove table=" + htd.getTableName());
TEST_UTIL.deleteTable(htd.getTableName()); TEST_UTIL.deleteTable(htd.getTableName());
} }
@ -171,7 +171,7 @@ public class TestFromClientSide3 {
TableName tableName = TableName.valueOf("testAdvancedConfigOverride"); TableName tableName = TableName.valueOf("testAdvancedConfigOverride");
Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10); Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
ClusterConnection connection = (ClusterConnection) TEST_UTIL.getConnection(); ClusterConnection connection = (ClusterConnection) TEST_UTIL.getConnection();
// Create 3 store files. // Create 3 store files.
@ -471,7 +471,7 @@ public class TestFromClientSide3 {
@Test @Test
public void testGetEmptyRow() throws Exception { public void testGetEmptyRow() throws Exception {
//Create a table and put in 1 row //Create a table and put in 1 row
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes.toBytes("test"))); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes.toBytes("test")));
desc.addFamily(new HColumnDescriptor(FAMILY)); desc.addFamily(new HColumnDescriptor(FAMILY));
admin.createTable(desc); admin.createTable(desc);
@ -713,7 +713,7 @@ public class TestFromClientSide3 {
HTableDescriptor htd = new HTableDescriptor(tableName); HTableDescriptor htd = new HTableDescriptor(tableName);
HColumnDescriptor fam = new HColumnDescriptor(FAMILY); HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam); htd.addFamily(fam);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd); admin.createTable(htd);
Table table = admin.getConnection().getTable(TableName.valueOf("testMVCCUsingMVCCPreAssign")); Table table = admin.getConnection().getTable(TableName.valueOf("testMVCCUsingMVCCPreAssign"));
//put two row first to init the scanner //put two row first to init the scanner

View File

@ -340,7 +340,7 @@ public class TestHCM {
final ConnectionImplementation hci = (ConnectionImplementation)TEST_UTIL.getConnection(); final ConnectionImplementation hci = (ConnectionImplementation)TEST_UTIL.getConnection();
try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tn)) { try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tn)) {
while (l.getRegionLocation(rk).getPort() != sn.getPort()) { while (l.getRegionLocation(rk).getPort() != sn.getPort()) {
TEST_UTIL.getHBaseAdmin().move(l.getRegionLocation(rk).getRegionInfo(). TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegionInfo().
getEncodedNameAsBytes(), Bytes.toBytes(sn.toString())); getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
TEST_UTIL.waitUntilNoRegionsInTransition(); TEST_UTIL.waitUntilNoRegionsInTransition();
hci.clearRegionCache(tn); hci.clearRegionCache(tn);
@ -804,7 +804,7 @@ public class TestHCM {
table.close(); table.close();
connection.close(); connection.close();
Assert.assertTrue("Unexpected exception is " + failed.get(), failed.get() == null); Assert.assertTrue("Unexpected exception is " + failed.get(), failed.get() == null);
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true); TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
} }
/** /**
@ -815,7 +815,7 @@ public class TestHCM {
TableName tableName = TableName.valueOf("HCM-testConnectionIdle"); TableName tableName = TableName.valueOf("HCM-testConnectionIdle");
TEST_UTIL.createTable(tableName, FAM_NAM).close(); TEST_UTIL.createTable(tableName, FAM_NAM).close();
int idleTime = 20000; int idleTime = 20000;
boolean previousBalance = TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, true); boolean previousBalance = TEST_UTIL.getAdmin().setBalancerRunning(false, true);
Configuration c2 = new Configuration(TEST_UTIL.getConfiguration()); Configuration c2 = new Configuration(TEST_UTIL.getConfiguration());
// We want to work on a separate connection. // We want to work on a separate connection.
@ -863,7 +863,7 @@ public class TestHCM {
connection.close(); connection.close();
EnvironmentEdgeManager.reset(); EnvironmentEdgeManager.reset();
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true); TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
} }
/** /**
@ -877,7 +877,7 @@ public class TestHCM {
TableName tableName = TableName.valueOf("HCM-testConnectionCut"); TableName tableName = TableName.valueOf("HCM-testConnectionCut");
TEST_UTIL.createTable(tableName, FAM_NAM).close(); TEST_UTIL.createTable(tableName, FAM_NAM).close();
boolean previousBalance = TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, true); boolean previousBalance = TEST_UTIL.getAdmin().setBalancerRunning(false, true);
Configuration c2 = new Configuration(TEST_UTIL.getConfiguration()); Configuration c2 = new Configuration(TEST_UTIL.getConfiguration());
// We want to work on a separate connection. // We want to work on a separate connection.
@ -932,7 +932,7 @@ public class TestHCM {
} finally { } finally {
syncBlockingFilter.set(true); syncBlockingFilter.set(true);
t.join(); t.join();
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true); TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
} }
table.close(); table.close();
@ -1008,7 +1008,7 @@ public class TestHCM {
assertNotNull(conn.getCachedLocation(TABLE_NAME, ROW)); assertNotNull(conn.getCachedLocation(TABLE_NAME, ROW));
assertNotNull(conn.getCachedLocation(TableName.valueOf(TABLE_NAME.getName()), ROW.clone())); assertNotNull(conn.getCachedLocation(TableName.valueOf(TABLE_NAME.getName()), ROW.clone()));
TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, false); TEST_UTIL.getAdmin().setBalancerRunning(false, false);
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster(); HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
// We can wait for all regions to be online, that makes log reading easier when debugging // We can wait for all regions to be online, that makes log reading easier when debugging
@ -1040,7 +1040,7 @@ public class TestHCM {
// Moving. It's possible that we don't have all the regions online at this point, so // Moving. It's possible that we don't have all the regions online at this point, so
// the test must depends only on the region we're looking at. // the test must depends only on the region we're looking at.
LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString()); LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move( TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(), toMove.getRegionInfo().getEncodedNameAsBytes(),
destServerName.getServerName().getBytes() destServerName.getServerName().getBytes()
); );
@ -1099,7 +1099,7 @@ public class TestHCM {
// We move it back to do another test with a scan // We move it back to do another test with a scan
LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString()); LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move( TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(), toMove.getRegionInfo().getEncodedNameAsBytes(),
curServer.getServerName().getServerName().getBytes() curServer.getServerName().getServerName().getBytes()
); );
@ -1304,7 +1304,7 @@ public class TestHCM {
conn.clearRegionCache(TABLE_NAME3); conn.clearRegionCache(TABLE_NAME3);
Assert.assertEquals(0, conn.getNumberOfCachedRegionLocations(TABLE_NAME3)); Assert.assertEquals(0, conn.getNumberOfCachedRegionLocations(TABLE_NAME3));
TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, false); TEST_UTIL.getAdmin().setBalancerRunning(false, false);
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster(); HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
// We can wait for all regions to be online, that makes log reading easier when debugging // We can wait for all regions to be online, that makes log reading easier when debugging
@ -1357,7 +1357,7 @@ public class TestHCM {
// Moving. It's possible that we don't have all the regions online at this point, so // Moving. It's possible that we don't have all the regions online at this point, so
// the test must depends only on the region we're looking at. // the test must depends only on the region we're looking at.
LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString()); LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move( TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(), toMove.getRegionInfo().getEncodedNameAsBytes(),
destServerName.getServerName().getBytes() destServerName.getServerName().getBytes()
); );

View File

@ -162,7 +162,7 @@ public class TestHTableMultiplexerFlushCache {
// Move the region // Move the region
LOG.info("Moving " + loc.getRegionInfo().getEncodedName() + " from " + originalServer LOG.info("Moving " + loc.getRegionInfo().getEncodedName() + " from " + originalServer
+ " to " + newServer); + " to " + newServer);
TEST_UTIL.getHBaseAdmin().move(loc.getRegionInfo().getEncodedNameAsBytes(), TEST_UTIL.getAdmin().move(loc.getRegionInfo().getEncodedNameAsBytes(),
Bytes.toBytes(newServer.getServerName())); Bytes.toBytes(newServer.getServerName()));
TEST_UTIL.waitUntilAllRegionsAssigned(TABLE); TEST_UTIL.waitUntilAllRegionsAssigned(TABLE);

View File

@ -177,14 +177,14 @@ public class TestIllegalTableDescriptor {
} }
private void checkTableIsLegal(HTableDescriptor htd) throws IOException { private void checkTableIsLegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd); admin.createTable(htd);
assertTrue(admin.tableExists(htd.getTableName())); assertTrue(admin.tableExists(htd.getTableName()));
TEST_UTIL.deleteTable(htd.getTableName()); TEST_UTIL.deleteTable(htd.getTableName());
} }
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException { private void checkTableIsIllegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
try { try {
admin.createTable(htd); admin.createTable(htd);
fail(); fail();

View File

@ -87,7 +87,7 @@ public class TestLeaseRenewal {
*/ */
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
for (HTableDescriptor htd : TEST_UTIL.getHBaseAdmin().listTables()) { for (HTableDescriptor htd : TEST_UTIL.getAdmin().listTables()) {
LOG.info("Tear down, remove table=" + htd.getTableName()); LOG.info("Tear down, remove table=" + htd.getTableName());
TEST_UTIL.deleteTable(htd.getTableName()); TEST_UTIL.deleteTable(htd.getTableName());
} }

View File

@ -112,7 +112,7 @@ public class TestMetaWithReplicas {
@Test @Test
public void testMetaHTDReplicaCount() throws Exception { public void testMetaHTDReplicaCount() throws Exception {
assertTrue(TEST_UTIL.getHBaseAdmin().getTableDescriptor(TableName.META_TABLE_NAME) assertTrue(TEST_UTIL.getAdmin().getTableDescriptor(TableName.META_TABLE_NAME)
.getRegionReplication() == 3); .getRegionReplication() == 3);
} }
@ -166,14 +166,14 @@ public class TestMetaWithReplicas {
TableName TABLE = TableName.valueOf("testShutdownHandling"); TableName TABLE = TableName.valueOf("testShutdownHandling");
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") }; byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") };
if (util.getHBaseAdmin().tableExists(TABLE)) { if (util.getAdmin().tableExists(TABLE)) {
util.getHBaseAdmin().disableTable(TABLE); util.getAdmin().disableTable(TABLE);
util.getHBaseAdmin().deleteTable(TABLE); util.getAdmin().deleteTable(TABLE);
} }
ServerName master = null; ServerName master = null;
try (Connection c = ConnectionFactory.createConnection(util.getConfiguration());) { try (Connection c = ConnectionFactory.createConnection(util.getConfiguration());) {
try (Table htable = util.createTable(TABLE, FAMILIES);) { try (Table htable = util.createTable(TABLE, FAMILIES);) {
util.getHBaseAdmin().flush(TableName.META_TABLE_NAME); util.getAdmin().flush(TableName.META_TABLE_NAME);
Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
30000) * 6); 30000) * 6);
List<HRegionInfo> regions = MetaTableAccessor.getTableRegions(c, TABLE); List<HRegionInfo> regions = MetaTableAccessor.getTableRegions(c, TABLE);
@ -184,13 +184,13 @@ public class TestMetaWithReplicas {
// If the servers are the same, then move the test table's region out of the server // If the servers are the same, then move the test table's region out of the server
// to another random server // to another random server
if (hrl.getServerName().equals(primary)) { if (hrl.getServerName().equals(primary)) {
util.getHBaseAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes(), null); util.getAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes(), null);
// wait for the move to complete // wait for the move to complete
do { do {
Thread.sleep(10); Thread.sleep(10);
hrl = MetaTableAccessor.getRegionLocation(c, regions.get(0)); hrl = MetaTableAccessor.getRegionLocation(c, regions.get(0));
} while (primary.equals(hrl.getServerName())); } while (primary.equals(hrl.getServerName()));
util.getHBaseAdmin().flush(TableName.META_TABLE_NAME); util.getAdmin().flush(TableName.META_TABLE_NAME);
Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
30000) * 3); 30000) * 3);
} }
@ -237,9 +237,9 @@ public class TestMetaWithReplicas {
public void testMetaLookupThreadPoolCreated() throws Exception { public void testMetaLookupThreadPoolCreated() throws Exception {
TableName TABLE = TableName.valueOf("testMetaLookupThreadPoolCreated"); TableName TABLE = TableName.valueOf("testMetaLookupThreadPoolCreated");
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") }; byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") };
if (TEST_UTIL.getHBaseAdmin().tableExists(TABLE)) { if (TEST_UTIL.getAdmin().tableExists(TABLE)) {
TEST_UTIL.getHBaseAdmin().disableTable(TABLE); TEST_UTIL.getAdmin().disableTable(TABLE);
TEST_UTIL.getHBaseAdmin().deleteTable(TABLE); TEST_UTIL.getAdmin().deleteTable(TABLE);
} }
try (Table htable = TEST_UTIL.createTable(TABLE, FAMILIES);) { try (Table htable = TEST_UTIL.createTable(TABLE, FAMILIES);) {
byte[] row = "test".getBytes(); byte[] row = "test".getBytes();
@ -392,7 +392,7 @@ public class TestMetaWithReplicas {
// check that the data in the znode is parseable (this would also mean the znode exists) // check that the data in the znode is parseable (this would also mean the znode exists)
byte[] data = ZKUtil.getData(zkw, primaryMetaZnode); byte[] data = ZKUtil.getData(zkw, primaryMetaZnode);
ServerName currentServer = ProtobufUtil.toServerName(data); ServerName currentServer = ProtobufUtil.toServerName(data);
Collection<ServerName> liveServers = TEST_UTIL.getHBaseAdmin().getClusterStatus().getServers(); Collection<ServerName> liveServers = TEST_UTIL.getAdmin().getClusterStatus().getServers();
ServerName moveToServer = null; ServerName moveToServer = null;
for (ServerName s : liveServers) { for (ServerName s : liveServers) {
if (!currentServer.equals(s)) { if (!currentServer.equals(s)) {
@ -402,8 +402,8 @@ public class TestMetaWithReplicas {
assert(moveToServer != null); assert(moveToServer != null);
TableName tableName = TableName.valueOf("randomTable5678"); TableName tableName = TableName.valueOf("randomTable5678");
TEST_UTIL.createTable(tableName, "f"); TEST_UTIL.createTable(tableName, "f");
assertTrue(TEST_UTIL.getHBaseAdmin().tableExists(tableName)); assertTrue(TEST_UTIL.getAdmin().tableExists(tableName));
TEST_UTIL.getHBaseAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(), TEST_UTIL.getAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
Bytes.toBytes(moveToServer.getServerName())); Bytes.toBytes(moveToServer.getServerName()));
int i = 0; int i = 0;
do { do {
@ -413,8 +413,8 @@ public class TestMetaWithReplicas {
i++; i++;
} while (!moveToServer.equals(currentServer) && i < 1000); //wait for 10 seconds overall } while (!moveToServer.equals(currentServer) && i < 1000); //wait for 10 seconds overall
assert(i != 1000); assert(i != 1000);
TEST_UTIL.getHBaseAdmin().disableTable(tableName); TEST_UTIL.getAdmin().disableTable(tableName);
assertTrue(TEST_UTIL.getHBaseAdmin().isTableDisabled(tableName)); assertTrue(TEST_UTIL.getAdmin().isTableDisabled(tableName));
} }
@Test @Test
@ -449,7 +449,7 @@ public class TestMetaWithReplicas {
TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager() TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager()
.getRegionStates().createRegionState(h); .getRegionStates().createRegionState(h);
TEST_UTIL.assignRegion(h); TEST_UTIL.assignRegion(h);
HBaseFsckRepair.waitUntilAssigned(TEST_UTIL.getHBaseAdmin(), h); HBaseFsckRepair.waitUntilAssigned(TEST_UTIL.getAdmin(), h);
// check that problem exists // check that problem exists
HBaseFsck hbck = doFsck(TEST_UTIL.getConfiguration(), false); HBaseFsck hbck = doFsck(TEST_UTIL.getConfiguration(), false);
assertErrors(hbck, new ERROR_CODE[]{ERROR_CODE.UNKNOWN, ERROR_CODE.SHOULD_NOT_BE_DEPLOYED}); assertErrors(hbck, new ERROR_CODE[]{ERROR_CODE.UNKNOWN, ERROR_CODE.SHOULD_NOT_BE_DEPLOYED});

View File

@ -161,9 +161,9 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
hcd.setMobThreshold(0L); hcd.setMobThreshold(0L);
htd.addFamily(hcd); htd.addFamily(hcd);
} }
util.getHBaseAdmin().createTable(htd, splitKeys); util.getAdmin().createTable(htd, splitKeys);
SnapshotTestingUtils.waitForTableToBeOnline(util, tableName); SnapshotTestingUtils.waitForTableToBeOnline(util, tableName);
assertEquals((splitKeys.length + 1) * regionReplication, assertEquals((splitKeys.length + 1) * regionReplication,
util.getHBaseAdmin().getTableRegions(tableName).size()); util.getAdmin().getTableRegions(tableName).size());
} }
} }

View File

@ -117,7 +117,7 @@ public class TestMultiRespectsLimits {
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF); hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF);
desc.addFamily(hcd); desc.addFamily(hcd);
TEST_UTIL.getHBaseAdmin().createTable(desc); TEST_UTIL.getAdmin().createTable(desc);
Table t = TEST_UTIL.getConnection().getTable(name); Table t = TEST_UTIL.getConnection().getTable(name);
final HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0); final HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0);

View File

@ -217,7 +217,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0); SlowMeCopro.sleepTime.set(0);
} }
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName()); HTU.deleteTable(hdt.getTableName());
} }
@ -238,13 +238,13 @@ public class TestReplicaWithCluster {
Assert.assertFalse(r.isStale()); Assert.assertFalse(r.isStale());
// Add a CF, it should work. // Add a CF, it should work.
HTableDescriptor bHdt = HTU.getHBaseAdmin().getTableDescriptor(hdt.getTableName()); HTableDescriptor bHdt = HTU.getAdmin().getTableDescriptor(hdt.getTableName());
HColumnDescriptor hcd = new HColumnDescriptor(row); HColumnDescriptor hcd = new HColumnDescriptor(row);
hdt.addFamily(hcd); hdt.addFamily(hcd);
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.getHBaseAdmin().modifyTable(hdt.getTableName(), hdt); HTU.getAdmin().modifyTable(hdt.getTableName(), hdt);
HTU.getHBaseAdmin().enableTable(hdt.getTableName()); HTU.getAdmin().enableTable(hdt.getTableName());
HTableDescriptor nHdt = HTU.getHBaseAdmin().getTableDescriptor(hdt.getTableName()); HTableDescriptor nHdt = HTU.getAdmin().getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()), Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount()); bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount());
@ -267,7 +267,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0); SlowMeCopro.sleepTime.set(0);
} }
Admin admin = HTU.getHBaseAdmin(); Admin admin = HTU.getAdmin();
nHdt =admin.getTableDescriptor(hdt.getTableName()); nHdt =admin.getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()), Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount()); bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount());
@ -288,7 +288,7 @@ public class TestReplicaWithCluster {
hdt.addFamily(fam); hdt.addFamily(fam);
hdt.addCoprocessor(SlowMeCopro.class.getName()); hdt.addCoprocessor(SlowMeCopro.class.getName());
HTU.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); HTU.getAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
Configuration conf2 = HBaseConfiguration.create(HTU.getConfiguration()); Configuration conf2 = HBaseConfiguration.create(HTU.getConfiguration());
conf2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1)); conf2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
@ -299,7 +299,7 @@ public class TestReplicaWithCluster {
HTU2.setZkCluster(miniZK); HTU2.setZkCluster(miniZK);
HTU2.startMiniCluster(NB_SERVERS); HTU2.startMiniCluster(NB_SERVERS);
LOG.info("Setup second Zk"); LOG.info("Setup second Zk");
HTU2.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); HTU2.getAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration()); ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration());
@ -313,7 +313,7 @@ public class TestReplicaWithCluster {
final Table table = HTU.getConnection().getTable(hdt.getTableName()); final Table table = HTU.getConnection().getTable(hdt.getTableName());
table.put(p); table.put(p);
HTU.getHBaseAdmin().flush(table.getName()); HTU.getAdmin().flush(table.getName());
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster."); LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() { Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@ -352,10 +352,10 @@ public class TestReplicaWithCluster {
}); });
table2.close(); table2.close();
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName()); HTU.deleteTable(hdt.getTableName());
HTU2.getHBaseAdmin().disableTable(hdt.getTableName()); HTU2.getAdmin().disableTable(hdt.getTableName());
HTU2.deleteTable(hdt.getTableName()); HTU2.deleteTable(hdt.getTableName());
// We shutdown HTU2 minicluster later, in afterClass(), as shutting down // We shutdown HTU2 minicluster later, in afterClass(), as shutting down
@ -438,7 +438,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0); SlowMeCopro.sleepTime.set(0);
} }
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName()); HTU.deleteTable(hdt.getTableName());
} }
@ -471,7 +471,7 @@ public class TestReplicaWithCluster {
Result r = table.get(g); Result r = table.get(g);
Assert.assertTrue(r.isStale()); Assert.assertTrue(r.isStale());
} finally { } finally {
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName()); HTU.deleteTable(hdt.getTableName());
} }
} }
@ -516,7 +516,7 @@ public class TestReplicaWithCluster {
Assert.assertTrue(r.isStale()); Assert.assertTrue(r.isStale());
} finally { } finally {
HTU.getHBaseAdmin().disableTable(hdt.getTableName()); HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName()); HTU.deleteTable(hdt.getTableName());
} }
} }

View File

@ -303,7 +303,7 @@ public class TestReplicasClient {
public void testLocations() throws Exception { public void testLocations() throws Exception {
byte[] b1 = "testLocations".getBytes(); byte[] b1 = "testLocations".getBytes();
openRegion(hriSecondary); openRegion(hriSecondary);
ClusterConnection hc = (ClusterConnection) HTU.getHBaseAdmin().getConnection(); ClusterConnection hc = (ClusterConnection) HTU.getAdmin().getConnection();
try { try {
hc.clearRegionCache(); hc.clearRegionCache();

View File

@ -103,7 +103,7 @@ public class TestRestoreSnapshotFromClient {
*/ */
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
this.admin = TEST_UTIL.getHBaseAdmin(); this.admin = TEST_UTIL.getAdmin();
long tid = System.currentTimeMillis(); long tid = System.currentTimeMillis();
tableName = tableName =
@ -146,7 +146,7 @@ public class TestRestoreSnapshotFromClient {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
TEST_UTIL.deleteTable(tableName); TEST_UTIL.deleteTable(tableName);
SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getHBaseAdmin()); SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL); SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL);
} }

View File

@ -137,7 +137,7 @@ public class TestScannerTimeout {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setCaching(SCANNER_CACHING); scan.setCaching(SCANNER_CACHING);
LOG.info("************ TEST3686A"); LOG.info("************ TEST3686A");
MetaTableAccessor.fullScanMetaAndPrint(TEST_UTIL.getHBaseAdmin().getConnection()); MetaTableAccessor.fullScanMetaAndPrint(TEST_UTIL.getAdmin().getConnection());
// Set a very high timeout, we want to test what happens when a RS // Set a very high timeout, we want to test what happens when a RS
// fails but the region is recovered before the lease times out. // fails but the region is recovered before the lease times out.
// Since the RS is already created, this conf is client-side only for // Since the RS is already created, this conf is client-side only for

View File

@ -77,7 +77,7 @@ public class TestSizeFailures {
splits[i - 1][0] = (byte) (split >>> 8); splits[i - 1][0] = (byte) (split >>> 8);
splits[i - 1][0] = (byte) (split); splits[i - 1][0] = (byte) (split);
} }
TEST_UTIL.getHBaseAdmin().createTable(desc, splits); TEST_UTIL.getAdmin().createTable(desc, splits);
Connection conn = TEST_UTIL.getConnection(); Connection conn = TEST_UTIL.getConnection();
try (Table table = conn.getTable(TABLENAME)) { try (Table table = conn.getTable(TABLENAME)) {

View File

@ -121,7 +121,7 @@ public class TestSnapshotCloneIndependence {
fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem(); fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
originalTableName = TableName.valueOf("test" + testName.getMethodName()); originalTableName = TableName.valueOf("test" + testName.getMethodName());
cloneTableName = TableName.valueOf("test-clone-" + originalTableName); cloneTableName = TableName.valueOf("test-clone-" + originalTableName);
snapshotNameAsString = "snapshot_" + originalTableName; snapshotNameAsString = "snapshot_" + originalTableName;
@ -137,7 +137,7 @@ public class TestSnapshotCloneIndependence {
public void tearDown() throws Exception { public void tearDown() throws Exception {
UTIL.deleteTable(originalTableName); UTIL.deleteTable(originalTableName);
UTIL.deleteTable(cloneTableName); UTIL.deleteTable(cloneTableName);
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin()); SnapshotTestingUtils.deleteAllSnapshots(UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(UTIL); SnapshotTestingUtils.deleteArchiveDirectory(UTIL);
} }

View File

@ -116,7 +116,7 @@ public class TestSnapshotFromClient {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
UTIL.deleteTable(TABLE_NAME); UTIL.deleteTable(TABLE_NAME);
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin()); SnapshotTestingUtils.deleteAllSnapshots(UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(UTIL); SnapshotTestingUtils.deleteArchiveDirectory(UTIL);
} }
@ -135,7 +135,7 @@ public class TestSnapshotFromClient {
*/ */
@Test (timeout=300000) @Test (timeout=300000)
public void testMetaTablesSnapshot() throws Exception { public void testMetaTablesSnapshot() throws Exception {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
byte[] snapshotName = Bytes.toBytes("metaSnapshot"); byte[] snapshotName = Bytes.toBytes("metaSnapshot");
try { try {
@ -153,7 +153,7 @@ public class TestSnapshotFromClient {
*/ */
@Test (timeout=300000) @Test (timeout=300000)
public void testSnapshotDeletionWithRegex() throws Exception { public void testSnapshotDeletionWithRegex() throws Exception {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
@ -189,7 +189,7 @@ public class TestSnapshotFromClient {
*/ */
@Test (timeout=300000) @Test (timeout=300000)
public void testOfflineTableSnapshot() throws Exception { public void testOfflineTableSnapshot() throws Exception {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
@ -237,7 +237,7 @@ public class TestSnapshotFromClient {
@Test (timeout=300000) @Test (timeout=300000)
public void testSnapshotFailsOnNonExistantTable() throws Exception { public void testSnapshotFailsOnNonExistantTable() throws Exception {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
String tableName = "_not_a_table"; String tableName = "_not_a_table";
@ -268,7 +268,7 @@ public class TestSnapshotFromClient {
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception { public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
// test with an empty table with one region // test with an empty table with one region
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
@ -313,7 +313,7 @@ public class TestSnapshotFromClient {
Admin admin = null; Admin admin = null;
TableName tableName2 = TableName.valueOf("testListTableSnapshots"); TableName tableName2 = TableName.valueOf("testListTableSnapshots");
try { try {
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
HTableDescriptor htd = new HTableDescriptor(tableName2); HTableDescriptor htd = new HTableDescriptor(tableName2);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration()); UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
@ -357,7 +357,7 @@ public class TestSnapshotFromClient {
public void testListTableSnapshotsWithRegex() throws Exception { public void testListTableSnapshotsWithRegex() throws Exception {
Admin admin = null; Admin admin = null;
try { try {
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
String table1Snapshot1 = "Table1Snapshot1"; String table1Snapshot1 = "Table1Snapshot1";
admin.snapshot(table1Snapshot1, TABLE_NAME); admin.snapshot(table1Snapshot1, TABLE_NAME);
@ -397,7 +397,7 @@ public class TestSnapshotFromClient {
Admin admin = null; Admin admin = null;
TableName tableName2 = TableName.valueOf("testListTableSnapshots"); TableName tableName2 = TableName.valueOf("testListTableSnapshots");
try { try {
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
HTableDescriptor htd = new HTableDescriptor(tableName2); HTableDescriptor htd = new HTableDescriptor(tableName2);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration()); UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
@ -430,7 +430,7 @@ public class TestSnapshotFromClient {
public void testDeleteTableSnapshotsWithRegex() throws Exception { public void testDeleteTableSnapshotsWithRegex() throws Exception {
Admin admin = null; Admin admin = null;
try { try {
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
String table1Snapshot1 = "Table1Snapshot1"; String table1Snapshot1 = "Table1Snapshot1";
admin.snapshot(table1Snapshot1, TABLE_NAME); admin.snapshot(table1Snapshot1, TABLE_NAME);

View File

@ -133,7 +133,7 @@ public class TestSnapshotMetadata {
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
admin = UTIL.getHBaseAdmin(); admin = UTIL.getAdmin();
createTableWithNonDefaultProperties(); createTableWithNonDefaultProperties();
} }

View File

@ -89,7 +89,7 @@ public class TestTableSnapshotScanner {
} else { } else {
util.createTable(tableName, FAMILIES); util.createTable(tableName, FAMILIES);
} }
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
// put some stuff in the table // put some stuff in the table
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
@ -146,7 +146,7 @@ public class TestTableSnapshotScanner {
scanner.close(); scanner.close();
} finally { } finally {
if (!shutdownCluster) { if (!shutdownCluster) {
util.getHBaseAdmin().deleteSnapshot(snapshotName); util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName); util.deleteTable(tableName);
tearDownCluster(); tearDownCluster();
} }

View File

@ -80,7 +80,7 @@ public class TestConstraint {
// add a constraint // add a constraint
Constraints.add(desc, CheckWasRunConstraint.class); Constraints.add(desc, CheckWasRunConstraint.class);
util.getHBaseAdmin().createTable(desc); util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
try { try {
// test that we don't fail on a valid put // test that we don't fail on a valid put
@ -113,7 +113,7 @@ public class TestConstraint {
// add a constraint that is sure to fail // add a constraint that is sure to fail
Constraints.add(desc, AllFailConstraint.class); Constraints.add(desc, AllFailConstraint.class);
util.getHBaseAdmin().createTable(desc); util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
// test that we do fail on violation // test that we do fail on violation
@ -157,7 +157,7 @@ public class TestConstraint {
// and then disable the failing constraint // and then disable the failing constraint
Constraints.disableConstraint(desc, AllFailConstraint.class); Constraints.disableConstraint(desc, AllFailConstraint.class);
util.getHBaseAdmin().createTable(desc); util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
try { try {
// test that we don't fail because its disabled // test that we don't fail because its disabled
@ -190,7 +190,7 @@ public class TestConstraint {
// then disable all the constraints // then disable all the constraints
Constraints.disable(desc); Constraints.disable(desc);
util.getHBaseAdmin().createTable(desc); util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
try { try {
// test that we do fail on violation // test that we do fail on violation
@ -223,7 +223,7 @@ public class TestConstraint {
Constraints.add(desc, CheckWasRunConstraint.class); Constraints.add(desc, CheckWasRunConstraint.class);
CheckWasRunConstraint.wasRun = false; CheckWasRunConstraint.wasRun = false;
util.getHBaseAdmin().createTable(desc); util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName); Table table = util.getConnection().getTable(tableName);
// test that we do fail on violation // test that we do fail on violation
@ -248,8 +248,8 @@ public class TestConstraint {
public void cleanup() throws Exception { public void cleanup() throws Exception {
// cleanup // cleanup
CheckWasRunConstraint.wasRun = false; CheckWasRunConstraint.wasRun = false;
util.getHBaseAdmin().disableTable(tableName); util.getAdmin().disableTable(tableName);
util.getHBaseAdmin().deleteTable(tableName); util.getAdmin().deleteTable(tableName);
} }
@AfterClass @AfterClass

View File

@ -86,7 +86,7 @@ public class TestMasterCoprocessorExceptionWithAbort {
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_TABLE)); HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_TABLE));
htd.addFamily(new HColumnDescriptor(TEST_FAMILY)); htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
try { try {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.createTable(htd); admin.createTable(htd);
fail("BuggyMasterObserver failed to throw an exception."); fail("BuggyMasterObserver failed to throw an exception.");
} catch (IOException e) { } catch (IOException e) {

View File

@ -192,7 +192,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
boolean threwDNRE = false; boolean threwDNRE = false;
try { try {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.createTable(htd1); admin.createTable(htd1);
} catch (IOException e) { } catch (IOException e) {
if (e.getClass().getName().equals("org.apache.hadoop.hbase.DoNotRetryIOException")) { if (e.getClass().getName().equals("org.apache.hadoop.hbase.DoNotRetryIOException")) {
@ -219,7 +219,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
// by creating another table: should not have a problem this time. // by creating another table: should not have a problem this time.
HTableDescriptor htd2 = new HTableDescriptor(TableName.valueOf(TEST_TABLE2)); HTableDescriptor htd2 = new HTableDescriptor(TableName.valueOf(TEST_TABLE2));
htd2.addFamily(new HColumnDescriptor(TEST_FAMILY2)); htd2.addFamily(new HColumnDescriptor(TEST_FAMILY2));
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
try { try {
admin.createTable(htd2); admin.createTable(htd2);
} catch (IOException e) { } catch (IOException e) {

View File

@ -1844,7 +1844,7 @@ public class TestMasterObserver {
// create a table // create a table
HTableDescriptor htd = new HTableDescriptor(tableName); HTableDescriptor htd = new HTableDescriptor(tableName);
htd.addFamily(new HColumnDescriptor(TEST_FAMILY)); htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
tableCreationLatch = new CountDownLatch(1); tableCreationLatch = new CountDownLatch(1);
admin.createTable(htd); admin.createTable(htd);
@ -1907,7 +1907,7 @@ public class TestMasterObserver {
// create a table // create a table
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.createNamespace(NamespaceDescriptor.create(testNamespace).build()); admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
assertTrue("Test namespace should be created", cp.wasCreateNamespaceCalled()); assertTrue("Test namespace should be created", cp.wasCreateNamespaceCalled());
@ -2082,7 +2082,7 @@ public class TestMasterObserver {
assertTrue("Coprocessor should be called on region rebalancing", assertTrue("Coprocessor should be called on region rebalancing",
cp.wasBalanceCalled()); cp.wasBalanceCalled());
} finally { } finally {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.disableTable(tableName); admin.disableTable(tableName);
deleteTable(admin, tableName); deleteTable(admin, tableName);
} }

View File

@ -122,11 +122,11 @@ public class TestOpenTableInCoprocessor {
@After @After
public void cleanupTestTable() throws Exception { public void cleanupTestTable() throws Exception {
UTIL.getHBaseAdmin().disableTable(primaryTable); UTIL.getAdmin().disableTable(primaryTable);
UTIL.getHBaseAdmin().deleteTable(primaryTable); UTIL.getAdmin().deleteTable(primaryTable);
UTIL.getHBaseAdmin().disableTable(otherTable); UTIL.getAdmin().disableTable(otherTable);
UTIL.getHBaseAdmin().deleteTable(otherTable); UTIL.getAdmin().deleteTable(otherTable);
} }
@ -156,7 +156,7 @@ public class TestOpenTableInCoprocessor {
other.addFamily(new HColumnDescriptor(family)); other.addFamily(new HColumnDescriptor(family));
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.createTable(primary); admin.createTable(primary);
admin.createTable(other); admin.createTable(other);

View File

@ -76,7 +76,7 @@ public class TestRegionObserverBypass {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
Admin admin = util.getHBaseAdmin(); Admin admin = util.getAdmin();
if (admin.tableExists(tableName)) { if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) { if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName); admin.disableTable(tableName);

View File

@ -270,7 +270,7 @@ public class TestRegionObserverScannerOpenHook {
desc.addCoprocessor(NoDataFromCompaction.class.getName(), null, Coprocessor.PRIORITY_HIGHEST, desc.addCoprocessor(NoDataFromCompaction.class.getName(), null, Coprocessor.PRIORITY_HIGHEST,
null); null);
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getAdmin();
admin.createTable(desc); admin.createTable(desc);
Table table = UTIL.getConnection().getTable(desc.getTableName()); Table table = UTIL.getConnection().getTable(desc.getTableName());

View File

@ -100,7 +100,7 @@ public class FilterTestingCluster {
conf = HBaseConfiguration.create(conf); conf = HBaseConfiguration.create(conf);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
try { try {
admin = TEST_UTIL.getHBaseAdmin(); admin = TEST_UTIL.getAdmin();
} catch (MasterNotRunningException e) { } catch (MasterNotRunningException e) {
assertNull("Master is not running", e); assertNull("Master is not running", e);
} catch (ZooKeeperConnectionException e) { } catch (ZooKeeperConnectionException e) {

View File

@ -176,7 +176,7 @@ public class TestFilterWrapper {
TestFilterWrapper.conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); TestFilterWrapper.conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
try { try {
connection = ConnectionFactory.createConnection(TestFilterWrapper.conf); connection = ConnectionFactory.createConnection(TestFilterWrapper.conf);
admin = TEST_UTIL.getHBaseAdmin(); admin = TEST_UTIL.getAdmin();
} catch (MasterNotRunningException e) { } catch (MasterNotRunningException e) {
assertNull("Master is not running", e); assertNull("Master is not running", e);
} catch (ZooKeeperConnectionException e) { } catch (ZooKeeperConnectionException e) {

View File

@ -298,7 +298,7 @@ public class TestBlockReorder {
((HRegion)region).getWAL().registerWALActionsListener(listener); ((HRegion)region).getWAL().registerWALActionsListener(listener);
} }
htu.getHBaseAdmin().rollWALWriter(targetRs.getServerName()); htu.getAdmin().rollWALWriter(targetRs.getServerName());
// wait // wait
try { try {

View File

@ -218,7 +218,7 @@ public class TestChangingEncoding {
private void compactAndWait() throws IOException, InterruptedException { private void compactAndWait() throws IOException, InterruptedException {
LOG.debug("Compacting table " + tableName); LOG.debug("Compacting table " + tableName);
HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0); HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
admin.majorCompact(tableName); admin.majorCompact(tableName);
// Waiting for the compaction to start, at least .5s. // Waiting for the compaction to start, at least .5s.

View File

@ -67,7 +67,7 @@ public class TestLoadAndSwitchEncodeOnDisk extends
@Test(timeout=TIMEOUT_MS) @Test(timeout=TIMEOUT_MS)
public void loadTest() throws Exception { public void loadTest() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getAdmin();
compression = Compression.Algorithm.GZ; // used for table setup compression = Compression.Algorithm.GZ; // used for table setup
super.loadTest(); super.loadTest();

View File

@ -120,7 +120,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
"Snapshot job should not use BucketCache.", "Snapshot job should not use BucketCache.",
0, job.getFloat("hbase.bucketcache.size", -1), 0.01); 0, job.getFloat("hbase.bucketcache.size", -1), 0.01);
} finally { } finally {
UTIL.getHBaseAdmin().deleteSnapshot(snapshotName); UTIL.getAdmin().deleteSnapshot(snapshotName);
UTIL.deleteTable(tableName); UTIL.deleteTable(tableName);
tearDownCluster(); tearDownCluster();
} }
@ -177,7 +177,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
verifyWithMockedMapReduce(job, numRegions, expectedNumSplits, getStartRow(), getEndRow()); verifyWithMockedMapReduce(job, numRegions, expectedNumSplits, getStartRow(), getEndRow());
} finally { } finally {
util.getHBaseAdmin().deleteSnapshot(snapshotName); util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName); util.deleteTable(tableName);
tearDownCluster(); tearDownCluster();
} }
@ -258,7 +258,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
Assert.assertTrue(job.isSuccessful()); Assert.assertTrue(job.isSuccessful());
} finally { } finally {
if (!shutdownCluster) { if (!shutdownCluster) {
util.getHBaseAdmin().deleteSnapshot(snapshotName); util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName); util.deleteTable(tableName);
} }
} }

Some files were not shown because too many files have changed in this diff Show More