embulk-input-sftp 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df31c9ece3349f98ed7d6cb077ea54d93eb03983
4
- data.tar.gz: 86a2988731cc55a81ed7e191eb453b952a3d13a4
3
+ metadata.gz: 6b0613256f73dca8ccdec6e3f5f37b551d967f80
4
+ data.tar.gz: 59136d00ccd17ab0d1a4ece5d1c061deda3d6651
5
5
  SHA512:
6
- metadata.gz: 5200a610d8dbcde6e46597d9749504da4e1afdeb44f1803c1ff162204ccb96f4eab73397ec889046111b6adf6677653521696fa4e88f4d35e5a0b9c4e3998fe2
7
- data.tar.gz: 33a363400d78fd010f238a0270f7e086610ba9a9bc9ea25cf59dcf2d03fb66f09198f5df0aa35ea46545fea2dded4eaa5264cc9a56aaf2c604cb49b424617171
6
+ metadata.gz: e2e6035fff5490c1ac3403f02e5d83b845347018e4bccf09f3d47971bf9a78e1d48d2e3c63650600089429dfad469e81e9cdce234e906c3f5a36eff5ef670427
7
+ data.tar.gz: db80accf97beba6ba00d546728913c74a6992e93068da7ae69775545468713cc5d0a0b11eced97de9173bd4ca05313958d07aa881eaa22d94475e25554c7d5bf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.5 - 2017-06-20
2
+
3
+ * [maintenance] Fix bug path_prefix extension are removed [#23](https://github.com/sakama/embulk-input-sftp/pull/23)
4
+
1
5
  ## 0.2.4 - 2017-06-05
2
6
 
3
7
  * [maintenance] Improve logic for remote file search with path_prefix [#22](https://github.com/sakama/embulk-input-sftp/pull/22)
data/build.gradle CHANGED
@@ -16,7 +16,7 @@ configurations {
16
16
  }
17
17
 
18
18
  group = "org.embulk.input.sftp"
19
- version = "0.2.4"
19
+ version = "0.2.5"
20
20
 
21
21
  sourceCompatibility = 1.7
22
22
  targetCompatibility = 1.7
@@ -197,7 +197,7 @@ public class SftpFileInput
197
197
  }
198
198
 
199
199
  FileObject files = manager.resolveFile(getSftpFileUri(task, task.getPathPrefix()), fsOptions);
200
- String basename = FilenameUtils.getBaseName(task.getPathPrefix());
200
+
201
201
  if (files.isFolder()) {
202
202
  //path_prefix is a folder, we add everything in that folder
203
203
  FileObject[] children = files.getChildren();
@@ -218,9 +218,10 @@ public class SftpFileInput
218
218
  FileObject parent = files.getParent();
219
219
  FileObject[] children = parent.getChildren();
220
220
  Arrays.sort(children);
221
+ String fileName = FilenameUtils.getName(task.getPathPrefix());
221
222
  for (FileObject f : children) {
222
223
  if (f.isFile()) {
223
- addFileToList(builder, f.toString(), f.getContent().getSize(), basename, lastKey);
224
+ addFileToList(builder, f.toString(), f.getContent().getSize(), fileName, lastKey);
224
225
  }
225
226
  }
226
227
  }
@@ -234,6 +234,29 @@ public class TestSftpFileInputPlugin
234
234
  assertEquals(SftpFileInput.getRelativePath(task, Optional.of(expected.get(1).get(0))), configDiff.get(String.class, "last_path"));
235
235
  }
236
236
 
237
+ @Test
238
+ public void testListFilesWithPathPrefixPointToFile() throws Exception
239
+ {
240
+ uploadFile(Resources.getResource("sample_01.csv").getPath(), REMOTE_DIRECTORY + "sample_01.csv", true);
241
+ ConfigSource configSource = config.deepCopy();
242
+ configSource.set("path_prefix", REMOTE_DIRECTORY + "not_exist.csv");
243
+ PluginTask task = configSource.loadConfig(PluginTask.class);
244
+ FileList actual = (FileList) SftpFileInput.listFilesByPrefix(task);
245
+ assertEquals(0, actual.getTaskCount());
246
+ }
247
+
248
+ @Test
249
+ public void testListFilesWithPathPrefix() throws Exception
250
+ {
251
+ uploadFile(Resources.getResource("sample_01.csv").getPath(), REMOTE_DIRECTORY + "sample_01.csv", true);
252
+ ConfigSource configSource = config.deepCopy();
253
+ configSource.set("path_prefix", REMOTE_DIRECTORY + "sample_01");
254
+ PluginTask task = configSource.loadConfig(PluginTask.class);
255
+ FileList actual = (FileList) SftpFileInput.listFilesByPrefix(task);
256
+ assertEquals(1, actual.getTaskCount());
257
+ assertEquals(actual.get(0).get(0), "sftp://username:password@127.0.0.1:20022/home/username/unittest/sample_01.csv");
258
+ }
259
+
237
260
  @Test
238
261
  public void testSftpInputByOpen() throws Exception
239
262
  {
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-sftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: '1.0'
19
+ name: bundler
25
20
  prerelease: false
26
21
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '10.0'
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '10.0'
33
+ name: rake
39
34
  prerelease: false
40
35
  type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
41
  description: Reads files stored on remote server using SFTP.
42
42
  email:
43
43
  - satoshiakama@gmail.com
@@ -69,11 +69,11 @@ files:
69
69
  - src/test/resources/id_rsa.pub
70
70
  - src/test/resources/sample_01.csv
71
71
  - src/test/resources/sample_02.csv
72
+ - classpath/jsch-0.1.53.jar
72
73
  - classpath/commons-io-1.3.2.jar
73
74
  - classpath/commons-logging-1.2.jar
75
+ - classpath/embulk-input-sftp-0.2.5.jar
74
76
  - classpath/commons-vfs2-2.1.jar
75
- - classpath/embulk-input-sftp-0.2.4.jar
76
- - classpath/jsch-0.1.53.jar
77
77
  homepage: https://github.com/embulk/embulk-input-sftp
78
78
  licenses:
79
79
  - Apache-2.0