You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by ag...@apache.org on 2017/09/03 18:40:36 UTC

svn commit: r1807159 - in /jmeter/trunk: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java xdocs/changes.xml xdocs/usermanual/component_reference.xml

Author: agomes
Date: Sun Sep  3 18:40:36 2017
New Revision: 1807159

URL: http://svn.apache.org/viewvc?rev=1807159&view=rev
Log:
Add a list for "JDBC Connection Configuration" "Validation Query" attribut. Felix remarks implemented

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java?rev=1807159&r1=1807158&r2=1807159&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java (original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java Sun Sep  3 18:40:36 2017
@@ -90,9 +90,8 @@ public class DataSourceElementBeanInfo e
         p.setValue(DEFAULT, "5000");
         p = property("checkQuery", TypeEditor.ComboStringEditor);
         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
-        p.setValue(DEFAULT, "Select 1");
-        String[] CHECK_QUERY = getCheckQuery();
-        p.setValue(TAGS, CHECK_QUERY);
+        p.setValue(DEFAULT, "");
+        p.setValue(TAGS, JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query", ""), "|"));
         p = property("dbUrl");
         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
         p.setValue(DEFAULT, "");
@@ -136,13 +135,4 @@ public class DataSourceElementBeanInfo e
         }
         return -1;
     }
-
-    /**
-     * Get the check queris for the main databases
-     * Based in https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases
-     * @return a String[] with the list of check queries
-     */
-    private String[] getCheckQuery() {
-        return JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query", ""), "|"); //$NON-NLS-1$
-    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1807159&r1=1807158&r2=1807159&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Sep  3 18:40:36 2017
@@ -103,6 +103,7 @@ Incorporated feed back about unclear doc
 <ul>
     <li><bug>61320</bug>Test Action : Set duration to <code>0</code> by default</li>
     <li>JDBC Connection Configuration : Set Max Number of Connections to <code>0</code> by default</li>
+    <li>JDBC Connection Configuration : Set "Validation Query" to <code>empty</code> by default to use isValid method of JDBC driver</li>
     <li>JDBC Connection Configuration : Add a list for main databases validation queries for "Validation Query" attribute</li>
 </ul>
 

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1807159&r1=1807158&r2=1807159&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sun Sep  3 18:40:36 2017
@@ -4029,19 +4029,19 @@ instead. (see figures 12 and 13).</p>
         This defaults to the '<code>isValid()</code>' method of the jdbc driver, which is suitable for many databases.
         However some may require a different query; for example Oracle something like '<code>SELECT 1 FROM DUAL</code>' could be used.
         <p>The list of the validation queries can be configured with <code>jdbc.config.check.query</code> property and are by default:</p>
-            <ul>
-              <li>hsqldb - select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</li>
-              <li>Oracle - select 1 from dual</li>
-              <li>DB2 - select 1 from sysibm.sysdummy1</li>
-              <li>mysql - select 1</li>
-              <li>microsoft SQL Server - select 1</li>
-              <li>postgresql - select 1</li>
-              <li>ingres - select 1</li>
-              <li>derby - values 1</li>
-              <li>H2 - select 1</li>
-              <li>Firebird - select 1 from rdb$database</li>
-            </ul>
-        <note>The list come from <a href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases</a> and it can be incorrect</note>
+            <dl>
+              <dt>hsqldb</dt><dd>select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</dd>
+              <dt>Oracle</dt><dd>select 1 from dual</dd>
+              <dt>DB2</dt><dd>select 1 from sysibm.sysdummy1</dd>
+              <dt>mysql</dt><dd>select 1</dd>
+              <dt>microsoft SQL Server</dt><dd>select 1</dd>
+              <dt>postgresql</dt><dd>select 1</dd>
+              <dt>ingres</dt><dd>select 1</dd>
+              <dt>derby</dt><dd>values 1</dd>
+              <dt>H2</dt><dd>select 1</dd>
+              <dt>Firebird</dt><dd>select 1 from rdb$database</dd>
+            </dl>
+        <note>The list come from <a href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">stackoverflow entry on different database validation queries</a> and it can be incorrect</note>
         <note>Note this validation query is used on pool creation to validate it even if "<code>Test While Idle</code>" suggests query would only be used on idle connections.
         This is DBCP behaviour.</note>
         </property>



Re: svn commit: r1807159 - in /jmeter/trunk: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java xdocs/changes.xml xdocs/usermanual/component_reference.xml

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 3. September 2017 20:40:36 MESZ schrieb agomes@apache.org:
>Author: agomes
>Date: Sun Sep  3 18:40:36 2017
>New Revision: 1807159
>
>URL: http://svn.apache.org/viewvc?rev=1807159&view=rev
>Log:
>Add a list for "JDBC Connection Configuration" "Validation Query"
>attribut. Felix remarks implemented

Thanks for using the empty string as default validation query. 

But I think you misunderstood my comment about inlining the variable. 
I would have inlined the variable, not the whole method. As the method had a clear descriptive name it was speaking to the reader about the intention of the code. The inlined method does not. 

The compiled code will probably be the same and way. 

Felix 

>
>Modified:
>jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
>    jmeter/trunk/xdocs/changes.xml
>    jmeter/trunk/xdocs/usermanual/component_reference.xml
>
>Modified:
>jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java?rev=1807159&r1=1807158&r2=1807159&view=diff
>==============================================================================
>---
>jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
>(original)
>+++
>jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
>Sun Sep  3 18:40:36 2017
>@@ -90,9 +90,8 @@ public class DataSourceElementBeanInfo e
>         p.setValue(DEFAULT, "5000");
>         p = property("checkQuery", TypeEditor.ComboStringEditor);
>         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
>-        p.setValue(DEFAULT, "Select 1");
>-        String[] CHECK_QUERY = getCheckQuery();
>-        p.setValue(TAGS, CHECK_QUERY);
>+        p.setValue(DEFAULT, "");
>+        p.setValue(TAGS,
>JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query",
>""), "|"));
>         p = property("dbUrl");
>         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
>         p.setValue(DEFAULT, "");
>@@ -136,13 +135,4 @@ public class DataSourceElementBeanInfo e
>         }
>         return -1;
>     }
>-
>-    /**
>-     * Get the check queris for the main databases
>-     * Based in
>https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases
>-     * @return a String[] with the list of check queries
>-     */
>-    private String[] getCheckQuery() {
>-        return
>JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query",
>""), "|"); //$NON-NLS-1$
>-    }
> }
>
>Modified: jmeter/trunk/xdocs/changes.xml
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1807159&r1=1807158&r2=1807159&view=diff
>==============================================================================
>--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
>+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Sep  3 18:40:36 2017
>@@ -103,6 +103,7 @@ Incorporated feed back about unclear doc
> <ul>
><li><bug>61320</bug>Test Action : Set duration to <code>0</code> by
>default</li>
><li>JDBC Connection Configuration : Set Max Number of Connections to
><code>0</code> by default</li>
>+    <li>JDBC Connection Configuration : Set "Validation Query" to
><code>empty</code> by default to use isValid method of JDBC driver</li>
><li>JDBC Connection Configuration : Add a list for main databases
>validation queries for "Validation Query" attribute</li>
> </ul>
> 
>
>Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1807159&r1=1807158&r2=1807159&view=diff
>==============================================================================
>--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
>+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sun Sep  3
>18:40:36 2017
>@@ -4029,19 +4029,19 @@ instead. (see figures 12 and 13).</p>
>This defaults to the '<code>isValid()</code>' method of the jdbc
>driver, which is suitable for many databases.
>However some may require a different query; for example Oracle
>something like '<code>SELECT 1 FROM DUAL</code>' could be used.
><p>The list of the validation queries can be configured with
><code>jdbc.config.check.query</code> property and are by default:</p>
>-            <ul>
>-              <li>hsqldb - select 1 from
>INFORMATION_SCHEMA.SYSTEM_USERS</li>
>-              <li>Oracle - select 1 from dual</li>
>-              <li>DB2 - select 1 from sysibm.sysdummy1</li>
>-              <li>mysql - select 1</li>
>-              <li>microsoft SQL Server - select 1</li>
>-              <li>postgresql - select 1</li>
>-              <li>ingres - select 1</li>
>-              <li>derby - values 1</li>
>-              <li>H2 - select 1</li>
>-              <li>Firebird - select 1 from rdb$database</li>
>-            </ul>
>-        <note>The list come from <a
>href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases</a>
>and it can be incorrect</note>
>+            <dl>
>+              <dt>hsqldb</dt><dd>select 1 from
>INFORMATION_SCHEMA.SYSTEM_USERS</dd>
>+              <dt>Oracle</dt><dd>select 1 from dual</dd>
>+              <dt>DB2</dt><dd>select 1 from sysibm.sysdummy1</dd>
>+              <dt>mysql</dt><dd>select 1</dd>
>+              <dt>microsoft SQL Server</dt><dd>select 1</dd>
>+              <dt>postgresql</dt><dd>select 1</dd>
>+              <dt>ingres</dt><dd>select 1</dd>
>+              <dt>derby</dt><dd>values 1</dd>
>+              <dt>H2</dt><dd>select 1</dd>
>+              <dt>Firebird</dt><dd>select 1 from rdb$database</dd>
>+            </dl>
>+        <note>The list come from <a
>href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">stackoverflow
>entry on different database validation queries</a> and it can be
>incorrect</note>
><note>Note this validation query is used on pool creation to validate
>it even if "<code>Test While Idle</code>" suggests query would only be
>used on idle connections.
>         This is DBCP behaviour.</note>
>         </property>