@Test public void testRunEmpty() throws Exception { final List<Path> files = new ArrayList<Path>(); WriteMetadataWorker worker = new WriteMetadataWorker(files, Collections.emptyMap(), false, new DisabledProgressListener()) { @Override public void cleanup(final Boolean result) { fail(); } }; worker.run(new NullSession(new Host(new TestProtocol())) { @Override @SuppressWarnings("unchecked") public <T> T _getFeature(final Class<T> type) { if(type == Metadata.class) { return (T) new Metadata() { @Override public Map<String, String> getDefault(final Local local) { return Collections.emptyMap(); } @Override public Map<String, String> getMetadata(final Path file) { fail(); return null; } @Override public void setMetadata(final Path file, final TransferStatus status) { fail(); } }; } return super._getFeature(type); } }); }
@Override public Boolean run(final Session<?> session) throws BackgroundException { final Metadata feature = session.getFeature(Metadata.class); if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", feature)); } for(Path file : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } this.write(session, feature, file); } return true; }
WriteMetadataWorker extends Worker<Boolean> { @Override public Boolean run(final Session<?> session) throws BackgroundException { final Metadata feature = session.getFeature(Metadata.class); if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", feature)); } for(Path file : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } this.write(session, feature, file); } return true; } }
WriteMetadataWorker extends Worker<Boolean> { @Override public Boolean run(final Session<?> session) throws BackgroundException { final Metadata feature = session.getFeature(Metadata.class); if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", feature)); } for(Path file : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } this.write(session, feature, file); } return true; } WriteMetadataWorker(List<Path> files, final Map<String, String> metadata,
                               final boolean recursive,
                               final ProgressListener listener);  WriteMetadataWorker(final List<Path> files, final Map<String, String> metadata,
                               final RecursiveCallback<String> callback,
                               final ProgressListener listener); }
WriteMetadataWorker extends Worker<Boolean> { @Override public Boolean run(final Session<?> session) throws BackgroundException { final Metadata feature = session.getFeature(Metadata.class); if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", feature)); } for(Path file : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } this.write(session, feature, file); } return true; } WriteMetadataWorker(List<Path> files, final Map<String, String> metadata,
                               final boolean recursive,
                               final ProgressListener listener);  WriteMetadataWorker(final List<Path> files, final Map<String, String> metadata,
                               final RecursiveCallback<String> callback,
                               final ProgressListener listener); @Override Boolean run(final Session<?> session); @Override String getActivity(); @Override Boolean initialize(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
WriteMetadataWorker extends Worker<Boolean> { @Override public Boolean run(final Session<?> session) throws BackgroundException { final Metadata feature = session.getFeature(Metadata.class); if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", feature)); } for(Path file : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } this.write(session, feature, file); } return true; } WriteMetadataWorker(List<Path> files, final Map<String, String> metadata,
                               final boolean recursive,
                               final ProgressListener listener);  WriteMetadataWorker(final List<Path> files, final Map<String, String> metadata,
                               final RecursiveCallback<String> callback,
                               final ProgressListener listener); @Override Boolean run(final Session<?> session); @Override String getActivity(); @Override Boolean initialize(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }