Search in sources :

Example 6 with DataSource

use of org.obeonetwork.dsl.database.reverse.source.DataSource in project InformationSystem by ObeoNetwork.

the class DatabaseInfos method getDataSource.

public DataSource getDataSource() {
    DataSource dataSource = new DataSource(getDatabase(), getSchema());
    dataSource.setJdbcUrl(getUrl());
    dataSource.setJdbcUsername(getUser());
    dataSource.setJdbcPassword(getPassword());
    dataSource.setVendor(getVendor());
    return dataSource;
}
Also used : DataSource(org.obeonetwork.dsl.database.reverse.source.DataSource)

Example 7 with DataSource

use of org.obeonetwork.dsl.database.reverse.source.DataSource 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);
}
Also used : MultiDataBaseQueries(org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries) DataSource(org.obeonetwork.dsl.database.reverse.source.DataSource) DataBase(org.obeonetwork.dsl.database.DataBase) Test(org.junit.Test)

Example 8 with DataSource

use of org.obeonetwork.dsl.database.reverse.source.DataSource in project InformationSystem by ObeoNetwork.

the class TestReverse method testH2Server.

@Test
public void testH2Server() {
    String databaseLocation = getH2DatabaseLocation(this.getClass(), "input");
    DataSource dataSource = new DataSource("appli1", "PUBLIC");
    dataSource.setJdbcUrl("jdbc:h2:tcp://localhost/" + 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);
}
Also used : MultiDataBaseQueries(org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries) DataSource(org.obeonetwork.dsl.database.reverse.source.DataSource) DataBase(org.obeonetwork.dsl.database.DataBase) Test(org.junit.Test)

Example 9 with DataSource

use of org.obeonetwork.dsl.database.reverse.source.DataSource in project InformationSystem by ObeoNetwork.

the class TestReverse method testPostgres.

@Test
public void testPostgres() {
    DataSource dataSource = new DataSource("postgres", "public");
    dataSource.setJdbcUrl("jdbc:postgresql://localhost:5432/postgres");
    dataSource.setJdbcUsername("postgres");
    dataSource.setJdbcPassword("admin");
    dataSource.setVendor("Postgres-9");
    DataBase database = DatabaseReverser.reverse(dataSource, new MultiDataBaseQueries(), null);
    DataBase databaseRef = loadModel("resources/postgres/outputRef.database", "pathmap://NativeDBTypes/Postgres-9");
    checkEquality(database, databaseRef);
}
Also used : MultiDataBaseQueries(org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries) DataSource(org.obeonetwork.dsl.database.reverse.source.DataSource) DataBase(org.obeonetwork.dsl.database.DataBase) Test(org.junit.Test)

Aggregations

DataSource (org.obeonetwork.dsl.database.reverse.source.DataSource)9 MultiDataBaseQueries (org.obeonetwork.dsl.database.reverse.utils.MultiDataBaseQueries)7 Test (org.junit.Test)6 DataBase (org.obeonetwork.dsl.database.DataBase)6 IFile (org.eclipse.core.resources.IFile)2 Connection (java.sql.Connection)1 IStatus (org.eclipse.core.runtime.IStatus)1 Path (org.eclipse.core.runtime.Path)1 Status (org.eclipse.core.runtime.Status)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 IViewPart (org.eclipse.ui.IViewPart)1 ProjectExplorer (org.eclipse.ui.navigator.resources.ProjectExplorer)1 DataSourceException (org.obeonetwork.dsl.database.reverse.source.DataSourceException)1