@Test public void testAcceptDirectory() throws Exception { Session session = new NullSession(new Host(new TestProtocol())); final SynchronizationPathFilter mirror = new SynchronizationPathFilter(new ComparePathFilter() { @Override public Comparison compare(Path file, Local local) { return Comparison.equal; } }, new OverwriteFilter(new DownloadSymlinkResolver(Collections.<TransferItem>emptyList()), session), new ch.cyberduck.core.transfer.upload.OverwriteFilter(new UploadSymlinkResolver(null, Collections.<TransferItem>emptyList()), session), TransferAction.mirror ); assertTrue(mirror.accept(new Path("/p", EnumSet.of(Path.Type.directory)), null, new TransferStatus().exists(true))); }
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { switch(comparison.compare(file, local)) { case equal: return file.isDirectory(); case remote: if(action.equals(TransferAction.upload)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.remote, action)); } return false; } return downloadFilter.accept(file, local, parent); case local: if(action.equals(TransferAction.download)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.local, action)); } return false; } return uploadFilter.accept(file, local, parent); } return false; }
SynchronizationPathFilter implements TransferPathFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { switch(comparison.compare(file, local)) { case equal: return file.isDirectory(); case remote: if(action.equals(TransferAction.upload)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.remote, action)); } return false; } return downloadFilter.accept(file, local, parent); case local: if(action.equals(TransferAction.download)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.local, action)); } return false; } return uploadFilter.accept(file, local, parent); } return false; } }
SynchronizationPathFilter implements TransferPathFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { switch(comparison.compare(file, local)) { case equal: return file.isDirectory(); case remote: if(action.equals(TransferAction.upload)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.remote, action)); } return false; } return downloadFilter.accept(file, local, parent); case local: if(action.equals(TransferAction.download)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.local, action)); } return false; } return uploadFilter.accept(file, local, parent); } return false; } SynchronizationPathFilter(final ComparePathFilter comparison,
                                     final TransferPathFilter downloadFilter,
                                     final TransferPathFilter uploadFilter,
                                     final TransferAction action); }
SynchronizationPathFilter implements TransferPathFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { switch(comparison.compare(file, local)) { case equal: return file.isDirectory(); case remote: if(action.equals(TransferAction.upload)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.remote, action)); } return false; } return downloadFilter.accept(file, local, parent); case local: if(action.equals(TransferAction.download)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.local, action)); } return false; } return uploadFilter.accept(file, local, parent); } return false; } SynchronizationPathFilter(final ComparePathFilter comparison,
                                     final TransferPathFilter downloadFilter,
                                     final TransferPathFilter uploadFilter,
                                     final TransferAction action); @Override TransferPathFilter withCache(final Cache<Path> cache); @Override TransferStatus prepare(final Path file, final Local local, final TransferStatus parent, final ProgressListener progress); @Override boolean accept(final Path file, final Local local, final TransferStatus parent); @Override void apply(final Path file, final Local local, final TransferStatus status, final ProgressListener listener); @Override void complete(final Path file, final Local local, final TransferOptions options, final TransferStatus status,
                         final ProgressListener listener); }
SynchronizationPathFilter implements TransferPathFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { switch(comparison.compare(file, local)) { case equal: return file.isDirectory(); case remote: if(action.equals(TransferAction.upload)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.remote, action)); } return false; } return downloadFilter.accept(file, local, parent); case local: if(action.equals(TransferAction.download)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison result %s because action is %s", file, Comparison.local, action)); } return false; } return uploadFilter.accept(file, local, parent); } return false; } SynchronizationPathFilter(final ComparePathFilter comparison,
                                     final TransferPathFilter downloadFilter,
                                     final TransferPathFilter uploadFilter,
                                     final TransferAction action); @Override TransferPathFilter withCache(final Cache<Path> cache); @Override TransferStatus prepare(final Path file, final Local local, final TransferStatus parent, final ProgressListener progress); @Override boolean accept(final Path file, final Local local, final TransferStatus parent); @Override void apply(final Path file, final Local local, final TransferStatus status, final ProgressListener listener); @Override void complete(final Path file, final Local local, final TransferOptions options, final TransferStatus status,
                         final ProgressListener listener);  }