diff --git a/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java b/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java index 6d270d144e..d39c7a7cff 100644 --- a/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java +++ b/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java @@ -74,7 +74,7 @@ public class MySqlMockExecuteHandlerImpl implements MockExecuteHandler { return executeQueryFromDual(statement, query); } } - throw new SQLException("TODO"); + throw new SQLException("TODO : " + query); } else if (from == null) { return executeQueryFromDual(statement, query); } else { diff --git a/src/test/java/com/alibaba/druid/pool/benckmark/Case3.java b/src/test/java/com/alibaba/druid/pool/benckmark/Case3.java index 7ae5484549..11867cda8e 100644 --- a/src/test/java/com/alibaba/druid/pool/benckmark/Case3.java +++ b/src/test/java/com/alibaba/druid/pool/benckmark/Case3.java @@ -31,7 +31,7 @@ public class Case3 extends TestCase { private String validationQuery = "SELECT 1"; // "SELECT 1"; private int threadCount = 10; private int TEST_COUNT = 3; - final int LOOP_COUNT = 1000 * 10; + final int LOOP_COUNT = 1000 * 1; private boolean testOnBorrow = false; private String connectionProperties = ""; // "bigStringTryClob=true;clientEncoding=GBK;defaultRowPrefetch=50;serverEncoding=ISO-8859-1"; private String sql = "SELECT 1"; @@ -43,11 +43,11 @@ public class Case3 extends TestCase { user = "dragoon25"; password = "dragoon25"; //driverClass = "com.alibaba.druid.mock.MockDriver"; - connectionProperties = "connectSleep=3;executeSleep=0"; +// connectionProperties = "connectSleep=3;executeSleep=0"; - jdbcUrl = "jdbc:mysql://10.20.153.104:3306/druid2"; - user = "root"; - password = "root"; +// jdbcUrl = "jdbc:mysql://10.20.153.104:3306/druid2"; +// user = "root"; +// password = "root"; } public void test_perf() throws Exception { @@ -160,6 +160,8 @@ public class Case3 extends TestCase { } rs.close(); stmt.close(); + + Thread.sleep(1); conn.close(); } diff --git a/src/test/java/com/alibaba/druid/pool/ui/DruidDataSourceUIManager.java b/src/test/java/com/alibaba/druid/pool/ui/DruidDataSourceUIManager.java index 6bf4515ada..fd8fd83786 100644 --- a/src/test/java/com/alibaba/druid/pool/ui/DruidDataSourceUIManager.java +++ b/src/test/java/com/alibaba/druid/pool/ui/DruidDataSourceUIManager.java @@ -96,6 +96,7 @@ public class DruidDataSourceUIManager extends JFrame { private AtomicInteger connectingCount = new AtomicInteger(); private AtomicInteger connectCount = new AtomicInteger(); private AtomicInteger closeCount = new AtomicInteger(); + private AtomicInteger executingCount = new AtomicInteger(); private Thread statusThread; @@ -406,15 +407,20 @@ public class DruidDataSourceUIManager extends JFrame { return; } - Statement stmt = conn.createStatement(); - stmt.setQueryTimeout(5); - ResultSet rs = stmt.executeQuery("SELECT * FROM address LIMIT 10"); - while (rs.next()) { - rs.getObject(1); + executingCount.incrementAndGet(); + try { + Statement stmt = conn.createStatement(); + stmt.setQueryTimeout(5); + ResultSet rs = stmt.executeQuery("SELECT 1"); + while (rs.next()) { + rs.getObject(1); + } + Thread.sleep(1000 * 3); + rs.close(); + stmt.close(); + } finally { + executingCount.decrementAndGet(); } - rs.close(); - - stmt.close(); activeConnections.add(conn); } catch (Exception ex) { @@ -514,6 +520,7 @@ public class DruidDataSourceUIManager extends JFrame { statusPanel.set("UI_GettingCount", connectingCount.get()); statusPanel.set("UI_GetCount", connectCount.get()); statusPanel.set("UI_ReleaseCount", closeCount.get()); + statusPanel.set("UI_ExecutingCount", executingCount.get()); try { Thread.sleep(100); @@ -555,6 +562,8 @@ public class DruidDataSourceUIManager extends JFrame { rs.close(); stmt.close(); + Thread.sleep(1); + conn.close(); } } catch (Exception ex) { @@ -583,7 +592,7 @@ public class DruidDataSourceUIManager extends JFrame { System.out.println("thread " + threadCount + " druid millis : " + NumberFormat.getInstance().format(millis) + ", YGC " + ygc + " FGC " + fullGC); } }; - + executor.submit(task); } diff --git a/src/test/java/com/alibaba/druid/pool/ui/DruidDataStatusPanel.java b/src/test/java/com/alibaba/druid/pool/ui/DruidDataStatusPanel.java index 03f2e3130b..3135b856e9 100644 --- a/src/test/java/com/alibaba/druid/pool/ui/DruidDataStatusPanel.java +++ b/src/test/java/com/alibaba/druid/pool/ui/DruidDataStatusPanel.java @@ -17,11 +17,13 @@ public class DruidDataStatusPanel extends JPanel { private final String[] fieldNames = new String[] { // "CreateCount", "CreateErrorCount", "CreateTimespanMillis", "CreateTimespanNano", "DestroyCount", // "ConnectCount", "ConnectErrorCount", "CloseCount", "RecycleCount", "ActiveCount", // - "PoolingCount", "IdleCheckCount", "UI_GettingCount", "UI_GetCount", "UI_ReleaseCount" }; + "PoolingCount", "IdleCheckCount", "UI_GettingCount", "UI_GetCount", "UI_ReleaseCount" // + , "UI_ExecutingCount" // + }; public DruidDataStatusPanel(){ - this.setLayout(new GridLayout(5, 6)); + this.setLayout(new GridLayout(6, 6)); for (String fieldName : fieldNames) { JLabel label = new JLabel(fieldName + " : "); diff --git a/src/test/resources/ojdbc5-11.2.0.2.0.jar b/src/test/resources/ojdbc5-11.2.0.2.0.jar deleted file mode 100644 index 45f327eff4..0000000000 Binary files a/src/test/resources/ojdbc5-11.2.0.2.0.jar and /dev/null differ diff --git a/src/test/resources/settings.xml b/src/test/resources/settings.xml deleted file mode 100644 index 28caf63cf2..0000000000 --- a/src/test/resources/settings.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - - - b2b.repo.server - maven - secret - - - scm.deploy.account - maven - secret - - - opensesame - wenshao - hello123 - - - - - - - - - - - - b2b - - - - central - released internal lib - http://repo.alibaba-inc.com/mvn/internal/releases - - false - - - - b2b-internal-snapshots - snapshot internal lib - http://repo.alibaba-inc.com/mvn/internal/snapshots - - true - - - false - - - - - b2b-shared-repository - b2b shared libraries - http://repo.alibaba-inc.com:9091/shared - - true - - - - - - - - - - b2b-plugin-snapshots - plugin snapshots - http://repo.alibaba-inc.com/mvn/internal/snapshots - - true - - - false - - - - b2b-plugin-releases - plugin releases - http://repo.alibaba-inc.com/mvn/internal/releases - - false - - - true - - - - b2b-external-cache - cached external lib - http://repo.alibaba-inc.com/mvn/external - - false - - - - central - archiva proxy server - http://repo.alibaba-inc.com/archiva/repository/external - - false - - - - - - - - - - - b2b.unmanaged - - - b2b-public-releases - B2B BU public repository for released artifacts - http://repo.alibaba-inc.com/mvn/public/releases - - false - - - true - - - - b2b-internal-snapshots - B2B internal repository for snapshots artifacts - http://repo.alibaba-inc.com/mvn/internal/snapshots - - true - - - false - - - - b2b-internal-releases - B2B internal repository for released artifacts - http://repo.alibaba-inc.com/mvn/internal/releases - - false - - - true - - - - - b2b-central-cache - B2B cache server for external repositories - http://repo.alibaba-inc.com/mvn/external - - false - - - - central - B2B proxy server for external repositories - http://repo.alibaba-inc.com/archiva/repository/external - - false - - - - - - b2b-public-snapshots - B2B BU public repository for snapshot artifacts - http://repo.alibaba-inc.com/mvn/public/snapshots - - true - - - false - - - - b2b-public-releases - B2B BU public repository for released artifacts - http://repo.alibaba-inc.com/mvn/public/releases - - false - - - true - - - - - b2b-internal-snapshots - B2B internal repository for snapshots artifacts - http://repo.alibaba-inc.com/mvn/internal/snapshots - - true - - - false - - - - b2b-internal-releases - B2B internal repository for released artifacts - http://repo.alibaba-inc.com/mvn/internal/releases - - false - - - true - - - - - b2b-central-cache - B2B cache to external repositories - http://repo.alibaba-inc.com/mvn/external - - false - - - - central - Platform proxy to external repositories - http://repo.alibaba-inc.com/archiva/repository/external - - false - - - - - - - taobao - - - tbmirror-central - taobao mirror central - http://mvnrepo.taobao.ali.com/mvn/repository - - true - - - true - - - - - - - - com.alibaba.org.apache.maven.plugins - com.alibaba.maven.plugins - - - b2b - b2b.unmanaged - -