Example #1
0
  public void killApp() throws Exception {
    // try to kill just by calling exit
    try {
      Client.getInstance().map("java.lang.System", "exit", 0);
    } catch (Exception e) {
      // this will actually throw an exception since it doesnt get a response from this command
    }

    // shut down the thread
    if (ap != null) {
      ap.close();
      ap.interrupt();
      ap = null;
    }

    // wait for the server to be dead
    for (int x = 0; x < 10; x++) {
      // try to make a query.. if it doesnt work then sleep
      TestLogger.get().info("Trying to see if server is still available..");

      if (!Client.getInstance().isListening()) break;

      if (x == 9) throw new Exception("Server is still available, but should not be");

      Thread.sleep(2000);
    }
  }
Example #2
0
  public void startApp() throws Exception {
    ap = new AppThread();
    ap.start();

    for (int x = 0; x < 10; x++) {
      // try to make a query.. if it doesnt work then sleep
      TestLogger.get().info("Trying to ping test server..");
      if (Client.getInstance().isListening()) break;

      if (x == 9) throw new Exception("Could not contact test server");

      Thread.sleep(5000);
    }
  }