@Before public void setup() throws Exception { TEST_UTIL = new HBaseTestingUtility(); TEST_UTIL.getConfiguration().setBoolean(HBASE_SPLIT_WAL_COORDINATED_BY_ZK, false); TEST_UTIL.getConfiguration().setInt(HBASE_SPLIT_WAL_MAX_SPLITTER, 1); TEST_UTIL.startMiniCluster(3); master = TEST_UTIL.getHBaseCluster().getMaster(); splitWALManager = master.getSplitWALManager(); TABLE_NAME = TableName.valueOf(Bytes.toBytes("TestSplitWALProcedure")); FAMILY = Bytes.toBytes("test"); }
@Test public void testMiniClusterBindToWildcard() throws Exception { HBaseTestingUtility hbt = new HBaseTestingUtility(); hbt.getConfiguration().set("hbase.regionserver.ipc.address", "0.0.0.0"); MiniHBaseCluster cluster = hbt.startMiniCluster(); try { assertEquals(1, cluster.getLiveRegionServerThreads().size()); } finally { hbt.shutdownMiniCluster(); } }
@Before public void setUp() throws Exception { DELAY_GET = 0; DELAY_SCAN = 0; DELAY_MUTATE = 0; table = TESTING_UTIL.createTable(TableName.valueOf(name.getMethodName()), FAMILY); Put put = new Put(ROW); put.addColumn(FAMILY, QUALIFIER, VALUE); table.put(put); }
@BeforeClass public static void setUp() throws Exception { UTIL.getConfiguration().setClass(HConstants.MASTER_IMPL, HMasterForTest.class, HMaster.class); UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 1000); UTIL.startMiniCluster(3); UTIL.getAdmin().balancerSwitch(false, true); UTIL.createTable(NAME, CF); UTIL.waitTableAvailable(NAME); }
@Before public void setUp() throws Exception { htu = new HBaseTestingUtility(); htu.getConfiguration().setInt("dfs.blocksize", 1024);// For the test with multiple blocks htu.getConfiguration().setInt("dfs.replication", 3); htu.startMiniDFSCluster(3, new String[]{"/r1", "/r2", "/r3"}, new String[]{host1, host2, host3}); conf = htu.getConfiguration(); cluster = htu.getDFSCluster(); dfs = (DistributedFileSystem) FileSystem.get(conf); }
@Before public void setup() throws Exception { TEST_UTIL.getConfiguration().setInt("hbase.regionserver.logroll.period", logRollPeriod); TEST_UTIL.startMiniCluster(1); TableName name = TableName.valueOf("Test"); TEST_UTIL.createTable(name, Bytes.toBytes("cf")); TEST_UTIL.waitTableAvailable(name); }
@Test public void testAccessingUnknownTables() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.setBoolean(HConstants.USE_META_REPLICAS, true); Table table = TEST_UTIL.getConnection().getTable(TableName.valueOf(name.getMethodName())); Get get = new Get(Bytes.toBytes("foo")); try { table.get(get); } catch (TableNotFoundException t) { return; } fail("Expected TableNotFoundException"); }
@Override protected Table createTable(byte[] fam) throws IOException { TableName tableName = TableName.valueOf(testName.getMethodName()); TEST_UTIL.getAdmin().createTable(TableDescriptorBuilder.newBuilder(tableName) .setColumnFamily(ColumnFamilyDescriptorBuilder.of(fam)).build()); return TEST_UTIL.getConnection().getTable(tableName); }
@Before public void setup() throws IOException { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); dir = TEST_UTIL.getDataTestDir("TestHRegion").toString(); method = name.getMethodName(); tableName = TableName.valueOf(method); CONF.set(CompactingMemStore.IN_MEMORY_FLUSH_THRESHOLD_FACTOR_KEY, String.valueOf(0.09)); }
@Before public void setUp() { hbtu = new HBaseTestingUtility(); tableName = TableName.valueOf("Table-" + testName.getMethodName()); hbtu.getConfiguration().set( FlushThroughputControllerFactory.HBASE_FLUSH_THROUGHPUT_CONTROLLER_KEY, PressureAwareFlushThroughputController.class.getName()); }
@BeforeClass public static void beforeClass() throws Exception { UTIL.getConfiguration().set("hbase.client.retries.number", "3"); UTIL.startMiniCluster(); Admin admin = UTIL.getAdmin(); HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(tableAname)); for (HColumnDescriptor family : families) { tableDescriptor.addFamily(family); } admin.createTable(tableDescriptor); admin.close(); }
@After public void tearDown() throws Exception { Admin admin = TEST_UTIL.getAdmin(); for (String table : new String[] {TABLE1, TABLE2}) { TableName t = TableName.valueOf(table); if (admin.tableExists(t)) { admin.disableTable(t); admin.deleteTable(t); } } conf.set("hbase.rest.readonly", "false"); }
@BeforeClass public static void setUp() throws Exception { TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, SCANNER_LEASE_TIMEOUT_PERIOD_MS); TEST_UTIL.startMiniCluster(1); TEST_UTIL.createTable(TABLE_NAME, FAMILY); CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get(); TABLE = CONN.getTable(TABLE_NAME); TABLE.putAll(IntStream.range(0, 10).mapToObj( i -> new Put(Bytes.toBytes(String.format("%02d", i))).addColumn(FAMILY, CQ, Bytes.toBytes(i))) .collect(Collectors.toList())).get(); }
@Test public void testFlush() throws IOException { byte[] row = Bytes.toBytes("row"); byte[] cf = Bytes.toBytes("cf"); byte[] cq = Bytes.toBytes("cq"); byte[] value = Bytes.toBytes("value"); TableName name = TableName.valueOf(getClass().getSimpleName()); Table t = util.createTable(name, cf); t.put(new Put(row).addColumn(cf, cq, value)); util.getAdmin().flush(name); assertArrayEquals(value, t.get(new Get(row)).getValue(cf, cq)); } }
private void setUp(boolean useBucketCache) throws IOException { test_util = HBaseTestingUtility.createLocalHTU(); conf = test_util.getConfiguration(); if (useBucketCache) { conf.setInt("hbase.bucketcache.size", 400); conf.setStrings(HConstants.BUCKET_CACHE_IOENGINE_KEY, "offheap"); conf.setInt("hbase.bucketcache.writer.threads", 10); conf.setFloat("hfile.block.cache.size", 0.2f); conf.setFloat("hbase.regionserver.global.memstore.size", 0.1f); } tableName = TableName.valueOf(name.getMethodName()); }
@BeforeClass public static void setUp() throws Exception { UTIL.startMiniCluster(1); try (Table table = UTIL.createTable(TABLE_NAME, CF)) { for (int i = 0; i < COUNT; i++) { table.put(new Put(Bytes.toBytes(i)).addColumn(CF, CQ, Bytes.toBytes(i))); } } HRI = UTIL.getAdmin().getTableRegions(TABLE_NAME).get(0); STUB = ((ConnectionImplementation) UTIL.getConnection()) .getClient(UTIL.getHBaseCluster().getRegionServer(0).getServerName()); }
private void toggleQuotaCheckAndRestartMiniCluster(boolean enable) throws Exception { TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, enable); TEST_UTIL.startMiniCluster(NUM_SLAVES_BASE - 1); TEST_UTIL.getConfiguration().setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, NUM_SLAVES_BASE - 1); TEST_UTIL.getConfiguration().setBoolean(SnapshotManager.HBASE_SNAPSHOT_ENABLED, true); initialize(); } }
@BeforeClass public static void setUp() throws Exception { UTIL.startMiniCluster(3); // Create 3 rows in the table, with rowkeys starting with "zzz*" so that // scan are forced to hit all the regions. try (Table table = UTIL.createMultiRegionTable(TABLE_NAME, CF)) { table.put(Arrays.asList(new Put(Bytes.toBytes("zzz1")).addColumn(CF, CQ, VALUE), new Put(Bytes.toBytes("zzz2")).addColumn(CF, CQ, VALUE), new Put(Bytes.toBytes("zzz3")).addColumn(CF, CQ, VALUE))); } CONN = ConnectionFactory.createAsyncConnection(UTIL.getConfiguration()).get(); NUM_REGIONS = UTIL.getHBaseCluster().getRegions(TABLE_NAME).size(); }
@BeforeClass public static void setUp() throws Exception { UTIL.startMiniCluster(1); try (Table table = UTIL.createTable(TABLE_NAME, FAMILY)) { for (int i = 0; i < ROW_COUNT; i++) { Put put = new Put(Bytes.toBytes(i)); for (int j = 0; j < CQS.length; j++) { put.addColumn(FAMILY, CQS[j], Bytes.toBytes((j + 1) * i)); } table.put(put); } } }