DFSUtil { public static String getSpnegoKeytabKey(Configuration conf, String defaultKey) { String value = conf.get(DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY); return (value == null || value.isEmpty()) ? defaultKey : DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY; } private  DFSUtil(); static Random getRandom(); static SecureRandom getSecureRandom(); static T[] shuffle(final T[] array); static boolean isValidName(String src); static String bytes2String(byte[] bytes); static byte[] string2Bytes(String str); static String byteArray2PathString(byte[][] pathComponents,
      int offset, int length); static String byteArray2PathString(byte[][] pathComponents); static String strings2PathString(String[] components); static String path2String(final Object path); static byte[][] bytes2byteArray(byte[] bytes, byte separator); static byte[][] bytes2byteArray(byte[] bytes, int len,
      byte separator); static String addKeySuffixes(String key, String... suffixes); static int roundBytesToGB(long bytes); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      DatanodeID datanodeid, Configuration conf, int socketTimeout,
      boolean connectToDnViaHostname, LocatedBlock locatedBlock); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      DatanodeID datanodeid, Configuration conf, int socketTimeout,
      boolean connectToDnViaHostname); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      InetSocketAddress addr, UserGroupInformation ticket, Configuration conf,
      SocketFactory factory); static URI createUri(String scheme, InetSocketAddress address); static void addPBProtocol(Configuration conf, Class<?> protocol,
      BlockingService service, RPC.Server server); static boolean parseHelpArgument(String[] args, String helpDescription,
      PrintStream out, boolean printGenericCommandUsage); static float getInvalidateWorkPctPerIteration(Configuration conf); static int getReplWorkMultiplier(Configuration conf); static String getSpnegoKeytabKey(Configuration conf,
      String defaultKey); static HttpConfig.Policy getHttpPolicy(Configuration conf); static HttpServer2.Builder loadSslConfToHttpServerBuilder(HttpServer2.Builder builder, Configuration sslConf); static HttpServer2.Builder loadSslConfToHttpServerBuilder(HttpServer2.Builder builder,
      Configuration sslConf, Configuration systemConf); static List<InetSocketAddress> getNameNodesServiceRpcAddresses(
      Configuration conf); static List<InetSocketAddress> getNameNodesRPCAddresses(
      Configuration conf); static List<URI> getNameNodesRPCAddressesAsURIs(Configuration conf); static String joinNameNodesRpcAddresses(
      List<InetSocketAddress> namenodes); static String joinNameNodesHostPortString(List<String> namenodes); static URI getInfoServer(InetSocketAddress namenodeAddr,
      Configuration conf, String scheme); static URI getInfoServerWithDefaultHost(String defaultHost,
      Configuration conf, final String scheme); static String getHttpClientScheme(Configuration conf); static List<URI> getNsServiceRpcUris(Configuration conf); static boolean isLogicalUri(Configuration conf, URI nameNodeUri); static URI createHDFSUri(String server); static Configuration loadSslConfiguration(Configuration conf); static HttpServer2.Builder httpServerTemplateForNNAndJN(
      Configuration conf, final InetSocketAddress httpAddr,
      final InetSocketAddress httpsAddr, String name, String spnegoUserNameKey,
      String spnegoKeytabFileKey); static Map<String, Map<String, InetSocketAddress>> getHaNnRpcAddresses(Configuration conf); static String dateToIso8601String(Date date); static String durationToString(long durationMs); static long parseRelativeTime(String relTime); static KeyProvider createKeyProvider(
      final Configuration conf); static KeyProviderCryptoExtension createKeyProviderCryptoExtension(
      final Configuration conf); static final Log LOG; static final Comparator<DatanodeInfo> DECOM_COMPARATOR; static Options helpOptions; static Option helpOpt; }
@Test(timeout = 5000) public void testGetSpnegoKeytabKey() { HdfsConfiguration conf = new HdfsConfiguration(); String defaultKey = "default.spengo.key"; conf.unset(DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY); assertEquals("Test spnego key in config is null", defaultKey, DFSUtil.getSpnegoKeytabKey(conf, defaultKey)); conf.set(DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY, ""); assertEquals("Test spnego key is empty", defaultKey, DFSUtil.getSpnegoKeytabKey(conf, defaultKey)); String spengoKey = "spengo.key"; conf.set(DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY, spengoKey); assertEquals("Test spnego key is NOT null", DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY, DFSUtil.getSpnegoKeytabKey(conf, defaultKey)); }