Search in sources :

Example 11 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class QueryGeneratorTest method testSQLServer.

@Test
public void testSQLServer() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("Microsoft SQL Server", "\"mydatabase\"", "\"myschema\"", "\"mytable\"", setting);
    Assert.assertEquals("\"SELECT \n  [mydatabase].[myschema].[mytable].[ID1], \n  [mydatabase].[myschema].[mytable].[NAME1]\nFROM [mydatabase].[myschema].[mytable]\"", result);
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Example 12 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class QueryGeneratorTest method testMySQL.

@Test
public void testMySQL() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("MySQL", "\"mydatabase\"", null, "\"mytable\"", setting);
    Assert.assertEquals("\"SELECT \n  `mydatabase`.`mytable`.`ID1`, \n  `mydatabase`.`mytable`.`NAME1`\nFROM `mydatabase`.`mytable`\"", result);
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Example 13 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class QueryGeneratorTest method testAS400.

@Test
public void testAS400() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("AS400", "\"mydatabase\"", "\"myschema\"", "\"mytable\"", setting);
    Assert.assertEquals("\"SELECT \n  \\\"mydatabase\\\"/\\\"myschema\\\"/\\\"mytable\\\"/\\\"ID1\\\", \n  \\\"mydatabase\\\"/\\\"myschema\\\"/\\\"mytable\\\"/\\\"NAME1\\\"\nFROM \\\"mydatabase\\\"/\\\"myschema\\\"/\\\"mytable\\\"\"", result);
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Example 14 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class QueryGeneratorTest method testCommonQueryGeneratorWithContextAndDBCatalogAndDBSchema.

@Test
public void testCommonQueryGeneratorWithContextAndDBCatalogAndDBSchema() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("General JDBC", "context.mydatabase", "context.mydbschema", "context.mytable", setting);
    Assert.assertEquals("\"SELECT \n  \\\"\"+context.mydatabase+\"\\\".\\\"\"+context.mydbschema+\"\\\".\\\"\"+context.mytable+\"\\\".\\\"ID1\\\", \n  \\\"\"+context.mydatabase+\"\\\".\\\"\"+context.mydbschema+\"\\\".\\\"\"+context.mytable+\"\\\".\\\"NAME1\\\"\nFROM \\\"\"+context.mydatabase+\"\\\".\\\"\"+context.mydbschema+\"\\\".\\\"\"+context.mytable+\"\\\"\"", result);
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Example 15 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class QueryGeneratorTest method testOracle.

@Test
public void testOracle() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("Oracle with SID", null, "\"myschema\"", "\"mytable\"", setting);
    Assert.assertEquals("\"SELECT \n  \\\"myschema\\\".\\\"mytable\\\".\\\"ID1\\\", \n  \\\"myschema\\\".\\\"mytable\\\".\\\"NAME1\\\"\nFROM \\\"myschema\\\".\\\"mytable\\\"\"", result);
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Aggregations

AllSetting (org.talend.components.jdbc.runtime.setting.AllSetting)56 Test (org.junit.Test)38 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)11 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)7 JDBCDatastoreProperties (org.talend.components.jdbc.datastore.JDBCDatastoreProperties)6 JDBCDatasetProperties (org.talend.components.jdbc.dataset.JDBCDatasetProperties)4 Connection (java.sql.Connection)3 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 JarEntry (java.util.jar.JarEntry)1 JarInputStream (java.util.jar.JarInputStream)1 BeforeClass (org.junit.BeforeClass)1 JDBCAvroRegistryString (org.talend.components.jdbc.avro.JDBCAvroRegistryString)1 JDBCConnectionModule (org.talend.components.jdbc.module.JDBCConnectionModule)1 TJDBCConnectionDefinition (org.talend.components.jdbc.tjdbcconnection.TJDBCConnectionDefinition)1