You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by je...@apache.org on 2002/01/13 07:42:36 UTC

cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka AbstractReporter.java

jefft       02/01/12 22:42:36

  Modified:    latka/src/java/org/apache/commons/latka
                        AbstractReporter.java
  Log:
  Much-needed javadocs.
  Submitted by: Dion Gillard <dion at multitask.com.au>
  Reviewed by: Jeff Turner <je...@apache.org>
  
  Revision  Changes    Path
  1.9       +82 -5     jakarta-commons/latka/src/java/org/apache/commons/latka/AbstractReporter.java
  
  Index: AbstractReporter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/AbstractReporter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractReporter.java	7 Sep 2001 17:09:15 -0000	1.8
  +++ AbstractReporter.java	13 Jan 2002 06:42:36 -0000	1.9
  @@ -72,40 +72,94 @@
   import org.apache.log4j.Category;
   
   /**
  - * Needs docs.
  + * The base class for several 'reporters'.
  + *
  + * A reporter is a class that will store or record information about events that
  + * occur during Latka processing
    *
    * @author Rodney Waldhoff
    * @author Morgan Delagrange
    */
   public abstract class AbstractReporter implements LatkaEventInfo {
   
  +  /**
  +   * maps the request to it's success or failure as a Boolean
  +   */
     protected Map _requestSucceeded = new HashMap();
  +  /**
  +   * maps the session to it's success or failure as a Boolean
  +   */
     protected Map _sessionSucceeded = new HashMap();
   
  +  /**
  +   * Holds whether or not the entire suite has succeeded
  +   * This is set to false when <strong>any</strong> request fails.
  +   */
     protected boolean _suiteSucceeded = true;
   
  +  /**
  +   * Holds the failed responses received by this object.
  +   * @see #requestFailed(RequestEvent)
  +   */
     protected List _failedResponses = new LinkedList();
   
  +  /**
  +   * The log4J category used for processing log requests.
  +   */
     protected static final Category _log = 
  -    Category.getInstance(AbstractReporter.class);
  +  Category.getInstance(AbstractReporter.class);
   
  +  /**
  +   * Invoked if the request succeeds.
  +   * Records the success
  +   *
  +   * @param event  a successful request event
  +   */
     public void requestSucceeded(RequestEvent event) {
       recordSuccess(event, true);
     }
  -  
  +
  +  /**
  +   * Invoked if the request failed.
  +   * Records the failure and adds the request's response to the list of
  +   * failed responses
  +   *
  +   * @param event  a "failed" request event.
  +   */
     public void requestFailed(RequestEvent event) {
       recordSuccess(event, false);
       _failedResponses.add(event.getResponse());
     }
   
  +  /**
  +   * A skipped request.
  +   * Records the skip as a failure
  +   *
  +   * @param event  a "skipped" request.
  +   */
     public void requestSkipped(RequestEvent event) {
       recordSuccess(event, false);
     }
  -  
  +
  +  /**
  +   * Invoked if a request error occurs.
  +   * Records the error as a failure
  +   *
  +   * @param event  a request "error" event.
  +   */
     public void requestError(RequestEvent event) {
       recordSuccess(event, false);
     }
   
  +  /**
  +   * Record the "success status" of a request event.
  +   * On a failed request, the current suite, request and session are
  +   * marked as failed
  +   *
  +   * param event  a request event.
  +   * param bool   the success (<code>true</code>) or failure
  +   * (<code>false</code>) of the request.
  +   */
     protected void recordSuccess (RequestEvent event, boolean bool) {
       if (bool == false) {
         _suiteSucceeded = false;
  @@ -116,6 +170,13 @@
   
     }
   
  +  /**
  +   * Check to see if a particular Request succeeded or failed.
  +   *
  +   * @param request the request to check for success or
  +   * failure
  +   * @return true if request succeeded
  +   */
     public boolean didRequestSucceed(Request request) {
       Boolean bool = (Boolean) _requestSucceeded.get(request);
   
  @@ -127,6 +188,15 @@
   
     }
   
  +  /**
  +   * Check to see if a particular Session succeeded or failed.
  +   * Once a request inside a session fails, the session itself
  +   * is marked as a failure.
  +   *
  +   * @param session the session to check for success or
  +   * failure
  +   * @return true if all requests in the session succeeded
  +   */
     public boolean didSessionSucceed(Session session) {
       Boolean bool = (Boolean) _sessionSucceeded.get(session);
   
  @@ -137,12 +207,19 @@
       }
     }
   
  +  /**
  +   * Returns true if all Requests in the suite succeed.
  +   *
  +   * @return true if all Requests have succeeded
  +   */
     public boolean didSuiteSucceed() {
       return _suiteSucceeded;
     }
   
  +  /**
  +   * @return a list of all responses of failed requests
  +   */
     public List getFailedResponses() {
       return _failedResponses;
     }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>