use of ch.cyberduck.core.local.DisabledApplicationQuitCallback in project cyberduck by iterate-ch.
the class DefaultWatchEditorTest method testNotfound.
@Test(expected = NoSuchFileException.class)
public void testNotfound() throws Exception {
final DefaultWatchEditor editor = new DefaultWatchEditor(new Host(new TestProtocol()), new Path("/remote", EnumSet.of(Path.Type.file)), new DisabledListProgressListener());
editor.watch(new Application("com.app"), new Local(System.getProperty("java.io.tmpdir") + "/notfound", UUID.randomUUID().toString()), new DisabledFileWatcherListener(), new DisabledApplicationQuitCallback());
}
use of ch.cyberduck.core.local.DisabledApplicationQuitCallback in project cyberduck by iterate-ch.
the class BrowserController method edit.
protected void edit(final Application application, final Path file) {
final Editor editor = editors.getOrDefault(file, EditorFactory.instance().create(pool.getHost(), file, this));
this.background(new WorkerBackgroundAction<>(this, pool, editor.open(application, new DisabledApplicationQuitCallback(), new DefaultEditorListener(this, pool, editor, new DefaultEditorListener.Listener() {
@Override
public void saved() {
reload(workdir, new PathReloadFinder().find(Collections.singletonList(file)), Collections.singletonList(file), true);
}
}))));
}
use of ch.cyberduck.core.local.DisabledApplicationQuitCallback in project cyberduck by iterate-ch.
the class AbstractEditorTest method testOpen.
@Test
public void testOpen() throws Exception {
final AtomicBoolean t = new AtomicBoolean();
final Host host = new Host(new TestProtocol());
final NullSession session = new NullTransferSession(host) {
@Override
@SuppressWarnings("unchecked")
public <T> T _getFeature(final Class<T> type) {
if (type.equals(Read.class)) {
return (T) new Read() {
@Override
public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) {
t.set(true);
return IOUtils.toInputStream("content", Charset.defaultCharset());
}
@Override
public boolean offset(final Path file) {
assertEquals(new Path("/f", EnumSet.of(Path.Type.file)), file);
return false;
}
};
}
return super._getFeature(type);
}
};
final AtomicBoolean e = new AtomicBoolean();
final Path file = new Path("/f", EnumSet.of(Path.Type.file));
final Local temporary = new DefaultTemporaryFileService().create(host.getUuid(), file);
file.attributes().setSize("content".getBytes().length);
final AbstractEditor editor = new AbstractEditor(host, file, new DisabledProgressListener()) {
@Override
public void close() {
//
}
@Override
protected void edit(final Application editor, final Path file, final Local temporary, final FileWatcherListener listener) {
e.set(true);
}
@Override
protected void watch(final Application application, final Local temporary, final FileWatcherListener listener, final ApplicationQuitCallback quit) {
//
}
};
editor.open(new Application("com.editor"), new DisabledApplicationQuitCallback(), new DisabledFileWatcherListener()).run(session);
assertTrue(t.get());
assertTrue(e.get());
assertTrue(temporary.exists());
}
Aggregations