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