use of com.qcloud.cos.model.ListNextBatchOfObjectsRequest in project cos-java-sdk-v5 by tencentyun.
the class ListObjectTest method ListNextBatchObjectWithTrunCated.
@Test
public void ListNextBatchObjectWithTrunCated() {
if (!judgeUserInfoValid()) {
return;
}
ObjectListing objectListingPrev = new ObjectListing();
objectListingPrev.setBucketName(bucket);
objectListingPrev.setPrefix(keyPrefix);
objectListingPrev.setNextMarker("");
objectListingPrev.setMaxKeys(100);
objectListingPrev.setDelimiter("");
objectListingPrev.setTruncated(false);
ListNextBatchOfObjectsRequest listNextBatchOfObjectsRequest = new ListNextBatchOfObjectsRequest(objectListingPrev);
ObjectListing objectListingNext = cosclient.listNextBatchOfObjects(listNextBatchOfObjectsRequest);
assertEquals(bucket, objectListingNext.getBucketName());
assertEquals(objectListingPrev.isTruncated(), objectListingNext.isTruncated());
assertEquals(objectListingPrev.getMaxKeys(), objectListingNext.getMaxKeys());
assertEquals(objectListingPrev.getNextMarker(), objectListingNext.getMarker());
assertEquals(0L, objectListingNext.getCommonPrefixes().size());
assertEquals(0L, objectListingNext.getObjectSummaries().size());
}
use of com.qcloud.cos.model.ListNextBatchOfObjectsRequest in project cos-java-sdk-v5 by tencentyun.
the class ListObjectTest method ListNextBatchObjectWithNoTrunCated.
@Test
public void ListNextBatchObjectWithNoTrunCated() {
if (!judgeUserInfoValid()) {
return;
}
ObjectListing objectListingPrev = new ObjectListing();
objectListingPrev.setBucketName(bucket);
objectListingPrev.setPrefix(keyPrefix);
objectListingPrev.setNextMarker("");
objectListingPrev.setMaxKeys(100);
objectListingPrev.setDelimiter("");
objectListingPrev.setTruncated(true);
ListNextBatchOfObjectsRequest listNextBatchOfObjectsRequest = new ListNextBatchOfObjectsRequest(objectListingPrev);
ObjectListing objectListingNext = cosclient.listNextBatchOfObjects(listNextBatchOfObjectsRequest);
assertEquals(0L, objectListingNext.getCommonPrefixes().size());
assertEquals(arrayNum, objectListingNext.getObjectSummaries().size());
List<COSObjectSummary> objectSummaries = objectListingNext.getObjectSummaries();
for (int i = 0; i < arrayNum; ++i) {
COSObjectSummary cosObjectSummary = objectSummaries.get(i);
String expectedKey = String.format("%s/%dk.txt", keyPrefix, i);
assertEquals(expectedKey, cosObjectSummary.getKey());
assertEquals(i * 1024L, cosObjectSummary.getSize());
}
}
Aggregations