protected ShellResponse execute(String request) { return ShellResponse.ok(); }
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { calls.set(request); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { calls.set(request); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
public void run(String request, ShellProcessContext context) throws Exception { syncA.await(); syncB.await(); context.append("foo"); context.end(ShellResponse.ok()); } });
public void run(String request, ShellProcessContext context) throws Exception { context.append("bar"); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } };
public void run(String request, ShellProcessContext context) throws Exception { context.append("bar"); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } });
public void run(String request, ShellProcessContext context) throws Exception { try { syncA.await(); syncB.await(); } catch (Exception e) { e.printStackTrace(); } String s = context.readLine("hello", true); if (s == null) { s = "cancelled"; } line.set(s); try { syncC.await(); } catch (Exception e) { e.printStackTrace(); } context.append("foo"); context.end(ShellResponse.ok()); } });
@Override ShellResponse doInvoke(final ShellProcessContext context) throws InterruptedException { CRaSHProcessContext invocationContext = new CRaSHProcessContext(session, context); try { command.invoke(invocationContext); return ShellResponse.ok(); } catch (CommandException e) { return build(e); } catch (Throwable t) { return build(t); } finally { Utils.close(invocationContext); } }
public void run(String request, ShellProcessContext context) throws Exception { try { syncA.await(); } catch (Exception e) { e.printStackTrace(); } String s = context.readLine("hello", true); if (s == null) { s = "cancelled"; } line.set(s); try { syncB.await(); } catch (Exception e) { e.printStackTrace(); } context.append("foo"); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { context.append("world"); context.end(ShellResponse.ok()); requests.add(request); } });
public void testPrompt() { driver.assertEmpty(); prompt = "% "; console.init(); driver.assertChar('%').assertChar(' ').assertFlush().assertEmpty(); final ArrayBlockingQueue<ShellProcessContext> contexts = new ArrayBlockingQueue<ShellProcessContext>(1); shell.addProcess(new SyncProcess() { @Override public void run(String request, ShellProcessContext context) throws Exception { contexts.add(context); } }); console.on(KeyStrokes.a); console.on(KeyStrokes.ENTER); driver.assertChar('a').assertFlush().assertCRLF().assertFlush().assertEmpty(); driver.assertEmpty(); ShellProcessContext context = contexts.poll(); assertNotNull(context); context.end(ShellResponse.ok()); driver.assertCRLF().assertFlush().assertChar('%').assertChar(' ').assertFlush().assertEmpty(); }