hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [03/10] hbase git commit: HBASE-19407 [branch-2] Remove backup/restore
Date Sat, 02 Dec 2017 01:22:46 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupCommandLineTool.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupCommandLineTool.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupCommandLineTool.java
deleted file mode 100644
index c9fc84f..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupCommandLineTool.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestBackupCommandLineTool {
-
-  private final static String USAGE_DESCRIBE = "Usage: hbase backup describe <backup_id>";
-  private final static String USAGE_CREATE = "Usage: hbase backup create";
-  private final static String USAGE_HISTORY = "Usage: hbase backup history";
-  private final static String USAGE_BACKUP = "Usage: hbase backup";
-  private final static String USAGE_DELETE = "Usage: hbase backup delete";
-  private final static String USAGE_PROGRESS = "Usage: hbase backup progress";
-  private final static String USAGE_SET = "Usage: hbase backup set";
-  private final static String USAGE_RESTORE = "Usage: hbase restore";
-
-  Configuration conf;
-
-  @Before
-  public void setUpBefore() throws Exception {
-    conf = HBaseConfiguration.create();
-    conf.setBoolean(BackupRestoreConstants.BACKUP_ENABLE_KEY, true);
-  }
-
-  @Test
-  public void testBackupDriverDescribeHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "describe", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DESCRIBE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "describe", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DESCRIBE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "describe" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DESCRIBE) >= 0);
-  }
-
-
-  @Test
-  public void testBackupDriverCreateTopLevelBackupDest() throws Exception {
-    String[] args = new String[] { "create", "full", "hdfs://localhost:1020", "-t", "t1" };
-    int result = ToolRunner.run(conf, new BackupDriver(), args);
-    // FAILED
-    assertEquals(1, result);
-  }
-
-  @Test
-  public void testBackupDriverCreateHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "create", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-    assertTrue(output.indexOf(BackupRestoreConstants.OPTION_TABLE_LIST_DESC) > 0);
-
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "create", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-    assertTrue(output.indexOf(BackupRestoreConstants.OPTION_TABLE_LIST_DESC) > 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "create" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-    assertTrue(output.indexOf(BackupRestoreConstants.OPTION_TABLE_LIST_DESC) > 0);
-
-  }
-
-  @Test
-  public void testBackupDriverHistoryHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "history", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_HISTORY) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "history", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_HISTORY) >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverDeleteHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "delete", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DELETE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "delete", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DELETE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "delete" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DELETE) >= 0);
-  }
-
-  @Test
-  public void testBackupDriverProgressHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "progress", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_PROGRESS) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "progress", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_PROGRESS) >= 0);
-  }
-
-  @Test
-  public void testBackupDriverSetHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "set", "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_SET) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "set", "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_SET) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "set" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_SET) >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "-help" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "-h" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-  }
-
-  @Test
-  public void testRestoreDriverHelp() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "-help" };
-    ToolRunner.run(conf, new RestoreDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_RESTORE) >= 0);
-    assertTrue(output.indexOf(BackupRestoreConstants.OPTION_TABLE_LIST_DESC) > 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "-h" };
-    ToolRunner.run(conf, new RestoreDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_RESTORE) >= 0);
-    assertTrue(output.indexOf(BackupRestoreConstants.OPTION_TABLE_LIST_DESC) > 0);
-
-  }
-
-  @Test
-  public void testBackupDriverUnrecognizedCommand() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "command" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "command" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-  }
-
-  @Test
-  public void testBackupDriverUnrecognizedOption() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "create", "-xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "describe", "-xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "history", "-xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "delete", "-xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "set", "-xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_BACKUP) >= 0);
-  }
-
-  @Test
-  public void testRestoreDriverUnrecognizedOption() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "-xx" };
-    ToolRunner.run(conf, new RestoreDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_RESTORE) >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverCreateWrongArgNumber() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "create" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "create", "22" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    args = new String[] { "create", "22", "22", "22", "22", "22" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_CREATE) >= 0);
-  }
-
-  @Test
-  public void testBackupDriverDeleteWrongArgNumber() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "delete" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_DELETE) >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverHistoryWrongArgs() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "history", "-n", "xx" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf(USAGE_HISTORY) >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverWrongBackupDestination() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "create", "full", "clicks" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf("ERROR: invalid backup destination") >= 0);
-
-  }
-
-  @Test
-  public void testBackupDriverBackupSetAndList() throws Exception {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-    String[] args = new String[] { "create", "full", "file:/localhost", "-t", "clicks", "-s", "s" };
-    ToolRunner.run(conf, new BackupDriver(), args);
-
-    String output = baos.toString();
-    System.out.println(baos.toString());
-    assertTrue(output.indexOf("ERROR: You can specify either backup set or list") >= 0);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java
deleted file mode 100644
index ebfc735..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category(LargeTests.class)
-public class TestBackupDelete extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupDelete.class);
-
-  /**
-   * Verify that full backup is created on a single table with data correctly. Verify that history
-   * works as expected
-   * @throws Exception
-   */
-  @Test
-  public void testBackupDelete() throws Exception {
-    LOG.info("test backup delete on a single table with data");
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    assertTrue(checkSucceeded(backupId));
-    LOG.info("backup complete");
-    String[] backupIds = new String[] { backupId };
-    BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection());
-    BackupInfo info = table.readBackupInfo(backupId);
-    Path path = new Path(info.getBackupRootDir(), backupId);
-    FileSystem fs = FileSystem.get(path.toUri(), conf1);
-    assertTrue(fs.exists(path));
-    int deleted = getBackupAdmin().deleteBackups(backupIds);
-
-    assertTrue(!fs.exists(path));
-    assertTrue(fs.exists(new Path(info.getBackupRootDir())));
-    assertTrue(1 == deleted);
-    table.close();
-    LOG.info("delete_backup");
-  }
-
-  /**
-   * Verify that full backup is created on a single table with data correctly. Verify that history
-   * works as expected
-   * @throws Exception
-   */
-  @Test
-  public void testBackupDeleteCommand() throws Exception {
-    LOG.info("test backup delete on a single table with data: command-line");
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    assertTrue(checkSucceeded(backupId));
-    LOG.info("backup complete");
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-
-    String[] args = new String[] { "delete", backupId };
-    // Run backup
-
-    try {
-      int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-      assertTrue(ret == 0);
-    } catch (Exception e) {
-      LOG.error("failed", e);
-    }
-    LOG.info("delete_backup");
-    String output = baos.toString();
-    LOG.info(baos.toString());
-    assertTrue(output.indexOf("Deleted 1 backups") >= 0);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java
deleted file mode 100644
index 85fba4b..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
- * law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
- * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.util.BackupUtils;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category(MediumTests.class)
-public class TestBackupDeleteRestore extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupDeleteRestore.class);
-
-  /**
-   * Verify that load data- backup - delete some data - restore works as expected - deleted data get
-   * restored.
-   * @throws Exception
-   */
-  @Test
-  public void testBackupDeleteRestore() throws Exception {
-
-    LOG.info("test full restore on a single table empty table");
-
-    List<TableName> tables = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tables);
-    assertTrue(checkSucceeded(backupId));
-    LOG.info("backup complete");
-    int numRows = TEST_UTIL.countRows(table1);
-    HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
-    // delete row
-    try (Table table = TEST_UTIL.getConnection().getTable(table1);) {
-      Delete delete = new Delete("row0".getBytes());
-      table.delete(delete);
-      hba.flush(table1);
-    }
-
-    TableName[] tableset = new TableName[] { table1 };
-    TableName[] tablemap = null;// new TableName[] { table1_restore };
-    BackupAdmin client = getBackupAdmin();
-    client.restore(BackupUtils.createRestoreRequest(BACKUP_ROOT_DIR, backupId, false,
-      tableset, tablemap, true));
-
-    int numRowsAfterRestore = TEST_UTIL.countRows(table1);
-    assertEquals(numRows, numRowsAfterRestore);
-    hba.close();
-  }
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
deleted file mode 100644
index af8e907..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.SnapshotDescription;
-import org.apache.hadoop.hbase.client.TableDescriptor;
-import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
-import org.apache.hadoop.hbase.coprocessor.MasterCoprocessor;
-import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.MasterObserver;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/**
- * This class is only a base for other integration-level backup tests. Do not add tests here.
- * TestBackupSmallTests is where tests that don't require bring machines up/down should go All other
- * tests should have their own classes and extend this one
- */
-@Category(LargeTests.class)
-public class TestBackupDeleteWithFailures extends TestBackupBase{
-
-  private static final Log LOG = LogFactory.getLog(TestBackupDeleteWithFailures.class);
-
-
-
-  public static enum Failure {
-    NO_FAILURES,
-    PRE_SNAPSHOT_FAILURE,
-    PRE_DELETE_SNAPSHOT_FAILURE,
-    POST_DELETE_SNAPSHOT_FAILURE
-  }
-
-  public static class MasterSnapshotObserver implements MasterCoprocessor, MasterObserver {
-    List<Failure> failures = new ArrayList<Failure>();
-
-    public void setFailures(Failure ... f) {
-      failures.clear();
-      for (int i = 0; i < f.length; i++) {
-        failures.add(f[i]);
-      }
-    }
-
-    @Override
-    public Optional<MasterObserver> getMasterObserver() {
-      return Optional.of(this);
-    }
-
-    @Override
-    public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
-        final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
-        throws IOException
-    {
-       if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) {
-         throw new IOException ("preSnapshot");
-       }
-    }
-
-    @Override
-    public void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
-        SnapshotDescription snapshot) throws IOException {
-      if (failures.contains(Failure.PRE_DELETE_SNAPSHOT_FAILURE)) {
-        throw new IOException ("preDeleteSnapshot");
-      }
-    }
-
-    @Override
-    public void postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
-        SnapshotDescription snapshot) throws IOException {
-      if (failures.contains(Failure.POST_DELETE_SNAPSHOT_FAILURE)) {
-        throw new IOException ("postDeleteSnapshot");
-      }
-    }
-
-  }
-
-  /**
-   * @throws java.lang.Exception
-   */
-  @Override
-  @Before
-  public void setUp() throws Exception {
-    conf1.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
-      MasterSnapshotObserver.class.getName());
-    conf1.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
-    super.setUp();
-  }
-
-
-  private MasterSnapshotObserver getMasterSnapshotObserver() {
-    return TEST_UTIL.getHBaseCluster().getMaster().getMasterCoprocessorHost()
-        .findCoprocessor(MasterSnapshotObserver.class);
-  }
-
-  @Test
-  public void testBackupDeleteWithFailures() throws Exception
-  {
-     testBackupDeleteWithFailuresAfter(1, Failure.PRE_DELETE_SNAPSHOT_FAILURE);
-     testBackupDeleteWithFailuresAfter(0, Failure.POST_DELETE_SNAPSHOT_FAILURE);
-     testBackupDeleteWithFailuresAfter(1, Failure.PRE_SNAPSHOT_FAILURE);
-  }
-
-  private void testBackupDeleteWithFailuresAfter(int expected, Failure ...failures) throws Exception {
-    LOG.info("test repair backup delete on a single table with data and failures "+ failures[0]);
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    assertTrue(checkSucceeded(backupId));
-    LOG.info("backup complete");
-    String[] backupIds = new String[] { backupId };
-    BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection());
-    BackupInfo info = table.readBackupInfo(backupId);
-    Path path = new Path(info.getBackupRootDir(), backupId);
-    FileSystem fs = FileSystem.get(path.toUri(), conf1);
-    assertTrue(fs.exists(path));
-
-    Connection conn = TEST_UTIL.getConnection();
-    Admin admin = conn.getAdmin();
-    MasterSnapshotObserver observer = getMasterSnapshotObserver();
-
-    observer.setFailures(failures);
-    try {
-      getBackupAdmin().deleteBackups(backupIds);
-    } catch(IOException e) {
-      if(expected != 1) assertTrue(false);
-    }
-
-    // Verify that history length == expected after delete failure
-    assertTrue (table.getBackupHistory().size() == expected);
-
-    String[] ids = table.getListOfBackupIdsFromDeleteOperation();
-
-    // Verify that we still have delete record in backup system table
-    if(expected == 1) {
-      assertTrue(ids.length == 1);
-      assertTrue(ids[0].equals(backupId));
-    } else {
-      assertNull(ids);
-    }
-
-    // Now run repair command to repair "failed" delete operation
-    String[] args = new String[] {"repair"};
-
-    observer.setFailures(Failure.NO_FAILURES);
-
-    // Run repair
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    // Verify that history length == 0
-    assertTrue (table.getBackupHistory().size() == 0);
-    ids = table.getListOfBackupIdsFromDeleteOperation();
-
-    // Verify that we do not have delete record in backup system table
-    assertNull(ids);
-
-    table.close();
-    admin.close();
-  }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java
deleted file mode 100644
index 0672325..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
-import org.apache.hadoop.hbase.backup.impl.BackupCommands;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category(LargeTests.class)
-public class TestBackupDescribe extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupDescribe.class);
-
-  /**
-   * Verify that describe works as expected if incorrect backup Id is supplied
-   * @throws Exception
-   */
-  @Test
-  public void testBackupDescribe() throws Exception {
-
-    LOG.info("test backup describe on a single table with data");
-
-    String[] args = new String[] { "describe", "backup_2" };
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret < 0);
-
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setErr(new PrintStream(baos));
-    args = new String[] { "progress" };
-    ToolRunner.run(TEST_UTIL.getConfiguration(), new BackupDriver(), args);
-
-    String output = baos.toString();
-    LOG.info("Output from progress: " + output);
-    assertTrue(output.indexOf(BackupCommands.NO_ACTIVE_SESSION_FOUND) >= 0);
-  }
-
-  @Test
-  public void testBackupSetCommandWithNonExistentTable() throws Exception {
-    String[] args = new String[] { "set", "add", "some_set", "table" };
-    // Run backup
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertNotEquals(ret, 0);
-  }
-
-  @Test
-  public void testBackupDescribeCommand() throws Exception {
-
-    LOG.info("test backup describe on a single table with data: command-line");
-
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-
-    LOG.info("backup complete");
-    assertTrue(checkSucceeded(backupId));
-
-    BackupInfo info = getBackupAdmin().getBackupInfo(backupId);
-    assertTrue(info.getState() == BackupState.COMPLETE);
-
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-
-    String[] args = new String[] { "describe", backupId };
-    // Run backup
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    String response = baos.toString();
-    assertTrue(response.indexOf(backupId) > 0);
-    assertTrue(response.indexOf("COMPLETE") > 0);
-
-    BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection());
-    BackupInfo status = table.readBackupInfo(backupId);
-    String desc = status.getShortDescription();
-    table.close();
-    assertTrue(response.indexOf(desc) >= 0);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java
deleted file mode 100644
index 6c1890b..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.testclassification.MasterTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category({ MasterTests.class, SmallTests.class })
-public class TestBackupHFileCleaner {
-  private static final Log LOG = LogFactory.getLog(TestBackupHFileCleaner.class);
-  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private static Configuration conf = TEST_UTIL.getConfiguration();
-  private static TableName tableName = TableName.valueOf("backup.hfile.cleaner");
-  private static String famName = "fam";
-  static FileSystem fs = null;
-  Path root;
-
-  /**
-   * @throws java.lang.Exception
-   */
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-    conf.setBoolean(BackupRestoreConstants.BACKUP_ENABLE_KEY, true);
-    TEST_UTIL.startMiniZKCluster();
-    TEST_UTIL.startMiniCluster(1);
-    fs = FileSystem.get(conf);
-  }
-
-  /**
-   * @throws java.lang.Exception
-   */
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {
-    if (fs != null) {
-      fs.close();
-    }
-    TEST_UTIL.shutdownMiniCluster();
-  }
-
-  @Before
-  public void setup() throws IOException {
-    root = TEST_UTIL.getDataTestDirOnTestFS();
-  }
-
-  @After
-  public void cleanup() {
-    try {
-      fs.delete(root, true);
-    } catch (IOException e) {
-      LOG.warn("Failed to delete files recursively from path " + root);
-    }
-  }
-
-  @Test
-  public void testGetDeletableFiles() throws IOException {
-    // 1. Create a file
-    Path file = new Path(root, "testIsFileDeletableWithNoHFileRefs");
-    fs.createNewFile(file);
-    // 2. Assert file is successfully created
-    assertTrue("Test file not created!", fs.exists(file));
-    BackupHFileCleaner cleaner = new BackupHFileCleaner();
-    cleaner.setConf(conf);
-    cleaner.setCheckForFullyBackedUpTables(false);
-    // 3. Assert that file as is should be deletable
-    List<FileStatus> stats = new ArrayList<>();
-    FileStatus stat = fs.getFileStatus(file);
-    stats.add(stat);
-    Iterable<FileStatus> deletable = cleaner.getDeletableFiles(stats);
-    deletable = cleaner.getDeletableFiles(stats);
-    boolean found = false;
-    for (FileStatus stat1 : deletable) {
-      if (stat.equals(stat1)) found = true;
-    }
-    assertTrue("Cleaner should allow to delete this file as there is no hfile reference "
-        + "for it.", found);
-
-    // 4. Add the file as bulk load
-    List<Path> list = new ArrayList<>(1);
-    list.add(file);
-    try (Connection conn = ConnectionFactory.createConnection(conf);
-        BackupSystemTable sysTbl = new BackupSystemTable(conn)) {
-      List<TableName> sTableList = new ArrayList<>();
-      sTableList.add(tableName);
-      Map<byte[], List<Path>>[] maps = new Map[1];
-      maps[0] = new HashMap<>();
-      maps[0].put(famName.getBytes(), list);
-      sysTbl.writeBulkLoadedFiles(sTableList, maps, "1");
-    }
-
-    // 5. Assert file should not be deletable
-    deletable = cleaner.getDeletableFiles(stats);
-    deletable = cleaner.getDeletableFiles(stats);
-    found = false;
-    for (FileStatus stat1 : deletable) {
-      if (stat.equals(stat1)) found = true;
-    }
-    assertFalse("Cleaner should not allow to delete this file as there is a hfile reference "
-        + "for it.", found);
-  }
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupMultipleDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupMultipleDeletes.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupMultipleDeletes.java
deleted file mode 100644
index 0944ea2..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupMultipleDeletes.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupAdminImpl;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/**
- * Create multiple backups for two tables: table1, table2 then perform 1 delete
- */
-@Category(LargeTests.class)
-public class TestBackupMultipleDeletes extends TestBackupBase {
-  private static final Log LOG = LogFactory.getLog(TestBackupMultipleDeletes.class);
-
-  @Test
-  public void testBackupMultipleDeletes() throws Exception {
-    // #1 - create full backup for all tables
-    LOG.info("create full backup image for all tables");
-    List<TableName> tables = Lists.newArrayList(table1, table2);
-    HBaseAdmin admin = null;
-    Connection conn = ConnectionFactory.createConnection(conf1);
-    admin = (HBaseAdmin) conn.getAdmin();
-    BackupAdmin client = new BackupAdminImpl(conn);
-    BackupRequest request = createBackupRequest(BackupType.FULL, tables, BACKUP_ROOT_DIR);
-    String backupIdFull = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdFull));
-    // #2 - insert some data to table table1
-    HTable t1 = (HTable) conn.getTable(table1);
-    Put p1;
-    for (int i = 0; i < NB_ROWS_IN_BATCH; i++) {
-      p1 = new Put(Bytes.toBytes("row-t1" + i));
-      p1.addColumn(famName, qualName, Bytes.toBytes("val" + i));
-      t1.put(p1);
-    }
-    Assert.assertEquals(TEST_UTIL.countRows(t1), NB_ROWS_IN_BATCH * 2);
-    t1.close();
-    // #3 - incremental backup for table1
-    tables = Lists.newArrayList(table1);
-    request = createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR);
-    String backupIdInc1 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdInc1));
-    // #4 - insert some data to table table2
-    HTable t2 = (HTable) conn.getTable(table2);
-    Put p2 = null;
-    for (int i = 0; i < NB_ROWS_IN_BATCH; i++) {
-      p2 = new Put(Bytes.toBytes("row-t2" + i));
-      p2.addColumn(famName, qualName, Bytes.toBytes("val" + i));
-      t2.put(p2);
-    }
-    // #5 - incremental backup for table1, table2
-    tables = Lists.newArrayList(table1, table2);
-    request = createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR);
-    String backupIdInc2 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdInc2));
-    // #6 - insert some data to table table1
-    t1 = (HTable) conn.getTable(table1);
-    for (int i = NB_ROWS_IN_BATCH; i < 2 * NB_ROWS_IN_BATCH; i++) {
-      p1 = new Put(Bytes.toBytes("row-t1" + i));
-      p1.addColumn(famName, qualName, Bytes.toBytes("val" + i));
-      t1.put(p1);
-    }
-    // #7 - incremental backup for table1
-    tables = Lists.newArrayList(table1);
-    request = createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR);
-    String backupIdInc3 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdInc3));
-    // #8 - insert some data to table table2
-    t2 = (HTable) conn.getTable(table2);
-    for (int i = NB_ROWS_IN_BATCH; i < 2 * NB_ROWS_IN_BATCH; i++) {
-      p2 = new Put(Bytes.toBytes("row-t1" + i));
-      p2.addColumn(famName, qualName, Bytes.toBytes("val" + i));
-      t2.put(p2);
-    }
-    // #9 - incremental backup for table1, table2
-    tables = Lists.newArrayList(table1, table2);
-    request = createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR);
-    String backupIdInc4 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdInc4));
-    // #10 full backup for table3
-    tables = Lists.newArrayList(table3);
-    request = createBackupRequest(BackupType.FULL, tables, BACKUP_ROOT_DIR);
-    String backupIdFull2 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdFull2));
-    // #11 - incremental backup for table3
-    tables = Lists.newArrayList(table3);
-    request = createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR);
-    String backupIdInc5 = client.backupTables(request);
-    assertTrue(checkSucceeded(backupIdInc5));
-    LOG.error("Delete backupIdInc2");
-    client.deleteBackups(new String[] { backupIdInc2 });
-    LOG.error("Delete backupIdInc2 done");
-    List<BackupInfo> list = client.getHistory(100);
-    // First check number of backup images before and after
-    assertEquals(4, list.size());
-    // then verify that no backupIdInc2,3,4
-    Set<String> ids = new HashSet<String>();
-    ids.add(backupIdInc2);
-    ids.add(backupIdInc3);
-    ids.add(backupIdInc4);
-    for (BackupInfo info : list) {
-      String backupId = info.getBackupId();
-      if (ids.contains(backupId)) {
-        assertTrue(false);
-      }
-    }
-    // Verify that backupInc5 contains only table3
-    boolean found = false;
-    for (BackupInfo info : list) {
-      String backupId = info.getBackupId();
-      if (backupId.equals(backupIdInc5)) {
-        assertTrue(info.getTables().size() == 1);
-        assertEquals(table3, info.getTableNames().get(0));
-        found = true;
-      }
-    }
-    assertTrue(found);
-    admin.close();
-    conn.close();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupRepair.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupRepair.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupRepair.java
deleted file mode 100644
index 4b1d84f..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupRepair.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.backup.impl.TableBackupClient;
-import org.apache.hadoop.hbase.backup.impl.TableBackupClient.Stage;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-
-@Category(LargeTests.class)
-public class TestBackupRepair extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupRepair.class);
-
-
-  @Test
-  public void testFullBackupWithFailuresAndRestore() throws Exception {
-
-    autoRestoreOnFailure = false;
-
-    conf1.set(TableBackupClient.BACKUP_CLIENT_IMPL_CLASS,
-      FullTableBackupClientForTest.class.getName());
-    int maxStage = Stage.values().length -1;
-    // Fail stage in loop between 0 and 4 inclusive
-    for (int stage = 0; stage < maxStage; stage++) {
-      LOG.info("Running stage " + stage);
-      runBackupAndFailAtStageWithRestore(stage);
-    }
-  }
-
-  public void runBackupAndFailAtStageWithRestore(int stage) throws Exception {
-
-    conf1.setInt(FullTableBackupClientForTest.BACKUP_TEST_MODE_STAGE, stage);
-    try (BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection())) {
-      int before = table.getBackupHistory().size();
-      String[] args =
-          new String[] { "create", "full", BACKUP_ROOT_DIR, "-t",
-              table1.getNameAsString() + "," + table2.getNameAsString() };
-      // Run backup
-      int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-      assertFalse(ret == 0);
-
-      // Now run restore
-      args = new String[] {"repair"};
-
-      ret  = ToolRunner.run(conf1, new BackupDriver(), args);
-      assertTrue(ret == 0);
-
-      List<BackupInfo> backups = table.getBackupHistory();
-      int after = table.getBackupHistory().size();
-
-      assertTrue(after ==  before +1);
-      for (BackupInfo data : backups) {
-        String backupId = data.getBackupId();
-        assertFalse(checkSucceeded(backupId));
-      }
-      Set<TableName> tables = table.getIncrementalBackupTableSet(BACKUP_ROOT_DIR);
-      assertTrue(tables.size() == 0);
-    }
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java
deleted file mode 100644
index 57c1533..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.util.BackupUtils;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category(LargeTests.class)
-public class TestBackupShowHistory extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupShowHistory.class);
-
-  private boolean findBackup(List<BackupInfo> history, String backupId) {
-    assertTrue(history.size() > 0);
-    boolean success = false;
-    for (BackupInfo info : history) {
-      if (info.getBackupId().equals(backupId)) {
-        success = true;
-        break;
-      }
-    }
-    return success;
-  }
-
-  /**
-   * Verify that full backup is created on a single table with data correctly. Verify that history
-   * works as expected
-   * @throws Exception
-   */
-  @Test
-  public void testBackupHistory() throws Exception {
-
-    LOG.info("test backup history on a single table with data");
-
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    assertTrue(checkSucceeded(backupId));
-    LOG.info("backup complete");
-
-    List<BackupInfo> history = getBackupAdmin().getHistory(10);
-    assertTrue(findBackup(history, backupId));
-    BackupInfo.Filter nullFilter = new BackupInfo.Filter() {
-      @Override
-      public boolean apply(BackupInfo info) {
-        return true;
-      }
-    };
-    history = BackupUtils.getHistory(conf1, 10, new Path(BACKUP_ROOT_DIR), nullFilter);
-    assertTrue(findBackup(history, backupId));
-
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-
-    String[] args = new String[] { "history", "-n", "10", "-p", BACKUP_ROOT_DIR };
-    // Run backup
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    LOG.info("show_history");
-    String output = baos.toString();
-    LOG.info(output);
-    baos.close();
-    assertTrue(output.indexOf(backupId) > 0);
-
-    tableList = Lists.newArrayList(table2);
-    String backupId2 = fullTableBackup(tableList);
-    assertTrue(checkSucceeded(backupId2));
-    LOG.info("backup complete: " + table2);
-    BackupInfo.Filter tableNameFilter = new BackupInfo.Filter() {
-      @Override
-      public boolean apply(BackupInfo image) {
-        if (table1 == null) return true;
-        List<TableName> names = image.getTableNames();
-        return names.contains(table1);
-      }
-    };
-    BackupInfo.Filter tableSetFilter = new BackupInfo.Filter() {
-      @Override
-      public boolean apply(BackupInfo info) {
-        String backupId = info.getBackupId();
-        return backupId.startsWith("backup");
-      }
-    };
-
-    history = getBackupAdmin().getHistory(10, tableNameFilter, tableSetFilter);
-    assertTrue(history.size() > 0);
-    boolean success = true;
-    for (BackupInfo info : history) {
-      if (!info.getTableNames().contains(table1)) {
-        success = false;
-        break;
-      }
-    }
-    assertTrue(success);
-
-    history =
-        BackupUtils.getHistory(conf1, 10, new Path(BACKUP_ROOT_DIR), tableNameFilter,
-          tableSetFilter);
-    assertTrue(history.size() > 0);
-    success = true;
-    for (BackupInfo info : history) {
-      if (!info.getTableNames().contains(table1)) {
-        success = false;
-        break;
-      }
-    }
-    assertTrue(success);
-
-    args =
-        new String[] { "history", "-n", "10", "-p", BACKUP_ROOT_DIR,
-          "-t", "table1", "-s", "backup" };
-    // Run backup
-    ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    LOG.info("show_history");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java
deleted file mode 100644
index 73d8d9f..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category(LargeTests.class)
-public class TestBackupStatusProgress extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestBackupStatusProgress.class);
-
-  /**
-   * Verify that full backup is created on a single table with data correctly.
-   * @throws Exception
-   */
-  @Test
-  public void testBackupStatusProgress() throws Exception {
-
-    LOG.info("test backup status/progress on a single table with data");
-
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    LOG.info("backup complete");
-    assertTrue(checkSucceeded(backupId));
-
-    BackupInfo info = getBackupAdmin().getBackupInfo(backupId);
-    assertTrue(info.getState() == BackupState.COMPLETE);
-
-    LOG.debug(info.getShortDescription());
-    assertTrue(info.getProgress() > 0);
-
-  }
-
-  @Test
-  public void testBackupStatusProgressCommand() throws Exception {
-
-    LOG.info("test backup status/progress on a single table with data: command-line");
-
-    List<TableName> tableList = Lists.newArrayList(table1);
-    String backupId = fullTableBackup(tableList);
-    LOG.info("backup complete");
-    assertTrue(checkSucceeded(backupId));
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-
-    String[] args = new String[] { "describe", backupId };
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    String responce = baos.toString();
-    assertTrue(responce.indexOf(backupId) > 0);
-    assertTrue(responce.indexOf("COMPLETE") > 0);
-
-    baos = new ByteArrayOutputStream();
-    System.setOut(new PrintStream(baos));
-
-    args = new String[] { "progress", backupId };
-    ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret == 0);
-    responce = baos.toString();
-    assertTrue(responce.indexOf(backupId) >= 0);
-    assertTrue(responce.indexOf("progress") > 0);
-    assertTrue(responce.indexOf("100") > 0);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
deleted file mode 100644
index 5814d87..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
-import org.apache.hadoop.hbase.backup.impl.BackupManager;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Test cases for backup system table API
- */
-@Category(MediumTests.class)
-public class TestBackupSystemTable {
-
-  private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
-  protected static Configuration conf = UTIL.getConfiguration();
-  protected static MiniHBaseCluster cluster;
-  protected static Connection conn;
-  protected BackupSystemTable table;
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    conf.setBoolean(BackupRestoreConstants.BACKUP_ENABLE_KEY, true);
-    BackupManager.decorateMasterConfiguration(conf);
-    BackupManager.decorateRegionServerConfiguration(conf);
-    cluster = UTIL.startMiniCluster();
-    conn = UTIL.getConnection();
-  }
-
-  @Before
-  public void before() throws IOException {
-    table = new BackupSystemTable(conn);
-  }
-
-  @After
-  public void after() {
-    if (table != null) {
-      table.close();
-    }
-
-  }
-
-  @Test
-  public void testUpdateReadDeleteBackupStatus() throws IOException {
-    BackupInfo ctx = createBackupInfo();
-    table.updateBackupInfo(ctx);
-    BackupInfo readCtx = table.readBackupInfo(ctx.getBackupId());
-    assertTrue(compare(ctx, readCtx));
-    // try fake backup id
-    readCtx = table.readBackupInfo("fake");
-    assertNull(readCtx);
-    // delete backup info
-    table.deleteBackupInfo(ctx.getBackupId());
-    readCtx = table.readBackupInfo(ctx.getBackupId());
-    assertNull(readCtx);
-    cleanBackupTable();
-  }
-
-  @Test
-  public void testWriteReadBackupStartCode() throws IOException {
-    Long code = 100L;
-    table.writeBackupStartCode(code, "root");
-    String readCode = table.readBackupStartCode("root");
-    assertEquals(code, new Long(Long.parseLong(readCode)));
-    cleanBackupTable();
-  }
-
-  private void cleanBackupTable() throws IOException {
-    Admin admin = UTIL.getHBaseAdmin();
-    admin.disableTable(BackupSystemTable.getTableName(conf));
-    admin.truncateTable(BackupSystemTable.getTableName(conf), true);
-    if (admin.isTableDisabled(BackupSystemTable.getTableName(conf))) {
-      admin.enableTable(BackupSystemTable.getTableName(conf));
-    }
-  }
-
-  @Test
-  public void testBackupHistory() throws IOException {
-    int n = 10;
-    List<BackupInfo> list = createBackupInfoList(n);
-
-    // Load data
-    for (BackupInfo bc : list) {
-      // Make sure we set right status
-      bc.setState(BackupState.COMPLETE);
-      table.updateBackupInfo(bc);
-    }
-
-    // Reverse list for comparison
-    Collections.reverse(list);
-    List<BackupInfo> history = table.getBackupHistory();
-    assertTrue(history.size() == n);
-
-    for (int i = 0; i < n; i++) {
-      BackupInfo ctx = list.get(i);
-      BackupInfo data = history.get(i);
-      assertTrue(compare(ctx, data));
-    }
-
-    cleanBackupTable();
-
-  }
-
-  @Test
-  public void testBackupDelete() throws IOException {
-
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      int n = 10;
-      List<BackupInfo> list = createBackupInfoList(n);
-
-      // Load data
-      for (BackupInfo bc : list) {
-        // Make sure we set right status
-        bc.setState(BackupState.COMPLETE);
-        table.updateBackupInfo(bc);
-      }
-
-      // Verify exists
-      for (BackupInfo bc : list) {
-        assertNotNull(table.readBackupInfo(bc.getBackupId()));
-      }
-
-      // Delete all
-      for (BackupInfo bc : list) {
-        table.deleteBackupInfo(bc.getBackupId());
-      }
-
-      // Verify do not exists
-      for (BackupInfo bc : list) {
-        assertNull(table.readBackupInfo(bc.getBackupId()));
-      }
-
-      cleanBackupTable();
-    }
-
-  }
-
-  @Test
-  public void testRegionServerLastLogRollResults() throws IOException {
-    String[] servers = new String[] { "server1", "server2", "server3" };
-    Long[] timestamps = new Long[] { 100L, 102L, 107L };
-
-    for (int i = 0; i < servers.length; i++) {
-      table.writeRegionServerLastLogRollResult(servers[i], timestamps[i], "root");
-    }
-
-    HashMap<String, Long> result = table.readRegionServerLastLogRollResult("root");
-    assertTrue(servers.length == result.size());
-    Set<String> keys = result.keySet();
-    String[] keysAsArray = new String[keys.size()];
-    keys.toArray(keysAsArray);
-    Arrays.sort(keysAsArray);
-
-    for (int i = 0; i < keysAsArray.length; i++) {
-      assertEquals(keysAsArray[i], servers[i]);
-      Long ts1 = timestamps[i];
-      Long ts2 = result.get(keysAsArray[i]);
-      assertEquals(ts1, ts2);
-    }
-
-    cleanBackupTable();
-  }
-
-  @Test
-  public void testIncrementalBackupTableSet() throws IOException {
-    TreeSet<TableName> tables1 = new TreeSet<>();
-
-    tables1.add(TableName.valueOf("t1"));
-    tables1.add(TableName.valueOf("t2"));
-    tables1.add(TableName.valueOf("t3"));
-
-    TreeSet<TableName> tables2 = new TreeSet<>();
-
-    tables2.add(TableName.valueOf("t3"));
-    tables2.add(TableName.valueOf("t4"));
-    tables2.add(TableName.valueOf("t5"));
-
-    table.addIncrementalBackupTableSet(tables1, "root");
-    BackupSystemTable table = new BackupSystemTable(conn);
-    TreeSet<TableName> res1 = (TreeSet<TableName>) table.getIncrementalBackupTableSet("root");
-    assertTrue(tables1.size() == res1.size());
-    Iterator<TableName> desc1 = tables1.descendingIterator();
-    Iterator<TableName> desc2 = res1.descendingIterator();
-    while (desc1.hasNext()) {
-      assertEquals(desc1.next(), desc2.next());
-    }
-
-    table.addIncrementalBackupTableSet(tables2, "root");
-    TreeSet<TableName> res2 = (TreeSet<TableName>) table.getIncrementalBackupTableSet("root");
-    assertTrue((tables2.size() + tables1.size() - 1) == res2.size());
-
-    tables1.addAll(tables2);
-
-    desc1 = tables1.descendingIterator();
-    desc2 = res2.descendingIterator();
-
-    while (desc1.hasNext()) {
-      assertEquals(desc1.next(), desc2.next());
-    }
-    cleanBackupTable();
-
-  }
-
-  @Test
-  public void testRegionServerLogTimestampMap() throws IOException {
-    TreeSet<TableName> tables = new TreeSet<>();
-
-    tables.add(TableName.valueOf("t1"));
-    tables.add(TableName.valueOf("t2"));
-    tables.add(TableName.valueOf("t3"));
-
-    HashMap<String, Long> rsTimestampMap = new HashMap<String, Long>();
-
-    rsTimestampMap.put("rs1:100", 100L);
-    rsTimestampMap.put("rs2:100", 101L);
-    rsTimestampMap.put("rs3:100", 103L);
-
-    table.writeRegionServerLogTimestamp(tables, rsTimestampMap, "root");
-
-    HashMap<TableName, HashMap<String, Long>> result = table.readLogTimestampMap("root");
-
-    assertTrue(tables.size() == result.size());
-
-    for (TableName t : tables) {
-      HashMap<String, Long> rstm = result.get(t);
-      assertNotNull(rstm);
-      assertEquals(rstm.get("rs1:100"), new Long(100L));
-      assertEquals(rstm.get("rs2:100"), new Long(101L));
-      assertEquals(rstm.get("rs3:100"), new Long(103L));
-    }
-
-    Set<TableName> tables1 = new TreeSet<>();
-
-    tables1.add(TableName.valueOf("t3"));
-    tables1.add(TableName.valueOf("t4"));
-    tables1.add(TableName.valueOf("t5"));
-
-    HashMap<String, Long> rsTimestampMap1 = new HashMap<String, Long>();
-
-    rsTimestampMap1.put("rs1:100", 200L);
-    rsTimestampMap1.put("rs2:100", 201L);
-    rsTimestampMap1.put("rs3:100", 203L);
-
-    table.writeRegionServerLogTimestamp(tables1, rsTimestampMap1, "root");
-
-    result = table.readLogTimestampMap("root");
-
-    assertTrue(5 == result.size());
-
-    for (TableName t : tables) {
-      HashMap<String, Long> rstm = result.get(t);
-      assertNotNull(rstm);
-      if (t.equals(TableName.valueOf("t3")) == false) {
-        assertEquals(rstm.get("rs1:100"), new Long(100L));
-        assertEquals(rstm.get("rs2:100"), new Long(101L));
-        assertEquals(rstm.get("rs3:100"), new Long(103L));
-      } else {
-        assertEquals(rstm.get("rs1:100"), new Long(200L));
-        assertEquals(rstm.get("rs2:100"), new Long(201L));
-        assertEquals(rstm.get("rs3:100"), new Long(203L));
-      }
-    }
-
-    for (TableName t : tables1) {
-      HashMap<String, Long> rstm = result.get(t);
-      assertNotNull(rstm);
-      assertEquals(rstm.get("rs1:100"), new Long(200L));
-      assertEquals(rstm.get("rs2:100"), new Long(201L));
-      assertEquals(rstm.get("rs3:100"), new Long(203L));
-    }
-
-    cleanBackupTable();
-
-  }
-
-  @Test
-  public void testAddWALFiles() throws IOException {
-    List<String> files =
-        Arrays.asList("hdfs://server/WALs/srv1,101,15555/srv1,101,15555.default.1",
-          "hdfs://server/WALs/srv2,102,16666/srv2,102,16666.default.2",
-          "hdfs://server/WALs/srv3,103,17777/srv3,103,17777.default.3");
-    String newFile = "hdfs://server/WALs/srv1,101,15555/srv1,101,15555.default.5";
-
-    table.addWALFiles(files, "backup", "root");
-
-    assertTrue(table.isWALFileDeletable(files.get(0)));
-    assertTrue(table.isWALFileDeletable(files.get(1)));
-    assertTrue(table.isWALFileDeletable(files.get(2)));
-    assertFalse(table.isWALFileDeletable(newFile));
-
-    cleanBackupTable();
-  }
-
-  /**
-   * Backup set tests
-   */
-
-  @Test
-  public void testBackupSetAddNotExists() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames != null);
-      assertTrue(tnames.size() == tables.length);
-      for (int i = 0; i < tnames.size(); i++) {
-        assertTrue(tnames.get(i).getNameAsString().equals(tables[i]));
-      }
-      cleanBackupTable();
-    }
-
-  }
-
-  @Test
-  public void testBackupSetAddExists() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      String[] addTables = new String[] { "table4", "table5", "table6" };
-      table.addToBackupSet(setName, addTables);
-
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames != null);
-      assertTrue(tnames.size() == tables.length + addTables.length);
-      for (int i = 0; i < tnames.size(); i++) {
-        assertTrue(tnames.get(i).getNameAsString().equals("table" + (i + 1)));
-      }
-      cleanBackupTable();
-    }
-  }
-
-  @Test
-  public void testBackupSetAddExistsIntersects() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      String[] addTables = new String[] { "table3", "table4", "table5", "table6" };
-      table.addToBackupSet(setName, addTables);
-
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames != null);
-      assertTrue(tnames.size() == tables.length + addTables.length - 1);
-      for (int i = 0; i < tnames.size(); i++) {
-        assertTrue(tnames.get(i).getNameAsString().equals("table" + (i + 1)));
-      }
-      cleanBackupTable();
-    }
-  }
-
-  @Test
-  public void testBackupSetRemoveSomeNotExists() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3", "table4" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      String[] removeTables = new String[] { "table4", "table5", "table6" };
-      table.removeFromBackupSet(setName, removeTables);
-
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames != null);
-      assertTrue(tnames.size() == tables.length - 1);
-      for (int i = 0; i < tnames.size(); i++) {
-        assertTrue(tnames.get(i).getNameAsString().equals("table" + (i + 1)));
-      }
-      cleanBackupTable();
-    }
-  }
-
-  @Test
-  public void testBackupSetRemove() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3", "table4" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      String[] removeTables = new String[] { "table4", "table3" };
-      table.removeFromBackupSet(setName, removeTables);
-
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames != null);
-      assertTrue(tnames.size() == tables.length - 2);
-      for (int i = 0; i < tnames.size(); i++) {
-        assertTrue(tnames.get(i).getNameAsString().equals("table" + (i + 1)));
-      }
-      cleanBackupTable();
-    }
-  }
-
-  @Test
-  public void testBackupSetDelete() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3", "table4" };
-      String setName = "name";
-      table.addToBackupSet(setName, tables);
-      table.deleteBackupSet(setName);
-
-      List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames == null);
-      cleanBackupTable();
-    }
-  }
-
-  @Test
-  public void testBackupSetList() throws IOException {
-    try (BackupSystemTable table = new BackupSystemTable(conn)) {
-
-      String[] tables = new String[] { "table1", "table2", "table3", "table4" };
-      String setName1 = "name1";
-      String setName2 = "name2";
-      table.addToBackupSet(setName1, tables);
-      table.addToBackupSet(setName2, tables);
-
-      List<String> list = table.listBackupSets();
-
-      assertTrue(list.size() == 2);
-      assertTrue(list.get(0).equals(setName1));
-      assertTrue(list.get(1).equals(setName2));
-
-      cleanBackupTable();
-    }
-  }
-
-  private boolean compare(BackupInfo one, BackupInfo two) {
-    return one.getBackupId().equals(two.getBackupId()) && one.getType().equals(two.getType())
-        && one.getBackupRootDir().equals(two.getBackupRootDir())
-        && one.getStartTs() == two.getStartTs() && one.getCompleteTs() == two.getCompleteTs();
-  }
-
-  private BackupInfo createBackupInfo() {
-
-    BackupInfo ctxt =
-        new BackupInfo("backup_" + System.nanoTime(), BackupType.FULL, new TableName[] {
-            TableName.valueOf("t1"), TableName.valueOf("t2"), TableName.valueOf("t3") },
-            "/hbase/backup");
-    ctxt.setStartTs(System.currentTimeMillis());
-    ctxt.setCompleteTs(System.currentTimeMillis() + 1);
-    return ctxt;
-  }
-
-  private List<BackupInfo> createBackupInfoList(int size) {
-    List<BackupInfo> list = new ArrayList<BackupInfo>();
-    for (int i = 0; i < size; i++) {
-      list.add(createBackupInfo());
-      try {
-        Thread.sleep(10);
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-      }
-    }
-    return list;
-  }
-
-  @AfterClass
-  public static void tearDown() throws IOException {
-    if (cluster != null) cluster.shutdown();
-  }
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackup.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackup.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackup.java
deleted file mode 100644
index 919668e..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackup.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(LargeTests.class)
-public class TestFullBackup extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestFullBackup.class);
-
-  @Test
-  public void testFullBackupMultipleCommand() throws Exception {
-    LOG.info("test full backup on a multiple tables with data: command-line");
-    try (BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection())) {
-      int before = table.getBackupHistory().size();
-      String[] args =
-          new String[] { "create", "full", BACKUP_ROOT_DIR, "-t",
-              table1.getNameAsString() + "," + table2.getNameAsString() };
-      // Run backup
-      int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-      assertTrue(ret == 0);
-      List<BackupInfo> backups = table.getBackupHistory();
-      int after = table.getBackupHistory().size();
-      assertTrue(after == before + 1);
-      for (BackupInfo data : backups) {
-        String backupId = data.getBackupId();
-        assertTrue(checkSucceeded(backupId));
-      }
-    }
-    LOG.info("backup complete");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/79ac70ac/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java
deleted file mode 100644
index c115971..0000000
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.backup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(LargeTests.class)
-public class TestFullBackupSet extends TestBackupBase {
-
-  private static final Log LOG = LogFactory.getLog(TestFullBackupSet.class);
-
-  /**
-   * Verify that full backup is created on a single table with data correctly.
-   * @throws Exception
-   */
-  @Test
-  public void testFullBackupSetExist() throws Exception {
-
-    LOG.info("Test full backup, backup set exists");
-
-    // Create set
-    try (BackupSystemTable table = new BackupSystemTable(TEST_UTIL.getConnection())) {
-      String name = "name";
-      table.addToBackupSet(name, new String[] { table1.getNameAsString() });
-      List<TableName> names = table.describeBackupSet(name);
-
-      assertNotNull(names);
-      assertTrue(names.size() == 1);
-      assertTrue(names.get(0).equals(table1));
-
-      String[] args = new String[] { "create", "full", BACKUP_ROOT_DIR, "-s", name };
-      // Run backup
-      int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-      assertTrue(ret == 0);
-      List<BackupInfo> backups = table.getBackupHistory();
-      assertTrue(backups.size() == 1);
-      String backupId = backups.get(0).getBackupId();
-      assertTrue(checkSucceeded(backupId));
-
-      LOG.info("backup complete");
-
-      // Restore from set into other table
-      args =
-          new String[] { BACKUP_ROOT_DIR, backupId, "-s", name, "-m",
-              table1_restore.getNameAsString(), "-o" };
-      // Run backup
-      ret = ToolRunner.run(conf1, new RestoreDriver(), args);
-      assertTrue(ret == 0);
-      HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
-      assertTrue(hba.tableExists(table1_restore));
-      // Verify number of rows in both tables
-      assertEquals(TEST_UTIL.countRows(table1), TEST_UTIL.countRows(table1_restore));
-      TEST_UTIL.deleteTable(table1_restore);
-      LOG.info("restore into other table is complete");
-      hba.close();
-
-    }
-
-  }
-
-  @Test
-  public void testFullBackupSetDoesNotExist() throws Exception {
-
-    LOG.info("test full backup, backup set does not exist");
-    String name = "name1";
-    String[] args = new String[] { "create", "full", BACKUP_ROOT_DIR, "-s", name };
-    // Run backup
-    int ret = ToolRunner.run(conf1, new BackupDriver(), args);
-    assertTrue(ret != 0);
-
-  }
-
-}


Mime
View raw message