示例#1
0
 /**
  * Appends the missing tables of the given schema difference to the result
  *
  * @param schemaDifference The difference, not null
  * @param result The result to append to, not null
  */
 protected void appendMissingTableDifferences(
     SchemaDifference schemaDifference, StringBuilder result) {
   for (Table missingTable : schemaDifference.getMissingTables()) {
     result.append("\nFound missing table ");
     result.append(schemaDifference.getSchema().getName());
     result.append(".");
     result.append(missingTable.getName());
   }
 }
示例#2
0
 /**
  * Appends the table differences of the given schema difference to the result
  *
  * @param schemaDifference The difference, not null
  * @param result The result to append to, not null
  */
 protected void appendTableDifferences(SchemaDifference schemaDifference, StringBuilder result) {
   for (TableDifference tableDifference : schemaDifference.getTableDifferences()) {
     Table table = tableDifference.getTable();
     if (table.isEmpty()) {
       result.append("\nExpected table to be empty but found rows for table ");
       appendTableName(schemaDifference.getSchema(), table, result);
       result.append("\n");
       continue;
     }
     result.append("\nFound differences for table ");
     appendTableName(schemaDifference.getSchema(), table, result);
     result.append(":\n");
     appendMissingRowDifferences(tableDifference, result);
     appendBestRowDifferences(tableDifference, result);
   }
 }
示例#3
0
  /**
   * Appends all rows and tables of the actual schema to the result. Only tables that are in the
   * expected schema will be appended.
   *
   * @param schema The expected schema, not null
   * @param actualSchema The actual schema, not null
   * @param result The result to append to, not null
   */
  protected void appendSchemaContent(Schema schema, Schema actualSchema, StringBuilder result) {
    for (Table table : schema.getTables()) {
      Table actualTable = actualSchema.getTable(table.getName());
      if (actualTable == null) {
        continue;
      }
      appendTableName(schema, actualTable, result);
      result.append("\n");

      if (actualTable.getRows().isEmpty()) {
        result.append("  <empty table>\n");
      } else {
        result.append("  ");
        appendColumnNames(actualTable.getRows().get(0), result);
        result.append("\n");
        for (Row row : actualTable.getRows()) {
          result.append("  ");
          appendRow(row, result);
          result.append("\n");
        }
      }
      result.append("\n");
    }
  }
示例#4
0
 /**
  * Appends the schema and table name to the result
  *
  * @param schema The schema name, not null
  * @param table The table name, not null
  * @param result The result to append to, not null
  */
 protected void appendTableName(Schema schema, Table table, StringBuilder result) {
   result.append(schema.getName());
   result.append(".");
   result.append(table.getName());
 }