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)));
}
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());
}
}
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"));
}
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());
}
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)));
}
Aggregations