Skip to content

Commit

Permalink
Merge branch 'master' into add-fail-regex-extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
jvangaalen committed Nov 8, 2024
2 parents 07cda84 + 872112b commit 6d26e75
Show file tree
Hide file tree
Showing 39 changed files with 263 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ matrix.setNamePattern(['java_version', 'java_distribution', 'hash', 'os', 'tz',

// Semeru uses OpenJ9 jit which has no option for making hash codes the same
matrix.exclude({java_distribution: {value: 'semeru'}, hash: {value: 'same'}});
// MacOS and Oracle Java does not work currently. No JAVA_HOME_${VERSION}_x64 set and thus no java found
matrix.exclude({os: 'macos-latest', java_distribution: {value: 'oracle'}})
// Ignore builds with JAVA EA for now, see https://github.com/apache/jmeter/issues/6114
matrix.exclude({java_version: eaJava})
matrix.imply({java_version: eaJava}, {java_distribution: {value: 'oracle'}})
Expand Down
2 changes: 1 addition & 1 deletion bin/jmeter.properties
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ wmlParser.types=text/vnd.wap.wml
# Database validation query
# based in https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases list
jdbc.config.check.query=select 1 from INFORMATION_SCHEMA.SYSTEM_USERS|select 1 from dual|select 1 from sysibm.sysdummy1|select 1|select 1 from rdb$database
jdbc.config.jdbc.driver.class=com.mysql.jdbc.Driver|org.postgresql.Driver|oracle.jdbc.OracleDriver|com.ingres.jdbc.IngresDriver|com.microsoft.sqlserver.jdbc.SQLServerDriver|com.microsoft.jdbc.sqlserver.SQLServerDriver|org.apache.derby.jdbc.ClientDriver|org.hsqldb.jdbc.JDBCDriver|com.ibm.db2.jcc.DB2Driver|org.apache.derby.jdbc.ClientDriver|org.h2.Driver|org.firebirdsql.jdbc.FBDriver|org.mariadb.jdbc.Driver|org.sqlite.JDBC|net.sourceforge.jtds.jdbc.Driver|com.exasol.jdbc.EXADriver
jdbc.config.jdbc.driver.class=com.mysql.cj.jdbc.Driver|com.mysql.jdbc.Driver|org.postgresql.Driver|oracle.jdbc.OracleDriver|com.ingres.jdbc.IngresDriver|com.microsoft.sqlserver.jdbc.SQLServerDriver|com.microsoft.jdbc.sqlserver.SQLServerDriver|org.apache.derby.jdbc.ClientDriver|org.hsqldb.jdbc.JDBCDriver|com.ibm.db2.jcc.DB2Driver|org.apache.derby.jdbc.ClientDriver|org.h2.Driver|org.firebirdsql.jdbc.FBDriver|org.mariadb.jdbc.Driver|org.sqlite.JDBC|net.sourceforge.jtds.jdbc.Driver|com.exasol.jdbc.EXADriver

#---------------------------------------------------------------------------
# OS Process Sampler configuration
Expand Down
2 changes: 1 addition & 1 deletion bin/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
~ limitations under the License.
-->

<Configuration status="WARN" packages="org.apache.jmeter.gui.logging">
<Configuration status="WARN">

<Appenders>
<!-- Uncomment to set rotating logs up to 5 files of 100 MB-->
Expand Down
2 changes: 1 addition & 1 deletion bin/testfiles/JDBC_TESTS.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ JDBC_SELECT_LIMIT_RESULTSET_1,200,OK,TG-OK 1-1,text,true,1,1,1,0
JDBC_SELECT_LIMIT_RESULTSET_2,200,OK,TG-OK 1-1,text,true,1,1,1,0
JDBC_SELECT_LIMIT_RESULTSET_3,200,OK,TG-OK 1-1,text,true,1,1,1,0
JDBC_SELECT_LIMIT_RESULTSET_4,200,OK,TG-OK 1-1,text,true,1,1,1,0
JDBC_NoConfig,000,java.lang.IllegalArgumentException: Name for DataSoure must not be empty in JDBC_NoConfig,TG-Errors 2-1,text,true,1,1,1,0
JDBC_NoConfig,000,java.lang.IllegalArgumentException: Name for DataSource must not be empty in JDBC_NoConfig,TG-Errors 2-1,text,true,1,1,1,0
JDBC_Wrong_Sql,42581 -5581,java.sql.SQLSyntaxErrorException: unexpected token: WHERE,TG-Errors 2-1,text,true,1,1,1,0
JDBC_With_Failing_PreProcessor,200,OK,TG-Errors 2-1,text,true,1,1,1,0
JDBC_With_Failing_PostProcessor,200,OK,TG-Errors 2-1,text,true,1,1,1,0
10 changes: 5 additions & 5 deletions bin/testfiles/JDBC_TESTS.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def user = &apos;SA&apos;
def password = &apos;&apos;
def driver = &apos;org.hsqldb.jdbcDriver&apos;
def sql = Sql.newInstance(url, user, password, driver)
def row = sql.firstRow(&apos;select count(*) from INFORMATION_SCHEMA.system_sessions&apos;)
def row = sql.firstRow(&apos;select count(*) from INFORMATION_SCHEMA.system_sessions&apos;)
def sessionNum = row[0]

try {
Expand Down Expand Up @@ -164,7 +164,7 @@ sql.close()
title VARCHAR(50) NOT NULL,
author VARCHAR(20) NOT NULL,
submission_date DATE,
PRIMARY KEY (id)
PRIMARY KEY (id)
);

</stringProp>
Expand Down Expand Up @@ -196,7 +196,7 @@ sql.close()
BEGIN ATOMIC
DECLARE result CURSOR FOR SELECT * FROM USERS WHERE ID = IDENTITY();
INSERT INTO USERS VALUES (DEFAULT, title, author, CURRENT_DATE);
OPEN result;
OPEN result;
END ;</stringProp>
<stringProp name="queryArguments"></stringProp>
<stringProp name="queryArgumentsTypes"></stringProp>
Expand Down Expand Up @@ -225,7 +225,7 @@ sql.close()
MODIFIES SQL DATA DYNAMIC RESULT SETS 1
BEGIN ATOMIC
DECLARE result CURSOR FOR SELECT * FROM USERS order by id FOR READ ONLY;
OPEN result;
OPEN result;
END ;</stringProp>
<stringProp name="queryArguments"></stringProp>
<stringProp name="queryArgumentsTypes"></stringProp>
Expand Down Expand Up @@ -1284,7 +1284,7 @@ if (list.size()==3) {
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="-1643270117">Name for DataSoure must not be empty in JDBC_NoConfig</stringProp>
<stringProp name="-1643270117">Name for DataSource must not be empty in JDBC_NoConfig</stringProp>
</collectionProp>
<stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
<boolProp name="Assertion.assume_success">true</boolProp>
Expand Down
2 changes: 1 addition & 1 deletion bin/testfiles/JDBC_TESTS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
<error>false</error>
</assertionResult>
</sample>
<sample s="true" lb="JDBC_NoConfig" rc="000" rm="java.lang.IllegalArgumentException: Name for DataSoure must not be empty in JDBC_NoConfig" tn="TG-Errors 2-1" dt="text" sc="1" ec="0" ng="1" na="1">
<sample s="true" lb="JDBC_NoConfig" rc="000" rm="java.lang.IllegalArgumentException: Name for DataSource must not be empty in JDBC_NoConfig" tn="TG-Errors 2-1" dt="text" sc="1" ec="0" ng="1" na="1">
<assertionResult>
<name>Response Assertion</name>
<failure>false</failure>
Expand Down
4 changes: 2 additions & 2 deletions bin/testfiles/ResponseDecompression.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">true</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ tasks.withType<AbstractArchiveTask>().configureEach {
// Ensure builds are reproducible
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
dirMode = "775".toInt(8)
fileMode = "664".toInt(8)
filePermissions {
unix("rw-r--r--")
}
dirPermissions {
unix("rwxr-xr-x")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ java {
withSourcesJar()
}

val archivesBaseName = when (name) {
// We maintain the file names for backward compatibility
val archiveName = when (name) {
"jorphan", "bshclient" -> name
"launcher" -> "ApacheJMeter"
else -> "ApacheJMeter_$name"
}
setProperty("archivesBaseName", archivesBaseName)

base {
archivesName = archiveName
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = archivesBaseName
artifactId = archiveName
from(components["java"])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ plugins {
id("build-logic.publish-to-central")
}

val archivesBaseName = "ApacheJMeter_$name"
setProperty("archivesBaseName", archivesBaseName)
val archiveName = "ApacheJMeter_$name"

base {
archivesName = archiveName
}

publishing {
publications {
create<MavenPublication>("mavenJavaPlatform") {
artifactId = archivesBaseName
artifactId = archiveName
from(components["javaPlatform"])
}
}
Expand Down
5 changes: 5 additions & 0 deletions build-logic/root-build/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ plugins {
}

dependencies {
constraints {
api("xerces:xercesImpl:2.12.1") {
because("Some of the plugins might depend on an older version, and we want using a more recent one")
}
}
api(projects.buildParameters)
api(projects.verification)
api("com.github.vlsi.crlf:com.github.vlsi.crlf.gradle.plugin:1.90")
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public long delay() {
nextEvent = events.next();
}
long now = System.currentTimeMillis();
long testStarted = JMeterContextService.getTestStartTime();
long testStarted = JMeterContextService.getContext().getThreadGroup().getStartTime();
long delay = (long) (nextEvent * TimeUnit.SECONDS.toMillis(1) + testStarted - now);
if (log.isDebugEnabled()) {
log.debug("Calculated delay is {}", delay);
Expand All @@ -117,7 +117,7 @@ public long delay() {
}

private EventProducer getEventProducer() {
long testStarted = JMeterContextService.getTestStartTime();
long testStarted = JMeterContextService.getContext().getThreadGroup().getStartTime();
long prevStarted = PREV_TEST_STARTED.get();
if (prevStarted != testStarted && PREV_TEST_STARTED.compareAndSet(prevStarted, testStarted)) {
// Reset counters if we are calculating throughput for a new test, see https://github.com/apache/jmeter/issues/6165
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public abstract class SamplerResultTab implements ResultRenderer {

private static final String NL = "\n"; // $NON-NLS-1$

private static final String SPACE = " "; // $NON-NLS-1$

public static final Color SERVER_ERROR_COLOR = Color.red;

public static final Color CLIENT_ERROR_COLOR = Color.blue;
Expand Down Expand Up @@ -261,53 +263,53 @@ public void setupTabPane() {
StringBuilder statsBuff = new StringBuilder(200);
statsBuff
.append(JMeterUtils
.getResString("view_results_thread_name")) //$NON-NLS-1$
.getResString("view_results_thread_name")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getThreadName()).append(NL);
String startTime = dateFormat
.format(Instant.ofEpochMilli(sampleResult.getStartTime()));
statsBuff
.append(JMeterUtils
.getResString("view_results_sample_start")) //$NON-NLS-1$
.getResString("view_results_sample_start")).append(SPACE) //$NON-NLS-1$
.append(startTime).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_load_time")) //$NON-NLS-1$
.getResString("view_results_load_time")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getTime()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_connect_time")) //$NON-NLS-1$
.getResString("view_results_connect_time")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getConnectTime()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_latency")) //$NON-NLS-1$
.getResString("view_results_latency")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getLatency()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_size_in_bytes")) //$NON-NLS-1$
.getResString("view_results_size_in_bytes")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getBytesAsLong()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_sent_bytes")) //$NON-NLS-1$
.getResString("view_results_sent_bytes")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getSentBytes()).append(NL);
statsBuff
.append(JMeterUtils.getResString(
"view_results_size_headers_in_bytes")) //$NON-NLS-1$
"view_results_size_headers_in_bytes")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getHeadersSize()).append(NL);
statsBuff
.append(JMeterUtils.getResString(
"view_results_size_body_in_bytes")) //$NON-NLS-1$
"view_results_size_body_in_bytes")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getBodySizeAsLong()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_sample_count")) //$NON-NLS-1$
.getResString("view_results_sample_count")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getSampleCount()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_error_count")) //$NON-NLS-1$
.getResString("view_results_error_count")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getErrorCount()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_datatype")) //$NON-NLS-1$
.getResString("view_results_datatype")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getDataType()).append(NL);
statsDoc.insertString(statsDoc.getLength(),
statsBuff.toString(), null);
Expand Down
17 changes: 17 additions & 0 deletions src/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.github.autostyle.gradle.AutostyleTask
import com.github.vlsi.gradle.ide.IdeExtension
import java.util.jar.JarFile

plugins {
id("java-test-fixtures")
Expand Down Expand Up @@ -45,6 +46,9 @@ dependencies {
api("org.apache.logging.log4j:log4j-core") {
because("GuiLogEventAppender is using log4j-core to implement GUI-based log appender")
}
kapt("org.apache.logging.log4j:log4j-core") {
because("Generates a plugin cache file for GuiLogEventAppender")
}
api("org.apache.logging.log4j:log4j-slf4j-impl") {
because("Both log4j and slf4j are included, so it makes sense to just add log4j->slf4j bridge as well")
}
Expand Down Expand Up @@ -188,3 +192,16 @@ tasks.jar {
from("$rootDir/xdocs/images/logo.svg")
}
}

// Checks the generated JAR for a Log4j plugin cache file.
tasks.jar {
doLast {
val jarFile = archiveFile.get().asFile
JarFile(jarFile).use { jar ->
val entryName = "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat"
if (jar.getJarEntry(entryName) == null) {
throw IllegalStateException("$entryName was not found in $jarFile. The entry should be generated by log4j-core annotation processor")
}
}
}
}
4 changes: 2 additions & 2 deletions src/core/src/main/java/org/apache/jmeter/JMeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ void runNonGui(String testFile, String logFile, boolean remoteStart, String remo
testListener.setStartedRemoteEngines(engines);
distributedRunner.start();
}
startUdpDdaemon(engines);
startUdpDaemon(engines);
} catch (ConfigurationException e) {
throw e;
} catch (Exception e) {
Expand Down Expand Up @@ -1379,7 +1379,7 @@ public static boolean isNonGUI(){
return "true".equals(System.getProperty(JMeter.JMETER_NON_GUI)); //$NON-NLS-1$
}

private static void startUdpDdaemon(final List<? extends JMeterEngine> engines) {
private static void startUdpDaemon(final List<? extends JMeterEngine> engines) {
int port = JMeterUtils.getPropDefault("jmeterengine.nongui.port", UDP_PORT_DEFAULT); // $NON-NLS-1$
int maxPort = JMeterUtils.getPropDefault("jmeterengine.nongui.maxport", 4455); // $NON-NLS-1$
if (port > 1000){
Expand Down
Loading

0 comments on commit 6d26e75

Please sign in to comment.