HBASE-22002 Remove the deprecated methods in Admin interface
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / client / CloneSnapshotFromClientCloneLinksAfterDeleteTestBase.java
blob254aeac6a3bc93971feb94321e48bbf91ed6deeb
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.client;
20 import java.io.IOException;
21 import org.apache.hadoop.hbase.TableName;
22 import org.junit.Test;
24 public class CloneSnapshotFromClientCloneLinksAfterDeleteTestBase
25 extends CloneSnapshotFromClientTestBase {
27 /**
28 * Verify that tables created from the snapshot are still alive after source table deletion.
30 @Test
31 public void testCloneLinksAfterDelete() throws IOException, InterruptedException {
32 // Clone a table from the first snapshot
33 final TableName clonedTableName =
34 TableName.valueOf(getValidMethodName() + "1-" + System.currentTimeMillis());
35 admin.cloneSnapshot(snapshotName0, clonedTableName);
36 verifyRowCount(TEST_UTIL, clonedTableName, snapshot0Rows);
38 // Take a snapshot of this cloned table.
39 admin.disableTable(clonedTableName);
40 admin.snapshot(snapshotName2, clonedTableName);
42 // Clone the snapshot of the cloned table
43 final TableName clonedTableName2 =
44 TableName.valueOf(getValidMethodName() + "2-" + System.currentTimeMillis());
45 admin.cloneSnapshot(snapshotName2, clonedTableName2);
46 verifyRowCount(TEST_UTIL, clonedTableName2, snapshot0Rows);
47 admin.disableTable(clonedTableName2);
49 // Remove the original table
50 TEST_UTIL.deleteTable(tableName);
51 waitCleanerRun();
53 // Verify the first cloned table
54 admin.enableTable(clonedTableName);
55 verifyRowCount(TEST_UTIL, clonedTableName, snapshot0Rows);
57 // Verify the second cloned table
58 admin.enableTable(clonedTableName2);
59 verifyRowCount(TEST_UTIL, clonedTableName2, snapshot0Rows);
60 admin.disableTable(clonedTableName2);
62 // Delete the first cloned table
63 TEST_UTIL.deleteTable(clonedTableName);
64 waitCleanerRun();
66 // Verify the second cloned table
67 admin.enableTable(clonedTableName2);
68 verifyRowCount(TEST_UTIL, clonedTableName2, snapshot0Rows);
70 // Clone a new table from cloned
71 final TableName clonedTableName3 =
72 TableName.valueOf(getValidMethodName() + "3-" + System.currentTimeMillis());
73 admin.cloneSnapshot(snapshotName2, clonedTableName3);
74 verifyRowCount(TEST_UTIL, clonedTableName3, snapshot0Rows);
76 // Delete the cloned tables
77 TEST_UTIL.deleteTable(clonedTableName2);
78 TEST_UTIL.deleteTable(clonedTableName3);
79 admin.deleteSnapshot(snapshotName2);
82 private void waitCleanerRun() throws InterruptedException {
83 TEST_UTIL.getMiniHBaseCluster().getMaster().getHFileCleaner().choreForTesting();