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.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28 import org.apache.hadoop.conf.Configuration;
29 import org.apache.hadoop.hbase.HBaseTestingUtility;
30 import org.apache.hadoop.hbase.HColumnDescriptor;
31 import org.apache.hadoop.hbase.TableName;
32 import org.apache.hadoop.hbase.mob.MobConstants;
33 import org.apache.hadoop.hbase.snapshot.MobSnapshotTestingUtils;
34 import org.apache.hadoop.hbase.testclassification.LargeTests;
35 import org.junit.BeforeClass;
36 import org.junit.experimental.categories.Category;
37
38
39
40
41 @Category({LargeTests.class})
42 public class TestMobRestoreSnapshotFromClient extends TestRestoreSnapshotFromClient {
43 private static final Log LOG = LogFactory.getLog(TestMobRestoreSnapshotFromClient.class);
44
45 @BeforeClass
46 public static void setupCluster() throws Exception {
47 setupConf(TEST_UTIL.getConfiguration());
48 TEST_UTIL.startMiniCluster(3);
49 }
50
51 protected static void setupConf(Configuration conf) {
52 TestRestoreSnapshotFromClient.setupConf(conf);
53 TEST_UTIL.getConfiguration().setInt(MobConstants.MOB_FILE_CACHE_SIZE_KEY, 0);
54 }
55
56 @Override
57 protected void createTable() throws Exception {
58 MobSnapshotTestingUtils.createMobTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
59 }
60
61 @Override
62 protected HColumnDescriptor getTestRestoreSchemaChangeHCD() {
63 HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY2);
64 hcd.setMobEnabled(true);
65 hcd.setMobThreshold(3L);
66 return hcd;
67 }
68
69 @Override
70 protected void verifyRowCount(final HBaseTestingUtility util, final TableName tableName,
71 long expectedRows) throws IOException {
72 MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows);
73 }
74
75 @Override
76 protected int countRows(final Table table, final byte[]... families) throws IOException {
77 return MobSnapshotTestingUtils.countMobRows(table, families);
78 }
79 }