use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Assoc23Test method importXtfExtRefBackward.
@Test
public void importXtfExtRefBackward() throws Exception {
// EhiLogger.getInstance().setTraceFilter(false);
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/Assoc23/Assoc2a.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);
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 Assoc23Test method importXtfExtFileRefBackward.
@Test
public void importXtfExtFileRefBackward() throws Exception {
// EhiLogger.getInstance().setTraceFilter(false);
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/Assoc23/Assoc2b1.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);
Ili2db.readSettingsFromDb(config);
Ili2db.run(config, null);
}
{
File data = new File("test/data/Assoc23/Assoc2b2.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);
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 GenericDbPanelDescriptor method aboutToDisplayPanel.
public void aboutToDisplayPanel() {
super.aboutToDisplayPanel();
Config config = ((Ili2dbWizard) getWizard()).getIli2dbConfig();
GenericDbPanel panel = (GenericDbPanel) getPanelComponent();
panel.setDburl(config.getDburl());
panel.setDbusr(config.getDbusr());
panel.setDbpwd(config.getDbpwd());
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Json23Test method importIli.
@Test
public void importIli() throws Exception {
Class driverClass = Class.forName("org.postgresql.Driver");
Connection jdbcConnection = null;
try {
setup.resetDb();
jdbcConnection = setup.createConnection();
File data = new File(TEST_OUT, "Json23.ili");
Config config = setup.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);
config.setJsonTrafo(Config.JSON_TRAFO_COALESCE);
Ili2db.run(config, null);
// asserts
{
{
// t_ili2db_attrname
String[][] expectedValues = new String[][] { { "Json23.TestA.Farbe.r", "r", "farbe", null }, { "Json23.TestA.Auto.Farben", "farben", "auto", null }, { "Json23.TestA.Farbe.active", "aactive", "farbe", null }, { "Json23.TestA.Farbe.g", "g", "farbe", null }, { "Json23.TestA.Farbe.name", "aname", "farbe", null }, { "Json23.TestA.Farbe.b", "b", "farbe", null } };
Ili2dbAssert.assertAttrNameTable(jdbcConnection, expectedValues, setup.getSchema());
}
{
// t_ili2db_trafo
String[][] expectedValues = new String[][] { { "Json23.TestA.Farbe", "ch.ehi.ili2db.inheritance", "newClass" }, { "Json23.TestA.Auto.Farben", "ch.ehi.ili2db.jsonTrafo", "coalesce" }, { "Json23.TestA.Auto", "ch.ehi.ili2db.inheritance", "newClass" } };
Ili2dbAssert.assertTrafoTable(jdbcConnection, expectedValues, setup.getSchema());
}
}
} finally {
if (jdbcConnection != null) {
jdbcConnection.close();
jdbcConnection = null;
}
}
}
use of ch.ehi.ili2db.gui.Config in project ili2db by claeis.
the class Json23Test method importXtf.
@Test
public void importXtf() throws Exception {
// EhiLogger.getInstance().setTraceFilter(false);
Class driverClass = Class.forName("org.postgresql.Driver");
setup.resetDb();
File data = new File(TEST_OUT, "Json23a.xtf");
Config config = setup.initConfig(data.getPath(), data.getPath() + ".log");
config.setFunction(Config.FC_IMPORT);
config.setDoImplicitSchemaImport(true);
config.setCreateFk(Config.CREATE_FK_YES);
config.setCreateNumChecks(true);
config.setTidHandling(Config.TID_HANDLING_PROPERTY);
config.setImportTid(true);
config.setImportBid(true);
config.setBasketHandling(Config.BASKET_HANDLING_READWRITE);
config.setCatalogueRefTrafo(null);
config.setMultiSurfaceTrafo(null);
config.setMultilingualTrafo(null);
config.setInheritanceTrafo(null);
config.setJsonTrafo(Config.JSON_TRAFO_COALESCE);
try {
Ili2db.run(config, null);
} catch (Exception ex) {
EhiLogger.logError(ex);
Assert.fail();
}
{
Connection jdbcConnection = null;
try {
jdbcConnection = setup.createConnection();
java.sql.Statement stmt = jdbcConnection.createStatement();
importXtf_doAsserts(stmt);
} finally {
if (jdbcConnection != null) {
jdbcConnection.close();
jdbcConnection = null;
}
}
}
}
Aggregations