Am 06.04.2017 um 19:06 schrieb Philippe Mouawad:
Hi Felix,
It seems you didn't commit the main function no :-) ?

Yes, that was missing. Ooops.

Thanks for catching that.

Felix

Thanks
Regards

On Thu, Apr 6, 2017 at 7:04 PM, <[email protected]> wrote:

Author: fschumacher
Date: Thu Apr  6 17:04:19 2017
New Revision: 1790429

URL: http://svn.apache.org/viewvc?rev=1790429&view=rev
Log:
Add ${__escapeXml()} function. Contributed by Michael Osipov (michaelo at
apache.org)

This closes #288 on github.

Bugzilla Id: 60883

Modified:
     jmeter/trunk/docs/changes.html
     jmeter/trunk/docs/usermanual/functions.html
     jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
     jmeter/trunk/src/core/org/apache/jmeter/resources/
messages_fr.properties
     jmeter/trunk/test/src/org/apache/jmeter/functions/
TestSimpleFunctions.java
     jmeter/trunk/xdocs/changes.xml
     jmeter/trunk/xdocs/usermanual/functions.xml

Modified: jmeter/trunk/docs/changes.html
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/changes.
html?rev=1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/docs/changes.html (original)
+++ jmeter/trunk/docs/changes.html Thu Apr  6 17:04:19 2017
@@ -419,6 +419,12 @@ jmeter.reportgenerator.apdex_per_transac

  <h3>Functions</h3>
  <ul>
+    <li><a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=60883";>
+      Bug
+      60883</a>
+    -
+  <a href="https://github.com/apache/jmeter/pull/288";>
+      Pull request #288</a> - Add <span class="code">${__escapeXml()}</span>
function. Contributed by Michael Osipov (michaelo at apache.org)</li>
  </ul>

  <h3>I18N</h3>

Modified: jmeter/trunk/docs/usermanual/functions.html
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/usermanual/
functions.html?rev=1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/docs/usermanual/functions.html (original)
+++ jmeter/trunk/docs/usermanual/functions.html Thu Apr  6 17:04:19 2017
@@ -104,6 +104,7 @@ Alternatively, just use <span class="cod
          <tr><td>String</td><td> <a 
href="#__unescape">unescape</a></td><td>Process
strings containing Java escapes (e.g. \n &amp; \t)</td><td>2.3.3</td></tr>
          <tr><td>String</td><td> <a href="#__unescapeHtml">
unescapeHtml</a></td><td>Decode HTML-encoded strings</td><td>2.3.3</td></
tr>
          <tr><td>String</td><td> <a 
href="#__escapeHtml">escapeHtml</a></td><td>Encode
strings using HTML encoding</td><td>2.3.3</td></tr>
+        <tr><td>String</td><td> <a 
href="#__escapeXml">escapeXml</a></td><td>Encode
strings using XMl encoding</td><td>3.2</td></tr>
          <tr><td>String</td><td> <a 
href="#__urldecode">urldecode</a></td><td>Decode
a application/x-www-form-urlencoded string</td><td>2.10</td></tr>
          <tr><td>String</td><td> <a 
href="#__urlencode">urlencode</a></td><td>Encode
a string to a application/x-www-form-urlencoded
string</td><td>2.10</td></tr>
          <tr><td>String</td><td> <a href="#__TestPlanName">
TestPlanName</a></td><td>Return name of current test
plan</td><td>2.6</td></tr>
@@ -1305,6 +1306,26 @@ A reference name - <span class="code">re
          </div><div class="required req-false">No</div></div>
  </div><div class="go-top"><a href="#">^</a></div></div>

+<div class="component"><h2 id="__escapeXml">__escapeXml<a
class="sectionlink" href="#__escapeXml" title="Link to
here">&para;</a></h2><div class="description">
+    <p>
+Function which escapes the characters in a String using XML 1.0 entities.
+</p>
+<p>
+For example,<span class="code">"bread" &amp; 'butter'</span>
+becomes:
+<span class="code">&amp;quot;bread&amp;quot; &amp;amp;
&amp;apos;butter&amp;apos;</span>.
+</p>
+    <p>
+    Uses <span class="code">StringEscapeUtils#escapeXml10(String)</span>
from Commons Lang.
+    </p>
+    </div><div class="properties"><h3 id="__escapeXml_parms1">
+        Parameters
+        <a class="sectionlink" href="#__escapeXml_parms1" title="Link to
here">&para;</a></h3><div class="property title"><div class="name
title">Attribute</div><div class="description title">Description</div><div
class="required title">Required</div></div>
+        <div class="property"><div class="name req-true">String to
escape</div><div class="description req-true">
+        The string to be escaped.
+        </div><div class="required req-true">Yes</div></div>
+</div><div class="go-top"><a href="#">^</a></div></div>
+
  </div>

  <div class="subsection"><h2 id="predefinedvars">21.6 Pre-defined
Variables<a class="sectionlink" href="#predefinedvars" title="Link to
here">&para;</a></h2>

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/
messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
apache/jmeter/resources/messages.properties?rev=
1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
Thu Apr  6 17:04:19 2017
@@ -298,6 +298,7 @@ error_occurred=Error Occurred
  error_title=Error
  es=Spanish
  escape_html_string=String to escape
+escape_xml_string=String to escape
  eval_name_param=Text containing variable and function references
  evalvar_name_param=Name of variable
  example_data=Sample Data

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/
messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
apache/jmeter/resources/messages_fr.properties?rev=
1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
Thu Apr  6 17:04:19 2017
@@ -293,6 +293,7 @@ error_occurred=Une erreur est survenue
  error_title=Erreur
  es=Espagnol
  escape_html_string=Cha\u00EEne d'\u00E9chappement
+escape_xml_string=Cha\u00EEne d'\u00E9chappement
  eval_name_param=Variable contenant du texte et r\u00E9f\u00E9rences de
fonctions
  evalvar_name_param=Nom de variable
  example_data=Exemple de donn\u00E9e

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/
TestSimpleFunctions.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/
apache/jmeter/functions/TestSimpleFunctions.java?rev=
1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java
(original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java
Thu Apr  6 17:04:19 2017
@@ -13,7 +13,7 @@
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
- *
+ *
   */

  package org.apache.jmeter.functions;
@@ -59,13 +59,13 @@ public class TestSimpleFunctions extends
          AbstractFunction function = new Uuid();
          checkInvalidParameterCounts(function, 0, 0);
      }
-
+
      @Test
      public void testThreadNumberParameterCount() throws Exception {
          AbstractFunction function = new ThreadNumber();
          checkInvalidParameterCounts(function, 0, 0);
      }
-
+
      @Test
      public void testEscapeHtmlParameterCount() throws Exception {
          AbstractFunction function = new EscapeHtml();
@@ -77,19 +77,25 @@ public class TestSimpleFunctions extends
          AbstractFunction function = new UnEscapeHtml();
          checkInvalidParameterCounts(function, 1, 1);
      }
-
+
+    @Test
+    public void testEscapeXmlParameterCount() throws Exception {
+        AbstractFunction function = new EscapeXml();
+        checkInvalidParameterCounts(function, 1, 1);
+    }
+
      @Test
      public void testUnEscapeParameterCount() throws Exception {
          AbstractFunction function = new UnEscape();
          checkInvalidParameterCounts(function, 1, 1);
      }
-
+
      @Test
      public void testTestPlanParameterCount() throws Exception {
          AbstractFunction function = new TestPlanName();
          checkInvalidParameterCounts(function, 0, 0);
      }
-
+
      @Test
      public void testThreadNumber() throws Exception {
          AbstractFunction function = new ThreadNumber();
@@ -97,8 +103,8 @@ public class TestSimpleFunctions extends
          String ret = function.execute(result, null);
          assertEquals("1", ret);
      }
-
-
+
+
      @Test
      public void testUuid() throws Exception {
          AbstractFunction function = new Uuid();
@@ -106,7 +112,7 @@ public class TestSimpleFunctions extends
          String ret = function.execute(result, null);
          UUID.fromString(ret);
      }
-
+
      @Test
      public void testEscapeHtml() throws Exception {
          AbstractFunction function = new EscapeHtml();
@@ -115,7 +121,7 @@ public class TestSimpleFunctions extends
          String ret = function.execute(result, null);
          assertEquals("&quot;bread&quot; &amp; &quot;butter&quot;", ret);
      }
-
+
      @Test
      public void testUnEscapeHtml() throws Exception {
          AbstractFunction function = new UnEscapeHtml();
@@ -124,7 +130,16 @@ public class TestSimpleFunctions extends
          String ret = function.execute(result, null);
          assertEquals("\"bread\" & \"butter\"", ret);
      }
-
+
+    @Test
+    public void testEscapeXml() throws Exception {
+        AbstractFunction function = new EscapeXml();
+        params.add(new CompoundVariable("\"bread\" & <'butter'>"));
+        function.setParameters(params);
+        String ret = function.execute(result, null);
+        assertEquals("&quot;bread&quot; &amp;
&lt;&apos;butter&apos;&gt;", ret);
+    }
+
      @Test
      public void testTestPlanName() throws Exception {
          AbstractFunction function = new TestPlanName();

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.
xml?rev=1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Apr  6 17:04:19 2017
@@ -306,6 +306,7 @@ jmeter.reportgenerator.apdex_per_transac

  <h3>Functions</h3>
  <ul>
+    <li><bug>60883</bug><pr>288</pr> - Add <code>${__escapeXml()}</code>
function. Contributed by Michael Osipov (michaelo at apache.org)</li>
  </ul>

  <h3>I18N</h3>

Modified: jmeter/trunk/xdocs/usermanual/functions.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/
functions.xml?rev=1790429&r1=1790428&r2=1790429&view=diff
============================================================
==================
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Thu Apr  6 17:04:19 2017
@@ -143,6 +143,7 @@ Alternatively, just use <code>/</code> i
          <tr><td>String</td><td> <a 
href="#__unescape">unescape</a></td><td>Process
strings containing Java escapes (e.g. \n &amp; \t)</td><td>2.3.3</td></tr>
          <tr><td>String</td><td> <a href="#__unescapeHtml">
unescapeHtml</a></td><td>Decode HTML-encoded strings</td><td>2.3.3</td></
tr>
          <tr><td>String</td><td> <a 
href="#__escapeHtml">escapeHtml</a></td><td>Encode
strings using HTML encoding</td><td>2.3.3</td></tr>
+        <tr><td>String</td><td> <a 
href="#__escapeXml">escapeXml</a></td><td>Encode
strings using XMl encoding</td><td>3.2</td></tr>
          <tr><td>String</td><td> <a 
href="#__urldecode">urldecode</a></td><td>Decode
a application/x-www-form-urlencoded string</td><td>2.10</td></tr>
          <tr><td>String</td><td> <a 
href="#__urlencode">urlencode</a></td><td>Encode
a string to a application/x-www-form-urlencoded
string</td><td>2.10</td></tr>
          <tr><td>String</td><td> <a href="#__TestPlanName">
TestPlanName</a></td><td>Return name of current test
plan</td><td>2.6</td></tr>
@@ -1475,6 +1476,28 @@ A reference name - <code>refName</code>
          </property>
  </properties>
  </component>
+
+<component index="&sect-num;.5.33" name="__escapeXml">
+<description>
+    <p>
+Function which escapes the characters in a String using XML 1.0 entities.
+</p>
+<p>
+For example,<code>&quot;bread&quot; &amp; &apos;butter&apos;</code>
+becomes:
+<code>&#38;quot;bread&#38;quot; &#38;amp; &#38;apos;butter&#38;apos;</
code>.
+</p>
+    <p>
+    Uses <code>StringEscapeUtils#escapeXml10(String)</code> from Commons
Lang.
+    </p>
+    </description>
+
+<properties>
+        <property name="String to escape" required="Yes">
+        The string to be escaped.
+        </property>
+</properties>
+</component>

  </subsection>






Reply via email to