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: /**
022: * Description:<br>
023: * <br>
024: * Generator is a base interface that defines the minimum methods needed to
025: * implement a concrete generator. The reason for creating this interface is
026: * eventually JMeter could use the logs directly rather than pre- process the
027: * logs into a JMeter .jmx file. In situations where a test plan simulates load
028: * from production logs, it is more efficient for JMeter to use the logs
029: * directly.
030: * <p>
031: * From first hand experience, loading a test plan with 10K or more Requests
032: * requires a lot of memory. It's important to keep in mind this type of testing
033: * is closer to functional and regression testing than the typical stress tests.
034: * Typically, this kind of testing is most useful for search sites that get a
035: * large number of requests per day, but the request parameters vary
036: * dramatically. E-commerce sites typically have limited inventory, therefore it
037: * is better to design test plans that use data from the database.
038: * <p>
039: *
040: * @author Peter Lin
041: * @version $Revision: 493789 $ last updated on $Date: 2007-01-07 18:10:21 +0000 (Sun, 07 Jan 2007) $
042: * Created on: Jun 23, 2003<br>
043: */
044:
045: public interface Generator {
046:
047: /**
048: * close the generator
049: */
050: public void close();
051:
052: /**
053: * The host is the name of the server.
054: *
055: * @param host
056: */
057: public void setHost(String host);
058:
059: /**
060: * This is the label for the request, which is used in the logs and results.
061: *
062: * @param label
063: */
064: public void setLabel(String label);
065:
066: /**
067: * The method is the HTTP request method. It's normally POST or GET.
068: *
069: * @param post_get
070: */
071: public void setMethod(String post_get);
072:
073: /**
074: * Set the request parameters
075: *
076: * @param params
077: */
078: public void setParams(NVPair[] params);
079:
080: /**
081: * The path is the web page you want to test.
082: *
083: * @param path
084: */
085: public void setPath(String path);
086:
087: /**
088: * The default port for HTTP is 80, but not all servers run on that port.
089: *
090: * @param port -
091: * port number
092: */
093: public void setPort(int port);
094:
095: /**
096: * Set the querystring for the request if the method is GET.
097: *
098: * @param querystring
099: */
100: public void setQueryString(String querystring);
101:
102: /**
103: * The source logs is the location where the access log resides.
104: *
105: * @param sourcefile
106: */
107: public void setSourceLogs(String sourcefile);
108:
109: /**
110: * The target can be either a java.io.File or a Sampler. We make it generic,
111: * so that later on we can use these classes directly from a HTTPSampler.
112: *
113: * @param target
114: */
115: public void setTarget(Object target);
116:
117: /**
118: * The method is responsible for calling the necessary methods to generate a
119: * valid request. If the generator is used to pre-process access logs, the
120: * method wouldn't return anything. If the generator is used by a control
121: * element, it should return the correct Sampler class with the required
122: * fields set.
123: */
124: public Object generateRequest();
125:
126: /**
127: * If the generator is converting the logs to a .jmx file, save should be
128: * called.
129: */
130: public void save();
131:
132: /**
133: * The purpose of the reset is so Samplers can explicitly call reset to
134: * create a new instance of HTTPSampler.
135: *
136: */
137: public void reset();
138: }
|