1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.client;
19
20 import static org.junit.Assert.assertEquals;
21 import static org.junit.Assert.assertFalse;
22 import static org.junit.Assert.fail;
23
24 import java.io.IOException;
25
26 import org.apache.hadoop.conf.Configuration;
27 import org.apache.hadoop.hbase.HBaseTestingUtility;
28 import org.apache.hadoop.hbase.HColumnDescriptor;
29 import org.apache.hadoop.hbase.TableName;
30 import org.apache.hadoop.hbase.mob.MobConstants;
31 import org.apache.hadoop.hbase.snapshot.MobSnapshotTestingUtils;
32 import org.apache.hadoop.hbase.testclassification.LargeTests;
33 import org.junit.BeforeClass;
34 import org.junit.experimental.categories.Category;
35
36
37
38
39 @Category({LargeTests.class})
40 public class TestMobRestoreSnapshotFromClient extends TestRestoreSnapshotFromClient {
41
42 @BeforeClass
43 public static void setupCluster() throws Exception {
44 setupConf(TEST_UTIL.getConfiguration());
45 TEST_UTIL.startMiniCluster(3);
46 }
47
48 protected static void setupConf(Configuration conf) {
49 TestRestoreSnapshotFromClient.setupConf(conf);
50 TEST_UTIL.getConfiguration().setInt(MobConstants.MOB_FILE_CACHE_SIZE_KEY, 0);
51 }
52
53 @Override
54 protected void createTable() throws Exception {
55 MobSnapshotTestingUtils.createMobTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
56 }
57
58 @Override
59 protected HColumnDescriptor getTestRestoreSchemaChangeHCD() {
60 HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY2);
61 hcd.setMobEnabled(true);
62 hcd.setMobThreshold(3L);
63 return hcd;
64 }
65
66 @Override
67 protected void verifyRowCount(final HBaseTestingUtility util, final TableName tableName,
68 long expectedRows) throws IOException {
69 MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows);
70 }
71
72 @Override
73 protected int countRows(final Table table, final byte[]... families) throws IOException {
74 return MobSnapshotTestingUtils.countMobRows(table, families);
75 }
76 }