本文整理汇总了Java中ca.sqlpower.sql.JDBCDataSource.setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java JDBCDataSource.setDisplayName方法的具体用法?Java JDBCDataSource.setDisplayName怎么用?Java JDBCDataSource.setDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.sqlpower.sql.JDBCDataSource
的用法示例。
在下文中一共展示了JDBCDataSource.setDisplayName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPopulateCatalogsSchemasAndTables
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testPopulateCatalogsSchemasAndTables() throws Exception {
JDBCDataSource ds = new JDBCDataSource(getPLIni());
ds.setDisplayName("catalogsSchemasAndTables");
ds.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ds.setUser("fake");
ds.setPass("fake");
ds.setUrl("jdbc:mock:dbmd.catalogTerm=Catalog&dbmd.schemaTerm=Schema" +
"&catalogs=cat1" +
"&schemas.cat1=sch1" +
"&tables.cat1.sch1=tab1");
SQLDatabase db = new SQLDatabase(ds);
db.populate();
assertEquals(1, db.getChildCount());
assertTrue(db.allowsChildType(SQLCatalog.class));
assertEquals(db.getChild(0).getName(), "cat1");
}
示例2: testPopulateTablesOnly
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testPopulateTablesOnly() throws Exception {
JDBCDataSource ds = new JDBCDataSource(getPLIni());
ds.setDisplayName("tablesOnly");
ds.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ds.setUser("fake");
ds.setPass("fake");
ds.setUrl("jdbc:mock:tables=tab1");
SQLDatabase db = new SQLDatabase(ds);
db.populate();
assertEquals(1, db.getChildCount());
assertTrue(db.allowsChildType(SQLTable.class));
assertEquals(db.getChild(0).getName(), "tab1");
}
示例3: testPopulateSchemasAndTables
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testPopulateSchemasAndTables() throws Exception {
JDBCDataSource ds = new JDBCDataSource(getPLIni());
ds.setDisplayName("schemasAndTables");
ds.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ds.setUser("fake");
ds.setPass("fake");
ds.setUrl("jdbc:mock:dbmd.schemaTerm=Schema&schemas=sch1&tables.sch1=tab1");
SQLDatabase db = new SQLDatabase(ds);
db.populate();
assertEquals(1, db.getChildCount());
assertTrue(db.allowsChildType(SQLSchema.class));
assertEquals(db.getChild(0).getName(), "sch1");
}
示例4: testPopulateCatalogsAndTables
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testPopulateCatalogsAndTables() throws Exception {
JDBCDataSource ds = new JDBCDataSource(getPLIni());
ds.setDisplayName("catalogsAndTables");
ds.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ds.setUser("fake");
ds.setPass("fake");
ds.setUrl("jdbc:mock:dbmd.catalogTerm=Catalog&catalogs=cat1&tables.cat1=tab1");
SQLDatabase db = new SQLDatabase(ds);
db.populate();
assertEquals(1, db.getChildCount());
assertTrue(db.allowsChildType(SQLCatalog.class));
assertEquals(db.getChild(0).getName(), "cat1");
}
示例5: testConnectionsPerThreadAreUnique
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testConnectionsPerThreadAreUnique() throws Exception{
JDBCDataSource ads = new JDBCDataSource(getPLIni());
ads.setParentType(new JDBCDataSourceType());
ads.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ads.setUrl("jdbc:mock:dbmd.catalogTerm=Catalog&dbmd.schemaTerm=Schema&catalogs=farm,yard,zoo&schemas.farm=cow,pig&schemas.yard=cat,robin&schemas.zoo=lion,giraffe&tables.farm.cow=moo&tables.farm.pig=oink&tables.yard.cat=meow&tables.yard.robin=tweet&tables.zoo.lion=roar&tables.zoo.giraffe=***,^%%");
ads.setUser("fake");
ads.setPass("fake");
ads.setDisplayName("test");
db.setDataSource(ads);
class ConnectionGetter implements Runnable {
Connection con;
public void run() {
try {
con = db.getConnection();
} catch (SQLObjectException e) {
e.printStackTrace();
}
}
}
ConnectionGetter cg1 = new ConnectionGetter();
Thread t1 = new Thread(cg1);
ConnectionGetter cg2 = new ConnectionGetter();
Thread t2 = new Thread(cg2);
t1.start();
t2.start();
t1.join();
t2.join();
if (cg1.con == null) fail("cg1 didn't get a connection");
if (cg2.con == null) fail("cg2 didn't get a connection");
assertNotSame("Both threads got the same connection!", cg1.con, cg2.con);
cg1.con.close();
cg2.con.close();
}
示例6: testPopulateColumnsCaseSensitive
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testPopulateColumnsCaseSensitive() throws Exception {
JDBCDataSource ds = new JDBCDataSource(getPLIni());
ds.setDisplayName("tableWithMixedColumnCase");
ds.getParentType().setJdbcDriver(MockJDBCDriver.class.getName());
ds.setUser("fake");
ds.setPass("fake");
ds.setUrl("jdbc:mock:" +
"tables=tab1" +
"&columns.tab1=this_is_my_column,THIS_IS_MY_COLUMN");
SQLDatabase db = new SQLDatabase(ds);
SQLTable t = db.getTableByName("tab1");
// this shouldn't throw a DuplicateColumnException
assertEquals(2, t.getColumns().size());
}