use of org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries in project InformationSystem by ObeoNetwork.
the class DatabaseImportHelper method importDatabaseIntoModel.
public static boolean importDatabaseIntoModel(DatabaseInfos databaseInfos, String modelFilename, Collection<IFile> referencedFiles) {
DataSource dataSource = databaseInfos.getDataSource();
// Override this resolver to resolve external dependencies (i.e.: tables store in another schema)
MultiDataBaseQueries queries = new MultiDataBaseQueries();
for (IFile referencedFile : referencedFiles) {
addFileToResolver(queries, referencedFile);
}
ImportRunnable runnable = new ImportRunnable(dataSource, modelFilename, queries);
try {
PlatformUI.getWorkbench().getProgressService().run(true, false, runnable);
} catch (Exception e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error while importing database", e));
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error occured while importing database", "An error occured while importing the database. See Error Log view for more details.");
}
return runnable.getResult();
}
use of org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries in project InformationSystem by ObeoNetwork.
the class TestReverse method testMySQL.
@Test
public void testMySQL() {
DataSource dataSource = new DataSource("northwind", null);
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/northwind");
dataSource.setJdbcUsername("root");
dataSource.setJdbcPassword(null);
dataSource.setVendor("MySQL-5");
DataBase database = DatabaseReverser.reverse(dataSource, new MultiDataBaseQueries(), null);
DataBase databaseRef = loadModel("resources/mysql/outputRef.database", "pathmap://NativeDBTypes/MySQL-5");
checkEquality(database, databaseRef);
}
use of org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries in project InformationSystem by ObeoNetwork.
the class TestReverse method testSQLServer.
@Test
public void testSQLServer() {
DataSource dataSource = new DataSource("Northwind", "dbo");
dataSource.setJdbcUrl("jdbc:sqlserver://localhost:1433;databaseName=Northwind");
dataSource.setJdbcUsername("testUser");
dataSource.setJdbcPassword("test");
dataSource.setVendor("SQLServer-2008");
DataBase database = DatabaseReverser.reverse(dataSource, new MultiDataBaseQueries(), null);
DataBase databaseRef = loadModel("resources/sqlserver/outputRef.database", "pathmap://NativeDBTypes/SQLServer-2008");
checkEquality(database, databaseRef);
}
use of org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries in project InformationSystem by ObeoNetwork.
the class TestReverse method testH2Embedded.
@Test
public void testH2Embedded() {
String databaseLocation = getH2DatabaseLocation(this.getClass(), "input");
DataSource dataSource = new DataSource("appli1", "PUBLIC");
dataSource.setJdbcUrl("jdbc:h2:" + databaseLocation);
dataSource.setJdbcUsername("sa");
dataSource.setVendor("H2-1.3");
DataBase database = DatabaseReverser.reverse(dataSource, new MultiDataBaseQueries(), null);
DataBase databaseRef = loadModel("resources/h2/outputRef.database", "pathmap://NativeDBTypes/H2-1.3");
checkEquality(database, databaseRef);
}
use of org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries in project InformationSystem by ObeoNetwork.
the class TestReverse method testOracle.
@Test
public void testOracle() {
DataSource dataSource = new DataSource("XE", "NORTHWIND");
dataSource.setJdbcUrl("jdbc:oracle:thin:northwind/northwind@//localhost:1521/XE");
dataSource.setJdbcUsername("northwind");
dataSource.setJdbcPassword("northwind");
dataSource.setVendor("Oracle-11g");
DataBase database = DatabaseReverser.reverse(dataSource, new MultiDataBaseQueries(), null);
DataBase databaseRef = loadModel("resources/oracle/outputRef.database", "pathmap://NativeDBTypes/Oracle-11g");
checkEquality(database, databaseRef);
}
Aggregations