GH-75: Fix remote directory representation

Resolves spring-projects/spring-integration-aws#75

Since we can build S3 entity key any deep path,
e.g. `my_bucket/foo/bar/baz/file.name` and S3 Object `key` representation
is exactly the whole path without bucket name, we should treat only bucket
as a remote dir; the key should be as a file name

* Change `S3InboundFileSynchronizer` logic to extract bucket name before
performing `copyFileToLocalDirectory()`
* Change `S3StreamingMessageSource` to override the `S3FileInfo.remoteDirectory`
to the only bucket name after `poll()`.
* Use for both cases a new `S3Session.normalizeBucketName()` method
* Upgrade to Gradle 4.0 and some other `build.gradle` polishing
This commit is contained in:
Artem Bilan
2017-07-10 20:32:39 -04:00
parent 54782d13c5
commit d187c838b6
8 changed files with 45 additions and 21 deletions

View File

@@ -162,7 +162,7 @@ public class S3StreamingChannelAdapterTests {
S3RemoteFileTemplate s3FileTemplate = new S3RemoteFileTemplate(s3SessionFactory);
S3StreamingMessageSource s3MessageSource = new S3StreamingMessageSource(s3FileTemplate,
Comparator.comparing(FileInfo::getFilename));
s3MessageSource.setRemoteDirectory("/" + S3_BUCKET);
s3MessageSource.setRemoteDirectory("/" + S3_BUCKET + "/subdir");
s3MessageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "streaming"));
return s3MessageSource;