[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: svn commit: r1028515 - in /jakarta/jmeter/trunk: bin/ bin/examples/
From: sebb () apache ! org
Date: 2010-10-28 21:58:12
Message-ID: 20101028215812.9D4A12388980 () eris ! apache ! org
[Download RAW message or body]
Author: sebb
Date: Thu Oct 28 21:58:11 2010
New Revision: 1028515
URL: http://svn.apache.org/viewvc?rev=1028515&view=rev
Log:
Bug 49365 - Allow result set to be written to file in a path relative to the loaded \
script
Modified:
jakarta/jmeter/trunk/bin/examples/CSVSample.jmx
jakarta/jmeter/trunk/bin/jmeter.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
jakarta/jmeter/trunk/xdocs/usermanual/listeners.xml
Modified: jakarta/jmeter/trunk/bin/examples/CSVSample.jmx
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/examples/CSVSample.jmx?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/examples/CSVSample.jmx (original)
+++ jakarta/jmeter/trunk/bin/examples/CSVSample.jmx Thu Oct 28 21:58:11 2010
@@ -343,7 +343,7 @@
<bytes>true</bytes>
</value>
</objProp>
- <stringProp name="filename"></stringProp>
+ <stringProp name="filename">~/CSVSample.jtl</stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" \
testclass="ResultCollector" testname="View Results Tree" enabled="true">
Modified: jakarta/jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/jmeter.properties (original)
+++ jakarta/jmeter/trunk/bin/jmeter.properties Thu Oct 28 21:58:11 2010
@@ -364,6 +364,9 @@ log_level.jorphan=INFO
# Optional xml processing instruction for line 2 of the file:
#jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" \
href="../extras/jmeter-results-detail-report_21.xsl"?>
+# Prefix used to identify filenames that are relative to the current base
+#jmeter.save.saveservice.base_prefix=~/
+
#---------------------------------------------------------------------------
# Settings that affect SampleResults
#---------------------------------------------------------------------------
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java \
Thu Oct 28 21:58:11 2010 @@ -46,6 +46,7 @@ import org.apache.jmeter.samplers.Sample
import org.apache.jmeter.samplers.SampleSaveConfiguration;
import org.apache.jmeter.save.CSVSaveService;
import org.apache.jmeter.save.SaveService;
+import org.apache.jmeter.services.FileServer;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestListener;
import org.apache.jmeter.testelement.property.BooleanProperty;
@@ -375,6 +376,7 @@ public class ResultCollector extends Abs
if (filename == null || filename.length() == 0) {
return null;
}
+ filename = FileServer.resolveBaseRelativeName(filename);
FileEntry fe = files.get(filename);
PrintWriter writer = null;
boolean trimmed = true;
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java Thu \
Oct 28 21:58:11 2010 @@ -28,6 +28,7 @@ import org.apache.commons.lang.text.StrB
import org.apache.jmeter.samplers.SampleEvent;
import org.apache.jmeter.samplers.SampleListener;
import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.services.FileServer;
import org.apache.jmeter.testelement.AbstractTestElement;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jorphan.logging.LoggingManager;
@@ -173,7 +174,7 @@ public class ResultSaver extends Abstrac
* text/html;charset=ISO-8859-1
*/
private String makeFileName(String contentType, boolean skipAutoNumber, boolean \
skipSuffix) {
- StrBuilder sb = new StrBuilder(getFilename());
+ StrBuilder sb = new \
StrBuilder(FileServer.resolveBaseRelativeName(getFilename())); if (!skipAutoNumber){
sb.append(nextNumber());
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java Thu Oct \
28 21:58:11 2010 @@ -37,6 +37,7 @@ import java.util.Map;
import java.util.Random;
import org.apache.jmeter.gui.JMeterFileFilter;
+import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
@@ -54,9 +55,17 @@ import org.apache.log.Logger;
* test plans to execute on unknown boxes that only have Java installed.
*/
public class FileServer {
+
private static final Logger log = LoggingManager.getLoggerForClass();
- private static final String DEFAULT_BASE = System.getProperty("user.dir");
+ private static final String DEFAULT_BASE = System.getProperty("user.dir");// \
$NON-NLS-1$ +
+ /** Default base prefix */
+ private static final String BASE_PREFIX_DEFAULT = "~/"; // $NON-NLS-1$
+
+ private static final String BASE_PREFIX =
+ JMeterUtils.getPropDefault("jmeter.save.saveservice.base_prefix", // \
$NON-NLS-1$ + BASE_PREFIX_DEFAULT);
//@GuardedBy("this")
private File base;
@@ -345,4 +354,21 @@ public class FileServer {
charSetEncoding=e;
}
}
+
+ /**
+ * Resolve a file name that may be relative to the base directory.
+ * If the name begins with the value of the JMeter property
+ * "jmeter.save.saveservice.base_prefix"
+ * - default "~/" - then the name is assumed to be relative to the basename.
+ *
+ * @param relativeName
+ * @return the updated file
+ */
+ public static String resolveBaseRelativeName(String relativeName) {
+ if (relativeName.startsWith(BASE_PREFIX)){
+ String newName = relativeName.substring(BASE_PREFIX.length());
+ return new File(getFileServer().getBaseDir(),newName).getAbsolutePath();
+ }
+ return relativeName;
+ }
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Oct 28 21:58:11 2010
@@ -128,6 +128,7 @@ To override the default local language f
<ul>
<li>View Results Tree - Add a dialog's text box on "Sampler result tab > Parsed" to \
display the long value with a double click on cell</li> <li>Bug 37156 - Formatted \
view of Request in Results Tree</li> +<li>Bug 49365 - Allow result set to be written \
to file in a path relative to the loaded script</li> </ul>
<h3>Timers, Assertions, Config, Pre- & Post-Processors</h3>
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Oct 28 21:58:11 \
2010 @@ -2197,7 +2197,13 @@ by using the -l command-line flag.
<figure width="786" height="145" image="simpledatawriter.png">Result file \
configuration panel</figure> </p>
<properties>
- <property name="File Name" required="No">Name of the file containing sample \
results</property> + <property name="Filename" required="No">Name of the file \
containing sample results. + The file name can be specified using either a \
relative or an absolute path name. + Relative paths are resolved relative to \
the current working directory (which defaults to the bin/ directory). + \
Versions of JMeter after 2.4 also support paths relative to the directory containing \
the current test plan (JMX file). + If the path name begins with "~/" (or \
whatever is in the jmeter.save.saveservice.base_prefix JMeter property), + \
then the path is assumed to be relative to the JMX file location. + \
</property>
<property name="Browse..." required="No">File Browse Button</property>
<property name="Errors" required="No">Select this to write/read only results \
with errors</property>
<property name="Successes" required="No">Select this to write/read only \
results without errors. @@ -2625,7 +2631,12 @@ i.e. 30.0 requests/minute is saved as \
0. </description>
<properties>
<property name="Name" required="No">Descriptive name for this element that is shown \
in the tree.</property>
- <property name="Filename Prefix" required="Yes">Prefix for the generated file \
names; this can include a directory name.</property> + <property name="Filename \
Prefix" required="Yes">Prefix for the generated file names; this can include a \
directory name. + Relative paths are resolved relative to the current working \
directory (which defaults to the bin/ directory). + Versions of JMeter after \
2.4 also support paths relative to the directory containing the current test plan \
(JMX file). + If the path name begins with "~/" (or whatever is in the \
jmeter.save.saveservice.base_prefix JMeter property), + then the path is \
assumed to be relative to the JMX file location. + </property>
<property name="Variable Name" required="No">
Name of a variable in which to save the generated file name (so it can be used \
later in the test plan). If there are sub-samples then a numeric suffix is added to \
the variable name.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/listeners.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/listeners.xml?rev=1028515&r1=1028514&r2=1028515&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/listeners.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/listeners.xml Thu Oct 28 21:58:11 2010
@@ -48,7 +48,11 @@ write it as CSV or XML.
CSV files are much smaller than XML files, so use CSV if you are generating lots of \
samples. </p>
<p>
-
+The file name can be specified using either a relative or an absolute path name.
+Relative paths are resolved relative to the current working directory (which \
defaults to the bin/ directory). +Versions of JMeter after 2.4 also support paths \
relative to the directory containing the current test plan (JMX file). +If the path \
name begins with "~/" (or whatever is in the jmeter.save.saveservice.base_prefix \
JMeter property), +then the path is assumed to be relative to the JMX file location.
</p>
<p>
If you only wish to record certain samples, add the Listener as a child of the \
sampler. @@ -176,6 +180,9 @@ sampleresult.timestamp.start=true
# Optional xml processing instruction for line 2 of the file:
#jmeter.save.saveservice.xml_pi=&lt;?xml-stylesheet type="text/xsl" \
href="sample.xsl"?> +
+# Prefix used to identify filenames that are relative to the current base
+#jmeter.save.saveservice.base_prefix=~/
</pre>
</code></p>
<p>
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic