OssClientWrapper implements InitializingBean, DisposableBean { public ObjectOperation objectOperation(String key){ return new ObjectOperation(ossProperties.getBucketName(), key, this); } 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 testWatermarkAction2() throws Exception { WaterMaskProperties config = new WaterMaskProperties(); config.setText("测试了~~"); config.setSize(100); config.setImage("test/activiti-logo.png?x-oss-process=image/resize,P_30"); this.wraper.objectOperation(bucketName, "test/test-upload.jpg") .watermask("test/test-upload-mask.jpg", config, null); }
@Test public void testVideoSnopsot() { SnapshotProperties config = new SnapshotProperties(); config.setEnabled(true); config.setTime(1000); this.wraper.objectOperation(bucketName, "test/test.mp4") .videoSnapshot(config, cutImagekey -> { System.out.println("cutImagekey: " + cutImagekey); }); }
@Test public void testResizeAction2() throws Exception { ResizeProperties config = new ResizeProperties(); config.setWidth(200); this.wraper.objectOperation(bucketName, "test/test.jpg") .resize("test/test2.jpg", config); }