-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(oss): 修改私有访问的 bucket previewUrl 链接的拼接
- Loading branch information
1 parent
ba6d8f4
commit 2632aa7
Showing
4 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...pring-boot-starter/src/test/java/com/admin4j/oss/impl/SimpleOSSUploadFileServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.admin4j.oss.impl; | ||
|
||
import com.admin4j.oss.AmazonS3Factory; | ||
import com.admin4j.oss.OssProperties; | ||
import com.amazonaws.services.s3.AmazonS3; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author andanyang | ||
* @since 2023/11/10 9:48 | ||
*/ | ||
class SimpleOSSUploadFileServiceTest { | ||
|
||
static SimpleOSSUploadFileService simpleOSSUploadFileService; | ||
|
||
@BeforeAll | ||
public static void init() { | ||
|
||
OssProperties ossProperties = new OssProperties(); | ||
ossProperties.setEndpoint("http://192.168.1.13:9901/"); | ||
ossProperties.setAccessKey("4NdsQG6g6hzJfwko"); | ||
ossProperties.setSecretKey("zeSSPz3WC3Wn4zBZsYtxK9YXhZ7Hjnnv"); | ||
ossProperties.setBucket("crm-email"); | ||
ossProperties.setPreviewUrl("http://192.168.1.13:9902/crm-email"); | ||
ossProperties.setIntranetUrl("http://192.168.1.13:9902/crm/"); | ||
ossProperties.setExpires(300); | ||
|
||
ossProperties.init(); | ||
|
||
AmazonS3 amazonS3 = AmazonS3Factory.create(ossProperties); | ||
OssTemplateImpl ossTemplate = new OssTemplateImpl(amazonS3, ossProperties); | ||
|
||
simpleOSSUploadFileService = new SimpleOSSUploadFileService(ossTemplate, ossProperties); | ||
} | ||
|
||
@Test | ||
void getPreviewUrl() { | ||
|
||
String previewUrl = simpleOSSUploadFileService.getPreviewUrl("attachment/20231005/cc56268d64944a7348d43741129292fa.jpg"); | ||
System.out.println("previewUrl = " + previewUrl); | ||
} | ||
|
||
@Test | ||
void getPrivateUrl() { | ||
} | ||
|
||
@Test | ||
void testGetPrivateUrl() { | ||
} | ||
|
||
@Test | ||
void getPreviewIntranetUrl() { | ||
} | ||
} |