类org.apache.hadoop.hbase.protobuf.generated.HBaseProtos源码实例Demo

下面列出了怎么用org.apache.hadoop.hbase.protobuf.generated.HBaseProtos的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: presto-hbase-connector   文件: HBaseMetadata.java
/**
 * create snapshot
 *
 * @param snapshotName snapshot name
 * @param admin        admin
 * @param schemaName   schema name
 * @param tableName    table name
 * @throws IOException io exception
 */
public static void createSnapshot(String snapshotName,
                                  Admin admin,
                                  String schemaName,
                                  String tableName) throws IOException {
    long start = System.currentTimeMillis();
    String fullTableName;
    if (Constant.HBASE_NAMESPACE_DEFAULT.equals(schemaName)
            || "".equals(schemaName)) {
        fullTableName = tableName;
    } else {
        fullTableName = schemaName + ":" + tableName;
    }
    HBaseProtos.SnapshotDescription snapshot = HBaseProtos.SnapshotDescription.newBuilder()
            .setName(snapshotName)
            .setTable(fullTableName)
            .setType(HBaseProtos.SnapshotDescription.Type.FLUSH)
            // .setType(HBaseProtos.SnapshotDescription.Type.DISABLED)
            .build();
    admin.snapshot(snapshot);
    log.info("createSnapshot: create snapshot " + snapshotName
            + " used " + (System.currentTimeMillis() - start) + " mill seconds.");
}
 
源代码2 项目: presto-hbase-connector   文件: Utils.java
/**
 * get region infos
 *
 * @param zookeeperQuorum     zookeeper quorum
 * @param zookeeperClientPort zookeeper client port
 * @param hBaseRootDir        HBase root dir
 * @param snapshotName        snapshot name
 * @return region info list
 * @throws IOException IOException
 */
public static List<HRegionInfo> getRegionInfos(String zookeeperQuorum, String zookeeperClientPort,
                                               String hBaseRootDir, String snapshotName) throws IOException {
    try {
        Configuration conf = Utils.getHadoopConf(zookeeperQuorum, zookeeperClientPort);
        Path root = new Path(hBaseRootDir);
        FileSystem fs = FileSystem.get(conf);
        Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, root);
        HBaseProtos.SnapshotDescription snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
        SnapshotManifest manifest = SnapshotManifest.open(conf, fs, snapshotDir, snapshotDesc);
        return Utils.getRegionInfosFromManifest(manifest);
    } catch (IOException ex) {
        logger.error("get region info error: " + ex.getMessage(), ex);
        throw ex;
    }
}
 
@Test
public void testAfterSuccess() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;

    // all tables, keep unlimited
    String[] argsParam = {"localhost", ".*", "--test",
        "--" + Args.OPTION_AFTER_SUCCESS + "=" + AlertSenderTest.ALERT_SCRIPT};
    SnapshotArgs args = new SnapshotArgs(argsParam);
    Snapshot app = new Snapshot(admin, args);

    int sendCountBefore = AlertSender.getSendCount();

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    Assert.assertEquals(sendCountBefore + 1, AlertSender.getSendCount());
}
 
源代码4 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExclude() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName, "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
}
 
源代码5 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码6 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExcludeRegexList() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");
    createAdditionalTable(tableName + "21");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName2 + ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName, snapshotDescriptions.get(0).getTable());
}
 
源代码7 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码8 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testNamespace() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;
    String fullTableName = null;

    try {
        // create table with namespace
        fullTableName = TEST_NAMESPACE + ":" + TestBase.tableName;
        createTable(fullTableName);

        // table with namespace
        argsParam = new String[]{"localhost", fullTableName};
        args = new SnapshotArgs(argsParam);
        app = new Snapshot(admin, args);

        // create snapshot
        app.run();
        snapshotDescriptions = admin.listSnapshots(app.getPrefix(fullTableName) + ".*");
        assertEquals(1, snapshotDescriptions.size());
    } finally {
        dropTable(fullTableName);
    }
}
 
@Test
public void testAfterSuccess() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;

    // all tables, keep unlimited
    String[] argsParam = {"localhost", ".*", "--test",
        "--" + Args.OPTION_AFTER_SUCCESS + "=" + AlertSenderTest.ALERT_SCRIPT};
    SnapshotArgs args = new SnapshotArgs(argsParam);
    Snapshot app = new Snapshot(admin, args);

    int sendCountBefore = AlertSender.getSendCount();

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    Assert.assertEquals(sendCountBefore + 1, AlertSender.getSendCount());
}
 
源代码10 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExclude() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName, "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
}
 
源代码11 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码12 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExcludeRegexList() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");
    createAdditionalTable(tableName + "21");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName2 + ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName, snapshotDescriptions.get(0).getTable());
}
 
源代码13 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码14 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testNamespace() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;
    String fullTableName = null;

    try {
        // create table with namespace
        fullTableName = TEST_NAMESPACE + ":" + TestBase.tableName;
        createTable(fullTableName);

        // table with namespace
        argsParam = new String[]{"localhost", fullTableName};
        args = new SnapshotArgs(argsParam);
        app = new Snapshot(admin, args);

        // create snapshot
        app.run();
        snapshotDescriptions = admin.listSnapshots(app.getPrefix(fullTableName) + ".*");
        assertEquals(1, snapshotDescriptions.size());
    } finally {
        dropTable(fullTableName);
    }
}
 
@Test
public void testAfterSuccess() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;

    // all tables, keep unlimited
    String[] argsParam = {"localhost", ".*", "--test",
        "--" + Args.OPTION_AFTER_SUCCESS + "=" + AlertSenderTest.ALERT_SCRIPT};
    SnapshotArgs args = new SnapshotArgs(argsParam);
    Snapshot app = new Snapshot(admin, args);

    int sendCountBefore = AlertSender.getSendCount();

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    Assert.assertEquals(sendCountBefore + 1, AlertSender.getSendCount());
}
 
源代码16 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExclude() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName, "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
}
 
源代码17 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码18 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testExcludeRegexList() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");
    createAdditionalTable(tableName + "21");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName2 + ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(tableName, snapshotDescriptions.get(0).getTable());
}
 
源代码19 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
源代码20 项目: hbase-tools   文件: SnapshotTest.java
@Test
public void testNamespace() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;
    String fullTableName = null;

    try {
        // create table with namespace
        fullTableName = TEST_NAMESPACE + ":" + TestBase.tableName;
        createTable(fullTableName);

        // table with namespace
        argsParam = new String[]{"localhost", fullTableName};
        args = new SnapshotArgs(argsParam);
        app = new Snapshot(admin, args);

        // create snapshot
        app.run();
        snapshotDescriptions = admin.listSnapshots(app.getPrefix(fullTableName) + ".*");
        assertEquals(1, snapshotDescriptions.size());
    } finally {
        dropTable(fullTableName);
    }
}
 
源代码21 项目: hbase-tools   文件: SnapshotArgs.java
public HBaseProtos.SnapshotDescription.Type flushType(String tableName) {
    if (tableFlushMap.get(tableName) == null) {
        return SnapshotAdapter.getType(optionSet);
    } else {
        return SnapshotAdapter.getType(tableName, tableFlushMap);
    }
}
 
源代码22 项目: hbase-tools   文件: SnapshotAdapter.java
public static HBaseProtos.SnapshotDescription.Type getType(String tableName, Map<String, Boolean> tableFlushMap) {
    if (tableFlushMap.get(tableName)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}
 
源代码23 项目: hbase-tools   文件: SnapshotAdapter.java
public static HBaseProtos.SnapshotDescription.Type getType(OptionSet optionSet) {
    if (optionSet.has(Args.OPTION_SKIP_FLUSH)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}
 
源代码24 项目: hbase-tools   文件: TestBase.java
protected void deleteSnapshots(String tableName) throws Exception {
    for (HBaseProtos.SnapshotDescription snapshotDescription : admin.listSnapshots(".*" + tableName + ".*")) {
        if (snapshotDescription.getTable().equals(tableName) || snapshotDescription.getTable().equals(TEST_NAMESPACE + ":" + tableName)) {
            admin.deleteSnapshots(snapshotDescription.getName());
        }
    }
}
 
源代码25 项目: hbase-tools   文件: SnapshotArgs.java
public HBaseProtos.SnapshotDescription.Type flushType(String tableName) {
    if (tableFlushMap.get(tableName) == null) {
        return SnapshotAdapter.getType(optionSet);
    } else {
        return SnapshotAdapter.getType(tableName, tableFlushMap);
    }
}
 
源代码26 项目: hbase-tools   文件: SnapshotTableArgTest.java
@Test
public void testRegexList() throws Exception {
    // create tables
    String tableName2 = createAdditionalTable(tableName + "2");
    String tableName3 = createAdditionalTable(tableName + "3");

    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;

    // all tables, keep unlimited
    String[] argsParam = {"localhost", tableName + ".*," + tableName2 + ".*," + tableName3 + ".*"};
    SnapshotArgs args = new SnapshotArgs(argsParam);
    Snapshot app = new Snapshot(admin, args);

    // create snapshot 1
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(3, snapshotDescriptions.size());

    // create snapshot 2
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(6, snapshotDescriptions.size());

    // create snapshot 3
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(9, snapshotDescriptions.size());

    // create snapshot 3
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(12, snapshotDescriptions.size());
}
 
源代码27 项目: hbase-tools   文件: SnapshotTableArgTest.java
@Test
public void testList() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", tableName + "," + tableName2};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(2, snapshotDescriptions.size());

    // with table list contains blank
    argsParam = new String[]{"localhost", tableName + " , " + tableName2};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(4, snapshotDescriptions.size());
}
 
源代码28 项目: hbase-tools   文件: SnapshotTableArgTest.java
@Test
public void testDetailList() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", tableName + "/1/true," + tableName2 + "/2/false"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot 1
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(2, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
    assertEquals(tableName, snapshotDescriptions.get(1).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(1).getType());

    // create snapshot 2
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(3, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
    assertEquals(tableName2, snapshotDescriptions.get(1).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(1).getType());
    assertEquals(tableName, snapshotDescriptions.get(2).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(2).getType());
}
 
源代码29 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testSkipFlush() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // skip flush
    argsParam = new String[]{"localhost", ".*", "--skip-flush=true", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
    assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(0).getType());

    // do not skip flush
    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(2, snapshotDescriptions.size());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(1).getType());
}
 
源代码30 项目: hbase-tools   文件: SnapshotOptionTest.java
@Test
public void testOverride() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // create table
    String tableName2 = createAdditionalTable(tableName + "2");

    // with table list
    argsParam = new String[]{"localhost", ".*", "--override=" + tableName + "/1/true", "--keep=2", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot 1
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(2, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
    assertEquals(tableName, snapshotDescriptions.get(1).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(1).getType());

    // create snapshot 2
    Thread.sleep(1000);
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(3, snapshotDescriptions.size());
    assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
    assertEquals(tableName2, snapshotDescriptions.get(1).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(1).getType());
    assertEquals(tableName, snapshotDescriptions.get(2).getTable());
    assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(2).getType());
}
 
 类所在包
 同包方法