jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1198563 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/TestPlanName.java xdocs/changes.xml xdocs/usermanual/functions.xml
Date Sun, 06 Nov 2011 21:20:36 GMT
Author: pmouawad
Date: Sun Nov  6 21:20:36 2011
New Revision: 1198563

URL: http://svn.apache.org/viewvc?rev=1198563&view=rev
Log:
Bug 51091 - New function returning the name of the current "Test Plan"

Added:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java   (with props)
Modified:
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/functions.xml

Added: jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java?rev=1198563&view=auto
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java (added)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java Sun Nov  6 21:20:36
2011
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.jmeter.engine.util.CompoundVariable;
+import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.samplers.Sampler;
+
+/**
+ * Returns Test Plan name
+ *
+ */
+public class TestPlanName extends AbstractFunction {
+
+    private static final List<String> desc = new LinkedList<String>();
+
+    private static final String KEY = "__TestPlanName"; //$NON-NLS-1$
+
+    /**
+     * No-arg constructor.
+     */
+    public TestPlanName() {
+        super();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
+            throws InvalidVariableException {
+    	String testPlanFile = GuiPackage.getInstance().getTestPlanFile();
+        return testPlanFile;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException
{
+        checkParameterCount(parameters, 0);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getReferenceKey() {
+        return KEY;
+    }
+
+    /** {@inheritDoc} */
+    public List<String> getArgumentDesc() {
+        return desc;
+    }
+}
\ No newline at end of file

Propchange: jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1198563&r1=1198562&r2=1198563&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Nov  6 21:20:36 2011
@@ -183,6 +183,7 @@ these occurs, Sampler is marked as faile
 <ul>
 <li>Bug 52006 - Create a function RandomString to generate random Strings</li>
 <li>Bug 52016 - It would be useful to support Jexl2</li>
+<li>Bug 51091 - New function returning the name of the current "Test Plan"</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=1198563&r1=1198562&r2=1198563&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Sun Nov  6 21:20:36 2011
@@ -117,6 +117,7 @@ and need to be referenced using the __P 
         <tr><td>String</td><td> <a href="#__unescape">unescape</a></td><td>Process
strings containing Java escapes (e.g. \n &amp; \t)</td></tr>
         <tr><td>String</td><td> <a href="#__unescapeHtml">unescapeHtml</a></td><td>Decode
HTML-encoded strings</td></tr>
         <tr><td>String</td><td> <a href="#__escapeHtml">escapeHtml</a></td><td>Encode
strings using HTML encoding</td></tr>
+        <tr><td>String</td><td> <a href="#__TestPlanName">TestPlanName</a></td><td>Return
name of current test plan</td></tr>
 </table>
 <p></p>
 <subsection name="&sect-num;.1 What can functions do" anchor="what_can_do">
@@ -1159,6 +1160,14 @@ A reference name - refName - for reusing
 </properties>
 </component>
 
+<component index="&sect-num;.5.28" name="__TestPlanName">
+
+<description>
+    <p>
+    The TestPlanName function returns the name of the current test plan (can be used in Including
Plans to know the name of the calling test plan).
+    </p>
+</description>
+</component>
 </subsection>
 
 <subsection name="&sect-num;.6 Pre-defined Variables" anchor="predefinedvars">



Mime
View raw message