@Test void testGetBlob() throws Exception { OSSObject ossObject = new OSSObject(); ossObject.setKey(FILENAME); ossObject.setObjectContent(new ByteArrayInputStream(PAYLOAD.getBytes())); Mockito.when(blobUtils.blobBuilder()) .thenReturn(new BlobBuilderImpl()); Mockito.when(ossClient.getObject(any(GetObjectRequest.class))) .thenReturn(ossObject); Blob blob = aliOSSBlobStore.getBlob(CONTAINER, FILENAME); String actualPayload = IOUtils.toString(blob.getPayload() .openStream(), StandardCharsets.UTF_8); assertEquals(PAYLOAD, actualPayload); }
@Override public Blob getBlob(String container, String name, GetOptions options) { return doOssOperation(oss -> { GetObjectRequest req = toGetObjectRequest(container, name, options); OSSObject object = oss.getObject(req); return convertToBlob(object); }, false); }
AliOSSBlobStore extends BaseBlobStore { @Override public Blob getBlob(String container, String name, GetOptions options) { return doOssOperation(oss -> { GetObjectRequest req = toGetObjectRequest(container, name, options); OSSObject object = oss.getObject(req); return convertToBlob(object); }, false); } }
AliOSSBlobStore extends BaseBlobStore { @Override public Blob getBlob(String container, String name, GetOptions options) { return doOssOperation(oss -> { GetObjectRequest req = toGetObjectRequest(container, name, options); OSSObject object = oss.getObject(req); return convertToBlob(object); }, false); } @Inject protected  AliOSSBlobStore(AliOSSApi aliOSSApi, BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
                              LocationsSupplier locations, PayloadSlicer slicer); }
AliOSSBlobStore extends BaseBlobStore { @Override public Blob getBlob(String container, String name, GetOptions options) { return doOssOperation(oss -> { GetObjectRequest req = toGetObjectRequest(container, name, options); OSSObject object = oss.getObject(req); return convertToBlob(object); }, false); } @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 Blob getBlob(String container, String name, GetOptions options) { return doOssOperation(oss -> { GetObjectRequest req = toGetObjectRequest(container, name, options); OSSObject object = oss.getObject(req); return convertToBlob(object); }, false); } @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();  }