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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations