mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add testcase & remove unused code
This commit is contained in:
@@ -1356,22 +1356,15 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
map.put("StatementExecuteCount", stat.getStatementStat().getExecuteCount());
|
||||
map.put("StatementRunningCount", stat.getStatementStat().getRunningCount());
|
||||
|
||||
// 15 -24
|
||||
// 15 - 19
|
||||
map.put("StatementConcurrentMax", stat.getStatementStat().getConcurrentMax());
|
||||
map.put("StatementCloseCount", stat.getStatementStat().getCloseCount());
|
||||
map.put("StatementErrorCount", stat.getStatementStat().getErrorCount());
|
||||
Throwable lastStatementError = stat.getStatementStat().getLastException();
|
||||
if (lastStatementError != null) {
|
||||
map.put("StatementLastErrorTime", stat.getStatementStat().getLastErrorTime());
|
||||
map.put("StatementLastErrorMessage", lastStatementError.getMessage());
|
||||
map.put("StatementLastErrorTime", null);
|
||||
map.put("StatementLastErrorMessage", null);
|
||||
|
||||
map.put("StatementLastErrorStackTrace", IOUtils.getStackTrace(lastStatementError));
|
||||
} else {
|
||||
map.put("StatementLastErrorTime", null);
|
||||
map.put("StatementLastErrorMessage", null);
|
||||
|
||||
map.put("StatementLastErrorStackTrace", null);
|
||||
}
|
||||
// 20 - 24
|
||||
map.put("StatementLastErrorStackTrace", null);
|
||||
map.put("StatementExecuteMillisTotal", stat.getStatementStat().getMillisTotal());
|
||||
map.put("StatementExecuteLastTime", stat.getStatementStat().getExecuteLastTime());
|
||||
map.put("ConnectionConnectingCount", stat.getConnectionStat().getConnectingCount());
|
||||
@@ -1388,14 +1381,8 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
map.put("ResultSetErrorCount", stat.getResultSetStat().getErrorCount());
|
||||
map.put("ResultSetOpenningMillisTotal", stat.getResultSetStat().getAliveMillisTotal());
|
||||
map.put("ResultSetLastErrorTime", stat.getResultSetStat().getLastErrorTime());
|
||||
Throwable lastResultSetError = stat.getResultSetStat().getLastError();
|
||||
if (lastResultSetError != null) {
|
||||
map.put("ResultSetLastErrorMessage", lastResultSetError.getMessage());
|
||||
map.put("ResultSetLastErrorStackTrace", IOUtils.getStackTrace(lastResultSetError));
|
||||
} else {
|
||||
map.put("ResultSetLastErrorMessage", null);
|
||||
map.put("ResultSetLastErrorStackTrace", null);
|
||||
}
|
||||
map.put("ResultSetLastErrorMessage", null);
|
||||
map.put("ResultSetLastErrorStackTrace", null);
|
||||
|
||||
// 35 - 39
|
||||
map.put("ConnectionConnectCount", createErrorCount);
|
||||
|
||||
@@ -44,7 +44,15 @@ public class DruidDataSourceTest_oracle2 extends TestCase {
|
||||
dataSource.setUseOracleImplicitCache(false);
|
||||
Assert.assertNull(dataSource.getConnectProperties().get("oracle.jdbc.FreeMemoryOnEnterImplicitCache"));
|
||||
|
||||
dataSource.setUseOracleImplicitCache(true);
|
||||
dataSource.setUseOracleImplicitCache(true);
|
||||
Assert.assertEquals("true", dataSource.getConnectProperties().get("oracle.jdbc.FreeMemoryOnEnterImplicitCache"));
|
||||
|
||||
dataSource.setUseOracleImplicitCache(false);
|
||||
Assert.assertNull(dataSource.getConnectProperties().get("oracle.jdbc.FreeMemoryOnEnterImplicitCache"));
|
||||
dataSource.setDriver(null);
|
||||
|
||||
dataSource.setUseOracleImplicitCache(true);
|
||||
Assert.assertNull(dataSource.getConnectProperties().get("oracle.jdbc.FreeMemoryOnEnterImplicitCache"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user