Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jmeter-java-dsl-azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-azure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-base-remote-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-base-remote-engine</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-blazemeter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-blazemeter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>jmeter-java-dsl-parent</artifactId>
<groupId>us.abstracta.jmeter</groupId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-bridge</artifactId>
Expand Down
9 changes: 8 additions & 1 deletion jmeter-java-dsl-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmeter-java-dsl-parent</artifactId>
<groupId>us.abstracta.jmeter</groupId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-cli</artifactId>
Expand Down Expand Up @@ -201,6 +201,13 @@
<include>org.apache-extras.beanshell:bsh</include>
<!-- required for converting jsonpath -->
<include>com.jayway.jsonpath:json-path</include>
<!-- required for kotlin support in JMeter 5.6.3+ -->
<include>org.jetbrains.kotlin:kotlin-stdlib</include>
<include>org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm</include>
<include>org.jetbrains.kotlinx:kotlinx-coroutines-swing</include>
<include>com.github.ben-manes.caffeine:caffeine</include>
<include>org.jetbrains:annotations</include>
<include>org.checkerframework:checker-qual</include>
</includes>
</artifactSet>
<filters>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-dashboard</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-datadog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-datadog</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-elasticsearch-listener/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-elasticsearch-listener</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-graphql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmeter-java-dsl-parent</artifactId>
<groupId>us.abstracta.jmeter</groupId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmeter-java-dsl-parent</artifactId>
<groupId>us.abstracta.jmeter</groupId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-octoperf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-octoperf</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-parallel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-parallel</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-prometheus</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-recorder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-recorder</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl-wrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmeter-java-dsl-parent</artifactId>
<groupId>us.abstracta.jmeter</groupId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl-wrapper</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions jmeter-java-dsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-parent</artifactId>
<version>1.31-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jmeter-java-dsl</artifactId>
Expand Down Expand Up @@ -89,7 +89,7 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<!-- Same version as JMeter dependency -->
<version>2.11.0</version>
<version>2.15.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -114,7 +114,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.11.1</version>
<version>2.12.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -182,4 +182,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package us.abstracta.jmeter.javadsl.core.controllers;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import org.apache.jmeter.testelement.TestElement;
Expand Down Expand Up @@ -51,7 +51,10 @@ private static String solveMethodName(TestElement element, MethodCallContext con
}

private static Map<TestElement, String> getDefinedMethods(MethodCallContext context) {
return context.getRoot().computeEntryIfAbsent(FragmentMethodCall.class, HashMap::new);
// Since JMeter 5.6.3, TestElement hash calculation changed from object identity
// to property-based hashing. IdentityHashMap is used here to prevent hash collisions
// that occur when multiple TestElements share identical property values.
return context.getRoot().computeEntryIfAbsent(FragmentMethodCall.class, IdentityHashMap::new);
}

private static String buildUniqueName(String elementName, Set<String> existingNames) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ protected TestElement buildTestElement() {
}
HTTPSamplerProxy ret = new HTTPSamplerProxy();
HttpElementHelper.modifyTestElementUrl(ret, protocol, host, port, path);
// We need to use this logic since setPath method triggers additional logic
if (path != null) {
ret.setPath(path);
}

HttpElementHelper.modifyTestElementTimeouts(ret, connectionTimeout, responseTimeout);
HttpElementHelper.modifyTestElementProxy(ret, proxyUrl, proxyUser, proxyPassword);
return configureHttpTestElement(ret);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void shouldGenerateExpectedCodeWhenSimpleJmxIsProvided(@TempDir Path temp
throws Exception {
File solvedTemplate = solveTemplateResource("test-plan.template.jmx", tempDir);
assertThat(new DslCodeGenerator().generateCodeFromJmx(solvedTemplate))
.isEqualTo(
.isEqualToNormalizingNewlines(
solveTestClassTemplate(Collections.singleton(ContentType.class.getName()),
"SimpleTest.java"));
}
Expand All @@ -50,15 +50,15 @@ private String solveTestClassTemplate(Set<String> imports, String testPlanCodeRe
public void shouldGenerateExpectedCodeWhenRecordedJmxIsProvided() throws Exception {
assertThat(new DslCodeGenerator()
.generateCodeFromJmx(new TestResource(RESOURCES_FOLDER + "/recorded.jmx").file()))
.isEqualTo(solveTestClassTemplate(Collections.singleton(StandardCharsets.class.getName()),
.isEqualToNormalizingNewlines(solveTestClassTemplate(Collections.singleton(StandardCharsets.class.getName()),
"RecordedTest.java"));
}

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static StringTemplateAssertString assertThat(String actual) {
protected abstract ErrorMessageFactory getErrorMessageFactory(List<Delta<String>> diffs);

public SELF matches(TestResource template) throws IOException {
return matches(template.rawContents());
return matches(template.rawContents().replace("\r\n", "\n"));
}

public SELF matches(String templateContents) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void shouldGenerateDslWithFragmentWhenConvertingTestPlanWithIncludeContro
buildIncludeControllerJmx(includedJmx)
));
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(buildTestPlanDsl(FRAGMENT_METHOD_CALL));
.isEqualToNormalizingNewlines(buildTestPlanDsl(FRAGMENT_METHOD_CALL));
}

private File buildIncludedTestPlanJmx(Path tmp) throws IOException {
Expand Down Expand Up @@ -69,7 +69,7 @@ public void shouldReuseFragmentWhenTestPlanWithTwoIncludesWithSameFile(@TempDir
buildIncludeControllerJmx(includedJmx)
));
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(buildTestPlanDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL));
.isEqualToNormalizingNewlines(buildTestPlanDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void shouldReuseFragmentMethodWhenModuleUsesPreviousEnabledFragment(@Temp
buildFragmentJmx(),
buildModuleJmx(DEFAULT_FRAGMENT_NAME));
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(buildFragmentPlanDsl(
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
buildThreadGroupDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
}

Expand Down Expand Up @@ -60,7 +60,7 @@ public void shouldDefineAndUseFragmentMethodWhenModuleUsesLaterEnabledFragment(
buildModuleJmx(DEFAULT_FRAGMENT_NAME),
buildFragmentJmx());
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(buildFragmentPlanDsl(
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
buildThreadGroupDsl(FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
}

Expand All @@ -72,7 +72,7 @@ public void shouldUseFragmentMethodWhenModuleUsesDisabledFragment(@TempDir Path
buildModuleJmx(DEFAULT_FRAGMENT_NAME)
);
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(buildFragmentPlanDsl(
.isEqualToNormalizingNewlines(buildFragmentPlanDsl(
"httpCookies()",
"httpCache()",
buildThreadGroupDsl("//" + FRAGMENT_METHOD_CALL, FRAGMENT_METHOD_CALL)));
Expand All @@ -85,7 +85,7 @@ public void shouldDefineAndUseMethodWhenModuleUsesPreviouslyDefinedController(@T
buildIfControllerJmx(),
buildModuleJmx(IF_CONTROLLER_DEFAULT_NAME));
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(
.isEqualToNormalizingNewlines(
buildIfControllerPlanDsl(IF_CONTROLLER_METHOD_CALL, IF_CONTROLLER_METHOD_CALL));
}

Expand All @@ -109,7 +109,7 @@ public void shouldDefineAndUseMethodWhenModuleUsesLaterDefinedController(@TempDi
buildIfControllerJmx()
);
assertThat(jmx2dsl(jmx, tmp))
.isEqualTo(
.isEqualToNormalizingNewlines(
buildIfControllerPlanDsl(IF_CONTROLLER_METHOD_CALL, IF_CONTROLLER_METHOD_CALL));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void shouldGenerateDslWithFragmentMethodWhenConvertTestPlanWithFragment(
@TempDir Path tmp) throws IOException {
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx());
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(buildFragmentMethod(), DEFAULT_FRAGMENT_METHOD_CALL));
.isEqualToNormalizingNewlines(buildTestPlanDsl(buildFragmentMethod(), DEFAULT_FRAGMENT_METHOD_CALL));
}

private String buildTestPlanDsl(String method, String child) {
Expand All @@ -79,7 +79,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentNonDefaultName(
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
String methodName = "myFragment";
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(
.isEqualToNormalizingNewlines(buildTestPlanDsl(
buildFragmentMethod(methodName, fragmentName),
methodName + "()"));
}
Expand All @@ -91,7 +91,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentWithNameStarting
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
String methodName = "fragment" + fragmentName;
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(
.isEqualToNormalizingNewlines(buildTestPlanDsl(
buildFragmentMethod(methodName, fragmentName),
methodName + "()"));
}
Expand All @@ -103,7 +103,7 @@ public void shouldGenerateDslWithFragmentNameWhenConvertFragmentWithNameWithSpec
String testPlanJmx = buildTestPlanJmx(buildFragmentJmx(fragmentName));
String methodName = "myFragment";
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(
.isEqualToNormalizingNewlines(buildTestPlanDsl(
buildFragmentMethod(methodName, fragmentName),
methodName + "()"));
}
Expand All @@ -116,7 +116,7 @@ public void shouldGenerateDslWithFragmentsWhenConvertFragmentsWithCollidingNames
buildFragmentJmx());
String methodName2 = "testFragment2";
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(
.isEqualToNormalizingNewlines(buildTestPlanDsl(
Arrays.asList(
buildFragmentMethod(),
buildFragmentMethod(methodName2, DEFAULT_FRAGMENT_NAME)),
Expand All @@ -130,7 +130,7 @@ public void shouldGenerateDslWithCommentedFragmentCallWhenConvertDisabledFragmen
String testPlanJmx = buildTestPlanJmx(buildFragmentDisabledJmx());
String cacheMethodCall = "httpCache()";
assertThat(jmx2dsl(testPlanJmx, tmp))
.isEqualTo(buildTestPlanDsl(Collections.singletonList(buildFragmentMethod()),
.isEqualToNormalizingNewlines(buildTestPlanDsl(Collections.singletonList(buildFragmentMethod()),
Arrays.asList("httpCookies()", cacheMethodCall, "//" + DEFAULT_FRAGMENT_METHOD_CALL))
.replace(cacheMethodCall + ",", cacheMethodCall + "//,"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void shouldSendMultiPartFormWhenPostRequestWithBodyParts() throws Excepti
verify(postRequestedFor(anyUrl())
.withHeader(HTTPConstants.HEADER_CONTENT_TYPE,
matching(ContentType.MULTIPART_FORM_DATA.withCharset((String) null) + "; boundary="
+ MULTIPART_BOUNDARY_PATTERN))
+ MULTIPART_BOUNDARY_PATTERN + "; charset=UTF-8"))
.withRequestBody(matching(
buildMultiPartBodyPattern(part1Name, part1Value, part1Encoding, part2Name, part2File,
part2Encoding))));
Expand Down
2 changes: 1 addition & 1 deletion jmeter-java-dsl/src/test/resources/test-plan.template.jmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="{{jmeterVersion:5.4.3~\d+\.\d+(\.\d+)?(-SNAPSHOT [0-9a-f]+)?}}">
<jmeterTestPlan version="1.2" properties="5.0" jmeter="{{jmeterVersion:5.6.3~\d+\.\d+(\.\d+)?(-SNAPSHOT [0-9a-f]+)?}}">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan">
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments">
Expand Down
Loading