public class StandardGenerator extends java.lang.Object implements Generator, java.io.Serializable
This version is a completely new class with a totally different implementation, since generating the XML is no longer handled by the generator. The generator is only responsible for handling the parsed results and passing it to the appropriate JMeter class.
Notes:
the class needs to first create a thread group and add it to the HashTree.
Then the samplers should be added to the thread group. Listeners shouldn't be
added and should be left up to the user. One option is to provide parameters,
so the user can pass the desired listener to the tool.
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
FILE |
protected java.lang.String |
FILENAME |
protected java.io.OutputStream |
OUTPUT |
protected HTTPSamplerBase |
SAMPLE |
Constructor and Description |
---|
StandardGenerator()
The constructor is used by GUI and samplers to generate request objects.
|
StandardGenerator(java.lang.String file) |
Modifier and Type | Method and Description |
---|---|
void |
close()
close the generator
|
java.lang.Object |
generateRequest()
The method is responsible for calling the necessary methods to generate a
valid request.
|
protected void |
initStream()
Create the OutputStream to save the JMX file.
|
void |
reset()
Reset the HTTPSampler to make sure it is a new instance.
|
void |
save()
save must be called to write the jmx file, otherwise it will not be
saved.
|
void |
setHost(java.lang.String host)
The host is the name of the server.
|
void |
setLabel(java.lang.String label)
This is the label for the request, which is used in the logs and results.
|
void |
setMethod(java.lang.String post_get)
The method is the HTTP request method.
|
void |
setParams(NVPair[] params)
Set the request parameters
|
void |
setPath(java.lang.String path)
The path is the web page you want to test.
|
void |
setPort(int port)
The default port for HTTP is 80, but not all servers run on that port.
|
void |
setQueryString(java.lang.String querystring)
Set the querystring for the request if the method is GET.
|
void |
setSourceLogs(java.lang.String sourcefile)
The source logs is the location where the access log resides.
|
void |
setTarget(java.lang.Object target)
The target can be either a java.io.File or a Sampler.
|
protected HTTPSamplerBase SAMPLE
protected transient java.io.OutputStream OUTPUT
protected java.lang.String FILENAME
protected java.io.File FILE
public StandardGenerator()
public StandardGenerator(java.lang.String file)
file
- name of a file (TODO seems not to be used anywhere)protected void initStream()
public void setHost(java.lang.String host)
public void setLabel(java.lang.String label)
public void setMethod(java.lang.String post_get)
public void setParams(NVPair[] params)
public void setPath(java.lang.String path)
public void setPort(int port)
public void setQueryString(java.lang.String querystring)
setQueryString
in interface Generator
querystring
- query string of the requestpublic void setSourceLogs(java.lang.String sourcefile)
setSourceLogs
in interface Generator
sourcefile
- path to the access log filepublic void setTarget(java.lang.Object target)
public java.lang.Object generateRequest()
generateRequest
in interface Generator
public void save()
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.