diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a508772bc..e89896ff7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,11 +18,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '21' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.github/workflows/manually-release.yml b/.github/workflows/manually-release.yml index 3049e696c..1d645d983 100644 --- a/.github/workflows/manually-release.yml +++ b/.github/workflows/manually-release.yml @@ -31,11 +31,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '21' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46d88c88c..ca38149fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,9 @@ on: env: GH_USER_NAME: github.actor SCRIPTS_VERSION: 5.12.0 - BOM_VERSION: 5.12.1 - MIGRATIONS_VERSION: 5.12.0 - RELEASE_VERSION: 5.12.1 + BOM_VERSION: 5.13.0 + MIGRATIONS_VERSION: 5.13.0 + RELEASE_VERSION: 5.13.0 jobs: release: @@ -23,11 +23,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '21' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/build.gradle b/build.gradle index 7cce8e7cb..d4962fd33 100644 --- a/build.gradle +++ b/build.gradle @@ -4,16 +4,16 @@ plugins { id 'io.spring.dependency-management' version '1.0.9.RELEASE' id 'java' id 'java-library' - id 'nu.studer.jooq' version '3.0.3' - id 'org.owasp.dependencycheck' version '5.3.1' + id 'org.owasp.dependencycheck' version '11.1.0' + id "org.jooq.jooq-codegen-gradle" version "${jooqVersion}" } apply from: 'project-properties.gradle' apply from: "$scriptsUrl/release-commons.gradle" apply from: "$scriptsUrl/signing.gradle" apply from: "$scriptsUrl/copy-database-scripts.gradle" -apply from: "$scriptsUrl/build-quality.gradle" -apply from: "$scriptsUrl/jacoco.gradle" +//apply from: "$scriptsUrl/build-quality.gradle" +//apply from: "$scriptsUrl/jacoco.gradle" apply from: 'jooq.gradle' repositories { @@ -24,9 +24,16 @@ repositories { } } +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +ext['spring-boot.version'] = '2.5.15' + dependencyManagement { imports { - mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:5.12.1' : 'com.epam.reportportal:commons-bom:5.12.1') + mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:5.13.0' : 'com.epam.reportportal:commons-bom:5.13.0') mavenBom('io.zonky.test.postgres:embedded-postgres-binaries-bom:16.2.0') } } @@ -35,7 +42,7 @@ dependencies { if (releaseMode) { implementation 'com.epam.reportportal:commons' } else { - implementation 'com.github.reportportal:commons:d4be022' + implementation 'com.github.reportportal:commons:develop-SNAPSHOT' } implementation 'org.springframework.security:spring-security-core' @@ -43,7 +50,7 @@ dependencies { implementation 'org.apache.tika:tika-core' //https://nvd.nist.gov/vuln/detail/CVE-2020-10683 (dom4j 2.1.3 version dependency) AND https://nvd.nist.gov/vuln/detail/CVE-2019-14900 - compile('org.springframework.boot:spring-boot-starter-data-jpa') { + api('org.springframework.boot:spring-boot-starter-data-jpa') { exclude group: 'org.hibernate', module: 'hibernate-core' } implementation 'org.springframework:spring-jdbc:5.3.33' @@ -51,31 +58,29 @@ dependencies { // //https://nvd.nist.gov/vuln/detail/CVE-2020-13692 - compile 'org.postgresql:postgresql:42.7.3' - compile 'org.jooq:jooq' - jooqRuntime 'org.postgresql:postgresql:42.7.3' + implementation 'org.postgresql:postgresql:42.7.3' + api 'org.jooq:jooq' - compile 'io.minio:minio:6.0.13' + implementation 'io.minio:minio:6.0.13' implementation group: 'org.json', name: 'json', version: '20231013' - compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' - compile 'org.hibernate.validator:hibernate-validator' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' + implementation 'org.hibernate.validator:hibernate-validator' - compile 'org.apache.commons:commons-collections4:4.4' - compile 'commons-fileupload:commons-fileupload:1.4' - compile('commons-validator:commons-validator:1.6') { + api 'org.apache.commons:commons-collections4:4.4' + api 'commons-fileupload:commons-fileupload:1.4' + api('commons-validator:commons-validator:1.6') { exclude group: 'commons-beanutils', module: 'commons-beanutils' } - compile 'org.jasypt:jasypt:1.9.3' + api 'org.jasypt:jasypt:1.9.3' - compile 'io.zonky.test:embedded-postgres:2.0.6' - //Fix CVE-2024-25710, CVE-2024-26308 - compile 'org.apache.commons:commons-compress:1.26.0' - compile 'org.flywaydb:flyway-core:6.3.1' + api 'io.zonky.test:embedded-postgres:2.0.6' + api 'org.apache.commons:commons-compress:1.26.0' + implementation 'org.flywaydb:flyway-core:6.3.1' - compile 'org.apache.jclouds.api:s3:2.5.0' - compile 'org.apache.jclouds.provider:aws-s3:2.5.0' + api 'org.apache.jclouds.api:s3:2.5.0' + implementation 'org.apache.jclouds.provider:aws-s3:2.5.0' implementation 'org.apache.jclouds.api:filesystem:2.5.0' // add lombok support @@ -86,8 +91,11 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-cache' implementation 'com.github.ben-manes.caffeine:caffeine' + testImplementation 'net.bytebuddy:byte-buddy:1.14.9' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:6.1.0' + testImplementation 'org.ow2.asm:asm:9.5' + testImplementation 'org.ow2.asm:asm-util:9.5' } @@ -112,4 +120,4 @@ tasks.withType(JavaCompile) { checkCommitNeeded.dependsOn removeScripts test.dependsOn copyTestDatabaseScripts -build.dependsOn jacocoTestReport +//build.dependsOn jacocoTestReport diff --git a/gradle.properties b/gradle.properties index 662010825..0a85bbffb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ -version=5.12.2 -lombokVersion=1.18.30 \ No newline at end of file +version=5.13.0 +lombokVersion=1.18.30 +jooqVersion=3.19.13 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar old mode 100755 new mode 100644 index cc4fdc293..a4b76b953 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 c8ce83d67..9355b4155 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Fri Mar 13 21:13:13 MSK 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d9..f5feea6d6 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/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. @@ -15,80 +15,116 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## 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/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/. +# ############################################################################## # 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 -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" +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,87 +133,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" = "true" -o "$msys" = "true" ] ; 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 +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # 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=`expr $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"' + +# 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 9618d8d96..9d21a2183 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @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 +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +27,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 +43,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 +57,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 diff --git a/jitpack.yml b/jitpack.yml index 46c852919..a20279256 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,2 +1,2 @@ jdk: - - openjdk11 \ No newline at end of file + - openjdk21 \ No newline at end of file diff --git a/jooq.gradle b/jooq.gradle index 25c643f1d..a966fdd4b 100644 --- a/jooq.gradle +++ b/jooq.gradle @@ -1,7 +1,5 @@ jooq { - version = '3.12.4' - edition = 'OSS' - sample(sourceSets.main) { + configuration { jdbc { driver = 'org.postgresql.Driver' url = 'jdbc:postgresql://localhost:5432/reportportal' @@ -47,6 +45,6 @@ jooq { } } -generateSampleJooqSchemaSource { - enabled = false -} +//generateSampleJooqSchemaSource { +// enabled = false +//} diff --git a/project-properties.gradle b/project-properties.gradle index 01c569094..2edd225bf 100755 --- a/project-properties.gradle +++ b/project-properties.gradle @@ -1,6 +1,3 @@ -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 - def commonScriptsUrl = 'https://raw.githubusercontent.com/reportportal/gradle-scripts/' def migrationsScriptsUrl = 'https://raw.githubusercontent.com/reportportal/migrations/' @@ -83,6 +80,7 @@ project.ext { (migrationsUrl + '/migrations/84_notication_update.up.sql') : 'V084__notication_update.sql', (migrationsUrl + '/migrations/86_add_retention_policy_launch.up.sql') : 'V086__add_retention_policy_launch.sql', (migrationsUrl + '/migrations/88_analytics_data_table.up.sql') : 'V088__analytics_data_table.sql', + (migrationsUrl + '/migrations/90_add_user_fields.up.sql') : 'V090__scim_user_fields.sql', ] excludeTests = [ @@ -112,5 +110,5 @@ project.ext { } wrapper { - gradleVersion = '6.0' + gradleVersion = '8.10' } diff --git a/src/main/java/com/epam/ta/reportportal/commons/ReportPortalUser.java b/src/main/java/com/epam/ta/reportportal/commons/ReportPortalUser.java index 96cec4818..e6105e0e6 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/ReportPortalUser.java +++ b/src/main/java/com/epam/ta/reportportal/commons/ReportPortalUser.java @@ -16,23 +16,22 @@ package com.epam.ta.reportportal.commons; +import static java.util.Optional.ofNullable; + +import com.epam.reportportal.rules.exception.ErrorType; import com.epam.reportportal.rules.exception.ReportPortalException; import com.epam.ta.reportportal.entity.project.ProjectRole; import com.epam.ta.reportportal.entity.user.UserRole; -import com.epam.reportportal.rules.exception.ErrorType; import com.fasterxml.jackson.annotation.JsonProperty; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; - import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.stream.Collectors; - -import static java.util.Optional.ofNullable; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; /** * ReportPortal user representation @@ -41,6 +40,8 @@ */ public class ReportPortalUser extends User { + private boolean active; + private Long userId; private UserRole userRole; @@ -51,18 +52,29 @@ public class ReportPortalUser extends User { private ReportPortalUser(String username, String password, Collection authorities, Long userId, - UserRole role, Map projectDetails, String email) { + UserRole role, Map projectDetails, String email, boolean isActive) { super(username, password, authorities); this.userId = userId; this.userRole = role; this.projectDetails = projectDetails; this.email = email; + this.active = isActive; } public static ReportPortalUserBuilder userBuilder() { return new ReportPortalUserBuilder(); } + @Override + public boolean isEnabled() { + return active; + } + + @Override + public boolean isAccountNonLocked() { + return active; + } + public Long getUserId() { return userId; } @@ -161,6 +173,7 @@ public ProjectDetails build() { public static class ReportPortalUserBuilder { + private boolean active; private String username; private String password; private Long userId; @@ -173,6 +186,11 @@ private ReportPortalUserBuilder() { } + public ReportPortalUserBuilder withActive(boolean active) { + this.active = active; + return this; + } + public ReportPortalUserBuilder withUserName(String userName) { this.username = userName; return this; @@ -193,6 +211,7 @@ public ReportPortalUserBuilder withUserDetails(UserDetails userDetails) { this.username = userDetails.getUsername(); this.password = userDetails.getPassword(); this.authorities = userDetails.getAuthorities(); + this.active = userDetails.isEnabled(); return this; } @@ -217,6 +236,7 @@ public ReportPortalUserBuilder withProjectDetails(Map pr } public ReportPortalUser fromUser(com.epam.ta.reportportal.entity.user.User user) { + this.active = user.getActive(); this.username = user.getLogin(); this.email = user.getPassword(); this.userId = user.getId(); @@ -237,7 +257,7 @@ public ReportPortalUser fromUser(com.epam.ta.reportportal.entity.user.User user) public ReportPortalUser build() { return new ReportPortalUser(username, password, authorities, userId, userRole, projectDetails, - email); + email, active); } } } diff --git a/src/main/java/com/epam/ta/reportportal/commons/querygen/CriteriaHolder.java b/src/main/java/com/epam/ta/reportportal/commons/querygen/CriteriaHolder.java index f81f50773..917bfaa9a 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/querygen/CriteriaHolder.java +++ b/src/main/java/com/epam/ta/reportportal/commons/querygen/CriteriaHolder.java @@ -16,9 +16,11 @@ package com.epam.ta.reportportal.commons.querygen; -import com.epam.reportportal.rules.exception.ErrorType; +import static com.epam.reportportal.rules.commons.validation.Suppliers.formattedSupplier; + import com.epam.reportportal.rules.commons.validation.BusinessRule; -import com.epam.reportportal.rules.commons.validation.Suppliers; +import com.epam.reportportal.rules.exception.ErrorType; +import com.epam.reportportal.rules.exception.ReportPortalException; import com.epam.ta.reportportal.commons.querygen.query.JoinEntity; import com.epam.ta.reportportal.entity.enums.IntegrationGroupEnum; import com.epam.ta.reportportal.entity.enums.LaunchModeEnum; @@ -26,7 +28,6 @@ import com.epam.ta.reportportal.entity.enums.StatusEnum; import com.epam.ta.reportportal.entity.enums.TestItemIssueGroup; import com.epam.ta.reportportal.entity.enums.TestItemTypeEnum; -import com.epam.reportportal.rules.exception.ReportPortalException; import com.epam.ta.reportportal.jooq.enums.JIntegrationGroupEnum; import com.epam.ta.reportportal.jooq.enums.JLaunchModeEnum; import com.epam.ta.reportportal.jooq.enums.JStatusEnum; @@ -41,6 +42,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.UUID; import org.apache.commons.lang3.BooleanUtils; import org.jooq.Field; import org.jooq.impl.DSL; @@ -165,7 +167,7 @@ public Object castValue(String oneValue, ErrorType errorType) { castedValue = DateTimeUtils.parseDateTimeWithOffset(oneValue); } catch (DateTimeParseException e) { throw new ReportPortalException(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid date", oneValue).get() + formattedSupplier("Cannot convert '{}' to valid date", oneValue).get() ); } } @@ -176,17 +178,17 @@ public Object castValue(String oneValue, ErrorType errorType) { Optional level = LogLevel.toLevel(oneValue); BusinessRule.expect(level, Optional::isPresent) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'LogLevel'", oneValue)); + formattedSupplier("Cannot convert '{}' to valid 'LogLevel'", oneValue)); castedValue = level.get().toInt(); BusinessRule.expect(castedValue, Objects::nonNull) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'LogLevel'", oneValue)); + formattedSupplier("Cannot convert '{}' to valid 'LogLevel'", oneValue)); } else if (JStatusEnum.class.isAssignableFrom(getDataType())) { Optional status = StatusEnum.fromValue(oneValue); BusinessRule.expect(status, Optional::isPresent) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'Status'", oneValue)); + formattedSupplier("Cannot convert '{}' to valid 'Status'", oneValue)); castedValue = JStatusEnum.valueOf(status.get().name()); } else if (JTestItemTypeEnum.class.isAssignableFrom(getDataType())) { @@ -194,7 +196,7 @@ public Object castValue(String oneValue, ErrorType errorType) { Optional itemType = TestItemTypeEnum.fromValue(oneValue); BusinessRule.expect(itemType, Optional::isPresent) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'Test item type'", + formattedSupplier("Cannot convert '{}' to valid 'Test item type'", oneValue)); castedValue = JTestItemTypeEnum.valueOf(itemType.get().name()); @@ -203,7 +205,7 @@ public Object castValue(String oneValue, ErrorType errorType) { Optional launchMode = LaunchModeEnum.findByName(oneValue); BusinessRule.expect(launchMode, Optional::isPresent) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'Launch mode'", oneValue)); + formattedSupplier("Cannot convert '{}' to valid 'Launch mode'", oneValue)); castedValue = JLaunchModeEnum.valueOf(launchMode.get().name()); } else if (JIntegrationGroupEnum.class.isAssignableFrom(getDataType())) { @@ -211,7 +213,7 @@ public Object castValue(String oneValue, ErrorType errorType) { Optional integrationGroup = IntegrationGroupEnum.findByName(oneValue); BusinessRule.expect(integrationGroup, Optional::isPresent) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'Integration group", + formattedSupplier("Cannot convert '{}' to valid 'Integration group", oneValue)); castedValue = JIntegrationGroupEnum.valueOf(integrationGroup.get().name()); @@ -219,12 +221,19 @@ public Object castValue(String oneValue, ErrorType errorType) { castedValue = TestItemIssueGroup.validate(oneValue); BusinessRule.expect(castedValue, Objects::nonNull) .verify(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid 'Issue Type'", oneValue)); + formattedSupplier("Cannot convert '{}' to valid 'Issue Type'", oneValue)); } else if (Collection.class.isAssignableFrom(getDataType())) { /* Collection doesn't stores objects as ObjectId */ castedValue = oneValue; } else if (String.class.isAssignableFrom(getDataType())) { castedValue = oneValue != null ? oneValue.trim() : null; + } else if (UUID.class.isAssignableFrom(getDataType())) { + try { + castedValue = UUID.fromString(oneValue); + } catch (IllegalArgumentException e) { + throw new ReportPortalException(errorType, + formattedSupplier("Cannot convert '{}' to valid 'UUID'", oneValue)); + } } else { castedValue = DSL.val(oneValue).cast(getDataType()); } @@ -237,7 +246,7 @@ private Long parseLong(String value, ErrorType errorType) { return Long.parseLong(value); } catch (final NumberFormatException nfe) { throw new ReportPortalException(errorType, - Suppliers.formattedSupplier("Cannot convert '{}' to valid number", value)); + formattedSupplier("Cannot convert '{}' to valid number", value)); } } diff --git a/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java b/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java index ebd0f0088..476ac32d7 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java +++ b/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java @@ -93,8 +93,10 @@ import static com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_UNIQUE_ID; import static com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_UUID; import static com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.RETRY_PARENT; +import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_ACTIVE; import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_EMAIL; import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_EXPIRED; +import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_EXTERNAL_ID; import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_FULL_NAME; import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_LAST_LOGIN; import static com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_ROLE; @@ -143,7 +145,6 @@ import com.epam.ta.reportportal.commons.querygen.query.JoinEntity; import com.epam.ta.reportportal.commons.querygen.query.QuerySupplier; import com.epam.ta.reportportal.entity.activity.Activity; -import com.epam.ta.reportportal.entity.activity.EventSubject; import com.epam.ta.reportportal.entity.dashboard.Dashboard; import com.epam.ta.reportportal.entity.enums.LogLevel; import com.epam.ta.reportportal.entity.filter.UserFilter; @@ -166,6 +167,7 @@ import java.util.Collection; import java.util.List; import java.util.Optional; +import java.util.UUID; import java.util.stream.Collectors; import org.jooq.Field; import org.jooq.JoinType; @@ -345,6 +347,11 @@ protected Field idField() { USER_TARGET(User.class, Arrays.asList( new CriteriaHolderBuilder().newBuilder(CRITERIA_ID, USERS.ID, Long.class).get(), + new CriteriaHolderBuilder().newBuilder(CRITERIA_UUID, USERS.UUID, UUID.class).get(), + new CriteriaHolderBuilder().newBuilder(CRITERIA_EXTERNAL_ID, USERS.EXTERNAL_ID, String.class) + .get(), + new CriteriaHolderBuilder().newBuilder(CRITERIA_ACTIVE, USERS.ACTIVE, Boolean.class) + .get(), new CriteriaHolderBuilder().newBuilder(CRITERIA_USER, USERS.LOGIN, String.class).get(), new CriteriaHolderBuilder().newBuilder(CRITERIA_EMAIL, USERS.EMAIL, String.class).get(), new CriteriaHolderBuilder().newBuilder(CRITERIA_FULL_NAME, USERS.FULL_NAME, String.class) @@ -372,6 +379,9 @@ protected Field idField() { protected Collection selectFields() { return Lists.newArrayList(USERS.ID, USERS.LOGIN, + USERS.UUID, + USERS.EXTERNAL_ID, + USERS.ACTIVE, USERS.FULL_NAME, USERS.TYPE, USERS.ATTACHMENT, diff --git a/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/GeneralCriteriaConstant.java b/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/GeneralCriteriaConstant.java index d0ec9e4a9..33c0459d5 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/GeneralCriteriaConstant.java +++ b/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/GeneralCriteriaConstant.java @@ -24,6 +24,8 @@ public final class GeneralCriteriaConstant { public static final String CRITERIA_ID = "id"; + + public static final String CRITERIA_UUID = "uuid"; public static final String CRITERIA_NAME = "name"; public static final String CRITERIA_SHARED = "shared"; public static final String CRITERIA_OWNER = "owner"; diff --git a/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/UserCriteriaConstant.java b/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/UserCriteriaConstant.java index f2b152924..5c4a6830d 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/UserCriteriaConstant.java +++ b/src/main/java/com/epam/ta/reportportal/commons/querygen/constant/UserCriteriaConstant.java @@ -21,6 +21,10 @@ */ public final class UserCriteriaConstant { + public static final String CRITERIA_EXTERNAL_ID = "externalId"; + + public static final String CRITERIA_ACTIVE = "active"; + public static final String CRITERIA_USER = "user"; public static final String CRITERIA_ROLE = "role"; public static final String CRITERIA_TYPE = "type"; diff --git a/src/main/java/com/epam/ta/reportportal/dao/ClusterRepository.java b/src/main/java/com/epam/ta/reportportal/dao/ClusterRepository.java index 32cc8ed06..31687eaf3 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/ClusterRepository.java +++ b/src/main/java/com/epam/ta/reportportal/dao/ClusterRepository.java @@ -47,7 +47,8 @@ public interface ClusterRepository extends ReportPortalRepository "SELECT new com.epam.reportportal.model.launch.cluster.ClusterInfoResource(c.id, c.indexId as index, c.launchId, c.message, count(cti.itemId) as matchedTests) " + "FROM Cluster c LEFT JOIN ClusterTestItem cti ON c.id = cti.clusterId " + "WHERE c.launchId = :launchId " - + "GROUP BY c.id") + + "GROUP BY c.id " + + "HAVING count(cti.itemId) > 0") Page findAllByLaunchIdWithCount(@Param("launchId") Long launchId, Pageable pageable); @Modifying diff --git a/src/main/java/com/epam/ta/reportportal/dao/UserRepository.java b/src/main/java/com/epam/ta/reportportal/dao/UserRepository.java index 55bc5f756..651d19af0 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/UserRepository.java +++ b/src/main/java/com/epam/ta/reportportal/dao/UserRepository.java @@ -63,14 +63,11 @@ Page findAllByUserTypeAndExpired(@Param("userType") UserType userType, /** * Updates user's last login value - * - * @param lastLogin Last login date * @param username User */ @Modifying(clearAutomatically = true) - @Query(value = "UPDATE users SET metadata = jsonb_set(metadata, '{metadata,last_login}', to_jsonb(extract(EPOCH FROM CAST (:lastLogin AS TIMESTAMP)) * 1000), TRUE ) WHERE login = :username", nativeQuery = true) - void updateLastLoginDate(@Param("lastLogin") Instant lastLogin, - @Param("username") String username); + @Query(value = "UPDATE users SET metadata = jsonb_set(metadata, '{metadata,last_login}', to_jsonb(round(extract(EPOCH from clock_timestamp()) * 1000)), TRUE ) WHERE login = :username", nativeQuery = true) + void updateLastLoginDate(@Param("username") String username); @Query(value = "SELECT u.login FROM users u JOIN project_user pu ON u.id = pu.user_id WHERE pu.project_id = :projectId", nativeQuery = true) List findNamesByProject(@Param("projectId") Long projectId); diff --git a/src/main/java/com/epam/ta/reportportal/dao/UserRepositoryCustomImpl.java b/src/main/java/com/epam/ta/reportportal/dao/UserRepositoryCustomImpl.java index f618feb5d..ef52f2753 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/UserRepositoryCustomImpl.java +++ b/src/main/java/com/epam/ta/reportportal/dao/UserRepositoryCustomImpl.java @@ -25,14 +25,13 @@ import static com.epam.ta.reportportal.jooq.tables.JProjectUser.PROJECT_USER; import static com.epam.ta.reportportal.jooq.tables.JUsers.USERS; +import com.epam.reportportal.rules.exception.ErrorType; +import com.epam.reportportal.rules.exception.ReportPortalException; import com.epam.ta.reportportal.commons.ReportPortalUser; import com.epam.ta.reportportal.commons.querygen.QueryBuilder; import com.epam.ta.reportportal.commons.querygen.Queryable; import com.epam.ta.reportportal.entity.project.ProjectRole; import com.epam.ta.reportportal.entity.user.User; -import com.epam.reportportal.rules.exception.ReportPortalException; - -import com.epam.reportportal.rules.exception.ErrorType; import java.util.List; import java.util.Map; import java.util.Optional; @@ -105,7 +104,7 @@ public Map findUsernamesWithProjectRolesByProjectId(Long pr @Override public Optional findUserDetails(String login) { return Optional.ofNullable(REPORTPORTAL_USER_FETCHER.apply( - dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL, + dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL, USERS.ACTIVE, PROJECT_USER.PROJECT_ID, PROJECT_USER.PROJECT_ROLE, PROJECT.NAME ).from(USERS).leftJoin(PROJECT_USER).on(USERS.ID.eq(PROJECT_USER.USER_ID)).leftJoin(PROJECT) .on(PROJECT_USER.PROJECT_ID.eq(PROJECT.ID)).where(USERS.LOGIN.eq(login)).fetch())); @@ -113,13 +112,13 @@ public Optional findUserDetails(String login) { @Override public Optional findReportPortalUser(String login) { - return dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL).from(USERS) + return dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL, USERS.ACTIVE).from(USERS) .where(USERS.LOGIN.eq(login)).fetchOptional(REPORT_PORTAL_USER_MAPPER); } @Override public Optional findReportPortalUser(Long userId) { - return dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL).from(USERS) + return dsl.select(USERS.ID, USERS.LOGIN, USERS.PASSWORD, USERS.ROLE, USERS.EMAIL, USERS.ACTIVE).from(USERS) .where(USERS.ID.eq(userId)).fetchOptional(REPORT_PORTAL_USER_MAPPER); } } diff --git a/src/main/java/com/epam/ta/reportportal/dao/util/RecordMappers.java b/src/main/java/com/epam/ta/reportportal/dao/util/RecordMappers.java index aeae7905c..8a96b1988 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/util/RecordMappers.java +++ b/src/main/java/com/epam/ta/reportportal/dao/util/RecordMappers.java @@ -359,6 +359,7 @@ public class RecordMappers { }; public static final RecordMapper REPORT_PORTAL_USER_MAPPER = r -> ReportPortalUser.userBuilder() + .withActive(r.get(USERS.ACTIVE)) .withUserName(r.get(USERS.LOGIN)) .withPassword(ofNullable(r.get(USERS.PASSWORD)).orElse("")) .withAuthorities(Collections.emptyList()) diff --git a/src/main/java/com/epam/ta/reportportal/dao/util/ResultFetchers.java b/src/main/java/com/epam/ta/reportportal/dao/util/ResultFetchers.java index 373fc6ce9..6b538c6e7 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/util/ResultFetchers.java +++ b/src/main/java/com/epam/ta/reportportal/dao/util/ResultFetchers.java @@ -373,6 +373,7 @@ record -> users.computeIfAbsent(record.get(USERS.ID), key -> record.map(USER_MAP if (!CollectionUtils.isEmpty(records)) { ReportPortalUser user = ReportPortalUser.userBuilder() .withUserName(records.get(0).get(USERS.LOGIN)) + .withActive(records.get(0).get(USERS.ACTIVE)) .withPassword(ofNullable(records.get(0).get(USERS.PASSWORD)).orElse("")) .withAuthorities(Collections.emptyList()) .withUserId(records.get(0).get(USERS.ID)) diff --git a/src/main/java/com/epam/ta/reportportal/entity/activity/ActivityAction.java b/src/main/java/com/epam/ta/reportportal/entity/activity/ActivityAction.java index 197ddb454..8c32eb123 100644 --- a/src/main/java/com/epam/ta/reportportal/entity/activity/ActivityAction.java +++ b/src/main/java/com/epam/ta/reportportal/entity/activity/ActivityAction.java @@ -72,7 +72,9 @@ public enum ActivityAction { CREATE_PROJECT("createProject"), DELETE_PROJECT("deleteProject"), BULK_DELETE_PROJECT("bulkDeleteProject"), - UPDATE_PATTERN_ANALYZER("updatePatternAnalysisSettings"); + UPDATE_PATTERN_ANALYZER("updatePatternAnalysisSettings"), + + UPDATE_INSTANCE("updateInstance"); private final String value; diff --git a/src/main/java/com/epam/ta/reportportal/entity/activity/EventObject.java b/src/main/java/com/epam/ta/reportportal/entity/activity/EventObject.java index d03168dc0..ff07e0835 100644 --- a/src/main/java/com/epam/ta/reportportal/entity/activity/EventObject.java +++ b/src/main/java/com/epam/ta/reportportal/entity/activity/EventObject.java @@ -18,6 +18,7 @@ public enum EventObject { + INSTANCE("instance"), LAUNCH("launch"), DASHBOARD("dashboard"), DEFECT_TYPE("defectType"), diff --git a/src/main/java/com/epam/ta/reportportal/entity/user/User.java b/src/main/java/com/epam/ta/reportportal/entity/user/User.java index 2c3e2208a..b44506e84 100644 --- a/src/main/java/com/epam/ta/reportportal/entity/user/User.java +++ b/src/main/java/com/epam/ta/reportportal/entity/user/User.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.util.Objects; import java.util.Set; +import java.util.UUID; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +33,23 @@ import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; /** * @author Andrei Varabyeu */ +@Getter +@Setter +@NoArgsConstructor @Entity @TypeDef(name = "meta", typeClass = Metadata.class) @Table(name = "users", schema = "public") +@DynamicInsert public class User implements Serializable { private static final long serialVersionUID = 923392981; @@ -50,6 +59,15 @@ public class User implements Serializable { @Column(name = "id", unique = true, nullable = false, precision = 64) private Long id; + @Column(name = "uuid") + private UUID uuid; + + @Column(name = "external_id") + private String externalId; + + @Column(name = "active") + private Boolean active; + @Column(name = "login") private String login; @@ -86,105 +104,6 @@ public class User implements Serializable { CascadeType.MERGE, CascadeType.REFRESH}) private Set projects = Sets.newHashSet(); - public User() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLogin() { - return this.login; - } - - public void setLogin(String login) { - this.login = login; - } - - public String getPassword() { - return this.password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - - public UserRole getRole() { - return role; - } - - public void setRole(UserRole role) { - this.role = role; - } - - public Set getProjects() { - return projects; - } - - public void setProjects(Set projects) { - this.projects = projects; - } - - public String getFullName() { - return this.fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public boolean isExpired() { - return isExpired; - } - - public void setExpired(boolean expired) { - isExpired = expired; - } - - public String getAttachment() { - return attachment; - } - - public void setAttachment(String attachment) { - this.attachment = attachment; - } - - public String getAttachmentThumbnail() { - return attachmentThumbnail; - } - - public void setAttachmentThumbnail(String attachmentThumbnail) { - this.attachmentThumbnail = attachmentThumbnail; - } - - public UserType getUserType() { - return userType; - } - - public void setUserType(UserType userType) { - this.userType = userType; - } - - public Metadata getMetadata() { - return metadata; - } - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -194,21 +113,12 @@ public boolean equals(Object o) { return false; } User user = (User) o; - return isExpired == user.isExpired && Objects.equals(id, user.id) && Objects.equals(login, - user.login) && Objects.equals(password, - user.password - ) && Objects.equals(email, user.email) && role == user.role && Objects.equals(fullName, - user.fullName) && Objects.equals(metadata, - user.metadata - ) && Objects.equals(attachment, user.attachment) && Objects.equals(attachmentThumbnail, - user.attachmentThumbnail) - && userType == user.userType; + return Objects.equals(id, user.id) && Objects.equals(uuid, user.uuid) + && Objects.equals(login, user.login) && Objects.equals(email, user.email); } @Override public int hashCode() { - return Objects.hash(id, login, password, email, role, fullName, isExpired, metadata, attachment, - attachmentThumbnail, userType); + return Objects.hash(id, uuid, login, email); } - } diff --git a/src/main/java/com/epam/ta/reportportal/entity/user/UserType.java b/src/main/java/com/epam/ta/reportportal/entity/user/UserType.java index 7f7a10d4f..d4eeea858 100644 --- a/src/main/java/com/epam/ta/reportportal/entity/user/UserType.java +++ b/src/main/java/com/epam/ta/reportportal/entity/user/UserType.java @@ -31,7 +31,9 @@ public enum UserType { UPSA, GITHUB, LDAP, - SAML; + SAML, + + SCIM; //@formatter:on public static UserType getByName(String type) { diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JActivity.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JActivity.java index e631cc433..50d7d788d 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JActivity.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JActivity.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JActivity extends TableImpl { - private static final long serialVersionUID = 1836644654; + private static final long serialVersionUID = 946186659; /** * The reference instance of public.activity diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAnalyticsData.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAnalyticsData.java index 5c7db06a8..72305f755 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAnalyticsData.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAnalyticsData.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JAnalyticsData extends TableImpl { - private static final long serialVersionUID = -1928480576; + private static final long serialVersionUID = 282420139; /** * The reference instance of public.analytics_data diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JApiKeys.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JApiKeys.java index 19accc2d3..b088e630c 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JApiKeys.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JApiKeys.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JApiKeys extends TableImpl { - private static final long serialVersionUID = -1384819830; + private static final long serialVersionUID = -859604491; /** * The reference instance of public.api_keys diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachment.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachment.java index a73f6715d..0ab47366d 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachment.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachment.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JAttachment extends TableImpl { - private static final long serialVersionUID = -2060499086; + private static final long serialVersionUID = 116419815; /** * The reference instance of public.attachment diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachmentDeletion.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachmentDeletion.java index 577ddae94..e29fcf614 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachmentDeletion.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JAttachmentDeletion.java @@ -43,7 +43,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JAttachmentDeletion extends TableImpl { - private static final long serialVersionUID = 466997915; + private static final long serialVersionUID = 2100753798; /** * The reference instance of public.attachment_deletion diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JDashboard.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JDashboard.java index bd61f7b24..3220b56e3 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JDashboard.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JDashboard.java @@ -43,7 +43,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JDashboard extends TableImpl { - private static final long serialVersionUID = 1541902098; + private static final long serialVersionUID = 396879431; /** * The reference instance of public.dashboard diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegration.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegration.java index 1314b8972..5c3c5ad5a 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegration.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegration.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JIntegration extends TableImpl { - private static final long serialVersionUID = 514650851; + private static final long serialVersionUID = -1251108530; /** * The reference instance of public.integration diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegrationType.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegrationType.java index 6023b11b4..800259f6b 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegrationType.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JIntegrationType.java @@ -47,7 +47,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JIntegrationType extends TableImpl { - private static final long serialVersionUID = 1851238148; + private static final long serialVersionUID = 884680057; /** * The reference instance of public.integration_type diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JLaunch.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JLaunch.java index d110cb7f0..772dba983 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JLaunch.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JLaunch.java @@ -47,7 +47,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JLaunch extends TableImpl { - private static final long serialVersionUID = 1239960135; + private static final long serialVersionUID = -860672068; /** * The reference instance of public.launch diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JLog.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JLog.java index af61fd317..de5e6009a 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JLog.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JLog.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JLog extends TableImpl { - private static final long serialVersionUID = -540189389; + private static final long serialVersionUID = 2006866472; /** * The reference instance of public.log diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JOnboarding.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JOnboarding.java index f53f8518c..ba416953b 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JOnboarding.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JOnboarding.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JOnboarding extends TableImpl { - private static final long serialVersionUID = -2033029058; + private static final long serialVersionUID = 1642783657; /** * The reference instance of public.onboarding diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JProject.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JProject.java index 34b593aaf..a45f92e2a 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JProject.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JProject.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JProject extends TableImpl { - private static final long serialVersionUID = -1619671757; + private static final long serialVersionUID = 1861656734; /** * The reference instance of public.project diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JRestorePasswordBid.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JRestorePasswordBid.java index e064cf1f1..34391445b 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JRestorePasswordBid.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JRestorePasswordBid.java @@ -43,7 +43,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JRestorePasswordBid extends TableImpl { - private static final long serialVersionUID = 422602805; + private static final long serialVersionUID = -1448430102; /** * The reference instance of public.restore_password_bid diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JShedlock.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JShedlock.java index 0f336f1cb..dd933c549 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JShedlock.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JShedlock.java @@ -43,7 +43,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JShedlock extends TableImpl { - private static final long serialVersionUID = -2077089538; + private static final long serialVersionUID = -1932515469; /** * The reference instance of public.shedlock diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JStaleMaterializedView.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JStaleMaterializedView.java index 5b4f45e1f..699a4693f 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JStaleMaterializedView.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JStaleMaterializedView.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JStaleMaterializedView extends TableImpl { - private static final long serialVersionUID = -70601346; + private static final long serialVersionUID = 581510835; /** * The reference instance of public.stale_materialized_view diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItem.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItem.java index 110101644..23453aaf4 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItem.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItem.java @@ -45,7 +45,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JTestItem extends TableImpl { - private static final long serialVersionUID = 1074590849; + private static final long serialVersionUID = 767540278; /** * The reference instance of public.test_item diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItemResults.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItemResults.java index 09b8e98c0..8f0c8bf7d 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItemResults.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTestItemResults.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JTestItemResults extends TableImpl { - private static final long serialVersionUID = -648299127; + private static final long serialVersionUID = -722704972; /** * The reference instance of public.test_item_results diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTicket.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTicket.java index b6d38d01e..9d47ce94a 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JTicket.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JTicket.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JTicket extends TableImpl { - private static final long serialVersionUID = -914734476; + private static final long serialVersionUID = -1169544097; /** * The reference instance of public.ticket diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JUserCreationBid.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JUserCreationBid.java index 189eb9623..9949b233b 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JUserCreationBid.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JUserCreationBid.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JUserCreationBid extends TableImpl { - private static final long serialVersionUID = -303475788; + private static final long serialVersionUID = -842162999; /** * The reference instance of public.user_creation_bid @@ -74,6 +74,11 @@ public Class getRecordType() { */ public final TableField EMAIL = createField(DSL.name("email"), org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, ""); + /** + * The column public.user_creation_bid.role. + */ + public final TableField ROLE = createField(DSL.name("role"), org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, ""); + /** * The column public.user_creation_bid.inviting_user_id. */ @@ -89,11 +94,6 @@ public Class getRecordType() { */ public final TableField METADATA = createField(DSL.name("metadata"), org.jooq.impl.SQLDataType.JSONB, this, ""); - /** - * The column public.user_creation_bid.role. - */ - public final TableField ROLE = createField(DSL.name("role"), org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, ""); - /** * Create a public.user_creation_bid table reference */ @@ -187,7 +187,7 @@ public JUserCreationBid rename(Name name) { // ------------------------------------------------------------------------- @Override - public Row7 fieldsRow() { + public Row7 fieldsRow() { return (Row7) super.fieldsRow(); } } diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/JUsers.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/JUsers.java index 64bfc9264..b3693cc30 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/JUsers.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/JUsers.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.List; +import java.util.UUID; import javax.annotation.processing.Generated; @@ -21,7 +22,7 @@ import org.jooq.JSONB; import org.jooq.Name; import org.jooq.Record; -import org.jooq.Row11; +import org.jooq.Row14; import org.jooq.Schema; import org.jooq.Table; import org.jooq.TableField; @@ -43,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class JUsers extends TableImpl { - private static final long serialVersionUID = 2058736098; + private static final long serialVersionUID = 541188090; /** * The reference instance of public.users @@ -113,6 +114,21 @@ public Class getRecordType() { */ public final TableField METADATA = createField(DSL.name("metadata"), org.jooq.impl.SQLDataType.JSONB, this, ""); + /** + * The column public.users.uuid. + */ + public final TableField UUID = createField(DSL.name("uuid"), org.jooq.impl.SQLDataType.UUID.nullable(false).defaultValue(org.jooq.impl.DSL.field("gen_random_uuid()", org.jooq.impl.SQLDataType.UUID)), this, ""); + + /** + * The column public.users.external_id. + */ + public final TableField EXTERNAL_ID = createField(DSL.name("external_id"), org.jooq.impl.SQLDataType.VARCHAR, this, ""); + + /** + * The column public.users.active. + */ + public final TableField ACTIVE = createField(DSL.name("active"), org.jooq.impl.SQLDataType.BOOLEAN.defaultValue(org.jooq.impl.DSL.field("true", org.jooq.impl.SQLDataType.BOOLEAN)), this, ""); + /** * Create a public.users table reference */ @@ -198,11 +214,11 @@ public JUsers rename(Name name) { } // ------------------------------------------------------------------------- - // Row11 type methods + // Row14 type methods // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row14 fieldsRow() { + return (Row14) super.fieldsRow(); } } diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUserCreationBidRecord.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUserCreationBidRecord.java index 1596be11d..c12dab998 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUserCreationBidRecord.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUserCreationBidRecord.java @@ -29,9 +29,9 @@ comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class JUserCreationBidRecord extends UpdatableRecordImpl implements Record7 { +public class JUserCreationBidRecord extends UpdatableRecordImpl implements Record7 { - private static final long serialVersionUID = -1051909294; + private static final long serialVersionUID = 333422022; /** * Setter for public.user_creation_bid.uuid. @@ -76,59 +76,59 @@ public String getEmail() { } /** - * Setter for public.user_creation_bid.inviting_user_id. + * Setter for public.user_creation_bid.role. */ - public void setInvitingUserId(Long value) { + public void setRole(String value) { set(3, value); } /** - * Getter for public.user_creation_bid.inviting_user_id. + * Getter for public.user_creation_bid.role. */ - public Long getInvitingUserId() { - return (Long) get(3); + public String getRole() { + return (String) get(3); } /** - * Setter for public.user_creation_bid.project_name. + * Setter for public.user_creation_bid.inviting_user_id. */ - public void setProjectName(String value) { + public void setInvitingUserId(Long value) { set(4, value); } /** - * Getter for public.user_creation_bid.project_name. + * Getter for public.user_creation_bid.inviting_user_id. */ - public String getProjectName() { - return (String) get(4); + public Long getInvitingUserId() { + return (Long) get(4); } /** - * Setter for public.user_creation_bid.metadata. + * Setter for public.user_creation_bid.project_name. */ - public void setMetadata(JSONB value) { + public void setProjectName(String value) { set(5, value); } /** - * Getter for public.user_creation_bid.metadata. + * Getter for public.user_creation_bid.project_name. */ - public JSONB getMetadata() { - return (JSONB) get(5); + public String getProjectName() { + return (String) get(5); } /** - * Setter for public.user_creation_bid.role. + * Setter for public.user_creation_bid.metadata. */ - public void setRole(String value) { + public void setMetadata(JSONB value) { set(6, value); } /** - * Getter for public.user_creation_bid.role. + * Getter for public.user_creation_bid.metadata. */ - public String getRole() { - return (String) get(6); + public JSONB getMetadata() { + return (JSONB) get(6); } // ------------------------------------------------------------------------- @@ -145,12 +145,12 @@ public Record1 key() { // ------------------------------------------------------------------------- @Override - public Row7 fieldsRow() { + public Row7 fieldsRow() { return (Row7) super.fieldsRow(); } @Override - public Row7 valuesRow() { + public Row7 valuesRow() { return (Row7) super.valuesRow(); } @@ -170,23 +170,23 @@ public Field field3() { } @Override - public Field field4() { - return JUserCreationBid.USER_CREATION_BID.INVITING_USER_ID; + public Field field4() { + return JUserCreationBid.USER_CREATION_BID.ROLE; } @Override - public Field field5() { - return JUserCreationBid.USER_CREATION_BID.PROJECT_NAME; + public Field field5() { + return JUserCreationBid.USER_CREATION_BID.INVITING_USER_ID; } @Override - public Field field6() { - return JUserCreationBid.USER_CREATION_BID.METADATA; + public Field field6() { + return JUserCreationBid.USER_CREATION_BID.PROJECT_NAME; } @Override - public Field field7() { - return JUserCreationBid.USER_CREATION_BID.ROLE; + public Field field7() { + return JUserCreationBid.USER_CREATION_BID.METADATA; } @Override @@ -205,23 +205,23 @@ public String component3() { } @Override - public Long component4() { - return getInvitingUserId(); + public String component4() { + return getRole(); } @Override - public String component5() { - return getProjectName(); + public Long component5() { + return getInvitingUserId(); } @Override - public JSONB component6() { - return getMetadata(); + public String component6() { + return getProjectName(); } @Override - public String component7() { - return getRole(); + public JSONB component7() { + return getMetadata(); } @Override @@ -240,23 +240,23 @@ public String value3() { } @Override - public Long value4() { - return getInvitingUserId(); + public String value4() { + return getRole(); } @Override - public String value5() { - return getProjectName(); + public Long value5() { + return getInvitingUserId(); } @Override - public JSONB value6() { - return getMetadata(); + public String value6() { + return getProjectName(); } @Override - public String value7() { - return getRole(); + public JSONB value7() { + return getMetadata(); } @Override @@ -278,31 +278,31 @@ public JUserCreationBidRecord value3(String value) { } @Override - public JUserCreationBidRecord value4(Long value) { - setInvitingUserId(value); + public JUserCreationBidRecord value4(String value) { + setRole(value); return this; } @Override - public JUserCreationBidRecord value5(String value) { - setProjectName(value); + public JUserCreationBidRecord value5(Long value) { + setInvitingUserId(value); return this; } @Override - public JUserCreationBidRecord value6(JSONB value) { - setMetadata(value); + public JUserCreationBidRecord value6(String value) { + setProjectName(value); return this; } @Override - public JUserCreationBidRecord value7(String value) { - setRole(value); + public JUserCreationBidRecord value7(JSONB value) { + setMetadata(value); return this; } @Override - public JUserCreationBidRecord values(String value1, Instant value2, String value3, Long value4, String value5, JSONB value6, String value7) { + public JUserCreationBidRecord values(String value1, Instant value2, String value3, String value4, Long value5, String value6, JSONB value7) { value1(value1); value2(value2); value3(value3); @@ -327,15 +327,15 @@ public JUserCreationBidRecord() { /** * Create a detached, initialised JUserCreationBidRecord */ - public JUserCreationBidRecord(String uuid, Instant lastModified, String email, Long invitingUserId, String projectName, JSONB metadata, String role) { + public JUserCreationBidRecord(String uuid, Instant lastModified, String email, String role, Long invitingUserId, String projectName, JSONB metadata) { super(JUserCreationBid.USER_CREATION_BID); set(0, uuid); set(1, lastModified); set(2, email); - set(3, invitingUserId); - set(4, projectName); - set(5, metadata); - set(6, role); + set(3, role); + set(4, invitingUserId); + set(5, projectName); + set(6, metadata); } } diff --git a/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUsersRecord.java b/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUsersRecord.java index 4dffd9558..67c72573c 100644 --- a/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUsersRecord.java +++ b/src/main/java/com/epam/ta/reportportal/jooq/tables/records/JUsersRecord.java @@ -6,13 +6,15 @@ import com.epam.ta.reportportal.jooq.tables.JUsers; +import java.util.UUID; + import javax.annotation.processing.Generated; import org.jooq.Field; import org.jooq.JSONB; import org.jooq.Record1; -import org.jooq.Record11; -import org.jooq.Row11; +import org.jooq.Record14; +import org.jooq.Row14; import org.jooq.impl.UpdatableRecordImpl; @@ -27,9 +29,9 @@ comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class JUsersRecord extends UpdatableRecordImpl implements Record11 { +public class JUsersRecord extends UpdatableRecordImpl implements Record14 { - private static final long serialVersionUID = -329787849; + private static final long serialVersionUID = -549002462; /** * Setter for public.users.id. @@ -185,6 +187,48 @@ public JSONB getMetadata() { return (JSONB) get(10); } + /** + * Setter for public.users.uuid. + */ + public void setUuid(UUID value) { + set(11, value); + } + + /** + * Getter for public.users.uuid. + */ + public UUID getUuid() { + return (UUID) get(11); + } + + /** + * Setter for public.users.external_id. + */ + public void setExternalId(String value) { + set(12, value); + } + + /** + * Getter for public.users.external_id. + */ + public String getExternalId() { + return (String) get(12); + } + + /** + * Setter for public.users.active. + */ + public void setActive(Boolean value) { + set(13, value); + } + + /** + * Getter for public.users.active. + */ + public Boolean getActive() { + return (Boolean) get(13); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -195,17 +239,17 @@ public Record1 key() { } // ------------------------------------------------------------------------- - // Record11 type implementation + // Record14 type implementation // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row14 fieldsRow() { + return (Row14) super.fieldsRow(); } @Override - public Row11 valuesRow() { - return (Row11) super.valuesRow(); + public Row14 valuesRow() { + return (Row14) super.valuesRow(); } @Override @@ -263,6 +307,21 @@ public Field field11() { return JUsers.USERS.METADATA; } + @Override + public Field field12() { + return JUsers.USERS.UUID; + } + + @Override + public Field field13() { + return JUsers.USERS.EXTERNAL_ID; + } + + @Override + public Field field14() { + return JUsers.USERS.ACTIVE; + } + @Override public Long component1() { return getId(); @@ -318,6 +377,21 @@ public JSONB component11() { return getMetadata(); } + @Override + public UUID component12() { + return getUuid(); + } + + @Override + public String component13() { + return getExternalId(); + } + + @Override + public Boolean component14() { + return getActive(); + } + @Override public Long value1() { return getId(); @@ -373,6 +447,21 @@ public JSONB value11() { return getMetadata(); } + @Override + public UUID value12() { + return getUuid(); + } + + @Override + public String value13() { + return getExternalId(); + } + + @Override + public Boolean value14() { + return getActive(); + } + @Override public JUsersRecord value1(Long value) { setId(value); @@ -440,7 +529,25 @@ public JUsersRecord value11(JSONB value) { } @Override - public JUsersRecord values(Long value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, Boolean value9, String value10, JSONB value11) { + public JUsersRecord value12(UUID value) { + setUuid(value); + return this; + } + + @Override + public JUsersRecord value13(String value) { + setExternalId(value); + return this; + } + + @Override + public JUsersRecord value14(Boolean value) { + setActive(value); + return this; + } + + @Override + public JUsersRecord values(Long value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, Boolean value9, String value10, JSONB value11, UUID value12, String value13, Boolean value14) { value1(value1); value2(value2); value3(value3); @@ -452,6 +559,9 @@ public JUsersRecord values(Long value1, String value2, String value3, String val value9(value9); value10(value10); value11(value11); + value12(value12); + value13(value13); + value14(value14); return this; } @@ -469,7 +579,7 @@ public JUsersRecord() { /** * Create a detached, initialised JUsersRecord */ - public JUsersRecord(Long id, String login, String password, String email, String attachment, String attachmentThumbnail, String role, String type, Boolean expired, String fullName, JSONB metadata) { + public JUsersRecord(Long id, String login, String password, String email, String attachment, String attachmentThumbnail, String role, String type, Boolean expired, String fullName, JSONB metadata, UUID uuid, String externalId, Boolean active) { super(JUsers.USERS); set(0, id); @@ -483,5 +593,8 @@ public JUsersRecord(Long id, String login, String password, String email, String set(8, expired); set(9, fullName); set(10, metadata); + set(11, uuid); + set(12, externalId); + set(13, active); } } diff --git a/src/test/java/com/epam/ta/reportportal/dao/ClusterRepositoryTest.java b/src/test/java/com/epam/ta/reportportal/dao/ClusterRepositoryTest.java index 0b48008f6..3400a6278 100644 --- a/src/test/java/com/epam/ta/reportportal/dao/ClusterRepositoryTest.java +++ b/src/test/java/com/epam/ta/reportportal/dao/ClusterRepositoryTest.java @@ -69,6 +69,7 @@ void insertClusters() { return cluster; }).collect(Collectors.toList()); clusterRepository.saveAll(clusters); + clusterRepository.saveClusterTestItems(clusters.get(0), Set.of(1L)); clusters.stream().map(Cluster::getId).forEach(savedIds::add); } @@ -92,7 +93,7 @@ void shouldFindAllByLaunchIdWithCount() { final Pageable pageable = PageRequest.of(0, 3, Sort.by(Sort.Order.by(CRITERIA_ID))); final Page clusters = clusterRepository.findAllByLaunchIdWithCount(LAUNCH_ID, pageable); assertFalse(clusters.isEmpty()); - assertEquals(3, clusters.getContent().size()); + assertEquals(1, clusters.getContent().size()); clusters.getContent().forEach(cluster -> assertEquals(LAUNCH_ID, cluster.getLaunchId())); } @@ -128,36 +129,24 @@ void shouldDeleteByLaunchId() { @Test void shouldDeleteClusterTestItemsByProjectId() { - final Cluster cluster = clusterRepository.findByIndexIdAndLaunchId(1L, 1L).get(); - clusterRepository.saveClusterTestItems(cluster, Set.of(1L)); - final int removed = clusterRepository.deleteClusterTestItemsByProjectId(1L); assertEquals(1, removed); } @Test void shouldDeleteClusterTestItemsByLaunchId() { - final Cluster cluster = clusterRepository.findByIndexIdAndLaunchId(1L, 1L).get(); - clusterRepository.saveClusterTestItems(cluster, Set.of(1L)); - final int removed = clusterRepository.deleteClusterTestItemsByLaunchId(1L); assertEquals(1, removed); } @Test void shouldDeleteClusterTestItemsByItemId() { - final Cluster cluster = clusterRepository.findByIndexIdAndLaunchId(1L, 1L).get(); - clusterRepository.saveClusterTestItems(cluster, Set.of(1L)); - final int removed = clusterRepository.deleteClusterTestItemsByItemId(1L); assertEquals(1, removed); } @Test void shouldDeleteClusterTestItemsByItemIdIn() { - final Cluster cluster = clusterRepository.findByIndexIdAndLaunchId(1L, 1L).get(); - clusterRepository.saveClusterTestItems(cluster, Set.of(1L)); - final int removed = clusterRepository.deleteClusterTestItemsByItemIds(List.of(1L)); assertEquals(1, removed); @@ -168,7 +157,7 @@ void shouldDeleteClusterTestItemsByItemIdIn() { @Test void shouldSaveClusterTestItems() { - final Cluster cluster = clusterRepository.findAllByLaunchId(LAUNCH_ID).get(0); + final Cluster cluster = clusterRepository.findAllByLaunchId(LAUNCH_ID).get(1); final int inserted = clusterRepository.saveClusterTestItems(cluster, Set.of(1L, 2L)); assertEquals(2, inserted); } diff --git a/src/test/java/com/epam/ta/reportportal/dao/UserRepositoryTest.java b/src/test/java/com/epam/ta/reportportal/dao/UserRepositoryTest.java index c3b3ffb8b..b4d14355b 100644 --- a/src/test/java/com/epam/ta/reportportal/dao/UserRepositoryTest.java +++ b/src/test/java/com/epam/ta/reportportal/dao/UserRepositoryTest.java @@ -50,6 +50,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.UUID; import org.assertj.core.util.Sets; import org.hamcrest.Matchers; import org.jooq.Operator; @@ -342,6 +343,7 @@ void createUserTest() { User reg = new User(); reg.setEmail("email.com"); + reg.setUuid(UUID.randomUUID()); reg.setFullName("test"); reg.setLogin("created"); reg.setPassword("new"); diff --git a/src/test/resources/db/migration/V001003__test_project_init.sql b/src/test/resources/db/migration/V001003__test_project_init.sql index 2c66ba0a2..2d9c54823 100644 --- a/src/test/resources/db/migration/V001003__test_project_init.sql +++ b/src/test/resources/db/migration/V001003__test_project_init.sql @@ -14,37 +14,37 @@ BEGIN VALUES ('millennium_falcon', 'INTERNAL', now()); falcon := (SELECT currval(pg_get_serial_sequence('project', 'id'))); - INSERT INTO users (login, password, email, role, type, full_name, expired, metadata) + INSERT INTO users (login, password, email, role, type, full_name, expired, metadata, uuid) VALUES ('han_solo', '3531f6f9b0538fd347f4c95bd2af9d01', 'han_solo@domain.com', 'ADMINISTRATOR', 'INTERNAL', 'Han Solo', FALSE, - '{"metadata": {"last_login": "1551187023768"}}'); + '{"metadata": {"last_login": "1551187023768"}}', gen_random_uuid()); han_solo := (SELECT currval(pg_get_serial_sequence('users', 'id'))); INSERT INTO project_user (user_id, project_id, project_role) VALUES (han_solo, falcon, 'PROJECT_MANAGER'); - INSERT INTO users (login, password, email, role, type, full_name, expired, metadata) + INSERT INTO users (login, password, email, role, type, full_name, expired, metadata, uuid) VALUES ('chubaka', '601c4731aeff3b84f76672ad024bb2a0', 'chybaka@domain.com', 'USER', 'INTERNAL', 'Chubaka', FALSE, - '{"metadata": {"last_login": "1551187023768"}}'); + '{"metadata": {"last_login": "1551187023768"}}', gen_random_uuid()); chubaka := (SELECT currval(pg_get_serial_sequence('users', 'id'))); INSERT INTO project_user (user_id, project_id, project_role) VALUES (chubaka, falcon, 'MEMBER'); - INSERT INTO users (login, password, email, role, type, full_name, expired, metadata) + INSERT INTO users (login, password, email, role, type, full_name, expired, metadata, uuid) VALUES ('fake_chubaka', '601c4731aeff3b84f76672ad024bb2a0', 'chybakafake@domain.com', 'USER', 'INTERNAL', 'Chubaka Fake', FALSE, - '{"metadata": {"last_login": "1551187023768"}}'); + '{"metadata": {"last_login": "1551187023768"}}', gen_random_uuid()); fake_chubaka := (SELECT currval(pg_get_serial_sequence('users', 'id'))); INSERT INTO project_user (user_id, project_id, project_role) VALUES (fake_chubaka, falcon, 'MEMBER'); - INSERT INTO users (login, password, email, role, type, full_name, expired, metadata) + INSERT INTO users (login, password, email, role, type, full_name, expired, metadata, uuid) VALUES ('ch_not_assigned', '601c4731aeff3b84f76672ad024bb2a0', 'ch_not_assigned@domain.com', 'USER', 'INTERNAL', 'Ch Not Assigned', FALSE, - '{"metadata": {"last_login": "1551187023768"}}'); + '{"metadata": {"last_login": "1551187023768"}}', gen_random_uuid()); INSERT INTO issue_type_project (project_id, issue_type_id) VALUES (falcon, 1),