@@ -29,11 +29,14 @@ import com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor
2929import com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo
3030import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo
3131import com.github.tomakehurst.wiremock.junit5.WireMockTest
32- import org.apache.jmeter.config.ConfigTestElement
32+ import org.apache.jmeter.config.Argument
3333import org.apache.jmeter.junit.JMeterTestCase
34+ import org.apache.jmeter.protocol.http.control.arguments
35+ import org.apache.jmeter.protocol.http.control.httpRequestDefaults
36+ import org.apache.jmeter.protocol.http.util.HTTPArgument
3437import org.apache.jmeter.test.assertions.executePlanAndCollectEvents
35- import org.apache.jmeter.treebuilder.oneRequest
3638import org.apache.jmeter.treebuilder.TreeBuilder
39+ import org.apache.jmeter.treebuilder.oneRequest
3740import org.junit.jupiter.params.ParameterizedTest
3841import org.junit.jupiter.params.provider.ValueSource
3942import kotlin.time.Duration.Companion.seconds
@@ -115,22 +118,25 @@ class HttpSamplerDisableArgumentsTest : JMeterTestCase() {
115118
116119 executePlanAndCollectEvents(10 .seconds) {
117120 oneRequest {
118- httpRequest {
119- ConfigTestElement ::class {
120- addArgument(" param0" , " value0" )
121- arguments.getArgument(0 ).isEnabled = false
122- addArgument(" param4" , " value4" )
123- props {
124- // guiClass is needed for org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.applies
125- it[guiClass] = " org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui"
126- }
121+ httpRequestDefaults {
122+ arguments {
123+ addArgument(
124+ HTTPArgument (" param0" , " value0" ).apply {
125+ isEnabled = false
126+ }
127+ )
128+ addArgument(
129+ HTTPArgument (" param4" , " value4" )
130+ )
127131 }
132+ }
133+ httpRequest {
128134 method = " POST"
129135 doMultipart = true
130136 implementation = httpImplementation
131137 port = server.httpPort
132138 addArgument(" param1" , " value1" )
133- arguments.getArgument(1 ).isEnabled = false
139+ arguments.getArgument(0 ).isEnabled = false
134140 addArgument(" param2" , " value2" )
135141 }
136142 }
@@ -142,6 +148,9 @@ class HttpSamplerDisableArgumentsTest : JMeterTestCase() {
142148 .withRequestBodyPart(
143149 aMultipart(" param2" ).withBody(equalTo(" value2" )).build()
144150 )
151+ .withRequestBodyPart(
152+ aMultipart(" param4" ).withBody(equalTo(" value4" )).build()
153+ )
145154 .withRequestBody(
146155 httpImplementation,
147156 """
@@ -151,6 +160,12 @@ class HttpSamplerDisableArgumentsTest : JMeterTestCase() {
151160 Content-Transfer-Encoding: 8bit
152161
153162 value2
163+ -----------------------------7d159c1302d0y0
164+ Content-Disposition: form-data; name="param4"
165+ Content-Type: text/plain; charset=UTF-8
166+ Content-Transfer-Encoding: 8bit
167+
168+ value4
154169 -----------------------------7d159c1302d0y0--
155170
156171 """ .trimIndent()
0 commit comments