View Javadoc

1   /*
2    * Copyright 1999-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.commons.latka.event;
18  
19  /**
20   * Event listener used during the execution of Latka tests.
21   * 
22   * @author Rodney Waldhoff
23   * @author Morgan Delagrange
24   * @author dIon Gillard
25   * @version 
26   * $Id: LatkaEventListener.java 155424 2005-02-26 13:09:29Z dirkv $
27   */
28  public interface LatkaEventListener {
29  
30     /**
31      * Invoked if the request succeeds
32      * 
33      * @param event  a successful request event
34      */
35     void requestSucceeded(RequestEvent event);
36     
37     /**
38      * Invoked if the request failed.  A request "failure" is
39      * defined as a request that successfully received a
40      * reponse from the server, but that response failed
41      * validation (threw a ValidationException).
42      * 
43      * @param event  a "failed" request event.  This request should still
44      *       have a response, although the response was not expected by the test.
45      */
46     void requestFailed(RequestEvent event);
47     
48     /**
49      * A skipped request.  Most Latka suites will skip 
50      * any further requests inside a session 
51      * upon the first failed request.
52      * 
53      * @param event  a "skipped" request. Skipped requests have no valid 
54      *       response.
55      */
56     void requestSkipped(RequestEvent event);
57     
58     /**
59      * Invoked if a request error occurs.  A request "error"
60      * designates an inability to communicate with the
61      * target HTTP server (typically an IOException or a 
62      * related exception).
63      * 
64      * @param event  a request "error" event.  This request has no valid
65      *               response.
66      */
67     void requestError(RequestEvent event);
68  
69     /**
70      * Invoked if a Latka suite wants to send a message to the 
71      * report generated for the test.  Some implementations
72      * of the LatkaEventListener may not generate reports.
73      * 
74      * @param event  Event containing the report message
75      */
76     void reportMessage(ReportMessageEvent event);
77  
78     /**
79      * Invoke when all requests completed.
80      *
81      * @param event suite event
82      */
83     void suiteCompleted(SuiteEvent event);
84  
85  }