| /** |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| package org.apache.hadoop.hbase.client; |
| |
| import static org.junit.Assert.assertNotNull; |
| |
| import java.io.IOException; |
| import org.apache.hadoop.hbase.HBaseTestingUtility; |
| import org.apache.hadoop.hbase.HConstants; |
| import org.apache.hadoop.hbase.MetaTableAccessor; |
| import org.apache.hadoop.hbase.TableName; |
| import org.junit.After; |
| import org.junit.AfterClass; |
| import org.junit.BeforeClass; |
| import org.junit.Rule; |
| import org.junit.rules.TestName; |
| |
| public class TestAdminBase { |
| |
| protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); |
| protected static Admin ADMIN; |
| |
| @Rule |
| public TestName name = new TestName(); |
| |
| @BeforeClass |
| public static void setUpBeforeClass() throws Exception { |
| TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100); |
| TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250); |
| TEST_UTIL.getConfiguration().setInt("hbase.client.retries.number", 6); |
| TEST_UTIL.getConfiguration().setBoolean("hbase.master.enabletable.roundrobin", true); |
| TEST_UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 30); |
| TEST_UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HANDLER_COUNT, 30); |
| TEST_UTIL.getConfiguration().setBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY, true); |
| TEST_UTIL.startMiniCluster(3); |
| ADMIN = TEST_UTIL.getAdmin(); |
| } |
| |
| @AfterClass |
| public static void tearDownAfterClass() throws Exception { |
| TEST_UTIL.shutdownMiniCluster(); |
| } |
| |
| @After |
| public void tearDown() throws Exception { |
| for (TableDescriptor htd : ADMIN.listTableDescriptors()) { |
| TEST_UTIL.deleteTable(htd.getTableName()); |
| } |
| } |
| |
| protected TableState.State getStateFromMeta(TableName table) throws IOException { |
| TableState state = MetaTableAccessor.getTableState(TEST_UTIL.getConnection(), table); |
| assertNotNull(state); |
| return state.getState(); |
| } |
| } |