1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.hbtop.mode;
19
20 import static org.hamcrest.CoreMatchers.is;
21 import static org.junit.Assert.assertThat;
22 import static org.junit.Assert.fail;
23
24 import java.util.List;
25 import org.apache.hadoop.hbase.hbtop.Record;
26 import org.apache.hadoop.hbase.hbtop.TestUtils;
27 import org.apache.hadoop.hbase.hbtop.field.Field;
28 import org.apache.hadoop.hbase.testclassification.SmallTests;
29 import org.junit.experimental.categories.Category;
30
31 @Category(SmallTests.class)
32 public class TestRegionServerMode extends TestModeBase {
33
34 @Override
35 protected Mode getMode() {
36 return Mode.REGION_SERVER;
37 }
38
39 @Override
40 protected void assertRecords(List<Record> records) {
41 TestUtils.assertRecordsInRegionServerMode(records);
42 }
43
44 @Override
45 protected void assertDrillDown(Record currentRecord, DrillDownInfo drillDownInfo) {
46 assertThat(drillDownInfo.getNextMode(), is(Mode.REGION));
47 assertThat(drillDownInfo.getInitialFilters().size(), is(1));
48
49 switch (currentRecord.get(Field.REGION_SERVER).asString()) {
50 case "host1:1000":
51 assertThat(drillDownInfo.getInitialFilters().get(0).toString(), is("RS==host1:1000"));
52 break;
53
54 case "host2:1001":
55 assertThat(drillDownInfo.getInitialFilters().get(0).toString(), is("RS==host2:1001"));
56 break;
57
58 default:
59 fail();
60 }
61 }
62 }