@Test @Tag("S3Test") public void testMoveFileToWorkFolder() { amazonS3.putObject(BUCKET_NAME, "_unittest/forMove/dummyfile.txt", "dummy"); var newResource = handler.moveFileToWorkFolder(BUCKET_NAME, "_unittest/forMove/dummyfile.txt", "_unittest/forMove", "_work"); assertThat(newResource.getFilename()).isEqualTo("_unittest/forMove_work/dummyfile.txt"); assertThatThrownBy(() -> amazonS3.getObject(BUCKET_NAME, "_unittest/forMove/dummyfile.txt")) .isInstanceOfSatisfying(AmazonS3Exception.class, e -> assertThat(e.getMessage()).startsWith("The resource you requested does not exist")); assertThat(amazonS3.getObject(BUCKET_NAME, "_unittest/forMove_work/dummyfile.txt")).isNotNull(); }
public Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix) { var newFilePath = filePath.replaceFirst(folderName, folderName + workFolderSuffix); copyFile(bucketName, filePath, bucketName, newFilePath); deleteFile(bucketName, filePath); return resolver.getResource("s3: }
S3FileHandler { public Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix) { var newFilePath = filePath.replaceFirst(folderName, folderName + workFolderSuffix); copyFile(bucketName, filePath, bucketName, newFilePath); deleteFile(bucketName, filePath); return resolver.getResource("s3: } }
S3FileHandler { public Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix) { var newFilePath = filePath.replaceFirst(folderName, folderName + workFolderSuffix); copyFile(bucketName, filePath, bucketName, newFilePath); deleteFile(bucketName, filePath); return resolver.getResource("s3: } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); }
S3FileHandler { public Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix) { var newFilePath = filePath.replaceFirst(folderName, folderName + workFolderSuffix); copyFile(bucketName, filePath, bucketName, newFilePath); deleteFile(bucketName, filePath); return resolver.getResource("s3: } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern); void deleteFile(String bucketName, String filePath); void copyFile(String fromBucketName, String fromFilePath, String toBucketName, String toFilePath); Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix); void deleteAllFilesInFolder(String bucketName, String folderPath); void deleteAllFilesInFolderExcept(String bucketName, String folderPath, List<String> excludeList); }
S3FileHandler { public Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix) { var newFilePath = filePath.replaceFirst(folderName, folderName + workFolderSuffix); copyFile(bucketName, filePath, bucketName, newFilePath); deleteFile(bucketName, filePath); return resolver.getResource("s3: } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern); void deleteFile(String bucketName, String filePath); void copyFile(String fromBucketName, String fromFilePath, String toBucketName, String toFilePath); Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix); void deleteAllFilesInFolder(String bucketName, String folderPath); void deleteAllFilesInFolderExcept(String bucketName, String folderPath, List<String> excludeList);  }