You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2024/12/10 20:23:15 UTC
(accumulo-testing) 01/03: Merge branch '2.0' into 2.1
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git
commit 7be840948685f5d61dcd2915e379bb82b96b00ff
Merge: 6c620c3 43796e6
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Tue Dec 10 15:09:35 2024 -0500
Merge branch '2.0' into 2.1
pom.xml | 1 -
.../apache/accumulo/testing/KerberosHelper.java | 85 ++++++++++++++++++++++
.../java/org/apache/accumulo/testing/TestEnv.java | 1 +
.../testing/continuous/ContinuousMoru.java | 8 +-
.../apache/accumulo/testing/mapreduce/RowHash.java | 9 ++-
.../accumulo/testing/mapreduce/TeraSortIngest.java | 5 +-
.../testing/randomwalk/multitable/CopyTool.java | 11 ++-
.../randomwalk/sequential/MapRedVerifyTool.java | 10 ++-
8 files changed, 117 insertions(+), 13 deletions(-)
diff --cc pom.xml
index 7c2a15a,510bc4e..e53da23
--- a/pom.xml
+++ b/pom.xml
@@@ -269,14 -250,7 +269,13 @@@
<!-- This was added to ensure project only uses public API -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.3.0</version>
- <version>3.1.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>10.12.3</version>
+ </dependency>
+ </dependencies>
<executions>
<execution>
<id>check-style</id>
diff --cc src/main/java/org/apache/accumulo/testing/KerberosHelper.java
index 0000000,84bc325..4d3bc08
mode 000000,100644..100644
--- a/src/main/java/org/apache/accumulo/testing/KerberosHelper.java
+++ b/src/main/java/org/apache/accumulo/testing/KerberosHelper.java
@@@ -1,0 -1,83 +1,85 @@@
+ /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+ *
- * http://www.apache.org/licenses/LICENSE-2.0
++ * https://www.apache.org/licenses/LICENSE-2.0
+ *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+ */
+ package org.apache.accumulo.testing;
+
+ import java.io.IOException;
+ import java.util.Properties;
+
+ import org.apache.accumulo.core.client.Accumulo;
+ import org.apache.accumulo.core.client.AccumuloClient;
+ import org.apache.accumulo.core.client.AccumuloException;
+ import org.apache.accumulo.core.client.AccumuloSecurityException;
+ import org.apache.accumulo.core.client.security.tokens.DelegationToken;
+ import org.apache.accumulo.core.conf.ClientProperty;
+ import org.apache.hadoop.conf.Configuration;
+ import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
+ import org.apache.hadoop.security.UserGroupInformation;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+
+ public class KerberosHelper {
+ private static final Logger log = LoggerFactory.getLogger(KerberosHelper.class);
+
+ public static void saslLogin(Properties clientProps, Configuration conf) {
+ if (Boolean.parseBoolean(ClientProperty.SASL_ENABLED.getValue(clientProps))) {
+ conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
+ UserGroupInformation.setConfiguration(conf);
+ try {
+ UserGroupInformation.loginUserFromKeytab(
+ ClientProperty.AUTH_PRINCIPAL.getValue(clientProps),
+ ClientProperty.AUTH_TOKEN.getValue(clientProps));
+ } catch (IOException e) {
+ log.warn("Sasl login failed", e);
+ }
+ }
+ }
+
+ public static Properties configDelegationToken(Properties clientProps)
+ throws AccumuloException, AccumuloSecurityException {
+ if (Boolean.parseBoolean(ClientProperty.SASL_ENABLED.getValue(clientProps))) {
+ AccumuloClient client = Accumulo.newClient().from(clientProps).build();
+ DelegationToken dt = client.securityOperations().getDelegationToken(null);
+ clientProps = Accumulo.newClientProperties().from(clientProps)
+ .as(ClientProperty.AUTH_PRINCIPAL.getValue(clientProps), dt).build();
+ client.close();
+ }
+ return clientProps;
+ }
+
+ public static Properties configDelegationToken(TestEnv env)
+ throws AccumuloException, AccumuloSecurityException {
+ Properties clientProps = env.getClientProps();
+ if (Boolean.parseBoolean(ClientProperty.SASL_ENABLED.getValue(clientProps))) {
+ AccumuloClient client = env.getAccumuloClient();
+ clientProps = configDelegationToken(clientProps, client);
+ client.close();
+ }
+ return clientProps;
+ }
+
+ public static Properties configDelegationToken(Properties clientProps, AccumuloClient client)
+ throws AccumuloException, AccumuloSecurityException {
+ if (Boolean.parseBoolean(ClientProperty.SASL_ENABLED.getValue(clientProps))) {
+ DelegationToken dt = client.securityOperations().getDelegationToken(null);
+ clientProps = Accumulo.newClientProperties().from(clientProps)
+ .as(ClientProperty.AUTH_PRINCIPAL.getValue(clientProps), dt).build();
+ }
+ return clientProps;
+ }
+ }