Package com.lazerycode.jmeter.mojo
Class AbstractJMeterMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.lazerycode.jmeter.mojo.AbstractJMeterMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
CheckResultsMojo
,ConfigureJMeterMojo
,RunJMeterGUIMojo
,RunJMeterMojo
,RunJMeterServerMojo
public abstract class AbstractJMeterMojo extends org.apache.maven.plugin.AbstractMojo
JMeter Maven plugin. This is a base class for the JMeter mojos.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
appendResultsTimestamp
Append the results timestamp to the filename (It will be prepended by default if testResultsTimestamp is set to true)protected File
confFilesDirectory
Path under which .conf files are stored.protected List<File>
customPropertiesFiles
Absolute path to JMeter custom (test dependent) properties file.static String
DEFAULT_CONFIG_EXECUTION_ID
protected boolean
doNotFailBuildIfJVMIsKilled
Do not fail the build if the JMeter JVM is force killed.protected boolean
generateReports
Generate JMeter Reports (this will force your .jtl's into .csv mode)protected static String
JMETER_ARTIFACT_NAME
protected static String
JMETER_ARTIFACT_PREFIX
protected static String
JMETER_CONFIG_ARTIFACT_NAME
protected JMeterProcessJVMSettings
jMeterProcessJVMSettings
Value class that wraps all JMeter Process JVM settings.protected static String
JORPHAN_ARTIFACT_NAME
protected static String
LINE_SEPARATOR
protected File
logsDirectory
TODO Dynamic Set the directory that JMeter logs are saved to.protected org.apache.maven.plugin.MojoExecution
mojoExecution
The information extracted from the Mojo being currently executedprotected String
overrideRootLogLevel
Set a root log level to override all log levels used by JMeter Valid log levels are: ERROR, WARN, INFO, DEBUG (They are not case sensitive); If you try to set an invalid log level it will be ignoredprotected String
postTestPauseInSeconds
Set a pause in seconds after each test that is run.protected File
projectBuildDirectory
The project build directoryprotected ProxyConfiguration
proxyConfig
Value class that wraps all proxy configurations.protected RemoteConfiguration
remoteConfig
Value class that wraps all remote configurations.protected File
reportDirectory
TODO Dynamic Set the directory that JMeter reports are saved to.protected File
resultsDirectory
TODO Dynamic Set the directory that JMeter results are saved to.protected String
resultsFileNameDateFormat
Set the format of the timestamp that is appended to the results filename.protected String
selectedConfiguration
The filename used to store the results configprotected org.apache.maven.execution.MavenSession
session
protected org.apache.maven.settings.Settings
settings
Maven settingsprotected boolean
skipTests
Skip the JMeter testsprotected boolean
suppressJMeterOutput
Suppress JMeter outputprotected TestConfigurationWrapper
testConfig
protected String
testConfigFile
The filename used to store the results configprotected File
testFilesBuildDirectory
TODO Dynamic Set the directory that JMeter test files are copied into as part of the build.protected File
testFilesDirectory
Path under which JMX files are stored.protected List<String>
testFilesExcluded
Sets the list of exclude patterns to use in directory scan for JMX files.protected List<String>
testFilesIncluded
Sets the list of include patterns to use in directory scan for JMX files.protected boolean
testResultsTimestamp
Timestamp the test results.protected boolean
useMavenProxy
Use maven proxy configuration if no specific proxy configuration provided
-
Constructor Summary
Constructors Constructor Description AbstractJMeterMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected JMeterArgumentsArray
computeJMeterArgumentsArray(boolean disableGUI, boolean isCSVFormat, String jmeterDirectoryPath)
Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter.protected abstract void
doExecute()
void
execute()
protected void
loadMavenProxy()
Try to load the active maven proxy.
-
-
-
Field Detail
-
DEFAULT_CONFIG_EXECUTION_ID
public static final String DEFAULT_CONFIG_EXECUTION_ID
- See Also:
- Constant Field Values
-
LINE_SEPARATOR
protected static final String LINE_SEPARATOR
- See Also:
- Constant Field Values
-
JMETER_ARTIFACT_PREFIX
protected static final String JMETER_ARTIFACT_PREFIX
- See Also:
- Constant Field Values
-
JMETER_ARTIFACT_NAME
protected static final String JMETER_ARTIFACT_NAME
- See Also:
- Constant Field Values
-
JMETER_CONFIG_ARTIFACT_NAME
protected static final String JMETER_CONFIG_ARTIFACT_NAME
- See Also:
- Constant Field Values
-
JORPHAN_ARTIFACT_NAME
protected static final String JORPHAN_ARTIFACT_NAME
- See Also:
- Constant Field Values
-
testFilesIncluded
@Parameter protected List<String> testFilesIncluded
Sets the list of include patterns to use in directory scan for JMX files. Relative to testFilesDirectory.
-
testFilesExcluded
@Parameter protected List<String> testFilesExcluded
Sets the list of exclude patterns to use in directory scan for JMX files. Relative to testFilesDirectory.
-
confFilesDirectory
@Parameter(defaultValue="${basedir}/src/test/conf") protected File confFilesDirectory
Path under which .conf files are stored.
-
testFilesDirectory
@Parameter(defaultValue="${basedir}/src/test/jmeter") protected File testFilesDirectory
Path under which JMX files are stored.
-
testResultsTimestamp
@Parameter(defaultValue="true") protected boolean testResultsTimestamp
Timestamp the test results.
-
appendResultsTimestamp
@Parameter(defaultValue="false") protected boolean appendResultsTimestamp
Append the results timestamp to the filename (It will be prepended by default if testResultsTimestamp is set to true)
-
resultsFileNameDateFormat
@Parameter protected String resultsFileNameDateFormat
Set the format of the timestamp that is appended to the results filename. (This assumes that testResultsTimestamp is set to 'true') For formatting see http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
-
generateReports
@Parameter(defaultValue="false") protected boolean generateReports
Generate JMeter Reports (this will force your .jtl's into .csv mode)
-
doNotFailBuildIfJVMIsKilled
@Parameter(defaultValue="false") protected boolean doNotFailBuildIfJVMIsKilled
Do not fail the build if the JMeter JVM is force killed. The JVM is normally killed forcibly because you ran out of memory, or the process running inside it stopped responding. Make sure you investigate the above before reaching for this option!
-
resultsDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/results") protected File resultsDirectory
TODO Dynamic Set the directory that JMeter results are saved to.
-
reportDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/reports") protected File reportDirectory
TODO Dynamic Set the directory that JMeter reports are saved to.
-
logsDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/logs") protected File logsDirectory
TODO Dynamic Set the directory that JMeter logs are saved to.
-
testFilesBuildDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/testFiles") protected File testFilesBuildDirectory
TODO Dynamic Set the directory that JMeter test files are copied into as part of the build.
-
customPropertiesFiles
@Parameter protected List<File> customPropertiesFiles
Absolute path to JMeter custom (test dependent) properties file.
-
useMavenProxy
@Parameter protected boolean useMavenProxy
Use maven proxy configuration if no specific proxy configuration provided
-
settings
@Parameter(defaultValue="${settings}", readonly=true) protected org.apache.maven.settings.Settings settings
Maven settings
-
proxyConfig
@Parameter protected ProxyConfiguration proxyConfig
Value class that wraps all proxy configurations.
-
remoteConfig
@Parameter(defaultValue="${remoteConfig}") protected RemoteConfiguration remoteConfig
Value class that wraps all remote configurations.
-
jMeterProcessJVMSettings
@Parameter(defaultValue="${jMeterProcessJVMSettings}") protected JMeterProcessJVMSettings jMeterProcessJVMSettings
Value class that wraps all JMeter Process JVM settings.
-
overrideRootLogLevel
@Parameter protected String overrideRootLogLevel
Set a root log level to override all log levels used by JMeter Valid log levels are: ERROR, WARN, INFO, DEBUG (They are not case sensitive); If you try to set an invalid log level it will be ignored
-
suppressJMeterOutput
@Parameter(defaultValue="false") protected boolean suppressJMeterOutput
Suppress JMeter output
-
mojoExecution
@Parameter(defaultValue="${mojoExecution}", required=true, readonly=true) protected org.apache.maven.plugin.MojoExecution mojoExecution
The information extracted from the Mojo being currently executed
-
session
@Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession session
-
skipTests
@Parameter(defaultValue="${skipTests}") protected boolean skipTests
Skip the JMeter tests
-
postTestPauseInSeconds
@Parameter(defaultValue="0") protected String postTestPauseInSeconds
Set a pause in seconds after each test that is run.
-
testConfigFile
@Parameter(defaultValue="${project.build.directory}/config.json") protected String testConfigFile
The filename used to store the results config
-
selectedConfiguration
@Parameter(property="selectConfiguration", defaultValue="configuration") protected String selectedConfiguration
The filename used to store the results config
-
projectBuildDirectory
@Parameter(defaultValue="${project.build.directory}") protected File projectBuildDirectory
The project build directory
-
testConfig
protected TestConfigurationWrapper testConfig
-
-
Method Detail
-
execute
public final void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
doExecute
protected abstract void doExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
computeJMeterArgumentsArray
protected JMeterArgumentsArray computeJMeterArgumentsArray(boolean disableGUI, boolean isCSVFormat, String jmeterDirectoryPath) throws org.apache.maven.plugin.MojoExecutionException
Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter.- Parameters:
disableGUI
- Prevent JMeter gGUI from starting upisCSVFormat
- Determines if results output is in CSV formate of legacy JTL formatjmeterDirectoryPath
- Path to the JMeter directory- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionException
- If unable to generate arguments array
-
loadMavenProxy
protected void loadMavenProxy()
Try to load the active maven proxy.
-
-