jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1844156 - in /jmeter/trunk: src/core/org/apache/jmeter/testbeans/gui/ src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/ xdocs/ xdocs/usermanual/
Date Wed, 17 Oct 2018 19:33:23 GMT
Author: pmouawad
Date: Wed Oct 17 19:33:23 2018
New Revision: 1844156

URL: http://svn.apache.org/viewvc?rev=1844156&view=rev
Log:
Bug 62832 - JDBC Connection Configuration: Be able to set init SQL statements
Bugzilla Id: 62832

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources_fr.properties
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java Wed Oct 17 19:33:23
2018
@@ -84,7 +84,7 @@ public class TextAreaEditor extends Prop
      *            to be used for the editor. Must not be <code>null</code>
      */
     public TextAreaEditor(PropertyDescriptor descriptor) {
-        textUI = JSyntaxTextArea.getInstance(20, 20);
+        textUI = JSyntaxTextArea.getInstance(10, 60);
         textUI.setLanguage((String) descriptor.getValue(GenericTestBeanCustomizer.TEXT_LANGUAGE));
         scroller = JTextScrollPane.getInstance(textUI, true);
         init();

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
Wed Oct 17 19:33:23 2018
@@ -18,6 +18,7 @@ package org.apache.jmeter.protocol.jdbc.
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -49,6 +50,7 @@ public class DataSourceElement extends A
     private transient String username;
     private transient String password;
     private transient String checkQuery;
+    private transient String initQuery;
     private transient String poolMax;
     private transient String connectionAge;
     private transient String timeout;
@@ -222,6 +224,12 @@ public class DataSourceElement extends A
         dataSource.setMinIdle(0);
         dataSource.setInitialSize(poolSize);
         dataSource.setEnableAutoCommitOnReturn(false);
+        if(StringUtils.isNotEmpty(initQuery)) {
+            String[] sqls = initQuery.split("\n");
+            dataSource.setConnectionInitSqls(Arrays.asList(sqls));
+        } else {
+            dataSource.setConnectionInitSqls(Collections.emptyList());
+        }
         dataSource.setRollbackOnReturn(false);
         dataSource.setMaxIdle(poolSize);
         dataSource.setMaxTotal(poolSize);
@@ -564,4 +572,18 @@ public class DataSourceElement extends A
     public void setTransactionIsolation(String transactionIsolation) {
         this.transactionIsolation = transactionIsolation;
     }
+
+    /**
+     * @return the initQuery
+     */
+    public String getInitQuery() {
+        return initQuery;
+    }
+
+    /**
+     * @param initQuery the initQuery to set
+     */
+    public void setInitQuery(String initQuery) {
+        this.initQuery = initQuery;
+    }
 }

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=1844156&r1=1844155&r2=1844156&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
Wed Oct 17 19:33:23 2018
@@ -54,7 +54,7 @@ public class DataSourceElementBeanInfo e
         createPropertyGroup("varName", new String[] { "dataSource" });
 
         createPropertyGroup("pool", new String[] { "poolMax", "timeout", 
-                "trimInterval", "autocommit", "transactionIsolation"  });
+                "trimInterval", "autocommit", "transactionIsolation", "initQuery"  });
 
         createPropertyGroup("keep-alive", new String[] { "keepAlive", "connectionAge", "checkQuery"
});
 
@@ -82,6 +82,9 @@ public class DataSourceElementBeanInfo e
         Set<String> modesSet = TRANSACTION_ISOLATION_MAP.keySet();
         String[] modes = modesSet.toArray(new String[modesSet.size()]);
         p.setValue(TAGS, modes);
+        p = property("initQuery", TypeEditor.TextAreaEditor);
+        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        p.setValue(DEFAULT, "");
         p = property("keepAlive");
         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
         p.setValue(DEFAULT, Boolean.TRUE);

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources.properties?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources.properties
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources.properties
Wed Oct 17 19:33:23 2018
@@ -34,6 +34,8 @@ password.displayName=Password
 password.shortDescription=Password used to connect to database
 checkQuery.displayName=Validation Query
 checkQuery.shortDescription=A query used to validate a connection still works.  Only relevant
if Validate connections is true.
+initQuery.displayName=Init SQL statements separated by new line
+initQuery.shortDescription=A Collection of SQL statements that will be used to initialize
physical connections when they are first created. These statements are executed only once
- when the configured connection factory creates the connection. 
 dataSource.displayName=Variable Name for created pool
 dataSource.shortDescription=Name of the JMeter variable that the pool will be bound to.
 timeout.displayName=Max Wait (ms)

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources_fr.properties?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources_fr.properties
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElementResources_fr.properties
Wed Oct 17 19:33:23 2018
@@ -28,6 +28,8 @@ dbUrl.shortDescription=URL compl\u00E8te
 displayName=Configuration de connexion JDBC
 driver.displayName=Classe du pilote JDBC 
 driver.shortDescription=Nom (paquet+classe) complet du pilote JDBC \u00E0 utiliser. (Doit
\u00EAtre dans le classpath de JMeter)
+initQuery.displayName=Requ\u00eates SQL Init s\u00e9par\u00e9es par une nouvelle ligne
+initQuery.shortDescription=Un ensemble d'instructions SQL qui seront utilis\u00e9es pour
initialiser les connexions physiques lors de leur cr\u00e9ation initiale. Ces instructions
ne sont ex\u00e9cut\u00e9es qu'une seule fois - lorsque la connexion est configur\u00e9e par
la factory
 keep-alive.displayName=Validation des connexions par le pool
 keepAlive.displayName=Connexions persistantes (keep-alive) 
 keepAlive.shortDescription=Est-ce que le pool doit valider les connexions. Sinon, la dur\u00E9e
de vie des connexions et des validations de requ\u00EAtes sont ignor\u00E9es.

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Wed Oct 17 19:33:23 2018
@@ -94,6 +94,7 @@ Summary
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
 <ul>
     <li><bug>62766</bug>Keystore Config : We should load all aliases by
default. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
+    <li><bug>62832</bug>JDBC Connection Configuration: Be able to set init
SQL statements. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
 <h3>Functions</h3>

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1844156&r1=1844155&r2=1844156&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Wed Oct 17 19:33:23 2018
@@ -3933,6 +3933,8 @@ instead. (see figures 12 and 13).</p>
         <property name="Time Between Eviction Runs (ms)" required="Yes">The number
of milliseconds to sleep between runs of the idle object evictor thread. When non-positive,
no idle object evictor thread will be run. (Defaults to "<code>60000</code>",
1 minute).
         See <a href="https://commons.apache.org/proper/commons-dbcp/api-2.1.1/org/apache/commons/dbcp2/BasicDataSource.html#getTimeBetweenEvictionRunsMillis--"
>BasicDataSource.html#getTimeBetweenEvictionRunsMillis</a></property>
         <property name="Auto Commit" required="Yes">Turn auto commit on or off for
the connections.</property>
+        <property name="Transaction isolation" required="Yes">Transaction isolation
level</property>
+        <property name="Init SQL statements separated by new line" required="No">A
Collection of SQL statements that will be used to initialize physical connections when they
are first created. These statements are executed only once - when the configured connection
factory creates the connection. </property>
         <property name="Test While Idle" required="Yes">Test idle connections of the
pool, see <a href="https://commons.apache.org/proper/commons-dbcp/api-2.1.1/org/apache/commons/dbcp2/BasicDataSource.html#getTestWhileIdle--">BasicDataSource.html#getTestWhileIdle</a>.

         Validation Query will be used to test it.</property>
         <property name="Soft Min Evictable Idle Time(ms)" required="Yes">Minimum amount
of time a connection may sit idle in the pool before it is eligible for eviction by the idle
object evictor, with the extra condition that at least <code>minIdle</code> connections
remain in the pool.



Mime
View raw message