HBASE-26921 Rewrite the counting cells part in TestMultiVersions (#4316)
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / tool / TestSecureBulkLoadHFiles.java
blob05785b43261733fe98ea95f857d7417bbe108458
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.tool;
20 import org.apache.hadoop.hbase.HBaseClassTestRule;
21 import org.apache.hadoop.hbase.HConstants;
22 import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags;
23 import org.apache.hadoop.hbase.security.HadoopSecurityEnabledUserProviderForTesting;
24 import org.apache.hadoop.hbase.security.UserProvider;
25 import org.apache.hadoop.hbase.security.access.PermissionStorage;
26 import org.apache.hadoop.hbase.security.access.SecureTestUtil;
27 import org.apache.hadoop.hbase.testclassification.LargeTests;
28 import org.apache.hadoop.hbase.testclassification.MiscTests;
29 import org.junit.BeforeClass;
30 import org.junit.ClassRule;
31 import org.junit.experimental.categories.Category;
33 /**
34 * Reruns TestBulkLoadHFiles using BulkLoadHFiles in secure mode. This suite is unable
35 * to verify the security handoff/turnover as miniCluster is running as system user thus has root
36 * privileges and delegation tokens don't seem to work on miniDFS.
37 * <p/>
38 * Thus SecureBulkload can only be completely verified by running integration tests against a secure
39 * cluster. This suite is still invaluable as it verifies the other mechanisms that need to be
40 * supported as part of a LoadIncrementalFiles call.
42 @Category({ MiscTests.class, LargeTests.class })
43 public class TestSecureBulkLoadHFiles extends TestBulkLoadHFiles {
45 @ClassRule
46 public static final HBaseClassTestRule CLASS_RULE =
47 HBaseClassTestRule.forClass(TestSecureBulkLoadHFiles.class);
49 @BeforeClass
50 public static void setUpBeforeClass() throws Exception {
51 // set the always on security provider
52 UserProvider.setUserProviderForTesting(util.getConfiguration(),
53 HadoopSecurityEnabledUserProviderForTesting.class);
54 // setup configuration
55 SecureTestUtil.enableSecurity(util.getConfiguration());
56 util.getConfiguration().setInt(BulkLoadHFiles.MAX_FILES_PER_REGION_PER_FAMILY,
57 MAX_FILES_PER_REGION_PER_FAMILY);
58 // change default behavior so that tag values are returned with normal rpcs
59 util.getConfiguration().set(HConstants.RPC_CODEC_CONF_KEY,
60 KeyValueCodecWithTags.class.getCanonicalName());
62 util.startMiniCluster();
64 // Wait for the ACL table to become available
65 util.waitTableEnabled(PermissionStorage.ACL_TABLE_NAME);
67 setupNamespace();