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.HConstants;
23  import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags;
24  import org.apache.hadoop.hbase.testclassification.LargeTests;
25  import org.apache.hadoop.hbase.security.UserProvider;
26  import org.apache.hadoop.hbase.security.access.AccessControlLists;
27  import org.apache.hadoop.hbase.security.access.SecureTestUtil;
28  
29  import org.junit.BeforeClass;
30  import org.junit.experimental.categories.Category;
31  
32  /**
33   * Reruns TestLoadIncrementalHFiles using LoadIncrementalHFiles in secure mode.
34   * This suite is unable to verify the security handoff/turnover
35   * as miniCluster is running as system user thus has root privileges
36   * and delegation tokens don't seem to work on miniDFS.
37   *
38   * Thus SecureBulkload can only be completely verified by running
39   * integration tests against a secure cluster. This suite is still
40   * invaluable as it verifies the other mechanisms that need to be
41   * supported as part of a LoadIncrementalFiles call.
42   */
43  @Category(LargeTests.class)
44  public class TestSecureLoadIncrementalHFiles extends  TestLoadIncrementalHFiles{
45  
46    @BeforeClass
47    public static void setUpBeforeClass() throws Exception {
48      // set the always on security provider
49      UserProvider.setUserProviderForTesting(util.getConfiguration(),
50        HadoopSecurityEnabledUserProviderForTesting.class);
51      // setup configuration
52      SecureTestUtil.enableSecurity(util.getConfiguration());
53      util.getConfiguration().setInt(
54          LoadIncrementalHFiles.MAX_FILES_PER_REGION_PER_FAMILY,
55          MAX_FILES_PER_REGION_PER_FAMILY);
56      // change default behavior so that tag values are returned with normal rpcs
57      util.getConfiguration().set(HConstants.RPC_CODEC_CONF_KEY,
58          KeyValueCodecWithTags.class.getCanonicalName());
59  
60      util.startMiniCluster();
61  
62      // Wait for the ACL table to become available
63      util.waitTableEnabled(AccessControlLists.ACL_TABLE_NAME);
64  
65      setupNamespace();
66    }
67  
68  }
69