Search in sources :

Example 1 with FTPWorkdirService

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());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) UnixFTPEntryParser(org.apache.commons.net.ftp.parser.UnixFTPEntryParser) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser) ListService(ch.cyberduck.core.ListService) 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) FTPTouchFeature(ch.cyberduck.core.ftp.FTPTouchFeature) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 2 with FTPWorkdirService

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());
}
Also used : Path(ch.cyberduck.core.Path) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) ListService(ch.cyberduck.core.ListService) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ConnectionTimeoutException(ch.cyberduck.core.exception.ConnectionTimeoutException) SocketTimeoutException(java.net.SocketTimeoutException) AttributedList(ch.cyberduck.core.AttributedList) ListProgressListener(ch.cyberduck.core.ListProgressListener) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) BackgroundException(ch.cyberduck.core.exception.BackgroundException) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 3 with FTPWorkdirService

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());
}
Also used : Path(ch.cyberduck.core.Path) 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) FTPTouchFeature(ch.cyberduck.core.ftp.FTPTouchFeature) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 4 with FTPWorkdirService

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());
}
Also used : ListService(ch.cyberduck.core.ListService) Path(ch.cyberduck.core.Path) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 5 with FTPWorkdirService

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());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) UnixFTPEntryParser(org.apache.commons.net.ftp.parser.UnixFTPEntryParser) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser) ListService(ch.cyberduck.core.ListService) 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) 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