@Test public void testAction() 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("p", "t") { @Override public boolean exists() { return true; } @Override public AttributedList<Local> list() { return new AttributedList<Local>(Collections.<Local>singletonList(new NullLocal("p", "a"))); } })); final AtomicBoolean prompt = new AtomicBoolean(); final NullSession session = new NullSession(new Host(new TestProtocol())); assertNull(t.action(session, null, false, false, new DisabledTransferPrompt() { @Override public TransferAction prompt(final TransferItem file) { prompt.set(true); return null; } }, new DisabledListProgressListener())); assertTrue(prompt.get()); }
@Override public TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested, final TransferPrompt prompt, final ListProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Find transfer action for Resume=%s,Reload=%s", resumeRequested, reloadRequested)); } if(resumeRequested) { if(action.equals(TransferAction.callback)) { return action = prompt.prompt(item); } return action; } return action = prompt.prompt(item); }
SyncTransfer extends Transfer { @Override public TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested, final TransferPrompt prompt, final ListProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Find transfer action for Resume=%s,Reload=%s", resumeRequested, reloadRequested)); } if(resumeRequested) { if(action.equals(TransferAction.callback)) { return action = prompt.prompt(item); } return action; } return action = prompt.prompt(item); } }
SyncTransfer extends Transfer { @Override public TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested, final TransferPrompt prompt, final ListProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Find transfer action for Resume=%s,Reload=%s", resumeRequested, reloadRequested)); } if(resumeRequested) { if(action.equals(TransferAction.callback)) { return action = prompt.prompt(item); } return action; } return action = prompt.prompt(item); } SyncTransfer(final Host host, final TransferItem item);  SyncTransfer(final Host host, final TransferItem item, final TransferAction action); }
SyncTransfer extends Transfer { @Override public TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested, final TransferPrompt prompt, final ListProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Find transfer action for Resume=%s,Reload=%s", resumeRequested, reloadRequested)); } if(resumeRequested) { if(action.equals(TransferAction.callback)) { return action = prompt.prompt(item); } return action; } return action = prompt.prompt(item); } 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 TransferAction action(final Session<?> source, final Session<?> destination, final boolean resumeRequested, final boolean reloadRequested, final TransferPrompt prompt, final ListProgressListener listener) { if(log.isDebugEnabled()) { log.debug(String.format("Find transfer action for Resume=%s,Reload=%s", resumeRequested, reloadRequested)); } if(resumeRequested) { if(action.equals(TransferAction.callback)) { return action = prompt.prompt(item); } return action; } return action = prompt.prompt(item); } 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();  }