use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class SimpleFgdbTest method importXtfStruct.
@Test
public void importXtfStruct() throws Exception {
EhiLogger.getInstance().setTraceFilter(false);
File fgdbFile = new File(fgdbFileName);
Fgdb4j.deleteFileGdb(fgdbFile);
Class driverClass = Class.forName(FgdbDriver.class.getName());
File data = new File("test/data/Simple/SimpleStruct23a.xtf");
Config config = initConfig(data.getPath(), data.getPath() + ".log");
config.setFunction(Config.FC_IMPORT);
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);
try {
Ili2db.run(config, null);
} catch (Exception ex) {
EhiLogger.logError(ex);
Assert.fail();
}
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class GeodbDbPanel 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;
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Dataset23Smart1Test method initConfig.
public Config initConfig(String xtfFilename, String dbschema, 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 Dataset23Smart1Test method importNoDatasetName.
@Test
public void importNoDatasetName() throws Exception {
EhiLogger.getInstance().setTraceFilter(false);
Connection jdbcConnection = null;
try {
File fgdbFile = new File(fgdbFileName);
Fgdb4j.deleteFileGdb(fgdbFile);
Class driverClass = Class.forName(FgdbDriver.class.getName());
jdbcConnection = DriverManager.getConnection(FgdbDriver.BASE_URL + fgdbFileName, null, null);
Statement stmt = jdbcConnection.createStatement();
{
{
File data = new File("test/data/Dataset23Smart1/Dataset1a1.xtf");
Config config = initConfig(data.getPath(), null, data.getPath() + ".log");
config.setDatasetName(null);
config.setFunction(Config.FC_IMPORT);
config.setCreateFk(config.CREATE_FK_YES);
config.setBasketHandling(config.BASKET_HANDLING_READWRITE);
config.setBasketHandling(null);
config.setCatalogueRefTrafo(null);
config.setMultiSurfaceTrafo(null);
config.setMultilingualTrafo(null);
config.setInheritanceTrafo(config.INHERITANCE_TRAFO_SMART1);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
}
{
File data = new File("test/data/Dataset23Smart1/Dataset1a1.xtf");
Config config = initConfig(data.getPath(), null, data.getPath() + ".log");
config.setDatasetName(null);
config.setFunction(Config.FC_IMPORT);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
}
}
} finally {
if (jdbcConnection != null) {
jdbcConnection.close();
}
}
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Datatypes23Test 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;
}
Aggregations