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
{
40 public static final HBaseClassTestRule CLASS_RULE
=
41 HBaseClassTestRule
.forClass(TestRSGroupsCPHookCalled
.class);
44 public static void setUp() throws Exception
{
45 setUpTestBeforeClass();
49 public static void tearDown() throws Exception
{
54 public void beforeMethod() throws Exception
{
59 public void afterMethod() throws Exception
{
60 tearDownAfterMethod();
64 public void testGetRSGroupInfoCPHookCalled() throws Exception
{
65 ADMIN
.getRSGroup(RSGroupInfo
.DEFAULT_GROUP
);
66 assertTrue(OBSERVER
.preGetRSGroupInfoCalled
);
67 assertTrue(OBSERVER
.postGetRSGroupInfoCalled
);
71 public void testGetRSGroupInfoOfTableCPHookCalled() throws Exception
{
72 ADMIN
.getRSGroup(TableName
.META_TABLE_NAME
);
73 assertTrue(OBSERVER
.preGetRSGroupInfoOfTableCalled
);
74 assertTrue(OBSERVER
.postGetRSGroupInfoOfTableCalled
);
78 public void testListRSGroupsCPHookCalled() throws Exception
{
80 assertTrue(OBSERVER
.preListRSGroupsCalled
);
81 assertTrue(OBSERVER
.postListRSGroupsCalled
);
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
);