use of org.springframework.orm.ibatis.SqlMapClientTemplate in project pinpoint by naver.
the class SqlMapClientTemplateIT method methodCallWithNullSqlIdShouldOnlyTraceMethodName.
@Test
public void methodCallWithNullSqlIdShouldOnlyTraceMethodName() throws Exception {
// Given
SqlMapClientTemplate template = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
// When
template.insert(null);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method insert = SqlMapClientTemplate.class.getDeclaredMethod("insert", String.class);
verifier.verifyTrace(event("IBATIS_SPRING", insert));
}
use of org.springframework.orm.ibatis.SqlMapClientTemplate in project pinpoint by naver.
the class SqlMapClientTemplateIT method queryForObjectShouldBeTraced.
@Test
public void queryForObjectShouldBeTraced() throws Exception {
// Given
final String queryForObjectId = "queryForObjectId";
SqlMapClientTemplate clientTemplate = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
// When
clientTemplate.queryForObject(queryForObjectId);
clientTemplate.queryForObject(queryForObjectId, new Object());
clientTemplate.queryForObject(queryForObjectId, new Object(), new Object());
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method queryForObject1 = SqlMapClientTemplate.class.getDeclaredMethod("queryForObject", String.class);
Method queryForObject2 = SqlMapClientTemplate.class.getDeclaredMethod("queryForObject", String.class, Object.class);
Method queryForObject3 = SqlMapClientTemplate.class.getDeclaredMethod("queryForObject", String.class, Object.class, Object.class);
verifier.verifyTrace(event("IBATIS_SPRING", queryForObject1, Expectations.cachedArgs(queryForObjectId)));
verifier.verifyTrace(event("IBATIS_SPRING", queryForObject2, Expectations.cachedArgs(queryForObjectId)));
verifier.verifyTrace(event("IBATIS_SPRING", queryForObject3, Expectations.cachedArgs(queryForObjectId)));
}
use of org.springframework.orm.ibatis.SqlMapClientTemplate 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)));
}
use of org.springframework.orm.ibatis.SqlMapClientTemplate in project pinpoint by naver.
the class SqlMapClientTemplateIT method queryForListShouldBeTraced.
@Test
public void queryForListShouldBeTraced() throws Exception {
// Given
final String queryForListId = "queryForListId";
SqlMapClientTemplate clientTemplate = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
// When
clientTemplate.queryForList(queryForListId);
clientTemplate.queryForList(queryForListId, new Object());
clientTemplate.queryForList(queryForListId, 0, 1);
clientTemplate.queryForList(queryForListId, new Object(), 0, 1);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method queryForList1 = SqlMapClientTemplate.class.getDeclaredMethod("queryForList", String.class);
Method queryForList2 = SqlMapClientTemplate.class.getDeclaredMethod("queryForList", String.class, Object.class);
Method queryForList3 = SqlMapClientTemplate.class.getDeclaredMethod("queryForList", String.class, int.class, int.class);
Method queryForList4 = SqlMapClientTemplate.class.getDeclaredMethod("queryForList", String.class, Object.class, int.class, int.class);
verifier.verifyTrace(event("IBATIS_SPRING", queryForList1, Expectations.cachedArgs(queryForListId)));
verifier.verifyTrace(event("IBATIS_SPRING", queryForList2, Expectations.cachedArgs(queryForListId)));
verifier.verifyTrace(event("IBATIS_SPRING", queryForList3, Expectations.cachedArgs(queryForListId)));
verifier.verifyTrace(event("IBATIS_SPRING", queryForList4, Expectations.cachedArgs(queryForListId)));
}
use of org.springframework.orm.ibatis.SqlMapClientTemplate in project pinpoint by naver.
the class SqlMapClientTemplateIT method updateShouldBeTraced.
@Test
public void updateShouldBeTraced() throws Exception {
// Given
final String updateId = "updateId";
SqlMapClientTemplate clientTemplate = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
// When
clientTemplate.update(updateId);
clientTemplate.update(updateId, new Object());
clientTemplate.update(updateId, new Object(), 0);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method update1 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class);
Method update2 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class, Object.class);
Method update3 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class, Object.class, int.class);
verifier.verifyTrace(event("IBATIS_SPRING", update1, Expectations.cachedArgs(updateId)));
verifier.verifyTrace(event("IBATIS_SPRING", update2, Expectations.cachedArgs(updateId)));
verifier.verifyTrace(event("IBATIS_SPRING", update3, Expectations.cachedArgs(updateId)));
}
Aggregations