jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1647188 - in /jmeter/trunk/src/core/org/apache/jmeter: samplers/SampleEvent.java samplers/SampleResult.java save/CSVSaveService.java
Date Sun, 21 Dec 2014 18:58:48 GMT
Author: fschumacher
Date: Sun Dec 21 18:58:47 2014
New Revision: 1647188

URL: http://svn.apache.org/r1647188
Log:
Bug 57193: Add param and return tags to javadoc
Bugzilla Id: 57193

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
    jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java?rev=1647188&r1=1647187&r2=1647188&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java Sun Dec 21 18:58:47
2014
@@ -21,6 +21,7 @@ package org.apache.jmeter.samplers;
 import java.io.Serializable;
 import java.util.Arrays;
 
+import org.apache.jmeter.protocol.http.proxy.ProxyControl;
 import org.apache.jmeter.threads.JMeterVariables;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
@@ -71,8 +72,9 @@ public class SampleEvent implements Seri
 
     private final boolean isTransactionSampleEvent;
 
-    /*
-     * Only for Unit tests
+    /**
+     * Constructor used for Unit tests only. Uses <code>null</code> for the
+     * associated {@link SampleResult} and the <code>threadGroup</code>-name.
      */
     public SampleEvent() {
         this(null, null);
@@ -80,22 +82,29 @@ public class SampleEvent implements Seri
 
     /**
      * Creates SampleEvent without saving any variables.
+     * <p>
+     * Use by {@link ProxyControl} and {@link StatisticalSampleSender}.
      *
-     * Use by Proxy and StatisticalSampleSender.
-     *
-     * @param result SampleResult
-     * @param threadGroup name
+     * @param result
+     *            The SampleResult to be associated with this event
+     * @param threadGroup
+     *            The name of the thread, the {@link SampleResult} was recorded
      */
     public SampleEvent(SampleResult result, String threadGroup) {
         this(result, threadGroup, HOSTNAME, false);
     }
 
     /**
-     * Contructor used for normal samples, saves variable values if any are defined.
+     * Constructor used for normal samples, saves variable values if any are
+     * defined.
      *
      * @param result
-     * @param threadGroup name
-     * @param jmvars Jmeter variables
+     *            The SampleResult to be associated with this event
+     * @param threadGroup
+     *            The name of the thread, the {@link SampleResult} was recorded
+     * @param jmvars
+     *            the {@link JMeterVariables} of the thread, the
+     *            {@link SampleResult} was recorded
      */
     public SampleEvent(SampleResult result, String threadGroup, JMeterVariables jmvars) {
         this(result, threadGroup, jmvars, false);
@@ -105,8 +114,12 @@ public class SampleEvent implements Seri
      * Only intended for use when loading results from a file.
      *
      * @param result
+     *            The SampleResult to be associated with this event
      * @param threadGroup
+     *            The name of the thread, the {@link SampleResult} was recorded
      * @param hostname
+     *            The name of the host, for which the {@link SampleResult} was
+     *            recorded
      */
     public SampleEvent(SampleResult result, String threadGroup, String hostname) {
        this(result, threadGroup, hostname, false);
@@ -122,9 +135,14 @@ public class SampleEvent implements Seri
 
     /**
      * @param result
+     *            The SampleResult to be associated with this event
      * @param threadGroup
+     *            The name of the thread, the {@link SampleResult} was recorded
      * @param jmvars
+     *            the {@link JMeterVariables} of the thread, the
+     *            {@link SampleResult} was recorded
      * @param isTransactionSampleEvent
+     *            Flag whether this event is an transaction sample event
      */
     public SampleEvent(SampleResult result, String threadGroup, JMeterVariables jmvars, boolean
isTransactionSampleEvent) {
         this(result, threadGroup, HOSTNAME, isTransactionSampleEvent);
@@ -137,17 +155,35 @@ public class SampleEvent implements Seri
         }
     }
 
-    /** Return the number of variables defined */
+    /**
+     * Get the number of defined variables
+     * 
+     * @return the number of variables defined
+     */
     public static int getVarCount(){
         return variableNames.length;
     }
 
-    /** Get the nth variable name (zero-based) */
+    /**
+     * Get the nth variable name (zero-based)
+     * 
+     * @param i
+     *            specifies which variable name should be returned (zero-based)
+     * @return the variable name of the nth variable
+     */
     public static String getVarName(int i){
         return variableNames[i];
     }
 
-    /** Get the nth variable value (zero-based) */
+    /**
+     * Get the nth variable value (zero-based)
+     * 
+     * @param i
+     *            specifies which variable value should be returned (zero-based)
+     * @return the value of the nth variable
+     * @throws JMeterError
+     *             when an invalid index <code>i</code> was given
+     */
     public String getVarValue(int i){
         try {
             return values[i];
@@ -156,14 +192,29 @@ public class SampleEvent implements Seri
         }
     }
 
+    /**
+     * Get the {@link SampleResult} associated with this event
+     * 
+     * @return the associated {@link SampleResult}
+     */
     public SampleResult getResult() {
         return result;
     }
 
+    /**
+     * Get the name of the thread group for which this event was recorded
+     * 
+     * @return the name of the thread group
+     */
     public String getThreadGroup() {
         return threadGroup;
     }
 
+    /**
+     * Get the name of the host for which this event was recorded
+     * 
+     * @return the name of the host
+     */
     public String getHostname() {
         return hostname;
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1647188&r1=1647187&r2=1647188&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Sun Dec 21 18:58:47
2014
@@ -88,7 +88,7 @@ public class SampleResult implements Ser
      */
     public static final String BINARY = "bin"; // $NON-NLS-1$
 
-    /* empty arrays which can be returned instead of null */
+    /** empty array which can be returned instead of null */
     public static final byte[] EMPTY_BA = new byte[0];
 
     private static final SampleResult[] EMPTY_SR = new SampleResult[0];
@@ -358,9 +358,10 @@ public class SampleResult implements Ser
      * (used by StatVisualizerModel.Test)
      *
      * @param start
-     *            start time
+     *            start time in milliseconds since unix epoch
      * @param end
-     *            end time
+     *            end time in milliseconds since unix epoch
+     * @return sample with given start and end time
      */
     public static SampleResult createTestSample(long start, long end) {
         SampleResult res = new SampleResult();
@@ -373,8 +374,9 @@ public class SampleResult implements Ser
      * Create a sample with a specific elapsed time for test purposes, but don't
      * allow the times to be changed later
      *
-     * @param elapsed -
-     *            desired elapsed time
+     * @param elapsed
+     *            - desired elapsed time in milliseconds
+     * @return sample that starts 'now' and ends <code>elapsed</code> milliseconds
later
      */
     public static SampleResult createTestSample(long elapsed) {
         long now = System.currentTimeMillis();
@@ -385,11 +387,14 @@ public class SampleResult implements Ser
      * Allow users to create a sample with specific timestamp and elapsed times
      * for cloning purposes, but don't allow the times to be changed later
      *
-     * Currently used by OldSaveService, CSVSaveService and StatisticalSampleResult
+     * Currently used by OldSaveService, CSVSaveService and
+     * StatisticalSampleResult
      *
-     * @param stamp -
-     *            this may be a start time or an end time
+     * @param stamp
+     *            this may be a start time or an end time (both in
+     *            milliseconds)
      * @param elapsed
+     *            time in milliseconds
      */
     public SampleResult(long stamp, long elapsed) {
         this();
@@ -400,7 +405,14 @@ public class SampleResult implements Ser
         return System.nanoTime() / 1000000;
     }
 
-    // Helper method to get 1 ms resolution timing.
+    /**
+     * Helper method to get 1 ms resolution timing.
+     * 
+     * @return the current time in milliseconds
+     * @throws RuntimeException
+     *             when <code>useNanoTime</code> is <code>true</code>
but
+     *             <code>nanoTimeOffset</code> is not set
+     */
     public long currentTimeInMillis() {
         if (useNanoTime){
             if (nanoTimeOffset == Long.MIN_VALUE){
@@ -424,12 +436,16 @@ public class SampleResult implements Ser
         elapsedTime = elapsed;
     }
 
-    /*
+    /**
      * For use by SaveService only.
-     *
-     * @param stamp -
-     *            this may be a start time or an end time
+     * 
+     * @param stamp
+     *            this may be a start time or an end time (both in milliseconds)
      * @param elapsed
+     *            time in milliseconds
+     * @throws RuntimeException
+     *             when <code>startTime</code> or <code>endTime</code>
has been
+     *             set already
      */
     public void setStampAndTime(long stamp, long elapsed) {
         if (startTime != 0 || endTime != 0){
@@ -441,8 +457,8 @@ public class SampleResult implements Ser
     /**
      * Set the "marked" flag to show that the result has been written to the file.
      *
-     * @param filename
-     * @return true if the result was previously marked
+     * @param filename the name of the file
+     * @return <code>true</code> if the result was previously marked
      */
     public synchronized boolean markFile(String filename) {
         return !files.add(filename);
@@ -562,6 +578,7 @@ public class SampleResult implements Ser
      * Add a subresult and adjust the parent byte count and end-time.
      * 
      * @param subResult
+     *            the {@link SampleResult} to be added
      */
     public void addSubResult(SampleResult subResult) {
         if(subResult == null) {
@@ -588,6 +605,7 @@ public class SampleResult implements Ser
      * Add a subresult to the collection without updating any parent fields.
      * 
      * @param subResult
+     *            the {@link SampleResult} to be added
      */
     public void addRawSubResult(SampleResult subResult){
         storeSubResult(subResult);
@@ -595,10 +613,13 @@ public class SampleResult implements Ser
 
     /**
      * Add a subresult read from a results file.
-     *
-     * As for addSubResult(), except that the fields don't need to be accumulated
+     * <p>
+     * As for {@link SampleResult#addSubResult(SampleResult)
+     * addSubResult(SampleResult)}, except that the fields don't need to be
+     * accumulated
      *
      * @param subResult
+     *            the {@link SampleResult} to be added
      */
     public void storeSubResult(SampleResult subResult) {
         if (subResults == null) {
@@ -944,10 +965,10 @@ public class SampleResult implements Ser
     }
 
     /**
-     * Stores the content-type string, e.g. "text/xml; charset=utf-8"
+     * Stores the content-type string, e.g. <code>text/xml; charset=utf-8</code>
      * @see #setEncodingAndType(String) which can be used to extract the charset.
      *
-     * @param string
+     * @param string the content-type to be set
      */
     public void setContentType(String string) {
         contentType = string;
@@ -1065,6 +1086,7 @@ public class SampleResult implements Ser
      * When a Sampler is working as a monitor
      *
      * @param monitor
+     *            flag whether this sampler is working as a monitor
      */
     public void setMonitor(boolean monitor) {
         isMonitor = monitor;
@@ -1132,10 +1154,11 @@ public class SampleResult implements Ser
      */
     /**
      * In the event the sampler does want to pass back the actual contents, we
-     * still want to calculate the throughput. The bytes is the bytes of the
+     * still want to calculate the throughput. The bytes are the bytes of the
      * response data.
      *
      * @param length
+     *            the number of bytes of the response data for this sample
      */
     public void setBytes(int length) {
         bytes = length;
@@ -1270,6 +1293,7 @@ public class SampleResult implements Ser
      * Set the headers size in bytes
      * 
      * @param size
+     *            the number of bytes of the header
      */
     public void setHeadersSize(int size) {
         this.headersSize = size;

Modified: jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java?rev=1647188&r1=1647187&r2=1647188&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java Sun Dec 21 18:58:47 2014
@@ -127,6 +127,8 @@ public final class CSVSaveService {
      * @param resultCollector
      *            the parent collector
      * @throws IOException
+     *             when the file referenced by <code>filename</code> can't be
+     *             read correctly
      */
     public static void processSamples(String filename, Visualizer visualizer,
             ResultCollector resultCollector) throws IOException {
@@ -383,6 +385,8 @@ public final class CSVSaveService {
     /**
      * Generates the field names for the output file
      * 
+     * @param saveConfig
+     *            the configuration of what is to be saved
      * @return the field names as a string
      */
     public static String printableFieldNamesToString(
@@ -654,6 +658,7 @@ public final class CSVSaveService {
      * @param writer
      *            output file
      * @throws IOException
+     *             when writing to <code>writer</code> fails
      */
     public static void saveCSVStats(List<?> data, FileWriter writer)
             throws IOException {
@@ -673,6 +678,7 @@ public final class CSVSaveService {
      * @param headers
      *            header names (if non-null)
      * @throws IOException
+     *             when writing to <code>writer</code> fails
      */
     public static void saveCSVStats(List<?> data, FileWriter writer,
             String headers[]) throws IOException {
@@ -710,6 +716,7 @@ public final class CSVSaveService {
      * @param writer
      *            output file
      * @throws IOException
+     *             when writing to <code>writer</code> fails
      */
     public static void saveCSVStats(DefaultTableModel model, FileWriter writer)
             throws IOException {
@@ -718,8 +725,8 @@ public final class CSVSaveService {
 
     /**
      * Method saves aggregate statistics as CSV from a table model. Same as
-     * {@link #saveCSVStats(List, FileWriter, String[])} except that there is
-     * no need to create a List containing the data.
+     * {@link #saveCSVStats(List, FileWriter, String[])} except that there is no
+     * need to create a List containing the data.
      * 
      * @param model
      *            table model containing the data
@@ -728,6 +735,7 @@ public final class CSVSaveService {
      * @param saveHeaders
      *            whether or not to save headers
      * @throws IOException
+     *             when writing to <code>writer</code> fails
      */
     public static void saveCSVStats(DefaultTableModel model, FileWriter writer,
             boolean saveHeaders) throws IOException {



Mime
View raw message