Skip to content

Commit ba7fc83

Browse files
fdelpoggiosebastianlorenzo88
authored andcommitted
Upgrade JMeter to 5.6.3
1 parent f802165 commit ba7fc83

File tree

11 files changed

+26
-29
lines changed

11 files changed

+26
-29
lines changed

jmeter-java-dsl/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<groupId>commons-io</groupId>
9090
<artifactId>commons-io</artifactId>
9191
<!-- Same version as JMeter dependency -->
92-
<version>2.11.0</version>
92+
<version>2.15.1</version>
9393
</dependency>
9494
<dependency>
9595
<groupId>org.apache.commons</groupId>
@@ -114,7 +114,7 @@
114114
<dependency>
115115
<groupId>org.apache.commons</groupId>
116116
<artifactId>commons-pool2</artifactId>
117-
<version>2.11.1</version>
117+
<version>2.12.0</version>
118118
</dependency>
119119

120120
<dependency>
@@ -182,4 +182,4 @@
182182
</plugins>
183183
</build>
184184

185-
</project>
185+
</project>

jmeter-java-dsl/src/main/java/us/abstracta/jmeter/javadsl/core/controllers/FragmentMethodCall.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package us.abstracta.jmeter.javadsl.core.controllers;
22

33
import java.util.Collections;
4-
import java.util.HashMap;
54
import java.util.HashSet;
5+
import java.util.IdentityHashMap;
66
import java.util.Map;
77
import java.util.Set;
88
import org.apache.jmeter.testelement.TestElement;
@@ -51,7 +51,7 @@ private static String solveMethodName(TestElement element, MethodCallContext con
5151
}
5252

5353
private static Map<TestElement, String> getDefinedMethods(MethodCallContext context) {
54-
return context.getRoot().computeEntryIfAbsent(FragmentMethodCall.class, HashMap::new);
54+
return context.getRoot().computeEntryIfAbsent(FragmentMethodCall.class, IdentityHashMap::new);
5555
}
5656

5757
private static String buildUniqueName(String elementName, Set<String> existingNames) {

jmeter-java-dsl/src/main/java/us/abstracta/jmeter/javadsl/http/DslBaseHttpSampler.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,7 @@ protected TestElement buildTestElement() {
253253
}
254254
HTTPSamplerProxy ret = new HTTPSamplerProxy();
255255
HttpElementHelper.modifyTestElementUrl(ret, protocol, host, port, path);
256-
// We need to use this logic since setPath method triggers additional logic
257-
if (path != null) {
258-
ret.setPath(path);
259-
}
256+
260257
HttpElementHelper.modifyTestElementTimeouts(ret, connectionTimeout, responseTimeout);
261258
HttpElementHelper.modifyTestElementProxy(ret, proxyUrl, proxyUser, proxyPassword);
262259
return configureHttpTestElement(ret);

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/codegeneration/DslCodeGeneratorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void shouldGenerateExpectedCodeWhenSimpleJmxIsProvided(@TempDir Path temp
2424
throws Exception {
2525
File solvedTemplate = solveTemplateResource("test-plan.template.jmx", tempDir);
2626
assertThat(new DslCodeGenerator().generateCodeFromJmx(solvedTemplate))
27-
.isEqualTo(
27+
.isEqualToNormalizingNewlines(
2828
solveTestClassTemplate(Collections.singleton(ContentType.class.getName()),
2929
"SimpleTest.java"));
3030
}
@@ -50,15 +50,15 @@ private String solveTestClassTemplate(Set<String> imports, String testPlanCodeRe
5050
public void shouldGenerateExpectedCodeWhenRecordedJmxIsProvided() throws Exception {
5151
assertThat(new DslCodeGenerator()
5252
.generateCodeFromJmx(new TestResource(RESOURCES_FOLDER + "/recorded.jmx").file()))
53-
.isEqualTo(solveTestClassTemplate(Collections.singleton(StandardCharsets.class.getName()),
53+
.isEqualToNormalizingNewlines(solveTestClassTemplate(Collections.singleton(StandardCharsets.class.getName()),
5454
"RecordedTest.java"));
5555
}
5656

5757
@Test
5858
public void shouldGenerateCommentedElementsCodeWhenDisabledElementsInJmx() throws Exception {
5959
assertThat(new DslCodeGenerator()
6060
.generateCodeFromJmx(new TestResource(RESOURCES_FOLDER + "/disabled-elements.jmx").file()))
61-
.isEqualTo(solveTestClassTemplate(Collections.emptySet(), "DisabledElements.java"));
61+
.isEqualToNormalizingNewlines(solveTestClassTemplate(Collections.emptySet(), "DisabledElements.java"));
6262
}
6363

6464
}

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/core/StringTemplateAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static StringTemplateAssertString assertThat(String actual) {
4343
protected abstract ErrorMessageFactory getErrorMessageFactory(List<Delta<String>> diffs);
4444

4545
public SELF matches(TestResource template) throws IOException {
46-
return matches(template.rawContents());
46+
return matches(template.rawContents().replace("\r\n", "\n"));
4747
}
4848

4949
public SELF matches(String templateContents) throws IOException {

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/core/controllers/DslIncludeControllerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void shouldGenerateDslWithFragmentWhenConvertingTestPlanWithIncludeContro
3333
buildIncludeControllerJmx(includedJmx)
3434
));
3535
assertThat(jmx2dsl(jmx, tmp))
36-
.isEqualTo(buildTestPlanDsl(FRAGMENT_METHOD_CALL));
36+
.isEqualToNormalizingNewlines(buildTestPlanDsl(FRAGMENT_METHOD_CALL));
3737
}
3838

3939
private File buildIncludedTestPlanJmx(Path tmp) throws IOException {
@@ -69,7 +69,7 @@ public void shouldReuseFragmentWhenTestPlanWithTwoIncludesWithSameFile(@TempDir
6969
buildIncludeControllerJmx(includedJmx)
7070
));
7171
assertThat(jmx2dsl(jmx, tmp))
72-
.isEqualTo(buildTestPlanDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL));
72+
.isEqualToNormalizingNewlines(buildTestPlanDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL));
7373
}
7474

7575
}

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/core/controllers/DslModuleControllerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void shouldReuseFragmentMethodWhenModuleUsesPreviousEnabledFragment(@Temp
3131
buildFragmentJmx(),
3232
buildModuleJmx(DEFAULT_FRAGMENT_NAME));
3333
assertThat(jmx2dsl(jmx, tmp))
34-
.isEqualTo(buildFragmentPlanDsl(
34+
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
3535
buildThreadGroupDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
3636
}
3737

@@ -60,7 +60,7 @@ public void shouldDefineAndUseFragmentMethodWhenModuleUsesLaterEnabledFragment(
6060
buildModuleJmx(DEFAULT_FRAGMENT_NAME),
6161
buildFragmentJmx());
6262
assertThat(jmx2dsl(jmx, tmp))
63-
.isEqualTo(buildFragmentPlanDsl(
63+
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
6464
buildThreadGroupDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
6565
}
6666

@@ -72,7 +72,7 @@ public void shouldUseFragmentMethodWhenModuleUsesDisabledFragment(@TempDir Path
7272
buildModuleJmx(DEFAULT_FRAGMENT_NAME)
7373
);
7474
assertThat(jmx2dsl(jmx, tmp))
75-
.isEqualTo(buildFragmentPlanDsl(
75+
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
7676
"httpCookies()",
7777
"httpCache()",
7878
buildThreadGroupDsl("//" + FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
@@ -85,7 +85,7 @@ public void shouldDefineAndUseMethodWhenModuleUsesPreviouslyDefinedController(@T
8585
buildIfControllerJmx(),
8686
buildModuleJmx(IF_CONTROLLER_DEFAULT_NAME));
8787
assertThat(jmx2dsl(jmx, tmp))
88-
.isEqualTo(
88+
.isEqualToNormalizingNewlines(
8989
buildIfControllerPlanDsl(IF_CONTROLLER_METHOD_CALL, IF_CONTROLLER_METHOD_CALL));
9090
}
9191

@@ -109,7 +109,7 @@ public void shouldDefineAndUseMethodWhenModuleUsesLaterDefinedController(@TempDi
109109
buildIfControllerJmx()
110110
);
111111
assertThat(jmx2dsl(jmx, tmp))
112-
.isEqualTo(
112+
.isEqualToNormalizingNewlines(
113113
buildIfControllerPlanDsl(IF_CONTROLLER_METHOD_CALL, IF_CONTROLLER_METHOD_CALL));
114114
}
115115

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/core/controllers/DslTestFragmentControllerTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void shouldGenerateDslWithFragmentMethodWhenConvertTestPlanWithFragment(
5757
@TempDir Path tmp) throws IOException {
5858
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx());
5959
assertThat(jmx2dsl(testPlanJmx, tmp))
60-
.isEqualTo(buildTestPlanDsl(buildFragmentMethod(), DEFAULT_FRAGMENT_METHOD_CALL));
60+
.isEqualToNormalizingNewlines(buildTestPlanDsl(buildFragmentMethod(), DEFAULT_FRAGMENT_METHOD_CALL));
6161
}
6262

6363
private String buildTestPlanDsl(String method, String child) {
@@ -79,7 +79,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentNonDefaultName(
7979
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
8080
String methodName = "myFragment";
8181
assertThat(jmx2dsl(testPlanJmx, tmp))
82-
.isEqualTo(buildTestPlanDsl(
82+
.isEqualToNormalizingNewlines(buildTestPlanDsl(
8383
buildFragmentMethod(methodName, fragmentName),
8484
methodName + "()"));
8585
}
@@ -91,7 +91,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentWithNameStarting
9191
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
9292
String methodName = "fragment" + fragmentName;
9393
assertThat(jmx2dsl(testPlanJmx, tmp))
94-
.isEqualTo(buildTestPlanDsl(
94+
.isEqualToNormalizingNewlines(buildTestPlanDsl(
9595
buildFragmentMethod(methodName, fragmentName),
9696
methodName + "()"));
9797
}
@@ -103,7 +103,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentWithNameWithSpec
103103
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
104104
String methodName = "myFragment";
105105
assertThat(jmx2dsl(testPlanJmx, tmp))
106-
.isEqualTo(buildTestPlanDsl(
106+
.isEqualToNormalizingNewlines(buildTestPlanDsl(
107107
buildFragmentMethod(methodName, fragmentName),
108108
methodName + "()"));
109109
}
@@ -116,7 +116,7 @@ public void shouldGenerateDslWithFragmentsWhenConvertFragmentsWithCollidingNames
116116
buildFragmentJmx());
117117
String methodName2 = "testFragment2";
118118
assertThat(jmx2dsl(testPlanJmx, tmp))
119-
.isEqualTo(buildTestPlanDsl(
119+
.isEqualToNormalizingNewlines(buildTestPlanDsl(
120120
Arrays.asList(
121121
buildFragmentMethod(),
122122
buildFragmentMethod(methodName2, DEFAULT_FRAGMENT_NAME)),
@@ -130,7 +130,7 @@ public void shouldGenerateDslWithCommentedFragmentCallWhenConvertDisabledFragmen
130130
String testPlanJmx = buildTestPlanJmx(buildFragmentDisabledJmx());
131131
String cacheMethodCall = "httpCache()";
132132
assertThat(jmx2dsl(testPlanJmx, tmp))
133-
.isEqualTo(buildTestPlanDsl(Collections.singletonList(buildFragmentMethod()),
133+
.isEqualToNormalizingNewlines(buildTestPlanDsl(Collections.singletonList(buildFragmentMethod()),
134134
Arrays.asList("httpCookies()", cacheMethodCall, "//" + DEFAULT_FRAGMENT_METHOD_CALL))
135135
.replace(cacheMethodCall + ",", cacheMethodCall + "//,"));
136136
}

jmeter-java-dsl/src/test/java/us/abstracta/jmeter/javadsl/http/DslHttpSamplerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public void shouldSendMultiPartFormWhenPostRequestWithBodyParts() throws Excepti
450450
verify(postRequestedFor(anyUrl())
451451
.withHeader(HTTPConstants.HEADER_CONTENT_TYPE,
452452
matching(ContentType.MULTIPART_FORM_DATA.withCharset((String) null) + "; boundary="
453-
+ MULTIPART_BOUNDARY_PATTERN))
453+
+ MULTIPART_BOUNDARY_PATTERN + "; charset=UTF-8"))
454454
.withRequestBody(matching(
455455
buildMultiPartBodyPattern(part1Name, part1Value, part1Encoding, part2Name, part2File,
456456
part2Encoding))));

jmeter-java-dsl/src/test/resources/test-plan.template.jmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<jmeterTestPlan version="1.2" properties="5.0" jmeter="{{jmeterVersion:5.4.3~\d+\.\d+(\.\d+)?(-SNAPSHOT [0-9a-f]+)?}}">
2+
<jmeterTestPlan version="1.2" properties="5.0" jmeter="{{jmeterVersion:5.6.3~\d+\.\d+(\.\d+)?(-SNAPSHOT [0-9a-f]+)?}}">
33
<hashTree>
44
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan">
55
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments">

0 commit comments

Comments
 (0)