Package com.carrotsearch.ant.tasks.junit4.events.BootstrapEvent

Examples of com.carrotsearch.ant.tasks.junit4.events.BootstrapEvent.EventChannelType


      .create();
   
    while (true) {
      reader.beginArray();
      EventType type = EventType.valueOf(reader.nextString());
      IStreamEvent evt;
      switch (type) {
        case APPEND_STDERR:
        case APPEND_STDOUT:
          evt = (IStreamEvent) gson.fromJson(reader, type.eventClass);
          evt.copyTo(System.out);
          break;
        default:
          System.out.println("\n\n## " + type);
          reader.skipValue();
      }
View Full Code Here


      .create();
   
    while (true) {
      reader.beginArray();
      EventType type = EventType.valueOf(reader.nextString());
      IStreamEvent evt;
      switch (type) {
        case APPEND_STDERR:
        case APPEND_STDOUT:
          evt = (IStreamEvent) gson.fromJson(reader, type.eventClass);
          System.out.write(evt.getChunk());
          break;
        default:
          System.out.println("\n\n## " + type);
          reader.skipValue();
      }
View Full Code Here

  }

  @Override
  protected String computeNext() {
    try {
      serializer.serialize(new IdleEvent());
      serializer.flush();

      String line = reader.readLine();
      return line != null ? line : endOfData();
    } catch (IOException e) {
View Full Code Here

      restoreStreams();
    }

    if (serializer != null) {
      try {
        serializer.serialize(new QuitEvent());
        serializer.getOutputStream().close();
      } catch (IOException e) {
        // Ignore.
      }
    }
View Full Code Here

      restoreStreams();
    }

    if (serializer != null) {
      try {
        serializer.serialize(new QuitEvent());
        serializer.getOutputStream().close();
      } catch (IOException e) {
        // Ignore.
      }
    }
View Full Code Here

    check("\n\t".getBytes("UTF-8"));
  }

  private void check(byte[] bytes) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Serializer s = new Serializer(baos);
    s.serialize(new AppendStdErrEvent(bytes, 0, bytes.length));
    s.flush();
    s.close();

    Deserializer deserializer = new Deserializer(new ByteArrayInputStream(baos.toByteArray()),
        Thread.currentThread().getContextClassLoader());
    IEvent deserialize = deserializer.deserialize();
   
View Full Code Here

  /**
   * Console entry point.
   */
  public static void main(String[] args) {
    int exitStatus = 0;
    Serializer serializer = null;
    try {
      // Pick the communication channel.
      final BootstrapEvent.EventChannelType channel = establishCommunicationChannel();
      new Serializer(System.out)
        .serialize(new BootstrapEvent(channel))
        .flush();

      final int bufferSize = 16 * 1024;
      switch (channel) {
        case STDERR:
          serializer = new Serializer(new BufferedOutputStream(System.err, bufferSize));
          warnings = System.out;
          break;

        case STDOUT:
          serializer = new Serializer(new BufferedOutputStream(System.out, bufferSize));
          warnings = System.err;
          break;

        default:
          warnings = System.err;
          throw new RuntimeException("Communication not implemented: " + channel);
      }

      // Redirect original streams and start running tests.
      redirectStreams(serializer);
      final SlaveMain main = new SlaveMain(serializer);
      parseArguments(main, args);
      main.execute();
    } catch (Throwable t) {
      warn("Exception at main loop level?", t);
      exitStatus = -1;
    } finally {
      restoreStreams();
    }

    if (serializer != null) {
      try {
        serializer.serialize(new QuitEvent());
        serializer.getOutputStream().close();
      } catch (IOException e) {
        // Ignore.
      }
    }

View Full Code Here

  /**
   * Console entry point.
   */
  public static void main(String[] args) {
    int exitStatus = 0;
    Serializer serializer = null;
    try {
      // Pick the communication channel.
      final BootstrapEvent.EventChannelType channel = establishCommunicationChannel();
      new Serializer(System.out)
        .serialize(new BootstrapEvent(channel))
        .flush();

      final int bufferSize = 16 * 1024;
      switch (channel) {
        case STDERR:
          serializer = new Serializer(new BufferedOutputStream(System.err, bufferSize));
          warnings = System.out;
          break;

        case STDOUT:
          serializer = new Serializer(new BufferedOutputStream(System.out, bufferSize));
          warnings = System.err;
          break;

        default:
          warnings = System.err;
          throw new RuntimeException("Communication not implemented: " + channel);
      }

      // Redirect original streams and start running tests.
      redirectStreams(serializer);
      final SlaveMain main = new SlaveMain(serializer);
      parseArguments(main, args);
      main.execute();
    } catch (Throwable t) {
      warn("Exception at main loop level?", t);
      exitStatus = -1;
    } finally {
      restoreStreams();
    }

    if (serializer != null) {
      try {
        serializer.serialize(new QuitEvent());
        serializer.getOutputStream().close();
      } catch (IOException e) {
        // Ignore.
      }
    }

View Full Code Here

    if (suiteFailures != null) {
      suiteFailures.add(e.getFailure());
    } else {
      receiveSuiteStart(new SuiteStartedEvent(e.getDescription()));
      suiteFailures.add(e.getFailure());
      receiveSuiteEnd(new SuiteCompletedEvent(e.getDescription(), System.currentTimeMillis(), 0));
    }
  }
View Full Code Here

    if (suiteFailures != null) {
      suiteFailures.add(e.getFailure());
    } else {
      receiveSuiteStart(new SuiteStartedEvent(e.getDescription()));
      suiteFailures.add(e.getFailure());
      receiveSuiteEnd(new SuiteCompletedEvent(e.getDescription(), System.currentTimeMillis(), 0));
    }
  }
View Full Code Here

TOP

Related Classes of com.carrotsearch.ant.tasks.junit4.events.BootstrapEvent.EventChannelType

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.