SWJTU-ZhangLei commented on PR #50703:
URL: https://github.com/apache/doris/pull/50703#issuecomment-2871414229

           new MockUp<S3Client>(S3Client.class) {
               @Mock
               public ListObjectsV2Response listObjectsV2(ListObjectsV2Request 
listObjectsV2Request) {
                   ListObjectsV2Response.Builder builder = 
ListObjectsV2Response.builder();
                   List<S3Object> s3Objects = new ArrayList<>();
                   String prefix = listObjectsV2Request.prefix();
                   String continuationToken = 
listObjectsV2Request.continuationToken();
                   int startIndex = 0;
                   if (continuationToken != null) {
                       startIndex = Integer.parseInt(continuationToken);
                   }
                   int endIndex = Math.min(startIndex + numBatch, 
allObjKeys.size());
                   for (int i = startIndex; i < endIndex; ++i) {
                       String objKey = allObjKeys.get(i);
                       if (prefix != null && !objKey.startsWith(prefix)) {
                           continue;
                       }
                       s3Objects.add(S3Object.builder().key(objKey).build());
                   }
                   builder.contents(s3Objects);
                   if (endIndex < allObjKeys.size()) {
                       builder.isTruncated(true);
                       builder.nextContinuationToken(String.valueOf(endIndex));
                   } else {
                       builder.isTruncated(false);
                       builder.nextContinuationToken(null);
                   }
                   return builder.build();
               } mock没生效
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to