Package org.junit.runners.model

Examples of org.junit.runners.model.RunnerScheduler


    @Test
    public void useChildHarvester() throws InitializationError {
        log = "";
        ParentRunner<?> runner = new BlockJUnit4ClassRunner(FruitTest.class);
        runner.setScheduler(new RunnerScheduler() {
            public void schedule(Runnable childStatement) {
                log += "before ";
                childStatement.run();
                log += "after ";
            }
View Full Code Here


    protected boolean isIgnored(T child) {
        return false;
    }

    private void runChildren(final RunNotifier notifier) {
        final RunnerScheduler currentScheduler = scheduler;
        try {
            for (final T each : getFilteredChildren()) {
                currentScheduler.schedule(new Runnable() {
                    public void run() {
                        ParentRunner.this.runChild(each, notifier);
                    }
                });
            }
        } finally {
            currentScheduler.finished();
        }
    }
View Full Code Here

        return new ParallelComputer(false, true);
    }

    private static Runner parallelize(Runner runner) {
        if (runner instanceof ParentRunner) {
            ((ParentRunner<?>) runner).setScheduler(new RunnerScheduler() {
                private final ExecutorService fService = Executors.newCachedThreadPool();

                public void schedule(Runnable childStatement) {
                    fService.submit(childStatement);
                }
View Full Code Here

    return new ParallelComputer(false, true);
  }

  private static <T> Runner parallelize(Runner runner) {
    if (runner instanceof ParentRunner<?>) {
      ((ParentRunner<?>) runner).setScheduler(new RunnerScheduler() {
        private final List<Future<Object>> fResults= new ArrayList<Future<Object>>();

        private final ExecutorService fService= Executors
            .newCachedThreadPool();
View Full Code Here

* use the same object keys in different tests!  And if you can help it, try not to use the same bucket either!
*/
public class ConcurrentJunitRunner extends BlockJUnit4ClassRunner {
    public ConcurrentJunitRunner(final Class<?> klass) throws InitializationError {
        super(klass);
        setScheduler(new RunnerScheduler() {
            ExecutorService executorService = Executors.newFixedThreadPool(
                    klass.isAnnotationPresent(Concurrent.class) ?
                            klass.getAnnotation(Concurrent.class).threads() :
                            (int) (Runtime.getRuntime().availableProcessors() * 1.5),
                    new NamedThreadFactory(klass.getSimpleName()));
View Full Code Here

  @Test
  public void useChildHarvester() throws InitializationError {
    log= "";
    ParentRunner<?> runner= new BlockJUnit4ClassRunner(FruitTest.class);
    runner.setScheduler(new RunnerScheduler() {
      public void schedule(Runnable childStatement) {
        log+= "before ";
        childStatement.run();
        log+= "after ";
      }
View Full Code Here

public class ConcurrentJunitRunner extends BlockJUnit4ClassRunner {

  public ConcurrentJunitRunner(final Class<?> klass) throws InitializationError {
    super(klass);
    setScheduler(new RunnerScheduler() {
      ExecutorService executorService = Executors.newFixedThreadPool(
          klass.isAnnotationPresent(Concurrent.class) ? klass.getAnnotation(
              Concurrent.class).threads() : (int) (Runtime.getRuntime()
              .availableProcessors() * 1.5),
          new NamedThreadFactory(klass.getSimpleName()));
View Full Code Here

    return new ParallelComputer2(false, true);
  }

  private static <T> Runner parallelize(Runner runner) {
    if (runner instanceof ParentRunner<?>) {
      ((ParentRunner<?>) runner).setScheduler(new RunnerScheduler() {
        private final List<Future<Object>> fResults = new ArrayList<Future<Object>>();

        private final ExecutorService fService = Executors.newFixedThreadPool(NUM_THREADS);

        public void schedule(final Runnable childStatement) {
View Full Code Here

                        return runner;
                }
                return null;
            }
        });
        setScheduler(new RunnerScheduler() {
            ExecutorService executorService = Executors.newFixedThreadPool(
                    klass.isAnnotationPresent(Concurrent.class) ?
                            klass.getAnnotation(Concurrent.class).threads() :
                            (int) (Runtime.getRuntime().availableProcessors() * 1.5),
                    new NamedThreadFactory(klass.getSimpleName()));
View Full Code Here

* @author Mathieu Carbou (mathieu.carbou@gmail.com)
*/
public class ConcurrentJunitRunner extends BlockJUnit4ClassRunner {
    public ConcurrentJunitRunner(final Class<?> klass) throws InitializationError {
        super(klass);
        setScheduler(new RunnerScheduler() {
            ExecutorService executorService = Executors.newFixedThreadPool(
                    klass.isAnnotationPresent(Concurrent.class) ?
                            klass.getAnnotation(Concurrent.class).threads() :
                            (int) (Runtime.getRuntime().availableProcessors() * 1.5),
                    new NamedThreadFactory(klass.getSimpleName()));
View Full Code Here

TOP

Related Classes of org.junit.runners.model.RunnerScheduler

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.