Search in sources :

Example 1 with CompositeFileEntryParser

use of ch.cyberduck.core.ftp.parser.CompositeFileEntryParser 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 CompositeFileEntryParser

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

the class FTPListResponseReaderTest method testLimit.

@Test(expected = ListCanceledException.class)
@Ignore
public void testLimit() throws Exception {
    final CompositeFileEntryParser parser = new FTPParserSelector().getParser("NETWARE  Type : L8");
    final AttributedList<Path> list = new FTPListResponseReader(parser).read(new Path("/", EnumSet.of(Path.Type.directory)), Collections.singletonList("lrwxrwxrwx    1 ftp      ftp            23 Feb 05 06:51 debian -> ../pool/4/mirror/debian"), new DisabledListProgressListener() {

        @Override
        public void chunk(final Path parent, AttributedList<Path> list) throws ListCanceledException {
            throw new ListCanceledException(AttributedList.<Path>emptyList());
        }
    });
}
Also used : FTPParserSelector(ch.cyberduck.core.ftp.FTPParserSelector) Path(ch.cyberduck.core.Path) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser) ListCanceledException(ch.cyberduck.core.exception.ListCanceledException) Ignore(org.junit.Ignore) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 3 with CompositeFileEntryParser

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

the class FTPListResponseReaderTest method testParseAbsolutePaths.

@Test
public void testParseAbsolutePaths() throws Exception {
    Path path = new Path("/data/FTP_pub", EnumSet.of(Path.Type.directory));
    String[] replies = new String[] { "- [RWCEAFMS] Petersm                             0 May 05  2004 /data/FTP_pub/WelcomeTo_PeakFTP" };
    final CompositeFileEntryParser parser = new FTPParserSelector().getParser("NETWARE  Type : L8");
    final AttributedList<Path> list = new FTPListResponseReader(parser).read(path, Arrays.asList(replies), new DisabledListProgressListener());
    assertEquals(1, list.size());
    final Path parsed = list.get(0);
    assertEquals("WelcomeTo_PeakFTP", parsed.getName());
    assertEquals("/data/FTP_pub", parsed.getParent().getAbsolute());
    assertFalse(parsed.attributes().getPermission().isSticky());
    assertFalse(parsed.attributes().getPermission().isSetuid());
    assertFalse(parsed.attributes().getPermission().isSetgid());
}
Also used : Path(ch.cyberduck.core.Path) FTPParserSelector(ch.cyberduck.core.ftp.FTPParserSelector) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 4 with CompositeFileEntryParser

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

the class FTPParserFactory method createMVSEntryParser.

private CompositeFileEntryParser createMVSEntryParser(final TimeZone timezone) {
    return new CompositeFileEntryParser(Collections.singletonList(new MVSFTPEntryParser() {

        @Override
        protected FTPClientConfig getDefaultConfiguration() {
            final FTPClientConfig config = super.getDefaultConfiguration();
            config.setServerTimeZoneId(timezone.getID());
            return config;
        }
    }));
}
Also used : MVSFTPEntryParser(org.apache.commons.net.ftp.parser.MVSFTPEntryParser) FTPClientConfig(org.apache.commons.net.ftp.FTPClientConfig) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser)

Example 5 with CompositeFileEntryParser

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

the class FTPParserFactory method createOS2FTPEntryParser.

private CompositeFileEntryParser createOS2FTPEntryParser(final TimeZone timezone) {
    return new CompositeFileEntryParser(Collections.singletonList(new OS2FTPEntryParser() {

        @Override
        protected FTPClientConfig getDefaultConfiguration() {
            final FTPClientConfig config = super.getDefaultConfiguration();
            config.setServerTimeZoneId(timezone.getID());
            return config;
        }
    }));
}
Also used : FTPClientConfig(org.apache.commons.net.ftp.FTPClientConfig) OS2FTPEntryParser(org.apache.commons.net.ftp.parser.OS2FTPEntryParser) CompositeFileEntryParser(ch.cyberduck.core.ftp.parser.CompositeFileEntryParser)

Aggregations

CompositeFileEntryParser (ch.cyberduck.core.ftp.parser.CompositeFileEntryParser)14 Test (org.junit.Test)7 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)6 Path (ch.cyberduck.core.Path)6 IntegrationTest (ch.cyberduck.test.IntegrationTest)6 FTPClientConfig (org.apache.commons.net.ftp.FTPClientConfig)6 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)3 ListService (ch.cyberduck.core.ListService)3 AbstractFTPTest (ch.cyberduck.core.ftp.AbstractFTPTest)3 FTPParserSelector (ch.cyberduck.core.ftp.FTPParserSelector)3 FTPTouchFeature (ch.cyberduck.core.ftp.FTPTouchFeature)3 FTPWorkdirService (ch.cyberduck.core.ftp.FTPWorkdirService)3 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)3 UnixFTPEntryParser (org.apache.commons.net.ftp.parser.UnixFTPEntryParser)3 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)2 Delete (ch.cyberduck.core.features.Delete)2 FTPDeleteFeature (ch.cyberduck.core.ftp.FTPDeleteFeature)2 LaxUnixFTPEntryParser (ch.cyberduck.core.ftp.parser.LaxUnixFTPEntryParser)2 ListCanceledException (ch.cyberduck.core.exception.ListCanceledException)1 EPLFFTPEntryParser (ch.cyberduck.core.ftp.parser.EPLFFTPEntryParser)1