Package fit

Examples of fit.Parse


    }
    return root.more;
  }

  private Parse buildCells(OSGiTestResult testResult) {
    Parse root = new Parse(null, null, null, null);
    Parse next = root;
    if (testResult.hasPassed()) {
      next = next.more = new Parse("td", "Pass", null, null);
      right(next);
    } else if (testResult.hasFailed()) {
      next = next.more = new Parse("td", "Fail", null, null);
      wrong(next);
    } else if (testResult.hasErrored()) {
      next = next.more = new Parse("td", "Error", null, null);
      exception(next, testResult.getThrowable());
    }
    String testName = testResult.getMethodName();
    next = next.more = new Parse("td", testName, null, null);
    if (!testResult.hasPassed()) {
      next = next.more = new Parse("td", escape(testResult.getMessage()), null, null);
    } else {
      next = next.more = new Parse("td", " ", null, null);
    }
    return root.more;
  }
View Full Code Here


  public final Fixture ensureSourceAndTargetHas() {
    return ensuringTargetIsConsistentWithSource();
  }

  public final void withConfiguration(final Parse cells) throws IOException {
    Parse args = cells.more;
    if (args == null) {
      throw new MissingCellsFailureException(cells.text()
          + " requires an argument");
    }
    String cmdString = args.text();
    connector = factory.createMongoSourceTargetConnector(cmdString);
    cmdString = parameters.replaceValuesIn(cmdString);
    args.addToBody("<hr/>" + label("Substituted Output") + "<hr/>");
    args.addToBody("<pre/>" + cmdString + "</pre>");
  }
View Full Code Here

    stderr = new PrintStream(err, true);
    this.namedParams = namedParams;
  }

  public final void andRun(final Parse cells) throws IOException {
    Parse args = cells.more;
    if (args == null) {
      throw new MissingCellsFailureException(cells.text()
          + " requires an argument");
    }
    runCommandWith(args);
View Full Code Here

      stderr.close();
    }
  }

  public final void andShow(final Parse cells) {
    Parse stream = cells.more;
    if (stream == null) {
      throw new MissingCellsFailureException(cells.text()
          + " requires an argument");
    }
    String consoleStream = stream.text();
    if (STDOUT.equalsIgnoreCase(consoleStream)) {
      stream.addToBody("<hr/>" + label("Console Output") + "<hr/>");
      stream.addToBody("<pre/>" + out.toString() + "</pre>");
    } else if (STDERR.equalsIgnoreCase(consoleStream)) {
      stream.addToBody("<hr/>" + label("Console Error") + "<hr/>");
      stream.addToBody("<pre/>" + err.toString() + "</pre>");
    } else {
      throw new FitFailureException("Don't know how to process "
          + consoleStream
          + ", valid values are: <pre>stdout, stderr</pre>");
    }
View Full Code Here

    mongo = new MongoClient(host, port);
    mongo.getDB("test").command("ismaster");
  }

  public final void useDatabase(final Parse cells) {
    Parse expected = cells.more;
    if (expected == null) {
        throw new MissingCellsFailureException(cells.text()
        + " requires an argument");
    }
    String databaseName = expected.text();
    db = mongo.getDB(databaseName);
    String actual = db.getName();
    if (databaseName.equals(actual)) {
        right(expected);
    } else {
View Full Code Here

        wrong(expected, actual);
    }
  }

  public final void run(final Parse cells) {
    Parse command = cells.more;
    if (command == null) {
        throw new MissingCellsFailureException(cells.text()
        + " requires an argument");
    }
    String cmdString = command.text();
    CommandResult result = db.doEval(cmdString);
    if (result.ok()) {
      right(command);
    } else {
      wrong(command, result.getErrorMessage());
View Full Code Here

    this.mongo = source;
    mongo.getDB("test").command("ismaster");
  }

  public final void useDatabase(final Parse cells) {
    Parse expected = cells.more;
    if (expected == null) {
      throw new MissingCellsFailureException(cells.text()
          + " requires an argument");
    }

    String databaseName = expected.text();
    db = mongo.getDB(databaseName);
    String actual = db.getName();
    if (databaseName.equals(actual)) {
      right(expected);
    } else {
View Full Code Here

      wrong(expected, actual);
    }
  }

  public final void run(final Parse cells) {
    Parse command = cells.more;
    if (command == null) {
      throw new MissingCellsFailureException(cells.text()
          + " requires an argument");
    }
    String cmdString = command.text();
    CommandResult result = db.doEval(cmdString);
    if (result.ok()) {
      right(command);
    } else {
      wrong(command, result.getErrorMessage());
View Full Code Here

  public Table(Parse table) {
    this.table = table;
  }

  public Table(String html) throws ParseException {
    this.table = new Parse(html);
  }
View Full Code Here

    firstRow.more = table.parts;
    table.parts = firstRow;
  }

  public Parse stripFirstRow() {
    Parse firstRow = table.parts;
    table.parts = table.parts.more;
    return firstRow;
  }
View Full Code Here

TOP

Related Classes of fit.Parse

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.