@Test(timeout = 60000)
public void testMetaSplit() throws Exception {
Instance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
Connector connector = instance.getConnector("root", new PasswordToken(secret));
TableOperations opts = connector.tableOperations();
for (int i = 1; i <= 10; i++) {
opts.create("" + i);
}
opts.merge(Constants.METADATA_TABLE_NAME, new Text("01"), new Text("02"));
assertEquals(2, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
addSplits(opts, "4 5 6 7 8".split(" "));
assertEquals(7, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
opts.merge(Constants.METADATA_TABLE_NAME, new Text("6"), new Text("9"));
assertEquals(5, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
addSplits(opts, "44 55 66 77 88".split(" "));
assertEquals(10, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
opts.merge(Constants.METADATA_TABLE_NAME, new Text("5"), new Text("7"));
assertEquals(7, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
opts.merge(Constants.METADATA_TABLE_NAME, null, null);
assertEquals(1, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
}