22
33import com .google .common .base .Charsets ;
44import com .google .common .base .Optional ;
5- import com .google .common .base .Splitter ;
6- import com .google .common .base .Throwables ;
75import com .google .common .collect .Lists ;
86import com .google .common .io .Resources ;
97import org .apache .commons .vfs2 .FileSystemException ;
3230import org .embulk .spi .TransactionalPageOutput ;
3331import org .embulk .spi .time .Timestamp ;
3432import org .hamcrest .CoreMatchers ;
35- import org .hamcrest .Matcher ;
3633import org .junit .After ;
3734import org .junit .Before ;
3835import org .junit .Rule ;
4441import java .io .File ;
4542import java .io .IOException ;
4643import java .nio .file .DirectoryStream ;
47- import java .nio .file .FileSystems ;
4844import java .nio .file .Files ;
4945import java .nio .file .Path ;
50- import java .nio .file .PathMatcher ;
5146import java .nio .file .Paths ;
5247import java .security .PublicKey ;
53- import java .util .Arrays ;
5448import java .util .Collections ;
5549import java .util .List ;
5650
5751import static com .google .common .io .Files .readLines ;
58- import static org .embulk .spi .type .Types .*;
52+ import static org .embulk .spi .type .Types .BOOLEAN ;
53+ import static org .embulk .spi .type .Types .DOUBLE ;
54+ import static org .embulk .spi .type .Types .LONG ;
55+ import static org .embulk .spi .type .Types .STRING ;
56+ import static org .embulk .spi .type .Types .TIMESTAMP ;
5957import static org .hamcrest .CoreMatchers .containsString ;
6058import static org .hamcrest .CoreMatchers .hasItem ;
61- import static org .hamcrest .CoreMatchers .instanceOf ;
62- import static org .hamcrest .MatcherAssert .*;
63- import static org .hamcrest .core .Is .is ;
6459import static org .junit .Assert .assertEquals ;
65- //import static org.hamcrest.Matchers.*;
66-
60+ import static org .junit .Assert .assertThat ;
6761public class TestSftpFileOutputPlugin
6862{
6963 @ Rule
@@ -136,7 +130,8 @@ public boolean authenticate(String username, PublicKey key, ServerSession sessio
136130 }
137131
138132 @ After
139- public void cleanup () throws InterruptedException {
133+ public void cleanup () throws InterruptedException
134+ {
140135 try {
141136 sshServer .stop (true );
142137 }
@@ -151,17 +146,19 @@ private ConfigSource getConfigFromYaml(String yaml)
151146 return loader .fromYamlString (yaml );
152147 }
153148
154- private List <String > lsR (List <String > fileNames , Path dir ) {
149+ private List <String > lsR (List <String > fileNames , Path dir )
150+ {
155151 try (DirectoryStream <Path > stream = Files .newDirectoryStream (dir )) {
156152 for (Path path : stream ) {
157- if (path .toFile ().isDirectory ()) {
153+ if (path .toFile ().isDirectory ()) {
158154 lsR (fileNames , path );
159- } else {
155+ }
156+ else {
160157 fileNames .add (path .toAbsolutePath ().toString ());
161158 }
162159 }
163160 }
164- catch (IOException e ) {
161+ catch (IOException e ) {
165162 logger .debug (e .getMessage (), e );
166163 }
167164 return fileNames ;
@@ -215,7 +212,7 @@ private void assertRecordsInFile(String filePath)
215212 for (int i = 0 ; i < lines .size (); i ++) {
216213 String [] record = lines .get (i ).split ("," );
217214 if (i == 0 ) {
218- for (int j = 0 ; j <= 4 ; j ++) {
215+ for (int j = 0 ; j <= 4 ; j ++) {
219216 assertEquals ("_c" + j , record [j ]);
220217 }
221218 }
@@ -284,7 +281,6 @@ public void testConfigValuesIncludingDefault()
284281 // timeout
285282 // 0 second
286283
287-
288284 @ Test
289285 public void testUserPasswordAndPutToUserDirectoryRoot ()
290286 {
@@ -318,7 +314,6 @@ public void testUserPasswordAndPutToUserDirectoryRoot()
318314 assertRecordsInFile (String .format ("%s/%s001.00.txt" ,
319315 testFolder .getRoot ().getAbsolutePath (),
320316 pathPrefix ));
321-
322317 }
323318
324319 @ Test
0 commit comments