HDFS-9085. Show renewer information in DelegationTokenIdentifier#toString. Contributed by Zhihai Xu.

This commit is contained in:
cnauroth 2015-10-09 14:27:13 -07:00
parent c32614f410
commit 4f6e842ba9
3 changed files with 14 additions and 1 deletions

View File

@ -61,7 +61,8 @@ public Text getKind() {
@Override @Override
public String toString() { public String toString() {
return getKind() + " token " + getSequenceNumber() return getKind() + " token " + getSequenceNumber()
+ " for " + getUser().getShortUserName(); + " for " + getUser().getShortUserName() + " with renewer " +
getRenewer();
} }
/** @return a string representation of the token */ /** @return a string representation of the token */

View File

@ -39,6 +39,9 @@ Trunk (Unreleased)
HDFS-8981. Adding revision to data node jmx getVersion() method. (Siqi Li HDFS-8981. Adding revision to data node jmx getVersion() method. (Siqi Li
via mingma) via mingma)
HDFS-9085. Show renewer information in DelegationTokenIdentifier#toString.
(Zhihai Xu via cnauroth)
NEW FEATURES NEW FEATURES
HDFS-3125. Add JournalService to enable Journal Daemon. (suresh) HDFS-3125. Add JournalService to enable Journal Daemon. (suresh)

View File

@ -314,4 +314,13 @@ public Object run() throws Exception {
} }
}); });
} }
@Test
public void testDelegationTokenIdentifierToString() throws Exception {
DelegationTokenIdentifier dtId = new DelegationTokenIdentifier(new Text(
"SomeUser"), new Text("JobTracker"), null);
Assert.assertEquals("HDFS_DELEGATION_TOKEN token 0" +
" for SomeUser with renewer JobTracker",
dtId.toString());
}
} }