@Test void testList() throws Exception { ObjectListing objectListing = new ObjectListing(); objectListing.setBucketName(CONTAINER); objectListing.setObjectSummaries(getObjectSummaries(3)); Mockito.when(ossClient.listObjects(any(ListObjectsRequest.class))) .thenReturn(objectListing); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setUserMetadata(getUserMetadata()); Mockito.when(ossClient.getObjectMetadata(any(String.class), any(String.class))) .thenReturn(objectMetadata); Mockito.when(ossClient.generatePresignedUrl(any(), any(), any())) .thenReturn(new URL("https: aliOSSBlobStore.list(CONTAINER, new ListContainerOptions().withDetails()) .forEach(storageMetadata -> { assertTrue(storageMetadata.getName() .startsWith(FILENAME)); assertEquals(PAYLOAD.length(), storageMetadata.getSize()); assertTrue(storageMetadata.getETag() .startsWith(FILENAME)); assertEquals(getUserMetadata(), storageMetadata.getUserMetadata()); }); }
@Override public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) { return doOssOperation(oss -> { ListObjectsRequest request = toListObjectRequest(container, options); ObjectListing objectListing = oss.listObjects(request); List<StorageMetadata> storageMetadataList = toStorageMetadataList(oss, container, objectListing); return new PageSetImpl<>(storageMetadataList, objectListing.getNextMarker()); }); }
AliOSSBlobStore extends BaseBlobStore { @Override public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) { return doOssOperation(oss -> { ListObjectsRequest request = toListObjectRequest(container, options); ObjectListing objectListing = oss.listObjects(request); List<StorageMetadata> storageMetadataList = toStorageMetadataList(oss, container, objectListing); return new PageSetImpl<>(storageMetadataList, objectListing.getNextMarker()); }); } }
AliOSSBlobStore extends BaseBlobStore { @Override public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) { return doOssOperation(oss -> { ListObjectsRequest request = toListObjectRequest(container, options); ObjectListing objectListing = oss.listObjects(request); List<StorageMetadata> storageMetadataList = toStorageMetadataList(oss, container, objectListing); return new PageSetImpl<>(storageMetadataList, objectListing.getNextMarker()); }); } @Inject protected  AliOSSBlobStore(AliOSSApi aliOSSApi, BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
                              LocationsSupplier locations, PayloadSlicer slicer); }
AliOSSBlobStore extends BaseBlobStore { @Override public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) { return doOssOperation(oss -> { ListObjectsRequest request = toListObjectRequest(container, options); ObjectListing objectListing = oss.listObjects(request); List<StorageMetadata> storageMetadataList = toStorageMetadataList(oss, container, objectListing); return new PageSetImpl<>(storageMetadataList, objectListing.getNextMarker()); }); } @Inject protected  AliOSSBlobStore(AliOSSApi aliOSSApi, BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
                              LocationsSupplier locations, PayloadSlicer slicer); @Override boolean containerExists(String container); @Override PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options); @Override boolean blobExists(String container, String name); @Override String putBlob(String container, Blob blob); @Override String putBlob(String container, Blob blob, PutOptions options); @Override Blob getBlob(String container, String name, GetOptions options); @Override void removeBlob(String container, String name); @Override PageSet<? extends StorageMetadata> list(); @Override boolean createContainerInLocation(Location location, String container); @Override boolean createContainerInLocation(Location location, String container, CreateContainerOptions options); @Override ContainerAccess getContainerAccess(String container); @Override void setContainerAccess(String container, ContainerAccess access); @Override BlobMetadata blobMetadata(String container, String name); @Override BlobAccess getBlobAccess(String container, String name); @Override void setBlobAccess(String container, String name, BlobAccess access); @Override MultipartUpload initiateMultipartUpload(String container, BlobMetadata blob, PutOptions options); @Override void abortMultipartUpload(MultipartUpload mpu); @Override String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts); @Override MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload); @Override List<MultipartPart> listMultipartUpload(MultipartUpload mpu); @Override List<MultipartUpload> listMultipartUploads(String container); @Override long getMinimumMultipartPartSize(); @Override long getMaximumMultipartPartSize(); @Override int getMaximumNumberOfParts(); }
AliOSSBlobStore extends BaseBlobStore { @Override public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) { return doOssOperation(oss -> { ListObjectsRequest request = toListObjectRequest(container, options); ObjectListing objectListing = oss.listObjects(request); List<StorageMetadata> storageMetadataList = toStorageMetadataList(oss, container, objectListing); return new PageSetImpl<>(storageMetadataList, objectListing.getNextMarker()); }); } @Inject protected  AliOSSBlobStore(AliOSSApi aliOSSApi, BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
                              LocationsSupplier locations, PayloadSlicer slicer); @Override boolean containerExists(String container); @Override PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options); @Override boolean blobExists(String container, String name); @Override String putBlob(String container, Blob blob); @Override String putBlob(String container, Blob blob, PutOptions options); @Override Blob getBlob(String container, String name, GetOptions options); @Override void removeBlob(String container, String name); @Override PageSet<? extends StorageMetadata> list(); @Override boolean createContainerInLocation(Location location, String container); @Override boolean createContainerInLocation(Location location, String container, CreateContainerOptions options); @Override ContainerAccess getContainerAccess(String container); @Override void setContainerAccess(String container, ContainerAccess access); @Override BlobMetadata blobMetadata(String container, String name); @Override BlobAccess getBlobAccess(String container, String name); @Override void setBlobAccess(String container, String name, BlobAccess access); @Override MultipartUpload initiateMultipartUpload(String container, BlobMetadata blob, PutOptions options); @Override void abortMultipartUpload(MultipartUpload mpu); @Override String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts); @Override MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload); @Override List<MultipartPart> listMultipartUpload(MultipartUpload mpu); @Override List<MultipartUpload> listMultipartUploads(String container); @Override long getMinimumMultipartPartSize(); @Override long getMaximumMultipartPartSize(); @Override int getMaximumNumberOfParts();  }