jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1850776 - in /jmeter/trunk: src/core/org/apache/jmeter/control/IfController.java test/src/org/apache/jmeter/control/TestIfController.java xdocs/changes.xml
Date Tue, 08 Jan 2019 17:30:48 GMT
Author: fschumacher
Date: Tue Jan  8 17:30:48 2019
New Revision: 1850776

URL: http://svn.apache.org/viewvc?rev=1850776&view=rev
Log:
Ignore spaces at the end and beginning of expressions used in IfController

Bugzilla Id: 63064

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java
    jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java?rev=1850776&r1=1850775&r2=1850776&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java Tue Jan  8 17:30:48
2019
@@ -174,7 +174,7 @@ public class IfController extends Generi
      * @return the condition associated with this controller
      */
     public String getCondition() {
-        return getPropertyAsString(CONDITION);
+        return getPropertyAsString(CONDITION).trim();
     }
 
     /**

Modified: jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java?rev=1850776&r1=1850775&r2=1850776&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java Tue Jan  8 17:30:48
2019
@@ -19,6 +19,7 @@
 package org.apache.jmeter.control;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
 import org.apache.jmeter.config.Arguments;
@@ -294,4 +295,23 @@ public class TestIfController extends JM
         }
         assertEquals(counter, 6);
     }
+
+    @Test
+    public void shouldIgnoreEmptyLastLine() {
+        GenericController controller = new GenericController();
+
+        IfController ifCont = new IfController("true\n");
+        ifCont.setUseExpression(true);
+        ifCont.setEvaluateAll(false);
+
+        ifCont.addTestElement(new TestSampler("sample1"));
+        controller.addTestElement(ifCont);
+
+        controller.initialize();
+        controller.setRunningVersion(true);
+        ifCont.setRunningVersion(true);
+
+        Sampler sampler = controller.next();
+        assertFalse(sampler == null);
+    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1850776&r1=1850775&r2=1850776&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Jan  8 17:30:48 2019
@@ -192,6 +192,7 @@ of previous time slot as a base. Startin
 <ul>
     <li><bug>62806</bug>ModuleController cloning by Run behaves differently
wether in GUI or Non GUI mode. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>62847</bug>If Controller cannot use variable for index exposed
by LoopController/WhileController/ForEachController</li>
+    <li><bug>63064</bug>Ignore spaces at the end and beginning of expressions
used in IfController</li>
 </ul>
 
 <h3>Listeners</h3>



Mime
View raw message