Exemple #1
0
 public static AnnotatedTest of(AnnotatedPackage aPackage) {
   TestTarget target = TestTarget.of(aPackage);
   List<AnnotatedTest> tests = forPackages(aPackage.packages);
   Log log = Logs.of();
   AnnotatedCallTree calls = log.annotatedCallTree();
   AnnotatedStackTrace invoked = log.annotatedStackTrace();
   Map<Assertion, Assertion.Result> results = ImmutableMap.of();
   return new AnnotatedTest(target, tests, calls, invoked, results);
 }
  /**
   * Produce the contents of a column name cell. The cell should link to a page for the column. It
   * should also have a tooltip with a description to the column and links for relevant hints (joins
   * and filters);
   */
  String nameCell(DBColumn column) {
    log.args(column);
    int width = maxWidth(column);
    String columnName = breakUp(column.name);

    if (columnName.length() > width) {
      columnName = columnName.substring(0, width);
    }
    Label text = Label.of(columnName);
    URIObject target = column.linkTo().getTarget();
    ImmutableList<DBColumn> joins = destinationColumns(column, hints.getJoinsFor(column));
    ImmutableList<DBRowFilter> filters = hints.getFiltersFor(column);
    Tooltip tooltip = ColumnNameTooltip.columnJoinsFilters(column, joins, filters);
    String link = Link.textTargetTip(text, target, tooltip).toString();
    Keyness keyness = column.keyness;
    if (keyness == DBColumn.Keyness.NONE) {
      return link;
    }
    if (keyness == DBColumn.Keyness.PRIMARY) {
      return tags.img("Primary key", Icons.PRIMARY_KEY) + link;
    }
    if (keyness == DBColumn.Keyness.FOREIGN) {
      return tags.img("Foreign key", Icons.FOREIGN_KEY) + link;
    }
    throw new IllegalArgumentException("" + keyness);
  }
 /** Return a string to go in a table name cell. */
 String nameCell(DBTable table) {
   log.args(table);
   Label text = Label.of(table.name);
   URIObject target = table.linkTo().getTarget();
   return "Table : " + Link.textTarget(text, target).toString();
 }
 /** Return a string to go in a database name cell. */
 String nameCell(Database database) {
   log.args(database);
   Label text = Label.of(database.name);
   URIObject target = database.linkTo().getTarget();
   return "Database : " + Link.textTarget(text, target).toString();
 }
 private void debug(Object arg) {
   log.debug(arg);
 }
 private void info(String mesage) {
   log.info(mesage);
 }