// @Test
 public void exportSmart1() throws Ili2dbException {
   File data = new File("test/data/InheritanceSmart1/Inheritance1a-out.xtf");
   Config config = initConfig(data.getPath(), DBSCHEMA, data.getPath() + ".log");
   config.setDatasetName(DATASETNAME);
   config.setFunction(Config.FC_EXPORT);
   Ili2db.readSettingsFromDb(config);
   Ili2db.run(config, null);
 }
  @Test
  public void importSmart1() throws Exception {
    File data = new File("test/data/InheritanceSmart1/Inheritance1a.xtf");

    Connection jdbcConnection = null;
    try {
      Class driverClass = Class.forName("org.postgresql.Driver");
      jdbcConnection = DriverManager.getConnection(dburl, dbuser, dbpwd);
      Statement stmt = jdbcConnection.createStatement();
      stmt.execute("DROP SCHEMA IF EXISTS " + DBSCHEMA + " CASCADE");

      Config config = initConfig(data.getPath(), DBSCHEMA, data.getPath() + ".log");
      config.setFunction(Config.FC_IMPORT);
      config.setCreateFk(Config.CREATE_FK_YES);
      config.setInheritanceTrafo(Config.INHERITANCE_TRAFO_SMART1);
      config.setDatasetName(DATASETNAME);
      config.setTidHandling(Config.TID_HANDLING_PROPERTY);
      config.setBasketHandling(Config.BASKET_HANDLING_READWRITE);
      config.setCreatescript(data.getPath() + ".sql");
      Ili2db.readSettingsFromDb(config);
      Ili2db.run(config, null);

      Assert.assertTrue(
          stmt.execute("SELECT attra3,attra3b FROM " + DBSCHEMA + ".classa3 WHERE t_ili_tid='7'"));
      ResultSet rs = stmt.getResultSet();
      Assert.assertTrue(rs.next());
      Assert.assertEquals("a3", rs.getString(1));
      Assert.assertEquals("a3b", rs.getString(2));

    } finally {
      if (jdbcConnection != null) {
        jdbcConnection.close();
      }
    }

    exportSmart1();
  }
 public void aboutToHidePanel() {
   Config config = ((Ili2dbWizard) getWizard()).getIli2dbConfig();
   GpkgDbPanel panel = (GpkgDbPanel) getPanelComponent();
   config.setDbdatabase(panel.getDbname());
   config.setDbhost(panel.getDbhost());
   config.setDbport(panel.getDbport());
   config.setDbusr(panel.getDbusr());
   config.setDbpwd(panel.getDbpwd());
   try {
     config.setDburl(panel.getDbUrlConverter().makeUrl(config));
     Ili2db.readSettingsFromDb(config);
   } catch (Ili2dbException e) {
     EhiLogger.logError(e);
   }
   super.aboutToHidePanel();
 }
  public Config initConfig(String xtfFilename, String dbschema, String logfile) {
    Config config = new Config();
    new ch.ehi.ili2pg.PgMain().initConfig(config);

    config.setDburl(dburl);
    config.setDbusr(dbuser);
    config.setDbpwd(dbpwd);
    if (dbschema != null) {
      config.setDbschema(dbschema);
    }
    if (logfile != null) {
      config.setLogfile(logfile);
    }

    config.setXtffile(xtfFilename);
    if (Ili2db.isItfFilename(xtfFilename)) {
      config.setItfTransferfile(true);
    }
    return config;
  }