com.lazerycode.jmeter
Class JMeterAbstractMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.lazerycode.jmeter.JMeterAbstractMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
JMeterMojo

public abstract class JMeterAbstractMojo
extends org.apache.maven.plugin.AbstractMojo

JMeter Maven plugin. This is a base class for the JMeter mojos.

Author:
Tim McCune

Field Summary
protected  boolean appendResultsTimestamp
          Append the results timestamp to the filename (It will be prepended by default if testResultsTimestamp is set to true)
protected  File binDir
          Other directories will be created by this plugin and used by JMeter
protected  File customPropertiesFile
          Absolute path to JMeter custom (test dependent) properties file.
protected  boolean ignoreResultFailures
          Sets whether FailureScanner should ignore failures in JMeter result file.
protected  String jmeterConfigArtifact
          All property files are stored in this artifact, comes with JMeter library
protected  File libDir
           
protected  File libExtDir
           
protected  File logsDir
           
protected  org.apache.maven.project.MavenProject mavenProject
           
protected  String overrideRootLogLevel
          Set a root log level to override all log levels used by JMeter Valid log levels are: FATAL_ERROR, ERROR, WARN, INFO, DEBUG (They are not case sensitive); If you try to set an invalid log level it will be ignored
protected  List<org.apache.maven.artifact.Artifact> pluginArtifacts
          Get a list of artifacts used by this plugin
protected  PropertyHandler pluginProperties
           
protected  Map<String,String> propertiesGlobal
          JMeter Global Properties that override those given in jmeterProps.
protected  Map<String,String> propertiesJMeter
          Absolute path to JMeter custom (test dependent) properties file.
protected  boolean propertiesReplacedByCustomFiles
          Replace the default JMeter properties with any custom properties files supplied.
protected  Map<String,String> propertiesSaveService
          JMeter Properties that are merged with precedence into default JMeter file in saveservice.properties
protected  Map<String,String> propertiesSystem
          (Java) System properties set for the test run.
protected  Map<String,String> propertiesUpgrade
          JMeter Properties that are merged with precedence into default JMeter file in upgrade.properties
protected  Map<String,String> propertiesUser
          JMeter Properties that are merged with precedence into default JMeter file in user.properties user.properties takes precedence over jmeter.properties
protected  ProxyConfiguration proxyConfig
          Value class that wraps all proxy configurations.
protected  RemoteConfiguration remoteConfig
          Value class that wraps all remote configurations.
protected  File resultsDir
           
protected  String resultsFileFormat
          Set the format of the results generated by JMeter Valid values are: xml, csv (XML set by default).
protected  String resultsFileNameDateFormat
          Set the format of the timestamp that is appended to the results filename.
protected  boolean resultsOutputIsCSVFormat
           
protected  boolean skipTests
          Skip the JMeter tests
protected  boolean suppressJMeterOutput
          Suppress JMeter output
protected  JMeterArgumentsArray testArgs
           
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 Test 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  File workDir
          JMeter outputs.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
JMeterAbstractMojo()
           
 
Method Summary
protected  void generateJMeterDirectoryTree()
          Generate the directory tree utilised by JMeter.
protected  org.apache.maven.artifact.Artifact getArtifactNamed(String artifactName)
          Search the list of plugin artifacts for an artifact with a specific name
protected  void initialiseJMeterArgumentsArray(boolean disableGUI)
          Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter.
protected  SecurityManager overrideSecurityManager()
          Capture System.exit commands so that we can check to see if JMeter is trying to kill us without warning.
protected  Thread.UncaughtExceptionHandler overrideUncaughtExceptionHandler()
          Override System.exit(0) to ensure JMeter doesn't kill us without warning.
protected  void populateJMeterDirectoryTree()
          Copy jars/files to correct place in the JMeter directory tree.
protected  void propertyConfiguration()
           
protected  void setJMeterResultFileFormat()
           
protected  void waitForTestToFinish(List<String> threadNames)
          Wait for one of the JMeterThreads in the list to stop.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

testFilesIncluded

protected List<String> testFilesIncluded
Sets the list of include patterns to use in directory scan for JMX files. Relative to testFilesDirectory.


testFilesExcluded

protected List<String> testFilesExcluded
Sets the list of exclude patterns to use in directory scan for Test files. Relative to testFilesDirectory.


testFilesDirectory

protected File testFilesDirectory
Path under which JMX files are stored.


testResultsTimestamp

protected boolean testResultsTimestamp
Timestamp the test results.


appendResultsTimestamp

protected boolean appendResultsTimestamp
Append the results timestamp to the filename (It will be prepended by default if testResultsTimestamp is set to true)


resultsFileNameDateFormat

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


resultsFileFormat

protected String resultsFileFormat
Set the format of the results generated by JMeter Valid values are: xml, csv (XML set by default).


propertiesJMeter

protected Map<String,String> propertiesJMeter
Absolute path to JMeter custom (test dependent) properties file. .


propertiesSaveService

protected Map<String,String> propertiesSaveService
JMeter Properties that are merged with precedence into default JMeter file in saveservice.properties


propertiesUpgrade

protected Map<String,String> propertiesUpgrade
JMeter Properties that are merged with precedence into default JMeter file in upgrade.properties


propertiesUser

protected Map<String,String> propertiesUser
JMeter Properties that are merged with precedence into default JMeter file in user.properties user.properties takes precedence over jmeter.properties


propertiesGlobal

protected Map<String,String> propertiesGlobal
JMeter Global Properties that override those given in jmeterProps.
This sets local and remote properties (JMeter's definition of global properties is actually remote properties) and overrides any local/remote properties already set


propertiesSystem

protected Map<String,String> propertiesSystem
(Java) System properties set for the test run. Properties are merged with precedence into default JMeter file system.properties


overrideRootLogLevel

protected String overrideRootLogLevel
Set a root log level to override all log levels used by JMeter Valid log levels are: FATAL_ERROR, ERROR, WARN, INFO, DEBUG (They are not case sensitive); If you try to set an invalid log level it will be ignored


propertiesReplacedByCustomFiles

protected boolean propertiesReplacedByCustomFiles
Replace the default JMeter properties with any custom properties files supplied. (If set to false any custom properties files will be merged with the default JMeter properties files, custom properties will overwrite default ones)


customPropertiesFile

protected File customPropertiesFile
Absolute path to JMeter custom (test dependent) properties file.


ignoreResultFailures

protected boolean ignoreResultFailures
Sets whether FailureScanner should ignore failures in JMeter result file.

Failures are for example failed requests


proxyConfig

protected ProxyConfiguration proxyConfig
Value class that wraps all proxy configurations.


remoteConfig

protected RemoteConfiguration remoteConfig
Value class that wraps all remote configurations.


suppressJMeterOutput

protected boolean suppressJMeterOutput
Suppress JMeter output


mavenProject

protected org.apache.maven.project.MavenProject mavenProject

pluginArtifacts

protected List<org.apache.maven.artifact.Artifact> pluginArtifacts
Get a list of artifacts used by this plugin


skipTests

protected boolean skipTests
Skip the JMeter tests


workDir

protected transient File workDir
JMeter outputs.


binDir

protected File binDir
Other directories will be created by this plugin and used by JMeter


libDir

protected File libDir

libExtDir

protected File libExtDir

logsDir

protected File logsDir

resultsDir

protected File resultsDir

jmeterConfigArtifact

protected final String jmeterConfigArtifact
All property files are stored in this artifact, comes with JMeter library

See Also:
Constant Field Values

testArgs

protected JMeterArgumentsArray testArgs

pluginProperties

protected PropertyHandler pluginProperties

resultsOutputIsCSVFormat

protected boolean resultsOutputIsCSVFormat
Constructor Detail

JMeterAbstractMojo

public JMeterAbstractMojo()
Method Detail

generateJMeterDirectoryTree

protected void generateJMeterDirectoryTree()
Generate the directory tree utilised by JMeter.


propertyConfiguration

protected void propertyConfiguration()
                              throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

populateJMeterDirectoryTree

protected void populateJMeterDirectoryTree()
                                    throws org.apache.maven.plugin.MojoExecutionException
Copy jars/files to correct place in the JMeter directory tree.

Throws:
org.apache.maven.plugin.MojoExecutionException

getArtifactNamed

protected org.apache.maven.artifact.Artifact getArtifactNamed(String artifactName)
                                                       throws org.apache.maven.plugin.MojoExecutionException
Search the list of plugin artifacts for an artifact with a specific name

Parameters:
artifactName -
Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

initialiseJMeterArgumentsArray

protected void initialiseJMeterArgumentsArray(boolean disableGUI)
                                       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.

Throws:
org.apache.maven.plugin.MojoExecutionException

setJMeterResultFileFormat

protected void setJMeterResultFileFormat()

waitForTestToFinish

protected void waitForTestToFinish(List<String> threadNames)
                            throws InterruptedException
Wait for one of the JMeterThreads in the list to stop.

Throws:
InterruptedException

overrideSecurityManager

protected SecurityManager overrideSecurityManager()
Capture System.exit commands so that we can check to see if JMeter is trying to kill us without warning.

Returns:
old SecurityManager so that we can switch back to normal behaviour.

overrideUncaughtExceptionHandler

protected Thread.UncaughtExceptionHandler overrideUncaughtExceptionHandler()
Override System.exit(0) to ensure JMeter doesn't kill us without warning.

Returns:
old UncaughtExceptionHandler so that we can switch back to normal behaviour.


Copyright © 2013. All Rights Reserved.