use of ch.cyberduck.core.ftp.FTPParserSelector in project cyberduck by iterate-ch.
the class FTPListResponseReaderTest method testListNoRead.
@Test(expected = FTPInvalidListException.class)
public void testListNoRead() throws Exception {
final Path directory = new Path("/sandbox/noread", EnumSet.of(Path.Type.directory));
final String[] lines = new String[] { "213-Status follows:", "d-w--w---- 2 1003 1003 4096 Nov 06 2013 noread", "213 End of status" };
final AttributedList<Path> list = new FTPListResponseReader(new FTPParserSelector().getParser("UNIX"), true).read(directory, Arrays.asList(lines), new DisabledListProgressListener());
assertEquals(0, list.size());
}
use of ch.cyberduck.core.ftp.FTPParserSelector 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());
}
});
}
use of ch.cyberduck.core.ftp.FTPParserSelector 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());
}
use of ch.cyberduck.core.ftp.FTPParserSelector in project cyberduck by iterate-ch.
the class FTPListResponseReaderTest method test3243.
@Test(expected = FTPInvalidListException.class)
public void test3243() throws Exception {
Path path = new Path("/SunnyD", EnumSet.of(Path.Type.directory));
assertEquals("SunnyD", path.getName());
assertEquals("/SunnyD", path.getAbsolute());
final AttributedList<Path> list = new AttributedList<Path>();
new FTPListResponseReader(new FTPParserSelector().getParser("UNIX")).read(path, Collections.singletonList(" drwxrwx--x 1 owner group 512 Jun 12 15:40 SunnyD"), new DisabledListProgressListener());
}
use of ch.cyberduck.core.ftp.FTPParserSelector in project cyberduck by iterate-ch.
the class FTPListResponseReaderTest method testParseSymbolicLink.
@Test
public void testParseSymbolicLink() throws Exception {
Path path = new Path("/", EnumSet.of(Path.Type.directory));
assertEquals("/", path.getName());
assertEquals("/", path.getAbsolute());
final AttributedList<Path> list = new FTPListResponseReader(new FTPParserSelector().getParser("UNIX")).read(path, Collections.singletonList("lrwxrwxrwx 1 mk basicgrp 27 Sep 23 2004 www -> /www/basic/mk"), new DisabledListProgressListener());
assertFalse(list.isEmpty());
final Path parsed = list.get(0);
assertTrue(parsed.isSymbolicLink());
assertEquals("/www/basic/mk", parsed.getSymlinkTarget().getAbsolute());
assertEquals(new Permission("rwxrwxrwx"), parsed.attributes().getPermission());
}
Aggregations