我正在测试黄瓜,我想从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复制到外部。
发布于 2018-10-07 22:09:27
要访问src/main/resources/
中名为"my.properties“的文件,您只需执行以下操作:
File propertiesFile = new File(this.getClass().getClassLoader().getResource("my.properties").getFile());
https://stackoverflow.com/questions/52689017
复制相似问题