Search in sources :

Example 41 with NullSession

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()));
}
Also used : Path(ch.cyberduck.core.Path) TestProtocol(ch.cyberduck.core.TestProtocol) HashMap(java.util.HashMap) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Example 42 with NullSession

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());
}
Also used : Path(ch.cyberduck.core.Path) NullTransferSession(ch.cyberduck.core.NullTransferSession) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) TestProtocol(ch.cyberduck.core.TestProtocol) HashMap(java.util.HashMap) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Example 43 with NullSession

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());
}
Also used : Path(ch.cyberduck.core.Path) NullTransferSession(ch.cyberduck.core.NullTransferSession) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) TestProtocol(ch.cyberduck.core.TestProtocol) HashMap(java.util.HashMap) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Example 44 with NullSession

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)));
}
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 45 with NullSession

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());
}
Also used : DisabledDownloadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledDownloadSymlinkResolver) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) TestProtocol(ch.cyberduck.core.TestProtocol) NullLocal(ch.cyberduck.core.NullLocal) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Aggregations

Host (ch.cyberduck.core.Host)128 NullSession (ch.cyberduck.core.NullSession)128 TestProtocol (ch.cyberduck.core.TestProtocol)128 Test (org.junit.Test)127 Path (ch.cyberduck.core.Path)118 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)81 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)69 NullLocal (ch.cyberduck.core.NullLocal)59 ListProgressListener (ch.cyberduck.core.ListProgressListener)40 AttributedList (ch.cyberduck.core.AttributedList)32 DisabledUploadSymlinkResolver (ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver)27 Local (ch.cyberduck.core.Local)24 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)24 ConnectionCallback (ch.cyberduck.core.ConnectionCallback)19 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)18 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)17 Session (ch.cyberduck.core.Session)17 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)17 HashMap (java.util.HashMap)14 LocalAttributes (ch.cyberduck.core.LocalAttributes)13