public void testReadOnlySpecificSchema() {

    JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();

    OverrideRepository or = new OverrideRepository();
    or.addSchemaSelection(new SchemaSelection(null, SCHEMA));
    configuration.setReverseEngineeringStrategy(
        or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()));
    configuration.readFromJDBC();

    List<Table> tables = getTables(configuration);

    assertEquals(2, tables.size());

    Table catchild = (Table) tables.get(0);
    Table catmaster = (Table) tables.get(1);

    if (catchild.getName().equals(TABLE2)) {
      catchild = (Table) tables.get(1);
      catmaster = (Table) tables.get(0);
    }

    TableIdentifier masterid = TableIdentifier.create(catmaster);
    TableIdentifier childid = TableIdentifier.create(catchild);

    assertEquals(new TableIdentifier(null, SCHEMA, TABLE1), childid);
    assertEquals(new TableIdentifier(null, SCHEMA, TABLE2), masterid);
  }
  /* (non-Javadoc)
   * @see org.hibernate.tool.hbm2x.ant.ConfigurationTask#doConfiguration(org.hibernate.cfg.Configuration)
   */
  protected void doConfiguration(Configuration configuration) {
    JDBCMetaDataConfiguration jmdc = (JDBCMetaDataConfiguration) configuration;
    super.doConfiguration(jmdc);

    jmdc.setPreferBasicCompositeIds(preferBasicCompositeIds);

    DefaultReverseEngineeringStrategy defaultStrategy = new DefaultReverseEngineeringStrategy();

    ReverseEngineeringStrategy strategy = defaultStrategy;

    if (revengFiles != null) {
      OverrideRepository or = new OverrideRepository();

      String[] fileNames = revengFiles.list();
      for (int i = 0; i < fileNames.length; i++) {
        or.addFile(new File(fileNames[i]));
      }
      strategy = or.getReverseEngineeringStrategy(defaultStrategy);
    }

    if (reverseEngineeringStrategyClass != null) {
      strategy = loadreverseEngineeringStrategy(reverseEngineeringStrategyClass, strategy);
    }

    ReverseEngineeringSettings qqsettings =
        new ReverseEngineeringSettings(strategy)
            .setDefaultPackageName(packageName)
            .setDetectManyToMany(detectManyToMany)
            .setDetectOneToOne(detectOneToOne)
            .setDetectOptimisticLock(detectOptimisticLock);

    defaultStrategy.setSettings(qqsettings);
    strategy.setSettings(qqsettings);

    jmdc.setReverseEngineeringStrategy(strategy);

    jmdc.readFromJDBC();
  }