public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return caller.readLine(msg, echo); }
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return processContext.readLine(msg, echo); }
protected final String readLine(String msg, boolean echo) throws IOException, InterruptedException { return processContext.readLine(msg, echo); }
@Override public void run() { try { String s = context.readLine("m", true); lines.add(s); } catch (Exception e) { e.printStackTrace(); } } };
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); line.set(s); try { syncC.await(); } catch (Exception e) { e.printStackTrace(); } context.end(ShellResponse.close()); } });
@Override public void run() { try { context.readLine("", true); } catch (InterruptedException e) { interrupteds.add(true); } catch (Exception e) { interrupteds.add(false); } } };
@Override public void run() { try { context.readLine("", true); } catch (InterruptedException e) { interrupteds.add(true); } catch (Exception e) { interrupteds.add(false); } } };
@Override public void run() { try { context.readLine("", true); } catch (InterruptedException e) { interrupteds.add(true); } catch (Exception e) { interrupteds.add(false); } } };
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()); } });
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()); } });
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()); } });
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return processContext.readLine(msg, echo); }
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return caller.readLine(msg, echo); }
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return processContext.readLine(msg, echo); }
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return caller.readLine(msg, echo); }
public String readLine(String msg, boolean echo) { return caller.readLine(msg, echo); }
public String readLine(String msg, boolean echo) { return processContext.readLine(msg, echo); }
context.readLine("", true); fail();
/** * Same than {@link #testReadLine1()} but we provide input before the thread read lines effectively * which leads to a simpler test since we need only one thread */ public void testReadLine2() throws Exception { 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.init(); console.on(KeyStrokes.a); console.on(KeyStrokes.ENTER); driver.assertChar('a').assertFlush().assertCRLF().assertFlush().assertEmpty(); driver.assertEmpty(); final ShellProcessContext context = contexts.poll(); assertNotNull(context); console.on(KeyStrokes.b); console.on(KeyStrokes.ENTER); driver.assertEmpty(); String line = context.readLine("m", true); driver.assertChar('m').assertFlush().assertChar('b').assertFlush().assertCRLF().assertFlush().assertEmpty(); assertEquals("b", line); }