Search in sources :

Example 51 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener 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 52 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener 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 53 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener 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 54 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener 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)

Example 55 with DisabledProgressListener

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

the class OverwriteFilterTest method testOverrideFileWithDirectory.

@Test(expected = AccessDeniedException.class)
public void testOverrideFileWithDirectory() throws Exception {
    final OverwriteFilter f = new OverwriteFilter(new DisabledDownloadSymlinkResolver(), new NullSession(new Host(new TestProtocol())));
    final NullLocal l = new NullLocal(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    new DefaultLocalTouchFeature().touch(l);
    f.prepare(new Path("a", EnumSet.of(Path.Type.directory)), l, 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) DefaultLocalTouchFeature(ch.cyberduck.core.local.DefaultLocalTouchFeature) 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

DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)166 Test (org.junit.Test)147 Host (ch.cyberduck.core.Host)135 Path (ch.cyberduck.core.Path)128 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)103 TestProtocol (ch.cyberduck.core.TestProtocol)95 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)94 NullSession (ch.cyberduck.core.NullSession)68 IntegrationTest (ch.cyberduck.test.IntegrationTest)65 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)59 NullLocal (ch.cyberduck.core.NullLocal)49 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)48 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)48 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)48 Credentials (ch.cyberduck.core.Credentials)43 Delete (ch.cyberduck.core.features.Delete)42 Local (ch.cyberduck.core.Local)40 LoginConnectionService (ch.cyberduck.core.LoginConnectionService)39 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)36 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)34