use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class CreateFK23GpkgTest method initConfig.
public Config initConfig(String xtfFilename, String logfile) {
Config config = new Config();
new ch.ehi.ili2gpkg.GpkgMain().initConfig(config);
config.setDbfile(gpkgFileName);
config.setDburl("jdbc:sqlite:" + gpkgFileName);
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 Datatypes10GpkgTest method importIli.
@Test
public void importIli() throws Exception {
File gpkgFile = new File(gpkgFileName);
if (gpkgFile.exists()) {
gpkgFile.delete();
}
File data = new File("test/data/Datatypes10/Datatypes10.ili");
Config config = initConfig(data.getPath(), data.getPath() + ".log");
config.setFunction(Config.FC_SCHEMAIMPORT);
config.setCreateFk(config.CREATE_FK_YES);
config.setCreateNumChecks(true);
config.setTidHandling(Config.TID_HANDLING_PROPERTY);
config.setBasketHandling(config.BASKET_HANDLING_READWRITE);
config.setCatalogueRefTrafo(null);
config.setMultiSurfaceTrafo(null);
config.setMultilingualTrafo(null);
config.setInheritanceTrafo(null);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Datatypes10GpkgTest method exportItfWithSkipPolygonBuilding.
// @Test
public void exportItfWithSkipPolygonBuilding() throws Ili2dbException {
File data = new File("test/data/Datatypes10/Datatypes10a-ltout.itf");
Config config = initConfig(data.getPath(), data.getPath() + ".log");
config.setModels("Datatypes10");
config.setFunction(Config.FC_EXPORT);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Datatypes10GpkgTest method importItfWithSkipPolygonBuilding.
@Test
public void importItfWithSkipPolygonBuilding() throws Exception {
File gpkgFile = new File(gpkgFileName);
if (gpkgFile.exists()) {
gpkgFile.delete();
}
File data = new File("test/data/Datatypes10/Datatypes10a.itf");
Config config = initConfig(data.getPath(), 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.setDoItfLineTables(true);
config.setCatalogueRefTrafo(null);
config.setMultiSurfaceTrafo(null);
config.setMultilingualTrafo(null);
config.setInheritanceTrafo(null);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
initDb();
String stmtTxt = "SELECT atext FROM tablea AS a INNER JOIN subtable AS b ON (a.t_id=b.main) WHERE b.t_ili_tid='30'";
Assert.assertTrue(stmt.execute(stmtTxt));
{
ResultSet rs = stmt.getResultSet();
Assert.assertTrue(rs.next());
Assert.assertEquals("obj11", rs.getObject(1));
}
exportItfWithSkipPolygonBuilding();
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class MdbDbPanel method getTestConnectionButton.
/**
* This method initializes testConnectionButton
*
* @return javax.swing.JButton
*/
private JButton getTestConnectionButton() {
if (testConnectionButton == null) {
testConnectionButton = new JButton();
testConnectionButton.setText("test connection");
testConnectionButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
getLogUi().setText("");
ch.ehi.ili2db.gui.Config config = new ch.ehi.ili2db.gui.Config();
config.setDbfile(getDbfile());
String dbusr = getDbusr();
String dbpwd = getDbpwd();
String dburl = dbUrlConverter.makeUrl(config);
try {
Class.forName(jdbcDriver);
} catch (Exception ex) {
EhiLogger.logError("failed to load JDBC driver", ex);
return;
}
Connection conn = null;
try {
conn = DriverManager.getConnection(dburl, dbusr, dbpwd);
} catch (Exception ex) {
EhiLogger.logError(ex);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException ex) {
EhiLogger.logError(ex);
}
}
}
JOptionPane.showMessageDialog(null, "Successfully connected", "test connection", JOptionPane.INFORMATION_MESSAGE);
}
});
}
return testConnectionButton;
}
Aggregations