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.AbstractMojoJMeter Maven plugin. This is a base class for the JMeter mojos.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanappendResultsTimestampAppend the results timestamp to the filename (It will be prepended by default if testResultsTimestamp is set to true)protected FileconfFilesDirectoryPath under which .conf files are stored.protected List<File>customPropertiesFilesAbsolute path to JMeter custom (test dependent) properties file.static StringDEFAULT_CONFIG_EXECUTION_IDprotected booleandoNotFailBuildIfJVMIsKilledDo not fail the build if the JMeter JVM is force killed.protected booleangenerateReportsGenerate JMeter Reports (this will force your .jtl's into .csv mode)protected static StringJMETER_ARTIFACT_NAMEprotected static StringJMETER_ARTIFACT_PREFIXprotected static StringJMETER_CONFIG_ARTIFACT_NAMEprotected JMeterProcessJVMSettingsjMeterProcessJVMSettingsValue class that wraps all JMeter Process JVM settings.protected static StringJORPHAN_ARTIFACT_NAMEprotected static StringLINE_SEPARATORprotected FilelogsDirectoryTODO Dynamic Set the directory that JMeter logs are saved to.protected org.apache.maven.plugin.MojoExecutionmojoExecutionThe information extracted from the Mojo being currently executedprotected StringoverrideRootLogLevelSet 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 StringpostTestPauseInSecondsSet a pause in seconds after each test that is run.protected FileprojectBuildDirectoryThe project build directoryprotected ProxyConfigurationproxyConfigValue class that wraps all proxy configurations.protected RemoteConfigurationremoteConfigValue class that wraps all remote configurations.protected FilereportDirectoryTODO Dynamic Set the directory that JMeter reports are saved to.protected FileresultsDirectoryTODO Dynamic Set the directory that JMeter results are saved to.protected StringresultsFileNameDateFormatSet the format of the timestamp that is appended to the results filename.protected StringselectedConfigurationThe filename used to store the results configprotected org.apache.maven.execution.MavenSessionsessionprotected org.apache.maven.settings.SettingssettingsMaven settingsprotected booleanskipTestsSkip the JMeter testsprotected booleansuppressJMeterOutputSuppress JMeter outputprotected TestConfigurationWrappertestConfigprotected StringtestConfigFileThe filename used to store the results configprotected FiletestFilesBuildDirectoryTODO Dynamic Set the directory that JMeter test files are copied into as part of the build.protected FiletestFilesDirectoryPath under which JMX files are stored.protected List<String>testFilesExcludedSets the list of exclude patterns to use in directory scan for JMX files.protected List<String>testFilesIncludedSets the list of include patterns to use in directory scan for JMX files.protected booleantestResultsTimestampTimestamp the test results.protected booleanuseMavenProxyUse 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 JMeterArgumentsArraycomputeJMeterArgumentsArray(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 voiddoExecute()voidexecute()protected voidloadMavenProxy()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 confFilesDirectoryPath under which .conf files are stored.
-
testFilesDirectory
@Parameter(defaultValue="${basedir}/src/test/jmeter") protected File testFilesDirectoryPath 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 resultsDirectoryTODO Dynamic Set the directory that JMeter results are saved to.
-
reportDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/reports") protected File reportDirectoryTODO Dynamic Set the directory that JMeter reports are saved to.
-
logsDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/logs") protected File logsDirectoryTODO Dynamic Set the directory that JMeter logs are saved to.
-
testFilesBuildDirectory
@Parameter(defaultValue="${project.build.directory}/jmeter/testFiles") protected File testFilesBuildDirectoryTODO 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 settingsMaven settings
-
proxyConfig
@Parameter protected ProxyConfiguration proxyConfig
Value class that wraps all proxy configurations.
-
remoteConfig
@Parameter(defaultValue="${remoteConfig}") protected RemoteConfiguration remoteConfigValue class that wraps all remote configurations.
-
jMeterProcessJVMSettings
@Parameter(defaultValue="${jMeterProcessJVMSettings}") protected JMeterProcessJVMSettings jMeterProcessJVMSettingsValue 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 mojoExecutionThe 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 skipTestsSkip 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 testConfigFileThe filename used to store the results config
-
selectedConfiguration
@Parameter(property="selectConfiguration", defaultValue="configuration") protected String selectedConfigurationThe filename used to store the results config
-
projectBuildDirectory
@Parameter(defaultValue="${project.build.directory}") protected File projectBuildDirectoryThe 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.MojoExecutionExceptionorg.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.MojoExecutionExceptionorg.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.
-
-