embulk-input-sftp 0.2.11 → 0.2.12

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: 525f2176e7c9834fb4ed151c692f7f8f445a2e8f
4
- data.tar.gz: ed2a712f5da1a3ad32427fb1663129b370f30228
3
+ metadata.gz: aee50a24af4aefe560e866185b937b75fd55c6de
4
+ data.tar.gz: 89a75e4a81249fb7b72a94843da40c3f46884dba
5
5
  SHA512:
6
- metadata.gz: b143a20f5ab3bf1d9c2a5d8e33935b684c005d6785b84f1d7e8f95de562ba7f7e3904d52ac980dce21581bb502f710e023bc41db1b61487d997500c5a523bd36
7
- data.tar.gz: ff8557ec6c892adc565ed7512661b3dadd29ab55ca3b3f51311baed04f760cea45973e9abac091144e7435ab35fb746d6dce3bbe691ae54b4a8a78793f0282b1
6
+ metadata.gz: 4d6ff3b1f944e43d293c1354b671f0b7e888a67c8b5375ba199ef717a5236cae3f192803f120ce267447fb10b1a11ade82cafee9b7b675f0bb5f440a3619df37
7
+ data.tar.gz: 33974b8d4d2746a0a731d0afaf72604a36ee6804fccda0ddfaea36bd79b0f1d0a44ca5e0f255b78c0ef693d9cb583d9acc7a9d028cd1f129515e6cd0f722cb8a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.12 - 2018-10-05
2
+ * [maintenance] Give up processing and throw ConfigException when "Auth fail" first appears [#33](https://github.com/embulk/embulk-input-sftp/pull/33)
3
+
1
4
  ## 0.2.11 - 2018-05-07
2
5
  * [maintenance] Use java.util.regex.Pattern for host name validation [#32](https://github.com/embulk/embulk-input-sftp/pull/32)
3
6
 
data/build.gradle CHANGED
@@ -16,7 +16,7 @@ configurations {
16
16
  }
17
17
 
18
18
  group = "org.embulk.input.sftp"
19
- version = "0.2.11"
19
+ version = "0.2.12"
20
20
 
21
21
  sourceCompatibility = 1.7
22
22
  targetCompatibility = 1.7
@@ -264,6 +264,12 @@ public class SftpFileInput
264
264
  @Override
265
265
  public boolean isRetryableException(Exception exception)
266
266
  {
267
+ if (exception.getCause() != null && exception.getCause().getCause() != null) {
268
+ Throwable cause = exception.getCause().getCause();
269
+ if (cause.getMessage() != null && cause.getMessage().contains("Auth fail")) {
270
+ throw new ConfigException(exception);
271
+ }
272
+ }
267
273
  if (exception instanceof ConfigException) {
268
274
  return false;
269
275
  }
@@ -288,14 +294,6 @@ public class SftpFileInput
288
294
  public void onGiveup(Exception firstException, Exception lastException)
289
295
  throws RetryGiveupException
290
296
  {
291
- // Generally, Auth fail should be caught and throw ConfigException when first retry. But this library is a bit unstable.
292
- // So we throw ConfigException after all retries are completed
293
- if (lastException.getCause() != null && lastException.getCause().getCause() != null) {
294
- Throwable cause = lastException.getCause().getCause();
295
- if (cause.getMessage().contains("Auth fail")) {
296
- throw new ConfigException(lastException);
297
- }
298
- }
299
297
  }
300
298
  });
301
299
  }
@@ -56,6 +56,7 @@ import java.util.Collections;
56
56
  import java.util.List;
57
57
 
58
58
  import static org.junit.Assert.assertEquals;
59
+ import static org.junit.Assert.fail;
59
60
 
60
61
  public class TestSftpFileInputPlugin
61
62
  {
@@ -248,6 +249,36 @@ public class TestSftpFileInputPlugin
248
249
  assertEquals(SftpFileInput.getRelativePath(task, Optional.of(expected.get(1).get(0))), configDiff.get(String.class, "last_path"));
249
250
  }
250
251
 
252
+ @Test
253
+ public void testListFilesAuthFail() throws Exception
254
+ {
255
+ uploadFile(Resources.getResource("sample_01.csv").getPath(), REMOTE_DIRECTORY + "sample_01.csv", true);
256
+ uploadFile(Resources.getResource("sample_02.csv").getPath(), REMOTE_DIRECTORY + "sample_02.csv", true);
257
+
258
+ PluginTask task = config.deepCopy().set("user", "wrong_user").loadConfig(PluginTask.class);
259
+
260
+ plugin.transaction(config, new FileInputPlugin.Control() {
261
+ @Override
262
+ public List<TaskReport> run(TaskSource taskSource, int taskCount)
263
+ {
264
+ assertEquals(2, taskCount);
265
+ return emptyTaskReports(taskCount);
266
+ }
267
+ });
268
+
269
+ Method listFilesByPrefix = SftpFileInput.class.getDeclaredMethod("listFilesByPrefix", PluginTask.class);
270
+ listFilesByPrefix.setAccessible(true);
271
+ try {
272
+ listFilesByPrefix.invoke(plugin, task);
273
+ fail();
274
+ }
275
+ catch (Exception ex) {
276
+ Throwable cause = ex.getCause();
277
+ assertEquals(cause.getClass(), ConfigException.class);
278
+ assertEquals(cause.getCause().getCause().getCause().getMessage(), "Auth fail");
279
+ }
280
+ }
281
+
251
282
  @Test
252
283
  public void testListFilesWithPathPrefixPointToFile() throws Exception
253
284
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-sftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2018-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -69,10 +69,10 @@ 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/commons-io-2.6.jar
73
72
  - classpath/commons-logging-1.2.jar
73
+ - classpath/embulk-input-sftp-0.2.12.jar
74
74
  - classpath/commons-vfs2-2.2.jar
75
- - classpath/embulk-input-sftp-0.2.11.jar
75
+ - classpath/commons-io-2.6.jar
76
76
  - classpath/jsch-0.1.54.jar
77
77
  homepage: https://github.com/embulk/embulk-input-sftp
78
78
  licenses: