HADOOP-10774. Update KerberosTestUtils for hadoop-auth tests when using IBM Java (sangamesh via aw)
This commit is contained in:
parent
039366e3b4
commit
b01d3433ae
|
@ -32,12 +32,14 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test helper class for Java Kerberos setup.
|
* Test helper class for Java Kerberos setup.
|
||||||
*/
|
*/
|
||||||
public class KerberosTestUtils {
|
public class KerberosTestUtils {
|
||||||
private static String keytabFile = new File(System.getProperty("test.dir", "target"),
|
private static String keytabFile = new File(System.getProperty("test.dir", "target"),
|
||||||
UUID.randomUUID().toString()).toString();
|
UUID.randomUUID().toString()).getAbsolutePath();
|
||||||
|
|
||||||
public static String getRealm() {
|
public static String getRealm() {
|
||||||
return "EXAMPLE.COM";
|
return "EXAMPLE.COM";
|
||||||
|
@ -65,6 +67,13 @@ public class KerberosTestUtils {
|
||||||
@Override
|
@Override
|
||||||
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
|
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
|
||||||
Map<String, String> options = new HashMap<String, String>();
|
Map<String, String> options = new HashMap<String, String>();
|
||||||
|
if (IBM_JAVA) {
|
||||||
|
options.put("useKeytab", KerberosTestUtils.getKeytabFile().startsWith("file://") ?
|
||||||
|
KerberosTestUtils.getKeytabFile() : "file://" + KerberosTestUtils.getKeytabFile());
|
||||||
|
options.put("principal", principal);
|
||||||
|
options.put("refreshKrb5Config", "true");
|
||||||
|
options.put("credsType", "both");
|
||||||
|
} else {
|
||||||
options.put("keyTab", KerberosTestUtils.getKeytabFile());
|
options.put("keyTab", KerberosTestUtils.getKeytabFile());
|
||||||
options.put("principal", principal);
|
options.put("principal", principal);
|
||||||
options.put("useKeyTab", "true");
|
options.put("useKeyTab", "true");
|
||||||
|
@ -74,10 +83,19 @@ public class KerberosTestUtils {
|
||||||
options.put("renewTGT", "true");
|
options.put("renewTGT", "true");
|
||||||
options.put("refreshKrb5Config", "true");
|
options.put("refreshKrb5Config", "true");
|
||||||
options.put("isInitiator", "true");
|
options.put("isInitiator", "true");
|
||||||
|
}
|
||||||
String ticketCache = System.getenv("KRB5CCNAME");
|
String ticketCache = System.getenv("KRB5CCNAME");
|
||||||
if (ticketCache != null) {
|
if (ticketCache != null) {
|
||||||
|
if (IBM_JAVA) {
|
||||||
|
// IBM JAVA only respect system property and not env variable
|
||||||
|
// The first value searched when "useDefaultCcache" is used.
|
||||||
|
System.setProperty("KRB5CCNAME", ticketCache);
|
||||||
|
options.put("useDefaultCcache", "true");
|
||||||
|
options.put("renewTGT", "true");
|
||||||
|
} else {
|
||||||
options.put("ticketCache", ticketCache);
|
options.put("ticketCache", ticketCache);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
options.put("debug", "true");
|
options.put("debug", "true");
|
||||||
|
|
||||||
return new AppConfigurationEntry[]{
|
return new AppConfigurationEntry[]{
|
||||||
|
|
|
@ -403,6 +403,9 @@ Trunk (Unreleased)
|
||||||
|
|
||||||
HADOOP-11637. bash location hard-coded in shell scripts (aw)
|
HADOOP-11637. bash location hard-coded in shell scripts (aw)
|
||||||
|
|
||||||
|
HADOOP-10774. Update KerberosTestUtils for hadoop-auth tests when using
|
||||||
|
IBM Java (sangamesh via aw)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
||||||
|
|
Loading…
Reference in New Issue