zoukankan      html  css  js  c++  java
  • 3 测试docker文件上传功能

    上一篇我们在docker中安装好了fastdfs,本篇就来上传一个图片进行测试

    创建springboot项目,添加依赖

            <dependency>
                <groupId>net.oschina.zcx7878</groupId>
                <artifactId>fastdfs-client-java</artifactId>
                <version>1.27.0.0</version>
            </dependency>
    

     更改地址

     书写测试类

        @Test
        void contextLoads() throws IOException, MyException {
    
            ClientGlobal.initByProperties("fastdfs-client.properties");
            TrackerClient trackerClient = new TrackerClient();
            TrackerServer trackerServer = trackerClient.getConnection();
            StorageServer storageServer=null;
            StorageClient1 client1 = new StorageClient1(trackerServer, storageServer);
            NameValuePair pairs[]=null;
            String fileId = client1.upload_file1("G:\a.jpg", "jpg", pairs);
            System.out.println(fileId);
    
        }
    

      运行后返回

    查看文件

    访问文件

  • 相关阅读:
    方法
    数组
    Scanner类+Random
    运算符2
    运算符1
    Linux中Oracle的安装
    redis安装常见错误
    redis常用命令
    Linux中redis安装
    修改Oracle字符集
  • 原文地址:https://www.cnblogs.com/gfbzs/p/13461683.html
Copyright © 2011-2022 走看看