简单测试

This commit is contained in:
Shikong 2023-03-29 21:31:13 +08:00
parent 54a6ece1f1
commit bf4364a3b6
2 changed files with 5 additions and 13 deletions

View File

@ -2,14 +2,12 @@ package cn.skcks.study.springcloud.project01.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Data
@Configuration
@ConfigurationProperties(prefix = "seaweedfs")
public class SeaweedfsConfig {
public class SeaweedFsConfig {
private String url;
private String accessKey;
private String secretKey;

View File

@ -1,14 +1,11 @@
package cn.skcks.study.springcloud.project01;
import cn.skcks.study.springcloud.project01.config.SeaweedfsConfig;
import cn.skcks.study.springcloud.project01.config.SeaweedFsConfig;
import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.PutObjectArgs;
import io.minio.errors.*;
import io.minio.messages.Bucket;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -18,13 +15,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
@ -36,13 +30,13 @@ public class ApplicationTest {
public static void main(String[] args) {
SpringApplication.run(ApplicationTest.class,args);
}
private SeaweedfsConfig seaweedfsConfig;
private SeaweedFsConfig seaweedFsConfig;
private MinioClient mc;
private final static String bucket = "simple-test";
@Autowired
public void setSeaweedfsConfig(SeaweedfsConfig seaweedfsConfig) {
this.seaweedfsConfig = seaweedfsConfig;
public void setSeaweedFsConfig(SeaweedFsConfig seaweedfsConfig) {
this.seaweedFsConfig = seaweedfsConfig;
log.info("{}",seaweedfsConfig);
this.mc = MinioClient.builder()
.endpoint(seaweedfsConfig.getUrl())