Package com.carrotsearch.ant.tasks.junit4.balancers

Examples of com.carrotsearch.ant.tasks.junit4.balancers.RoundRobinBalancer


    return suite;
  }

  public JsonArray serializeEvents(AggregatedSuiteResultEvent e, JsonSerializationContext context) {
    final JsonArray output = new JsonArray();
    final ForkedJvmInfo slave = e.getSlave();
    int lineBuffer = 160;
    final StringWriter out = new StringWriter();
    final StringWriter err = new StringWriter();
    WriterOutputStream stdout = new WriterOutputStream(out, slave.getCharset(), lineBuffer, false);
    WriterOutputStream stderr = new WriterOutputStream(err, slave.getCharset(), lineBuffer, false);
    for (IEvent evt : e.getEventStream()) {
      try {
        JsonObject marker;
        switch (evt.getType()) {
          case SUITE_FAILURE:
View Full Code Here


    isStatusShown(TestStatus.ERROR);
    if (!isStatusShown(status)) {
      return;
    }

    SlaveInfo slave = result.getSlave();
    Description description = result.getDescription();
    List<FailureMirror> failures = result.getFailures();

    StringBuilder line = new StringBuilder();
    line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
    line.append(formatTime(timeMillis));
    if (slave.slaves > 1) {
      final int digits = 1 + (int) Math.floor(Math.log10(slave.slaves));
      line.append(String.format(" S%-" + digits + "d", slave.id));
    }   
    line.append(" | ");

    String className = description.getClassName();
    if (className != null) {
      String [] components = className.split("[\\.]");
      className = components[components.length - 1];
      line.append(className);
      if (description.getMethodName() != null) {
        line.append(".").append(description.getMethodName());
      } else {
        line.append(" (suite)");
      }
    } else {
      if (description.getMethodName() != null) {
        line.append(description.getMethodName());
      }
    }
    line.append("\n");

    if (showThrowable && !failures.isEmpty()) {
      StringWriter sw = new StringWriter();
      PrefixedWriter pos = new PrefixedWriter(indent, sw);
      int count = 0;
      for (FailureMirror fm : failures) {
        count++;
        try {
          final String details =
              (showStackTraces && !fm.isAssumptionViolation())
              ? fm.getTrace()
              : fm.getThrowableString();

          pos.write(String.format(Locale.ENGLISH,
              "Throwable #%d: %s",
              count, details));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      if (sw.getBuffer().length() > 0) {
        line.append(sw.toString());
        line.append("\n");
      }
    }

    if (showOutputStream || showErrorStream) {
      StringWriter sw = new StringWriter();
      Writer stdout = new PrefixedWriter(stdoutIndent, new LineBufferWriter(sw));
      Writer stderr = new PrefixedWriter(stderrIndent, new LineBufferWriter(sw));
      slave.decodeStreams(result.getEventStream(), stdout, stderr);
     
      if (sw.getBuffer().length() > 0) {
        line.append(sw.toString());
        line.append("\n");
      }
View Full Code Here

    return suite;
  }

  public JsonArray serializeEvents(AggregatedSuiteResultEvent e, JsonSerializationContext context) {
    final JsonArray output = new JsonArray();
    final SlaveInfo slave = e.getSlave();
    int lineBuffer = 160;
    final StringWriter out = new StringWriter();
    final StringWriter err = new StringWriter();
    WriterOutputStream stdout = new WriterOutputStream(out, slave.getCharset(), lineBuffer, false);
    WriterOutputStream stderr = new WriterOutputStream(err, slave.getCharset(), lineBuffer, false);
    for (IEvent evt : e.getEventStream()) {
      try {
        JsonObject marker;
        switch (evt.getType()) {
          case SUITE_FAILURE:
View Full Code Here

    return suite;
  }

  public JsonArray serializeEvents(AggregatedSuiteResultEvent e, JsonSerializationContext context) {
    final JsonArray output = new JsonArray();
    final SlaveInfo slave = e.getSlave();
    int lineBuffer = 160;
    final StringWriter out = new StringWriter();
    final StringWriter err = new StringWriter();
    WriterOutputStream stdout = new WriterOutputStream(out, slave.getCharset(), lineBuffer, false);
    WriterOutputStream stderr = new WriterOutputStream(err, slave.getCharset(), lineBuffer, false);
    for (IEvent evt : e.getEventStream()) {
      try {
        JsonObject marker;
        switch (evt.getType()) {
          case SUITE_FAILURE:
View Full Code Here

    isStatusShown(TestStatus.ERROR);
    if (!isStatusShown(status)) {
      return;
    }

    SlaveInfo slave = result.getSlave();
    Description description = result.getDescription();
    List<FailureMirror> failures = result.getFailures();

    StringBuilder line = new StringBuilder();
    line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
    line.append(formatTime(timeMillis));
    if (slave.slaves > 1) {
      final int digits = 1 + (int) Math.floor(Math.log10(slave.slaves));
      line.append(String.format(" S%-" + digits + "d", slave.id));
    }   
    line.append(" | ");

    String className = description.getClassName();
    if (className != null) {
      String [] components = className.split("[\\.]");
      className = components[components.length - 1];
      line.append(className);
      if (description.getMethodName() != null) {
        line.append(".").append(description.getMethodName());
      } else {
        line.append(" (suite)");
      }
    } else {
      if (description.getMethodName() != null) {
        line.append(description.getMethodName());
      }
    }
    line.append("\n");

    if (showThrowable && !failures.isEmpty()) {
      StringWriter sw = new StringWriter();
      PrefixedWriter pos = new PrefixedWriter(indent, sw);
      int count = 0;
      for (FailureMirror fm : failures) {
        count++;
        try {
          final String details =
              (showStackTraces && !fm.isAssumptionViolation())
              ? fm.getTrace()
              : fm.getThrowableString();

          pos.write(String.format(Locale.ENGLISH,
              "Throwable #%d: %s",
              count, details));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      if (sw.getBuffer().length() > 0) {
        line.append(sw.toString());
        line.append("\n");
      }
    }

    if (showOutputStream || showErrorStream) {
      StringWriter sw = new StringWriter();
      Writer stdout = new PrefixedWriter(stdoutIndent, new LineBufferWriter(sw));
      Writer stderr = new PrefixedWriter(stderrIndent, new LineBufferWriter(sw));
      slave.decodeStreams(result.getEventStream(), stdout, stderr);
     
      if (sw.getBuffer().length() > 0) {
        line.append(sw.toString());
        line.append("\n");
      }
View Full Code Here

   * that should be load-balanced dynamically based on job stealing.
   */
  private List<String> loadBalanceSuites(List<SlaveInfo> slaveInfos,
      List<String> testClassNames, List<SuiteBalancer> balancers) {
    final List<SuiteBalancer> balancersWithFallback = Lists.newArrayList(balancers);
    balancersWithFallback.add(new RoundRobinBalancer());

    // Initialize per-slave lists.
    for (SlaveInfo si : slaveInfos) {
      si.testSuites = Lists.newArrayList();
    }
View Full Code Here

   * that should be load-balanced dynamically based on job stealing.
   */
  private List<String> loadBalanceSuites(List<SlaveInfo> slaveInfos,
      List<String> testClassNames, List<SuiteBalancer> balancers) {
    final List<SuiteBalancer> balancersWithFallback = Lists.newArrayList(balancers);
    balancersWithFallback.add(new RoundRobinBalancer());

    // Initialize per-slave lists.
    for (SlaveInfo si : slaveInfos) {
      si.testSuites = Lists.newArrayList();
    }
View Full Code Here

    };
    Collection<String> replicated = Collections2.transform(partitioned.get(true), extractClassName);
    Collection<String> suites     = Collections2.transform(partitioned.get(false), extractClassName);

    final List<SuiteBalancer> balancersWithFallback = Lists.newArrayList(balancers);
    balancersWithFallback.add(new RoundRobinBalancer());

    // Go through all the balancers, the first one to assign a suite wins.
    final Multiset<String> remaining = HashMultiset.create(suites);
    final Map<Integer,List<Assignment>> perJvmAssignments = Maps.newHashMap();
    for (ForkedJvmInfo si : jvmInfo) {
View Full Code Here

    };
    Collection<String> replicated = Collections2.transform(partitioned.get(true), extractClassName);
    Collection<String> suites     = Collections2.transform(partitioned.get(false), extractClassName);

    final List<SuiteBalancer> balancersWithFallback = Lists.newArrayList(balancers);
    balancersWithFallback.add(new RoundRobinBalancer());

    // Go through all the balancers, the first one to assign a suite wins.
    final Multiset<String> remaining = HashMultiset.create(suites);
    final Map<Integer,List<Assignment>> perJvmAssignments = Maps.newHashMap();
    for (ForkedJvmInfo si : jvmInfo) {
View Full Code Here

   * that should be load-balanced dynamically based on job stealing.
   */
  private List<String> loadBalanceSuites(List<SlaveInfo> slaveInfos,
      List<String> testClassNames, List<SuiteBalancer> balancers) {
    final List<SuiteBalancer> balancersWithFallback = Lists.newArrayList(balancers);
    balancersWithFallback.add(new RoundRobinBalancer());

    // Go through all the balancers, the first one to assign a suite wins.
    final Multiset<String> remaining = HashMultiset.create(testClassNames);
    final Map<Integer,List<Assignment>> perJvmAssignments = Maps.newHashMap();
    for (SlaveInfo si : slaveInfos) {
View Full Code Here

TOP

Related Classes of com.carrotsearch.ant.tasks.junit4.balancers.RoundRobinBalancer

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.