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.snapshot;
019
020import java.io.IOException;
021import java.util.UUID;
022import org.apache.hadoop.conf.Configuration;
023import org.apache.hadoop.fs.FileSystem;
024import org.apache.hadoop.fs.Path;
025import org.apache.hadoop.hbase.HBaseClassTestRule;
026import org.apache.hadoop.hbase.testclassification.MediumTests;
027import org.junit.AfterClass;
028import org.junit.BeforeClass;
029import org.junit.ClassRule;
030import org.junit.Ignore;
031import org.junit.experimental.categories.Category;
032
033@Ignore // HBASE-24493
034@Category({ MediumTests.class })
035public class TestExportSnapshotWithTemporaryDirectory extends TestExportSnapshot {
036
037  @ClassRule
038  public static final HBaseClassTestRule CLASS_RULE =
039    HBaseClassTestRule.forClass(TestExportSnapshotWithTemporaryDirectory.class);
040
041  @BeforeClass
042  public static void setUpBeforeClass() throws Exception {
043    setUpBaseConf(TEST_UTIL.getConfiguration());
044    TEST_UTIL.startMiniCluster(3);
045    TEST_UTIL.startMiniMapReduceCluster();
046  }
047
048  @AfterClass
049  public static void tearDownAfterClass() throws Exception {
050    TestExportSnapshot.tearDownAfterClass();
051  }
052
053  public static void setUpBaseConf(Configuration conf) {
054    Path tmpDir = null;
055    try {
056      FileSystem localFs = FileSystem.getLocal(conf);
057      tmpDir = TEST_UTIL.getDataTestDir(UUID.randomUUID().toString())
058        .makeQualified(localFs.getUri(), localFs.getWorkingDirectory());
059    } catch (IOException ioe) {
060      throw new RuntimeException(ioe);
061    }
062    TestExportSnapshot.setUpBaseConf(conf);
063    conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR, tmpDir.toUri().toString());
064  }
065}