MiniHBaseCluster defaultCluster = htu.startMiniCluster(); assertNotEquals(HConstants.DEFAULT_MASTER_INFOPORT, defaultCluster.getConfiguration().getInt(HConstants.MASTER_INFO_PORT, 0)); assertNotEquals(HConstants.DEFAULT_REGIONSERVER_INFOPORT, defaultCluster.getConfiguration().getInt(HConstants.REGIONSERVER_INFO_PORT, 0)); } finally { htu.shutdownMiniCluster(); MiniHBaseCluster customCluster = htu.startMiniCluster(); assertEquals(nonDefaultMasterInfoPort, customCluster.getConfiguration().getInt(HConstants.MASTER_INFO_PORT, 0)); assertEquals(nonDefaultRegionServerPort, customCluster.getConfiguration().getInt(HConstants.REGIONSERVER_INFO_PORT, 0)); } finally { htu.shutdownMiniCluster();
@Test public void testEnableRSGroup() throws IOException, InterruptedException { TEST_UTIL.getMiniHBaseCluster().stopMaster(0); TEST_UTIL.getMiniHBaseCluster().waitOnMaster(0); LOG.info("stopped master..."); final Configuration conf = TEST_UTIL.getMiniHBaseCluster().getConfiguration(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, RSGroupAdminEndpoint.class.getName()); conf.set(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, RSGroupBasedLoadBalancer.class.getName()); TEST_UTIL.getMiniHBaseCluster().startMaster(); TEST_UTIL.getMiniHBaseCluster().waitForActiveAndReadyMaster(60000); LOG.info("started master..."); // check if master started successfully assertTrue(TEST_UTIL.getMiniHBaseCluster().getMaster() != null); // wait RSGroupBasedLoadBalancer online RSGroupBasedLoadBalancer loadBalancer = (RSGroupBasedLoadBalancer) TEST_UTIL.getMiniHBaseCluster().getMaster().getLoadBalancer(); long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start <= 60000 && !loadBalancer.isOnline()) { LOG.info("waiting for rsgroup load balancer onLine..."); sleep(200); } assertTrue(loadBalancer.isOnline()); }
Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception {
Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception {
conf = hbm.getConfiguration();
Configuration conf = cluster.getConfiguration(); HBaseFsck.debugLsr(conf, new Path("/")); Path rootDir = FSUtils.getRootDir(conf);
@Test public void testRebuildIndexConnectionProperties() throws Exception { try (PhoenixConnection rebuildIndexConnection = MetaDataRegionObserver.getRebuildIndexConnection(hbaseTestUtil.getMiniHBaseCluster().getConfiguration())) { try (PhoenixConnection regularConnection = DriverManager.getConnection(url).unwrap(PhoenixConnection.class)) {
@Override protected void additionalConf() throws Exception { cluster.getConfiguration().set(HFileSink.HBASE_USER, User.getCurrent().getName()); cluster.getConfiguration().set(HFileSink.HDFS_USER, User.getCurrent().getName()); }
MiniHBaseCluster defaultCluster = htu.startMiniCluster(); assertNotEquals(HConstants.DEFAULT_MASTER_INFOPORT, defaultCluster.getConfiguration().getInt(HConstants.MASTER_INFO_PORT, 0)); assertNotEquals(HConstants.DEFAULT_REGIONSERVER_INFOPORT, defaultCluster.getConfiguration().getInt(HConstants.REGIONSERVER_INFO_PORT, 0)); } finally { htu.shutdownMiniCluster(); MiniHBaseCluster customCluster = htu.startMiniCluster(); assertEquals(nonDefaultMasterInfoPort, customCluster.getConfiguration().getInt(HConstants.MASTER_INFO_PORT, 0)); assertEquals(nonDefaultRegionServerPort, customCluster.getConfiguration().getInt(HConstants.REGIONSERVER_INFO_PORT, 0)); } finally { htu.shutdownMiniCluster();
@Test public void testEnableRSGroup() throws IOException, InterruptedException { TEST_UTIL.getMiniHBaseCluster().stopMaster(0); TEST_UTIL.getMiniHBaseCluster().waitOnMaster(0); LOG.info("stopped master..."); final Configuration conf = TEST_UTIL.getMiniHBaseCluster().getConfiguration(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, RSGroupAdminEndpoint.class.getName()); conf.set(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, RSGroupBasedLoadBalancer.class.getName()); TEST_UTIL.getMiniHBaseCluster().startMaster(); TEST_UTIL.getMiniHBaseCluster().waitForActiveAndReadyMaster(60000); LOG.info("started master..."); // check if master started successfully assertTrue(TEST_UTIL.getMiniHBaseCluster().getMaster() != null); // wait RSGroupBasedLoadBalancer online RSGroupBasedLoadBalancer loadBalancer = (RSGroupBasedLoadBalancer) TEST_UTIL.getMiniHBaseCluster().getMaster().getLoadBalancer(); long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start <= 60000 && !loadBalancer.isOnline()) { LOG.info("waiting for rsgroup load balancer onLine..."); sleep(200); } assertTrue(loadBalancer.isOnline()); }
@Test public void testWrite() throws IOException { List<String> data = Arrays.asList("a", "b", "bbb", "bbbb", "c", "xy"); List<String> inputs = data.stream() .sorted(Comparator.reverseOrder()) .collect(Collectors.toList()); File tmp = folder.newFolder(); tmp.deleteOnExit(); ListDataSource<String> source = ListDataSource.unbounded(inputs); Dataset<String> input = flow.createInput(source); MapElements.of(input) .using(HBaseTestCase::kv) .output() .persist(traceLoading(HFileSink.newBuilder() .withTable(table.getNameAsString()) .withConfiguration(cluster.getConfiguration()) .withOutputPath(new Path("file://" + tmp.getPath())) .windowBy(GlobalWindowing.get(), w -> "global") .build())); new LocalExecutor().submit(flow).join(); // we should not have success marker assertFalse(new File(tmp, "_SUCCESS").exists()); assertEquals(Collections.singletonList("file:" + tmp.getPath() + "/global"), loadedPaths); // validate that the bulk load directory was deleted assertFalse(new File(tmp + "/global", "t").exists()); // validate that the data have been written to hbase data.forEach(s -> assertArrayEquals(b(s), get(s))); }
@Before @Override public void setUp() throws Exception { super.setUp(); sink = HBaseSink.newBuilder() .withConfiguration(cluster.getConfiguration()) .withTable("test") .build(); flow = Flow.create(); }
@Before public void setUp() throws Exception { final HBaseTestingUtility utility = new HBaseTestingUtility(); cluster = utility.startMiniCluster(); additionalConf(); conn = ConnectionFactory.createConnection(cluster.getConfiguration()); TableName table = createTable(); client = conn.getTable(table); } protected void additionalConf() throws Exception {
Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception {
@Before @Override public void setUp() throws Exception { super.setUp(); source = HBaseSource.newBuilder().addFamily("t") .withConfiguration(cluster.getConfiguration()) .withTable("test") .build(); flow = Flow.create(); }
Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception {
conf = hbm.getConfiguration();
Configuration conf = cluster.getConfiguration(); HBaseFsck.debugLsr(conf, new Path("/")); Path rootDir = FSUtils.getRootDir(conf);