HBASE-26921 Rewrite the counting cells part in TestMultiVersions (#4316)
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / rsgroup / TestRSGroupsCPHookCalled.java
blob403045f22a64cd3f9987f451f04f7d5a29b0e5e1
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.rsgroup;
20 import static org.junit.Assert.assertTrue;
22 import org.apache.hadoop.hbase.HBaseClassTestRule;
23 import org.apache.hadoop.hbase.ServerName;
24 import org.apache.hadoop.hbase.SingleProcessHBaseCluster;
25 import org.apache.hadoop.hbase.TableName;
26 import org.apache.hadoop.hbase.testclassification.MediumTests;
27 import org.apache.hadoop.hbase.testclassification.RSGroupTests;
28 import org.junit.After;
29 import org.junit.AfterClass;
30 import org.junit.Before;
31 import org.junit.BeforeClass;
32 import org.junit.ClassRule;
33 import org.junit.Test;
34 import org.junit.experimental.categories.Category;
36 @Category({ RSGroupTests.class, MediumTests.class })
37 public class TestRSGroupsCPHookCalled extends TestRSGroupsBase {
39 @ClassRule
40 public static final HBaseClassTestRule CLASS_RULE =
41 HBaseClassTestRule.forClass(TestRSGroupsCPHookCalled.class);
43 @BeforeClass
44 public static void setUp() throws Exception {
45 setUpTestBeforeClass();
48 @AfterClass
49 public static void tearDown() throws Exception {
50 tearDownAfterClass();
53 @Before
54 public void beforeMethod() throws Exception {
55 setUpBeforeMethod();
58 @After
59 public void afterMethod() throws Exception {
60 tearDownAfterMethod();
63 @Test
64 public void testGetRSGroupInfoCPHookCalled() throws Exception {
65 ADMIN.getRSGroup(RSGroupInfo.DEFAULT_GROUP);
66 assertTrue(OBSERVER.preGetRSGroupInfoCalled);
67 assertTrue(OBSERVER.postGetRSGroupInfoCalled);
70 @Test
71 public void testGetRSGroupInfoOfTableCPHookCalled() throws Exception {
72 ADMIN.getRSGroup(TableName.META_TABLE_NAME);
73 assertTrue(OBSERVER.preGetRSGroupInfoOfTableCalled);
74 assertTrue(OBSERVER.postGetRSGroupInfoOfTableCalled);
77 @Test
78 public void testListRSGroupsCPHookCalled() throws Exception {
79 ADMIN.listRSGroups();
80 assertTrue(OBSERVER.preListRSGroupsCalled);
81 assertTrue(OBSERVER.postListRSGroupsCalled);
84 @Test
85 public void testGetRSGroupInfoOfServerCPHookCalled() throws Exception {
86 ServerName masterServerName = ((SingleProcessHBaseCluster) CLUSTER).getMaster().getServerName();
87 ADMIN.getRSGroup(masterServerName.getAddress());
88 assertTrue(OBSERVER.preGetRSGroupInfoOfServerCalled);
89 assertTrue(OBSERVER.postGetRSGroupInfoOfServerCalled);