You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2021/03/12 16:20:54 UTC

[jmeter] branch master updated (7980249 -> 413b77c)

This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git.


    from 7980249  Create SampleResult with 0 duration when exception is caught
     new d3c8942  added database and access mode parameters to BoltSampler
     new 0ce5d27  Added transaction timeout option
     new 93d7dbb  Delete Bolt Request.jmx
     new 007fa67  styling fixes & edited changes file
     new a0a84ac  Unit tests
     new f29000c  changes based on feedback
     new cca089d  Connection Pool Max Size parameter added to Bolt Connection Config
     new 8a6556c  getAccessMode with guard clause
     new 1fb565c  formatting fixes in changes.xml
     new e7b9b84  more xml formatting fixes in changes.xml
     new 92fadbc  Line is a bit long.
     new 413b77c  Space after comma, not before

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../bolt/config/BoltConnectionElement.java         |  16 ++++-
 .../bolt/config/BoltConnectionElementBeanInfo.java |   7 +-
 .../bolt/sampler/AbstractBoltTestElement.java      |  62 ++++++++++++++++++
 .../jmeter/protocol/bolt/sampler/BoltSampler.java  |  36 +++++++++--
 .../sampler/BoltTestElementBeanInfoSupport.java    |  26 +++++++-
 .../BoltConnectionElementResources.properties      |   4 +-
 .../bolt/sampler/BoltSamplerResources.properties   |   7 ++
 .../protocol/bolt/sampler/BoltSamplerSpec.groovy   |  71 +++++++++++++++++++--
 xdocs/changes.xml                                  |   8 +++
 .../images/screenshots/bolt-connection-config.png  | Bin 46364 -> 18012 bytes
 xdocs/images/screenshots/bolt-request.png          | Bin 139114 -> 57224 bytes
 xdocs/usermanual/component_reference.xml           |  12 +++-
 12 files changed, 231 insertions(+), 18 deletions(-)


[jmeter] 09/12: formatting fixes in changes.xml

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 1fb565c035c30bc313b06a613a2a6da7626dfe5b
Author: David Pecollet <da...@gmail.com>
AuthorDate: Fri Jan 29 17:03:00 2021 +0000

    formatting fixes in changes.xml
---
 xdocs/changes.xml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index fc2e6f0..01d5655 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -92,6 +92,9 @@ Summary
 </ul>
 <ul>Bolt Sampler : added "access mode" option, that allows running against a Neo4j Enterprise causal cluster,
     with proper query routing using the "neo4://" or "bolt+routing://" URL schemes.
+    <li>Bolt Sampler : added "transaction timeout" option</li>
+    <li>Bolt Sampler : added "database" option, required for Neo4j 4.x (with multi-database support)</li>
+    <li>Bolt Sampler : added "access mode" option, that allows running against a Neo4j Enterprise causal cluster</li>
 </ul>
 
 <h3>Controllers</h3>
@@ -105,7 +108,8 @@ Summary
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
-<ul>Bolt Connection Configuration: added ConnectionPoolMaxSize parameter
+<ul>
+    <li>Bolt Connection Configuration: added ConnectionPoolMaxSize parameter</li>
 </ul>
 
 <h3>Functions</h3>


[jmeter] 06/12: changes based on feedback

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit f29000caf04e469c3e8951e1b299fb4641a049fe
Author: David Pecollet <da...@gmail.com>
AuthorDate: Tue Dec 15 22:40:03 2020 +0000

    changes based on feedback
    
    also removed time assertions that made some unit tests flaky
---
 .../protocol/bolt/sampler/AbstractBoltTestElement.java   | 10 +++++++---
 .../apache/jmeter/protocol/bolt/sampler/BoltSampler.java |  4 ++--
 .../bolt/sampler/BoltTestElementBeanInfoSupport.java     | 16 ++++++++--------
 .../bolt/sampler/BoltSamplerResources.properties         |  2 +-
 .../jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy  |  2 --
 5 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
index 807b7ad..0ec9579 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
@@ -19,6 +19,8 @@ package org.apache.jmeter.protocol.bolt.sampler;
 
 import java.time.Duration;
 
+import org.apache.commons.lang3.EnumUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.testelement.AbstractTestElement;
 import org.neo4j.driver.AccessMode;
 import org.neo4j.driver.SessionConfig;
@@ -45,12 +47,14 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
         if (accessMode != null) {
             return accessMode;
         } else {
-            return "WRITE";
+            return AccessMode.WRITE.toString();
         }
     }
 
     public void setAccessMode(String accessMode) {
-        this.accessMode = accessMode;
+        if (EnumUtils.isValidEnum(AccessMode.class, accessMode)) {
+            this.accessMode = accessMode;
+        }
     }
 
     public String getDatabase() {
@@ -90,7 +94,7 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
         SessionConfig.Builder sessionConfigBuilder = SessionConfig.builder()
                 .withDefaultAccessMode(Enum.valueOf(AccessMode.class, getAccessMode()));
 
-        if (database != null && !"".equals(database)) {
+        if (StringUtils.isNotBlank(database)) {
             sessionConfigBuilder.withDatabase(database);
         }
 
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
index d3787dc..94ec298 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
@@ -163,7 +163,7 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
             //get records already as consume() will exhaust the stream
             records = result.list();
         } else {
-            records = null;
+            records = Collections.emptyList();
         }
         response.append("\nSummary:");
         ResultSummary summary = result.consume();
@@ -190,7 +190,7 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
                 .append("\nRelationships Deleted: ")
                 .append(summary.counters().relationshipsDeleted());
         response.append("\n\nRecords: ");
-        if (records != null) {
+        if (isRecordQueryResults()) {
             for (Record record : records) {
                 response.append("\n").append(record);
             }
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
index cd07b8f..a4c93a5 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
@@ -18,6 +18,7 @@
 package org.apache.jmeter.protocol.bolt.sampler;
 
 import java.beans.PropertyDescriptor;
+import java.util.Arrays;
 
 import org.apache.jmeter.testbeans.BeanInfoSupport;
 import org.apache.jmeter.testbeans.TestBean;
@@ -36,34 +37,33 @@ public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
         createPropertyGroup("query", new String[] { "cypher","params","recordQueryResults"});
         createPropertyGroup("options", new String[] { "accessMode","database", "txTimeout"});
 
-        PropertyDescriptor propertyDescriptor =  property("cypher", TypeEditor.TextAreaEditor);
+        PropertyDescriptor propertyDescriptor = property("cypher", TypeEditor.TextAreaEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, "");
 
-        propertyDescriptor =  property("params", TypeEditor.TextAreaEditor);
+        propertyDescriptor = property("params", TypeEditor.TextAreaEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, "{\"paramName\":\"paramValue\"}");
 
-        propertyDescriptor =  property("recordQueryResults");
+        propertyDescriptor = property("recordQueryResults");
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, Boolean.FALSE);
 
-        propertyDescriptor =  property("accessMode", TypeEditor.ComboStringEditor);
+        propertyDescriptor = property("accessMode", TypeEditor.ComboStringEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(NOT_EXPRESSION, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, AccessMode.WRITE.toString());
         propertyDescriptor.setValue(TAGS, getListAccessModes());
 
-        propertyDescriptor =  property("database", TypeEditor.ComboStringEditor);
+        propertyDescriptor = property("database", TypeEditor.ComboStringEditor);
         propertyDescriptor.setValue(DEFAULT, "neo4j");
 
         propertyDescriptor = property("txTimeout");
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
-        propertyDescriptor.setValue(DEFAULT, "60");
+        propertyDescriptor.setValue(DEFAULT, 60);
     }
 
     private String[] getListAccessModes() {
-        String[] list = {AccessMode.READ.toString(), AccessMode.WRITE.toString()};
-        return list;
+        return Arrays.stream(AccessMode.values()).map(Enum::toString).toArray(String[]::new);
     }
 }
diff --git a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
index 5e02808..fda9c0a 100644
--- a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
+++ b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
@@ -27,6 +27,6 @@ recordQueryResults.shortDescription=Records the results of queries and displays
 accessMode.displayName=Access Mode
 accessMode.shortDescription=Whether it's a READ or WRITE query (affects query routing in clusters)
 database.displayName=Database
-database.shortDescription=Neo4j 4.x : database to query (leave empty for 3.5)
+database.shortDescription=Neo4j 4.x: database to query (leave empty for 3.5)
 txTimeout.displayName=Transaction timeout
 txTimeout.shortDescription=Transaction timeout in seconds
diff --git a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
index d7a2565..a6062c7 100644
--- a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
+++ b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
@@ -82,7 +82,6 @@ class BoltSamplerSpec extends Specification {
             str.endsWith("Records: Skipped")
             response.getSampleCount() == 1
             response.getErrorCount() == 0
-            response.getTime() > 0
     }
 
     def "should display results if asked"() {
@@ -162,7 +161,6 @@ class BoltSamplerSpec extends Specification {
             str.endsWith("Records: Skipped")
             response.getSampleCount() == 1
             response.getErrorCount() == 0
-            response.getTime() > 0
     }
 
     def getEmptyQueryResult() {


[jmeter] 12/12: Space after comma, not before

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 413b77ca0a716c3f2bb0a1500ceefa91f83b8083
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Mar 12 16:57:10 2021 +0100

    Space after comma, not before
---
 .../jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
index 40711d4..8087c99 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
@@ -51,7 +51,7 @@ public class BoltConnectionElementBeanInfo extends BeanInfoSupport {
         if(log.isDebugEnabled()) {
             String descriptorsAsString = Arrays.stream(getPropertyDescriptors())
                     .map(pd -> pd.getName() + "=" + pd.getDisplayName())
-                    .collect(Collectors.joining(" ,"));
+                    .collect(Collectors.joining(", "));
             log.debug(descriptorsAsString);
         }
 


[jmeter] 02/12: Added transaction timeout option

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 0ce5d27e4a904419edc9670b40b5fb0aaafaf411
Author: David Pecollet <da...@gmail.com>
AuthorDate: Mon Dec 14 17:48:32 2020 +0000

    Added transaction timeout option
    
    - new tx timeout option
    - fixed results consumption issue in 4.x
    - separated options from query in UI + better descriptions
---
 bin/examples/Bolt Request.jmx                      | 121 +++++++++++++++++++++
 .../bolt/sampler/AbstractBoltTestElement.java      |  41 ++++++-
 .../jmeter/protocol/bolt/sampler/BoltSampler.java  |  34 ++++--
 .../sampler/BoltTestElementBeanInfoSupport.java    |  17 ++-
 .../bolt/sampler/BoltSamplerResources.properties   |   7 +-
 .../protocol/bolt/sampler/BoltSamplerSpec.groovy   |  11 +-
 6 files changed, 208 insertions(+), 23 deletions(-)

diff --git a/bin/examples/Bolt Request.jmx b/bin/examples/Bolt Request.jmx
new file mode 100644
index 0000000..fad690b
--- /dev/null
+++ b/bin/examples/Bolt Request.jmx	
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1-SNAPSHOT ec1b44c">
+  <hashTree>
+    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
+      <stringProp name="TestPlan.comments"></stringProp>
+      <boolProp name="TestPlan.functional_mode">false</boolProp>
+      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+        <collectionProp name="Arguments.arguments"/>
+      </elementProp>
+      <stringProp name="TestPlan.user_define_classpath"></stringProp>
+    </TestPlan>
+    <hashTree>
+      <BoltConnectionElement guiclass="TestBeanGUI" testclass="BoltConnectionElement" testname="Bolt Connection Configuration" enabled="true">
+        <stringProp name="boltUri">neo4j://localhost:7617</stringProp>
+        <stringProp name="password">changeme</stringProp>
+        <stringProp name="username">neo4j</stringProp>
+      </BoltConnectionElement>
+      <hashTree/>
+      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
+        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+          <boolProp name="LoopController.continue_forever">false</boolProp>
+          <stringProp name="LoopController.loops">10</stringProp>
+        </elementProp>
+        <stringProp name="ThreadGroup.num_threads">1</stringProp>
+        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+        <boolProp name="ThreadGroup.scheduler">false</boolProp>
+        <stringProp name="ThreadGroup.duration"></stringProp>
+        <stringProp name="ThreadGroup.delay"></stringProp>
+        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
+      </ThreadGroup>
+      <hashTree>
+        <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
+          <boolProp name="ResultCollector.error_logging">false</boolProp>
+          <objProp>
+            <name>saveConfig</name>
+            <value class="SampleSaveConfiguration">
+              <time>true</time>
+              <latency>true</latency>
+              <timestamp>true</timestamp>
+              <success>true</success>
+              <label>true</label>
+              <code>true</code>
+              <message>true</message>
+              <threadName>true</threadName>
+              <dataType>true</dataType>
+              <encoding>false</encoding>
+              <assertions>true</assertions>
+              <subresults>true</subresults>
+              <responseData>false</responseData>
+              <samplerData>false</samplerData>
+              <xml>false</xml>
+              <fieldNames>true</fieldNames>
+              <responseHeaders>false</responseHeaders>
+              <requestHeaders>false</requestHeaders>
+              <responseDataOnError>false</responseDataOnError>
+              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
+              <assertionsResultsToSave>0</assertionsResultsToSave>
+              <bytes>true</bytes>
+              <sentBytes>true</sentBytes>
+              <url>true</url>
+              <threadCounts>true</threadCounts>
+              <idleTime>true</idleTime>
+              <connectTime>true</connectTime>
+            </value>
+          </objProp>
+          <stringProp name="filename"></stringProp>
+        </ResultCollector>
+        <hashTree/>
+        <BoltSampler guiclass="TestBeanGUI" testclass="BoltSampler" testname="Bolt Request" enabled="true">
+          <stringProp name="cypher">call dbms.cluster.role(&quot;owowo&quot;)</stringProp>
+          <stringProp name="params">{&quot;paramName&quot;:&quot;paramValue&quot;}</stringProp>
+          <boolProp name="recordQueryResults">true</boolProp>
+          <stringProp name="accessMode">WRITE</stringProp>
+          <intProp name="txTimeout">10</intProp>
+          <stringProp name="database">owowo</stringProp>
+        </BoltSampler>
+        <hashTree/>
+      </hashTree>
+      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
+        <boolProp name="ResultCollector.error_logging">false</boolProp>
+        <objProp>
+          <name>saveConfig</name>
+          <value class="SampleSaveConfiguration">
+            <time>true</time>
+            <latency>true</latency>
+            <timestamp>true</timestamp>
+            <success>true</success>
+            <label>true</label>
+            <code>true</code>
+            <message>true</message>
+            <threadName>true</threadName>
+            <dataType>true</dataType>
+            <encoding>false</encoding>
+            <assertions>true</assertions>
+            <subresults>true</subresults>
+            <responseData>false</responseData>
+            <samplerData>false</samplerData>
+            <xml>false</xml>
+            <fieldNames>true</fieldNames>
+            <responseHeaders>false</responseHeaders>
+            <requestHeaders>false</requestHeaders>
+            <responseDataOnError>false</responseDataOnError>
+            <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
+            <assertionsResultsToSave>0</assertionsResultsToSave>
+            <bytes>true</bytes>
+            <sentBytes>true</sentBytes>
+            <url>true</url>
+            <threadCounts>true</threadCounts>
+            <idleTime>true</idleTime>
+            <connectTime>true</connectTime>
+          </value>
+        </objProp>
+        <stringProp name="filename"></stringProp>
+      </ResultCollector>
+      <hashTree/>
+    </hashTree>
+  </hashTree>
+</jmeterTestPlan>
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
index bba0c83..b30f750 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
@@ -17,26 +17,39 @@
 
 package org.apache.jmeter.protocol.bolt.sampler;
 
+import java.time.Duration;
+
 import org.apache.jmeter.testelement.AbstractTestElement;
 import org.neo4j.driver.AccessMode;
+import org.neo4j.driver.SessionConfig;
+import org.neo4j.driver.TransactionConfig;
 
 public abstract class AbstractBoltTestElement extends AbstractTestElement {
 
     private String cypher;
     private String params;
     private String database;
-    private AccessMode accessMode;
+    private String accessMode;
     private boolean recordQueryResults;
+    private int txTimeout;
+
+    public int getTxTimeout() {
+        return txTimeout;
+    }
 
-    public AccessMode getAccessMode() {
+    public void setTxTimeout(int txTimeout) {
+        this.txTimeout = txTimeout;
+    }
+
+    public String getAccessMode() {
         if (accessMode != null) {
             return accessMode;
         } else {
-            return AccessMode.WRITE;
+            return "WRITE";
         }
     }
 
-    public void setAccessMode(AccessMode accessMode) {
+    public void setAccessMode(String accessMode) {
         this.accessMode = accessMode;
     }
 
@@ -71,4 +84,24 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
     public void setRecordQueryResults(boolean recordQueryResults) {
         this.recordQueryResults = recordQueryResults;
     }
+
+    public SessionConfig getSessionConfig() {
+        SessionConfig.Builder sessionConfigBuilder = SessionConfig.builder()
+                .withDefaultAccessMode(Enum.valueOf(AccessMode.class, getAccessMode()));
+
+        if (database != null && !"".equals(database)) {
+            sessionConfigBuilder.withDatabase(database);
+        }
+
+        return sessionConfigBuilder.build();
+    }
+    public TransactionConfig getTransactionConfig() {
+        TransactionConfig.Builder txConfigBuilder = TransactionConfig.builder();
+
+        if (txTimeout > 0) {
+            txConfigBuilder.withTimeout(Duration.ofSeconds(txTimeout));
+        }
+
+        return txConfigBuilder.build();
+    }
 }
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
index dfc5d47..e0fa5e3 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
@@ -22,6 +22,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -35,12 +36,12 @@ import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testbeans.TestBean;
 import org.apache.jmeter.testelement.TestElement;
-import org.neo4j.driver.AccessMode;
 import org.neo4j.driver.Driver;
 import org.neo4j.driver.Record;
 import org.neo4j.driver.Result;
 import org.neo4j.driver.Session;
 import org.neo4j.driver.SessionConfig;
+import org.neo4j.driver.TransactionConfig;
 import org.neo4j.driver.exceptions.Neo4jException;
 import org.neo4j.driver.summary.ResultSummary;
 
@@ -84,7 +85,9 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
 
         try {
             res.setResponseHeaders("Cypher request: " + getCypher());
-            res.setResponseData(execute(BoltConnectionElement.getDriver(), getCypher(), params, getAccessMode(), getDatabase()), StandardCharsets.UTF_8.name());
+            res.setResponseData(
+                        execute(BoltConnectionElement.getDriver(), getCypher(), params,
+                                getSessionConfig(), getTransactionConfig()), StandardCharsets.UTF_8.name());
         } catch (Exception ex) {
             res = handleException(res, ex);
         } finally {
@@ -102,13 +105,9 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
         return APPLICABLE_CONFIG_CLASSES.contains(guiClass);
     }
 
-    private String execute(Driver driver, String cypher, Map<String, Object> params, AccessMode accessMode, String database) {
-        SessionConfig sessionConfig = SessionConfig.builder()
-                .withDatabase(database)
-                .withDefaultAccessMode(accessMode)
-                .build();
+    private String execute(Driver driver, String cypher, Map<String, Object> params, SessionConfig sessionConfig, TransactionConfig txConfig) {
         try (Session session = driver.session(sessionConfig)) {
-            Result statementResult = session.run(cypher, params);
+            Result statementResult = session.run(cypher, params, txConfig);
             return response(statementResult);
         }
     }
@@ -141,12 +140,25 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
                 .append(getCypher())
                 .append("\n")
                 .append("Parameters: \n")
-                .append(getParams());
+                .append(getParams())
+                .append("\n")
+                .append("Database: \n")
+                .append(getDatabase())
+                .append("\n")
+                .append("Access Mode: \n")
+                .append(getAccessMode().toString());
         return request.toString();
     }
 
     private String response(Result result) {
         StringBuilder response = new StringBuilder();
+        List<Record> records;
+        if (isRecordQueryResults()) {
+            //get records already as consume() will exhaust the stream
+            records = result.list();
+        } else {
+            records = null;
+        }
         response.append("\nSummary:");
         ResultSummary summary = result.consume();
         response.append("\nConstraints Added: ")
@@ -172,8 +184,8 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
                 .append("\nRelationships Deleted: ")
                 .append(summary.counters().relationshipsDeleted());
         response.append("\n\nRecords: ");
-        if (isRecordQueryResults()) {
-            for (Record record : result.list()) {
+        if (records != null) {
+            for (Record record : records) {
                 response.append("\n").append(record);
             }
         } else {
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
index 1282b4b..cd07b8f 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
@@ -33,7 +33,8 @@ public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
     protected BoltTestElementBeanInfoSupport(Class<? extends TestBean> beanClass) {
         super(beanClass);
 
-        createPropertyGroup("query", new String[] { "cypher","params","recordQueryResults","accessMode","database"});
+        createPropertyGroup("query", new String[] { "cypher","params","recordQueryResults"});
+        createPropertyGroup("options", new String[] { "accessMode","database", "txTimeout"});
 
         PropertyDescriptor propertyDescriptor =  property("cypher", TypeEditor.TextAreaEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
@@ -50,9 +51,19 @@ public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
         propertyDescriptor =  property("accessMode", TypeEditor.ComboStringEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(NOT_EXPRESSION, Boolean.TRUE);
-        propertyDescriptor.setValue(DEFAULT, AccessMode.WRITE);
+        propertyDescriptor.setValue(DEFAULT, AccessMode.WRITE.toString());
+        propertyDescriptor.setValue(TAGS, getListAccessModes());
 
-        propertyDescriptor =  property("database");
+        propertyDescriptor =  property("database", TypeEditor.ComboStringEditor);
         propertyDescriptor.setValue(DEFAULT, "neo4j");
+
+        propertyDescriptor = property("txTimeout");
+        propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        propertyDescriptor.setValue(DEFAULT, "60");
+    }
+
+    private String[] getListAccessModes() {
+        String[] list = {AccessMode.READ.toString(), AccessMode.WRITE.toString()};
+        return list;
     }
 }
diff --git a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
index 7ace4c2..5e02808 100644
--- a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
+++ b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
@@ -17,6 +17,7 @@
 
 displayName=Bolt Request
 query.displayName=Query
+options.displayName=Options
 cypher.displayName=Cypher Statement
 cypher.shortDescription=Cypher Statement
 params.displayName=Params
@@ -24,6 +25,8 @@ params.shortDescription=Params
 recordQueryResults.displayName=Record Query Results
 recordQueryResults.shortDescription=Records the results of queries and displays in listeners such as View Results Tree, this iterates through the entire resultset. Use to debug only.
 accessMode.displayName=Access Mode
-accessMode.shortDescription=Access Mode
+accessMode.shortDescription=Whether it's a READ or WRITE query (affects query routing in clusters)
 database.displayName=Database
-database.shortDescription=Database
+database.shortDescription=Neo4j 4.x : database to query (leave empty for 3.5)
+txTimeout.displayName=Transaction timeout
+txTimeout.shortDescription=Transaction timeout in seconds
diff --git a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
index 6f89702..80ce336 100644
--- a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
+++ b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
@@ -55,7 +55,8 @@ class BoltSamplerSpec extends Specification {
         given:
             sampler.setCypher("MATCH x")
             sampler.setDatabase("neo4j")
-            session.run("MATCH x", [:]) >> getEmptyQueryResult()
+            sampler.setTxTimeout(60)
+            session.run("MATCH x", [:], _) >> getEmptyQueryResult()
         when:
             def response = sampler.sample(entry)
         then:
@@ -73,7 +74,8 @@ class BoltSamplerSpec extends Specification {
         given:
             sampler.setCypher("MATCH x")
             sampler.setDatabase("neo4j")
-            session.run("MATCH x", [:]) >> { throw new RuntimeException("a message") }
+            sampler.setTxTimeout(60)
+            session.run("MATCH x", [:], _) >> { throw new RuntimeException("a message") }
         when:
             def response = sampler.sample(entry)
         then:
@@ -91,6 +93,8 @@ class BoltSamplerSpec extends Specification {
         given:
             sampler.setCypher("MATCH x")
             sampler.setParams("{invalid}")
+            sampler.setDatabase("neo4j")
+            sampler.setTxTimeout(60)
         when:
             def response = sampler.sample(entry)
         then:
@@ -108,7 +112,8 @@ class BoltSamplerSpec extends Specification {
         given:
             sampler.setCypher("MATCH x")
             sampler.setDatabase("neo4j")
-            session.run("MATCH x", [:]) >> { throw new ClientException("a code", "a message") }
+            sampler.setTxTimeout(60)
+            session.run("MATCH x", [:], _) >> { throw new ClientException("a code", "a message") }
         when:
             def response = sampler.sample(entry)
         then:


[jmeter] 08/12: getAccessMode with guard clause

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 8a6556c77cb2ddbd47faff768038bc10510c8acf
Author: David Pecollet <da...@gmail.com>
AuthorDate: Mon Jan 11 10:45:44 2021 +0000

    getAccessMode with guard clause
    
    also updated the docs of the Bolt Sampler and Bolt config to reflect the new parameters
    pngquant new images
---
 .../bolt/sampler/AbstractBoltTestElement.java      |   5 ++---
 xdocs/changes.xml                                  |   2 +-
 .../images/screenshots/bolt-connection-config.png  | Bin 46364 -> 18012 bytes
 xdocs/images/screenshots/bolt-request.png          | Bin 139114 -> 57224 bytes
 xdocs/usermanual/component_reference.xml           |  11 ++++++++++-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
index 0ec9579..5b99681 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
@@ -44,11 +44,10 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
     }
 
     public String getAccessMode() {
-        if (accessMode != null) {
-            return accessMode;
-        } else {
+        if (accessMode == null) {
             return AccessMode.WRITE.toString();
         }
+        return accessMode;
     }
 
     public void setAccessMode(String accessMode) {
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 01aee2c..fc2e6f0 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -105,7 +105,7 @@ Summary
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
-<ul>
+<ul>Bolt Connection Configuration: added ConnectionPoolMaxSize parameter
 </ul>
 
 <h3>Functions</h3>
diff --git a/xdocs/images/screenshots/bolt-connection-config.png b/xdocs/images/screenshots/bolt-connection-config.png
index 3afe34a..72220ce 100644
Binary files a/xdocs/images/screenshots/bolt-connection-config.png and b/xdocs/images/screenshots/bolt-connection-config.png differ
diff --git a/xdocs/images/screenshots/bolt-request.png b/xdocs/images/screenshots/bolt-request.png
index 521772e..b92ecc8 100644
Binary files a/xdocs/images/screenshots/bolt-request.png and b/xdocs/images/screenshots/bolt-request.png differ
diff --git a/xdocs/usermanual/component_reference.xml b/xdocs/usermanual/component_reference.xml
index 14a4932..2ed6086 100644
--- a/xdocs/usermanual/component_reference.xml
+++ b/xdocs/usermanual/component_reference.xml
@@ -1970,7 +1970,7 @@ MongoDB Script is more suitable for functional testing or test setup (setup/tear
         <p>This sampler allows you to run Cypher queries through the Bolt protocol.</p>
         <p>Before using this you need to set up a <complink name="Bolt Connection Configuration"/></p>
         <p>Every request uses a connection acquired from the pool and returns it to the pool when the sampler completes.
-        The connection pool size use the driver defaults (~100) and is not configurable at the moment.</p>
+        The connection pool size defaults to 100 and is configurable.</p>
         <p>The measured response time corresponds to the "full" query execution, including both
         the time to execute the cypher query AND the time to consume the results sent back by the database.</p>
     </description>
@@ -1986,6 +1986,13 @@ MongoDB Script is more suitable for functional testing or test setup (setup/tear
             Whether to add or not query result data to the sampler response (default false).
             Note that activating this has a memory overhead, use it wisely.
         </property>
+        <property name="Access Mode" required="Yes">Whether to access the database in WRITE or READ mode.
+            Use WRITE for a standalone Neo4j instance.
+            For a Neo4j cluster, select mode depending on whether the query writes to the database.
+            That setting will allow correct routing to the cluster leader, followers or read replicas.</property>
+        <property name="Database" required="No">The database to run the query against.
+            Required for Neo4j 4.0+, unless querying the default database. Must be undefined for Neo4j 3.5.</property>
+        <property name="Transaction timeout" required="No">Timeout for the transaction.</property>
     </properties>
 
     <note>It is strongly advised to use query parameters, allowing the database to cache and reuse execution plans.</note>
@@ -4524,6 +4531,8 @@ DB db = MongoDBHolder.getDBFromSource("value of property MongoDB Source",
         <property name="Bolt URI" required="Yes">The database URI.</property>
         <property name="Username" required="No">User account.</property>
         <property name="Password" required="No">User credentials.</property>
+        <property name="Connection Pool Max Size" required="Yes">Max size of the Neo4j driver Bolt connection pool.
+            Raise the value if running large number of concurrent threads, so that JMeter threads are not blocked waiting for a connection to be released to the pool.</property>
     </properties>
 </component>
 


[jmeter] 01/12: added database and access mode parameters to BoltSampler

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit d3c89422b1910bdec85a6d6f1e672808f0a1c7dc
Author: David Pecollet <da...@gmail.com>
AuthorDate: Fri Dec 11 17:13:26 2020 +0000

    added database and access mode parameters to BoltSampler
    
    database : required to address a on-default dtabase in Neo4j 4.x
    accessMode : allow to test against a cluster w/o having all queries sent to the leader (previous was defaulting to WRITE)
---
 .../bolt/sampler/AbstractBoltTestElement.java      | 23 ++++++++++++++++++++++
 .../jmeter/protocol/bolt/sampler/BoltSampler.java  | 12 ++++++++---
 .../sampler/BoltTestElementBeanInfoSupport.java    | 11 ++++++++++-
 .../bolt/sampler/BoltSamplerResources.properties   |  4 ++++
 .../protocol/bolt/sampler/BoltSamplerSpec.groovy   |  6 +++++-
 5 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
index 5f77d46..bba0c83 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
@@ -18,13 +18,36 @@
 package org.apache.jmeter.protocol.bolt.sampler;
 
 import org.apache.jmeter.testelement.AbstractTestElement;
+import org.neo4j.driver.AccessMode;
 
 public abstract class AbstractBoltTestElement extends AbstractTestElement {
 
     private String cypher;
     private String params;
+    private String database;
+    private AccessMode accessMode;
     private boolean recordQueryResults;
 
+    public AccessMode getAccessMode() {
+        if (accessMode != null) {
+            return accessMode;
+        } else {
+            return AccessMode.WRITE;
+        }
+    }
+
+    public void setAccessMode(AccessMode accessMode) {
+        this.accessMode = accessMode;
+    }
+
+    public String getDatabase() {
+        return database;
+    }
+
+    public void setDatabase(String database) {
+        this.database = database;
+    }
+
     public String getCypher() {
         return cypher;
     }
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
index 03b2c43..dfc5d47 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
@@ -35,10 +35,12 @@ import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testbeans.TestBean;
 import org.apache.jmeter.testelement.TestElement;
+import org.neo4j.driver.AccessMode;
 import org.neo4j.driver.Driver;
 import org.neo4j.driver.Record;
 import org.neo4j.driver.Result;
 import org.neo4j.driver.Session;
+import org.neo4j.driver.SessionConfig;
 import org.neo4j.driver.exceptions.Neo4jException;
 import org.neo4j.driver.summary.ResultSummary;
 
@@ -82,7 +84,7 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
 
         try {
             res.setResponseHeaders("Cypher request: " + getCypher());
-            res.setResponseData(execute(BoltConnectionElement.getDriver(), getCypher(), params), StandardCharsets.UTF_8.name());
+            res.setResponseData(execute(BoltConnectionElement.getDriver(), getCypher(), params, getAccessMode(), getDatabase()), StandardCharsets.UTF_8.name());
         } catch (Exception ex) {
             res = handleException(res, ex);
         } finally {
@@ -100,8 +102,12 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
         return APPLICABLE_CONFIG_CLASSES.contains(guiClass);
     }
 
-    private String execute(Driver driver, String cypher, Map<String, Object> params) {
-        try (Session session = driver.session()) {
+    private String execute(Driver driver, String cypher, Map<String, Object> params, AccessMode accessMode, String database) {
+        SessionConfig sessionConfig = SessionConfig.builder()
+                .withDatabase(database)
+                .withDefaultAccessMode(accessMode)
+                .build();
+        try (Session session = driver.session(sessionConfig)) {
             Result statementResult = session.run(cypher, params);
             return response(statementResult);
         }
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
index 0be4e9e..1282b4b 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltTestElementBeanInfoSupport.java
@@ -22,6 +22,7 @@ import java.beans.PropertyDescriptor;
 import org.apache.jmeter.testbeans.BeanInfoSupport;
 import org.apache.jmeter.testbeans.TestBean;
 import org.apache.jmeter.testbeans.gui.TypeEditor;
+import org.neo4j.driver.AccessMode;
 
 public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
     /**
@@ -32,7 +33,7 @@ public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
     protected BoltTestElementBeanInfoSupport(Class<? extends TestBean> beanClass) {
         super(beanClass);
 
-        createPropertyGroup("query", new String[] { "cypher","params","recordQueryResults"});
+        createPropertyGroup("query", new String[] { "cypher","params","recordQueryResults","accessMode","database"});
 
         PropertyDescriptor propertyDescriptor =  property("cypher", TypeEditor.TextAreaEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
@@ -45,5 +46,13 @@ public abstract class BoltTestElementBeanInfoSupport extends BeanInfoSupport {
         propertyDescriptor =  property("recordQueryResults");
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, Boolean.FALSE);
+
+        propertyDescriptor =  property("accessMode", TypeEditor.ComboStringEditor);
+        propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        propertyDescriptor.setValue(NOT_EXPRESSION, Boolean.TRUE);
+        propertyDescriptor.setValue(DEFAULT, AccessMode.WRITE);
+
+        propertyDescriptor =  property("database");
+        propertyDescriptor.setValue(DEFAULT, "neo4j");
     }
 }
diff --git a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
index 7b606b7..7ace4c2 100644
--- a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
+++ b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerResources.properties
@@ -23,3 +23,7 @@ params.displayName=Params
 params.shortDescription=Params
 recordQueryResults.displayName=Record Query Results
 recordQueryResults.shortDescription=Records the results of queries and displays in listeners such as View Results Tree, this iterates through the entire resultset. Use to debug only.
+accessMode.displayName=Access Mode
+accessMode.shortDescription=Access Mode
+database.displayName=Database
+database.shortDescription=Database
diff --git a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
index ffd3b5a..6f89702 100644
--- a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
+++ b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
@@ -24,6 +24,7 @@ import org.apache.jmeter.threads.JMeterVariables
 import org.neo4j.driver.Driver
 import org.neo4j.driver.Result
 import org.neo4j.driver.Session
+import org.neo4j.driver.SessionConfig
 import org.neo4j.driver.exceptions.ClientException
 import org.neo4j.driver.summary.ResultSummary
 import org.neo4j.driver.summary.SummaryCounters
@@ -47,12 +48,13 @@ class BoltSamplerSpec extends Specification {
         JMeterContextService.getContext().setVariables(variables)
         entry.addConfigElement(boltConfig)
         session = Mock(Session)
-        driver.session() >> session
+        driver.session(_) >> session
     }
 
     def "should execute return success on successful query"() {
         given:
             sampler.setCypher("MATCH x")
+            sampler.setDatabase("neo4j")
             session.run("MATCH x", [:]) >> getEmptyQueryResult()
         when:
             def response = sampler.sample(entry)
@@ -70,6 +72,7 @@ class BoltSamplerSpec extends Specification {
     def "should return error on failed query"() {
         given:
             sampler.setCypher("MATCH x")
+            sampler.setDatabase("neo4j")
             session.run("MATCH x", [:]) >> { throw new RuntimeException("a message") }
         when:
             def response = sampler.sample(entry)
@@ -104,6 +107,7 @@ class BoltSamplerSpec extends Specification {
     def "should return db error code"() {
         given:
             sampler.setCypher("MATCH x")
+            sampler.setDatabase("neo4j")
             session.run("MATCH x", [:]) >> { throw new ClientException("a code", "a message") }
         when:
             def response = sampler.sample(entry)


[jmeter] 03/12: Delete Bolt Request.jmx

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 93d7dbbd68e89c297d2cf512d1ca44a5bd16ea96
Author: David Pecollet <da...@gmail.com>
AuthorDate: Mon Dec 14 17:49:40 2020 +0000

    Delete Bolt Request.jmx
---
 bin/examples/Bolt Request.jmx | 121 ------------------------------------------
 1 file changed, 121 deletions(-)

diff --git a/bin/examples/Bolt Request.jmx b/bin/examples/Bolt Request.jmx
deleted file mode 100644
index fad690b..0000000
--- a/bin/examples/Bolt Request.jmx	
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1-SNAPSHOT ec1b44c">
-  <hashTree>
-    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
-      <stringProp name="TestPlan.comments"></stringProp>
-      <boolProp name="TestPlan.functional_mode">false</boolProp>
-      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
-      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
-      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
-        <collectionProp name="Arguments.arguments"/>
-      </elementProp>
-      <stringProp name="TestPlan.user_define_classpath"></stringProp>
-    </TestPlan>
-    <hashTree>
-      <BoltConnectionElement guiclass="TestBeanGUI" testclass="BoltConnectionElement" testname="Bolt Connection Configuration" enabled="true">
-        <stringProp name="boltUri">neo4j://localhost:7617</stringProp>
-        <stringProp name="password">changeme</stringProp>
-        <stringProp name="username">neo4j</stringProp>
-      </BoltConnectionElement>
-      <hashTree/>
-      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
-        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
-        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
-          <boolProp name="LoopController.continue_forever">false</boolProp>
-          <stringProp name="LoopController.loops">10</stringProp>
-        </elementProp>
-        <stringProp name="ThreadGroup.num_threads">1</stringProp>
-        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
-        <boolProp name="ThreadGroup.scheduler">false</boolProp>
-        <stringProp name="ThreadGroup.duration"></stringProp>
-        <stringProp name="ThreadGroup.delay"></stringProp>
-        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
-      </ThreadGroup>
-      <hashTree>
-        <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
-          <boolProp name="ResultCollector.error_logging">false</boolProp>
-          <objProp>
-            <name>saveConfig</name>
-            <value class="SampleSaveConfiguration">
-              <time>true</time>
-              <latency>true</latency>
-              <timestamp>true</timestamp>
-              <success>true</success>
-              <label>true</label>
-              <code>true</code>
-              <message>true</message>
-              <threadName>true</threadName>
-              <dataType>true</dataType>
-              <encoding>false</encoding>
-              <assertions>true</assertions>
-              <subresults>true</subresults>
-              <responseData>false</responseData>
-              <samplerData>false</samplerData>
-              <xml>false</xml>
-              <fieldNames>true</fieldNames>
-              <responseHeaders>false</responseHeaders>
-              <requestHeaders>false</requestHeaders>
-              <responseDataOnError>false</responseDataOnError>
-              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
-              <assertionsResultsToSave>0</assertionsResultsToSave>
-              <bytes>true</bytes>
-              <sentBytes>true</sentBytes>
-              <url>true</url>
-              <threadCounts>true</threadCounts>
-              <idleTime>true</idleTime>
-              <connectTime>true</connectTime>
-            </value>
-          </objProp>
-          <stringProp name="filename"></stringProp>
-        </ResultCollector>
-        <hashTree/>
-        <BoltSampler guiclass="TestBeanGUI" testclass="BoltSampler" testname="Bolt Request" enabled="true">
-          <stringProp name="cypher">call dbms.cluster.role(&quot;owowo&quot;)</stringProp>
-          <stringProp name="params">{&quot;paramName&quot;:&quot;paramValue&quot;}</stringProp>
-          <boolProp name="recordQueryResults">true</boolProp>
-          <stringProp name="accessMode">WRITE</stringProp>
-          <intProp name="txTimeout">10</intProp>
-          <stringProp name="database">owowo</stringProp>
-        </BoltSampler>
-        <hashTree/>
-      </hashTree>
-      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
-        <boolProp name="ResultCollector.error_logging">false</boolProp>
-        <objProp>
-          <name>saveConfig</name>
-          <value class="SampleSaveConfiguration">
-            <time>true</time>
-            <latency>true</latency>
-            <timestamp>true</timestamp>
-            <success>true</success>
-            <label>true</label>
-            <code>true</code>
-            <message>true</message>
-            <threadName>true</threadName>
-            <dataType>true</dataType>
-            <encoding>false</encoding>
-            <assertions>true</assertions>
-            <subresults>true</subresults>
-            <responseData>false</responseData>
-            <samplerData>false</samplerData>
-            <xml>false</xml>
-            <fieldNames>true</fieldNames>
-            <responseHeaders>false</responseHeaders>
-            <requestHeaders>false</requestHeaders>
-            <responseDataOnError>false</responseDataOnError>
-            <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
-            <assertionsResultsToSave>0</assertionsResultsToSave>
-            <bytes>true</bytes>
-            <sentBytes>true</sentBytes>
-            <url>true</url>
-            <threadCounts>true</threadCounts>
-            <idleTime>true</idleTime>
-            <connectTime>true</connectTime>
-          </value>
-        </objProp>
-        <stringProp name="filename"></stringProp>
-      </ResultCollector>
-      <hashTree/>
-    </hashTree>
-  </hashTree>
-</jmeterTestPlan>


[jmeter] 04/12: styling fixes & edited changes file

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 007fa67edced0b01aaca50e792ce96c296286371
Author: David Pecollet <da...@gmail.com>
AuthorDate: Tue Dec 15 15:23:04 2020 +0000

    styling fixes & edited changes file
---
 .../protocol/bolt/sampler/AbstractBoltTestElement.java       |  3 +++
 .../org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java | 12 +++++++++---
 xdocs/changes.xml                                            |  7 +++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
index b30f750..807b7ad 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/AbstractBoltTestElement.java
@@ -85,6 +85,7 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
         this.recordQueryResults = recordQueryResults;
     }
 
+    //returns a SessionConfig object that can be passed to the driver session
     public SessionConfig getSessionConfig() {
         SessionConfig.Builder sessionConfigBuilder = SessionConfig.builder()
                 .withDefaultAccessMode(Enum.valueOf(AccessMode.class, getAccessMode()));
@@ -95,6 +96,8 @@ public abstract class AbstractBoltTestElement extends AbstractTestElement {
 
         return sessionConfigBuilder.build();
     }
+
+    //returns a TransactionConfig object that can be passed to the driver transaction
     public TransactionConfig getTransactionConfig() {
         TransactionConfig.Builder txConfigBuilder = TransactionConfig.builder();
 
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
index e0fa5e3..d717cc8 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
@@ -86,8 +86,13 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
         try {
             res.setResponseHeaders("Cypher request: " + getCypher());
             res.setResponseData(
-                        execute(BoltConnectionElement.getDriver(), getCypher(), params,
-                                getSessionConfig(), getTransactionConfig()), StandardCharsets.UTF_8.name());
+                    execute(
+                        BoltConnectionElement.getDriver(),
+                        getCypher(),
+                        params,
+                        getSessionConfig(),
+                        getTransactionConfig()),
+                    StandardCharsets.UTF_8.name());
         } catch (Exception ex) {
             res = handleException(res, ex);
         } finally {
@@ -105,7 +110,8 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
         return APPLICABLE_CONFIG_CLASSES.contains(guiClass);
     }
 
-    private String execute(Driver driver, String cypher, Map<String, Object> params, SessionConfig sessionConfig, TransactionConfig txConfig) {
+    private String execute(Driver driver, String cypher, Map<String, Object> params,
+                           SessionConfig sessionConfig, TransactionConfig txConfig) {
         try (Session session = driver.session(sessionConfig)) {
             Result statementResult = session.run(cypher, params, txConfig);
             return response(statementResult);
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 8162185..01aee2c 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -86,6 +86,12 @@ Summary
 <h3>Other samplers</h3>
 <ul>
   <li><bug>65149</bug><pr>644</pr>Encode the personal part of email addresses in SMTP Sampler</li>
+<ul>Bolt Sampler : added "transaction timeout" option
+</ul>
+<ul>Bolt Sampler : added "database" option, required for Neo4j 4.x (with multi-database support)
+</ul>
+<ul>Bolt Sampler : added "access mode" option, that allows running against a Neo4j Enterprise causal cluster,
+    with proper query routing using the "neo4://" or "bolt+routing://" URL schemes.
 </ul>
 
 <h3>Controllers</h3>
@@ -135,6 +141,7 @@ Summary
 <h3>Other Samplers</h3>
 <ul>
   <li><bug>65152</bug>OS Process Sampler - Cannot <code>Add from Clipboard</code> Command parameters</li>
+<ul>Bolt Sampler : fixed error displaying results when "Record Query Results" is enabled.
 </ul>
 
 <h3>Controllers</h3>


[jmeter] 05/12: Unit tests

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit a0a84ac7f97fde63d20c9f4fe56362d59b285444
Author: David Pecollet <da...@gmail.com>
AuthorDate: Tue Dec 15 16:03:57 2020 +0000

    Unit tests
---
 .../jmeter/protocol/bolt/sampler/BoltSampler.java  |  2 +-
 .../protocol/bolt/sampler/BoltSamplerSpec.groovy   | 74 +++++++++++++++++++---
 2 files changed, 66 insertions(+), 10 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
index d717cc8..d3787dc 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/sampler/BoltSampler.java
@@ -152,7 +152,7 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes
                 .append(getDatabase())
                 .append("\n")
                 .append("Access Mode: \n")
-                .append(getAccessMode().toString());
+                .append(getAccessMode());
         return request.toString();
     }
 
diff --git a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
index 80ce336..d7a2565 100644
--- a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
+++ b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy
@@ -22,9 +22,9 @@ import org.apache.jmeter.samplers.Entry
 import org.apache.jmeter.threads.JMeterContextService
 import org.apache.jmeter.threads.JMeterVariables
 import org.neo4j.driver.Driver
+import org.neo4j.driver.Record
 import org.neo4j.driver.Result
 import org.neo4j.driver.Session
-import org.neo4j.driver.SessionConfig
 import org.neo4j.driver.exceptions.ClientException
 import org.neo4j.driver.summary.ResultSummary
 import org.neo4j.driver.summary.SummaryCounters
@@ -54,8 +54,6 @@ class BoltSamplerSpec extends Specification {
     def "should execute return success on successful query"() {
         given:
             sampler.setCypher("MATCH x")
-            sampler.setDatabase("neo4j")
-            sampler.setTxTimeout(60)
             session.run("MATCH x", [:], _) >> getEmptyQueryResult()
         when:
             def response = sampler.sample(entry)
@@ -70,11 +68,44 @@ class BoltSamplerSpec extends Specification {
             response.getTime() > 0
     }
 
+    def "should not display results by default"() {
+        given:
+            sampler.setCypher("MATCH x")
+            session.run("MATCH x", [:], _) >> getPopulatedQueryResult()
+        when:
+            def response = sampler.sample(entry)
+        then:
+            response.isSuccessful()
+            response.isResponseCodeOK()
+            def str = response.getResponseDataAsString()
+            str.contains("Summary:")
+            str.endsWith("Records: Skipped")
+            response.getSampleCount() == 1
+            response.getErrorCount() == 0
+            response.getTime() > 0
+    }
+
+    def "should display results if asked"() {
+        given:
+            sampler.setCypher("MATCH x")
+            sampler.setRecordQueryResults(true)
+            session.run("MATCH x", [:], _) >> getPopulatedQueryResult()
+        when:
+            def response = sampler.sample(entry)
+        then:
+            response.isSuccessful()
+            response.isResponseCodeOK()
+            def str = response.getResponseDataAsString()
+            str.contains("Summary:")
+            str.endsWith("Mock for type 'Record'")
+            response.getSampleCount() == 1
+            response.getErrorCount() == 0
+            response.getTime() > 0
+    }
+
     def "should return error on failed query"() {
         given:
             sampler.setCypher("MATCH x")
-            sampler.setDatabase("neo4j")
-            sampler.setTxTimeout(60)
             session.run("MATCH x", [:], _) >> { throw new RuntimeException("a message") }
         when:
             def response = sampler.sample(entry)
@@ -93,8 +124,6 @@ class BoltSamplerSpec extends Specification {
         given:
             sampler.setCypher("MATCH x")
             sampler.setParams("{invalid}")
-            sampler.setDatabase("neo4j")
-            sampler.setTxTimeout(60)
         when:
             def response = sampler.sample(entry)
         then:
@@ -111,8 +140,6 @@ class BoltSamplerSpec extends Specification {
     def "should return db error code"() {
         given:
             sampler.setCypher("MATCH x")
-            sampler.setDatabase("neo4j")
-            sampler.setTxTimeout(60)
             session.run("MATCH x", [:], _) >> { throw new ClientException("a code", "a message") }
         when:
             def response = sampler.sample(entry)
@@ -120,6 +147,24 @@ class BoltSamplerSpec extends Specification {
             response.getResponseCode() == "a code"
     }
 
+    def "should ignore invalid timeout values"() {
+        given:
+            sampler.setCypher("MATCH x")
+            sampler.setTxTimeout(-1)
+            session.run("MATCH x", [:], _) >> getEmptyQueryResult()
+        when:
+            def response = sampler.sample(entry)
+        then:
+            response.isSuccessful()
+            response.isResponseCodeOK()
+            def str = response.getResponseDataAsString()
+            str.contains("Summary:")
+            str.endsWith("Records: Skipped")
+            response.getSampleCount() == 1
+            response.getErrorCount() == 0
+            response.getTime() > 0
+    }
+
     def getEmptyQueryResult() {
         def queryResult = Mock(Result)
         def summary = Mock(ResultSummary)
@@ -128,4 +173,15 @@ class BoltSamplerSpec extends Specification {
         summary.counters() >> counters
         return queryResult
     }
+
+    def getPopulatedQueryResult() {
+        def queryResult = Mock(Result)
+        def summary = Mock(ResultSummary)
+        def list = [Mock(Record), Mock(Record), Mock(Record)]
+        queryResult.consume() >> summary
+        queryResult.list() >> list
+        SummaryCounters counters = Mock(SummaryCounters)
+        summary.counters() >> counters
+        return queryResult
+    }
 }


[jmeter] 07/12: Connection Pool Max Size parameter added to Bolt Connection Config

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit cca089de696f1e8d1a51207dbe8a24def35c94a6
Author: David Pecollet <da...@gmail.com>
AuthorDate: Fri Jan 8 11:22:16 2021 +0000

    Connection Pool Max Size parameter added to Bolt Connection Config
    
    Allows to specify a pool size larger than the default 100, which can become a bottleneck with large number of threads using a single Neo4j driver.
    Also improve Bolt URI description to describe neo4j:// format.
---
 .../protocol/bolt/config/BoltConnectionElement.java      | 16 +++++++++++++++-
 .../bolt/config/BoltConnectionElementBeanInfo.java       |  5 ++++-
 .../config/BoltConnectionElementResources.properties     |  4 +++-
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java
index c3211dc..8b1a41f 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java
@@ -26,11 +26,13 @@ import org.apache.jmeter.testelement.TestStateListener;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterVariables;
 import org.neo4j.driver.AuthTokens;
+import org.neo4j.driver.Config;
 import org.neo4j.driver.Driver;
 import org.neo4j.driver.GraphDatabase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 @TestElementMetadata(labelResource = "displayName")
 public class BoltConnectionElement extends AbstractTestElement
         implements ConfigElement, TestStateListener, TestBean {
@@ -39,6 +41,7 @@ public class BoltConnectionElement extends AbstractTestElement
     private String boltUri;
     private String username;
     private String password;
+    private int maxConnectionPoolSize;
     private Driver driver;
 
     public static final String BOLT_CONNECTION = "boltConnection";
@@ -65,7 +68,10 @@ public class BoltConnectionElement extends AbstractTestElement
             log.error("Bolt connection already exists");
         } else {
             synchronized (this) {
-                driver = GraphDatabase.driver(getBoltUri(), AuthTokens.basic(getUsername(), getPassword()));
+                Config config = Config.builder()
+                        .withMaxConnectionPoolSize( getMaxConnectionPoolSize() )
+                        .build();
+                driver = GraphDatabase.driver(getBoltUri(), AuthTokens.basic(getUsername(), getPassword()), config);
                 variables.putObject(BOLT_CONNECTION, driver);
             }
         }
@@ -100,6 +106,14 @@ public class BoltConnectionElement extends AbstractTestElement
         this.boltUri = boltUri;
     }
 
+    public int getMaxConnectionPoolSize() {
+        return maxConnectionPoolSize;
+    }
+
+    public void setMaxConnectionPoolSize(int maxConnectionPoolSize) {
+        this.maxConnectionPoolSize = maxConnectionPoolSize;
+    }
+
     public String getUsername() {
         return username;
     }
diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
index 9a8b75f..40711d4 100644
--- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
+++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java
@@ -33,7 +33,7 @@ public class BoltConnectionElementBeanInfo extends BeanInfoSupport {
     public BoltConnectionElementBeanInfo() {
         super(BoltConnectionElement.class);
 
-        createPropertyGroup("connection", new String[] { "boltUri", "username", "password" });
+        createPropertyGroup("connection", new String[] { "boltUri", "username", "password", "maxConnectionPoolSize" });
 
         PropertyDescriptor propertyDescriptor =  property("boltUri");
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
@@ -44,6 +44,9 @@ public class BoltConnectionElementBeanInfo extends BeanInfoSupport {
         propertyDescriptor = property("password", TypeEditor.PasswordEditor);
         propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
         propertyDescriptor.setValue(DEFAULT, "");
+        propertyDescriptor = property("maxConnectionPoolSize");
+        propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        propertyDescriptor.setValue(DEFAULT, 100);
 
         if(log.isDebugEnabled()) {
             String descriptorsAsString = Arrays.stream(getPropertyDescriptors())
diff --git a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties
index 98d2cc6..85d922d 100644
--- a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties
+++ b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties
@@ -18,8 +18,10 @@
 displayName=Bolt Connection Configuration
 connection.displayName=Bolt Configuration
 boltUri.displayName=Bolt URI
-boltUri.shortDescription=Bolt URI
+boltUri.shortDescription=Bolt URI<br>for a direct connection: bolt://&lt;HOST&gt;:&lt;PORT&gt;<br>for a cluster: neo4j://&lt;HOST&gt;:&lt;PORT&gt;[?&lt;ROUTING_CONTEXT&gt;])
 username.displayName=Username
 username.shortDescription=Username
 password.displayName=Password
 password.shortDescription=Password
+maxConnectionPoolSize.displayName=Connection Pool Max Size
+maxConnectionPoolSize.shortDescription=Size limit for the pool of Bolt connections


[jmeter] 11/12: Line is a bit long.

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 92fadbc7984ee6f6182d368f44880250b4b0b4a6
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Mar 12 16:54:49 2021 +0100

    Line is a bit long.
    
    Relates to #638
---
 xdocs/usermanual/component_reference.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xdocs/usermanual/component_reference.xml b/xdocs/usermanual/component_reference.xml
index 2ed6086..f342610 100644
--- a/xdocs/usermanual/component_reference.xml
+++ b/xdocs/usermanual/component_reference.xml
@@ -4532,7 +4532,8 @@ DB db = MongoDBHolder.getDBFromSource("value of property MongoDB Source",
         <property name="Username" required="No">User account.</property>
         <property name="Password" required="No">User credentials.</property>
         <property name="Connection Pool Max Size" required="Yes">Max size of the Neo4j driver Bolt connection pool.
-            Raise the value if running large number of concurrent threads, so that JMeter threads are not blocked waiting for a connection to be released to the pool.</property>
+            Raise the value if running large number of concurrent threads, so that JMeter threads are not blocked waiting
+            for a connection to be released to the pool.</property>
     </properties>
 </component>
 


[jmeter] 10/12: more xml formatting fixes in changes.xml

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit e7b9b8499a83427d6a6e6792a095071e24b06de6
Author: David Pecollet <da...@gmail.com>
AuthorDate: Fri Jan 29 17:09:05 2021 +0000

    more xml formatting fixes in changes.xml
    
    Closes #638
---
 xdocs/changes.xml | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 01d5655..594d28b 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -86,15 +86,9 @@ Summary
 <h3>Other samplers</h3>
 <ul>
   <li><bug>65149</bug><pr>644</pr>Encode the personal part of email addresses in SMTP Sampler</li>
-<ul>Bolt Sampler : added "transaction timeout" option
-</ul>
-<ul>Bolt Sampler : added "database" option, required for Neo4j 4.x (with multi-database support)
-</ul>
-<ul>Bolt Sampler : added "access mode" option, that allows running against a Neo4j Enterprise causal cluster,
-    with proper query routing using the "neo4://" or "bolt+routing://" URL schemes.
-    <li>Bolt Sampler : added "transaction timeout" option</li>
-    <li>Bolt Sampler : added "database" option, required for Neo4j 4.x (with multi-database support)</li>
-    <li>Bolt Sampler : added "access mode" option, that allows running against a Neo4j Enterprise causal cluster</li>
+  <li><pr>638</pr>Various additions to the Bolt Sampler. Added <code>transaction timeout</code>, <code>database</code>
+    option required for Neo4j 4.x (with multi-database support) and <code>access mode</code> option, that allows running
+    against a Neo4j Enterprise Causal Cluster. Contributed by David Pecollet (david.pecollet at gmail.com)</li>
 </ul>
 
 <h3>Controllers</h3>
@@ -109,7 +103,8 @@ Summary
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
 <ul>
-    <li>Bolt Connection Configuration: added ConnectionPoolMaxSize parameter</li>
+    <li><pr>638</pr>Bolt Connection Configuration: added <code>ConnectionPoolMaxSize</code> parameter. Contributed by
+        David Pecollet (david.pecollet at gmail.com)</li>
 </ul>
 
 <h3>Functions</h3>
@@ -145,7 +140,8 @@ Summary
 <h3>Other Samplers</h3>
 <ul>
   <li><bug>65152</bug>OS Process Sampler - Cannot <code>Add from Clipboard</code> Command parameters</li>
-<ul>Bolt Sampler : fixed error displaying results when "Record Query Results" is enabled.
+  <li><pr>638</pr>Bolt Sampler: fixed error displaying results when "Record Query Results" is enabled. Contributed by
+        David Pecollet (david.pecollet at gmail.com)</li>
 </ul>
 
 <h3>Controllers</h3>
@@ -194,6 +190,7 @@ Summary
   <li>njzukas (github.com/njzukas)</li>
   <li>David Getzlaff (david.getzlaff at t-systems.com>)</li>
   <li>Konstantin Kalinin (konstantin at kkalinin.pro)</li>
+  <li>David Pecollet (david.pecollet at gmail.com)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <ul>