Package org.apache.helix

Examples of org.apache.helix.ExternalCommand


    String testName = className + "_" + methodName;
   
    System.out.println("START " + testName + " at "
        + new Date(System.currentTimeMillis()));

    ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("helix_random_kill_local_startzk.sh");
    String output = cmd.getStringOutput("UTF8");
    int i = getStateTransitionLatency(0, output);
    int j = output.indexOf("ms", i);
    long latency = Long.parseLong(output.substring(i, j));
    System.out.println("startup latency: " + latency);
   
View Full Code Here


    String testName = className + "_" + methodName;
   
    System.out.println("START " + testName + " at "
        + new Date(System.currentTimeMillis()));

    ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("dummy.sh");
    String output = cmd.getStringOutput("UTF8");
    int idx = output.indexOf("this is a dummy test for verify ExternalCommand works");
    Assert.assertNotSame(idx, -1);
   
    System.out.println("END " + testName + " at "
        + new Date(System.currentTimeMillis()));
View Full Code Here

    }
  }

  public static ProcessStateCode getProcessState(String processId) throws Exception {
    if (OS_NAME.equals("Mac OS X") || OS_NAME.equals("Linux")) {
      ExternalCommand cmd = ExternalCommand.start("ps", processId);
      cmd.waitFor();

      // split by new lines
      // should return 2 lines for an existing process, or 1 line for a non-existing process
      String lines[] = cmd.getStringOutput().split("[\\r\\n]+");
      if (lines.length != 2) {
        LOG.info("process: " + processId + " not exist");
        return null;
      }
View Full Code Here

        timeoutValue = Long.parseLong(timeout);
      } catch (NumberFormatException e) {
        // OK to use 0
      }
    }
    ExternalCommand externalCmd =
        ExternalCommand.executeWithTimeout(new File(workingDir), cmdValue, timeoutValue, args);

    int exitValue = externalCmd.exitValue();

    // debug
    // System.out.println("command: " + cmd + ", exitValue: " + exitValue
    // + " output:\n" + externalCmd.getStringOutput());

    if (_logger.isDebugEnabled()) {
      _logger.debug("command: " + cmd + ", exitValue: " + exitValue + " output:\n"
          + externalCmd.getStringOutput());
    }

    // monitor pid if pidFile exists
    if (pidFile == null) {
      // no pid to monitor
View Full Code Here

    String methodName = TestHelper.getTestMethodName();
    String testName = className + "_" + methodName;

    System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));

    ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("helix_random_kill_local_startzk.sh");
    String output = cmd.getStringOutput("UTF8");
    int i = getStateTransitionLatency(0, output);
    int j = output.indexOf("ms", i);
    long latency = Long.parseLong(output.substring(i, j));
    System.out.println("startup latency: " + latency);
View Full Code Here

    String methodName = TestHelper.getTestMethodName();
    String testName = className + "_" + methodName;

    System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));

    ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("dummy.sh");
    String output = cmd.getStringOutput("UTF8");
    int idx = output.indexOf("this is a dummy test for verify ExternalCommand works");
    Assert.assertNotSame(idx, -1);

    System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
View Full Code Here

        timeoutValue = Long.parseLong(timeout);
      } catch (NumberFormatException e) {
        // OK to use 0
      }
    }
    ExternalCommand externalCmd =
        ExternalCommand.executeWithTimeout(new File(workingDir), cmdValue, timeoutValue, args);

    int exitValue = externalCmd.exitValue();

    // debug
    // System.out.println("command: " + cmd + ", exitValue: " + exitValue
    // + " output:\n" + externalCmd.getStringOutput());

    if (_logger.isDebugEnabled()) {
      _logger.debug("command: " + cmd + ", exitValue: " + exitValue + " output:\n"
          + externalCmd.getStringOutput());
    }

    // monitor pid if pidFile exists
    if (pidFile == null) {
      // no pid to monitor
View Full Code Here

        timeoutValue = Long.parseLong(timeout);
      } catch (NumberFormatException e) {
        // OK to use 0
      }
    }
    ExternalCommand externalCmd =
        ExternalCommand.executeWithTimeout(new File(workingDir), cmdValue, timeoutValue, args);

    int exitValue = externalCmd.exitValue();

    // debug
    // System.out.println("command: " + cmd + ", exitValue: " + exitValue
    // + " output:\n" + externalCmd.getStringOutput());

    if (_logger.isDebugEnabled()) {
      _logger.debug("command: " + cmd + ", exitValue: " + exitValue + " output:\n"
          + externalCmd.getStringOutput());
    }

    // monitor pid if pidFile exists
    if (pidFile == null) {
      // no pid to monitor
View Full Code Here

    String methodName = TestHelper.getTestMethodName();
    String testName = className + "_" + methodName;

    System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));

    ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("helix_random_kill_local_startzk.sh");
    String output = cmd.getStringOutput("UTF8");
    int i = getStateTransitionLatency(0, output);
    int j = output.indexOf("ms", i);
    long latency = Long.parseLong(output.substring(i, j));
    System.out.println("startup latency: " + latency);
View Full Code Here

    }
  }
 
  public static ProcessStateCode getProcessState(String processId) throws Exception {
    if (OS_NAME.equals("Mac OS X") || OS_NAME.equals("Linux")) {
      ExternalCommand cmd = ExternalCommand.start("ps", processId);
      cmd.waitFor();
     
      // split by new lines
      // should return 2 lines for an existing process, or 1 line for a non-existing process
      String lines[] = cmd.getStringOutput().split("[\\r\\n]+");
      if (lines.length != 2) {
        LOG.info("process: " + processId + " not exist");
        return null;
      }
     
View Full Code Here

TOP

Related Classes of org.apache.helix.ExternalCommand

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.