5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 22:13:07 +08:00

SQOOP-2813: Sqoop2: Enable kerberos for real Hadoop cluster in the integration test

(Dian Fu via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2016-02-19 07:22:35 -08:00
parent acc0854063
commit 87515c56e8
3 changed files with 67 additions and 2 deletions

View File

@ -18,6 +18,7 @@
package org.apache.sqoop.test.infrastructure.providers;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.log4j.Logger;
import org.apache.sqoop.test.hadoop.HadoopMiniClusterRunner;
import org.apache.sqoop.test.hadoop.HadoopRunner;
@ -61,7 +62,9 @@ public void stop() {
@Override
public void setHadoopConfiguration(Configuration conf) {
try {
instance.setConfiguration(instance.prepareConfiguration(conf));
Configuration newConf = instance.prepareConfiguration(conf);
instance.setConfiguration(newConf);
UserGroupInformation.setConfiguration(newConf);
} catch (Exception e) {
LOG.error("Could not set configuration.", e);
}

View File

@ -0,0 +1,61 @@
/**
* 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
*
* 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.sqoop.test.kdc;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL;
import org.apache.sqoop.client.SqoopClient;
import java.net.URL;
import java.util.Map;
/**
* Represents a real kdc setup. It should be used together with
* real clusters such as RealSqoopCluster, HadoopRealClusterRunner etc.
*/
public class RealKdcRunner extends KdcRunner {
@Override
public Configuration prepareHadoopConfiguration(Configuration config) throws Exception {
return config;
}
@Override
public Map<String, String> prepareSqoopConfiguration(Map<String, String> properties) {
return properties;
}
@Override
public void start() throws Exception {
// Do nothing
}
@Override
public void stop() throws Exception {
// Do nothing
}
@Override
public void authenticateWithSqoopServer(SqoopClient client) throws Exception {
// Do nothing
}
@Override
public void authenticateWithSqoopServer(URL url, DelegationTokenAuthenticatedURL.Token authToken) throws Exception {
// Do nothing
}
}

View File

@ -66,6 +66,7 @@ public String getServerUrl() {
@Override
public String getConfigurationPath() {
return "/etc/hadoop/conf/";
return System.getProperty(
"sqoop.hadoop.config.path", "/etc/hadoop/conf");
}
}