private DelegationTokenIdentifier getID(String tokenStr) throws IOException {
    DelegationTokenIdentifier id = new DelegationTokenIdentifier();
    Token<DelegationTokenIdentifier> token = new Token<>();
    token.decodeFromUrlString(tokenStr);
    try (DataInputStream in = new DataInputStream(
        new ByteArrayInputStream(token.getIdentifier()))) {
      id.readFields(in);
    }
    return id;
  }
Test the renewal of Delegation tokens obtained from the Metastore.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/security/TestTokenStoreDelegationTokenSecretManager.java