Search in sources :

Example 66 with HBaseTestingUtil

use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.

the class TestSnapshotCleanerChore method testSnapshotCleanerWithReadIOE.

@Test
public void testSnapshotCleanerWithReadIOE() throws IOException {
    snapshotManager = Mockito.mock(SnapshotManager.class);
    Stoppable stopper = new StoppableImplementation();
    Configuration conf = new HBaseTestingUtil().getConfiguration();
    SnapshotCleanerChore snapshotCleanerChore = new SnapshotCleanerChore(stopper, conf, snapshotManager);
    Mockito.when(snapshotManager.getCompletedSnapshots()).thenThrow(IOException.class);
    try {
        LOG.info("While getting completed Snapshots, IOException would occur. Hence, No Snapshot" + " should be deleted");
        snapshotCleanerChore.chore();
    } finally {
        stopper.stop("Stopping Test Stopper");
    }
    Mockito.verify(snapshotManager, Mockito.times(0)).deleteSnapshot(Mockito.any());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) Stoppable(org.apache.hadoop.hbase.Stoppable) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) SnapshotManager(org.apache.hadoop.hbase.master.snapshot.SnapshotManager) Test(org.junit.Test)

Example 67 with HBaseTestingUtil

use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.

the class TestRegionMoveAndAbandon method setup.

@Before
public void setup() throws Exception {
    UTIL = new HBaseTestingUtil();
    zkCluster = UTIL.startMiniZKCluster();
    StartTestingClusterOption option = StartTestingClusterOption.builder().numRegionServers(2).build();
    cluster = UTIL.startMiniHBaseCluster(option);
    rs1 = cluster.getRegionServer(0);
    rs2 = cluster.getRegionServer(1);
    assertEquals(2, cluster.getRegionServerThreads().size());
    tableName = TableName.valueOf(name.getMethodName());
    UTIL.createTable(tableName, Bytes.toBytes("cf"));
    UTIL.waitTableAvailable(tableName, 30_000);
    regionInfo = Iterables.getOnlyElement(cluster.getRegions(tableName)).getRegionInfo();
}
Also used : HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) Before(org.junit.Before)

Example 68 with HBaseTestingUtil

use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.

the class TestRecoveredEditsReplayAndAbort method setup.

@Before
public void setup() throws IOException {
    TEST_UTIL = new HBaseTestingUtil();
    CONF = TEST_UTIL.getConfiguration();
    method = name.getMethodName();
    tableName = TableName.valueOf(method);
}
Also used : HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) Before(org.junit.Before)

Example 69 with HBaseTestingUtil

use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.

the class TestMemStoreSegmentsIterator method setup.

@Before
public void setup() throws IOException {
    Configuration conf = new Configuration();
    HBaseTestingUtil hbaseUtility = new HBaseTestingUtil(conf);
    TableDescriptorBuilder tableDescriptorBuilder = TableDescriptorBuilder.newBuilder(TableName.valueOf(TABLE));
    ColumnFamilyDescriptor columnFamilyDescriptor = ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(FAMILY)).build();
    tableDescriptorBuilder.setColumnFamily(columnFamilyDescriptor);
    RegionInfo info = RegionInfoBuilder.newBuilder(TableName.valueOf(TABLE)).build();
    Path rootPath = hbaseUtility.getDataTestDir(ROOT_SUB_PATH);
    this.wal = HBaseTestingUtil.createWal(conf, rootPath, info);
    this.region = HRegion.createHRegion(info, rootPath, conf, tableDescriptorBuilder.build(), this.wal, true);
    this.store = new HStore(this.region, columnFamilyDescriptor, conf, false);
    this.comparator = CellComparator.getInstance();
    this.compactionKVMax = HConstants.COMPACTION_KV_MAX_DEFAULT;
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) TableDescriptorBuilder(org.apache.hadoop.hbase.client.TableDescriptorBuilder) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) ColumnFamilyDescriptor(org.apache.hadoop.hbase.client.ColumnFamilyDescriptor) Before(org.junit.Before)

Example 70 with HBaseTestingUtil

use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.

the class TestAccessControlFilter method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() throws Exception {
    TEST_UTIL = new HBaseTestingUtil();
    Configuration conf = TEST_UTIL.getConfiguration();
    // Up the handlers; this test needs more than usual.
    conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10);
    enableSecurity(conf);
    verifyConfiguration(conf);
    // We expect 0.98 scanning semantics
    conf.setBoolean(AccessControlConstants.CF_ATTRIBUTE_EARLY_OUT, false);
    TEST_UTIL.startMiniCluster();
    TEST_UTIL.waitTableEnabled(PermissionStorage.ACL_TABLE_NAME.getName(), 50000);
    READER = User.createUserForTesting(conf, "reader", new String[0]);
    LIMITED = User.createUserForTesting(conf, "limited", new String[0]);
    DENIED = User.createUserForTesting(conf, "denied", new String[0]);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) BeforeClass(org.junit.BeforeClass)

Aggregations

HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)144 Configuration (org.apache.hadoop.conf.Configuration)42 Test (org.junit.Test)42 Before (org.junit.Before)41 BeforeClass (org.junit.BeforeClass)37 Path (org.apache.hadoop.fs.Path)24 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)22 Admin (org.apache.hadoop.hbase.client.Admin)22 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)15 StartTestingClusterOption (org.apache.hadoop.hbase.StartTestingClusterOption)14 FileSystem (org.apache.hadoop.fs.FileSystem)13 MiniZooKeeperCluster (org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster)12 TableName (org.apache.hadoop.hbase.TableName)10 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)10 SingleProcessHBaseCluster (org.apache.hadoop.hbase.SingleProcessHBaseCluster)9 ServerName (org.apache.hadoop.hbase.ServerName)8 Table (org.apache.hadoop.hbase.client.Table)8 ZKWatcher (org.apache.hadoop.hbase.zookeeper.ZKWatcher)8 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)7