@Test public void testFilterUpload() throws Exception { final Path p = new Path("t", EnumSet.of(Path.Type.directory)); Transfer t = new SyncTransfer(new Host(new TestProtocol()), new TransferItem(p, new NullLocal(System.getProperty("java.io.tmpdir"), "t"))); final NullSession session = new NullSession(new Host(new TestProtocol())); final TransferPathFilter filter = t.filter(session, null, TransferAction.upload, new DisabledProgressListener()); final Path test = new Path(p, "a", EnumSet.of(Path.Type.file)); assertTrue(filter.accept(test, new NullLocal(System.getProperty("java.io.tmpdir"), "a") { @Override public boolean exists() { return true; } @Override public LocalAttributes attributes() { return new LocalAttributes(this.getAbsolute()) { @Override public long getSize() { return 1L; } }; } }, new TransferStatus().exists(true))); }
@Override public TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Filter transfer with action %s", action)); } return new SynchronizationPathFilter( comparison = new CachingComparisonServiceFilter( new ComparisonServiceFilter(source, source.getHost().getTimezone(), listener).withCache(cache) ).withCache(comparisons), download.filter(source, destination, TransferAction.overwrite, listener), upload.filter(source, destination, TransferAction.overwrite, listener), action ).withCache(cache); }
SyncTransfer extends Transfer { @Override public TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Filter transfer with action %s", action)); } return new SynchronizationPathFilter( comparison = new CachingComparisonServiceFilter( new ComparisonServiceFilter(source, source.getHost().getTimezone(), listener).withCache(cache) ).withCache(comparisons), download.filter(source, destination, TransferAction.overwrite, listener), upload.filter(source, destination, TransferAction.overwrite, listener), action ).withCache(cache); } }
SyncTransfer extends Transfer { @Override public TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Filter transfer with action %s", action)); } return new SynchronizationPathFilter( comparison = new CachingComparisonServiceFilter( new ComparisonServiceFilter(source, source.getHost().getTimezone(), listener).withCache(cache) ).withCache(comparisons), download.filter(source, destination, TransferAction.overwrite, listener), upload.filter(source, destination, TransferAction.overwrite, listener), action ).withCache(cache); } SyncTransfer(final Host host, final TransferItem item);  SyncTransfer(final Host host, final TransferItem item, final TransferAction action); }
SyncTransfer extends Transfer { @Override public TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Filter transfer with action %s", action)); } return new SynchronizationPathFilter( comparison = new CachingComparisonServiceFilter( new ComparisonServiceFilter(source, source.getHost().getTimezone(), listener).withCache(cache) ).withCache(comparisons), download.filter(source, destination, TransferAction.overwrite, listener), upload.filter(source, destination, TransferAction.overwrite, listener), action ).withCache(cache); } SyncTransfer(final Host host, final TransferItem item);  SyncTransfer(final Host host, final TransferItem item, final TransferAction action); @Override Transfer withCache(final Cache<Path> cache); @Override T serialize(final Serializer dict); @Override Type getType(); @Override void setBandwidth(float bytesPerSecond); @Override String getName(); @Override Long getTransferred(); @Override TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener); @Override void pre(final Session<?> source, final Session<?> destination, final Map<TransferItem, TransferStatus> files, final ConnectionCallback callback); @Override List<TransferItem> list(final Session<?> session, final Path directory, final Local local,
                                   final ListProgressListener listener); @Override TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested,
                                 final TransferPrompt prompt, final ListProgressListener listener); @Override void transfer(final Session<?> source, final Session<?> destination, final Path file, final Local local,
                         final TransferOptions options, final TransferStatus status, final ConnectionCallback connectionCallback,
                         final ProgressListener progressListener, final StreamListener streamListener); Comparison compare(final TransferItem item); @Override void start(); @Override void stop(); @Override void reset(); @Override void normalize(); @Override String toString(); }
SyncTransfer extends Transfer { @Override public TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Filter transfer with action %s", action)); } return new SynchronizationPathFilter( comparison = new CachingComparisonServiceFilter( new ComparisonServiceFilter(source, source.getHost().getTimezone(), listener).withCache(cache) ).withCache(comparisons), download.filter(source, destination, TransferAction.overwrite, listener), upload.filter(source, destination, TransferAction.overwrite, listener), action ).withCache(cache); } SyncTransfer(final Host host, final TransferItem item);  SyncTransfer(final Host host, final TransferItem item, final TransferAction action); @Override Transfer withCache(final Cache<Path> cache); @Override T serialize(final Serializer dict); @Override Type getType(); @Override void setBandwidth(float bytesPerSecond); @Override String getName(); @Override Long getTransferred(); @Override TransferPathFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener); @Override void pre(final Session<?> source, final Session<?> destination, final Map<TransferItem, TransferStatus> files, final ConnectionCallback callback); @Override List<TransferItem> list(final Session<?> session, final Path directory, final Local local,
                                   final ListProgressListener listener); @Override TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested,
                                 final TransferPrompt prompt, final ListProgressListener listener); @Override void transfer(final Session<?> source, final Session<?> destination, final Path file, final Local local,
                         final TransferOptions options, final TransferStatus status, final ConnectionCallback connectionCallback,
                         final ProgressListener progressListener, final StreamListener streamListener); Comparison compare(final TransferItem item); @Override void start(); @Override void stop(); @Override void reset(); @Override void normalize(); @Override String toString();  }