Add callback for delete operation.
[cyberduck.git] / test / ch / cyberduck / core / ftp / FTPMlsdListServiceTest.java
blobc776784c89e4d5b9b0f35209941c249c4d81a3ba
1 package ch.cyberduck.core.ftp;
3 /*
4 * Copyright (c) 2002-2013 David Kocher. All rights reserved.
5 * http://cyberduck.ch/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch
20 import ch.cyberduck.core.AbstractTestCase;
21 import ch.cyberduck.core.AttributedList;
22 import ch.cyberduck.core.Credentials;
23 import ch.cyberduck.core.DisabledHostKeyCallback;
24 import ch.cyberduck.core.DisabledListProgressListener;
25 import ch.cyberduck.core.DisabledLoginCallback;
26 import ch.cyberduck.core.DisabledPasswordStore;
27 import ch.cyberduck.core.DisabledProgressListener;
28 import ch.cyberduck.core.DisabledTranscriptListener;
29 import ch.cyberduck.core.Host;
30 import ch.cyberduck.core.ListService;
31 import ch.cyberduck.core.LoginConnectionService;
32 import ch.cyberduck.core.Path;
33 import ch.cyberduck.core.PathCache;
34 import ch.cyberduck.core.exception.InteroperabilityException;
35 import ch.cyberduck.core.preferences.PreferencesFactory;
37 import org.junit.Test;
39 import static org.junit.Assert.assertFalse;
41 /**
42 * @version $Id$
44 public class FTPMlsdListServiceTest extends AbstractTestCase {
46 @Test(expected = InteroperabilityException.class)
47 public void testListNotSupportedTest() throws Exception {
48 final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch", new Credentials(
49 properties.getProperty("ftp.user"), properties.getProperty("ftp.password")
50 ));
51 final FTPSession session = new FTPSession(host);
52 new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(),
53 new DisabledPasswordStore(), new DisabledProgressListener(), new DisabledTranscriptListener()).connect(session, PathCache.empty());
54 final ListService list = new FTPMlsdListService(session);
55 final Path directory = session.workdir();
56 list.list(directory, new DisabledListProgressListener());
57 session.close();
60 @Test(expected = InteroperabilityException.class)
61 public void testListNotSupportedSwitch() throws Exception {
62 final Host host = new Host(new FTPProtocol(), "mirror.switch.ch", new Credentials(
63 PreferencesFactory.get().getProperty("connection.login.anon.name"), null
64 ));
65 final FTPSession session = new FTPSession(host);
66 new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(),
67 new DisabledPasswordStore(), new DisabledProgressListener(), new DisabledTranscriptListener()).connect(session, PathCache.empty());
68 final ListService list = new FTPMlsdListService(session);
69 final Path directory = session.workdir();
70 list.list(directory, new DisabledListProgressListener());
71 session.close();
74 @Test
75 public void testList() throws Exception {
76 final Host host = new Host(new FTPProtocol(), "ftp.crushftp.com", new Credentials(
77 PreferencesFactory.get().getProperty("connection.login.anon.name"), null
78 ));
79 host.setFTPConnectMode(FTPConnectMode.active);
80 final FTPSession session = new FTPSession(host);
81 new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(),
82 new DisabledPasswordStore(), new DisabledProgressListener(), new DisabledTranscriptListener()).connect(session, PathCache.empty());
83 final ListService s = new FTPMlsdListService(session);
84 final Path directory = session.workdir();
85 final AttributedList<Path> list = s.list(directory, new DisabledListProgressListener());
86 assertFalse(list.isEmpty());
87 session.close();