use of org.unidal.dal.jdbc.datasource.DataSource in project x-pipe by ctripcorp.
the class DalTransactionManagerTest method testStartTransaction.
@Test
public void testStartTransaction() throws SQLException {
DataSource ds = mock(DataSource.class);
when(ds.getConnection()).thenReturn(mock(Connection.class));
when(m_dataSourceManager.getDataSource("")).thenReturn(ds);
assertEquals(dalTM.getThreadLocalTransactionInfo().get().isInTransaction(), false);
dalTM.startTransaction("");
assertEquals(dalTM.getThreadLocalTransactionInfo().get().getRecursiveLayer(), 1);
assertEquals(dalTM.getThreadLocalTransactionInfo().get().isInTransaction(), true);
dalTM.startTransaction("");
assertEquals(dalTM.getThreadLocalTransactionInfo().get().getRecursiveLayer(), 2);
}
Aggregations