obligatory ssh client close()
parent
53bfaa6b60
commit
f2d00b7f83
@ -1,18 +1,26 @@
|
||||
package org.apache.sshd.fs.test;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xbib.files.FileService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FileServiceProviderTest {
|
||||
|
||||
@Test
|
||||
public void testSFTP() throws IOException {
|
||||
public void testSFTP() throws Exception {
|
||||
Map<String, ?> env = Map.of("username", "joerg");
|
||||
FileService fs = FileService.newInstance("sftp://alkmene:22", env);
|
||||
fs.list(".").forEach(p -> Logger.getAnonymousLogger().info(p.toString()));
|
||||
// close() is essential!
|
||||
try (Stream<Path> list = fs.list(".")) {
|
||||
list.forEach(p -> Logger.getAnonymousLogger().info(p.toString()));
|
||||
}
|
||||
// see if a second run still works
|
||||
try (Stream<Path> list = fs.list(".")) {
|
||||
list.forEach(p -> Logger.getAnonymousLogger().info(p.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
group = org.xbib
|
||||
name = files
|
||||
version = 4.4.0
|
||||
version = 4.5.0
|
||||
|
Loading…
Reference in New Issue