clolov commented on code in PR #13172: URL: https://github.com/apache/kafka/pull/13172#discussion_r1094783958
########## clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java: ########## @@ -596,22 +604,89 @@ synchronized public DeleteRecordsResult deleteRecords(Map<TopicPartition, Record @Override synchronized public CreateDelegationTokenResult createDelegationToken(CreateDelegationTokenOptions options) { - throw new UnsupportedOperationException("Not implemented yet"); + KafkaFutureImpl<DelegationToken> future = new KafkaFutureImpl<>(); + + for (KafkaPrincipal renewer : options.renewers()) { + if (!renewer.getPrincipalType().equals(KafkaPrincipal.USER_TYPE)) { + future.completeExceptionally(new InvalidPrincipalTypeException("")); + return new CreateDelegationTokenResult(future); + } + } + + String tokenId = Uuid.randomUuid().toString(); + TokenInformation tokenInfo = new TokenInformation(tokenId,options.renewers().get(0), options.renewers(),System.currentTimeMillis(), options.maxlifeTimeMs(), -1); + DelegationToken token = new DelegationToken(tokenInfo,tokenId.getBytes()); Review Comment: ```suggestion DelegationToken token = new DelegationToken(tokenInfo, tokenId.getBytes()); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org