@Test
public void test_һ�������ϴ�������Statement() {
TGroupDataSource tgds = new TGroupDataSource();
tgds.setDbGroupKey("dbKey0");
List<DataSourceWrapper> dataSourceWrappers = new ArrayList<DataSourceWrapper>();
MockDataSource db1 = new MockDataSource("db", "db1");
MockDataSource db2 = new MockDataSource("db", "db2");
DataSourceWrapper dsw1 = new DataSourceWrapper("db1", "rw", db1, DBType.MYSQL);
DataSourceWrapper dsw2 = new DataSourceWrapper("db2", "r", db2, DBType.MYSQL);
dataSourceWrappers.add(dsw1);
dataSourceWrappers.add(dsw2);
tgds.init(dataSourceWrappers);
TGroupConnection conn = null;
Statement stat = null;
try {
db1.setClosed(true);
db2.setClosed(false);
conn = tgds.getConnection();
stat = conn.createStatement();
stat.executeQuery("select 1 from test");
MockDataSource.showTrace();
Assert.assertTrue(MockDataSource.hasTrace("db", "db2", "select 1 from test"));
db1.setClosed(false);
db2.setClosed(true);
stat = conn.createStatement();
stat.executeQuery("select 2 from test");
//Assert.assertTrue(MockDataSource.hasTrace("db", "db1", "select 1 from test"));
Assert.fail("û�����õ�һ������");
} catch (SQLException e) {