KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > http > util > accesslog > Generator


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/Generator.java,v 1.4 2004/02/12 00:29:48 sebb Exp $
2
/*
3  * Copyright 2003-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.protocol.http.util.accesslog;
20
21
22 /**
23  * Description:<br>
24  * <br>
25  * Generator is a base interface that defines
26  * the minimum methods needed to implement a
27  * concrete generator. The reason for creating
28  * this interface is eventually JMeter could
29  * use the logs directly rather than pre-
30  * process the logs into a JMeter .jmx file.
31  * In situations where a test plan simulates
32  * load from production logs, it is more
33  * efficient for JMeter to use the logs
34  * directly.<p>
35  * From first hand experience, loading a test
36  * plan with 10K or more Requests requires a
37  * lot of memory. It's important to keep in
38  * mind this type of testing is closer to
39  * functional and regression testing than the
40  * typical stress tests. Typically, this kind
41  * of testing is most useful for search sites
42  * that get a large number of requests per
43  * day, but the request parameters vary
44  * dramatically. E-commerce sites typically
45  * have limited inventory, therefore it is
46  * better to design test plans that use data
47  * from the database.
48  * <p>
49  * @author Peter Lin
50  * @version $Revision: 1.4 $ last updated on $Date: 2004/02/12 00:29:48 $
51  * Created on: Jun 23, 2003<br>
52  */

53
54 public interface Generator {
55
56     /**
57      * close the generator
58      */

59     public void close();
60
61     /**
62      * The host is the name of the server.
63      * @param host
64      */

65     public void setHost(String JavaDoc host);
66
67     /**
68      * This is the label for the request,
69      * which is used in the logs and
70      * results.
71      * @param label
72      */

73     public void setLabel(String JavaDoc label);
74
75     /**
76      * The method is the HTTP request
77      * method. It's normally POST or GET.
78      * @param post_get
79      */

80     public void setMethod(String JavaDoc post_get);
81
82     /**
83      * Set the request parameters
84      * @param params
85      */

86     public void setParams(NVPair[] params);
87
88     /**
89      * The path is the web page you want
90      * to test.
91      * @param path
92      */

93     public void setPath(String JavaDoc path);
94
95     /**
96      * The default port for HTTP is 80,
97      * but not all servers run on that
98      * port.
99      * @param port - port number
100      */

101     public void setPort(int port);
102
103     /**
104      * Set the querystring for the request
105      * if the method is GET.
106      * @param querystring
107      */

108     public void setQueryString(String JavaDoc querystring);
109
110     /**
111      * The source logs is the location
112      * where the access log resides.
113      * @param sourcefile
114      */

115     public void setSourceLogs(String JavaDoc sourcefile);
116
117     /**
118      * The target can be either a java.io.File
119      * or a Sampler. We make it generic, so
120      * that later on we can use these classes
121      * directly from a HTTPSampler.
122      * @param target
123      */

124     public void setTarget(Object JavaDoc target);
125
126     /**
127      * The method is responsible for calling
128      * the necessary methods to generate a
129      * valid request. If the generator is
130      * used to pre-process access logs, the
131      * method wouldn't return anything. If
132      * the generator is used by a control
133      * element, it should return the correct
134      * Sampler class with the required
135      * fields set.
136      */

137     public Object JavaDoc generateRequest();
138     
139     /**
140      * If the generator is converting the logs
141      * to a .jmx file, save should be called.
142      */

143     public void save();
144     
145     /**
146      * The purpose of the reset is so Samplers
147      * can explicitly call reset to create a
148      * new instance of HTTPSampler.
149      *
150      */

151     public void reset();
152 }
153
Popular Tags