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
.master
;
20 import static org
.junit
.Assert
.assertFalse
;
21 import static org
.junit
.Assert
.assertNull
;
23 import org
.apache
.hadoop
.conf
.Configuration
;
24 import org
.apache
.hadoop
.hbase
.HBaseClassTestRule
;
25 import org
.apache
.hadoop
.hbase
.HBaseTestingUtility
;
26 import org
.apache
.hadoop
.hbase
.regionserver
.ChunkCreator
;
27 import org
.apache
.hadoop
.hbase
.testclassification
.MasterTests
;
28 import org
.apache
.hadoop
.hbase
.testclassification
.MediumTests
;
29 import org
.apache
.hadoop
.hbase
.util
.FSUtils
;
30 import org
.junit
.AfterClass
;
31 import org
.junit
.BeforeClass
;
32 import org
.junit
.ClassRule
;
33 import org
.junit
.Test
;
34 import org
.junit
.experimental
.categories
.Category
;
35 import org
.slf4j
.Logger
;
36 import org
.slf4j
.LoggerFactory
;
38 @Category({MasterTests
.class, MediumTests
.class})
39 public class TestMasterNotCarryTable
{
42 public static final HBaseClassTestRule CLASS_RULE
=
43 HBaseClassTestRule
.forClass(TestMasterNotCarryTable
.class);
45 private static final Logger LOG
= LoggerFactory
.getLogger(TestMasterNotCarryTable
.class);
47 private static final HBaseTestingUtility UTIL
= new HBaseTestingUtility();
49 private static HMaster master
;
52 public static void setUp() throws Exception
{
53 Configuration c
= UTIL
.getConfiguration();
54 // We use local filesystem. Set it so it writes into the testdir.
55 FSUtils
.setRootDir(c
, UTIL
.getDataTestDir());
56 UTIL
.startMiniZKCluster();
57 master
= new HMaster(UTIL
.getConfiguration());
59 // As no regionservers, only wait master to create AssignmentManager.
60 while (master
.getAssignmentManager() != null) {
61 LOG
.debug("Wait master to create AssignmentManager");
67 public static void tearDown() throws Exception
{
68 master
.stop("Shutdown");
69 UTIL
.shutdownMiniZKCluster();
73 public void testMasterNotCarryTable() {
74 // The default config is false
75 assertFalse(LoadBalancer
.isTablesOnMaster(UTIL
.getConfiguration()));
76 assertFalse(LoadBalancer
.isSystemTablesOnlyOnMaster(UTIL
.getConfiguration()));
80 public void testMasterBlockCache() {
81 // no need to instantiate block cache.
82 assertFalse(master
.getBlockCache().isPresent());
86 public void testMasterMOBFileCache() {
87 // no need to instantiate mob file cache.
88 assertFalse(master
.getMobFileCache().isPresent());