1
2
3
4
5
6
7
8
9
10
11
12 package org.apache.hadoop.hbase.backup;
13
14 import static org.junit.Assert.assertTrue;
15
16 import org.apache.commons.logging.Log;
17 import org.apache.commons.logging.LogFactory;
18 import org.apache.hadoop.hbase.TableName;
19 import org.apache.hadoop.hbase.client.HBaseAdmin;
20 import org.apache.hadoop.hbase.testclassification.LargeTests;
21 import org.junit.Test;
22 import org.junit.experimental.categories.Category;
23
24 @Category(LargeTests.class)
25 public class TestRemoteRestore extends TestBackupBase {
26
27 private static final Log LOG = LogFactory.getLog(TestRemoteRestore.class);
28
29
30
31
32
33 @Test
34 public void testFullRestoreRemote() throws Exception {
35
36 LOG.info("test remote full backup on a single table");
37 String backupId = backupTables(BackupType.FULL, toList(table1.getNameAsString()),
38 BACKUP_REMOTE_ROOT_DIR);
39 LOG.info("backup complete");
40 TableName[] tableset = new TableName[] { table1 };
41 TableName[] tablemap = new TableName[] { table1_restore };
42 getBackupAdmin().restore(createRestoreRequest(BACKUP_REMOTE_ROOT_DIR, backupId, false, tableset,
43 tablemap, false));
44 HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
45 assertTrue(hba.tableExists(table1_restore));
46 TEST_UTIL.deleteTable(table1_restore);
47 hba.close();
48 }
49
50 }