View Javadoc

1   /**
2    * Copyright The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.mapreduce;
21  
22  import org.apache.hadoop.hbase.LargeTests;
23  import org.apache.hadoop.hbase.security.UserProvider;
24  import org.apache.hadoop.hbase.security.access.AccessControlLists;
25  import org.apache.hadoop.hbase.security.access.SecureTestUtil;
26  
27  import org.junit.BeforeClass;
28  import org.junit.experimental.categories.Category;
29  
30  /**
31   * Reruns TestLoadIncrementalHFiles using LoadIncrementalHFiles in secure mode.
32   * This suite is unable to verify the security handoff/turnover
33   * as miniCluster is running as system user thus has root privileges
34   * and delegation tokens don't seem to work on miniDFS.
35   *
36   * Thus SecureBulkload can only be completely verified by running
37   * integration tests against a secure cluster. This suite is still
38   * invaluable as it verifies the other mechanisms that need to be
39   * supported as part of a LoadIncrementalFiles call.
40   */
41  @Category(LargeTests.class)
42  public class TestSecureLoadIncrementalHFiles extends  TestLoadIncrementalHFiles{
43  
44    @BeforeClass
45    public static void setUpBeforeClass() throws Exception {
46      // set the always on security provider
47      UserProvider.setUserProviderForTesting(util.getConfiguration(),
48        HadoopSecurityEnabledUserProviderForTesting.class);
49      // setup configuration
50      SecureTestUtil.enableSecurity(util.getConfiguration());
51      util.getConfiguration().setInt(
52          LoadIncrementalHFiles.MAX_FILES_PER_REGION_PER_FAMILY,
53          MAX_FILES_PER_REGION_PER_FAMILY);
54  
55      util.startMiniCluster();
56  
57      // Wait for the ACL table to become available
58      util.waitTableEnabled(AccessControlLists.ACL_TABLE_NAME.getName());
59    }
60  
61  }
62