@Test public void testAcceptDirectory() throws Exception { final CompareFilter filter = new CompareFilter(new DisabledUploadSymlinkResolver(), new NullSession(new Host(new TestProtocol())), new UploadFilterOptions(), new ComparisonServiceFilter(new NullSession(new Host(new TestProtocol())), null, new DisabledProgressListener()) { @Override public Comparison compare(final Path file, final Local local) { 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))); }
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { final Comparison comparison = comparisonService.compare(file, local); switch(comparison) { case local: return true; case equal: if(file.isDirectory()) { return true; } if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; case remote: if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; } log.warn(String.format("Invalid comparison result %s", comparison)); } return false; }
CompareFilter extends AbstractUploadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { final Comparison comparison = comparisonService.compare(file, local); switch(comparison) { case local: return true; case equal: if(file.isDirectory()) { return true; } if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; case remote: if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; } log.warn(String.format("Invalid comparison result %s", comparison)); } return false; } }
CompareFilter extends AbstractUploadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { final Comparison comparison = comparisonService.compare(file, local); switch(comparison) { case local: return true; case equal: if(file.isDirectory()) { return true; } if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; case remote: if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; } log.warn(String.format("Invalid comparison result %s", comparison)); } return false; } CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ComparisonServiceFilter comparisonService); }
CompareFilter extends AbstractUploadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { final Comparison comparison = comparisonService.compare(file, local); switch(comparison) { case local: return true; case equal: if(file.isDirectory()) { return true; } if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; case remote: if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; } log.warn(String.format("Invalid comparison result %s", comparison)); } return false; } CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ComparisonServiceFilter comparisonService); @Override AbstractUploadFilter withCache(final Cache<Path> cache); @Override boolean accept(final Path file, final Local local, final TransferStatus parent); }
CompareFilter extends AbstractUploadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { final Comparison comparison = comparisonService.compare(file, local); switch(comparison) { case local: return true; case equal: if(file.isDirectory()) { return true; } if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; case remote: if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with comparison %s", file, comparison)); } return false; } log.warn(String.format("Invalid comparison result %s", comparison)); } return false; } CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ProgressListener listener);  CompareFilter(final SymlinkResolver<Local> symlinkResolver, final Session<?> session,
                         final UploadFilterOptions options,
                         final ComparisonServiceFilter comparisonService); @Override AbstractUploadFilter withCache(final Cache<Path> cache); @Override boolean accept(final Path file, final Local local, final TransferStatus parent);  }