All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.carrotsearch.ant.tasks.junit4.balancers.RoundRobinBalancer Maven / Gradle / Ivy

package com.carrotsearch.ant.tasks.junit4.balancers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.carrotsearch.ant.tasks.junit4.JUnit4;
import com.carrotsearch.ant.tasks.junit4.SuiteBalancer;

/**
 * A round-robin suite balancer (default for non-assigned suites).
 */
public class RoundRobinBalancer implements SuiteBalancer {
 
  @Override
  public List assign(Collection suiteNames, int slaves, long seed) {
    List result = new ArrayList<>();
    int i = 0;
    for (String suite : suiteNames) {
      result.add(new Assignment(suite, i++, 0));
      if (i >= slaves) i = 0;
    }
    return result;
  }

  @Override
  public void setOwner(JUnit4 owner) {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy