From e321ab0d2acea5a70506d4805e4e623c6ca324c5 Mon Sep 17 00:00:00 2001 From: "nikita.smirnov" Date: Mon, 27 Jan 2025 14:45:14 +0400 Subject: [PATCH 1/4] Updated th2 gradle plugin `0.1.7` (bom: `4.10.0`) --- README.md | 8 +- build.gradle | 12 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 7 +- gradlew | 287 ++++++++++++++--------- gradlew.bat | 60 ++--- 6 files changed, 219 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index 413fbadba..c449b0896 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# th2 common library (Java) (5.14.0) +# th2 common library (Java) (5.15.0) ## Usage @@ -511,6 +511,12 @@ dependencies { ## Release notes +### 5.15.0-dev + ++ Updated th2 gradle plugin `0.1.7` (bom: `4.10.0`) ++ cradle: `5.4.4-dev` ++ grpc: `1.70.0` + ### 5.14.0-dev + Separate connections for publisher and consumer (allows to consume while publishing is blocked by RabbitMQ) diff --git a/build.gradle b/build.gradle index c657b1aaa..91292fcff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id "com.exactpro.th2.gradle.base" version "0.1.1" - id "com.exactpro.th2.gradle.publish" version "0.1.1" + id "com.exactpro.th2.gradle.base" version "0.1.7" + id "com.exactpro.th2.gradle.publish" version "0.1.7" id "org.jetbrains.kotlin.jvm" version "$kotlin_version" id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" id "java-library" @@ -16,12 +16,12 @@ group = 'com.exactpro.th2' version = release_version ext { - grpcVersion = '1.62.2' - protobufVersion = '3.25.3' + grpcVersion = '1.70.0' + protobufVersion = '3.25.5' serviceGeneratorVersion = '3.6.1' - cradleVersion = '5.4.1-dev' - junitVersion = '5.10.3' + cradleVersion = '5.4.4-dev' + junitVersion = '5.11.4' jmhVersion = '1.37' autoValueVersion = '1.10.4' diff --git a/gradle.properties b/gradle.properties index f8a2b4afb..7aa89bfeb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # -# Copyright 2022-2024 Exactpro (Exactpro Systems Limited) +# Copyright 2022-2025 Exactpro (Exactpro Systems Limited) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -release_version=5.14.0 +release_version=5.15.0 kotlin_version=1.8.22 description='th2 common library (Java)' vcs_url=https://github.com/th2-net/th2-common-j diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2970310cc..e2847c820 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Thu Jul 02 11:31:27 GMT+04:00 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b0d6d0ab5..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -1,13 +1,13 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -17,78 +17,111 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$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"' +# This is normally unused +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the 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. + JAVACMD=java + 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +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 fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# 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"' -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_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 \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 15e1ee37a..7101f8e46 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 +@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, @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +25,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +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" @@ -37,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +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 @@ -51,48 +55,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +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 -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :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 %CMD_LINE_ARGS% +"%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%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 From e4628ef6bbc5647fae4623b26a1cdeeeb190bc24 Mon Sep 17 00:00:00 2001 From: "nikita.smirnov" Date: Wed, 29 Jan 2025 12:13:15 +0400 Subject: [PATCH 2/4] Updated th2 gradle plugin `0.1.8` (bom dependency is specified explicitly) * Migrated to toml --- README.md | 9 ++- build.gradle | 72 ++++++++----------- .../grpc/router/AbstractGrpcInterceptor.kt | 4 +- .../configuration/ConfigurationManager.kt | 4 +- .../common/schema/factory/ExactproMetaInf.kt | 4 +- .../message/impl/OnlyOnceConfirmation.kt | 4 +- .../impl/rabbitmq/AbstractRabbitRouter.kt | 6 +- .../connection/ConsumeConnectionManager.kt | 9 ++- .../connection/PublishConnectionManager.kt | 4 +- .../RabbitMessageGroupBatchSubscriber.kt | 4 +- .../NotificationEventBatchRouter.kt | 4 +- .../NotificationEventBatchSubscriber.kt | 4 +- .../message/impl/rabbitmq/transport/Codecs.kt | 4 +- .../grpc/router/impl/DefaultGrpcRouterTest.kt | 8 ++- .../AbstractRabbitRouterIntegrationTest.kt | 6 +- .../connection/ConnectionManualBenchmark.kt | 4 +- .../connection/TestConnectionManager.kt | 8 +-- ...IntegrationTestRabbitMessageBatchRouter.kt | 6 +- ...ransportGroupBatchRouterIntegrationTest.kt | 6 +- 19 files changed, 82 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index c449b0896..a21c00d36 100644 --- a/README.md +++ b/README.md @@ -513,9 +513,12 @@ dependencies { ### 5.15.0-dev -+ Updated th2 gradle plugin `0.1.7` (bom: `4.10.0`) -+ cradle: `5.4.4-dev` -+ grpc: `1.70.0` ++ Updated: + + th2 gradle plugin `0.1.8` (bom: `4.10.0`) + + cradle: `5.4.4-dev` + + grpc: `1.70.0` ++ Migrated: + + io.github.oshai:kotlin-logging: `5.1.4` ### 5.14.0-dev diff --git a/build.gradle b/build.gradle index 91292fcff..fe25438fc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,30 +1,20 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id "com.exactpro.th2.gradle.base" version "0.1.7" - id "com.exactpro.th2.gradle.publish" version "0.1.7" - id "org.jetbrains.kotlin.jvm" version "$kotlin_version" - id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" + alias(libs.plugins.th2.publish) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.kapt) + alias(libs.plugins.protobuf) + alias(libs.plugins.jmh) id "java-library" id "java-test-fixtures" id "maven-publish" - id "com.google.protobuf" version "0.9.4" - id "me.champeau.jmh" version "0.7.2" } group = 'com.exactpro.th2' version = release_version ext { - grpcVersion = '1.70.0' - protobufVersion = '3.25.5' - serviceGeneratorVersion = '3.6.1' - - cradleVersion = '5.4.4-dev' - junitVersion = '5.11.4' - - jmhVersion = '1.37' - autoValueVersion = '1.10.4' genBaseDir = file("${buildDir}/generated/source/proto") } @@ -73,25 +63,25 @@ tasks.register('integrationTest', Test) { } dependencies { - api('com.exactpro.th2:grpc-common:4.5.0-dev') { + api(libs.th2.grpc.common) { because('protobuf transport is main now, this dependency should be moved to grpc, mq protobuf modules after splitting') } - api("com.exactpro.th2:cradle-core:$cradleVersion") { + api(libs.th2.cradle.core) { because('cradle is included into common library now, this dependency should be moved to a cradle module after splitting') } api('io.netty:netty-buffer') { because('th2 transport protocol is included into common library now, this dependency should be moved to a th2 transport module after splitting') } - jmh "org.openjdk.jmh:jmh-core:$jmhVersion" - jmh "org.openjdk.jmh:jmh-generator-annprocess:$jmhVersion" + jmh libs.jmh.core + jmh libs.jmh.generator.annprocess implementation 'com.google.protobuf:protobuf-java-util' - implementation "com.exactpro.th2:grpc-service-generator:$serviceGeneratorVersion" - implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion" + implementation libs.th2.grpc.service.generator + implementation libs.th2.cradle.cassandra - implementation "com.google.auto.value:auto-value-annotations:$autoValueVersion" - kapt("com.google.auto.value:auto-value:$autoValueVersion") { + implementation libs.auto.value.annotations + kapt(libs.auto.value) { //FIXME: Updated library because it is fat jar // auto-value-1.10.1.jar/META-INF/maven/com.google.guava/guava/pom.xml (pkg:maven/com.google.guava/guava@31.1-jre, cpe:2.3:a:google:guava:31.1:*:*:*:*:*:*:*) : CVE-2023-2976, CVE-2020-8908 } @@ -138,38 +128,38 @@ dependencies { implementation 'io.prometheus:simpleclient_httpserver' implementation 'io.prometheus:simpleclient_log4j2' - implementation("com.squareup.okio:okio:3.4.0") { + implementation(libs.okio) { because('fix vulnerability in transitive dependency ' + 'Note: kotlin:1.9 is transitive dependency since 3.5.0') } - implementation("com.squareup.okhttp3:okhttp:4.11.0") { + implementation(libs.okhttp3.okhttp) { because('fix vulnerability in transitive dependency . ' + 'Note: kotlin:1.9 is transitive dependency since 4.12.0') } - implementation('com.squareup.okhttp3:logging-interceptor:4.11.0') { + implementation(libs.okhttp3.logging.interceptor) { because('fix vulnerability in transitive dependency . ' + 'Note: kotlin:1.9 is transitive dependency since 4.12.0') } - implementation("io.fabric8:kubernetes-client:6.13.1") { + implementation(libs.kubernetes.client) { exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-yaml' } - implementation "io.github.microutils:kotlin-logging:3.0.5" + implementation libs.kotlin.logging - testImplementation 'javax.annotation:javax.annotation-api:1.3.2' - testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" - testImplementation "org.mockito.kotlin:mockito-kotlin:5.3.1" + testImplementation libs.javax.annotation.api + testImplementation libs.junit.jupiter + testImplementation libs.mockito.kotlin testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5' - testImplementation "org.testcontainers:testcontainers:1.19.8" - testImplementation "org.testcontainers:rabbitmq:1.19.8" - testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") { + testImplementation libs.testcontainers + testImplementation libs.testcontainers.rabbitmq + testImplementation(libs.junit.pioneer) { because("system property tests") } - testImplementation("org.awaitility:awaitility:4.2.1") + testImplementation libs.awaitility - testFixturesImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlin_version" - testFixturesImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" + testFixturesImplementation libs.kotlin.test.junit5 + testFixturesImplementation libs.junit.jupiter } // substitute commons-compress:1.24.0 from testcontainers:1.19.8 to version 1.26.2 @@ -178,7 +168,7 @@ configurations { configureEach { resolutionStrategy { dependencySubstitution { - substitute module('org.apache.commons:commons-compress') using module('org.apache.commons:commons-compress:1.26.2') + substitute module('org.apache.commons:commons-compress') using module("${libs.commons.compress.get()}") } } } @@ -191,14 +181,14 @@ sourceSets { protobuf { protoc { - artifact = "com.google.protobuf:protoc:$protobufVersion" + artifact = "${libs.protobuf.protoc.get()}" } plugins { grpc { - artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion" + artifact = "${libs.protoc.gen.grpc.java.get()}" } services { - artifact = "com.exactpro.th2:grpc-service-generator:$serviceGeneratorVersion:all@jar" + artifact = "${libs.th2.grpc.service.generator.get()}:all@jar" } } generateProtoTasks { diff --git a/src/main/kotlin/com/exactpro/th2/common/grpc/router/AbstractGrpcInterceptor.kt b/src/main/kotlin/com/exactpro/th2/common/grpc/router/AbstractGrpcInterceptor.kt index 95b08ac21..cd9408e6c 100644 --- a/src/main/kotlin/com/exactpro/th2/common/grpc/router/AbstractGrpcInterceptor.kt +++ b/src/main/kotlin/com/exactpro/th2/common/grpc/router/AbstractGrpcInterceptor.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Exactpro (Exactpro Systems Limited) + * Copyright 2020-2025 Exactpro (Exactpro Systems Limited) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,9 +16,9 @@ package com.exactpro.th2.common.grpc.router import com.google.protobuf.Message +import io.github.oshai.kotlinlogging.KotlinLogging import io.grpc.MethodDescriptor import io.prometheus.client.Counter -import mu.KotlinLogging abstract class AbstractGrpcInterceptor ( protected val pinName: String, diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/configuration/ConfigurationManager.kt b/src/main/kotlin/com/exactpro/th2/common/schema/configuration/ConfigurationManager.kt index f7eb10d60..90d2b99b6 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/configuration/ConfigurationManager.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/configuration/ConfigurationManager.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 Exactpro (Exactpro Systems Limited) + * Copyright 2020-2025 Exactpro (Exactpro Systems Limited) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,7 @@ package com.exactpro.th2.common.schema.configuration import com.fasterxml.jackson.databind.ObjectMapper -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.apache.commons.text.StringSubstitutor import java.io.IOException import java.nio.file.Files diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt b/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt index 0295e3a23..1aa8d63f8 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package com.exactpro.th2.common.schema.factory -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import java.io.IOException import java.net.URL import java.nio.file.Path diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/OnlyOnceConfirmation.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/OnlyOnceConfirmation.kt index c76daf479..2b70da5e4 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/OnlyOnceConfirmation.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/OnlyOnceConfirmation.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 Exactpro (Exactpro Systems Limited) + * Copyright 2022-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package com.exactpro.th2.common.schema.message.impl import com.exactpro.th2.common.schema.message.ManualAckDeliveryCallback +import io.github.oshai.kotlinlogging.KotlinLogging import java.util.concurrent.atomic.AtomicBoolean -import mu.KotlinLogging class OnlyOnceConfirmation private constructor( private val id: String, diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouter.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouter.kt index beeb7d58e..cfae06a51 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouter.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2021-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ import com.exactpro.th2.common.schema.message.QueueAttribute.PUBLISH import com.exactpro.th2.common.schema.message.QueueAttribute.SUBSCRIBE import com.exactpro.th2.common.schema.message.configuration.MessageRouterConfiguration import com.exactpro.th2.common.schema.message.configuration.QueueConfiguration -import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.ConsumeConnectionManager -import mu.KotlinLogging +import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager +import io.github.oshai.kotlinlogging.KotlinLogging import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicReference diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConsumeConnectionManager.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConsumeConnectionManager.kt index 84e81e0c7..e70c32947 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConsumeConnectionManager.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConsumeConnectionManager.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024 Exactpro (Exactpro Systems Limited) + * Copyright 2024-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +23,12 @@ import com.exactpro.th2.common.schema.message.ManualAckDeliveryCallback.Confirma import com.exactpro.th2.common.schema.message.impl.OnlyOnceConfirmation.Companion.wrap import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.ConnectionManagerConfiguration import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.RabbitMQConfiguration +import com.rabbitmq.client.BlockedListener +import com.rabbitmq.client.CancelCallback import com.rabbitmq.client.Channel import com.rabbitmq.client.Delivery -import com.rabbitmq.client.CancelCallback -import com.rabbitmq.client.BlockedListener import com.rabbitmq.client.ShutdownSignalException - -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import java.io.IOException import java.util.concurrent.ExecutorService import java.util.concurrent.ScheduledExecutorService diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/PublishConnectionManager.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/PublishConnectionManager.kt index 7f6d2feb1..4afae4c0c 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/PublishConnectionManager.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/PublishConnectionManager.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024 Exactpro (Exactpro Systems Limited) + * Copyright 2024-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.Rabbit import com.rabbitmq.client.AMQP import com.rabbitmq.client.BlockedListener import com.rabbitmq.client.Channel -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import java.io.IOException import java.util.concurrent.ExecutorService import java.util.concurrent.ScheduledExecutorService diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/RabbitMessageGroupBatchSubscriber.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/RabbitMessageGroupBatchSubscriber.kt index 3a3aeea35..933879b95 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/RabbitMessageGroupBatchSubscriber.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/RabbitMessageGroupBatchSubscriber.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2020-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,9 +37,9 @@ import com.exactpro.th2.common.schema.message.toShortDebugString import com.google.protobuf.CodedInputStream import com.google.protobuf.Message import com.rabbitmq.client.Delivery +import io.github.oshai.kotlinlogging.KotlinLogging import io.prometheus.client.Counter import io.prometheus.client.Gauge -import mu.KotlinLogging class RabbitMessageGroupBatchSubscriber( consumeConnectionManager: ConsumeConnectionManager, diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchRouter.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchRouter.kt index 619788469..bad80635b 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchRouter.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchRouter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 Exactpro (Exactpro Systems Limited) + * Copyright 2021-2025 Exactpro (Exactpro Systems Limited) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +22,7 @@ import com.exactpro.th2.common.schema.message.MessageListener import com.exactpro.th2.common.schema.message.MessageRouterContext import com.exactpro.th2.common.schema.message.NotificationRouter import com.exactpro.th2.common.schema.message.SubscriberMonitor -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging const val NOTIFICATION_QUEUE_PREFIX = "global-notification-queue" diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchSubscriber.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchSubscriber.kt index ccc21e2ce..de117ee75 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchSubscriber.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/notification/NotificationEventBatchSubscriber.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2021-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import com.exactpro.th2.common.schema.message.MessageSubscriber import com.exactpro.th2.common.schema.message.SubscriberMonitor import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.ConsumeConnectionManager import com.rabbitmq.client.Delivery -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import java.util.concurrent.CopyOnWriteArrayList // DRAFT of notification router diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/Codecs.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/Codecs.kt index 03565ce13..9e94e4887 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/Codecs.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/Codecs.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,11 @@ import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import io.github.oshai.kotlinlogging.KotlinLogging import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBufInputStream import io.netty.buffer.ByteBufOutputStream import io.netty.buffer.ByteBufUtil -import mu.KotlinLogging import java.io.OutputStream import java.nio.charset.Charset import java.time.Instant diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/grpc/router/impl/DefaultGrpcRouterTest.kt b/src/test/kotlin/com/exactpro/th2/common/schema/grpc/router/impl/DefaultGrpcRouterTest.kt index 17de2cd62..230fce315 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/grpc/router/impl/DefaultGrpcRouterTest.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/grpc/router/impl/DefaultGrpcRouterTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2025 Exactpro (Exactpro Systems Limited) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,11 +31,11 @@ import com.exactpro.th2.common.test.grpc.TestService import com.exactpro.th2.service.AbstractGrpcService.MID_TRANSFER_FAILURE_EXCEPTION_MESSAGE import com.exactpro.th2.service.AbstractGrpcService.ROOT_RETRY_SYNC_EXCEPTION_MESSAGE import com.exactpro.th2.service.AbstractGrpcService.STATUS_DESCRIPTION_OF_INTERRUPTED_REQUEST +import io.github.oshai.kotlinlogging.KotlinLogging import io.grpc.Context import io.grpc.Deadline import io.grpc.Server import io.grpc.stub.StreamObserver -import mu.KotlinLogging import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Disabled @@ -954,7 +954,9 @@ internal class DefaultGrpcRouterTest { ) { val expectedMessage = exceptionMetadata.message assertTrue( - exception.message == expectedMessage || exception.message?.startsWith(expectedMessage ?: "null") == true, + exception.message == expectedMessage || exception.message?.startsWith( + expectedMessage ?: "null" + ) == true, "Message for exception: $exception, path: ${path.printAsStackTrace()}" ) exceptionMetadata.suspended?.let { suspendMetadataList -> diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouterIntegrationTest.kt b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouterIntegrationTest.kt index 99486d023..0ddb89bea 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouterIntegrationTest.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/AbstractRabbitRouterIntegrationTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,13 @@ import com.exactpro.th2.common.schema.message.configuration.MessageRouterConfigu import com.exactpro.th2.common.schema.message.configuration.QueueConfiguration import com.exactpro.th2.common.schema.message.impl.context.DefaultMessageRouterContext import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.ConnectionManagerConfiguration -import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.ConsumeConnectionManager +import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.schema.message.impl.rabbitmq.custom.RabbitCustomRouter import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.google.common.util.concurrent.ThreadFactoryBuilder import com.rabbitmq.client.BuiltinExchangeType -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.junit.jupiter.api.Assertions.assertNull import org.mockito.kotlin.mock import org.testcontainers.containers.RabbitMQContainer diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConnectionManualBenchmark.kt b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConnectionManualBenchmark.kt index e216507a1..f60ea1202 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConnectionManualBenchmark.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/ConnectionManualBenchmark.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024 Exactpro (Exactpro Systems Limited) + * Copyright 2024-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import com.exactpro.th2.common.schema.message.ContainerConstants.RABBITMQ_IMAGE_ import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.ConnectionManagerConfiguration import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.google.common.util.concurrent.ThreadFactoryBuilder -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.testcontainers.containers.RabbitMQContainer import java.time.Duration import java.util.concurrent.Executors diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/TestConnectionManager.kt b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/TestConnectionManager.kt index 3e9cd94ca..cfe91a008 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/TestConnectionManager.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/connection/TestConnectionManager.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2022-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,15 +29,15 @@ import com.exactpro.th2.common.util.declareFanoutExchangeWithBinding import com.exactpro.th2.common.util.declareQueue import com.exactpro.th2.common.util.getChannelsInfo import com.exactpro.th2.common.util.getQueuesInfo +import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.exactpro.th2.common.util.getSubscribedChannelsCount import com.exactpro.th2.common.util.putMessageInQueue -import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.github.dockerjava.api.model.Capability import com.google.common.util.concurrent.ThreadFactoryBuilder import com.rabbitmq.client.BuiltinExchangeType import com.rabbitmq.client.CancelCallback import com.rabbitmq.client.Delivery -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.awaitility.Awaitility import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterEach @@ -46,9 +46,9 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertDoesNotThrow import org.slf4j.LoggerFactory import org.testcontainers.containers.GenericContainer import org.testcontainers.containers.RabbitMQContainer diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/IntegrationTestRabbitMessageBatchRouter.kt b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/IntegrationTestRabbitMessageBatchRouter.kt index f5a6bb202..ee69b1945 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/IntegrationTestRabbitMessageBatchRouter.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/group/IntegrationTestRabbitMessageBatchRouter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2022-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,12 +28,12 @@ import com.exactpro.th2.common.schema.message.ContainerConstants.ROUTING_KEY import com.exactpro.th2.common.schema.message.configuration.MessageRouterConfiguration import com.exactpro.th2.common.schema.message.impl.context.DefaultMessageRouterContext import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.ConnectionManagerConfiguration -import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.ConsumeConnectionManager +import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.google.common.util.concurrent.ThreadFactoryBuilder import com.rabbitmq.client.BuiltinExchangeType -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.junit.jupiter.api.Test import org.mockito.kotlin.mock import org.testcontainers.containers.RabbitMQContainer diff --git a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/TransportGroupBatchRouterIntegrationTest.kt b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/TransportGroupBatchRouterIntegrationTest.kt index 500c5be6b..61599feaa 100644 --- a/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/TransportGroupBatchRouterIntegrationTest.kt +++ b/src/test/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/TransportGroupBatchRouterIntegrationTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2025 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,12 @@ import com.exactpro.th2.common.schema.message.ContainerConstants.ROUTING_KEY import com.exactpro.th2.common.schema.message.configuration.MessageRouterConfiguration import com.exactpro.th2.common.schema.message.impl.context.DefaultMessageRouterContext import com.exactpro.th2.common.schema.message.impl.rabbitmq.configuration.ConnectionManagerConfiguration -import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.ConsumeConnectionManager +import com.exactpro.th2.common.schema.message.impl.rabbitmq.connection.PublishConnectionManager import com.exactpro.th2.common.util.getRabbitMQConfiguration import com.google.common.util.concurrent.ThreadFactoryBuilder import com.rabbitmq.client.BuiltinExchangeType -import mu.KotlinLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.junit.jupiter.api.Test import org.mockito.kotlin.mock import org.testcontainers.containers.RabbitMQContainer From a5ee55b84aee959659db7523ba6e8510740a7241 Mon Sep 17 00:00:00 2001 From: "nikita.smirnov" Date: Wed, 29 Jan 2025 12:15:15 +0400 Subject: [PATCH 3/4] Added toml file --- gradle/libs.versions.toml | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 gradle/libs.versions.toml diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..3db4660c9 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,52 @@ +[versions] +kotlin = "1.8.22" +protobuf = "3.25.5" # gRPC 1.66 libraries uses protobuf 3.+ +cradle = "5.4.4-dev" +grpc-service-genrator = "3.6.1" +jmh = "1.37" +okhttp = "4.11.0" +testcontainers = "1.19.8" +auto-value = "1.10.4" + +[libraries] +jmh-core = { group = "org.openjdk.jmh", name = "jmh-core", version.ref = "jmh" } +jmh-generator-annprocess = { group = "org.openjdk.jmh", name = "jmh-generator-annprocess", version.ref = "jmh" } + +protoc-gen-grpc-java = { group = "io.grpc", name = "protoc-gen-grpc-java", version = "1.70.0" } +protobuf-protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protobuf" } + +auto-value-annotations = { group = "com.google.auto.value", name = "auto-value-annotations", version.ref = "auto-value" } +auto-value = { group = "com.google.auto.value", name = "auto-value", version.ref = "auto-value" } + +java-uuid-generator = { group = "com.fasterxml.uuid", name = "java-uuid-generator", version = "5.1.0" } + +kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version = "5.1.4" } +kotlin-test-junit5 = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit5", version.ref = "kotlin" } + +commons-compress = { group = "org.apache.commons", name = "commons-compress", version = "1.26.2" } + +okio = { group = "com.squareup.okio", name = "okio", version = "3.4.0" } +okhttp3-okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } +okhttp3-logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } +kubernetes-client = { group = "io.fabric8", name = "kubernetes-client", version = "6.13.1" } + +th2-grpc-common = { group = "com.exactpro.th2", name = "grpc-common", version = "4.5.0-dev" } +th2-grpc-service-generator = { group = "com.exactpro.th2", name = "grpc-service-generator", version.ref = "grpc-service-genrator" } + +th2-cradle-core = { group = "com.exactpro.th2", name = "cradle-core", version.ref = "cradle" } +th2-cradle-cassandra = { group = "com.exactpro.th2", name = "cradle-cassandra", version.ref = "cradle" } + +junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.11.4" } +javax-annotation-api = { group = "javax.annotation", name = "javax.annotation-api", version = "1.3.2" } +mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version = "5.3.1" } +testcontainers = { group = "org.testcontainers", name = "testcontainers", version.ref = "testcontainers" } +testcontainers-rabbitmq = { group = "org.testcontainers", name = "rabbitmq", version.ref = "testcontainers" } +junit-pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version = "2.2.0" } +awaitility = { group = "org.awaitility", name = "awaitility", version = "4.2.1" } + +[plugins] +th2-publish = { id = "com.exactpro.th2.gradle.publish", version = "0.1.8" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +protobuf = { id = "com.google.protobuf", version = "0.9.4" } +jmh = { id = "me.champeau.jmh", version = "0.7.2" } \ No newline at end of file From 9c5d319319e0a9ebba3677699df5c6225184272a Mon Sep 17 00:00:00 2001 From: "nikita.smirnov" Date: Thu, 30 Jan 2025 11:40:46 +0400 Subject: [PATCH 4/4] Updated grpc-service-generator:3.7.0 --- .github/dependabot.yml | 4 ++-- README.md | 1 + gradle/libs.versions.toml | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8094d15dd..093de141d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,7 +8,7 @@ updates: schedule: interval: "daily" allow: - # Allow updates for Exactpro packages - - dependency-name: "com.exactpro*" + - dependency-name: '*' + dependency-type: production # Allow up to 10 open pull requests open-pull-requests-limit: 10 diff --git a/README.md b/README.md index a21c00d36..d7282a545 100644 --- a/README.md +++ b/README.md @@ -517,6 +517,7 @@ dependencies { + th2 gradle plugin `0.1.8` (bom: `4.10.0`) + cradle: `5.4.4-dev` + grpc: `1.70.0` + + grpc-service-generator: `3.7.0` + Migrated: + io.github.oshai:kotlin-logging: `5.1.4` diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3db4660c9..9513d9e7f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,6 @@ kotlin = "1.8.22" protobuf = "3.25.5" # gRPC 1.66 libraries uses protobuf 3.+ cradle = "5.4.4-dev" -grpc-service-genrator = "3.6.1" jmh = "1.37" okhttp = "4.11.0" testcontainers = "1.19.8" @@ -31,7 +30,7 @@ okhttp3-logging-interceptor = { group = "com.squareup.okhttp3", name = "logging- kubernetes-client = { group = "io.fabric8", name = "kubernetes-client", version = "6.13.1" } th2-grpc-common = { group = "com.exactpro.th2", name = "grpc-common", version = "4.5.0-dev" } -th2-grpc-service-generator = { group = "com.exactpro.th2", name = "grpc-service-generator", version.ref = "grpc-service-genrator" } +th2-grpc-service-generator = { group = "com.exactpro.th2", name = "grpc-service-generator", version = "3.7.0" } th2-cradle-core = { group = "com.exactpro.th2", name = "cradle-core", version.ref = "cradle" } th2-cradle-cassandra = { group = "com.exactpro.th2", name = "cradle-cassandra", version.ref = "cradle" }