Compare commits

...

10 Commits

Author SHA1 Message Date
junyejiang d5e96e1931
Merge 3310c2bb37 into 6d6654ed3b 2025-07-22 01:45:09 +08:00
Vladimir Sitnikov 6d6654ed3b chore: remove removeUnusedImports() rule
Validate Gradle Wrapper / Validation (push) Waiting to run Details
CI / Matrix Preparation (push) Waiting to run Details
CI / ${{ matrix.name }} (push) Blocked by required conditions Details
CI / Error Prone (JDK 17) (push) Waiting to run Details
Release Drafter / Update Release Draft (push) Waiting to run Details
removeUnusedImports causes issues with parsing newer Java, and
google-java-format requires --add-exports when running with Java 17+

We'd better use OpenRewrite for imports.
2025-07-21 20:18:45 +03:00
Mend Renovate b495352805 chore(deps): update plugin com.github.autostyle to v4
Validate Gradle Wrapper / Validation (push) Waiting to run Details
CI / Matrix Preparation (push) Waiting to run Details
CI / ${{ matrix.name }} (push) Blocked by required conditions Details
CI / Error Prone (JDK 17) (push) Waiting to run Details
Release Drafter / Update Release Draft (push) Waiting to run Details
2025-07-21 17:03:13 +03:00
junyejiang 3310c2bb37
Merge branch 'apache:master' into strip 2025-03-05 18:49:38 +08:00
junyejiang 7ff7fdbdf0 Merge branch 'strip' of github.com:junyejiang/jmeter into strip 2025-03-05 18:42:31 +08:00
junyejiang b755fde60d update 2025-03-05 18:42:07 +08:00
junyejiang 1a552eb8e3
Merge branch 'apache:master' into strip 2025-02-18 18:04:04 +08:00
junyejiang c7d58ec8e8
Merge branch 'apache:master' into strip 2025-02-10 21:18:39 +08:00
junyejiang 9d3d7c64f5 update as CR 2025-02-10 18:57:24 +08:00
junyejiang 7942d03010 Stripping success result in order to speed up transmit in distributed test mode. 2025-01-13 22:32:00 +08:00
7 changed files with 30 additions and 8 deletions

View File

@ -759,6 +759,8 @@ wmlParser.types=text/vnd.wap.wml
# set this property to false
#sample_sender_strip_also_on_error=true
sample_sender_strip_if_success=false
# Remote batching support
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
# batch mode (every 100 samples or every minute by default)

View File

@ -17,7 +17,7 @@
plugins {
`embedded-kotlin` apply false
id("com.github.autostyle") version "3.2"
id("com.github.autostyle") version "4.0"
}
allprojects {

View File

@ -75,7 +75,6 @@ plugins.withId("java") {
java {
license()
importOrder("static ", "java.", "javax", "org", "net", "com", "")
removeUnusedImports()
indentWithSpaces(4)
}
}

View File

@ -249,7 +249,7 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
if (operator == null) {
return "ERROR - invalid condition";
}
if (operator.evaluate(resultSize, allowedSize)) {
return "";
} else {

View File

@ -53,6 +53,7 @@ public class DataStrippingSampleSender extends AbstractSampleSender implements S
private final SampleSender decoratedSender;
// Configuration items, set up by readResolve
private transient volatile boolean stripAlsoOnError;
private static boolean stripIfSuccess = JMeterUtils.getPropDefault("sample_sender_strip_if_success", false);
/**
@ -126,6 +127,24 @@ public class DataStrippingSampleSender extends AbstractSampleSender implements S
private static void stripResponse(SampleResult result) {
result.setBytes(result.getBytesAsLong());
result.setResponseData(EMPTY_BA);
if (stripIfSuccess && result.isSuccessful()) {
result.setSentBytes(result.getSentBytes());
result.setSamplerData(null);
result.setRequestHeaders(null);
result.setBodySize(result.getBodySizeAsLong());
//result.setDataType(null);
//result.setDataEncoding(null);
result.setHeadersSize(result.getHeadersSize());
result.setResponseHeaders(null);
//result.setURL(null);
//result.setResponseMessage(null);
//result.setResponseCode(null);
}
}
/**
@ -138,10 +157,12 @@ public class DataStrippingSampleSender extends AbstractSampleSender implements S
protected Object readResolve() throws ObjectStreamException{
if (isClientConfigured()) {
stripAlsoOnError = clientConfiguredStripAlsoOnError;
stripIfSuccess = JMeterUtils.getPropDefault("sample_sender_strip_if_success", false);
} else {
stripAlsoOnError = SERVER_CONFIGURED_STRIP_ALSO_ON_ERROR;
}
log.info("Using DataStrippingSampleSender for this run with stripAlsoOnError: {}", stripAlsoOnError);
log.info("Using DataStrippingSampleSender for this run with stripIfSuccess: {}", stripIfSuccess);
return this;
}
}

View File

@ -86,7 +86,7 @@ public class ChangeCase extends AbstractFunction {
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, originalString);
return originalString;
}
return switch (changeCaseMode) {
case UPPER -> StringUtils.upperCase(originalString);
case LOWER -> StringUtils.lowerCase(originalString);

View File

@ -81,7 +81,7 @@ public class TestHttpRequestHdr extends JMeterTestCase {
Content-type: %s\r
Content-length: %d\r
\r
%s""".formatted(url, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED,
%s""".formatted(url, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED,
getBodyLength(postBody, contentEncoding), postBody);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPConstants.POST, s.getMethod());
@ -597,15 +597,15 @@ public class TestHttpRequestHdr extends JMeterTestCase {
private String createMultipartFormBody(String titleValue, String descriptionValue,
String contentEncoding, boolean includeExtraHeaders,
String boundary, String endOfLine) {
String titleHeaders = includeExtraHeaders ? """
Content-Type: text/plain; charset=%s%s\
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
String descriptionHeaders = includeExtraHeaders ? """
Content-Type: text/plain; charset=%s%s\
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
return """
--%s%s\
Content-Disposition: form-data; name="title"%s\