44import com .google .common .base .Optional ;
55import com .google .common .collect .Lists ;
66import com .google .common .io .Resources ;
7- import org .apache .commons .vfs2 .FileSystemException ;
87import org .apache .sshd .common .NamedFactory ;
98import org .apache .sshd .common .file .virtualfs .VirtualFileSystemFactory ;
109import org .apache .sshd .server .Command ;
3029import org .embulk .spi .Schema ;
3130import org .embulk .spi .TransactionalPageOutput ;
3231import org .embulk .spi .time .Timestamp ;
33- import org .hamcrest .CoreMatchers ;
3432import org .junit .After ;
3533import org .junit .Before ;
3634import org .junit .Rule ;
@@ -187,7 +185,7 @@ private List<String> lsR(List<String> fileNames, Path dir)
187185 return fileNames ;
188186 }
189187
190- private void run (String configYaml , final Optional < Integer > sleep )
188+ private void run (String configYaml )
191189 {
192190 ConfigSource config = getConfigFromYaml (configYaml );
193191 runner .transaction (config , SCHEMA , 1 , new Control ()
@@ -206,16 +204,10 @@ public List<TaskReport> run(TaskSource taskSource)
206204 true , 2L , 3.0D , "45" , Timestamp .ofEpochMilli (678L ), newMap (newString ("k" ), newString ("v" )),
207205 true , 2L , 3.0D , "45" , Timestamp .ofEpochMilli (678L ), newMap (newString ("k" ), newString ("v" )))) {
208206 pageOutput .add (page );
209- if (sleep .isPresent ()) {
210- Thread .sleep (sleep .get () * 1000 );
211- }
212207 }
213208 pageOutput .commit ();
214209 committed = true ;
215210 }
216- catch (InterruptedException e ) {
217- logger .debug (e .getMessage (), e );
218- }
219211 finally {
220212 if (!committed ) {
221213 pageOutput .abort ();
@@ -374,7 +366,7 @@ public void testUserPasswordAndPutToUserDirectoryRoot()
374366 " default_timezone: 'UTC'" ;
375367
376368 // runner.transaction -> ...
377- run (configYaml , Optional .< Integer > absent () );
369+ run (configYaml );
378370
379371 List <String > fileList = lsR (Lists .<String >newArrayList (), Paths .get (testFolder .getRoot ().getAbsolutePath ()));
380372 assertThat (fileList , hasItem (containsString (pathPrefix + "001.00.txt" )));
@@ -410,7 +402,7 @@ public void testUserSecretKeyFileAndPutToRootDirectory()
410402 " default_timezone: 'UTC'" ;
411403
412404 // runner.transaction -> ...
413- run (configYaml , Optional .< Integer > absent () );
405+ run (configYaml );
414406
415407 List <String > fileList = lsR (Lists .<String >newArrayList (), Paths .get (testFolder .getRoot ().getAbsolutePath ()));
416408 assertThat (fileList , hasItem (containsString (pathPrefix + "001.00.txt" )));
@@ -458,7 +450,7 @@ public void testUserSecretKeyFileWithProxy()
458450 " default_timezone: 'UTC'" ;
459451
460452 // runner.transaction -> ...
461- run (configYaml , Optional .< Integer > absent () );
453+ run (configYaml );
462454
463455 List <String > fileList = lsR (Lists .<String >newArrayList (), Paths .get (testFolder .getRoot ().getAbsolutePath ()));
464456 assertThat (fileList , hasItem (containsString (pathPrefix + "001.00.txt" )));
@@ -474,42 +466,6 @@ public void testUserSecretKeyFileWithProxy()
474466 }
475467 }
476468
477- @ Test
478- public void testTimeout ()
479- {
480- // setting embulk config
481- final String pathPrefix = "/test/testUserPassword" ;
482- String configYaml = "" +
483- "type: sftp\n " +
484- "host: " + HOST + "\n " +
485- "port: " + PORT + "\n " +
486- "user: " + USERNAME + "\n " +
487- "secret_key_file: " + SECRET_KEY_FILE + "\n " +
488- "secret_key_passphrase: " + SECRET_KEY_PASSPHRASE + "\n " +
489- "path_prefix: " + testFolder .getRoot ().getAbsolutePath () + pathPrefix + "\n " +
490- "timeout: 1\n " +
491- "file_ext: txt\n " +
492- "formatter:\n " +
493- " type: csv\n " +
494- " newline: CRLF\n " +
495- " newline_in_field: LF\n " +
496- " header_line: true\n " +
497- " charset: UTF-8\n " +
498- " quote_policy: NONE\n " +
499- " quote: \" \\ \" \" \n " +
500- " escape: \" \\ \\ \" \n " +
501- " null_string: \" \" \n " +
502- " default_timezone: 'UTC'" ;
503-
504- // exception
505- exception .expect (RuntimeException .class );
506- exception .expectCause (CoreMatchers .<Throwable >instanceOf (FileSystemException .class ));
507- exception .expectMessage ("Could not connect to SFTP server" );
508-
509- // runner.transaction -> ...
510- run (configYaml , Optional .of (60 )); // sleep 1 minute while processing
511- }
512-
513469 @ Test
514470 public void testProxyType ()
515471 {
0 commit comments