Search in sources :

Example 36 with AllSetting

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

the class QueryGeneratorTest method testCommonQueryGeneratorWithComplexVar.

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

Example 37 with AllSetting

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

the class QueryGeneratorTest method testHive.

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

Example 38 with AllSetting

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

the class QueryGeneratorTest method testNetezza.

@Test
public void testNetezza() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createTestSchema());
    String result = QueryUtils.generateNewQuery("Netezza", "\"mydatabase\"", "\"myschema\"", "\"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 39 with AllSetting

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

the class QueryGeneratorTest method testCommonQueryGeneratorWithComplexVarAndDBCatalogAndDBSchema.

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

Example 40 with AllSetting

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

the class QueryGeneratorTest method testCommonQueryGeneratorWithEmptySchema.

@Test
public void testCommonQueryGeneratorWithEmptySchema() {
    AllSetting setting = new AllSetting();
    setting.setSchema(createEmptySchema());
    // TODO now we only expect no exception, maybe should throw exception?
    QueryUtils.generateNewQuery("General JDBC", null, null, "\"mytable\"", setting);
}
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