use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.
the class FTPDefaultListServiceTest method testListDefaultFlag.
@Test
public void testListDefaultFlag() throws Exception {
final ListService list = new FTPDefaultListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())), FTPListService.Command.lista);
final Path directory = new FTPWorkdirService(session).find();
final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new FTPTouchFeature(session).touch(file, new TransferStatus());
assertTrue(list.list(directory, new DisabledListProgressListener()).contains(file));
new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.
the class FTPListServiceTest method testListIOFailureStat.
@Test(expected = ConnectionTimeoutException.class)
public void testListIOFailureStat() throws Exception {
final FTPListService service = new FTPListService(session, null, TimeZone.getDefault());
service.remove(FTPListService.Command.lista);
service.remove(FTPListService.Command.mlsd);
final AtomicBoolean set = new AtomicBoolean();
service.implementations.put(FTPListService.Command.stat, new ListService() {
@Override
public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
if (set.get()) {
fail();
}
set.set(true);
throw new ConnectionTimeoutException("t", new SocketTimeoutException());
}
});
final Path directory = new FTPWorkdirService(session).find();
final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener());
}
use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.
the class FTPListServiceTest method testListExtended.
@Test
public void testListExtended() throws Exception {
final FTPListService service = new FTPListService(session, null, TimeZone.getDefault());
service.remove(FTPListService.Command.list);
service.remove(FTPListService.Command.stat);
service.remove(FTPListService.Command.mlsd);
final Path directory = new FTPWorkdirService(session).find();
final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new FTPTouchFeature(session).touch(file, new TransferStatus());
final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener() {
@Override
public void chunk(final Path parent, AttributedList<Path> list) {
assertFalse(list.isEmpty());
}
});
assertTrue(list.contains(file));
new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.
the class FTPMlsdListServiceTest method testList.
@Test
public void testList() throws Exception {
final ListService list = new FTPMlsdListService(session);
final Path directory = new FTPWorkdirService(session).find();
assertFalse(list.list(directory, new DisabledListProgressListener()).isEmpty());
}
use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.
the class FTPDefaultListServiceTest method testListDefault.
@Test
public void testListDefault() throws Exception {
final ListService list = new FTPDefaultListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())), FTPListService.Command.list);
final Path directory = new FTPWorkdirService(session).find();
final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new FTPTouchFeature(session).touch(file, new TransferStatus());
assertTrue(list.list(directory, new DisabledListProgressListener()).contains(file));
new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Aggregations