diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f..1b33c55ba 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5dc..d4081da47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6c..23d15a936 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/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/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,22 +133,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,16 +200,20 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index f127cfd49..5eed7ee84 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,91 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -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. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@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 ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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 + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/marklogic-client-api-functionaltests/build.gradle b/marklogic-client-api-functionaltests/build.gradle index c1e53fd8f..c12d6085f 100755 --- a/marklogic-client-api-functionaltests/build.gradle +++ b/marklogic-client-api-functionaltests/build.gradle @@ -33,8 +33,12 @@ dependencies { } testImplementation 'ch.qos.logback:logback-classic:1.3.15' - testImplementation 'org.junit.jupiter:junit-jupiter:5.11.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4' testImplementation 'org.xmlunit:xmlunit-legacy:2.10.0' + + // Without this, once using JUnit 5.12 or higher, Gradle will not find any tests and report an error of: + // org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests + testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4" } tasks.register("runFragileTests", Test) { diff --git a/marklogic-client-api/build.gradle b/marklogic-client-api/build.gradle index bc6c188ee..b2bfdd46d 100644 --- a/marklogic-client-api/build.gradle +++ b/marklogic-client-api/build.gradle @@ -39,7 +39,8 @@ dependencies { compileOnly 'org.dom4j:dom4j:2.1.4' compileOnly 'com.google.code.gson:gson:2.10.1' - testImplementation 'org.junit.jupiter:junit-jupiter:5.11.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4' + // Forcing junit version to avoid vulnerability with older version in xmlunit testImplementation 'junit:junit:4.13.2' testImplementation 'org.xmlunit:xmlunit-legacy:2.10.0' @@ -64,17 +65,18 @@ dependencies { // Using this to avoid a schema validation issue with the regular xercesImpl testImplementation 'org.opengis.cite.xerces:xercesImpl-xsd11:2.12-beta-r1667115' - testImplementation ('com.opencsv:opencsv:5.11.2') { + testImplementation('com.opencsv:opencsv:5.11.2') { // Excluding this due to a security vulnerability, and the test for the example that uses this library // passes without this on the classpath. exclude module: "commons-beanutils" } testImplementation 'org.skyscreamer:jsonassert:1.5.3' - // Commenting out for now as it prevents tests from being runnable in Intellij. // Automatic loading of test framework implementation dependencies is deprecated. // https://docs.gradle.org/current/userguide/upgrading_version_8.html#test_framework_implementation_dependencies - // testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.13.4") + // Without this, once using JUnit 5.12 or higher, Gradle will not find any tests and report an error of: + // org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests + testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4" } // Ensure that mlHost and mlPassword can override the defaults of localhost/admin if they've been modified diff --git a/ml-development-tools/build.gradle b/ml-development-tools/build.gradle index 320f1db87..2308b5c70 100644 --- a/ml-development-tools/build.gradle +++ b/ml-development-tools/build.gradle @@ -24,12 +24,6 @@ dependencies { testCompileOnly gradleTestKit() testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' - - // We need the MarkLogicVersion class, but that has no dependencies and so we exclude all dependencies from - // this, in particular to avoid vulnerabilities on Spring 5.x libraries. - testImplementation ("com.marklogic:marklogic-junit5:1.5.0") { - transitive = false - } } // Added to avoid problem where processResources fails because - somehow - the plugin properties file is getting diff --git a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt index 7cbd0e2a0..d36359417 100644 --- a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt +++ b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt @@ -393,7 +393,10 @@ ${validations.joinToString("\n"){validation -> validation.message}}""") val classDesc = servdef.get("desc")?.asText() ?: "Provides a set of operations on the database server" - val classSrc = """package ${packageName}; + val classSrc = """/* + * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. + */ +package ${packageName}; // IMPORTANT: Do not edit. This file is generated. diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/ClonedMarkLogicVersion.java b/ml-development-tools/src/test/java/com/marklogic/client/test/ClonedMarkLogicVersion.java new file mode 100644 index 000000000..b285a4632 --- /dev/null +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/ClonedMarkLogicVersion.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. + */ +package com.marklogic.client.test; + +/** + * This is cloned from the marklogic-junit5 library to avoid a dependency on that library. That library brings in + * Spring 5.x dependencies that then make Black Duck unhappy because it cannot seem to understand our Gradle config + * for excluding all dependencies of marklogic-junit5. + *
+ * This is only needed for FixMjsModulesForMarkLogic12. Eventually, we can probably only run that on MarkLogic + * 12 or higher and then remove the need for this class and for FixMjsModulesForMarkLogic12. + */ +public class ClonedMarkLogicVersion { + + // For semver releases, which started with MarkLogic 11. + private final static String SEMVER_PATTERN = "^[0-9]+\\.[0-9]+\\.[0-9]+"; + private final static String NIGHTLY_SEMVER_PATTERN = "^[0-9]+\\.[0-9]+\\.[0-9]{8}"; + + // For non-semver releases, such as MarkLogic 10 and earlier.. + private final static String MAJOR_WITH_MINOR_PATTERN = "^.*-(.+)$"; + private final static String VERSION_WITH_PATCH_PATTERN = "^.*-(.+)\\..*"; + private final static String NIGHTLY_BUILD_PATTERN = "[^-]+-(\\d{4})(\\d{2})(\\d{2})"; + + private final int major; + private final Integer minor; + private final Integer patch; + private final boolean nightly; + + public ClonedMarkLogicVersion(String version) { + if (version.matches(NIGHTLY_SEMVER_PATTERN)) { + String[] tokens = version.split("\\."); + this.major = Integer.parseInt(tokens[0]); + this.minor = Integer.parseInt(tokens[1]); + this.patch = null; + this.nightly = true; + } else if (version.matches(SEMVER_PATTERN)) { + String[] tokens = version.split("\\."); + this.major = Integer.parseInt(tokens[0]); + this.minor = Integer.parseInt(tokens[1]); + this.patch = Integer.parseInt(tokens[2]); + this.nightly = false; + } else { + this.major = Integer.parseInt(version.replaceAll("([^.]+)\\..*", "$1")); + if (version.matches(NIGHTLY_BUILD_PATTERN)) { + this.minor = null; + this.patch = null; + this.nightly = true; + } else { + this.nightly = false; + if (version.matches(MAJOR_WITH_MINOR_PATTERN)) { + if (version.matches(VERSION_WITH_PATCH_PATTERN)) { + this.minor = Integer.parseInt(version.replaceAll(VERSION_WITH_PATCH_PATTERN, "$1")); + this.patch = Integer.parseInt(version.replaceAll("^.*-(.+)\\.(.*)", "$2")); + } else { + this.minor = Integer.parseInt(version.replaceAll(MAJOR_WITH_MINOR_PATTERN, "$1")); + this.patch = null; + } + } else { + this.minor = null; + this.patch = null; + } + } + } + } + + public int getMajor() { + return major; + } + + public Integer getMinor() { + return minor; + } + + public Integer getPatch() { + return patch; + } + + public boolean isNightly() { + return nightly; + } +} diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/FixMjsModulesForMarkLogic12.java b/ml-development-tools/src/test/java/com/marklogic/client/test/FixMjsModulesForMarkLogic12.java index ded19cc46..a7127485c 100644 --- a/ml-development-tools/src/test/java/com/marklogic/client/test/FixMjsModulesForMarkLogic12.java +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/FixMjsModulesForMarkLogic12.java @@ -12,7 +12,6 @@ import com.marklogic.client.io.Format; import com.marklogic.client.io.StringHandle; import com.marklogic.client.test.dbfunction.DBFunctionTestUtil; -import com.marklogic.junit5.MarkLogicVersion; import com.networknt.schema.utils.StringUtils; /** @@ -31,7 +30,7 @@ public class FixMjsModulesForMarkLogic12 { public static void main(String[] args) { try (DatabaseClient client = DBFunctionTestUtil.makeAdminClient("java-unittest-modules")) { String version = client.newServerEval().javascript("xdmp.version()").evalAs(String.class); - if (new MarkLogicVersion(version).getMajor() < 12) { + if (new ClonedMarkLogicVersion(version).getMajor() < 12) { return; }