use of com.ctrip.platform.dal.dao.client.DalTransactionManager in project dal by ctripcorp.
the class DalTransactionManagerTest method testDoInTransaction.
@Test
public void testDoInTransaction() {
final DalHints hints = new DalHints();
try {
final DalTransactionManager test = new DalTransactionManager(getDalConnectionManager());
assertFalse(DalTransactionManager.isInTransaction());
ConnectionAction<?> action = new ConnectionAction<Object>() {
public Object execute() throws Exception {
assertNotNull(DalTransactionManager.getCurrentDbMeta());
return null;
}
};
action.operation = DalEventEnum.EXECUTE;
test.doInTransaction(action, hints);
} catch (Exception e) {
e.printStackTrace();
fail();
}
assertFalse(DalTransactionManager.isInTransaction());
assertNull(DalTransactionManager.getCurrentDbMeta());
}
use of com.ctrip.platform.dal.dao.client.DalTransactionManager in project dal by ctripcorp.
the class ConnectionActionTest method testPopulateDbMetaInTransaction.
@Test
public void testPopulateDbMetaInTransaction() {
TestConnectionAction test = new TestConnectionAction();
try {
DalTransactionManager tranManager = new DalTransactionManager(getDalConnectionManager());
tranManager.doInTransaction(test, new DalHints());
// assertNotNull(test.entry.getDatabaseName());
assertNotNull((test.entry).getDatabaseName());
// assertNotNull(test.entry.getTag().get(LogEntry.TAG_USER_NAME)); be removed
// assertNotNull(test.entry.getTag().get(LogEntry.TAG_SERVER_ADDRESS)); be removed
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
Aggregations