Search in sources :

Example 6 with ProgressListener

use of ch.cyberduck.core.ProgressListener in project cyberduck by iterate-ch.

the class CompareFilterTest method testAcceptDirectory.

@Test
public void testAcceptDirectory() throws Exception {
    final CompareFilter filter = new CompareFilter(new DisabledDownloadSymlinkResolver(), new NullSession(new Host(new TestProtocol())), new DownloadFilterOptions(new Host(new TestProtocol())), new DisabledProgressListener(), new DefaultComparePathFilter(new NullSession(new Host(new TestProtocol())), null) {

        @Override
        public Comparison compare(final Path file, final Local local, final ProgressListener listener) {
            return Comparison.equal;
        }
    });
    assertTrue(filter.accept(new Path("/n", EnumSet.of(Path.Type.directory)), new NullLocal("/n"), new TransferStatus().exists(true)));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Path(ch.cyberduck.core.Path) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) NullLocal(ch.cyberduck.core.NullLocal) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) DefaultComparePathFilter(ch.cyberduck.core.synchronization.DefaultComparePathFilter) DisabledDownloadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledDownloadSymlinkResolver) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) ProgressListener(ch.cyberduck.core.ProgressListener) Comparison(ch.cyberduck.core.synchronization.Comparison) NullLocal(ch.cyberduck.core.NullLocal) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Test(org.junit.Test)

Example 7 with ProgressListener

use of ch.cyberduck.core.ProgressListener in project cyberduck by iterate-ch.

the class SFTPCompressFeatureTest method testArchive.

@Test
@Ignore
public void testArchive() throws Exception {
    final SFTPCompressFeature feature = new SFTPCompressFeature(session);
    for (Archive archive : Archive.getKnownArchives()) {
        final Path workdir = new SFTPHomeDirectoryService(session).find();
        final Path test = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        session.getFeature(Touch.class).touch(test, new TransferStatus());
        feature.archive(archive, workdir, Collections.singletonList(test), new ProgressListener() {

            @Override
            public void message(final String message) {
            // 
            }
        }, new DisabledTranscriptListener());
        assertTrue(new SFTPFindFeature(session).find(archive.getArchive(Collections.singletonList(test))));
        new SFTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new SFTPFindFeature(session).find(test));
        feature.unarchive(archive, archive.getArchive(Collections.singletonList(test)), new ProgressListener() {

            @Override
            public void message(final String message) {
            // 
            }
        }, new DisabledTranscriptListener());
        assertTrue(new SFTPFindFeature(session).find(test));
        new SFTPDeleteFeature(session).delete(Collections.singletonList(archive.getArchive(Collections.singletonList(test))), new DisabledLoginCallback(), new Delete.DisabledCallback());
        new SFTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) Archive(ch.cyberduck.core.Archive) Touch(ch.cyberduck.core.features.Touch) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) ProgressListener(ch.cyberduck.core.ProgressListener) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Ignore(org.junit.Ignore) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 8 with ProgressListener

use of ch.cyberduck.core.ProgressListener in project cyberduck by iterate-ch.

the class SFTPCommandFeatureTest method testSend.

@Test
@Ignore
public void testSend() throws Exception {
    final StringBuilder t = new StringBuilder();
    new SFTPCommandFeature(session).send("ps", new ProgressListener() {

        @Override
        public void message(final String message) {
            assertEquals("ps", message);
        }
    }, new TranscriptListener() {

        @Override
        public void log(final Type request, final String message) {
            switch(request) {
                case response:
                    t.append(message);
            }
        }
    });
    assertTrue("PID TTY          TIME CMD22417 ?        00:00:00 sshd22418 ?        00:00:00 sftp-server22427 ?        00:00:00 ps", t.toString().startsWith("  PID TTY          TIME"));
}
Also used : ProgressListener(ch.cyberduck.core.ProgressListener) TranscriptListener(ch.cyberduck.core.TranscriptListener) Ignore(org.junit.Ignore) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 9 with ProgressListener

use of ch.cyberduck.core.ProgressListener in project cyberduck by iterate-ch.

the class FTPCommandFeatureTest method testSend.

@Test
public void testSend() throws Exception {
    final StringBuilder t = new StringBuilder();
    new FTPCommandFeature(session).send("HELP", new ProgressListener() {

        @Override
        public void message(final String message) {
            assertEquals("HELP", message);
        }
    }, new TranscriptListener() {

        @Override
        public void log(final Type request, final String message) {
            switch(request) {
                case response:
                    t.append(message);
            }
        }
    });
    assertNotNull(t.toString());
}
Also used : ProgressListener(ch.cyberduck.core.ProgressListener) TranscriptListener(ch.cyberduck.core.TranscriptListener) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 10 with ProgressListener

use of ch.cyberduck.core.ProgressListener in project cyberduck by iterate-ch.

the class CompareFilterTest method testAcceptEqual.

@Test
public void testAcceptEqual() throws Exception {
    final CompareFilter filter = new CompareFilter(new DisabledDownloadSymlinkResolver(), new NullSession(new Host(new TestProtocol())), new DownloadFilterOptions(new Host(new TestProtocol())), new DisabledProgressListener(), new DefaultComparePathFilter(new NullSession(new Host(new TestProtocol())), null) {

        @Override
        public Comparison compare(final Path file, final Local local, final ProgressListener listener) {
            return Comparison.equal;
        }
    });
    final Path file = new Path("/f", EnumSet.of(Path.Type.file));
    final Local local = new NullLocal(System.getProperty("java.io.tmpdir"), "f");
    assertFalse(filter.accept(file, local, new TransferStatus().exists(true)));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Path(ch.cyberduck.core.Path) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) NullLocal(ch.cyberduck.core.NullLocal) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) DefaultComparePathFilter(ch.cyberduck.core.synchronization.DefaultComparePathFilter) DisabledDownloadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledDownloadSymlinkResolver) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) ProgressListener(ch.cyberduck.core.ProgressListener) Comparison(ch.cyberduck.core.synchronization.Comparison) NullLocal(ch.cyberduck.core.NullLocal) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Test(org.junit.Test)

Aggregations

ProgressListener (ch.cyberduck.core.ProgressListener)12 Test (org.junit.Test)12 Host (ch.cyberduck.core.Host)9 Path (ch.cyberduck.core.Path)9 TestProtocol (ch.cyberduck.core.TestProtocol)9 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)9 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)8 Local (ch.cyberduck.core.Local)8 NullLocal (ch.cyberduck.core.NullLocal)8 NullSession (ch.cyberduck.core.NullSession)8 Comparison (ch.cyberduck.core.synchronization.Comparison)5 DefaultComparePathFilter (ch.cyberduck.core.synchronization.DefaultComparePathFilter)5 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)4 Session (ch.cyberduck.core.Session)4 AttributedList (ch.cyberduck.core.AttributedList)3 ConnectionCallback (ch.cyberduck.core.ConnectionCallback)3 ListProgressListener (ch.cyberduck.core.ListProgressListener)3 DisabledStreamListener (ch.cyberduck.core.io.DisabledStreamListener)3 StreamListener (ch.cyberduck.core.io.StreamListener)3 DisabledNotificationService (ch.cyberduck.core.notification.DisabledNotificationService)3