Search in sources :

Example 1 with TransactionManager

use of com.ibatis.sqlmap.engine.transaction.TransactionManager in project pinpoint by naver.

the class SqlMapClientTemplateIT method queryForPaginagedListShouldBeTraced.

@Test
@SuppressWarnings("deprecation")
public void queryForPaginagedListShouldBeTraced() throws Exception {
    // Given
    final String queryForPaginatedListId = "queryForPaginatedListId";
    // to emulate lazy-loading, otherwise exception is thrown
    TransactionManager mockTxManager = mock(TransactionManager.class);
    when(this.mockSqlMapExecutorDelegate.getTxManager()).thenReturn(mockTxManager);
    SqlMapClientTemplate clientTemplate = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
    // When
    clientTemplate.queryForPaginatedList(queryForPaginatedListId, 1);
    clientTemplate.queryForPaginatedList(queryForPaginatedListId, new Object(), 1);
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method queryForPaginatedList1 = SqlMapClientTemplate.class.getDeclaredMethod("queryForPaginatedList", String.class, int.class);
    Method queryForPaginatedList2 = SqlMapClientTemplate.class.getDeclaredMethod("queryForPaginatedList", String.class, Object.class, int.class);
    verifier.verifyTrace(event("IBATIS_SPRING", queryForPaginatedList1, Expectations.cachedArgs(queryForPaginatedListId)));
    verifier.verifyTrace(event("IBATIS_SPRING", queryForPaginatedList2, Expectations.cachedArgs(queryForPaginatedListId)));
}
Also used : TransactionManager(com.ibatis.sqlmap.engine.transaction.TransactionManager) SqlMapClientTemplate(org.springframework.orm.ibatis.SqlMapClientTemplate) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Aggregations

TransactionManager (com.ibatis.sqlmap.engine.transaction.TransactionManager)1 PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)1 Method (java.lang.reflect.Method)1 Test (org.junit.Test)1 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)1