Exemplo n.º 1
0
 // @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);
 }
Exemplo n.º 2
0
  @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();
  }