Package test.shell.sync

Examples of test.shell.sync.SyncProcess


    final CyclicBarrier syncA = new CyclicBarrier(2);
    final CyclicBarrier syncB = new CyclicBarrier(2);
    final AtomicReference<String> line = new AtomicReference<String>();
    processor.addListener(term);
    term.publish(TermEvent.readLine("foo"));
    shell.addProcess(new SyncProcess() {
      public void run(String request, ShellProcessContext context) throws Exception {
        try {
          syncA.await();
        }
        catch (Exception e) {
View Full Code Here


*/
public class ViEofMaybeTestCase extends AbstractConsoleTestCase {

  public void testCtrlD1() throws Exception {
    final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1);
    SyncProcess process = new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        requests.add(request);
        context.end(ShellResponse.ok());
      }
View Full Code Here

    doTest(Mode.VI_INSERT);
  }

  private void doTest(Mode expected) {
    final AtomicReference<String> calls = new AtomicReference<String>();
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        calls.set(request);
        context.end(ShellResponse.ok());
      }
View Full Code Here

  // Vi move

  // The # key causes a comment to get inserted.
  public void testInsertComment1() throws Exception {
    final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1);
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        requests.add(request);
        context.end(ShellResponse.ok());
      }
View Full Code Here

    assertEquals("#putrified whales", request);
  }

  public void testInsertComment2() throws Exception {
    final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1);
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        requests.add(request);
        context.end(ShellResponse.ok());
      }
View Full Code Here

  }

  public void testProcess() throws Exception {
    final ArrayBlockingQueue<ShellProcessContext> contexts = new ArrayBlockingQueue<ShellProcessContext>(1);
    final CountDownLatch latch = new CountDownLatch(1);
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        contexts.add(context);
      }
      @Override
View Full Code Here

public class ViMoveAcceptLineTestCase extends AbstractConsoleTestCase {

  public void testEnter() {
    console.init();
    final AtomicReference<String> calls = new AtomicReference<String>();
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        calls.set(request);
        context.end(ShellResponse.ok());
      }
View Full Code Here

    console.init();
    doTest(Mode.VI_MOVE);
  }

  private void doTest(Mode mode) {
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        context.end(ShellResponse.ok());
      }
    });
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        context.end(ShellResponse.ok());
      }
    });
View Full Code Here

  }

  public void testProcess() {
    final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1);
    final ArrayBlockingQueue<ShellProcessContext> contexts = new ArrayBlockingQueue<ShellProcessContext>(1);
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        requests.add(request);
        contexts.add(context);
      }
    });
    console.init();
    console.on(KeyStrokes.a);
    console.on(KeyStrokes.ENTER);
    console.on(KeyStrokes.b);
    console.on(KeyStrokes.ENTER);
    assertEquals("a", requests.poll());
    ShellProcessContext context = contexts.poll();
    assertNotNull(context);
    shell.addProcess(new SyncProcess() {
      @Override
      public void run(String request, ShellProcessContext context) throws Exception {
        contexts.add(context);
      }
    });
View Full Code Here

    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);
      }
    });
View Full Code Here

TOP

Related Classes of test.shell.sync.SyncProcess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.