
org.codehaus.mojo.chronos.jmeter.HelpMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chronos-jmeter-maven-plugin Show documentation
Show all versions of chronos-jmeter-maven-plugin Show documentation
Plugin for testing performance with jmeter
The newest version!
package org.codehaus.mojo.chronos.jmeter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Display help information on chronos-jmeter-maven-plugin.
Call mvn chronos-jmeter:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
*
* @version generated on Thu Aug 23 10:17:13 CEST 2012
* @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.9)
* @goal help
* @requiresProject false
* @threadSafe
*/
public class HelpMojo
extends AbstractMojo
{
/**
* If true
, display all settable properties for each goal.
*
* @parameter expression="${detail}" default-value="false"
*/
private boolean detail;
/**
* The name of the goal for which to show help. If unspecified, all goals will be displayed.
*
* @parameter expression="${goal}"
*/
private java.lang.String goal;
/**
* The maximum length of a display line, should be positive.
*
* @parameter expression="${lineLength}" default-value="80"
*/
private int lineLength;
/**
* The number of spaces per indentation level, should be positive.
*
* @parameter expression="${indentSize}" default-value="2"
*/
private int indentSize;
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
{
if ( lineLength <= 0 )
{
getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
lineLength = 80;
}
if ( indentSize <= 0 )
{
getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
indentSize = 2;
}
StringBuffer sb = new StringBuffer();
append( sb, "org.codehaus.mojo:chronos-jmeter-maven-plugin:1.1.0", 0 );
append( sb, "", 0 );
append( sb, "Chronos JMeter", 0 );
append( sb, "Plugin for testing performance with jmeter", 1 );
append( sb, "", 0 );
if ( goal == null || goal.length() <= 0 )
{
append( sb, "This plugin has 6 goals:", 0 );
append( sb, "", 0 );
}
if ( goal == null || goal.length() <= 0 || "check".equals( goal ) )
{
append( sb, "chronos-jmeter:check", 0 );
append( sb, "Checks the latest performancetests to verify that performance targets have been met. Extends abstract baseclass inside the reporting plugin to avoid duplication of code.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "averageduration (Default: 20000)", 2 );
append( sb, "The timeinterval to base moving average calculations on (in millis).", 3 );
append( sb, "", 0 );
append( sb, "collectedprsecond", 2 );
append( sb, "The maximum memory (in kb) garbagecollected pr second.", 3 );
append( sb, "", 0 );
append( sb, "dataid (Default: performancetest)", 2 );
append( sb, "The id of the JMeter test", 3 );
append( sb, "", 0 );
append( sb, "gctimeratio", 2 );
append( sb, "The maximum allowed ratio of time spent garbage collecting.", 3 );
append( sb, "", 0 );
append( sb, "maxthroughput", 2 );
append( sb, "The minimum required maximum throughput (in requests/sec).", 3 );
append( sb, "", 0 );
append( sb, "project", 2 );
append( sb, "The current maven project.", 3 );
append( sb, "Expression: ${project}", 3 );
append( sb, "", 0 );
append( sb, "responsetime95", 2 );
append( sb, "The maximum acceptable 95 percentage responsetime (in millis).", 3 );
append( sb, "", 0 );
append( sb, "responsetime99", 2 );
append( sb, "The maximum acceptable 99 percentage responsetime (in millis).", 3 );
append( sb, "", 0 );
append( sb, "responsetimeaverage", 2 );
append( sb, "The maximum acceptable average responsetime (in millis).", 3 );
append( sb, "", 0 );
append( sb, "responsetimemax", 2 );
append( sb, "The maximum acceptable responsetime (in millis).", 3 );
append( sb, "", 0 );
append( sb, "stopOnFailed (Default: false)", 2 );
append( sb, "Determines if the build should fail if at least one of the samples failed.", 3 );
append( sb, "", 0 );
}
}
if ( goal == null || goal.length() <= 0 || "help".equals( goal ) )
{
append( sb, "chronos-jmeter:help", 0 );
append( sb, "Display help information on chronos-jmeter-maven-plugin.\nCall\n\u00a0\u00a0mvn\u00a0chronos-jmeter:help\u00a0-Ddetail=true\u00a0-Dgoal=\nto display parameter details.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "detail (Default: false)", 2 );
append( sb, "If true, display all settable properties for each goal.", 3 );
append( sb, "Expression: ${detail}", 3 );
append( sb, "", 0 );
append( sb, "goal", 2 );
append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
append( sb, "Expression: ${goal}", 3 );
append( sb, "", 0 );
append( sb, "indentSize (Default: 2)", 2 );
append( sb, "The number of spaces per indentation level, should be positive.", 3 );
append( sb, "Expression: ${indentSize}", 3 );
append( sb, "", 0 );
append( sb, "lineLength (Default: 80)", 2 );
append( sb, "The maximum length of a display line, should be positive.", 3 );
append( sb, "Expression: ${lineLength}", 3 );
append( sb, "", 0 );
}
}
if ( goal == null || goal.length() <= 0 || "jmeter".equals( goal ) )
{
append( sb, "chronos-jmeter:jmeter", 0 );
append( sb, "Invokes JMeter.\nJMeter is invoked by spawning a separate process to make it possible to control startup parameters. Can also be used by specifying a .jtl file as input and (possibly) a garbage collection logfile.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "bootstrapper", 2 );
append( sb, "Clasname of an (optional) bootstrapperclass. The purpose is to allow bootstrapping the proces eg. by initializing testdata in a relational database without measuring the time.", 3 );
append( sb, "", 0 );
append( sb, "dataid (Default: performancetest)", 2 );
append( sb, "The id of the jmeter invocation.", 3 );
append( sb, "", 0 );
append( sb, "gcargs", 2 );
append( sb, "Configuration parameters used for configurating the .", 3 );
append( sb, "", 0 );
append( sb, "gclogfile", 2 );
append( sb, "The name of an (optional) garbage collection logfile. Only used when loggc is set to true.", 3 );
append( sb, "", 0 );
append( sb, "heap (Default: 256m)", 2 );
append( sb, "The heapsize (both initial and max) of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "input", 2 );
append( sb, "The inputfile. This could either be a .jmx file or a folder containing .jmx files. jmeter is invoked, and corresponding .jtl file(s) generated.", 3 );
append( sb, "Required: Yes", 3 );
append( sb, "", 0 );
append( sb, "jmeterhome", 2 );
append( sb, "The path to the jmeter installation. The recommended way to set this is by specifying a property jmeter.home in the pom.xml or settings.xml.\n", 3 );
append( sb, "Expression: ${project.basedir}/jmeter", 3 );
append( sb, "", 0 );
append( sb, "jMeterRemoteLocation", 2 );
append( sb, "The URL from where jMeter can be downloaded. We use the archive, since old versions are preserved for a longer time here.", 3 );
append( sb, "Expression: http://archive.apache.org/dist/jmeter/binaries", 3 );
append( sb, "", 0 );
append( sb, "jmeterVariables", 2 );
append( sb, "Additional arguments supplied to jmeter. like invoking the jmeter startup script with using jmeterargumensts like -Jvariable=value", 3 );
append( sb, "", 0 );
append( sb, "jmeterVersion (Default: 2.7)", 2 );
append( sb, "the version to download", 3 );
append( sb, "", 0 );
append( sb, "loggc (Default: true)", 2 );
append( sb, "Will garbage collections be logged? Note that this is really only relevant if your tests are junitsamples in jmeter.", 3 );
append( sb, "", 0 );
append( sb, "maxliveobjectevacuationratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "maxtenuringthreshold (Default: 2)", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "newsize (Default: 128m)", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "options", 2 );
append( sb, "Optional Miscellaneous configuration parameters used when launching JMeter", 3 );
append( sb, "", 0 );
append( sb, "permsize (Default: 64m)", 2 );
append( sb, "The size of the part of the spawned jmeter jvm\'s memory, where classes e.g. are stored.", 3 );
append( sb, "", 0 );
append( sb, "project", 2 );
append( sb, "The current maven project.", 3 );
append( sb, "Expression: ${project}", 3 );
append( sb, "", 0 );
append( sb, "rmigcinterval (Default: 600000)", 2 );
append( sb, "How often will rmi garbage collections be performed? JVM option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "survivorratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "sysproperties", 2 );
append( sb, "System-properties to the launched jvm.", 3 );
append( sb, "", 0 );
append( sb, "targetsurvivorratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
}
}
if ( goal == null || goal.length() <= 0 || "jmetergui".equals( goal ) )
{
append( sb, "chronos-jmeter:jmetergui", 0 );
append( sb, "Invokes the JMeter gui.\nThe purpose is to create a testplan with the artifacts of the current project in the classpath.\nThis is necessary if the testplan should contain unittests or javaclases from the project.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "executedproject", 2 );
append( sb, "The \'current\' maven project as executed by the package phase.\nWe use this to find dependencies and paths.", 3 );
append( sb, "Expression: ${executedProject}", 3 );
append( sb, "", 0 );
append( sb, "heap (Default: 256m)", 2 );
append( sb, "The heapsize (both initial and max) of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "jmeterhome", 2 );
append( sb, "The path to the jmeter installation. The recommended way to set this is by specifying a property jmeter.home in the pom.xml or settings.xml.\n", 3 );
append( sb, "Expression: ${project.basedir}/jmeter", 3 );
append( sb, "", 0 );
append( sb, "jMeterRemoteLocation", 2 );
append( sb, "The URL from where jMeter can be downloaded. We use the archive, since old versions are preserved for a longer time here.", 3 );
append( sb, "Expression: http://archive.apache.org/dist/jmeter/binaries", 3 );
append( sb, "", 0 );
append( sb, "jmeterVersion (Default: 2.7)", 2 );
append( sb, "the version to download", 3 );
append( sb, "", 0 );
append( sb, "maxliveobjectevacuationratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "maxtenuringthreshold (Default: 2)", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "newsize (Default: 128m)", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "options", 2 );
append( sb, "Optional Miscellaneous configuration parameters used when launching JMeter", 3 );
append( sb, "", 0 );
append( sb, "permsize (Default: 64m)", 2 );
append( sb, "The size of the part of the spawned jmeter jvm\'s memory, where classes e.g. are stored.", 3 );
append( sb, "", 0 );
append( sb, "rmigcinterval (Default: 600000)", 2 );
append( sb, "How often will rmi garbage collections be performed? JVM option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "survivorratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
append( sb, "sysproperties", 2 );
append( sb, "System-properties to the launched jvm.", 3 );
append( sb, "", 0 );
append( sb, "targetsurvivorratio", 2 );
append( sb, "Specifies the corresponding jvm option of the spawned jvm invoking jmeter.", 3 );
append( sb, "", 0 );
}
}
if ( goal == null || goal.length() <= 0 || "jmeteroutput".equals( goal ) )
{
append( sb, "chronos-jmeter:jmeteroutput", 0 );
append( sb, "Analyzes output from JMeter.\nIs used by specifying one or more .jtl files as input and (possibly) a garbage collection logfile.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "dataid (Default: performancetest)", 2 );
append( sb, "The id of the jmeter invocation.", 3 );
append( sb, "", 0 );
append( sb, "gclogfile", 2 );
append( sb, "The name of an (optional) garbage collection logfile. Only used when loggc is set to true.", 3 );
append( sb, "", 0 );
append( sb, "jmeterOutput", 2 );
append( sb, "The inputfile of the type .jtl. Will be parsed.", 3 );
append( sb, "Required: Yes", 3 );
append( sb, "", 0 );
append( sb, "project", 2 );
append( sb, "The current maven project.", 3 );
append( sb, "Expression: ${project}", 3 );
append( sb, "", 0 );
}
}
if ( goal == null || goal.length() <= 0 || "savehistory".equals( goal ) )
{
append( sb, "chronos-jmeter:savehistory", 0 );
append( sb, "Save a snapshot of the currently executed test to enable later historic reports.", 1 );
append( sb, "", 0 );
if ( detail )
{
append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
append( sb, "dataid (Default: performancetest)", 2 );
append( sb, "The id of the currently executed performancetest.", 3 );
append( sb, "", 0 );
append( sb, "historydir", 2 );
append( sb, "The directory where historic data are stored.", 3 );
append( sb, "Expression: ${basedir}/target/chronos-history", 3 );
append( sb, "", 0 );
append( sb, "project", 2 );
append( sb, "The current maven project.", 3 );
append( sb, "Expression: ${project}", 3 );
append( sb, "", 0 );
}
}
if ( getLog().isInfoEnabled() )
{
getLog().info( sb.toString() );
}
}
/**
* Repeat a String n
times to form a new string.
*
* @param str String to repeat
* @param repeat number of times to repeat str
* @return String with repeated String
* @throws NegativeArraySizeException if repeat < 0
* @throws NullPointerException if str is null
*/
private static String repeat( String str, int repeat )
{
StringBuffer buffer = new StringBuffer( repeat * str.length() );
for ( int i = 0; i < repeat; i++ )
{
buffer.append( str );
}
return buffer.toString();
}
/**
* Append a description to the buffer by respecting the indentSize and lineLength parameters.
* Note: The last character is always a new line.
*
* @param sb The buffer to append the description, not null
.
* @param description The description, not null
.
* @param indent The base indentation level of each line, must not be negative.
*/
private void append( StringBuffer sb, String description, int indent )
{
for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )
{
sb.append( it.next().toString() ).append( '\n' );
}
}
/**
* Splits the specified text into lines of convenient display length.
*
* @param text The text to split into lines, must not be null
.
* @param indent The base indentation level of each line, must not be negative.
* @param indentSize The size of each indentation, must not be negative.
* @param lineLength The length of the line, must not be negative.
* @return The sequence of display lines, never null
.
* @throws NegativeArraySizeException if indent < 0
*/
private static List toLines( String text, int indent, int indentSize, int lineLength )
{
List lines = new ArrayList();
String ind = repeat( "\t", indent );
String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
for ( int i = 0; i < plainLines.length; i++ )
{
toLines( lines, ind + plainLines[i], indentSize, lineLength );
}
return lines;
}
/**
* Adds the specified line to the output sequence, performing line wrapping if necessary.
*
* @param lines The sequence of display lines, must not be null
.
* @param line The line to add, must not be null
.
* @param indentSize The size of each indentation, must not be negative.
* @param lineLength The length of the line, must not be negative.
*/
private static void toLines( List lines, String line, int indentSize, int lineLength )
{
int lineIndent = getIndentLevel( line );
StringBuffer buf = new StringBuffer( 256 );
String[] tokens = line.split( " +" );
for ( int i = 0; i < tokens.length; i++ )
{
String token = tokens[i];
if ( i > 0 )
{
if ( buf.length() + token.length() >= lineLength )
{
lines.add( buf.toString() );
buf.setLength( 0 );
buf.append( repeat( " ", lineIndent * indentSize ) );
}
else
{
buf.append( ' ' );
}
}
for ( int j = 0; j < token.length(); j++ )
{
char c = token.charAt( j );
if ( c == '\t' )
{
buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
}
else if ( c == '\u00A0' )
{
buf.append( ' ' );
}
else
{
buf.append( c );
}
}
}
lines.add( buf.toString() );
}
/**
* Gets the indentation level of the specified line.
*
* @param line The line whose indentation level should be retrieved, must not be null
.
* @return The indentation level of the line.
*/
private static int getIndentLevel( String line )
{
int level = 0;
for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
{
level++;
}
for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
{
if ( line.charAt( i ) == '\t' )
{
level++;
break;
}
}
return level;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy