001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: package org.apache.jmeter.protocol.http.util.accesslog;
020:
021: import org.apache.jmeter.testelement.TestElement;
022:
023: /**
024: * Description:<br>
025: * <br>
026: * Filter interface is designed to make it easier to use Access Logs for JMeter
027: * test plans. Normally, a person would have to clean a log file manually and
028: * create the JMeter requests. The access log parse utility uses the filter to
029: * include/exclude files by either file name or regular expression pattern.
030: * <p>
031: * It will also be used by HttpSamplers that use access logs. Using access logs
032: * is intended as a way to simulate production traffic. For functional testing,
033: * it is better to use the standard functional testing tools in JMeter. Using
034: * access logs can also reduce the amount of memory needed to run large test
035: * plans. <br>
036: *
037: * @author Peter Lin<br>
038: * @version $Revision: 493789 $ last updated $Date: 2007-01-07 18:10:21 +0000 (Sun, 07 Jan 2007) $ Created
039: * on: Jun 26, 2003<br>
040: */
041:
042: public interface Filter {
043:
044: /**
045: * @param oldextension
046: * @param newextension
047: */
048: public void setReplaceExtension(String oldextension,
049: String newextension);
050:
051: /**
052: * Include all files in the array.
053: *
054: * @param filenames
055: */
056: public void includeFiles(String[] filenames);
057:
058: /**
059: * Exclude all files in the array
060: *
061: * @param filenames
062: */
063: public void excludeFiles(String[] filenames);
064:
065: /**
066: * Include any log entry that contains the following regular expression
067: * pattern.
068: *
069: * @param regexp
070: */
071: public void includePattern(String[] regexp);
072:
073: /**
074: * Exclude any log entry that contains the following regular expression
075: * pattern.
076: *
077: * @param regexp
078: */
079: public void excludePattern(String[] regexp);
080:
081: /**
082: * Log parser will call this method to see if a particular entry should be
083: * filtered or not.
084: *
085: * @param path
086: * @return boolean
087: */
088: public boolean isFiltered(String path, TestElement sampler);
089:
090: /**
091: * In case the user wants to replace the file extension, log parsers should
092: * call this method. This is useful for regression test plans. If a website
093: * is migrating from one platform to another and the file extension changes,
094: * the filter provides an easy way to do it without spending a lot of time.
095: *
096: * @param text
097: * @return String
098: */
099: public String filter(String text);
100:
101: /**
102: * Tell the filter when the parsing has reached the end of the log file and
103: * is about to begin again. Gives the filter a chance to adjust it's values,
104: * if needed.
105: *
106: */
107: public void reset();
108:
109: }
|