OssClientWrapper implements InitializingBean, DisposableBean { public List<Bucket> listBuckets(){ ListBucketsRequest listBucketsRequest = new ListBucketsRequest(); listBucketsRequest.setMaxKeys(500); BucketList buckList = ossClient.listBuckets(listBucketsRequest); return buckList.getBucketList(); } OssClientWrapper(OssProperties ossProperties); @Override void destroy(); @Override void afterPropertiesSet(); Bucket createBucketIfNotExists(String bucketName); void setClinetConfig(ClientConfiguration clinetConfig); Optional<Bucket> getBucket(String bucketName, boolean createIfNotExist); List<Bucket> listBuckets(); ObjectOperation objectOperation(String key); ObjectOperation objectOperation(String bucketName, String key); String storeWithFileName(String bucketName, File file, ObjectMetadata meta); String store(String bucketName, File file, ObjectMetadata meta); String getUrl(boolean https, String bucketName, String key); PutObjectResult putObject(PutObjectRequest request); OSSClient getOssClient(); void deleteObject(String bucketName, String key);  }
@Test public void listBuckets(){ System.out.println("Listing buckets"); for (Bucket bucket : wraper.listBuckets()) { System.out.println(" - " + bucket.getName()); } System.out.println(); }