use of ch.cyberduck.core.NullSession in project cyberduck by iterate-ch.
the class OverwriteFilterTest method testAcceptDirectoryNew.
@Test
public void testAcceptDirectoryNew() throws Exception {
final HashMap<Path, Path> files = new HashMap<Path, Path>();
final Path source = new Path("a", EnumSet.of(Path.Type.directory));
files.put(source, new Path("a", EnumSet.of(Path.Type.directory)));
AbstractCopyFilter f = new OverwriteFilter(new NullSession(new Host(new TestProtocol())), new NullSession(new Host(new TestProtocol())), files);
assertTrue(f.accept(source, null, new TransferStatus()));
}
use of ch.cyberduck.core.NullSession in project cyberduck by iterate-ch.
the class OverwriteFilterTest method testPrepareDirectory.
@Test
public void testPrepareDirectory() throws Exception {
final HashMap<Path, Path> files = new HashMap<Path, Path>();
final Path source = new Path("a", EnumSet.of(Path.Type.directory));
source.attributes().setSize(1L);
final Path target = new Path("a", EnumSet.of(Path.Type.directory));
files.put(source, target);
OverwriteFilter f = new OverwriteFilter(new NullTransferSession(new Host(new TestProtocol())), new NullSession(new Host(new TestProtocol())), files);
final TransferStatus status = f.prepare(source, null, new TransferStatus(), new DisabledProgressListener());
assertEquals(0L, status.getLength());
}
use of ch.cyberduck.core.NullSession in project cyberduck by iterate-ch.
the class OverwriteFilterTest method testPrepareFile.
@Test
public void testPrepareFile() throws Exception {
final HashMap<Path, Path> files = new HashMap<Path, Path>();
final Path source = new Path("a", EnumSet.of(Path.Type.file));
source.attributes().setSize(1L);
files.put(source, new Path("a", EnumSet.of(Path.Type.file)));
OverwriteFilter f = new OverwriteFilter(new NullTransferSession(new Host(new TestProtocol())), new NullSession(new Host(new TestProtocol())), files);
final TransferStatus status = f.prepare(source, null, new TransferStatus(), new DisabledProgressListener());
assertEquals(1L, status.getLength());
}
use of ch.cyberduck.core.NullSession 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.NullSession in project cyberduck by iterate-ch.
the class OverwriteFilterTest method testOverrideDirectoryWithFile.
@Test(expected = AccessDeniedException.class)
public void testOverrideDirectoryWithFile() throws Exception {
final OverwriteFilter f = new OverwriteFilter(new DisabledDownloadSymlinkResolver(), new NullSession(new Host(new TestProtocol())));
f.prepare(new Path("a", EnumSet.of(Path.Type.file)), new NullLocal(System.getProperty("java.io.tmpdir")), new TransferStatus().exists(true), new DisabledProgressListener());
}
Aggregations