Search in sources :

Example 6 with FTPWorkdirService

use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.

the class FTPListServiceTest method testListEmptyDirectoryList.

@Test
public void testListEmptyDirectoryList() throws Exception {
    final FTPListService list = new FTPListService(session, null, TimeZone.getDefault());
    list.remove(FTPListService.Command.stat);
    list.remove(FTPListService.Command.lista);
    list.remove(FTPListService.Command.mlsd);
    final Path home = new FTPWorkdirService(session).find();
    final Path directory = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    new FTPDirectoryFeature(session).mkdir(directory, new TransferStatus());
    assertTrue(list.list(directory, new DisabledListProgressListener()).isEmpty());
    new FTPDeleteFeature(session).delete(Collections.singletonList(directory), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) FTPDirectoryFeature(ch.cyberduck.core.ftp.FTPDirectoryFeature) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 7 with FTPWorkdirService

use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.

the class FTPListServiceTest method testList.

@Test
public void testList() throws Exception {
    final ListService service = new FTPListService(session, null, TimeZone.getDefault());
    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 Permission permission = new Permission(Permission.Action.read_write, Permission.Action.read_write, Permission.Action.read_write);
    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());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) ListService(ch.cyberduck.core.ListService) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Permission(ch.cyberduck.core.Permission) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) FTPTouchFeature(ch.cyberduck.core.ftp.FTPTouchFeature) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 8 with FTPWorkdirService

use of ch.cyberduck.core.ftp.FTPWorkdirService in project cyberduck by iterate-ch.

the class FTPStatListServiceTest method testList.

@Test
public void testList() throws Exception {
    final ListService service = new FTPStatListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())));
    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());
    assertTrue(list.contains(file));
}
Also used : ListService(ch.cyberduck.core.ListService) Path(ch.cyberduck.core.Path) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) LaxUnixFTPEntryParser(ch.cyberduck.core.ftp.parser.LaxUnixFTPEntryParser) UnixFTPEntryParser(org.apache.commons.net.ftp.parser.UnixFTPEntryParser) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) FTPTouchFeature(ch.cyberduck.core.ftp.FTPTouchFeature) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Aggregations

DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)8 Path (ch.cyberduck.core.Path)8 AbstractFTPTest (ch.cyberduck.core.ftp.AbstractFTPTest)8 FTPWorkdirService (ch.cyberduck.core.ftp.FTPWorkdirService)8 IntegrationTest (ch.cyberduck.test.IntegrationTest)8 Test (org.junit.Test)8 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)6 ListService (ch.cyberduck.core.ListService)6 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)6 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)5 Delete (ch.cyberduck.core.features.Delete)5 FTPDeleteFeature (ch.cyberduck.core.ftp.FTPDeleteFeature)5 FTPTouchFeature (ch.cyberduck.core.ftp.FTPTouchFeature)5 CompositeFileEntryParser (ch.cyberduck.core.ftp.parser.CompositeFileEntryParser)3 UnixFTPEntryParser (org.apache.commons.net.ftp.parser.UnixFTPEntryParser)3 AttributedList (ch.cyberduck.core.AttributedList)1 ListProgressListener (ch.cyberduck.core.ListProgressListener)1 Permission (ch.cyberduck.core.Permission)1 BackgroundException (ch.cyberduck.core.exception.BackgroundException)1 ConnectionTimeoutException (ch.cyberduck.core.exception.ConnectionTimeoutException)1