Package fit

Examples of fit.Parse


      st = null;
    }
  }

  private Parse getDataRow(ResultSet rs) throws Exception {
    Parse newRow = new Parse("tr", null, null, null);
    ResultSetMetaData rsmd = rs.getMetaData();
    Parse prevCell = null;
    for (int i = 0; i < rsmd.getColumnCount(); i++) {
      Object value = rs.getObject(i + 1);
      value = DbParameterAccessor.normaliseValue(value);
      Parse cell = new Parse("td", Fixture.gray(value == null ? "null" : value.toString()), null, null);
      if (prevCell == null) {
        newRow.parts = cell;
      } else {
        prevCell.more = cell;
      }
View Full Code Here


    return newRow;

  }

  private Parse getHeaderFromRS(ResultSet rs) throws SQLException {
    Parse newRow = new Parse("tr", null, null, null);
    ResultSetMetaData rsmd = rs.getMetaData();
    Parse prevCell = null;
    for (int i = 0; i < rsmd.getColumnCount(); i++) {
      Parse cell = new Parse("td", Fixture.gray(rsmd.getColumnName(i + 1)), null, null);
      if (prevCell == null)
        newRow.parts = cell;
      else
        prevCell.more = cell;
      prevCell = cell;
View Full Code Here

  private MethodAccessor accessor;
  private PropertyBinding bindings[];
  private String parsePropertyMethodName;

  public void doRows(Parse rows) {
    Parse first = rows.parts;
    if (first == null) {
      throw new FitFailureException("You must specify a method.");
    }
    findMethod(first);
    Parse rest = rows.more;
    if (rest == null || rest.parts == null) {
      throw new RuntimeException("No test case is found!");
    }
    bindDtoProperties(rest.parts);
    super.doRows(rest.more);
View Full Code Here

   * @return
   */
  protected void findMethod(Parse cell) {
    String methodname = cell.text();
    methodname = StringHelper.camel(methodname);
    Parse argument = cell.more;
    if (StringHelper.isBlankOrNull(methodname)) {
      throw new FitFailureException("You must specify a method.");
    }
    try {
      if (argument == null) {
        this.accessor = MethodHelper.findMethodByArgCount(this, methodname, 1);
        this.dtoClazz = this.accessor.getMethod().getParameterTypes()[0];
      } else {
        String clazzName = argument.text();
        this.dtoClazz = Class.forName(clazzName);
        this.accessor = new MethodAccessor<Object>(this, methodname, dtoClazz);
      }
      this.right(cell);
    } catch (Throwable e) {
View Full Code Here

    }
  }

  @Override
  public void doRow(Parse row) {
    Parse cells = row.parts;
    try {
      Object para = this.instancePara(cells);
      Object result = accessor.invoke(this, new Object[] { para });
      if (!(result instanceof Boolean)) {
        this.right(cells);
View Full Code Here

    if (rows == null || rows.parts == null) {
      throw new FitFailureException("You must specify identified name of stored dto.");
    }
    dto = findDto(rows.parts);
    index = 0;
    Parse rest = rows.more;
    if (rest == null || rest.parts == null) {
      throw new RuntimeException("You must specify checked proproties!");
    }
    bindDtoProperties(rest.parts);
    currentRow = rest;
View Full Code Here

      addSurplusRow(dto);
    }
  }

  private void addSurplusRow(Object obj) {
    Parse newRow = new Parse("tr", null, null, null);
    currentRow.more = newRow;
    currentRow = newRow;
    try {
      String value = getValueFrom(obj, bindings[0]);
      Parse firstCell = new Parse("td", value, null, null);
      newRow.parts = firstCell;
      firstCell.addToBody(Fixture.gray(" surplus"));
      wrong(firstCell);
      for (int i = 1; i < bindings.length; i++) {
        Parse nextCell = new Parse("td", getValueFrom(obj, bindings[i]), null, null);
        firstCell.more = nextCell;
        firstCell = nextCell;
      }
    } catch (Throwable e) {
      exception(newRow, e);
View Full Code Here

  }

  @Override
  public void doRow(Parse row) {
    this.currentRow = row;
    Parse cells = row.parts;
    try {
      Object expected = getObjectByIndex();
      index++;
      for (int i = 0; cells != null && i < bindings.length; i++, cells = cells.more) {
        String binding = bindings[i];
View Full Code Here

    }
    return newRow;
  }

  private void addRowWithParamNames(Parse table, Map<String, DbParameterAccessor> params) {
    Parse newRow = new Parse("tr", null, null, null);
    table.parts.more = newRow;
    Parse prevCell = null;
    String orderedNames[] = new String[params.size()];
    for (String s : params.keySet()) {
      orderedNames[params.get(s).getPosition()] = s;
    }
    for (int i = 0; i < orderedNames.length; i++) {
      String name = orderedNames[i];
      if (params.get(name).getDirection() != DbParameterAccessor.INPUT)
        name = name + "?";
      Parse cell = new Parse("td", Fixture.gray(name), null, null);
      if (prevCell == null)
        newRow.parts = cell;
      else
        prevCell.more = cell;
      prevCell = cell;
View Full Code Here

    }
    PreparedStatement statement = null;
    try {
      initParameters(rows.parts);// init parameters from the first row
      statement = buildDeleteCommand(tableName, accessors);
      Parse row = rows;
      while ((row = row.more) != null) {
        deleteRowData(statement, row);
        right(row);
      }
    } catch (Throwable e) {
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.