com.lazerycode.jmeter.configuration.JMeterProcessJVMSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmeter-maven-plugin Show documentation
Show all versions of jmeter-maven-plugin Show documentation
A plugin to allow you to run JMeter tests with Maven.
package com.lazerycode.jmeter.configuration;
import java.util.ArrayList;
import java.util.List;
/**
* Used to specify JVM settings for the JMeter instance that will be run
*
* Configuration in pom.xml:
*
*
* {@code
*
*
* ${env.JAVA_HOME}/bin/java
* 512
* 1024
*
* foo
*
*
*
* }
*
*
* @author Mark Collin
*/
@SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
public class JMeterProcessJVMSettings {
private int xms = 512;
private int xmx = 512;
private String javaRuntime = "java";
private List arguments = new ArrayList<>();
private static final String RUN_HEADLESS = "-Djava.awt.headless=true";
private static final String HEADLESS_SETTING = "-Djava.awt.headless=";
public JMeterProcessJVMSettings() {
super();
}
public int getXms() {
return xms;
}
public int getXmx() {
return xmx;
}
public List getArguments() {
return arguments;
}
public JMeterProcessJVMSettings addArgument(String newArgument) {
if (arguments.stream().noneMatch(argument -> argument.equals(newArgument))) {
arguments.add(newArgument);
}
return this;
}
public JMeterProcessJVMSettings setHeadlessDefaultIfRequired() {
if (arguments.stream().noneMatch(argument -> argument.contains(HEADLESS_SETTING))) {
addArgument(RUN_HEADLESS);
}
return this;
}
public String getJavaRuntime() {
return this.javaRuntime;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy