Examples of IExecutor


Examples of org.testng.internal.thread.IExecutor

   */
  public static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues, ITestResult testResult)
  throws InterruptedException, ThreadExecutionException {
//    ICountDown done= ThreadUtil.createCountDown(1);
//    IThreadFactory factory= ThreadUtil.createFactory();
    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    boolean finished= exec.awaitTermination(tm.getTimeOut());
 
    if(!finished) {
      exec.stopNow();
      testResult.setThrowable(new ThreadTimeoutException("Method "
                                                  + tm.getMethod()
                                                  + " didn't finish within the time-out "
                                                  + tm.getTimeOut()));
      testResult.setStatus(ITestResult.FAILURE);
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

   */
  public static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues, ITestResult testResult)
  throws InterruptedException, ThreadExecutionException {
//    ICountDown done= ThreadUtil.createCountDown(1);
//    IThreadFactory factory= ThreadUtil.createFactory();
    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    boolean finished= exec.awaitTermination(tm.getTimeOut());
 
    if(!finished) {
      exec.stopNow();
      testResult.setThrowable(new ThreadTimeoutException("Method "
                                                  + tm.getMethod()
                                                  + " didn't finish within the time-out "
                                                  + tm.getTimeOut()));
      testResult.setStatus(ITestResult.FAILURE);
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

  public static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues,
      ITestResult testResult)
  throws InterruptedException, ThreadExecutionException {
//    ICountDown done= ThreadUtil.createCountDown(1);
//    IThreadFactory factory= ThreadUtil.createFactory();
    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    long realTimeOut = calculateTimeOut(tm);
    boolean finished= exec.awaitTermination(realTimeOut);
 
    if(!finished) {
      exec.stopNow();
      ThreadTimeoutException exception = new ThreadTimeoutException("Method "
        + tm.getMethod()
        + " didn't finish within the time-out "
        + realTimeOut);
      exception.setStackTrace(exec.getStackTraces()[0]);
      testResult.setThrowable(exception);
      testResult.setStatus(ITestResult.FAILURE);
    }
    else {
      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3,
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

   */
  public static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues, ITestResult testResult)
  throws InterruptedException, ThreadExecutionException {
//    ICountDown done= ThreadUtil.createCountDown(1);
//    IThreadFactory factory= ThreadUtil.createFactory();
    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    boolean finished= exec.awaitTermination(tm.getTimeOut());
 
    if(!finished) {
      exec.stopNow();
      testResult.setThrowable(new ThreadTimeoutException("Method "
                                                  + tm.getMethod()
                                                  + " didn't finish within the time-out "
                                                  + tm.getTimeOut()));
      testResult.setStatus(ITestResult.FAILURE);
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

  }

  private static void invokeWithTimeoutWithNewExecutor(ITestNGMethod tm, Object instance,
      Object[] parameterValues, ITestResult testResult)
      throws InterruptedException, ThreadExecutionException {
    IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethod().getName());

    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future = exec.submitRunnable(imr);
    exec.shutdown();
    long realTimeOut = MethodHelper.calculateTimeOut(tm);
    boolean finished = exec.awaitTermination(realTimeOut);

    if (!finished) {
      exec.stopNow();
      ThreadTimeoutException exception = new ThreadTimeoutException("Method "
          + tm.getClass().getName() + "." + tm.getMethodName() + "()"
          + " didn't finish within the time-out " + realTimeOut);
      exception.setStackTrace(exec.getStackTraces()[0]);
      testResult.setThrowable(exception);
      testResult.setStatus(ITestResult.FAILURE);
    } else {
      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + tm.getMethod()
          + " completed within the time-out " + tm.getTimeOut());
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

   * @throws ThreadExecutionException
   */
  public static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues,
      ITestResult testResult)
  throws InterruptedException, ThreadExecutionException {
    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    long realTimeOut = calculateTimeOut(tm);
    boolean finished = exec.awaitTermination(realTimeOut);
 
    if (! finished) {
      exec.stopNow();
      ThreadTimeoutException exception = new ThreadTimeoutException("Method "
        + tm.getClass().getName() + "." + tm.getMethodName() + "()"
        + " didn't finish within the time-out "
        + realTimeOut);
      exception.setStackTrace(exec.getStackTraces()[0]);
      testResult.setThrowable(exception);
      testResult.setStatus(ITestResult.FAILURE);
    }
    else {
      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3,
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

     * @throws ThreadExecutionException
     */
    protected static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues,
        ITestResult testResult)
    throws InterruptedException, ThreadExecutionException {
      IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());

      InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
      IFutureResult future= exec.submitRunnable(imr);
      exec.shutdown();
      long realTimeOut = MethodHelper.calculateTimeOut(tm);
      boolean finished = exec.awaitTermination(realTimeOut);

      if (! finished) {
        exec.stopNow();
        ThreadTimeoutException exception = new ThreadTimeoutException("Method "
          + tm.getClass().getName() + "." + tm.getMethodName() + "()"
          + " didn't finish within the time-out "
          + realTimeOut);
        exception.setStackTrace(exec.getStackTraces()[0]);
        testResult.setThrowable(exception);
        testResult.setStatus(ITestResult.FAILURE);
      }
      else {
        Utils.log("Invoker " + Thread.currentThread().hashCode(), 3,
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

  }

  private static void invokeWithTimeoutWithNewExecutor(ITestNGMethod tm, Object instance,
      Object[] parameterValues, ITestResult testResult)
      throws InterruptedException, ThreadExecutionException {
    IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethod().getName());

    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future = exec.submitRunnable(imr);
    exec.shutdown();
    long realTimeOut = MethodHelper.calculateTimeOut(tm);
    boolean finished = exec.awaitTermination(realTimeOut);

    if (!finished) {
      exec.stopNow();
      ThreadTimeoutException exception = new ThreadTimeoutException("Method "
          + tm.getClass().getName() + "." + tm.getMethodName() + "()"
          + " didn't finish within the time-out " + realTimeOut);
      exception.setStackTrace(exec.getStackTraces()[0]);
      testResult.setThrowable(exception);
      testResult.setStatus(ITestResult.FAILURE);
    } else {
      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + tm.getMethod()
          + " completed within the time-out " + tm.getTimeOut());
View Full Code Here

Examples of org.testng.internal.thread.IExecutor

     * @throws ThreadExecutionException
     */
    protected static void invokeWithTimeout(ITestNGMethod tm, Object instance, Object[] parameterValues,
        ITestResult testResult)
    throws InterruptedException, ThreadExecutionException {
      IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
      InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
      IFutureResult future= exec.submitRunnable(imr);
      exec.shutdown();
      long realTimeOut = MethodHelper.calculateTimeOut(tm);
      boolean finished = exec.awaitTermination(realTimeOut);
 
      if (! finished) {
        exec.stopNow();
        ThreadTimeoutException exception = new ThreadTimeoutException("Method "
          + tm.getClass().getName() + "." + tm.getMethodName() + "()"
          + " didn't finish within the time-out "
          + realTimeOut);
        exception.setStackTrace(exec.getStackTraces()[0]);
        testResult.setThrowable(exception);
        testResult.setStatus(ITestResult.FAILURE);
      }
      else {
        Utils.log("Invoker " + Thread.currentThread().hashCode(), 3,
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.