jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1713842 - in /jmeter/trunk: src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java xdocs/changes.xml xdocs/usermanual/component_reference.xml
Date Wed, 11 Nov 2015 13:49:31 GMT
Author: pmouawad
Date: Wed Nov 11 13:49:31 2015
New Revision: 1713842

URL: http://svn.apache.org/viewvc?rev=1713842&view=rev
Log:
Bug 58160 - JMS Publisher : reload file content if file name changes
Bugzilla Id: 58160

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java?rev=1713842&r1=1713841&r2=1713842&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
Wed Nov 11 13:49:31 2015
@@ -26,6 +26,7 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 import javax.jms.DeliveryMode;
 import javax.jms.JMSException;
@@ -95,6 +96,9 @@ public class PublisherSampler extends Ba
     // Cache for bytes-message, only used when parsing from a file 
     private byte[] bytes_msg_file_contents = null;
 
+    // Cached file name
+    private String cachedFileName;
+
     public PublisherSampler() {
     }
 
@@ -250,7 +254,9 @@ public class PublisherSampler extends Ba
         if (getConfigChoice().equals(JMSPublisherGui.USE_FILE_RSC)) {
             // in the case the test uses a file, we set it locally and
             // prevent loading the file repeatedly
-            if (file_contents == null) {
+            // if the file name changes we reload it
+            if (file_contents == null || !Objects.equals(cachedFileName, getInputFile()))
{
+                cachedFileName = getInputFile();
                 file_contents = getFileContent(getInputFile());
             }
             return file_contents;
@@ -288,7 +294,9 @@ public class PublisherSampler extends Ba
         if (getConfigChoice().equals(JMSPublisherGui.USE_FILE_RSC)) {
             // in the case the test uses a file, we set it locally and
             // prevent loading the file repeatedly
-            if (object_msg_file_contents == null) {
+            // if the file name changes we reload it
+            if (object_msg_file_contents == null || !Objects.equals(cachedFileName, getInputFile()))
{
+                cachedFileName = getInputFile();
                 object_msg_file_contents = getFileObjectContent(getInputFile());
             }
 
@@ -317,7 +325,9 @@ public class PublisherSampler extends Ba
         if (getConfigChoice().equals(JMSPublisherGui.USE_FILE_RSC)) {
             // in the case the test uses a file, we set it locally and
             // prevent loading the file repeatedly
-            if (bytes_msg_file_contents == null) {
+            // if the file name changes we reload it
+            if (bytes_msg_file_contents == null || !Objects.equals(cachedFileName, getInputFile()))
{
+                cachedFileName = getInputFile();
                 bytes_msg_file_contents = getFileBytesContent(getInputFile());
             }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1713842&r1=1713841&r2=1713842&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Nov 11 13:49:31 2015
@@ -77,6 +77,7 @@ Summary
     <li>Since version 2.14, you can use Nashorn Engine (default javascript engine is
Rhino) under Java8 for Elements that use Javascript Engine (__javaScript, IfController). If
you want to use it, use property <code>javascript.use_rhino=false</code>, see
<bugzilla>58406</bugzilla>.
     Note in future versions, we will switch to Nashorn by default, so users are encouraged
to report any issue related to broken code when using Nashorn instead of Rhino.
     </li>
+    <li>Since version 2.14, JMS Publisher will reload contents of file if Message source
is "From File" and the ""Filename" field changes (through variables usage for example)</li>
  
 </ul>
 
 <!-- =================== Improvements =================== -->
@@ -93,6 +94,7 @@ Summary
 <ul>
     <li><bug>57928</bug>Add ability to define protocol (http/https) to
AccessLogSampler GUI. Contributed by Jérémie Lesage (jeremie.lesage at jeci.fr)</li>
     <li><bug>58300</bug> Make existing Java Samplers implement Interruptible</li>
+    <li><bug>58160</bug>JMS Publisher : reload file content if file name
changes. Based partly on a patch contributed by Maxime Chassagneux (maxime.chassagneux at
gmail.com)</li>
 </ul>
 
 <h3>Controllers</h3>
@@ -211,6 +213,7 @@ Summary
 <li>Amol Moye (amol.moye at thomsonreuters.com)</li>
 <li>Samoht-fr (https://github.com/Samoht-fr)</li>
 <li>Graham Russell (jmeter at ham1.co.uk)</li>
+<li>Maxime Chassagneux (maxime.chassagneux at gmail.com)</li>
 </ul>
 
 <br/>

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1713842&r1=1713841&r2=1713842&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Wed Nov 11 13:49:31 2015
@@ -1548,7 +1548,7 @@ Currently the only way to changes these
   <property name="Number of samples to aggregate" required="Yes">Number of samples
to aggregate</property>
   <property name="Message source" required="Yes">Where to obtain the message:
   <dl>
-    <dt><code>From File</code></dt><dd>means the referenced
file will be read and reused by all samples</dd>
+    <dt><code>From File</code></dt><dd>means the referenced
file will be read and reused by all samples. If file name changes it is reloaded since JMeter
2.14</dd>
     <dt><code>Random File from folder specified below</code></dt><dd>means
a random file will be selected from folder specified below, this folder must contain either
files with extension <code>.dat</code> for Bytes Messages, or files with extension
<code>.txt</code> or <code>.obj</code> for Object or Text messages</dd>
     <dt><code>Text area</code></dt><dd>The Message to use either
for Text or Object message</dd>
   </dl>



Mime
View raw message