/** * Get the current username, before any encoding has been applied. * @return the current user from the kerberos identity, falling back * to the user and/or env variables. */ private static String currentUsernameUnencoded() { String env_hadoop_username = System.getenv( RegistryInternalConstants.HADOOP_USER_NAME); return getCurrentUsernameUnencoded(env_hadoop_username); }
/** * Get the current username, before any encoding has been applied. * @return the current user from the kerberos identity, falling back * to the user and/or env variables. */ public static String currentUsernameUnencoded() { String env_hadoop_username = System.getenv( RegistryInternalConstants.HADOOP_USER_NAME); return getCurrentUsernameUnencoded(env_hadoop_username); }
/** * Get the current username, before any encoding has been applied. * @return the current user from the kerberos identity, falling back * to the user and/or env variables. */ public static String currentUsernameUnencoded() { String env_hadoop_username = System.getenv( RegistryInternalConstants.HADOOP_USER_NAME); return getCurrentUsernameUnencoded(env_hadoop_username); }
/** * Get the current username, before any encoding has been applied. * @return the current user from the kerberos identity, falling back * to the user and/or env variables. */ private static String currentUsernameUnencoded() { String env_hadoop_username = System.getenv( RegistryInternalConstants.HADOOP_USER_NAME); return getCurrentUsernameUnencoded(env_hadoop_username); }
@Test public void testUsernameExtractionCurrentuser() throws Throwable { String whoami = RegistryUtils.getCurrentUsernameUnencoded(""); String ugiUser = UserGroupInformation.getCurrentUser().getShortUserName(); assertEquals(ugiUser, whoami); }
@Test public void testUsernameExtractionCurrentuser() throws Throwable { String whoami = RegistryUtils.getCurrentUsernameUnencoded(""); String ugiUser = UserGroupInformation.getCurrentUser().getShortUserName(); assertEquals(ugiUser, whoami); }
@Test public void testUsernameExtractionEnvVarOverrride() throws Throwable { String whoami = RegistryUtils.getCurrentUsernameUnencoded("drwho"); assertEquals("drwho", whoami); }
@Test public void testUsernameExtractionEnvVarOverrride() throws Throwable { String whoami = RegistryUtils.getCurrentUsernameUnencoded("drwho"); assertEquals("drwho", whoami); }