});
}
@Test
public void testRenewDelegationTokenWithoutKerberos() throws Exception {
final JobTracker jt = cluster.getJobTrackerRunner().getJobTracker();
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
ugi.setAuthenticationMethod(AuthenticationMethod.TOKEN);
config.set(CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION,
"kerberos");
// Set configuration again so that job tracker finds security enabled
UserGroupInformation.setConfiguration(config);
Assert.assertTrue(UserGroupInformation.isSecurityEnabled());
final Token<DelegationTokenIdentifier> token = generateDelegationToken(
"owner", ugi.getShortUserName());
ugi.doAs(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
try {
jt.renewDelegationToken(token);
Assert
.fail("Delegation token should not be renewed without Kerberos authentication");
} catch (IOException e) {
// success
}