org.apache.jmeter.protocol.http.util.accesslog

Class StandardGenerator

Implemented Interfaces:
Generator, Serializable

public class StandardGenerator
extends Object
implements Generator, Serializable

Description:

StandardGenerator will be the default generator used to pre-process logs. It uses JMeter classes to generate the .jmx file. The first version of the utility only generated the HTTP requests as XML, but it required users to copy and paste it into a blank jmx file. Doing that way isn't flexible and would require changes to keep the format in sync.

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.

Field Summary

protected File
FILE
protected String
FILENAME
protected OutputStream
OUTPUT
protected HTTPSamplerBase
SAMPLE
protected FileWriter
WRITER

Constructor Summary

StandardGenerator()
The constructor is used by GUI and samplers to generate request objects.
StandardGenerator(String file)

Method Summary

void
close()
Object
generateRequest()
protected void
initStream()
Create the FileWriter 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(String host)
void
setLabel(String label)
void
setMethod(String post_get)
void
setParams(NVPair[] params)
void
setPath(String path)
void
setPort(int port)
void
setQueryString(String querystring)
void
setSourceLogs(String sourcefile)
void
setTarget(Object target)

Field Details

FILE

protected File FILE

FILENAME

protected String FILENAME

OUTPUT

protected OutputStream OUTPUT

SAMPLE

protected HTTPSamplerBase SAMPLE

WRITER

protected FileWriter WRITER

Constructor Details

StandardGenerator

public StandardGenerator()
The constructor is used by GUI and samplers to generate request objects.

StandardGenerator

public StandardGenerator(String file)
Parameters:
file -

Method Details

close

public void close()
Specified by:
close in interface Generator

generateRequest

public Object generateRequest()
Specified by:
generateRequest in interface Generator

initStream

protected void initStream()
Create the FileWriter to save the JMX file.

reset

public void reset()
Reset the HTTPSampler to make sure it is a new instance.
Specified by:
reset in interface Generator

save

public void save()
save must be called to write the jmx file, otherwise it will not be saved.
Specified by:
save in interface Generator

setHost

public void setHost(String host)
Specified by:
setHost in interface Generator

setLabel

public void setLabel(String label)
Specified by:
setLabel in interface Generator

setMethod

public void setMethod(String post_get)
Specified by:
setMethod in interface Generator

setParams

public void setParams(NVPair[] params)
Specified by:
setParams in interface Generator

setPath

public void setPath(String path)
Specified by:
setPath in interface Generator

setPort

public void setPort(int port)
Specified by:
setPort in interface Generator

setQueryString

public void setQueryString(String querystring)
Specified by:
setQueryString in interface Generator

setSourceLogs

public void setSourceLogs(String sourcefile)
Specified by:
setSourceLogs in interface Generator

setTarget

public void setTarget(Object target)
Specified by:
setTarget in interface Generator

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.