List of usage examples for org.apache.commons.net.ftp.parser UnixFTPEntryParser UnixFTPEntryParser
public UnixFTPEntryParser()
From source file:ch.cyberduck.core.ftp.FTPDefaultListServiceTest.java
@Test public void testListDefault() throws Exception { final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch", new Credentials(System.getProperties().getProperty("ftp.user"), System.getProperties().getProperty("ftp.password"))); final FTPSession session = new FTPSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final ListService list = new FTPDefaultListService(session, new DisabledPasswordStore(), new DisabledLoginCallback(), new CompositeFileEntryParser(Arrays.asList(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 DefaultTouchFeature<Integer>(new DefaultUploadFeature<Integer>(new FTPWriteFeature(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()); session.close();/*from ww w .ja va2s . c o m*/ }
From source file:ch.cyberduck.core.ftp.FTPStatListServiceTest.java
@Test public void testList() throws Exception { final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch", new Credentials(System.getProperties().getProperty("ftp.user"), System.getProperties().getProperty("ftp.password"))); final FTPSession session = new FTPSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); 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 DefaultTouchFeature<Integer>(new DefaultUploadFeature<Integer>(new FTPWriteFeature(session))) .touch(file, new TransferStatus()); final Permission permission = new Permission(Permission.Action.read_write, Permission.Action.read_write, Permission.Action.read_write); new FTPUnixPermissionFeature(session).setUnixPermission(file, permission); final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener()); assertTrue(list.contains(file));/*from w w w . jav a2 s. c om*/ assertEquals(permission, list.get(file).attributes().getPermission()); session.close(); }
From source file:ch.cyberduck.core.ftp.FTPDefaultListServiceTest.java
@Test public void testListDefaultFlag() throws Exception { final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch", new Credentials(System.getProperties().getProperty("ftp.user"), System.getProperties().getProperty("ftp.password"))); final FTPSession session = new FTPSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final ListService list = new FTPDefaultListService(session, new DisabledPasswordStore(), new DisabledLoginCallback(), new CompositeFileEntryParser(Arrays.asList(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 DefaultTouchFeature<Integer>(new DefaultUploadFeature<Integer>(new FTPWriteFeature(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()); session.close();/*from w w w . java 2 s .co m*/ }
From source file:ch.cyberduck.core.ftp.FTPStatListServiceTest.java
@Test public void testParse8006() throws Exception { final List<String> lines = Arrays.asList("212-Status of /cgi-bin:", " drwxr-xr-x 3 1564466 15000 4 Jan 19 19:56 .", " drwxr-x--- 13 1564466 15000 44 Jun 13 18:36 ..", " drwxr-xr-x 2 1564466 15000 2 May 25 2009 tmp", " End of status", "212 -rw-r--r-- 1 1564466 15000 9859 Jan 19 19:56 adoptees.php"); final FTPFileEntryParser parser = new UnixFTPEntryParser(); final List<String> list = new FTPStatListService(null, parser).parse(212, lines.toArray(new String[lines.size()])); assertEquals(6, list.size());/*ww w . j av a 2s . c o m*/ final Path parent = new Path("/cgi-bin", EnumSet.of(Path.Type.directory)); final AttributedList<Path> parsed = new FTPListResponseReader(parser, true).read(parent, list, new DisabledListProgressListener()); assertEquals(2, parsed.size()); assertTrue(parsed.contains(new Path(parent, "tmp", EnumSet.of(Path.Type.directory)))); assertTrue(parsed.contains(new Path(parent, "adoptees.php", EnumSet.of(Path.Type.file)))); }
From source file:org.openo.nfvo.emsdriver.commons.ftp.ExtendsDefaultFTPFileEntryParserFactory.java
public FTPFileEntryParser createUnixFTPEntryParser() { return (FTPFileEntryParser) new UnixFTPEntryParser(); }
From source file:org.openo.nfvo.emsdriver.commons.ftp.ExtendsDefaultFTPFileEntryParserFactory.java
public FTPFileEntryParser createNTFTPEntryParser() { if (config != null && FTPClientConfig.SYST_NT.equals(config.getServerSystemKey())) { return new NTFTPEntryParser(); } else {/*from www. j ava 2s.c om*/ return new CompositeFileEntryParser( new FTPFileEntryParser[] { new NTFTPEntryParser(), new UnixFTPEntryParser() }); } }
From source file:org.openo.nfvo.emsdriver.commons.ftp.ExtendsDefaultFTPFileEntryParserFactory.java
public FTPFileEntryParser createOS400FTPEntryParser() { if (config != null && FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) { return new OS400FTPEntryParser(); } else {/* w w w .ja v a2s . co m*/ return new CompositeFileEntryParser( new FTPFileEntryParser[] { new OS400FTPEntryParser(), new UnixFTPEntryParser() }); } }