Search in sources :

Example 11 with DisabledUploadSymlinkResolver

use of ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver in project cyberduck by iterate-ch.

the class SkipFilterTest method testAccept.

@Test
public void testAccept() throws Exception {
    SkipFilter f = new SkipFilter(new DisabledUploadSymlinkResolver(), new NullTransferSession(new Host(new TestProtocol())) {

        @Override
        @SuppressWarnings("unchecked")
        public <T> T _getFeature(Class<T> type) {
            if (type == Find.class) {
                return (T) new Find() {

                    @Override
                    public boolean find(Path file, final ListProgressListener listener) {
                        return true;
                    }
                };
            }
            return super._getFeature(type);
        }
    });
    assertFalse(f.accept(new Path("a", EnumSet.of(Path.Type.file)), new NullLocal("a") {

        @Override
        public boolean exists() {
            return true;
        }
    }, new TransferStatus().exists(true)));
}
Also used : Path(ch.cyberduck.core.Path) DisabledUploadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver) TestProtocol(ch.cyberduck.core.TestProtocol) Host(ch.cyberduck.core.Host) NullTransferSession(ch.cyberduck.core.NullTransferSession) NullLocal(ch.cyberduck.core.NullLocal) Find(ch.cyberduck.core.features.Find) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) ListProgressListener(ch.cyberduck.core.ListProgressListener) Test(org.junit.Test)

Example 12 with DisabledUploadSymlinkResolver

use of ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver in project cyberduck by iterate-ch.

the class CompareFilterTest method testAcceptDirectory.

@Test
public void testAcceptDirectory() throws Exception {
    final Host host = new Host(new TestProtocol());
    final CompareFilter filter = new CompareFilter(new DisabledUploadSymlinkResolver(), new NullSession(host), new UploadFilterOptions(host), new DisabledProgressListener(), new DefaultComparePathFilter(new NullSession(host), 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") {

        @Override
        public boolean exists() {
            return true;
        }
    }, new TransferStatus().exists(true)));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Path(ch.cyberduck.core.Path) DisabledUploadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver) 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) 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 13 with DisabledUploadSymlinkResolver

use of ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver in project cyberduck by iterate-ch.

the class OverwriteFilterTest method testAcceptRemoteExists.

@Test
public void testAcceptRemoteExists() throws Exception {
    final OverwriteFilter f = new OverwriteFilter(new DisabledUploadSymlinkResolver(), new NullSession(new Host(new TestProtocol())));
    assertTrue(f.accept(new Path("a", EnumSet.of(Path.Type.directory)) {
    }, new NullLocal("t") {

        @Override
        public boolean exists() {
            return true;
        }
    }, new TransferStatus()));
    assertTrue(f.accept(new Path("a", EnumSet.of(Path.Type.directory)) {
    }, new NullLocal("t") {

        @Override
        public boolean exists() {
            return true;
        }
    }, new TransferStatus()));
}
Also used : Path(ch.cyberduck.core.Path) DisabledUploadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver) 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 14 with DisabledUploadSymlinkResolver

use of ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver in project cyberduck by iterate-ch.

the class OverwriteFilterTest method testSize.

@Test
public void testSize() throws Exception {
    final OverwriteFilter f = new OverwriteFilter(new DisabledUploadSymlinkResolver(), new NullSession(new Host(new TestProtocol())));
    assertEquals(1L, f.prepare(new Path("/t", EnumSet.of(Path.Type.file)) {
    }, new NullLocal("/t") {

        @Override
        public LocalAttributes attributes() {
            return new LocalAttributes("/t") {

                @Override
                public long getSize() {
                    return 1L;
                }
            };
        }

        @Override
        public boolean isFile() {
            return true;
        }
    }, new TransferStatus(), new DisabledProgressListener()).getLength(), 0L);
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledUploadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver) TestProtocol(ch.cyberduck.core.TestProtocol) NullLocal(ch.cyberduck.core.NullLocal) LocalAttributes(ch.cyberduck.core.LocalAttributes) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Example 15 with DisabledUploadSymlinkResolver

use of ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver in project cyberduck by iterate-ch.

the class OverwriteFilterTest method testOverrideDirectoryWithFile.

@Test(expected = AccessDeniedException.class)
public void testOverrideDirectoryWithFile() throws Exception {
    final AbstractUploadFilter f = new OverwriteFilter(new DisabledUploadSymlinkResolver(), new NullSession(new Host(new TestProtocol()))).withFinder(new Find() {

        @Override
        public boolean find(final Path file, final ListProgressListener listener) {
            if (file.getType().contains(Path.Type.file)) {
                return false;
            }
            return true;
        }
    });
    f.prepare(new Path("a", EnumSet.of(Path.Type.file)), new NullLocal(System.getProperty("java.io.tmpdir"), "f"), new TransferStatus().exists(true), new DisabledProgressListener());
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledUploadSymlinkResolver(ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) NullLocal(ch.cyberduck.core.NullLocal) Find(ch.cyberduck.core.features.Find) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) ListProgressListener(ch.cyberduck.core.ListProgressListener) Test(org.junit.Test)

Aggregations

Host (ch.cyberduck.core.Host)28 NullLocal (ch.cyberduck.core.NullLocal)28 Path (ch.cyberduck.core.Path)28 TestProtocol (ch.cyberduck.core.TestProtocol)28 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)28 DisabledUploadSymlinkResolver (ch.cyberduck.core.transfer.symlink.DisabledUploadSymlinkResolver)28 Test (org.junit.Test)28 NullSession (ch.cyberduck.core.NullSession)27 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)18 ListProgressListener (ch.cyberduck.core.ListProgressListener)14 AttributedList (ch.cyberduck.core.AttributedList)8 PathAttributes (ch.cyberduck.core.PathAttributes)8 LocalAttributes (ch.cyberduck.core.LocalAttributes)7 Find (ch.cyberduck.core.features.Find)7 AttributesFinder (ch.cyberduck.core.features.AttributesFinder)5 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 ConnectionCallback (ch.cyberduck.core.ConnectionCallback)3 NullWriteFeature (ch.cyberduck.core.NullWriteFeature)3 Move (ch.cyberduck.core.features.Move)3 Local (ch.cyberduck.core.Local)2