【发布时间】:2019-03-12 08:13:15
【问题描述】:
我正在黄瓜中测试测试,我想将文件从 testData 上传到 S3 存储桶:
String bucket = bucketname+ "/ADL";
String ActualFilesPathForComparison = Environment.getInstance().getValue(DATAINPUTPATH);
temp = ActualFilesPathForComparison+inputPath+ File.separator+ file;
s3.uploadFile(bucket, file, new File (temp));
public void uploadFile(String bucketName, String fileKeyName, File localFilePath) {
try {
this.s3.putObject((new PutObjectRequest(bucketName, fileKeyName, localFilePath)).withCannedAcl(CannedAccessControlList.PublicRead));
} catch (Exception var5) {
throw new RuntimeException("Upload file failed.", var5);
}
}
我有这个文件:
src\main\resources\testData\testInputsFile\testLZInputUnZippedFiles\Log.csv
当我运行测试时,我从调试中得到:
localFilePath = testData\testInputsFile\testLZInputUnZippedFiles\Log_WithHeader.csv
得到例外:
com.amazonaws.SdkClientException: Unable to calculate MD5 hash: testData\testInputsFile\testLZInputUnZippedFiles\Log_WithHeader.csv (The system cannot find the path specified)
我应该修复什么?我想避免从 src 复制文件。
【问题讨论】:
标签: java amazon-s3 file-upload cucumber