Package test.shell.base

Examples of test.shell.base.BaseProcessContext.execute()


    final AtomicReference<Boolean> interrupted = new AtomicReference<Boolean>();
    Thread t = new Thread() {
      @Override
      public void run() {
        try {
          ctx.execute();
        }
        finally {
          interrupted.set(isInterrupted());
        }
      }
View Full Code Here


  public void testLoop() throws Exception {
    final BaseProcessContext ctx = create("invoke " + CancellationTestCase.class.getName() + " loopCallback");
    Thread t = new Thread() {
      @Override
      public void run() {
        ctx.execute();
      }
    };

    //
    loopLatch1 = new CountDownLatch(1);
View Full Code Here

    //
    ServerAutomaton server = new ServerAutomaton(serverOOS, serverOIS);

    ShellProcess process = server.createProcess("hello");
    BaseProcessContext context = BaseProcessContext.create(process);
    context.execute();
    assertInstance(ShellResponse.Ok.class, context.getResponse());
    assertEquals("juu", context.getOutput());

    //
    t.interrupt();
View Full Code Here

    //
    ServerAutomaton server = new ServerAutomaton(serverOOS, serverOIS);

    ShellProcess process = server.createProcess("hello");
    BaseProcessContext context = BaseProcessContext.create(process);
    context.execute();
    ShellResponse response = context.getResponse();
    assertInstance(ShellResponse.Close.class, response);

    //
    assertJoin(t);
View Full Code Here

    //
    final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
    Thread u = new Thread() {
      @Override
      public void run() {
        context.execute();
        ShellResponse response = context.getResponse();
        assertInstance(ShellResponse.Cancelled.class, response);
      }
    };
    u.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
View Full Code Here

    Shell asyncShell = new AsyncShell(Executors.newSingleThreadExecutor(), shell);

    //
    BaseProcessContext ctx = BaseProcessContext.create(asyncShell, "foo");
    ctx.addLineInput("juu");
    ctx.execute();

    //
    ShellResponse resp = ctx.getResponse();

    //
View Full Code Here

  public void testAsyncEvaluation() throws InterruptedException {
    AsyncShell connector = new AsyncShell(Executors.newSingleThreadExecutor(), lifeCycle.createShell());
    status = 0;
    BaseProcessContext ctx = BaseProcessContext.create(connector, "invoke " + AsyncShellTestCase.class.getName() + " bilto");
    ctx.execute();
    ShellResponse resp = ctx.getResponse();
    assertTrue("Was not expecting response to be " + resp.getMessage(), resp instanceof ShellResponse.Ok);
    assertEquals(1, status);
    ctx.getResponse();
  }
View Full Code Here

    Shell shell = new BaseShell();
    CommandQueue commands = new CommandQueue();
    AsyncShell  asyncShell = new AsyncShell(commands, shell);
    BaseProcessContext ctx = BaseProcessContext.create(asyncShell, "foo");
    asyncShell.close();
    ctx.execute();
    assertEquals(Status.TERMINATED, ((AsyncProcess)ctx.getProcess()).getStatus());
    assertEquals(ShellResponse.Cancelled.class, ctx.getResponse().getClass());
    assertEquals(0, commands.getSize());
  }
View Full Code Here

    lifeCycle.bindGroovy("foo", command);
    final BaseProcessContext process = create("foo");
    new Thread() {
      @Override
      public void run() {
        process.execute();
      }
    }.start();
    latch1.await(10, TimeUnit.SECONDS);
    process.on(null, new int[]{'a'});
    ShellResponse response = process.getResponse();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.