mirror of https://github.com/apache/jmeter.git
Compare commits
10 Commits
540a849901
...
d5e96e1931
| Author | SHA1 | Date |
|---|---|---|
|
|
d5e96e1931 | |
|
|
6d6654ed3b | |
|
|
b495352805 | |
|
|
3310c2bb37 | |
|
|
7ff7fdbdf0 | |
|
|
b755fde60d | |
|
|
1a552eb8e3 | |
|
|
c7d58ec8e8 | |
|
|
9d3d7c64f5 | |
|
|
7942d03010 |
|
|
@ -759,6 +759,8 @@ wmlParser.types=text/vnd.wap.wml
|
||||||
# set this property to false
|
# set this property to false
|
||||||
#sample_sender_strip_also_on_error=true
|
#sample_sender_strip_also_on_error=true
|
||||||
|
|
||||||
|
sample_sender_strip_if_success=false
|
||||||
|
|
||||||
# Remote batching support
|
# Remote batching support
|
||||||
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
|
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
|
||||||
# batch mode (every 100 samples or every minute by default)
|
# batch mode (every 100 samples or every minute by default)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`embedded-kotlin` apply false
|
`embedded-kotlin` apply false
|
||||||
id("com.github.autostyle") version "3.2"
|
id("com.github.autostyle") version "4.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,6 @@ plugins.withId("java") {
|
||||||
java {
|
java {
|
||||||
license()
|
license()
|
||||||
importOrder("static ", "java.", "javax", "org", "net", "com", "")
|
importOrder("static ", "java.", "javax", "org", "net", "com", "")
|
||||||
removeUnusedImports()
|
|
||||||
indentWithSpaces(4)
|
indentWithSpaces(4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
return "ERROR - invalid condition";
|
return "ERROR - invalid condition";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operator.evaluate(resultSize, allowedSize)) {
|
if (operator.evaluate(resultSize, allowedSize)) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class DataStrippingSampleSender extends AbstractSampleSender implements S
|
||||||
private final SampleSender decoratedSender;
|
private final SampleSender decoratedSender;
|
||||||
// Configuration items, set up by readResolve
|
// Configuration items, set up by readResolve
|
||||||
private transient volatile boolean stripAlsoOnError;
|
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) {
|
private static void stripResponse(SampleResult result) {
|
||||||
result.setBytes(result.getBytesAsLong());
|
result.setBytes(result.getBytesAsLong());
|
||||||
result.setResponseData(EMPTY_BA);
|
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{
|
protected Object readResolve() throws ObjectStreamException{
|
||||||
if (isClientConfigured()) {
|
if (isClientConfigured()) {
|
||||||
stripAlsoOnError = clientConfiguredStripAlsoOnError;
|
stripAlsoOnError = clientConfiguredStripAlsoOnError;
|
||||||
|
stripIfSuccess = JMeterUtils.getPropDefault("sample_sender_strip_if_success", false);
|
||||||
} else {
|
} else {
|
||||||
stripAlsoOnError = SERVER_CONFIGURED_STRIP_ALSO_ON_ERROR;
|
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 stripAlsoOnError: {}", stripAlsoOnError);
|
||||||
|
log.info("Using DataStrippingSampleSender for this run with stripIfSuccess: {}", stripIfSuccess);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class ChangeCase extends AbstractFunction {
|
||||||
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, originalString);
|
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, originalString);
|
||||||
return originalString;
|
return originalString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return switch (changeCaseMode) {
|
return switch (changeCaseMode) {
|
||||||
case UPPER -> StringUtils.upperCase(originalString);
|
case UPPER -> StringUtils.upperCase(originalString);
|
||||||
case LOWER -> StringUtils.lowerCase(originalString);
|
case LOWER -> StringUtils.lowerCase(originalString);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class TestHttpRequestHdr extends JMeterTestCase {
|
||||||
Content-type: %s\r
|
Content-type: %s\r
|
||||||
Content-length: %d\r
|
Content-length: %d\r
|
||||||
\r
|
\r
|
||||||
%s""".formatted(url, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED,
|
%s""".formatted(url, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED,
|
||||||
getBodyLength(postBody, contentEncoding), postBody);
|
getBodyLength(postBody, contentEncoding), postBody);
|
||||||
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
|
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
|
||||||
assertEquals(HTTPConstants.POST, s.getMethod());
|
assertEquals(HTTPConstants.POST, s.getMethod());
|
||||||
|
|
@ -597,15 +597,15 @@ public class TestHttpRequestHdr extends JMeterTestCase {
|
||||||
private String createMultipartFormBody(String titleValue, String descriptionValue,
|
private String createMultipartFormBody(String titleValue, String descriptionValue,
|
||||||
String contentEncoding, boolean includeExtraHeaders,
|
String contentEncoding, boolean includeExtraHeaders,
|
||||||
String boundary, String endOfLine) {
|
String boundary, String endOfLine) {
|
||||||
|
|
||||||
String titleHeaders = includeExtraHeaders ? """
|
String titleHeaders = includeExtraHeaders ? """
|
||||||
Content-Type: text/plain; charset=%s%s\
|
Content-Type: text/plain; charset=%s%s\
|
||||||
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
|
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
|
||||||
|
|
||||||
String descriptionHeaders = includeExtraHeaders ? """
|
String descriptionHeaders = includeExtraHeaders ? """
|
||||||
Content-Type: text/plain; charset=%s%s\
|
Content-Type: text/plain; charset=%s%s\
|
||||||
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
|
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
|
||||||
|
|
||||||
return """
|
return """
|
||||||
--%s%s\
|
--%s%s\
|
||||||
Content-Disposition: form-data; name="title"%s\
|
Content-Disposition: form-data; name="title"%s\
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue