MC implements Command { public MC(HBaseAdmin admin, Args args) { if (args.getOptionSet().nonOptionArguments().size() != 2) { throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); } this.admin = admin; this.args = args; } MC(HBaseAdmin admin, Args args); @SuppressWarnings("unused") static String usage(); @Override void run();  }
@Test public void testMC() throws Exception { ArrayList<ServerName> serverNameList = getServerNameList(); assertTrue(serverNameList.size() >= 2); ArrayList<HRegionInfo> regionInfoList = getRegionInfoList(tableName); assertEquals(1, regionInfoList.size()); HRegionInfo regionInfo = regionInfoList.get(0); ServerName serverName = serverNameList.get(0); move(regionInfo, serverName); putData(table, "a".getBytes()); admin.flush(tableName); putData(table, "b".getBytes()); admin.flush(tableName); Thread.sleep(3000); assertEquals(2, getRegionLoad(regionInfo, serverName).getStorefiles()); String[] argsParam = {"zookeeper", tableName, "--force-proceed", "--wait", "--test"}; Args args = new ManagerArgs(argsParam); MC command = new MC(admin, args); command.run(); assertRegionName(command); assertEquals(1, getRegionLoad(regionInfo, serverName).getStorefiles()); }