Example #1
0
  public void runTests(File swf) throws IOException {
    if (headless) {
      // creat headless process and run
      CommandFactory.createHeadlessStart(xcommand);
    }

    // setup command to run
    PlayerCommand command = CommandFactory.createPlayer(os, player, localTrusted);
    command.setProject(project);
    command.setSwf(swf);

    // run player command
    LoggingUtil.log("Launching player:\n" + command.describe());
    command.execute();

    if (snapshot) {
      // create snapshot command and run
      CommandFactory.createSnapshot(headless, xcommand);
    }

    if (headless) {
      // create stop headless process and run
      CommandFactory.createHeadlessStop(xcommand);
    }
  }
Example #2
0
  private OperatingSystem identifyOperatingSystem() {
    OperatingSystem os = null;
    String env = System.getProperty("os.name");

    if (env.startsWith(WINDOWS_OS)) {
      LoggingUtil.log("OS: [Windows]");
      os = OperatingSystem.WINDOWS;
    } else if (env.startsWith(MAC_OS_X)) {
      LoggingUtil.log("OS: [Mac OSX]");
      os = OperatingSystem.MACOSX;
    } else {
      LoggingUtil.log("OS: [Unix]");
      os = OperatingSystem.UNIX;
    }

    return os;
  }
  public Process launch() throws IOException {
    LoggingUtil.log(proxiedCommand.getCommandLine().describeCommand());

    // execute the command directly
    return Runtime.getRuntime()
        .exec(
            proxiedCommand.getCommandLine().getCommandline(),
            getJointEnvironment(),
            proxiedCommand.getProject().getBaseDir());
  }
  public void validate() throws BuildException {
    if (port < FLOOR_FOR_PORT) {
      throw new BuildException(
          "The provided 'port' property value ["
              + port
              + "] must be great than "
              + FLOOR_FOR_PORT
              + ".");
    }

    if (socketTimeout < SHORTEST_SOCKET_TIMEOUT) {
      throw new BuildException(
          "The provided 'timeout' property value ["
              + socketTimeout
              + "] must be great than "
              + SHORTEST_SOCKET_TIMEOUT
              + ".");
    }

    if (reportDir != null && !reportDir.exists()) {
      LoggingUtil.log(
          "Provided report directory path [" + reportDir.getPath() + "] does not exist.");
    }

    if (command != null && !command.exists()) {
      throw new BuildException("The provided command path [" + command + "] does not exist.");
    }

    if (headless) {
      if (OperatingSystem.identify() != OperatingSystem.LINUX) {
        throw new BuildException(
            "Headless mode can only be used on Linux with vncserver installed.");
      }

      if (display < 1) {
        throw new BuildException(
            "The provided 'display' number must be set higher than 0.  99 or higher is recommended.");
      }
    }
  }
Example #5
0
  /**
   * Updates counts for failed, error, and ignore on suite as well as logs what failed if told to
   * use logging.
   *
   * @param test Test XML document
   */
  private void checkForStatus(Document test) {
    // Get the root element and pull the test name and status
    final Element root = test.getRootElement();
    final String name = root.attributeValue(NAME_ATTRIBUTE);
    final String status = root.attributeValue(STATUS_ATTRIBUTE);

    String format = null;
    if (status.equals(FAILURE)) {
      format = FAILED_TEST;
      suite.addFailure();
    } else if (status.equals(ERROR)) {
      format = ERRORED_TEST;
      suite.addError();
    } else if (status.equals(IGNORE)) {
      format = IGNORED_TEST;
      suite.addSkip();
    }

    // Creates the fail message for use with verbose
    if (format != null) {
      final String message = MessageFormat.format(format, new Object[] {name, suite});
      LoggingUtil.log(message);
    }
  }
  public void log() {
    LoggingUtil.log("Using the following settings for the test run:");

    // FLEX_HOME not required to run if not using ADL
    if (flexHome != null) {
      LoggingUtil.log("\tFLEX_HOME: [" + flexHome.getAbsolutePath() + "]");
    }

    LoggingUtil.log("\thaltonfailure: [" + failOnTestFailure + "]");
    LoggingUtil.log("\theadless: [" + headless + "]");
    LoggingUtil.log("\tdisplay: [" + display + "]");
    LoggingUtil.log("\tlocalTrusted: [" + isLocalTrusted + "]");
    LoggingUtil.log("\tplayer: [" + player + "]");

    if (isCustomCommand()) {
      LoggingUtil.log("\tcommand: [" + command + "]");
    }

    LoggingUtil.log("\tport: [" + port + "]");
    LoggingUtil.log("\tswf: [" + swf + "]");
    LoggingUtil.log("\ttimeout: [" + socketTimeout + "ms]");
    LoggingUtil.log("\ttoDir: [" + reportDir.getAbsolutePath() + "]");
  }