use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class MultilineTest method initConfig.
public Config initConfig(String xtfFilename, String logfile) {
Config config = new Config();
new ch.ehi.ili2fgdb.FgdbMain().initConfig(config);
config.setDbfile(fgdbFileName);
config.setDburl(FgdbDriver.BASE_URL + fgdbFileName);
if (logfile != null) {
config.setLogfile(logfile);
}
config.setXtffile(xtfFilename);
if (xtfFilename != null && Ili2db.isItfFilename(xtfFilename)) {
config.setItfTransferfile(true);
}
return config;
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class FilterImportTest method initConfig.
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 (xtfFilename != null && Ili2db.isItfFilename(xtfFilename)) {
config.setItfTransferfile(true);
}
return config;
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class FilterImportTest method importByTopic.
@Test
public void importByTopic() throws Exception {
Connection jdbcConnection = null;
try {
Class driverClass = Class.forName("org.postgresql.Driver");
jdbcConnection = DriverManager.getConnection(dburl, dbuser, dbpwd);
stmt = jdbcConnection.createStatement();
stmt.execute("DROP SCHEMA IF EXISTS " + DBSCHEMA + " CASCADE");
{
File data = new File("test/data/FilterImport/FilterImport1a.xtf");
Config config = initConfig(data.getPath(), DBSCHEMA, data.getPath() + ".log");
config.setFunction(Config.FC_IMPORT);
config.setCreateFk(config.CREATE_FK_YES);
config.setTidHandling(Config.TID_HANDLING_PROPERTY);
config.setBasketHandling(config.BASKET_HANDLING_READWRITE);
config.setCatalogueRefTrafo(null);
config.setMultiSurfaceTrafo(null);
config.setMultilingualTrafo(null);
config.setInheritanceTrafo(null);
config.setTopics("FilterImport.TestA");
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
// check that the classa1 objects from both baskets were imported
{
String stmtTxt = "SELECT count(*) FROM " + DBSCHEMA + ".classa1";
Assert.assertTrue(stmt.execute(stmtTxt));
ResultSet rs = stmt.getResultSet();
Assert.assertTrue(rs.next());
Assert.assertEquals(2, rs.getInt(1));
}
// check that no classb1 object was imported
{
String stmtTxt = "SELECT count(*) FROM " + DBSCHEMA + ".classb1";
Assert.assertTrue(stmt.execute(stmtTxt));
ResultSet rs = stmt.getResultSet();
Assert.assertTrue(rs.next());
Assert.assertEquals(0, rs.getInt(1));
}
}
} finally {
if (jdbcConnection != null) {
jdbcConnection.close();
}
}
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class GeomIndex10Test method initConfig.
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 (xtfFilename != null && Ili2db.isItfFilename(xtfFilename)) {
config.setItfTransferfile(true);
}
return config;
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class InheritanceNoSmartTest method importNoSmart.
@Test
public void importNoSmart() throws Exception {
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");
{
File data = new File("test/data/InheritanceNoSmart/Inheritance1a.xtf");
Config config = initConfig(data.getPath(), DBSCHEMA, data.getPath() + ".log");
config.setFunction(Config.FC_IMPORT);
config.setCreateFk(Config.CREATE_FK_YES);
config.setInheritanceTrafo(null);
config.setDatasetName(DATASETNAME);
config.setTidHandling(Config.TID_HANDLING_PROPERTY);
config.setBasketHandling(Config.BASKET_HANDLING_READWRITE);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
Assert.assertTrue(stmt.execute("SELECT classa3.attra3,a3b.attra3b FROM " + DBSCHEMA + ".classa3," + DBSCHEMA + ".classa3b a3b WHERE classa3.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();
}
}
}
Aggregations