1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.migration;
19
20
21 import java.io.IOException;
22
23 import junit.framework.Assert;
24
25 import org.apache.hadoop.hbase.*;
26 import org.apache.hadoop.hbase.catalog.MetaMigrationRemovingHTD;
27 import org.apache.hadoop.hbase.util.Writables;
28 import org.junit.Test;
29 import org.junit.experimental.categories.Category;
30
31
32
33
34
35 @Category(SmallTests.class)
36 public class TestMigrationFrom090To092 {
37 @Test
38 public void testMigrateHRegionInfoFromVersion0toVersion1()
39 throws IOException {
40 HTableDescriptor htd =
41 getHTableDescriptor("testMigrateHRegionInfoFromVersion0toVersion1");
42 HRegionInfo090x ninety =
43 new HRegionInfo090x(htd, HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW);
44 byte [] bytes = Writables.getBytes(ninety);
45
46 HRegionInfo hri = Writables.getHRegionInfo(bytes);
47 Assert.assertEquals(hri.getTableNameAsString(),
48 ninety.getTableDesc().getNameAsString());
49 Assert.assertEquals(HRegionInfo.VERSION, hri.getVersion());
50 }
51
52 private HTableDescriptor getHTableDescriptor(final String name) {
53 HTableDescriptor htd = new HTableDescriptor(name);
54 htd.addFamily(new HColumnDescriptor("family"));
55 return htd;
56 }
57
58 @org.junit.Rule
59 public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
60 new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
61 }
62