001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.master;
019
020import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.TRACKER_IMPL;
021import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.Trackers.FILE;
022import static org.junit.Assert.assertEquals;
023
024import org.apache.hadoop.hbase.HBaseClassTestRule;
025import org.apache.hadoop.hbase.HBaseTestingUtility;
026import org.apache.hadoop.hbase.TableName;
027import org.apache.hadoop.hbase.client.TableDescriptor;
028import org.apache.hadoop.hbase.testclassification.MasterTests;
029import org.apache.hadoop.hbase.testclassification.MediumTests;
030import org.junit.AfterClass;
031import org.junit.BeforeClass;
032import org.junit.ClassRule;
033import org.junit.Rule;
034import org.junit.Test;
035import org.junit.experimental.categories.Category;
036import org.junit.rules.TestName;
037
038/**
039 * Test the master filesystem in a local cluster with Store File Tracking explicitly set in global
040 * config
041 */
042@Category({ MasterTests.class, MediumTests.class })
043public class TestMasterFileSystemWithStoreFileTracking {
044
045  @ClassRule
046  public static final HBaseClassTestRule CLASS_RULE =
047    HBaseClassTestRule.forClass(TestMasterFileSystemWithStoreFileTracking.class);
048
049  @Rule
050  public TestName name = new TestName();
051
052  private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
053
054  @BeforeClass
055  public static void setupTest() throws Exception {
056    UTIL.getConfiguration().set(TRACKER_IMPL, FILE.name());
057    UTIL.startMiniCluster();
058  }
059
060  @AfterClass
061  public static void teardownTest() throws Exception {
062    UTIL.shutdownMiniCluster();
063  }
064
065  @Test
066  public void tesMetaDescriptorHasSFTConfig() throws Exception {
067    TableDescriptor descriptor = UTIL.getAdmin().getDescriptor(TableName.META_TABLE_NAME);
068    assertEquals(FILE.name(), descriptor.getValue(TRACKER_IMPL));
069  }
070}