mirror of https://github.com/apache/jmeter.git
Compare commits
4 Commits
4a5abcee2f
...
b09e12e2ae
| Author | SHA1 | Date |
|---|---|---|
|
|
b09e12e2ae | |
|
|
177a53073c | |
|
|
9578941ad4 | |
|
|
21440e9778 |
12
bin/jmeter
12
bin/jmeter
|
|
@ -183,13 +183,11 @@ esac
|
|||
# Modern container memory detection is automatic in Java 17+
|
||||
# RUN_IN_DOCKER="-XX:+UseContainerSupport"
|
||||
|
||||
# Java 17 specific performance optimizations
|
||||
# Modern JVM performance flags for better throughput and reduced latency
|
||||
JAVA17_PERFORMANCE="-XX:+AlwaysPreTouch -XX:+UseLargePages -XX:+OptimizeStringConcat"
|
||||
|
||||
# Enhanced G1GC tuning for Java 17
|
||||
# Improved G1 performance with better defaults and new features
|
||||
: "${GC_ALGO:="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20 -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:G1HeapRegionSize=16m"}"
|
||||
# Finally, some tracing to help in case things go astray:
|
||||
# You may want to add those settings:
|
||||
# -XX:+ParallelRefProcEnabled -XX:+PerfDisableSharedMem
|
||||
: "${GC_ALGO:="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20"}"
|
||||
|
||||
|
||||
# Always dump on OOM (does not cost anything unless triggered)
|
||||
|
|
@ -198,7 +196,7 @@ SYSTEM_PROPS="-Djava.security.egd=file:/dev/urandom"
|
|||
SERVER="-server"
|
||||
|
||||
if [ -z "${JMETER_COMPLETE_ARGS}" ]; then
|
||||
ARGS="$JAVA_OPTS $SERVER $DUMP $HEAP $VERBOSE_GC $GC_ALGO $JAVA17_PERFORMANCE $SYSTEM_PROPS $JMETER_LANGUAGE $RUN_IN_DOCKER"
|
||||
ARGS="$JAVA_OPTS $SERVER $DUMP $HEAP $VERBOSE_GC $GC_ALGO $SYSTEM_PROPS $JMETER_LANGUAGE $RUN_IN_DOCKER"
|
||||
else
|
||||
ARGS=""
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -80,9 +80,6 @@ if not defined JMETER_LANGUAGE (
|
|||
rem Minimal version to run JMeter
|
||||
set MINIMAL_VERSION=17.0.0
|
||||
|
||||
rem Java 17 specific performance optimizations
|
||||
rem Modern JVM performance flags for better throughput and reduced latency
|
||||
set JAVA17_PERFORMANCE=-XX:+AlwaysPreTouch -XX:+UseLargePages -XX:+OptimizeStringConcat
|
||||
|
||||
rem Optimized GC logging for Java 17 with structured output and performance analysis
|
||||
rem Uncomment to enable comprehensive GC logging with rotation and detailed metrics
|
||||
|
|
@ -150,10 +147,8 @@ if not defined HEAP (
|
|||
)
|
||||
|
||||
rem Legacy GC verbose options removed (Java 8/9 support discontinued)
|
||||
rem Enhanced G1GC tuning for Java 17
|
||||
rem Improved G1 performance with better defaults and new features
|
||||
if not defined GC_ALGO (
|
||||
set GC_ALGO=-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20 -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:G1HeapRegionSize=16m
|
||||
set GC_ALGO=-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20
|
||||
)
|
||||
|
||||
set SYSTEM_PROPS=-Djava.security.egd=file:/dev/urandom
|
||||
|
|
@ -182,7 +177,7 @@ if not defined DDRAW (
|
|||
|
||||
rem Collect the settings defined above
|
||||
if not defined JMETER_COMPLETE_ARGS (
|
||||
set ARGS=%JAVA_OPTS% %DUMP% %HEAP% %VERBOSE_GC% %GC_ALGO% %JAVA17_PERFORMANCE% %DDRAW% %SYSTEM_PROPS% %JMETER_LANGUAGE% %RUN_IN_DOCKER%
|
||||
set ARGS=%JAVA_OPTS% %DUMP% %HEAP% %VERBOSE_GC% %GC_ALGO% %DDRAW% %SYSTEM_PROPS% %JMETER_LANGUAGE% %RUN_IN_DOCKER%
|
||||
) else (
|
||||
set ARGS=
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,17 +35,77 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
|
|||
|
||||
private static final long serialVersionUID = 241L;
|
||||
|
||||
// Static int to signify the type of logical comparator to assert
|
||||
/**
|
||||
* Comparison operators for size assertions
|
||||
*/
|
||||
public enum ComparisonOperator {
|
||||
EQUAL(1, "size_assertion_comparator_error_equal"),
|
||||
NOTEQUAL(2, "size_assertion_comparator_error_notequal"),
|
||||
GREATERTHAN(3, "size_assertion_comparator_error_greater"),
|
||||
LESSTHAN(4, "size_assertion_comparator_error_less"),
|
||||
GREATERTHANEQUAL(5, "size_assertion_comparator_error_greaterequal"),
|
||||
LESSTHANEQUAL(6, "size_assertion_comparator_error_lessequal");
|
||||
|
||||
private final int value;
|
||||
private final String errorMessageKey;
|
||||
|
||||
ComparisonOperator(int value, String errorMessageKey) {
|
||||
this.value = value;
|
||||
this.errorMessageKey = errorMessageKey;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getErrorMessageKey() {
|
||||
return errorMessageKey;
|
||||
}
|
||||
|
||||
public static ComparisonOperator fromValue(int value) {
|
||||
for (ComparisonOperator op : values()) {
|
||||
if (op.value == value) {
|
||||
return op;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid comparison operator value: " + value);
|
||||
}
|
||||
|
||||
public boolean evaluate(long actual, long expected) {
|
||||
return switch (this) {
|
||||
case EQUAL -> actual == expected;
|
||||
case NOTEQUAL -> actual != expected;
|
||||
case GREATERTHAN -> actual > expected;
|
||||
case LESSTHAN -> actual < expected;
|
||||
case GREATERTHANEQUAL -> actual >= expected;
|
||||
case LESSTHANEQUAL -> actual <= expected;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Backward compatibility constants - deprecated
|
||||
/** @deprecated Use {@link ComparisonOperator#EQUAL} instead */
|
||||
@Deprecated
|
||||
public static final int EQUAL = 1;
|
||||
|
||||
/** @deprecated Use {@link ComparisonOperator#NOTEQUAL} instead */
|
||||
@Deprecated
|
||||
public static final int NOTEQUAL = 2;
|
||||
|
||||
/** @deprecated Use {@link ComparisonOperator#GREATERTHAN} instead */
|
||||
@Deprecated
|
||||
public static final int GREATERTHAN = 3;
|
||||
|
||||
/** @deprecated Use {@link ComparisonOperator#LESSTHAN} instead */
|
||||
@Deprecated
|
||||
public static final int LESSTHAN = 4;
|
||||
|
||||
/** @deprecated Use {@link ComparisonOperator#GREATERTHANEQUAL} instead */
|
||||
@Deprecated
|
||||
public static final int GREATERTHANEQUAL = 5;
|
||||
|
||||
/** @deprecated Use {@link ComparisonOperator#LESSTHANEQUAL} instead */
|
||||
@Deprecated
|
||||
public static final int LESSTHANEQUAL = 6;
|
||||
|
||||
/** Key for storing assertion-information in the jmx-file. */
|
||||
|
|
@ -174,41 +234,20 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
|
|||
* than equal, less than equal.
|
||||
*
|
||||
*/
|
||||
private record ComparisonResult(boolean result, String errorMessage) {}
|
||||
|
||||
private String compareSize(long resultSize) {
|
||||
long allowedSize = Long.parseLong(getAllowedSize());
|
||||
int comp = getCompOper();
|
||||
ComparisonOperator operator;
|
||||
try {
|
||||
operator = ComparisonOperator.fromValue(getCompOper());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return "ERROR - invalid condition";
|
||||
}
|
||||
|
||||
ComparisonResult comparison = switch (comp) {
|
||||
case EQUAL -> new ComparisonResult(
|
||||
resultSize == allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_equal") //$NON-NLS-1$
|
||||
);
|
||||
case NOTEQUAL -> new ComparisonResult(
|
||||
resultSize != allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_notequal") //$NON-NLS-1$
|
||||
);
|
||||
case GREATERTHAN -> new ComparisonResult(
|
||||
resultSize > allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_greater") //$NON-NLS-1$
|
||||
);
|
||||
case LESSTHAN -> new ComparisonResult(
|
||||
resultSize < allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_less") //$NON-NLS-1$
|
||||
);
|
||||
case GREATERTHANEQUAL -> new ComparisonResult(
|
||||
resultSize >= allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_greaterequal") //$NON-NLS-1$
|
||||
);
|
||||
case LESSTHANEQUAL -> new ComparisonResult(
|
||||
resultSize <= allowedSize,
|
||||
JMeterUtils.getResString("size_assertion_comparator_error_lessequal") //$NON-NLS-1$
|
||||
);
|
||||
default -> new ComparisonResult(false, "ERROR - invalid condition");
|
||||
};
|
||||
|
||||
return comparison.result() ? "" : comparison.errorMessage();
|
||||
if (operator.evaluate(resultSize, allowedSize)) {
|
||||
return "";
|
||||
} else {
|
||||
return JMeterUtils.getResString(operator.getErrorMessageKey());
|
||||
}
|
||||
}
|
||||
|
||||
private void setTestField(String testField) {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
|
|||
lessthanButton.setSelected(false);
|
||||
greaterthanequalButton.setSelected(false);
|
||||
lessthanequalButton.setSelected(false);
|
||||
execState = SizeAssertion.EQUAL;
|
||||
execState = SizeAssertion.ComparisonOperator.EQUAL.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -164,32 +164,32 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
|
|||
* <p>
|
||||
* Allowed states are
|
||||
* <ul>
|
||||
* <li>{@link SizeAssertion#EQUAL}</li>
|
||||
* <li>{@link SizeAssertion#NOTEQUAL}</li>
|
||||
* <li>{@link SizeAssertion#GREATERTHAN}</li>
|
||||
* <li>{@link SizeAssertion#LESSTHAN}</li>
|
||||
* <li>{@link SizeAssertion#GREATERTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion#LESSTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#EQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#NOTEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHAN}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHAN}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHANEQUAL}</li>
|
||||
* </ul>
|
||||
* @param state One of the allowed states
|
||||
*/
|
||||
public void setState(int state) {
|
||||
if (state == SizeAssertion.EQUAL) {
|
||||
if (state == SizeAssertion.ComparisonOperator.EQUAL.getValue()) {
|
||||
equalButton.setSelected(true);
|
||||
execState = state;
|
||||
} else if (state == SizeAssertion.NOTEQUAL) {
|
||||
} else if (state == SizeAssertion.ComparisonOperator.NOTEQUAL.getValue()) {
|
||||
notequalButton.setSelected(true);
|
||||
execState = state;
|
||||
} else if (state == SizeAssertion.GREATERTHAN) {
|
||||
} else if (state == SizeAssertion.ComparisonOperator.GREATERTHAN.getValue()) {
|
||||
greaterthanButton.setSelected(true);
|
||||
execState = state;
|
||||
} else if (state == SizeAssertion.LESSTHAN) {
|
||||
} else if (state == SizeAssertion.ComparisonOperator.LESSTHAN.getValue()) {
|
||||
lessthanButton.setSelected(true);
|
||||
execState = state;
|
||||
} else if (state == SizeAssertion.GREATERTHANEQUAL) {
|
||||
} else if (state == SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue()) {
|
||||
greaterthanequalButton.setSelected(true);
|
||||
execState = state;
|
||||
} else if (state == SizeAssertion.LESSTHANEQUAL) {
|
||||
} else if (state == SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue()) {
|
||||
lessthanequalButton.setSelected(true);
|
||||
execState = state;
|
||||
}
|
||||
|
|
@ -200,12 +200,12 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
|
|||
* <p>
|
||||
* Possible states are
|
||||
* <ul>
|
||||
* <li>{@link SizeAssertion#EQUAL}</li>
|
||||
* <li>{@link SizeAssertion#NOTEQUAL}</li>
|
||||
* <li>{@link SizeAssertion#GREATERTHAN}</li>
|
||||
* <li>{@link SizeAssertion#LESSTHAN}</li>
|
||||
* <li>{@link SizeAssertion#GREATERTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion#LESSTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#EQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#NOTEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHAN}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHAN}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHANEQUAL}</li>
|
||||
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHANEQUAL}</li>
|
||||
* </ul>
|
||||
* @return The current state of the radio Button
|
||||
*/
|
||||
|
|
@ -273,12 +273,12 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
|
|||
private Box createComparatorButtonPanel() {
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
|
||||
equalButton = createComparatorButton("=", SizeAssertion.EQUAL, group); //$NON-NLS-1$
|
||||
notequalButton = createComparatorButton("!=", SizeAssertion.NOTEQUAL, group); //$NON-NLS-1$
|
||||
greaterthanButton = createComparatorButton(">", SizeAssertion.GREATERTHAN, group); //$NON-NLS-1$
|
||||
lessthanButton = createComparatorButton("<", SizeAssertion.LESSTHAN, group); //$NON-NLS-1$
|
||||
greaterthanequalButton = createComparatorButton(">=", SizeAssertion.GREATERTHANEQUAL, group); //$NON-NLS-1$
|
||||
lessthanequalButton = createComparatorButton("<=", SizeAssertion.LESSTHANEQUAL, group); //$NON-NLS-1$
|
||||
equalButton = createComparatorButton("=", SizeAssertion.ComparisonOperator.EQUAL.getValue(), group); //$NON-NLS-1$
|
||||
notequalButton = createComparatorButton("!=", SizeAssertion.ComparisonOperator.NOTEQUAL.getValue(), group); //$NON-NLS-1$
|
||||
greaterthanButton = createComparatorButton(">", SizeAssertion.ComparisonOperator.GREATERTHAN.getValue(), group); //$NON-NLS-1$
|
||||
lessthanButton = createComparatorButton("<", SizeAssertion.ComparisonOperator.LESSTHAN.getValue(), group); //$NON-NLS-1$
|
||||
greaterthanequalButton = createComparatorButton(">=", SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue(), group); //$NON-NLS-1$
|
||||
lessthanequalButton = createComparatorButton("<=", SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue(), group); //$NON-NLS-1$
|
||||
|
||||
equalButton.setSelected(true);
|
||||
execState = Integer.parseInt(equalButton.getActionCommand());
|
||||
|
|
|
|||
|
|
@ -224,18 +224,9 @@ public class CSVDataSet extends ConfigTestElement
|
|||
int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
|
||||
this.alias = switch(modeInt){
|
||||
case CSVDataSetBeanInfo.SHARE_ALL -> alias;
|
||||
case CSVDataSetBeanInfo.SHARE_GROUP -> {
|
||||
// Complex logic for thread group sharing
|
||||
yield alias + "@" + System.identityHashCode(context.getThreadGroup());
|
||||
}
|
||||
case CSVDataSetBeanInfo.SHARE_THREAD -> {
|
||||
// Complex logic for thread-specific sharing
|
||||
yield alias + "@" + System.identityHashCode(context.getThread());
|
||||
}
|
||||
default -> {
|
||||
// User-specified key with validation
|
||||
yield alias + "@" + mode; // user-specified key
|
||||
}
|
||||
case CSVDataSetBeanInfo.SHARE_GROUP -> alias + "@" + System.identityHashCode(context.getThreadGroup());
|
||||
case CSVDataSetBeanInfo.SHARE_THREAD -> alias + "@" + System.identityHashCode(context.getThread());
|
||||
default -> alias + "@" + mode; // user-specified key
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionEquals() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.EQUAL);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.EQUAL.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertFailed();
|
||||
|
|
@ -73,7 +73,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionNotEquals() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.NOTEQUAL);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.NOTEQUAL.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertPassed();
|
||||
|
|
@ -91,7 +91,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionGreaterThan() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.GREATERTHAN);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.GREATERTHAN.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertPassed();
|
||||
|
|
@ -109,7 +109,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionGreaterThanEqual() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.GREATERTHANEQUAL);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertPassed();
|
||||
|
|
@ -127,7 +127,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionLessThan() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.LESSTHAN);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.LESSTHAN.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertFailed();
|
||||
|
|
@ -145,7 +145,7 @@ public class SizeAssertionTest extends JMeterTestCase {
|
|||
|
||||
@Test
|
||||
public void testSizeAssertionLessThanEqual() throws Exception {
|
||||
assertion.setCompOper(SizeAssertion.LESSTHANEQUAL);
|
||||
assertion.setCompOper(SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue());
|
||||
assertion.setAllowedSize(0);
|
||||
result = assertion.getResult(sample1);
|
||||
assertFailed();
|
||||
|
|
|
|||
Loading…
Reference in New Issue