### Question:
DFSClientCache { UserGroupInformation getUserGroupInformation( String effectiveUser, UserGroupInformation realUser) throws IOException { Preconditions.checkNotNull(effectiveUser); Preconditions.checkNotNull(realUser); realUser.checkTGTAndReloginFromKeytab(); UserGroupInformation ugi = UserGroupInformation.createProxyUser(effectiveUser, realUser); if (LOG.isDebugEnabled()){ LOG.debug(String.format("Created ugi:" + " %s for username: %s", ugi, effectiveUser)); } return ugi; } DFSClientCache(NfsConfiguration config);   DFSClientCache(NfsConfiguration config, int clientCache); void invalidateDfsInputStream(String userName, String inodePath); static final int SHUTDOWN_HOOK_PRIORITY; }### Answer:
@Test public void testGetUserGroupInformationSecure() throws IOException { String userName = "user1"; String currentUser = "test-user"; NfsConfiguration conf = new NfsConfiguration(); UserGroupInformation currentUserUgi = UserGroupInformation.createRemoteUser(currentUser); currentUserUgi.setAuthenticationMethod(KERBEROS); UserGroupInformation.setLoginUser(currentUserUgi); DFSClientCache cache = new DFSClientCache(conf); UserGroupInformation ugiResult = cache.getUserGroupInformation(userName, currentUserUgi); assertThat(ugiResult.getUserName(), is(userName)); assertThat(ugiResult.getRealUser(), is(currentUserUgi)); assertThat( ugiResult.getAuthenticationMethod(), is(UserGroupInformation.AuthenticationMethod.PROXY)); }
@Test public void testGetUserGroupInformation() throws IOException { String userName = "user1"; String currentUser = "currentUser"; UserGroupInformation currentUserUgi = UserGroupInformation .createUserForTesting(currentUser, new String[0]); NfsConfiguration conf = new NfsConfiguration(); conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "hdfs: DFSClientCache cache = new DFSClientCache(conf); UserGroupInformation ugiResult = cache.getUserGroupInformation(userName, currentUserUgi); assertThat(ugiResult.getUserName(), is(userName)); assertThat(ugiResult.getRealUser(), is(currentUserUgi)); assertThat( ugiResult.getAuthenticationMethod(), is(UserGroupInformation.AuthenticationMethod.PROXY)); }