001 /* 002 * Copyright 1999-2001,2004 The Apache Software Foundation. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.apache.commons.latka.event; 018 019 /** 020 * Event listener used during the execution of Latka tests. 021 * 022 * @author Rodney Waldhoff 023 * @author Morgan Delagrange 024 * @author dIon Gillard 025 * @version 026 * $Id: LatkaEventListener.java 155424 2005-02-26 13:09:29Z dirkv $ 027 */ 028 public interface LatkaEventListener { 029 030 /** 031 * Invoked if the request succeeds 032 * 033 * @param event a successful request event 034 */ 035 void requestSucceeded(RequestEvent event); 036 037 /** 038 * Invoked if the request failed. A request "failure" is 039 * defined as a request that successfully received a 040 * reponse from the server, but that response failed 041 * validation (threw a ValidationException). 042 * 043 * @param event a "failed" request event. This request should still 044 * have a response, although the response was not expected by the test. 045 */ 046 void requestFailed(RequestEvent event); 047 048 /** 049 * A skipped request. Most Latka suites will skip 050 * any further requests inside a session 051 * upon the first failed request. 052 * 053 * @param event a "skipped" request. Skipped requests have no valid 054 * response. 055 */ 056 void requestSkipped(RequestEvent event); 057 058 /** 059 * Invoked if a request error occurs. A request "error" 060 * designates an inability to communicate with the 061 * target HTTP server (typically an IOException or a 062 * related exception). 063 * 064 * @param event a request "error" event. This request has no valid 065 * response. 066 */ 067 void requestError(RequestEvent event); 068 069 /** 070 * Invoked if a Latka suite wants to send a message to the 071 * report generated for the test. Some implementations 072 * of the LatkaEventListener may not generate reports. 073 * 074 * @param event Event containing the report message 075 */ 076 void reportMessage(ReportMessageEvent event); 077 078 /** 079 * Invoke when all requests completed. 080 * 081 * @param event suite event 082 */ 083 void suiteCompleted(SuiteEvent event); 084 085 }