You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/10/09 17:22:40 UTC

svn commit: r703180 - in /jakarta/jmeter/trunk: docs/images/screenshots/ src/core/org/apache/jmeter/reporters/ src/core/org/apache/jmeter/reporters/gui/ src/core/org/apache/jmeter/resources/ xdocs/ xdocs/images/screenshots/ xdocs/usermanual/

Author: sebb
Date: Thu Oct  9 08:22:39 2008
New Revision: 703180

URL: http://svn.apache.org/viewvc?rev=703180&view=rev
Log:
Bug 43119 - Save Responses to file: optionally omit the file number

Modified:
    jakarta/jmeter/trunk/docs/images/screenshots/savetofile.png
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultSaver.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/gui/ResultSaverGui.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/images/screenshots/savetofile.png
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/docs/images/screenshots/savetofile.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/savetofile.png?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
Binary files - no diff available.

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=703180&r1=703179&r2=703180&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  9 08:22:39 2008
@@ -58,6 +58,8 @@
 
     public static final String SUCCESS_ONLY = "FileSaver.successonly"; // $NON-NLS-1$
 
+    public static final String SKIP_AUTO_NUMBER = "FileSaver.skipautonumber"; // $NON-NLS-1$
+
     private synchronized long nextNumber() {
         return ++sequenceNumber;
     }
@@ -142,7 +144,7 @@
             }
         }
 
-        String fileName = makeFileName(s.getContentType());
+        String fileName = makeFileName(s.getContentType(), getSkipAutoNumber());
         log.debug("Saving " + s.getSampleLabel() + " in " + fileName);
         s.setResultFileName(fileName);// Associate sample with file name
         String variable = getVariableName();
@@ -173,12 +175,12 @@
      *         from the contentType e.g. Content-Type:
      *         text/html;charset=ISO-8859-1
      */
-    private String makeFileName(String contentType) {
+    private String makeFileName(String contentType, boolean skipAutoNumber) {
         String suffix = "unknown";
         if (contentType != null) {
-            int i = contentType.indexOf("/");
+            int i = contentType.indexOf("/"); // $NON-NLS-1$
             if (i != -1) {
-                int j = contentType.indexOf(";");
+                int j = contentType.indexOf(";"); // $NON-NLS-1$
                 if (j != -1) {
                     suffix = contentType.substring(i + 1, j);
                 } else {
@@ -186,7 +188,12 @@
                 }
             }
         }
-        return getFilename() + nextNumber() + "." + suffix;
+        if (skipAutoNumber) {
+            return getFilename() + "." + suffix; // $NON-NLS-1$
+        }
+        else {
+            return getFilename() + nextNumber() + "." + suffix; // $NON-NLS-1$
+        }
     }
 
     /*
@@ -219,6 +226,10 @@
         return getPropertyAsBoolean(ERRORS_ONLY);
     }
 
+    private boolean getSkipAutoNumber() {
+        return getPropertyAsBoolean(SKIP_AUTO_NUMBER);
+    }
+
     private boolean getSuccessOnly() {
         return getPropertyAsBoolean(SUCCESS_ONLY);
     }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/gui/ResultSaverGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/gui/ResultSaverGui.java?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/gui/ResultSaverGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/gui/ResultSaverGui.java Thu Oct  9 08:22:39 2008
@@ -48,6 +48,8 @@
 
     private JCheckBox successOnly;
 
+    private JCheckBox skipAutoNumber;
+
     public ResultSaverGui() {
         super();
         init();
@@ -68,6 +70,7 @@
         filename.setText(el.getPropertyAsString(ResultSaver.FILENAME));
         errorsOnly.setSelected(el.getPropertyAsBoolean(ResultSaver.ERRORS_ONLY));
         successOnly.setSelected(el.getPropertyAsBoolean(ResultSaver.SUCCESS_ONLY));
+        skipAutoNumber.setSelected(el.getPropertyAsBoolean(ResultSaver.SKIP_AUTO_NUMBER));
         variableName.setText(el.getPropertyAsString(ResultSaver.VARIABLE_NAME,""));
     }
 
@@ -89,6 +92,7 @@
         super.configureTestElement(te);
         te.setProperty(ResultSaver.FILENAME, filename.getText());
         te.setProperty(ResultSaver.ERRORS_ONLY, errorsOnly.isSelected());
+        te.setProperty(ResultSaver.SKIP_AUTO_NUMBER, skipAutoNumber.isSelected());
         te.setProperty(ResultSaver.SUCCESS_ONLY, successOnly.isSelected());
         AbstractTestElement at = (AbstractTestElement) te;
         at.setProperty(ResultSaver.VARIABLE_NAME, variableName.getText(),""); //$NON-NLS-1$
@@ -100,6 +104,7 @@
     public void clearGui() {
         super.clearGui();
 
+        skipAutoNumber.setSelected(false);
         filename.setText(""); //$NON-NLS-1$
         errorsOnly.setSelected(false);
         successOnly.setSelected(false);
@@ -117,6 +122,8 @@
         box.add(errorsOnly);
         successOnly = new JCheckBox(JMeterUtils.getResString("resultsaver_success")); // $NON-NLS-1$
         box.add(successOnly);
+        skipAutoNumber = new JCheckBox(JMeterUtils.getResString("resultsaver_skipautonumber")); // $NON-NLS-1$
+        box.add(skipAutoNumber);
         add(box, BorderLayout.NORTH);
     }
 

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Thu Oct  9 08:22:39 2008
@@ -644,6 +644,7 @@
 resultsaver_errors=Save Failed Responses only
 resultsaver_prefix=Filename prefix\:
 resultsaver_success=Save Successful Responses only
+resultsaver_skipautonumber=Don\'t add number to prefix
 resultsaver_title=Save Responses to a file
 resultsaver_variable=Variable Name:
 retobj=Return object

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Oct  9 08:22:39 2008
@@ -132,6 +132,7 @@
 <li>Bug 45929 - improved French translations</li>
 <li>Bug 45571 - JMS Sampler correlation enhancement</li>
 <li>Bug 45479 - Support for multiple HTTP Header Manager nodes</li>
+<li>Bug 43119 - Save Responses to file: optionally omit the file number</li>
 </ul>
 
 <h3>Non-functional changes</h3>

Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/savetofile.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/savetofile.png?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=703180&r1=703179&r2=703180&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Oct  9 08:22:39 2008
@@ -2171,7 +2171,7 @@
 </div>
 </component>
 
-<component name="Save Responses to a file" index="&sect-num;.3.16"  width="361" height="178" screenshot="savetofile.png">
+<component name="Save Responses to a file" index="&sect-num;.3.16"  width="359" height="202" screenshot="savetofile.png">
     <description>
         <p>
         This test element can be placed anywhere in the test plan.
@@ -2179,7 +2179,7 @@
         The primary use for this is in creating functional tests, but it can also
         be useful where the response is too large to be displayed in the 
         <complink name="View Results Tree"/> Listener.
-        The file name is created from the specified prefix, plus a number.
+        The file name is created from the specified prefix, plus a number (unless this is disabled, see below).
         The file extension is created from the document type, if known.
         If not known, the file extension is set to 'unknown'.
         The generated file name is stored in the sample response, and can be saved
@@ -2187,6 +2187,8 @@
         </p>
         <p>
         The current sample is saved first, followed by any sub-samples (child samples).
+        If a variable name is provided, then the names of the files are saved in the order
+        that the sub-samples appear. See below. 
         </p>
     </description>
  <properties>
@@ -2200,6 +2202,7 @@
  </property>
  <property name="Save Failed Responses only" required="Yes">If selected, then only failed responses are saved</property>
  <property name="Save Successful Responses only" required="Yes">If selected, then only successful responses are saved</property>
+ <property name="Don't add number to prefix" required="Yes">If selected, then no number is added to the prefix. If you select this option, make sure that the prefix is unique or the file may be overwritten.</property>
  </properties>
 </component>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org