use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.
the class DalTableDaoShardByDbOracleTest method tearDownAfterClass.
@AfterClass
public static void tearDownAfterClass() throws Exception {
for (int i = 0; i < mod; i++) {
DalHints hints = new DalHints();
String[] sqls = new String[] { DROP_TABLE_SEQ, DROP_TABLE_TRIG, DROP_TABLE_SQL };
client.batchUpdate(sqls, hints.inShard(i));
}
}
use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.
the class DalTableDaoShardByDbOracleTest method tearDown.
@After
public void tearDown() throws Exception {
String sql = "DELETE FROM " + TABLE_NAME;
StatementParameters parameters = new StatementParameters();
DalHints hints = new DalHints();
try {
for (int i = 0; i < mod; i++) {
client.update(sql, parameters, hints.inShard(i));
}
} catch (SQLException e) {
e.printStackTrace();
fail();
}
}
use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.
the class DalTableDaoShardByDbSqlSvrTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
DalClientFactory.initClientFactory();
clientSqlSvr = DalClientFactory.getClient(DATABASE_NAME_SQLSVR);
DalHints hints = new DalHints();
String[] sqls = null;
// For SQL server
hints = new DalHints();
StatementParameters parameters = new StatementParameters();
for (int i = 0; i < mod; i++) {
sqls = new String[] { DROP_TABLE_SQL_SQLSVR_TPL, CREATE_TABLE_SQL_SQLSVR_TPL };
for (int j = 0; j < sqls.length; j++) {
clientSqlSvr.update(sqls[j], parameters, hints.inShard(i));
}
}
}
use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryListAllShardsWithRowCallbackSequential.
@Test
public void testQueryListAllShardsWithRowCallbackSequential() {
try {
DalHints hints = new DalHints();
TestDalRowCallback callback = new TestDalRowCallback();
dao.query(sqlListQuantity, parameters(), hints.inAllShards().sequentialExecute(), callback);
// 66 = (10 + 11 + 12)*2
assertEquals(66, callback.result.get());
} catch (Exception e) {
fail();
}
}
use of com.ctrip.platform.dal.dao.DalHints in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryListAllShardsWithRowCallbackSequentialAsync.
@Test
public void testQueryListAllShardsWithRowCallbackSequentialAsync() {
try {
DalHints hints = new DalHints();
TestDalRowCallback callback = new TestDalRowCallback();
dao.query(sqlListQuantity, parameters(), hints.inAllShards().sequentialExecute().asyncExecution(), callback);
// Make sure the execution is completed
hints.getAsyncResult().get();
// 66 = (10 + 11 + 12)*2
assertEquals(66, callback.result.get());
} catch (Exception e) {
fail();
}
}
Aggregations