2semestr
This commit is contained in:
parent
432efaf46a
commit
2b762f9c99
37
2 семестр/Lab1-2/.gitignore
vendored
Normal file
37
2 семестр/Lab1-2/.gitignore
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
0
2 семестр/Lab1-2/README.md
Normal file
0
2 семестр/Lab1-2/README.md
Normal file
28
2 семестр/Lab1-2/build.gradle
Normal file
28
2 семестр/Lab1-2/build.gradle
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.2.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.example'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = '17'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
|
||||||
|
implementation 'org.modelmapper:modelmapper:3.2.0'
|
||||||
|
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
BIN
2 семестр/Lab1-2/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
2 семестр/Lab1-2/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
2 семестр/Lab1-2/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
2 семестр/Lab1-2/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
2 семестр/Lab1-2/gradlew
vendored
Normal file
249
2 семестр/Lab1-2/gradlew
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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 ;; #(
|
||||||
|
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
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
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" && ! "$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
|
||||||
|
|
||||||
|
# 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" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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" "$@"
|
92
2 семестр/Lab1-2/gradlew.bat
vendored
Normal file
92
2 семестр/Lab1-2/gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
1
2 семестр/Lab1-2/settings.gradle
Normal file
1
2 семестр/Lab1-2/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'demo'
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.ageratings.service.AgeRatingService;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DemoApplication implements CommandLineRunner {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(DemoApplication.class);
|
||||||
|
|
||||||
|
private final TypeService typeService;
|
||||||
|
private final AgeRatingService ageratingService;
|
||||||
|
private final MovieService movieService;
|
||||||
|
|
||||||
|
public DemoApplication(TypeService typeService, AgeRatingService ageratingService, MovieService movieService) {
|
||||||
|
this.typeService = typeService;
|
||||||
|
this.ageratingService = ageratingService;
|
||||||
|
this.movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DemoApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
if (args.length > 0 && Objects.equals("--populate", args[0])) {
|
||||||
|
log.info("Create default types values");
|
||||||
|
final var type1 = typeService.create(new TypeEntity(null, "Фильм"));
|
||||||
|
final var type2 = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
|
||||||
|
log.info("Create default ageRatings values");
|
||||||
|
final var agerating4 = ageratingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
final var agerating5 = ageratingService.create(new AgeRatingEntity(null, "18+"));
|
||||||
|
|
||||||
|
log.info("Create default movies values");
|
||||||
|
movieService.create(new MovieEntity(null, "Начало", type1,
|
||||||
|
"src/assets/main-page/posters/Inception.jpg",
|
||||||
|
"Кобб – талантливый вор, лучший в опасном искусстве извлечения: похищения ценных секретов из глубин подсознания во время сна...",
|
||||||
|
2010, "США, Великобритания", "Кристофер Нолан", agerating4,
|
||||||
|
"https://www.youtube.com/embed/YoHD9XEInc0?si=AB3CDEfGHIJKLM"));
|
||||||
|
|
||||||
|
movieService.create(new MovieEntity(null, "Матрица", type1,
|
||||||
|
"src/assets/main-page/posters/TheMatrix.jpg",
|
||||||
|
"Компьютерный хакер Томас Андерсон под псевдонимом Нео узнает шокирующую правду о своей реальности...",
|
||||||
|
1999, "США, Австралия", "Лана и Лилли Вачовски", agerating5,
|
||||||
|
"https://www.youtube.com/embed/vKQi3bBA1y8?si=NO8PQRSTUVWX"));
|
||||||
|
|
||||||
|
movieService.create(new MovieEntity(null, "Во все тяжкие", type2,
|
||||||
|
"src/assets/main-page/posters/BreakingBad.jpg",
|
||||||
|
"Школьный учитель химии Уолтер Уайт получает диагноз 'рак' и решает заняться производством метамфетамина...",
|
||||||
|
2008, "США", "Винс Гиллиган", agerating5,
|
||||||
|
"https://www.youtube.com/embed/HhesaQXLuRY?si=YZ123456789"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.example.demo.ageratings.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.ageratings.service.AgeRatingService;
|
||||||
|
import com.example.demo.core.configuration.Constants;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/ageRating")
|
||||||
|
public class AgeRatingController {
|
||||||
|
private final AgeRatingService ageRatingService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public AgeRatingController(AgeRatingService ageRatingService, ModelMapper modelMapper) {
|
||||||
|
this.ageRatingService = ageRatingService;
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgeRatingDto toDto(AgeRatingEntity entity) {
|
||||||
|
return modelMapper.map(entity, AgeRatingDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgeRatingEntity toEntity(AgeRatingDto dto) {
|
||||||
|
return modelMapper.map(dto, AgeRatingEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<AgeRatingDto> getAll() {
|
||||||
|
return ageRatingService.getAll().stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AgeRatingDto get(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(ageRatingService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public AgeRatingDto create(@RequestBody @Valid AgeRatingDto dto) {
|
||||||
|
return toDto(ageRatingService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public AgeRatingDto update(@PathVariable(name = "id") Long id, @RequestBody AgeRatingDto dto) {
|
||||||
|
return toDto(ageRatingService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public AgeRatingDto delete(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(ageRatingService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.example.demo.ageratings.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
public class AgeRatingDto {
|
||||||
|
private Long id;
|
||||||
|
@NotBlank
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.example.demo.ageratings.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
public class AgeRatingEntity extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public AgeRatingEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity(Long id, String name) {
|
||||||
|
super(id);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final AgeRatingEntity other = (AgeRatingEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getName(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.ageratings.repository;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.core.repository.MapRepository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class AgeRatingRepository extends MapRepository<AgeRatingEntity> {
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.example.demo.ageratings.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.ageratings.repository.AgeRatingRepository;
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AgeRatingService {
|
||||||
|
private final AgeRatingRepository repository;
|
||||||
|
|
||||||
|
public AgeRatingService(AgeRatingRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AgeRatingEntity> getAll() {
|
||||||
|
return repository.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity get(Long id) {
|
||||||
|
return Optional.ofNullable(repository.get(id))
|
||||||
|
.orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity create(AgeRatingEntity entity) {
|
||||||
|
return repository.create(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity update(Long id, AgeRatingEntity entity) {
|
||||||
|
final AgeRatingEntity existsEntity = get(id);
|
||||||
|
existsEntity.setName(entity.getName());
|
||||||
|
return repository.update(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity delete(Long id) {
|
||||||
|
final AgeRatingEntity existsEntity = get(id);
|
||||||
|
return repository.delete(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAll() {
|
||||||
|
repository.deleteAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.example.demo.core.configuration;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
public static final String API_URL = "/api/1.0";
|
||||||
|
|
||||||
|
private Constants() {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.demo.core.configuration;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MapperConfiguration {
|
||||||
|
@Bean
|
||||||
|
ModelMapper modelMapper() {
|
||||||
|
return new ModelMapper();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.example.demo.core.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedMethods("GET", "POST", "PUT", "DELETE");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.demo.core.error;
|
||||||
|
|
||||||
|
public class NotFoundException extends RuntimeException {
|
||||||
|
public NotFoundException(Long id) {
|
||||||
|
super(String.format("Entity with id [%s] is not found or not exists", id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.example.demo.core.model;
|
||||||
|
|
||||||
|
public abstract class BaseEntity {
|
||||||
|
protected Long id;
|
||||||
|
|
||||||
|
protected BaseEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BaseEntity(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.example.demo.core.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CommonRepository<E, T> {
|
||||||
|
List<E> getAll();
|
||||||
|
|
||||||
|
E get(T id);
|
||||||
|
|
||||||
|
E create(E entity);
|
||||||
|
|
||||||
|
E update(E entity);
|
||||||
|
|
||||||
|
E delete(E entity);
|
||||||
|
|
||||||
|
void deleteAll();
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.demo.core.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
public abstract class MapRepository<E extends BaseEntity> implements CommonRepository<E, Long> {
|
||||||
|
private final Map<Long, E> entities = new TreeMap<>();
|
||||||
|
private Long lastId = 0L;
|
||||||
|
|
||||||
|
protected MapRepository() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<E> getAll() {
|
||||||
|
return entities.values().stream().toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public E get(Long id) {
|
||||||
|
return entities.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public E create(E entity) {
|
||||||
|
lastId++;
|
||||||
|
entity.setId(lastId);
|
||||||
|
entities.put(lastId, entity);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public E update(E entity) {
|
||||||
|
if (get(entity.getId()) == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
entities.put(entity.getId(), entity);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public E delete(E entity) {
|
||||||
|
if (get(entity.getId()) == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
entities.remove(entity.getId());
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll() {
|
||||||
|
lastId = 0L;
|
||||||
|
entities.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.example.demo.movies.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configuration.Constants;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/movie")
|
||||||
|
public class MovieController {
|
||||||
|
private final MovieService itemService;
|
||||||
|
private final TypeService typeService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public MovieController(MovieService itemService, TypeService typeService, ModelMapper modelMapper) {
|
||||||
|
this.itemService = itemService;
|
||||||
|
this.typeService = typeService;
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MovieDto toDto(MovieEntity entity) {
|
||||||
|
return modelMapper.map(entity, MovieDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MovieEntity toEntity(MovieDto dto) {
|
||||||
|
final MovieEntity entity = modelMapper.map(dto, MovieEntity.class);
|
||||||
|
entity.setType(typeService.get(dto.getTypeId()));
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<MovieDto> getAll(@RequestParam(name = "typeId", defaultValue = "0") Long typeId, @RequestParam(name = "typeId", defaultValue = "0") Long ageratingId) {
|
||||||
|
return itemService.getAll(typeId , ageratingId).stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public MovieDto get(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(itemService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public MovieDto create(@RequestBody @Valid MovieDto dto) {
|
||||||
|
return toDto(itemService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public MovieDto update(@PathVariable(name = "id") Long id, @RequestBody MovieDto dto) {
|
||||||
|
return toDto(itemService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public MovieDto delete(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(itemService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,125 @@
|
|||||||
|
package com.example.demo.movies.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class MovieDto {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
private String poster;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Integer releaseDate;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String director;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Long ageRatingId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String video;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTypeId() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(Long typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPoster() {
|
||||||
|
return poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoster(String poster) {
|
||||||
|
this.poster = poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getReleaseDate() {
|
||||||
|
return releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleaseDate(Integer releaseDate) {
|
||||||
|
this.releaseDate = releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDirector() {
|
||||||
|
return director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirector(String director) {
|
||||||
|
this.director = director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAgeRatingId() {
|
||||||
|
return ageRatingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgeRatingId(Long ageRatingId) {
|
||||||
|
this.ageRatingId = ageRatingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideo() {
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideo(String video) {
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
package com.example.demo.movies.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
|
||||||
|
public class MovieEntity extends BaseEntity {
|
||||||
|
private String title;
|
||||||
|
private TypeEntity type;
|
||||||
|
private String poster;
|
||||||
|
private String description;
|
||||||
|
private Integer releaseDate;
|
||||||
|
private String country;
|
||||||
|
private String director;
|
||||||
|
private AgeRatingEntity ageRating;
|
||||||
|
private String video;
|
||||||
|
|
||||||
|
public MovieEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity(Long id, String title, TypeEntity type, String poster,
|
||||||
|
String description, Integer releaseDate, String country, String director,
|
||||||
|
AgeRatingEntity ageRating, String video) {
|
||||||
|
super(id);
|
||||||
|
|
||||||
|
this.title = title;
|
||||||
|
this.type = type;
|
||||||
|
this.poster = poster;
|
||||||
|
this.description = description;
|
||||||
|
this.releaseDate = releaseDate;
|
||||||
|
this.country = country;
|
||||||
|
this.director = director;
|
||||||
|
this.ageRating = ageRating;
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(TypeEntity type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPoster() {
|
||||||
|
return poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoster(String poster) {
|
||||||
|
this.poster = poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getReleaseDate() {
|
||||||
|
return releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleaseDate(Integer releaseDate) {
|
||||||
|
this.releaseDate = releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDirector() {
|
||||||
|
return director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirector(String director) {
|
||||||
|
this.director = director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgeRatingEntity getAgeRating() {
|
||||||
|
return ageRating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgeRating(AgeRatingEntity ageRating) {
|
||||||
|
this.ageRating = ageRating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideo() {
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideo(String video) {
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, title, type, poster, description, releaseDate, country,
|
||||||
|
director, ageRating, video);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final MovieEntity other = (MovieEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getTitle(), title)
|
||||||
|
&& Objects.equals(other.getType(), type)
|
||||||
|
&& Objects.equals(other.getPoster(), poster)
|
||||||
|
&& Objects.equals(other.getDescription(), description)
|
||||||
|
&& Objects.equals(other.getReleaseDate(), releaseDate)
|
||||||
|
&& Objects.equals(other.getCountry(), country)
|
||||||
|
&& Objects.equals(other.getDirector(), director)
|
||||||
|
&& Objects.equals(other.getAgeRating(), ageRating)
|
||||||
|
&& Objects.equals(other.getVideo(), video);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.movies.repository;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.core.repository.MapRepository;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class MovieRepository extends MapRepository<MovieEntity> {
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.example.demo.movies.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.repository.MovieRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MovieService {
|
||||||
|
private final MovieRepository repository;
|
||||||
|
|
||||||
|
public MovieService(MovieRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MovieEntity> getAll(Long typeId, Long ageratingId) {
|
||||||
|
if (Objects.equals(typeId, 0L) && Objects.equals(ageratingId, 0L) ) {
|
||||||
|
return repository.getAll();
|
||||||
|
}
|
||||||
|
if (Objects.equals(ageratingId, 0L)) {
|
||||||
|
return repository.getAll().stream()
|
||||||
|
.filter(item -> item.getType().getId().equals(typeId))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (Objects.equals(typeId, 0L)) {
|
||||||
|
return repository.getAll().stream()
|
||||||
|
.filter(item -> item.getAgeRating().getId().equals(ageratingId))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return repository.getAll().stream()
|
||||||
|
.filter(item -> item.getType().getId().equals(typeId))
|
||||||
|
.filter(item -> item.getAgeRating().getId().equals(ageratingId))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MovieEntity get(Long id) {
|
||||||
|
return Optional.ofNullable(repository.get(id))
|
||||||
|
.orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity create(MovieEntity entity) {
|
||||||
|
return repository.create(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity update(Long id, MovieEntity entity) {
|
||||||
|
final MovieEntity existsEntity = get(id);
|
||||||
|
existsEntity.setTitle(entity.getTitle());
|
||||||
|
existsEntity.setType(entity.getType());
|
||||||
|
existsEntity.setPoster(entity.getPoster());
|
||||||
|
existsEntity.setDescription(entity.getDescription());
|
||||||
|
existsEntity.setReleaseDate(entity.getReleaseDate());
|
||||||
|
existsEntity.setCountry(entity.getCountry());
|
||||||
|
existsEntity.setDirector(entity.getDirector());
|
||||||
|
existsEntity.setAgeRating(entity.getAgeRating());
|
||||||
|
existsEntity.setVideo(entity.getVideo());
|
||||||
|
return repository.update(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity delete(Long id) {
|
||||||
|
final MovieEntity existsEntity = get(id);
|
||||||
|
return repository.delete(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAll() {
|
||||||
|
repository.deleteAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.example.demo.types.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configuration.Constants;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/type")
|
||||||
|
public class TypeController {
|
||||||
|
private final TypeService typeService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public TypeController(TypeService typeService, ModelMapper modelMapper) {
|
||||||
|
this.typeService = typeService;
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TypeDto toDto(TypeEntity entity) {
|
||||||
|
return modelMapper.map(entity, TypeDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TypeEntity toEntity(TypeDto dto) {
|
||||||
|
return modelMapper.map(dto, TypeEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<TypeDto> getAll() {
|
||||||
|
return typeService.getAll().stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public TypeDto get(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(typeService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public TypeDto create(@RequestBody @Valid TypeDto dto) {
|
||||||
|
return toDto(typeService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public TypeDto update(@PathVariable(name = "id") Long id, @RequestBody TypeDto dto) {
|
||||||
|
return toDto(typeService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public TypeDto delete(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(typeService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.example.demo.types.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
public class TypeDto {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.example.demo.types.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
public class TypeEntity extends BaseEntity {
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public TypeEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity(Long id, String name) {
|
||||||
|
super(id);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final TypeEntity other = (TypeEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getName(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.types.repository;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.core.repository.MapRepository;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class TypeRepository extends MapRepository<TypeEntity> {
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.example.demo.types.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
import com.example.demo.types.repository.TypeRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TypeService {
|
||||||
|
private final TypeRepository repository;
|
||||||
|
|
||||||
|
public TypeService(TypeRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TypeEntity> getAll() {
|
||||||
|
return repository.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity get(Long id) {
|
||||||
|
return Optional.ofNullable(repository.get(id))
|
||||||
|
.orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity create(TypeEntity entity) {
|
||||||
|
return repository.create(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity update(Long id, TypeEntity entity) {
|
||||||
|
final TypeEntity existsEntity = get(id);
|
||||||
|
existsEntity.setName(entity.getName());
|
||||||
|
return repository.update(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeEntity delete(Long id) {
|
||||||
|
final TypeEntity existsEntity = get(id);
|
||||||
|
return repository.delete(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAll() {
|
||||||
|
repository.deleteAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.example.demo.users.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configuration.Constants;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/user")
|
||||||
|
public class UserController {
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public UserController(UserService userService, ModelMapper modelMapper) {
|
||||||
|
this.userService = userService;
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserDto toDto(UserEntity entity) {
|
||||||
|
return modelMapper.map(entity, UserDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserEntity toEntity(UserDto dto) {
|
||||||
|
return modelMapper.map(dto, UserEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<UserDto> getAll() {
|
||||||
|
return userService.getAll().stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public UserDto get(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(userService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public UserDto create(@RequestBody @Valid UserDto dto) {
|
||||||
|
return toDto(userService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public UserDto update(@PathVariable(name = "id") Long id, @RequestBody UserDto dto) {
|
||||||
|
return toDto(userService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public UserDto delete(@PathVariable(name = "id") Long id) {
|
||||||
|
return toDto(userService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.example.demo.users.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class UserDto {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@NotBlank
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.example.demo.users.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
public class UserEntity extends BaseEntity {
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public UserEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity(Long id, String email, String password) {
|
||||||
|
super(id);
|
||||||
|
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, email, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final UserEntity other = (UserEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getEmail(), email)
|
||||||
|
&& Objects.equals(other.getPassword(), password);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.users.repository;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.core.repository.MapRepository;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class UserRepository extends MapRepository<UserEntity> {
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.example.demo.users.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.repository.UserRepository;
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserService {
|
||||||
|
private final UserRepository repository;
|
||||||
|
|
||||||
|
|
||||||
|
public UserService(UserRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserEntity> getAll() {
|
||||||
|
return repository.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity get(Long id) {
|
||||||
|
return Optional.ofNullable(repository.get(id))
|
||||||
|
.orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity create(UserEntity entity) {
|
||||||
|
return repository.create(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity update(Long id, UserEntity entity) {
|
||||||
|
final UserEntity existsEntity = get(id);
|
||||||
|
existsEntity.setEmail(entity.getEmail());
|
||||||
|
return repository.update(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity delete(Long id) {
|
||||||
|
final UserEntity existsEntity = get(id);
|
||||||
|
return repository.delete(existsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAll() {
|
||||||
|
repository.deleteAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.ageratings.service.AgeRatingService;
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class AgeRatingServiceTests {
|
||||||
|
@Autowired
|
||||||
|
private AgeRatingService ageRatingService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> ageRatingService.get(0L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void createTest() {
|
||||||
|
ageRatingService.deleteAll();
|
||||||
|
|
||||||
|
ageRatingService.create(new AgeRatingEntity(null, "12+"));
|
||||||
|
ageRatingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
final AgeRatingEntity last = ageRatingService.create(new AgeRatingEntity(null, "18+"));
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, ageRatingService.getAll().size());
|
||||||
|
Assertions.assertEquals(last, ageRatingService.get(3L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void updateTest() {
|
||||||
|
final String test = "TEST";
|
||||||
|
final AgeRatingEntity entity = ageRatingService.get(3L);
|
||||||
|
final String oldName = entity.getName();
|
||||||
|
final AgeRatingEntity newEntity = ageRatingService.update(3L, new AgeRatingEntity(2L, test));
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, ageRatingService.getAll().size());
|
||||||
|
Assertions.assertEquals(newEntity, ageRatingService.get(3L));
|
||||||
|
Assertions.assertEquals(test, newEntity.getName());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void deleteTest() {
|
||||||
|
ageRatingService.delete(3L);
|
||||||
|
Assertions.assertEquals(2, ageRatingService.getAll().size());
|
||||||
|
final AgeRatingEntity last = ageRatingService.get(2L);
|
||||||
|
Assertions.assertEquals(2L, last.getId());
|
||||||
|
|
||||||
|
final AgeRatingEntity newEntity = ageRatingService.create(new AgeRatingEntity(null, "18+"));
|
||||||
|
Assertions.assertEquals(3, ageRatingService.getAll().size());
|
||||||
|
Assertions.assertEquals(4L, newEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,162 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.model.AgeRatingEntity;
|
||||||
|
import com.example.demo.ageratings.service.AgeRatingService;
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class MovieServiceTests {
|
||||||
|
@Autowired
|
||||||
|
private TypeService typeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AgeRatingService ageRatingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MovieService movieService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> movieService.get(0L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGetAll() {
|
||||||
|
movieService
|
||||||
|
.deleteAll();
|
||||||
|
final var type1 = typeService.create(new TypeEntity(null, "Фильм"));
|
||||||
|
final var type2 = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
final var ageRating4 = ageRatingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
final var ageRating5 = ageRatingService.create(new AgeRatingEntity(null, "18+"));
|
||||||
|
movieService.create(new MovieEntity(null, "Начало", type1,
|
||||||
|
"src/assets/main-page/posters/Inception.jpg",
|
||||||
|
"Кобб – талантливый вор, лучший в опасном искусстве извлечения: похищения ценных секретов из глубин подсознания во время сна...",
|
||||||
|
2010, "США, Великобритания", "Кристофер Нолан", ageRating4,
|
||||||
|
"https://www.youtube.com/embed/YoHD9XEInc0?si=AB3CDEfGHIJKLM"));
|
||||||
|
|
||||||
|
movieService.create(new MovieEntity(null, "Матрица", type2,
|
||||||
|
"src/assets/main-page/posters/TheMatrix.jpg",
|
||||||
|
"Компьютерный хакер Томас Андерсон под псевдонимом Нео узнает шокирующую правду о своей реальности...",
|
||||||
|
1999, "США, Австралия", "Лана и Лилли Вачовски", ageRating5,
|
||||||
|
"https://www.youtube.com/embed/vKQi3bBA1y8?si=NO8PQRSTUVWX"));
|
||||||
|
List<MovieEntity> result1 = movieService.getAll(0L, 0L);
|
||||||
|
|
||||||
|
assertThat(result1).hasSize(2);
|
||||||
|
assertEquals("Начало", result1.get(0).getTitle());
|
||||||
|
assertEquals("Матрица", result1.get(1).getTitle());
|
||||||
|
|
||||||
|
List<MovieEntity> result2 = movieService.getAll(1L, 0L);
|
||||||
|
|
||||||
|
assertThat(result2).hasSize(1);
|
||||||
|
assertEquals("Начало", result2.get(0).getTitle());
|
||||||
|
List<MovieEntity> result3 = movieService.getAll(0L, 1L);
|
||||||
|
|
||||||
|
assertThat(result3).hasSize(1);
|
||||||
|
assertEquals("Начало", result3.get(0).getTitle());
|
||||||
|
List<MovieEntity> result4 = movieService.getAll(1L, 1L);
|
||||||
|
|
||||||
|
assertThat(result4).hasSize(1);
|
||||||
|
assertEquals("Начало", result4.get(0).getTitle());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void createTest() {
|
||||||
|
movieService
|
||||||
|
.deleteAll();
|
||||||
|
|
||||||
|
final var type1 = typeService.create(new TypeEntity(null, "Фильм"));
|
||||||
|
final var type2 = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
final var ageRating4 = ageRatingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
final var ageRating5 = ageRatingService.create(new AgeRatingEntity(null, "18+"));
|
||||||
|
|
||||||
|
movieService.create(new MovieEntity(null, "Начало", type1,
|
||||||
|
"src/assets/main-page/posters/Inception.jpg",
|
||||||
|
"Кобб – талантливый вор, лучший в опасном искусстве извлечения: похищения ценных секретов из глубин подсознания во время сна...",
|
||||||
|
2010, "США, Великобритания", "Кристофер Нолан", ageRating4,
|
||||||
|
"https://www.youtube.com/embed/YoHD9XEInc0?si=AB3CDEfGHIJKLM"));
|
||||||
|
|
||||||
|
movieService.create(new MovieEntity(null, "Матрица", type1,
|
||||||
|
"src/assets/main-page/posters/TheMatrix.jpg",
|
||||||
|
"Компьютерный хакер Томас Андерсон под псевдонимом Нео узнает шокирующую правду о своей реальности...",
|
||||||
|
1999, "США, Австралия", "Лана и Лилли Вачовски", ageRating5,
|
||||||
|
"https://www.youtube.com/embed/vKQi3bBA1y8?si=NO8PQRSTUVWX"));
|
||||||
|
|
||||||
|
final MovieEntity last = movieService.create(new MovieEntity(null, "Во все тяжкие", type2,
|
||||||
|
"src/assets/main-page/posters/BreakingBad.jpg",
|
||||||
|
"Школьный учитель химии Уолтер Уайт получает диагноз 'рак' и решает заняться производством метамфетамина...",
|
||||||
|
2008, "США", "Винс Гиллиган", ageRating5,
|
||||||
|
"https://www.youtube.com/embed/HhesaQXLuRY?si=YZ123456789"));
|
||||||
|
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, movieService.getAll(0L, 0L).size());
|
||||||
|
Assertions.assertEquals(1, movieService.getAll(1L, 1L).size());
|
||||||
|
Assertions.assertEquals(last, movieService.get(3L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void updateTest() {
|
||||||
|
final var type2 = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
final var ageRating4 = ageRatingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
|
||||||
|
final String test = "TEST";
|
||||||
|
final MovieEntity entity = movieService.get(3L);
|
||||||
|
final String oldName = entity.getTitle();
|
||||||
|
final MovieEntity newEntity = movieService.update(3L, new MovieEntity(null,
|
||||||
|
test, type2,
|
||||||
|
"src/assets/main-page/posters/PeakyBlinders.png",
|
||||||
|
"Сериал рассказывает историю восхождения одной ирландской семьи...",
|
||||||
|
2013, "Великобритания", "Энтони Бирн, Колм МакКарти", ageRating4,
|
||||||
|
"https://www.youtube.com/embed/7cOfn_sjlXM?si=fxNoZjlUon1SZd70"));
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, movieService.getAll(0L , 0L).size());
|
||||||
|
Assertions.assertEquals(newEntity, movieService.get(3L));
|
||||||
|
Assertions.assertEquals(test, newEntity.getTitle());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void deleteTest() {
|
||||||
|
final var type2 = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
final var ageRating4 = ageRatingService.create(new AgeRatingEntity(null, "16+"));
|
||||||
|
|
||||||
|
movieService.delete(3L);
|
||||||
|
Assertions.assertEquals(2, movieService.getAll(0L, 0L).size());
|
||||||
|
final MovieEntity last = movieService.get(2L);
|
||||||
|
Assertions.assertEquals(2L, last.getId());
|
||||||
|
|
||||||
|
final MovieEntity newEntity = movieService.create(new MovieEntity(null,
|
||||||
|
"Острые козырьки", type2,
|
||||||
|
"src/assets/main-page/posters/PeakyBlinders.png",
|
||||||
|
"Сериал рассказывает историю восхождения одной ирландской семьи...",
|
||||||
|
2013, "Великобритания", "Энтони Бирн, Колм МакКарти", ageRating4,
|
||||||
|
"https://www.youtube.com/embed/7cOfn_sjlXM?si=fxNoZjlUon1SZd70"));
|
||||||
|
Assertions.assertEquals(3, movieService.getAll(0L, 0L).size());
|
||||||
|
Assertions.assertEquals(4L, newEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.types.model.TypeEntity;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class TypeServiceTests {
|
||||||
|
@Autowired
|
||||||
|
private TypeService typeService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> typeService.get(0L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void createTest() {
|
||||||
|
typeService.deleteAll();
|
||||||
|
|
||||||
|
typeService.create(new TypeEntity(null, "Фильм"));
|
||||||
|
final TypeEntity last = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, typeService.getAll().size());
|
||||||
|
Assertions.assertEquals(last, typeService.get(2L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void updateTest() {
|
||||||
|
final String test = "TEST";
|
||||||
|
final TypeEntity entity = typeService.get(2L);
|
||||||
|
final String oldName = entity.getName();
|
||||||
|
final TypeEntity newEntity = typeService.update(2L, new TypeEntity(1L, test));
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, typeService.getAll().size());
|
||||||
|
Assertions.assertEquals(newEntity, typeService.get(2L));
|
||||||
|
Assertions.assertEquals(test, newEntity.getName());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void deleteTest() {
|
||||||
|
typeService.delete(2L);
|
||||||
|
Assertions.assertEquals(1, typeService.getAll().size());
|
||||||
|
final TypeEntity last = typeService.get(1L);
|
||||||
|
Assertions.assertEquals(1L, last.getId());
|
||||||
|
|
||||||
|
final TypeEntity newEntity = typeService.create(new TypeEntity(null, "Сериал"));
|
||||||
|
Assertions.assertEquals(2, typeService.getAll().size());
|
||||||
|
Assertions.assertEquals(3L, newEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.demo.ageratings.service.AgeRatingService;
|
||||||
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.types.service.TypeService;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class UserServiceTests {
|
||||||
|
@Autowired
|
||||||
|
private TypeService typeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AgeRatingService ageRatingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MovieService movieService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> userService.get(0L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void createTest() {
|
||||||
|
ageRatingService.deleteAll();
|
||||||
|
typeService.deleteAll();
|
||||||
|
movieService.deleteAll();
|
||||||
|
userService.deleteAll();
|
||||||
|
|
||||||
|
userService.create(new UserEntity(null, "myemail@mail.com", "12345678"));
|
||||||
|
userService.create(new UserEntity(null, "secondemail@mail.com", "qwwerty"));
|
||||||
|
final var last = userService
|
||||||
|
.create(new UserEntity(null, "thirdemail@mail.com", "ytrewq"));
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, userService.getAll().size());
|
||||||
|
Assertions.assertEquals(last, userService.get(3L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void updateTest() {
|
||||||
|
final String test = "TEST";
|
||||||
|
final String email = "TEST";
|
||||||
|
final String password = "rbgirgrbunrgu9nrbu9";
|
||||||
|
final UserEntity entity = userService.get(3L);
|
||||||
|
final String oldName = entity.getEmail();
|
||||||
|
final UserEntity newEntity = userService.update(3L, new UserEntity(1L,email, password));
|
||||||
|
Assertions.assertEquals(3, userService.getAll().size());
|
||||||
|
Assertions.assertEquals(newEntity, userService.get(3L));
|
||||||
|
Assertions.assertEquals(test, newEntity.getEmail());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void deleteTest() {
|
||||||
|
userService.delete(3L);
|
||||||
|
Assertions.assertEquals(2, userService.getAll().size());
|
||||||
|
final UserEntity last = userService.get(2L);
|
||||||
|
Assertions.assertEquals(2L, last.getId());
|
||||||
|
|
||||||
|
final var newEntity = userService
|
||||||
|
.create(new UserEntity(null, "thirdemail@mail.com", "ytrewq"));
|
||||||
|
Assertions.assertEquals(3, userService.getAll().size());
|
||||||
|
Assertions.assertEquals(4L, newEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
37
2 семестр/Lab3/.gitignore
vendored
Normal file
37
2 семестр/Lab3/.gitignore
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
0
2 семестр/Lab3/README.md
Normal file
0
2 семестр/Lab3/README.md
Normal file
44
2 семестр/Lab3/build.gradle
Normal file
44
2 семестр/Lab3/build.gradle
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.2.5'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.example'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
defaultTasks 'bootRun'
|
||||||
|
|
||||||
|
jar {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
bootJar {
|
||||||
|
archiveFileName = String.format('%s-%s.jar', rootProject.name, version)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert System.properties['java.specification.version'] == '17' || '21'
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = '17'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
|
||||||
|
implementation 'org.modelmapper:modelmapper:3.2.0'
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
|
implementation 'com.h2database:h2:2.2.224'
|
||||||
|
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
BIN
2 семестр/Lab3/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
2 семестр/Lab3/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
2 семестр/Lab3/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
2 семестр/Lab3/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
2 семестр/Lab3/gradlew
vendored
Normal file
249
2 семестр/Lab3/gradlew
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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 ;; #(
|
||||||
|
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
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
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" && ! "$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
|
||||||
|
|
||||||
|
# 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" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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" "$@"
|
92
2 семестр/Lab3/gradlew.bat
vendored
Normal file
92
2 семестр/Lab3/gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
1
2 семестр/Lab3/settings.gradle
Normal file
1
2 семестр/Lab3/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'demo'
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DemoApplication implements CommandLineRunner {
|
||||||
|
|
||||||
|
private final CategorieService categorieService;
|
||||||
|
private final MovieService movieService;
|
||||||
|
|
||||||
|
public DemoApplication(CategorieService categorieService, MovieService movieService) {
|
||||||
|
this.categorieService = categorieService;
|
||||||
|
this.movieService = movieService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DemoApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
|
||||||
|
if (args.length > 0 && Objects.equals("--populate", args[0])) {
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
|
||||||
|
final var categorie1 = categorieService.create(new CategorieEntity(
|
||||||
|
"Драма", "placeholder"));
|
||||||
|
final var categorie2 = categorieService.create(new CategorieEntity(
|
||||||
|
"Комедия", "placeholder"));
|
||||||
|
final var categorie3 = categorieService.create(new CategorieEntity(
|
||||||
|
"Хоррор", "placeholder"));
|
||||||
|
|
||||||
|
categories.add(categorie1);
|
||||||
|
categories.add(categorie2);
|
||||||
|
movieService.create(new MovieEntity(categories, "Астрал", "1", "1", "1"));
|
||||||
|
categories.clear();
|
||||||
|
categories.add(categorie3);
|
||||||
|
categories.add(categorie1);
|
||||||
|
movieService.create(new MovieEntity(categories, "Хатико", "2", "2", "2"));
|
||||||
|
categories.clear();
|
||||||
|
categories.add(categorie2);
|
||||||
|
categories.add(categorie1);
|
||||||
|
movieService.create(new MovieEntity(categories, "Паранормальное", "3", "3", "3"));
|
||||||
|
categories.clear();
|
||||||
|
categories.add(categorie3);
|
||||||
|
categories.add(categorie2);
|
||||||
|
movieService.create(new MovieEntity(categories, "Побег из Шоушенка", "4", "4","4"));
|
||||||
|
categories.clear();
|
||||||
|
categories.add(categorie1);
|
||||||
|
categories.add(categorie2);
|
||||||
|
movieService.create(new MovieEntity(categories, "Бойцовский клуб", "5", "5", "5"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.example.demo.categories.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/categorie")
|
||||||
|
|
||||||
|
public class CategorieController {
|
||||||
|
|
||||||
|
private final CategorieService categorieService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public CategorieController(CategorieService categorieService, ModelMapper modelMapper) {
|
||||||
|
this.categorieService = categorieService;
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CategorieDTO toDto(CategorieEntity entity) {
|
||||||
|
return modelMapper.map(entity, CategorieDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CategorieEntity toEntity(CategorieDTO categorieDTO) {
|
||||||
|
return modelMapper.map(categorieDTO, CategorieEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public List<CategorieDTO> getAll() {
|
||||||
|
return categorieService.getAll().stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public CategorieDTO get(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(categorieService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public CategorieDTO create(@RequestBody @Valid CategorieDTO categorieDTO) {
|
||||||
|
|
||||||
|
return toDto(categorieService.create(toEntity(categorieDTO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public CategorieDTO update(@PathVariable(name = "id") Integer id, @RequestBody CategorieDTO categorieDTO) {
|
||||||
|
return toDto(categorieService.update(id, toEntity(categorieDTO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public CategorieDTO delete(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(categorieService.delete(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.example.demo.categories.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
|
public class CategorieDTO {
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 5, max = 50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Size(min = 5, max = 50)
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.example.demo.categories.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "categories")
|
||||||
|
public class CategorieEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(nullable = true)
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@ManyToMany(mappedBy = "categories")
|
||||||
|
private List<MovieEntity> movies;
|
||||||
|
|
||||||
|
public CategorieEntity() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CategorieEntity(String name, String image) {
|
||||||
|
this.name = name;
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final CategorieEntity other = (CategorieEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id) &&
|
||||||
|
Objects.equals(other.getName(), name) &&
|
||||||
|
Objects.equals(other.getImage(), image);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.example.demo.categories.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
|
||||||
|
public interface CategorieRepository extends CrudRepository<CategorieEntity, Integer> {
|
||||||
|
Optional<CategorieEntity> findByNameIgnoreCase(String name);
|
||||||
|
List<CategorieEntity> findAllById(List<Integer> ids);
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.example.demo.categories.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.repository.CategorieRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CategorieService {
|
||||||
|
|
||||||
|
private final CategorieRepository repository;
|
||||||
|
|
||||||
|
public CategorieService(CategorieRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkName(String name) {
|
||||||
|
if (repository.findByNameIgnoreCase(name).isPresent()) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Type with name %s is already exists", name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<CategorieEntity> getAll() {
|
||||||
|
return StreamSupport.stream(repository.findAll().spliterator(), false).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public CategorieEntity get(Integer id) {
|
||||||
|
return repository.findById(id).orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<CategorieEntity> getAllCategories(List<Integer> ids) {
|
||||||
|
return repository.findAllById(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CategorieEntity create(CategorieEntity entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
throw new IllegalArgumentException("Сущность не найдена");
|
||||||
|
}
|
||||||
|
checkName(entity.getName());
|
||||||
|
return repository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CategorieEntity update(Integer id, CategorieEntity entity) {
|
||||||
|
final CategorieEntity existsentity = get(id);
|
||||||
|
existsentity.setName(entity.getName());
|
||||||
|
existsentity.setImage(entity.getImage());
|
||||||
|
return repository.save(existsentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CategorieEntity delete(Integer id) {
|
||||||
|
final CategorieEntity existsentity = get(id);
|
||||||
|
repository.delete(existsentity);
|
||||||
|
return existsentity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.core.configurations;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
public static final String API_URL = "/api";
|
||||||
|
public static final String SEQUENCE_NAME = "hibernate_sequence";
|
||||||
|
|
||||||
|
private Constants() {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.demo.core.configurations;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MapperConfiguration {
|
||||||
|
@Bean
|
||||||
|
ModelMapper modelMapper() {
|
||||||
|
return new ModelMapper();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.example.demo.core.configurations;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer{
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(@NonNull CorsRegistry registry){
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedMethods("GET", "POST", "PUT", "DELETE");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.demo.core.errors;
|
||||||
|
|
||||||
|
public class NotFoundException extends RuntimeException {
|
||||||
|
public NotFoundException(Integer id) {
|
||||||
|
super(String.format("Сущность с айдишником <[%s]> не найден, либо его не существует", id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.demo.core.errors;
|
||||||
|
|
||||||
|
public class NullArgumentException extends RuntimeException {
|
||||||
|
public NullArgumentException(Integer id) {
|
||||||
|
super(String.format("В данной сущности нет объектов в айдишником <[%s]>", id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.example.demo.core.model;
|
||||||
|
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import jakarta.persistence.SequenceGenerator;
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
public abstract class BaseEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = Constants.SEQUENCE_NAME)
|
||||||
|
@SequenceGenerator(name = Constants.SEQUENCE_NAME, sequenceName = Constants.SEQUENCE_NAME, allocationSize = 1)
|
||||||
|
protected Integer id;
|
||||||
|
|
||||||
|
protected BaseEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.example.demo.favorites.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
import com.example.demo.favorites.model.FavoriteEntity;
|
||||||
|
import com.example.demo.favorites.service.FavoriteService;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/favorite")
|
||||||
|
public class FavoriteController {
|
||||||
|
|
||||||
|
private final FavoriteService favoriteService;
|
||||||
|
private final UserService userService;
|
||||||
|
private final MovieService movieService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public FavoriteController(FavoriteService favoriteService, UserService userService,
|
||||||
|
MovieService movieService, ModelMapper modelMapper) {
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
this.userService = userService;
|
||||||
|
this.favoriteService = favoriteService;
|
||||||
|
this.movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FavoriteDto toDto(FavoriteEntity entity) {
|
||||||
|
return modelMapper.map(entity, FavoriteDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private FavoriteEntity toEntity(FavoriteDto dto) {
|
||||||
|
final FavoriteEntity entity = modelMapper.map(dto, FavoriteEntity.class);
|
||||||
|
entity.setMovie(movieService.get(dto.getMovieId()));
|
||||||
|
entity.setUser(userService.get(dto.getUserId()));
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<FavoriteDto> getAll(@RequestParam(name = "userId", defaultValue = "0") Integer userId) {
|
||||||
|
return favoriteService.getAll(userId).stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public FavoriteDto get(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(favoriteService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public FavoriteDto create(@RequestBody @Valid FavoriteDto dto) {
|
||||||
|
return toDto(favoriteService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public FavoriteDto update(@PathVariable(name = "id") Integer id,
|
||||||
|
@RequestBody FavoriteDto dto) {
|
||||||
|
return toDto(favoriteService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public FavoriteDto delete(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(favoriteService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.example.demo.favorites.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class FavoriteDto {
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Integer movieId;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMovieId() {
|
||||||
|
return movieId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMovieId(Integer movieId) {
|
||||||
|
this.movieId = movieId;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.example.demo.favorites.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "favorites")
|
||||||
|
public class FavoriteEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "userId", nullable = false)
|
||||||
|
private UserEntity user;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "movieId", nullable = false)
|
||||||
|
private MovieEntity movie;
|
||||||
|
|
||||||
|
public FavoriteEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FavoriteEntity(UserEntity user, MovieEntity movie) {
|
||||||
|
this.user = user;
|
||||||
|
this.movie = movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(UserEntity user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity getMovie() {
|
||||||
|
return movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMovie(MovieEntity movie) {
|
||||||
|
this.movie = movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, user, movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final FavoriteEntity other = (FavoriteEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getUser(), user)
|
||||||
|
&& Objects.equals(other.getMovie(), movie);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.demo.favorites.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import com.example.demo.favorites.model.FavoriteEntity;
|
||||||
|
|
||||||
|
public interface FavoriteRepository extends CrudRepository<FavoriteEntity, Integer> {
|
||||||
|
List<FavoriteEntity> findByUserId(Integer userId);
|
||||||
|
|
||||||
|
Optional<FavoriteEntity> findOneByUserIdAndId(Integer userId, Integer id);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.example.demo.favorites.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.favorites.model.FavoriteEntity;
|
||||||
|
import com.example.demo.favorites.repository.FavoriteRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FavoriteService {
|
||||||
|
private final FavoriteRepository repository;
|
||||||
|
|
||||||
|
public FavoriteService(FavoriteRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<FavoriteEntity> getAll(Integer userId) {
|
||||||
|
if (userId == 0) {
|
||||||
|
return StreamSupport.stream(repository.findAll().spliterator(), false).toList();
|
||||||
|
}
|
||||||
|
return repository.findByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public FavoriteEntity get(Integer id) {
|
||||||
|
return repository.findById(id).orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public FavoriteEntity create(FavoriteEntity entity) {
|
||||||
|
return repository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public FavoriteEntity update(Integer id, FavoriteEntity entity) {
|
||||||
|
final FavoriteEntity exisEntity = get(id);
|
||||||
|
exisEntity.setUser(entity.getUser());
|
||||||
|
exisEntity.setMovie(entity.getMovie());
|
||||||
|
return repository.save(exisEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public FavoriteEntity delete(Integer id) {
|
||||||
|
final FavoriteEntity exisEntity = get(id);
|
||||||
|
repository.delete(exisEntity);
|
||||||
|
return exisEntity;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.example.demo.movies.api;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/movie")
|
||||||
|
public class MovieController {
|
||||||
|
|
||||||
|
private final MovieService movieService;
|
||||||
|
private final CategorieService categorieService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public MovieController(MovieService movieService, CategorieService categorieService, ModelMapper modelMapper) {
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
this.categorieService = categorieService;
|
||||||
|
this.movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MovieDTO toDto(MovieEntity entity) {
|
||||||
|
return modelMapper.map(entity, MovieDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MovieEntity toEntity(MovieDTO dto) {
|
||||||
|
final MovieEntity entity = modelMapper.map(dto, MovieEntity.class);
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
categories.addAll(categorieService.getAllCategories(dto.getCategoriesIdList()));
|
||||||
|
entity.setCategories(categories);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<MovieDTO> getAll(@RequestParam(name = "categorieId", defaultValue = "0") Integer categorieId) {
|
||||||
|
return movieService.getAll(categorieId).stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public MovieDTO get(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(movieService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public MovieDTO create(@RequestBody @Valid MovieDTO dto) {
|
||||||
|
return toDto(movieService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public MovieDTO update(@PathVariable(name = "id") Integer id, @RequestBody MovieDTO dto) {
|
||||||
|
return toDto(movieService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public MovieDTO delete(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(movieService.delete(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.example.demo.movies.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
|
public class MovieDTO {
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private List<Integer> categoriesIdList;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 2, max = 50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 2, max = 50)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 2, max = 50)
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getCategoriesIdList() {
|
||||||
|
return categoriesIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategorieId(List<Integer> categoriesIdList) {
|
||||||
|
this.categoriesIdList = categoriesIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
package com.example.demo.movies.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "movies")
|
||||||
|
public class MovieEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
private List<CategorieEntity> categories;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 300)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 50)
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
@Column(nullable = true)
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
public MovieEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity(List<CategorieEntity> categories, String name, String description, String duration,
|
||||||
|
String image) {
|
||||||
|
|
||||||
|
this.categories = categories;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.duration = duration;
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CategorieEntity> getCategories() {
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategories(List<CategorieEntity> categories) {
|
||||||
|
this.categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, categories, name, description, duration, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final MovieEntity other = (MovieEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getCategories(), categories)
|
||||||
|
&& Objects.equals(other.getName(), name)
|
||||||
|
&& Objects.equals(other.getDescription(), description)
|
||||||
|
&& Objects.equals(other.getDuration(), duration)
|
||||||
|
&& Objects.equals(other.getImage(), image);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.example.demo.movies.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
|
||||||
|
public interface MovieRepository extends CrudRepository<MovieEntity, Integer> {
|
||||||
|
|
||||||
|
Optional<MovieEntity> findByNameIgnoreCase(String name);
|
||||||
|
|
||||||
|
Optional<MovieEntity> findByCategoriesIdAndId(Integer categoriesId, Integer id);
|
||||||
|
|
||||||
|
List<MovieEntity> findByCategoriesId(Integer categoriesId);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(DISTINCT v.user.id) FROM ViewedEntity v WHERE v.movie.id = :movieId")
|
||||||
|
Integer getCountViews(@Param("movieId") Integer movieId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.example.demo.movies.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.repository.MovieRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MovieService {
|
||||||
|
|
||||||
|
private final MovieRepository repository;
|
||||||
|
|
||||||
|
public MovieService(MovieRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkName(String name) {
|
||||||
|
if (repository.findByNameIgnoreCase(name).isPresent()) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Type with name %s is already exists", name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<MovieEntity> getAll(Integer categoriesId) {
|
||||||
|
|
||||||
|
if (categoriesId == 0) {
|
||||||
|
return StreamSupport.stream(repository.findAll().spliterator(), false).toList();
|
||||||
|
}
|
||||||
|
return repository.findByCategoriesId(categoriesId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public MovieEntity get(Integer id) {
|
||||||
|
return repository.findById(id).orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public MovieEntity create(MovieEntity entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
throw new IllegalArgumentException("Сущность не найдена");
|
||||||
|
}
|
||||||
|
checkName(entity.getName());
|
||||||
|
|
||||||
|
return repository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public MovieEntity update(Integer id, MovieEntity entity) {
|
||||||
|
final MovieEntity exisEntity = get(id);
|
||||||
|
exisEntity.setCategories(entity.getCategories());
|
||||||
|
exisEntity.setName(entity.getName());
|
||||||
|
exisEntity.setDescription(entity.getDescription());
|
||||||
|
exisEntity.setDuration(entity.getDuration());
|
||||||
|
exisEntity.setImage(entity.getImage());
|
||||||
|
return repository.save(exisEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public MovieEntity delete(Integer id) {
|
||||||
|
final MovieEntity exisEntity = get(id);
|
||||||
|
repository.delete(exisEntity);
|
||||||
|
return exisEntity;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.example.demo.users.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/user")
|
||||||
|
public class UserController {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public UserController(UserService userService, ModelMapper modelMapper) {
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserEntity toEntity(UserDTO dto) {
|
||||||
|
return modelMapper.map(dto, UserEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserDTO toDto(UserEntity entity) {
|
||||||
|
return modelMapper.map(entity, UserDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public List<UserDTO> getAll() {
|
||||||
|
return userService.getAll().stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public UserDTO get(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(userService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public UserDTO create(@RequestBody @Valid UserDTO userDTO) {
|
||||||
|
|
||||||
|
return toDto(userService.create(toEntity(userDTO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public UserDTO update(@PathVariable(name = "id") Integer id, @RequestBody UserDTO userDTO) {
|
||||||
|
return toDto(userService.update(id, toEntity(userDTO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public UserDTO delete(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(userService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.demo.users.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
|
public class UserDTO {
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 2, max = 50)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 2, max = 10)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private boolean isAdmin;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsAdmin(boolean isAdmin) {
|
||||||
|
this.isAdmin = isAdmin;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.example.demo.users.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "users")
|
||||||
|
public class UserEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 15)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 5)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private boolean isAdmin;
|
||||||
|
|
||||||
|
public UserEntity() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity(String username, String password, boolean isAdmin) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.isAdmin = isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsAdmin(boolean isAdmin) {
|
||||||
|
this.isAdmin = isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, username, password, isAdmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final UserEntity other = (UserEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id) &&
|
||||||
|
Objects.equals(other.getUsername(), username) &&
|
||||||
|
Objects.equals(other.getIsAdmin(), isAdmin) &&
|
||||||
|
Objects.equals(other.getPassword(), password);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.users.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
|
||||||
|
public interface UserRepository extends CrudRepository<UserEntity, Integer> {
|
||||||
|
Optional<UserEntity> findByUsernameIgnoreCase(String username);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.example.demo.users.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.repository.UserRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserService {
|
||||||
|
private final UserRepository repository;
|
||||||
|
|
||||||
|
public UserService(UserRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<UserEntity> getAll() {
|
||||||
|
return StreamSupport.stream(repository.findAll().spliterator(), false).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public UserEntity get(Integer id) {
|
||||||
|
return repository.findById(id).orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UserEntity create(UserEntity entity) {
|
||||||
|
return repository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UserEntity update(Integer id, UserEntity entity) {
|
||||||
|
final UserEntity existsentity = get(id);
|
||||||
|
existsentity.setUsername(entity.getUsername());
|
||||||
|
existsentity.setPassword(entity.getPassword());
|
||||||
|
existsentity.setIsAdmin(entity.getIsAdmin());
|
||||||
|
return repository.save(existsentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UserEntity delete(Integer id) {
|
||||||
|
final UserEntity existsentity = get(id);
|
||||||
|
repository.delete(existsentity);
|
||||||
|
return existsentity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.example.demo.viewed.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.example.demo.core.configurations.Constants;
|
||||||
|
import com.example.demo.viewed.model.ViewedEntity;
|
||||||
|
import com.example.demo.viewed.service.ViewedService;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_URL + "/viewed")
|
||||||
|
public class ViewedController {
|
||||||
|
|
||||||
|
private final ViewedService viewedService;
|
||||||
|
private final UserService userService;
|
||||||
|
private final MovieService movieService;
|
||||||
|
private final ModelMapper modelMapper;
|
||||||
|
|
||||||
|
public ViewedController(
|
||||||
|
ViewedService viewedService, UserService userService,
|
||||||
|
MovieService movieService, ModelMapper modelMapper) {
|
||||||
|
this.modelMapper = modelMapper;
|
||||||
|
this.userService = userService;
|
||||||
|
this.viewedService = viewedService;
|
||||||
|
this.movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ViewedDto toDto(ViewedEntity entity) {
|
||||||
|
return modelMapper.map(entity, ViewedDto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ViewedEntity toEntity(ViewedDto dto) {
|
||||||
|
final ViewedEntity entity = modelMapper.map(dto, ViewedEntity.class);
|
||||||
|
entity.setMovie(movieService.get(dto.getMovieId()));
|
||||||
|
entity.setUser(userService.get(dto.getUserId()));
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<ViewedDto> getAll(@RequestParam(name = "userId", defaultValue = "0") Integer userId) {
|
||||||
|
return viewedService.getAll(userId).stream().map(this::toDto).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ViewedDto get(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(viewedService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ViewedDto create(@RequestBody @Valid ViewedDto dto) {
|
||||||
|
return toDto(viewedService.create(toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ViewedDto update(@PathVariable(name = "id") Integer id,
|
||||||
|
@RequestBody ViewedDto dto) {
|
||||||
|
return toDto(viewedService.update(id, toEntity(dto)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ViewedDto delete(@PathVariable(name = "id") Integer id) {
|
||||||
|
return toDto(viewedService.delete(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.example.demo.viewed.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class ViewedDto {
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Min(1)
|
||||||
|
private Integer movieId;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMovieId() {
|
||||||
|
return movieId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMovieId(Integer movieId) {
|
||||||
|
this.movieId = movieId;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.example.demo.viewed.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "viewes")
|
||||||
|
public class ViewedEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "userId", nullable = false)
|
||||||
|
private UserEntity user;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "movieId", nullable = false)
|
||||||
|
private MovieEntity movie;
|
||||||
|
|
||||||
|
public ViewedEntity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewedEntity(UserEntity user, MovieEntity movie) {
|
||||||
|
this.user = user;
|
||||||
|
this.movie = movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(UserEntity user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieEntity getMovie() {
|
||||||
|
return movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMovie(MovieEntity movie) {
|
||||||
|
this.movie = movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, user, movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null || getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final ViewedEntity other = (ViewedEntity) obj;
|
||||||
|
return Objects.equals(other.getId(), id)
|
||||||
|
&& Objects.equals(other.getUser(), user)
|
||||||
|
&& Objects.equals(other.getMovie(), movie);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.example.demo.viewed.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import com.example.demo.viewed.model.ViewedEntity;
|
||||||
|
|
||||||
|
public interface ViewedRepository extends CrudRepository<ViewedEntity, Integer> {
|
||||||
|
|
||||||
|
List<ViewedEntity> findByUserId(Integer userId);
|
||||||
|
|
||||||
|
Optional<ViewedEntity> findOneByUserIdAndId(Integer userId, Integer id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.example.demo.viewed.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.viewed.model.ViewedEntity;
|
||||||
|
import com.example.demo.viewed.repository.ViewedRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ViewedService {
|
||||||
|
private final ViewedRepository repository;
|
||||||
|
|
||||||
|
public ViewedService(ViewedRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<ViewedEntity> getAll(Integer userId) {
|
||||||
|
if (userId == 0) {
|
||||||
|
return StreamSupport.stream(repository.findAll().spliterator(), false).toList();
|
||||||
|
}
|
||||||
|
return repository.findByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public ViewedEntity get(Integer id) {
|
||||||
|
return repository.findById(id).orElseThrow(() -> new NotFoundException(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ViewedEntity create(ViewedEntity entity) {
|
||||||
|
return repository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ViewedEntity update(Integer id, ViewedEntity entity) {
|
||||||
|
final ViewedEntity exisEntity = get(id);
|
||||||
|
exisEntity.setUser(entity.getUser());
|
||||||
|
exisEntity.setMovie(entity.getMovie());
|
||||||
|
return repository.save(exisEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ViewedEntity delete(Integer id) {
|
||||||
|
final ViewedEntity exisEntity = get(id);
|
||||||
|
repository.delete(exisEntity);
|
||||||
|
return exisEntity;
|
||||||
|
}
|
||||||
|
}
|
1
2 семестр/Lab3/src/main/resources/application.properties
Normal file
1
2 семестр/Lab3/src/main/resources/application.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class CategorieServiceTests {
|
||||||
|
@Autowired
|
||||||
|
private CategorieService categorieService;
|
||||||
|
|
||||||
|
private CategorieEntity categorie;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
|
||||||
|
categorie = categorieService.create(new CategorieEntity("Ужасы", "null"));
|
||||||
|
categorieService.create(new CategorieEntity("Боевик", "null"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
categorieService.getAll().forEach(item -> categorieService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> categorieService.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createTest() {
|
||||||
|
Assertions.assertEquals(2, categorieService.getAll().size());
|
||||||
|
Assertions.assertEquals(categorie, categorieService.get(categorie.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createNotUniqueTest() {
|
||||||
|
final CategorieEntity nonUniqueCategorie = new CategorieEntity("Ужасы", "null");
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> categorieService.create(nonUniqueCategorie));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createNullableTest() {
|
||||||
|
final CategorieEntity nullableCategorie = new CategorieEntity(null, "null");
|
||||||
|
Assertions.assertThrows(DataIntegrityViolationException.class, () -> categorieService.create(
|
||||||
|
nullableCategorie));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateTest() {
|
||||||
|
final String newName = "TEST";
|
||||||
|
final String oldName = categorie.getName();
|
||||||
|
final CategorieEntity cat = new CategorieEntity(newName, categorie.getImage());
|
||||||
|
final CategorieEntity newEntity = categorieService.update(categorie.getId(), cat);
|
||||||
|
Assertions.assertEquals(newName, newEntity.getName());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteTest() {
|
||||||
|
categorieService.delete(categorie.getId());
|
||||||
|
Assertions.assertEquals(1, categorieService.getAll().size());
|
||||||
|
|
||||||
|
Assertions.assertNotEquals(3, categorieService.getAll().size());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.favorites.model.FavoriteEntity;
|
||||||
|
import com.example.demo.favorites.service.FavoriteService;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class FavoriteServiceTests {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FavoriteService favoriteService;
|
||||||
|
|
||||||
|
private FavoriteEntity lastFavorite;
|
||||||
|
private FavoriteEntity lastFavorite2;
|
||||||
|
|
||||||
|
private CategorieEntity cat1;
|
||||||
|
private MovieEntity mov1;
|
||||||
|
private MovieEntity mov2;
|
||||||
|
private UserEntity us1;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CategorieService categorieService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MovieService movieService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
|
||||||
|
cat1 = categorieService.create(new CategorieEntity("Фэнтэзи", "123"));
|
||||||
|
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
|
||||||
|
final var categorie1 = categorieService.create(new CategorieEntity(
|
||||||
|
"Драма", "placeholder"));
|
||||||
|
final var categorie2 = categorieService.create(new CategorieEntity(
|
||||||
|
"Комедия", "placeholder"));
|
||||||
|
|
||||||
|
|
||||||
|
categories.add(categorie1);
|
||||||
|
categories.add(categorie2);
|
||||||
|
|
||||||
|
mov1 = movieService.create(new MovieEntity(categories, "Астрал", "1", "1", "1"));
|
||||||
|
mov2 = movieService.create(new MovieEntity(categories, "Крепкий орешек","2", "2", "2"));
|
||||||
|
|
||||||
|
us1 = userService.create(new UserEntity("Yourdax", "123", true));
|
||||||
|
|
||||||
|
lastFavorite = favoriteService.create(new FavoriteEntity(us1, mov1));
|
||||||
|
lastFavorite2 = favoriteService.create(new FavoriteEntity(us1, mov2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
favoriteService.getAll(0).forEach(fv -> favoriteService.delete(fv.getId()));
|
||||||
|
userService.getAll().forEach(u -> userService.delete(u.getId()));
|
||||||
|
movieService.getAll(0).forEach(item -> movieService.delete(item.getId()));
|
||||||
|
categorieService.getAll().forEach(item -> categorieService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> favoriteService.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createTest() {
|
||||||
|
Assertions.assertEquals(2, favoriteService.getAll(us1.getId()).size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void update() {
|
||||||
|
final FavoriteEntity fav = favoriteService.create(new FavoriteEntity(us1, mov2));
|
||||||
|
|
||||||
|
final FavoriteEntity oldFav = favoriteService.get(lastFavorite.getId());
|
||||||
|
|
||||||
|
final FavoriteEntity newFav = favoriteService.update(lastFavorite2.getId(), fav);
|
||||||
|
|
||||||
|
Assertions.assertNotEquals(oldFav.getMovie().getName(),
|
||||||
|
newFav.getMovie().getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void delete() {
|
||||||
|
|
||||||
|
favoriteService.delete(lastFavorite.getId());
|
||||||
|
|
||||||
|
Assertions.assertEquals(1, favoriteService.getAll(us1.getId()).size());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
||||||
|
import com.example.demo.categories.model.CategorieEntity;
|
||||||
|
import com.example.demo.categories.service.CategorieService;
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.viewed.model.ViewedEntity;
|
||||||
|
import com.example.demo.movies.model.MovieEntity;
|
||||||
|
import com.example.demo.movies.service.MovieService;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
import com.example.demo.viewed.service.ViewedService;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class MovieServiceTest {
|
||||||
|
@Autowired
|
||||||
|
private MovieService movieService;
|
||||||
|
|
||||||
|
private MovieEntity movie;
|
||||||
|
private MovieEntity movie2;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CategorieService categorieService;
|
||||||
|
|
||||||
|
private CategorieEntity cat1;
|
||||||
|
private CategorieEntity cat2;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private UserEntity user;
|
||||||
|
private UserEntity user1;
|
||||||
|
private UserEntity user2;
|
||||||
|
private UserEntity user3;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ViewedService viewedService;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
cat1 = categorieService.create(new CategorieEntity("Drama", "null"));
|
||||||
|
cat2 = categorieService.create(new CategorieEntity("Boevik", "null"));
|
||||||
|
|
||||||
|
categories.add(cat1);
|
||||||
|
categories.add(cat2);
|
||||||
|
|
||||||
|
user = userService.create(new UserEntity("1", "1", true));
|
||||||
|
user1 = userService.create(new UserEntity("2", "2", true));
|
||||||
|
user2 = userService.create(new UserEntity("3", "3", true));
|
||||||
|
user3 = userService.create(new UserEntity("4", "4", true));
|
||||||
|
|
||||||
|
movie = movieService.create(new MovieEntity(categories, "1", "1", "1", "1"));
|
||||||
|
movie2 = movieService.create(new MovieEntity(categories, "2", "2", "2", "2"));
|
||||||
|
|
||||||
|
viewedService.create(new ViewedEntity(user, movie));
|
||||||
|
viewedService.create(new ViewedEntity(user1, movie));
|
||||||
|
viewedService.create(new ViewedEntity(user2, movie));
|
||||||
|
viewedService.create(new ViewedEntity(user3, movie));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
viewedService.getAll(0).forEach(vs -> viewedService.delete(vs.getId()));
|
||||||
|
userService.getAll().forEach(u -> userService.delete(u.getId()));
|
||||||
|
movieService.getAll(0).forEach(item -> movieService.delete(item.getId()));
|
||||||
|
categorieService.getAll().forEach(item -> categorieService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void countCategorieTest() {
|
||||||
|
assertEquals(2, movie.getCategories().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> movieService.get(10));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void createTest() {
|
||||||
|
Assertions.assertEquals(2, movieService.getAll(cat1.getId()).size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void createNotUniqueTest() {
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
|
||||||
|
categories.add(cat1);
|
||||||
|
final MovieEntity nonUniqueCategorie = new MovieEntity(categories, "1", "1", "1",
|
||||||
|
"1");
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> movieService.create(nonUniqueCategorie));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(4)
|
||||||
|
void createNullableTest() {
|
||||||
|
List<CategorieEntity> categories = new ArrayList<>();
|
||||||
|
categories.add(cat1);
|
||||||
|
final MovieEntity nullableCategorie = new MovieEntity(categories, null, "1", "1",
|
||||||
|
"1");
|
||||||
|
Assertions.assertThrows(DataIntegrityViolationException.class, () -> movieService.create(
|
||||||
|
nullableCategorie));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(5)
|
||||||
|
void updateTest() {
|
||||||
|
final String newName = "TEST";
|
||||||
|
final String oldName = movie.getName();
|
||||||
|
final MovieEntity mov = new MovieEntity(movie.getCategories(),
|
||||||
|
newName, movie.getDescription(),
|
||||||
|
movie.getDuration(), movie.getImage());
|
||||||
|
final MovieEntity newEntity = movieService.update(movie.getId(), mov);
|
||||||
|
Assertions.assertEquals(newName, newEntity.getName());
|
||||||
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(6)
|
||||||
|
void deleteTest() {
|
||||||
|
movieService.delete(movie2.getId());
|
||||||
|
Assertions.assertEquals(1, movieService.getAll(cat1.getId()).size());
|
||||||
|
|
||||||
|
Assertions.assertNotEquals(3, movieService.getAll(cat1.getId()).size());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import com.example.demo.core.errors.NotFoundException;
|
||||||
|
import com.example.demo.users.model.UserEntity;
|
||||||
|
import com.example.demo.users.service.UserService;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
|
class UserServiceTests {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private UserEntity firstUser;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
|
||||||
|
firstUser = userService.create(new UserEntity("Yourdax", "123", true));
|
||||||
|
userService.create(new UserEntity("Ivan", "789", false));
|
||||||
|
userService.create(new UserEntity("Nikita", "456", false));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
userService.getAll().forEach(item -> userService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getTest() {
|
||||||
|
Assertions.assertThrows(NotFoundException.class, () -> userService.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
void createTest() {
|
||||||
|
|
||||||
|
Assertions.assertEquals(firstUser, userService.get(firstUser.getId()));
|
||||||
|
Assertions.assertEquals(3, userService.getAll().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
void update() {
|
||||||
|
final String newPassword = "000";
|
||||||
|
final UserEntity existEntity = userService.get(firstUser.getId());
|
||||||
|
final String oldPassword = existEntity.getPassword();
|
||||||
|
final UserEntity entity = new UserEntity(existEntity.getUsername(), newPassword,
|
||||||
|
existEntity.getIsAdmin());
|
||||||
|
final UserEntity newEntity = userService.update(firstUser.getId(), entity);
|
||||||
|
Assertions.assertEquals(newPassword, newEntity.getPassword());
|
||||||
|
Assertions.assertNotEquals(oldPassword, newEntity.getPassword());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
void delete() {
|
||||||
|
userService.delete(firstUser.getId());
|
||||||
|
Assertions.assertEquals(2, userService.getAll().size());
|
||||||
|
}
|
||||||
|
}
|
36
2 семестр/Lab4-5/.gitignore
vendored
Normal file
36
2 семестр/Lab4-5/.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
data.*.db
|
12
2 семестр/Lab4-5/.vscode/extensions.json
vendored
Normal file
12
2 семестр/Lab4-5/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
// fronted
|
||||||
|
"AndersEAndersen.html-class-suggestions",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
// backend
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"vmware.vscode-boot-dev-pack",
|
||||||
|
"vscjava.vscode-gradle",
|
||||||
|
"redhat.vscode-xml"
|
||||||
|
]
|
||||||
|
}
|
11
2 семестр/Lab4-5/.vscode/launch.json
vendored
Normal file
11
2 семестр/Lab4-5/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "DemoApplication",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "com.example.demo.DemoApplication",
|
||||||
|
"projectName": "Lab4-5"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
24
2 семестр/Lab4-5/.vscode/settings.json
vendored
Normal file
24
2 семестр/Lab4-5/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"editor.detectIndentation": false,
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"editor.formatOnPaste": true,
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.formatOnType": false,
|
||||||
|
"java.compile.nullAnalysis.mode": "disabled",
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"[java]": {
|
||||||
|
"editor.pasteAs.enabled": false,
|
||||||
|
},
|
||||||
|
"gradle.nestedProjects": true,
|
||||||
|
"java.saveActions.organizeImports": true,
|
||||||
|
"java.dependency.packagePresentation": "hierarchical",
|
||||||
|
"spring-boot.ls.problem.boot2.JAVA_CONSTRUCTOR_PARAMETER_INJECTION": "WARNING",
|
||||||
|
"spring.initializr.defaultLanguage": "Java",
|
||||||
|
"java.format.settings.url": ".vscode/eclipse-formatter.xml",
|
||||||
|
"java.project.explorer.showNonJavaResources": true,
|
||||||
|
"java.codeGeneration.hashCodeEquals.useJava7Objects": true,
|
||||||
|
"cSpell.words": [
|
||||||
|
"classappend"
|
||||||
|
],
|
||||||
|
}
|
51
2 семестр/Lab4-5/build.gradle
Normal file
51
2 семестр/Lab4-5/build.gradle
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.2.4'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.example'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
defaultTasks 'bootRun'
|
||||||
|
|
||||||
|
jar {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
bootJar {
|
||||||
|
archiveFileName = String.format('%s-%s.jar', rootProject.name, version)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert System.properties['java.specification.version'] == '17' || '21'
|
||||||
|
java {
|
||||||
|
sourceCompatibility = '17'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
|
implementation 'org.modelmapper:modelmapper:3.2.0'
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
|
implementation 'com.h2database:h2:2.2.224'
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-devtools'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
|
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0'
|
||||||
|
runtimeOnly 'org.webjars.npm:bootstrap:5.3.3'
|
||||||
|
runtimeOnly 'org.webjars.npm:bootstrap-icons:1.11.3'
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
|
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
|
||||||
|
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
BIN
2 семестр/Lab4-5/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
2 семестр/Lab4-5/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
2 семестр/Lab4-5/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
2 семестр/Lab4-5/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
2 семестр/Lab4-5/gradlew
vendored
Normal file
249
2 семестр/Lab4-5/gradlew
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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 ;; #(
|
||||||
|
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
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
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" && ! "$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
|
||||||
|
|
||||||
|
# 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" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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" "$@"
|
92
2 семестр/Lab4-5/gradlew.bat
vendored
Normal file
92
2 семестр/Lab4-5/gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
228
2 семестр/Lab4-5/hs_err_pid3688.log
Normal file
228
2 семестр/Lab4-5/hs_err_pid3688.log
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
#
|
||||||
|
# There is insufficient memory for the Java Runtime Environment to continue.
|
||||||
|
# Native memory allocation (mmap) failed to map 536870912 bytes for G1 virtual space
|
||||||
|
# Possible reasons:
|
||||||
|
# The system is out of physical RAM or swap space
|
||||||
|
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
|
||||||
|
# Possible solutions:
|
||||||
|
# Reduce memory load on the system
|
||||||
|
# Increase physical memory or swap space
|
||||||
|
# Check if swap backing store is full
|
||||||
|
# Decrease Java heap size (-Xmx/-Xms)
|
||||||
|
# Decrease number of Java threads
|
||||||
|
# Decrease Java thread stack sizes (-Xss)
|
||||||
|
# Set larger code cache with -XX:ReservedCodeCacheSize=
|
||||||
|
# JVM is running with Zero Based Compressed Oops mode in which the Java heap is
|
||||||
|
# placed in the first 32GB address space. The Java Heap base address is the
|
||||||
|
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
|
||||||
|
# to set the Java Heap base and to place the Java Heap above 32GB virtual address.
|
||||||
|
# This output file may be truncated or incomplete.
|
||||||
|
#
|
||||||
|
# Out of Memory Error (os_windows.cpp:3613), pid=3688, tid=20112
|
||||||
|
#
|
||||||
|
# JRE version: (17.0.10+7) (build )
|
||||||
|
# Java VM: OpenJDK 64-Bit Server VM (17.0.10+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
|
||||||
|
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
|
||||||
|
#
|
||||||
|
|
||||||
|
--------------- S U M M A R Y ------------
|
||||||
|
|
||||||
|
Command Line: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED -Dplugin.dir=D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\plugins com.microsoft.java.bs.core.Launcher
|
||||||
|
|
||||||
|
Host: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz, 12 cores, 31G, Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
|
||||||
|
Time: Wed May 29 22:49:15 2024 Windows 11 , 64 bit Build 22621 (10.0.22621.2506) elapsed time: 0.020621 seconds (0d 0h 0m 0s)
|
||||||
|
|
||||||
|
--------------- T H R E A D ---------------
|
||||||
|
|
||||||
|
Current thread (0x0000027e648cc2e0): JavaThread "Unknown thread" [_thread_in_vm, id=20112, stack(0x00000088d6400000,0x00000088d6500000)]
|
||||||
|
|
||||||
|
Stack: [0x00000088d6400000,0x00000088d6500000]
|
||||||
|
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
|
||||||
|
V [jvm.dll+0x67d2c9]
|
||||||
|
V [jvm.dll+0x834afa]
|
||||||
|
V [jvm.dll+0x8365be]
|
||||||
|
V [jvm.dll+0x836c23]
|
||||||
|
V [jvm.dll+0x2477ff]
|
||||||
|
V [jvm.dll+0x67a109]
|
||||||
|
V [jvm.dll+0x66eb7a]
|
||||||
|
V [jvm.dll+0x30764b]
|
||||||
|
V [jvm.dll+0x30eaf6]
|
||||||
|
V [jvm.dll+0x35e83e]
|
||||||
|
V [jvm.dll+0x35ea6f]
|
||||||
|
V [jvm.dll+0x2de248]
|
||||||
|
V [jvm.dll+0x2df1b4]
|
||||||
|
V [jvm.dll+0x806361]
|
||||||
|
V [jvm.dll+0x36c6f1]
|
||||||
|
V [jvm.dll+0x7e4e06]
|
||||||
|
V [jvm.dll+0x3eff3f]
|
||||||
|
V [jvm.dll+0x3f1b71]
|
||||||
|
C [jli.dll+0x528f]
|
||||||
|
C [ucrtbase.dll+0x29363]
|
||||||
|
C [KERNEL32.DLL+0x1257d]
|
||||||
|
C [ntdll.dll+0x5aa58]
|
||||||
|
|
||||||
|
|
||||||
|
--------------- P R O C E S S ---------------
|
||||||
|
|
||||||
|
Threads class SMR info:
|
||||||
|
_java_thread_list=0x00007ffd92efee98, length=0, elements={
|
||||||
|
}
|
||||||
|
|
||||||
|
Java Threads: ( => current thread )
|
||||||
|
|
||||||
|
Other Threads:
|
||||||
|
0x0000027e64978390 GCTaskThread "GC Thread#0" [stack: 0x00000088d6500000,0x00000088d6600000] [id=9664]
|
||||||
|
0x0000027e79acc050 ConcurrentGCThread "G1 Main Marker" [stack: 0x00000088d6600000,0x00000088d6700000] [id=8220]
|
||||||
|
0x0000027e79acca70 ConcurrentGCThread "G1 Conc#0" [stack: 0x00000088d6700000,0x00000088d6800000] [id=19800]
|
||||||
|
|
||||||
|
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd926bec87]
|
||||||
|
|
||||||
|
VM state: not at safepoint (not fully initialized)
|
||||||
|
|
||||||
|
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
|
||||||
|
[0x0000027e648c6210] Heap_lock - owner thread: 0x0000027e648cc2e0
|
||||||
|
|
||||||
|
Heap address: 0x0000000600c00000, size: 8180 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
|
||||||
|
|
||||||
|
CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 1.
|
||||||
|
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0
|
||||||
|
|
||||||
|
GC Precious Log:
|
||||||
|
<Empty>
|
||||||
|
|
||||||
|
Heap:
|
||||||
|
garbage-first heap total 0K, used 0K [0x0000000600c00000, 0x0000000800000000)
|
||||||
|
region size 4096K, 0 young (0K), 0 survivors (0K)
|
||||||
|
|
||||||
|
[error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd92aa6fb9]
|
||||||
|
|
||||||
|
GC Heap History (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Dll operation events (1 events):
|
||||||
|
Event: 0.014 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.dll
|
||||||
|
|
||||||
|
Deoptimization events (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Classes unloaded (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Classes redefined (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Internal exceptions (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
VM Operations (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Events (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
|
||||||
|
Dynamic libraries:
|
||||||
|
0x00007ff707200000 - 0x00007ff70720e000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.exe
|
||||||
|
0x00007ffe2d350000 - 0x00007ffe2d567000 C:\Windows\SYSTEM32\ntdll.dll
|
||||||
|
0x00007ffe2c1b0000 - 0x00007ffe2c274000 C:\Windows\System32\KERNEL32.DLL
|
||||||
|
0x00007ffe2aa30000 - 0x00007ffe2add6000 C:\Windows\System32\KERNELBASE.dll
|
||||||
|
0x00007ffdf9aa0000 - 0x00007ffdf9ab7000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\jli.dll
|
||||||
|
0x00007ffe2afc0000 - 0x00007ffe2b0d1000 C:\Windows\System32\ucrtbase.dll
|
||||||
|
0x00007ffe2d080000 - 0x00007ffe2d22e000 C:\Windows\System32\USER32.dll
|
||||||
|
0x00007ffe2ade0000 - 0x00007ffe2ae06000 C:\Windows\System32\win32u.dll
|
||||||
|
0x00007ffe2b370000 - 0x00007ffe2b399000 C:\Windows\System32\GDI32.dll
|
||||||
|
0x00007ffe2a6d0000 - 0x00007ffe2a7e8000 C:\Windows\System32\gdi32full.dll
|
||||||
|
0x00007ffdf3520000 - 0x00007ffdf353b000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\VCRUNTIME140.dll
|
||||||
|
0x00007ffe169a0000 - 0x00007ffe16c33000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100\COMCTL32.dll
|
||||||
|
0x00007ffe2a7f0000 - 0x00007ffe2a88a000 C:\Windows\System32\msvcp_win.dll
|
||||||
|
0x00007ffe2c570000 - 0x00007ffe2c617000 C:\Windows\System32\msvcrt.dll
|
||||||
|
0x00007ffe2b330000 - 0x00007ffe2b361000 C:\Windows\System32\IMM32.DLL
|
||||||
|
0x00007ffdff6b0000 - 0x00007ffdff6bc000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\vcruntime140_1.dll
|
||||||
|
0x00007ffdf1cc0000 - 0x00007ffdf1d4d000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\msvcp140.dll
|
||||||
|
0x00007ffd923d0000 - 0x00007ffd93032000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\server\jvm.dll
|
||||||
|
0x00007ffe2cfc0000 - 0x00007ffe2d073000 C:\Windows\System32\ADVAPI32.dll
|
||||||
|
0x00007ffe2b260000 - 0x00007ffe2b308000 C:\Windows\System32\sechost.dll
|
||||||
|
0x00007ffe2aa00000 - 0x00007ffe2aa28000 C:\Windows\System32\bcrypt.dll
|
||||||
|
0x00007ffe2c620000 - 0x00007ffe2c737000 C:\Windows\System32\RPCRT4.dll
|
||||||
|
0x00007ffe2a5a0000 - 0x00007ffe2a5ed000 C:\Windows\SYSTEM32\POWRPROF.dll
|
||||||
|
0x00007ffe226f0000 - 0x00007ffe22724000 C:\Windows\SYSTEM32\WINMM.dll
|
||||||
|
0x00007ffe0c080000 - 0x00007ffe0c089000 C:\Windows\SYSTEM32\WSOCK32.dll
|
||||||
|
0x00007ffe2c9c0000 - 0x00007ffe2ca31000 C:\Windows\System32\WS2_32.dll
|
||||||
|
0x00007ffe23450000 - 0x00007ffe2345a000 C:\Windows\SYSTEM32\VERSION.dll
|
||||||
|
0x00007ffe2a580000 - 0x00007ffe2a593000 C:\Windows\SYSTEM32\UMPDC.dll
|
||||||
|
0x00007ffe29680000 - 0x00007ffe29698000 C:\Windows\SYSTEM32\kernel.appcore.dll
|
||||||
|
0x00007ffdfed50000 - 0x00007ffdfed5a000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\jimage.dll
|
||||||
|
0x00007ffe20d90000 - 0x00007ffe20fc3000 C:\Windows\SYSTEM32\DBGHELP.DLL
|
||||||
|
0x00007ffe2b3a0000 - 0x00007ffe2b729000 C:\Windows\System32\combase.dll
|
||||||
|
0x00007ffe2c290000 - 0x00007ffe2c367000 C:\Windows\System32\OLEAUT32.dll
|
||||||
|
0x00007ffdc94e0000 - 0x00007ffdc9512000 C:\Windows\SYSTEM32\dbgcore.DLL
|
||||||
|
0x00007ffe2ae10000 - 0x00007ffe2ae8a000 C:\Windows\System32\bcryptPrimitives.dll
|
||||||
|
0x00007ffdf33b0000 - 0x00007ffdf33d5000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.dll
|
||||||
|
|
||||||
|
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
|
||||||
|
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\server
|
||||||
|
|
||||||
|
VM Arguments:
|
||||||
|
jvm_args: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED -Dplugin.dir=D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\plugins
|
||||||
|
java_command: com.microsoft.java.bs.core.Launcher
|
||||||
|
java_class_path (initial): D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\server.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\bsp4j-2.1.0-M4.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\checker-qual-3.5.0.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\commons-lang3-3.13.0.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\error_prone_annotations-2.3.4.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\failureaccess-1.0.1.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\gradle-tooling-api-8.1.1.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\gson-2.9.1.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\guava-30.1-jre.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\j2objc-annotations-1.3.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\jsr305-3.0.2.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\model.jar;D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\..\..\vscjava.vscode-gradle-3.13.5\server\runtime\org.eclipse
|
||||||
|
Launcher Type: SUN_STANDARD
|
||||||
|
|
||||||
|
[Global flags]
|
||||||
|
intx CICompilerCount = 4 {product} {ergonomic}
|
||||||
|
uint ConcGCThreads = 3 {product} {ergonomic}
|
||||||
|
uint G1ConcRefinementThreads = 10 {product} {ergonomic}
|
||||||
|
size_t G1HeapRegionSize = 4194304 {product} {ergonomic}
|
||||||
|
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
|
||||||
|
size_t InitialHeapSize = 536870912 {product} {ergonomic}
|
||||||
|
size_t MarkStackSize = 4194304 {product} {ergonomic}
|
||||||
|
size_t MaxHeapSize = 8577351680 {product} {ergonomic}
|
||||||
|
size_t MinHeapDeltaBytes = 4194304 {product} {ergonomic}
|
||||||
|
size_t MinHeapSize = 8388608 {product} {ergonomic}
|
||||||
|
uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic}
|
||||||
|
uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
|
||||||
|
uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
|
||||||
|
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
|
||||||
|
bool SegmentedCodeCache = true {product} {ergonomic}
|
||||||
|
size_t SoftMaxHeapSize = 8577351680 {manageable} {ergonomic}
|
||||||
|
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
|
||||||
|
bool UseCompressedOops = true {product lp64_product} {ergonomic}
|
||||||
|
bool UseG1GC = true {product} {ergonomic}
|
||||||
|
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
|
||||||
|
|
||||||
|
Logging:
|
||||||
|
Log output configuration:
|
||||||
|
#0: stdout all=warning uptime,level,tags
|
||||||
|
#1: stderr all=off uptime,level,tags
|
||||||
|
|
||||||
|
Environment Variables:
|
||||||
|
PATH=C:\Program Files\Eclipse Adoptium\jdk-21.0.3.9-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;D:\Users\Leo\AppData\Local\Microsoft\WindowsApps;D:\Users\Leo\AppData\Local\Programs\Microsoft VS Code\bin;D:\Users\Leo\.dotnet\tools
|
||||||
|
USERNAME=Leo
|
||||||
|
OS=Windows_NT
|
||||||
|
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
|
||||||
|
TMP=C:\Temp
|
||||||
|
TEMP=C:\Temp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Periodic native trim disabled
|
||||||
|
|
||||||
|
|
||||||
|
--------------- S Y S T E M ---------------
|
||||||
|
|
||||||
|
OS:
|
||||||
|
Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
|
||||||
|
OS uptime: 0 days 7:45 hours
|
||||||
|
|
||||||
|
CPU: total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10 microcode 0xde, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, rtm, adx, fma, vzeroupper, clflush, clflushopt
|
||||||
|
Processor Information for all 12 processors :
|
||||||
|
Max Mhz: 3192, Current Mhz: 3192, Mhz Limit: 3192
|
||||||
|
|
||||||
|
Memory: 4k page, system-wide physical 32714M (6252M free)
|
||||||
|
TotalPageFile size 32714M (AvailPageFile size 362M)
|
||||||
|
current process WorkingSet (physical memory assigned to process): 12M, peak: 12M
|
||||||
|
current process commit charge ("private bytes"): 64M, peak: 576M
|
||||||
|
|
||||||
|
vm_info: OpenJDK 64-Bit Server VM (17.0.10+7) for windows-amd64 JRE (17.0.10+7), built on Jan 16 2024 23:25:11 by "admin" with MS VC++ 16.10 / 16.11 (VS2019)
|
||||||
|
|
||||||
|
END.
|
760
2 семестр/Lab4-5/hs_err_pid6804.log
Normal file
760
2 семестр/Lab4-5/hs_err_pid6804.log
Normal file
@ -0,0 +1,760 @@
|
|||||||
|
#
|
||||||
|
# There is insufficient memory for the Java Runtime Environment to continue.
|
||||||
|
# Native memory allocation (malloc) failed to allocate 1813616 bytes for Chunk::new
|
||||||
|
# Possible reasons:
|
||||||
|
# The system is out of physical RAM or swap space
|
||||||
|
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
|
||||||
|
# Possible solutions:
|
||||||
|
# Reduce memory load on the system
|
||||||
|
# Increase physical memory or swap space
|
||||||
|
# Check if swap backing store is full
|
||||||
|
# Decrease Java heap size (-Xmx/-Xms)
|
||||||
|
# Decrease number of Java threads
|
||||||
|
# Decrease Java thread stack sizes (-Xss)
|
||||||
|
# Set larger code cache with -XX:ReservedCodeCacheSize=
|
||||||
|
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is
|
||||||
|
# placed in the first 4GB address space. The Java Heap base address is the
|
||||||
|
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
|
||||||
|
# to set the Java Heap base and to place the Java Heap above 4GB virtual address.
|
||||||
|
# This output file may be truncated or incomplete.
|
||||||
|
#
|
||||||
|
# Out of Memory Error (arena.cpp:191), pid=6804, tid=19748
|
||||||
|
#
|
||||||
|
# JRE version: OpenJDK Runtime Environment Temurin-17.0.10+7 (17.0.10+7) (build 17.0.10+7)
|
||||||
|
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (17.0.10+7, mixed mode, tiered, compressed oops, compressed class ptrs, parallel gc, windows-amd64)
|
||||||
|
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
|
||||||
|
#
|
||||||
|
|
||||||
|
--------------- S U M M A R Y ------------
|
||||||
|
|
||||||
|
Command Line: --add-modules=ALL-SYSTEM --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -DDetectVMInstallationsJob.disabled=true -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\lombok\lombok-1.18.32.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=d:\Users\Leo\AppData\Roaming\Code\User\workspaceStorage\6df9095751c7a8980dc2d97141507ccf\redhat.java -Daether.dependencyCollector.impl=bf d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.800.v20240330-1250.jar -configuration d:\Users\Leo\AppData\Roaming\Code\User\globalStorage\redhat.java\1.30.0\config_win -data d:\Users\Leo\AppData\Roaming\Code\User\workspaceStorage\6df9095751c7a8980dc2d97141507ccf\redhat.java\jdt_ws --pipe=\\.\pipe\lsp-caf0488237ebe000a356048faf0dfab7-sock
|
||||||
|
|
||||||
|
Host: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz, 12 cores, 31G, Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
|
||||||
|
Time: Wed May 29 22:49:05 2024 Windows 11 , 64 bit Build 22621 (10.0.22621.2506) elapsed time: 9.665292 seconds (0d 0h 0m 9s)
|
||||||
|
|
||||||
|
--------------- T H R E A D ---------------
|
||||||
|
|
||||||
|
Current thread (0x000002387d028240): JavaThread "C2 CompilerThread2" daemon [_thread_in_native, id=19748, stack(0x0000009137c00000,0x0000009137d00000)]
|
||||||
|
|
||||||
|
|
||||||
|
Current CompileTask:
|
||||||
|
C2: 9665 5354 ! 4 org.eclipse.osgi.internal.loader.BundleLoader::findRequiredSource (283 bytes)
|
||||||
|
|
||||||
|
Stack: [0x0000009137c00000,0x0000009137d00000]
|
||||||
|
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
|
||||||
|
V [jvm.dll+0x67d2c9]
|
||||||
|
V [jvm.dll+0x834afa]
|
||||||
|
V [jvm.dll+0x8365be]
|
||||||
|
V [jvm.dll+0x836c23]
|
||||||
|
V [jvm.dll+0x2477ff]
|
||||||
|
V [jvm.dll+0xac514]
|
||||||
|
V [jvm.dll+0xacb5c]
|
||||||
|
V [jvm.dll+0x366782]
|
||||||
|
V [jvm.dll+0x330bfa]
|
||||||
|
V [jvm.dll+0x33009a]
|
||||||
|
V [jvm.dll+0x219ef1]
|
||||||
|
V [jvm.dll+0x219311]
|
||||||
|
V [jvm.dll+0x1a502d]
|
||||||
|
V [jvm.dll+0x2290de]
|
||||||
|
V [jvm.dll+0x2272ac]
|
||||||
|
V [jvm.dll+0x7e9bb7]
|
||||||
|
V [jvm.dll+0x7e3fba]
|
||||||
|
V [jvm.dll+0x67c1b5]
|
||||||
|
C [ucrtbase.dll+0x29363]
|
||||||
|
C [KERNEL32.DLL+0x1257d]
|
||||||
|
C [ntdll.dll+0x5aa58]
|
||||||
|
|
||||||
|
|
||||||
|
--------------- P R O C E S S ---------------
|
||||||
|
|
||||||
|
Threads class SMR info:
|
||||||
|
_java_thread_list=0x000002387b733160, length=43, elements={
|
||||||
|
0x000002385d7503c0, 0x0000023873527020, 0x0000023873527af0, 0x00000238786054a0,
|
||||||
|
0x0000023878605e70, 0x0000023878606940, 0x0000023878607cd0, 0x0000023878608980,
|
||||||
|
0x00000238786093e0, 0x000002387860c560, 0x0000023878782f20, 0x0000023879e38b40,
|
||||||
|
0x000002387a5a7780, 0x000002387a54a670, 0x000002387a69bba0, 0x000002387a8e5f10,
|
||||||
|
0x000002387ab271b0, 0x000002387a9a77e0, 0x000002387a727f30, 0x000002387a728e60,
|
||||||
|
0x000002387a729370, 0x000002387b342050, 0x000002387a728440, 0x000002387a729880,
|
||||||
|
0x000002387a727510, 0x000002387d028240, 0x000002387a729d90, 0x000002387a726af0,
|
||||||
|
0x000002387ce843f0, 0x000002387ce86c70, 0x000002387ce86760, 0x000002387ce834c0,
|
||||||
|
0x000002387ce85d40, 0x000002387ce86250, 0x000002387ce85320, 0x000002387ce880b0,
|
||||||
|
0x000002387ce84e10, 0x000002387ce84900, 0x000002387ce87ba0, 0x000002387ce83ee0,
|
||||||
|
0x000002387ce87180, 0x000002387ce894f0, 0x000002387ce839d0
|
||||||
|
}
|
||||||
|
|
||||||
|
Java Threads: ( => current thread )
|
||||||
|
0x000002385d7503c0 JavaThread "main" [_thread_blocked, id=12588, stack(0x0000009135700000,0x0000009135800000)]
|
||||||
|
0x0000023873527020 JavaThread "Reference Handler" daemon [_thread_blocked, id=11312, stack(0x0000009135a00000,0x0000009135b00000)]
|
||||||
|
0x0000023873527af0 JavaThread "Finalizer" daemon [_thread_blocked, id=6444, stack(0x0000009135b00000,0x0000009135c00000)]
|
||||||
|
0x00000238786054a0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7428, stack(0x0000009135c00000,0x0000009135d00000)]
|
||||||
|
0x0000023878605e70 JavaThread "Attach Listener" daemon [_thread_blocked, id=21956, stack(0x0000009135d00000,0x0000009135e00000)]
|
||||||
|
0x0000023878606940 JavaThread "Service Thread" daemon [_thread_blocked, id=15400, stack(0x0000009135e00000,0x0000009135f00000)]
|
||||||
|
0x0000023878607cd0 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=10376, stack(0x0000009135f00000,0x0000009136000000)]
|
||||||
|
0x0000023878608980 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=11668, stack(0x0000009136000000,0x0000009136100000)]
|
||||||
|
0x00000238786093e0 JavaThread "C1 CompilerThread0" daemon [_thread_in_vm, id=11156, stack(0x0000009136100000,0x0000009136200000)]
|
||||||
|
0x000002387860c560 JavaThread "Sweeper thread" daemon [_thread_blocked, id=19400, stack(0x0000009136200000,0x0000009136300000)]
|
||||||
|
0x0000023878782f20 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=20652, stack(0x0000009136300000,0x0000009136400000)]
|
||||||
|
0x0000023879e38b40 JavaThread "Notification Thread" daemon [_thread_blocked, id=11340, stack(0x0000009136400000,0x0000009136500000)]
|
||||||
|
0x000002387a5a7780 JavaThread "Active Thread: Equinox Container: 86c7d161-dccf-4e47-b706-52c054c92e66" [_thread_blocked, id=22180, stack(0x0000009136d00000,0x0000009136e00000)]
|
||||||
|
0x000002387a54a670 JavaThread "Framework Event Dispatcher: Equinox Container: 86c7d161-dccf-4e47-b706-52c054c92e66" daemon [_thread_blocked, id=8164, stack(0x0000009136c00000,0x0000009136d00000)]
|
||||||
|
0x000002387a69bba0 JavaThread "Start Level: Equinox Container: 86c7d161-dccf-4e47-b706-52c054c92e66" daemon [_thread_blocked, id=10872, stack(0x0000009136e00000,0x0000009136f00000)]
|
||||||
|
0x000002387a8e5f10 JavaThread "Bundle File Closer" daemon [_thread_blocked, id=17836, stack(0x0000009137100000,0x0000009137200000)]
|
||||||
|
0x000002387ab271b0 JavaThread "SCR Component Actor" daemon [_thread_blocked, id=4956, stack(0x0000009137000000,0x0000009137100000)]
|
||||||
|
0x000002387a9a77e0 JavaThread "SCR Component Registry" daemon [_thread_blocked, id=6296, stack(0x0000009137400000,0x0000009137500000)]
|
||||||
|
0x000002387a727f30 JavaThread "Worker-JM" [_thread_blocked, id=2756, stack(0x0000009137500000,0x0000009137600000)]
|
||||||
|
0x000002387a728e60 JavaThread "Worker-0" [_thread_blocked, id=16648, stack(0x0000009137700000,0x0000009137800000)]
|
||||||
|
0x000002387a729370 JavaThread "Worker-1" [_thread_blocked, id=10520, stack(0x0000009137800000,0x0000009137900000)]
|
||||||
|
0x000002387b342050 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=19428, stack(0x0000009137600000,0x0000009137700000)]
|
||||||
|
0x000002387a728440 JavaThread "Worker-2" [_thread_blocked, id=6100, stack(0x0000009137900000,0x0000009137a00000)]
|
||||||
|
0x000002387a729880 JavaThread "Java indexing" daemon [_thread_blocked, id=9312, stack(0x0000009137a00000,0x0000009137b00000)]
|
||||||
|
0x000002387a727510 JavaThread "Worker-3: Loading available Gradle versions" [_thread_in_vm, id=17752, stack(0x0000009137b00000,0x0000009137c00000)]
|
||||||
|
=>0x000002387d028240 JavaThread "C2 CompilerThread2" daemon [_thread_in_native, id=19748, stack(0x0000009137c00000,0x0000009137d00000)]
|
||||||
|
0x000002387a729d90 JavaThread "JNA Cleaner" daemon [_thread_blocked, id=1660, stack(0x0000009137d00000,0x0000009137e00000)]
|
||||||
|
0x000002387a726af0 JavaThread "Thread-2" daemon [_thread_in_native, id=540, stack(0x0000009137e00000,0x0000009137f00000)]
|
||||||
|
0x000002387ce843f0 JavaThread "Thread-3" daemon [_thread_in_native, id=6568, stack(0x0000009137f00000,0x0000009138000000)]
|
||||||
|
0x000002387ce86c70 JavaThread "Thread-4" daemon [_thread_in_native, id=11108, stack(0x0000009138000000,0x0000009138100000)]
|
||||||
|
0x000002387ce86760 JavaThread "Thread-5" daemon [_thread_in_native, id=14776, stack(0x0000009138100000,0x0000009138200000)]
|
||||||
|
0x000002387ce834c0 JavaThread "Thread-6" daemon [_thread_in_native, id=21284, stack(0x0000009138200000,0x0000009138300000)]
|
||||||
|
0x000002387ce85d40 JavaThread "Thread-7" daemon [_thread_in_native, id=11720, stack(0x0000009138300000,0x0000009138400000)]
|
||||||
|
0x000002387ce86250 JavaThread "Thread-8" daemon [_thread_in_native, id=3816, stack(0x0000009138400000,0x0000009138500000)]
|
||||||
|
0x000002387ce85320 JavaThread "Thread-9" daemon [_thread_in_native, id=11348, stack(0x0000009138500000,0x0000009138600000)]
|
||||||
|
0x000002387ce880b0 JavaThread "Thread-10" daemon [_thread_in_native, id=19648, stack(0x0000009138600000,0x0000009138700000)]
|
||||||
|
0x000002387ce84e10 JavaThread "Thread-11" daemon [_thread_in_native, id=6624, stack(0x0000009138700000,0x0000009138800000)]
|
||||||
|
0x000002387ce84900 JavaThread "Thread-12" daemon [_thread_in_native, id=6608, stack(0x0000009138800000,0x0000009138900000)]
|
||||||
|
0x000002387ce87ba0 JavaThread "Thread-13" daemon [_thread_in_native, id=14772, stack(0x0000009138900000,0x0000009138a00000)]
|
||||||
|
0x000002387ce83ee0 JavaThread "Thread-14" daemon [_thread_in_native, id=10060, stack(0x0000009138a00000,0x0000009138b00000)]
|
||||||
|
0x000002387ce87180 JavaThread "pool-2-thread-1" [_thread_blocked, id=20520, stack(0x0000009138b00000,0x0000009138c00000)]
|
||||||
|
0x000002387ce894f0 JavaThread "WorkspaceEventsHandler" [_thread_blocked, id=3864, stack(0x0000009138c00000,0x0000009138d00000)]
|
||||||
|
0x000002387ce839d0 JavaThread "pool-1-thread-1" [_thread_in_vm, id=21940, stack(0x0000009138d00000,0x0000009138e00000)]
|
||||||
|
|
||||||
|
Other Threads:
|
||||||
|
0x00000238785d3870 VMThread "VM Thread" [stack: 0x0000009135900000,0x0000009135a00000] [id=1652]
|
||||||
|
0x0000023879e39020 WatcherThread [stack: 0x0000009136500000,0x0000009136600000] [id=20508]
|
||||||
|
0x000002385d766010 GCTaskThread "GC Thread#0" [stack: 0x0000009135800000,0x0000009135900000] [id=16012]
|
||||||
|
0x0000023879e45c10 GCTaskThread "GC Thread#1" [stack: 0x0000009136600000,0x0000009136700000] [id=4472]
|
||||||
|
0x000002387a2457c0 GCTaskThread "GC Thread#2" [stack: 0x0000009136700000,0x0000009136800000] [id=21252]
|
||||||
|
0x000002387a245a80 GCTaskThread "GC Thread#3" [stack: 0x0000009136800000,0x0000009136900000] [id=20692]
|
||||||
|
0x000002387a4e6050 GCTaskThread "GC Thread#4" [stack: 0x0000009136900000,0x0000009136a00000] [id=18768]
|
||||||
|
0x000002387a4e6310 GCTaskThread "GC Thread#5" [stack: 0x0000009136a00000,0x0000009136b00000] [id=6752]
|
||||||
|
0x000002387a4e65d0 GCTaskThread "GC Thread#6" [stack: 0x0000009136b00000,0x0000009136c00000] [id=4960]
|
||||||
|
0x000002387a6f1ef0 GCTaskThread "GC Thread#7" [stack: 0x0000009136f00000,0x0000009137000000] [id=10468]
|
||||||
|
0x000002387a7fd3e0 GCTaskThread "GC Thread#8" [stack: 0x0000009137200000,0x0000009137300000] [id=3252]
|
||||||
|
0x000002387aabee60 GCTaskThread "GC Thread#9" [stack: 0x0000009137300000,0x0000009137400000] [id=14716]
|
||||||
|
|
||||||
|
Threads with active compile tasks:
|
||||||
|
C2 CompilerThread0 9707 5769 ! 4 org.eclipse.osgi.internal.hooks.EclipseLazyStarter::postFindLocalClass (394 bytes)
|
||||||
|
C1 CompilerThread0 9707 5775 3 com.google.gson.stream.JsonReader::endObject (100 bytes)
|
||||||
|
C2 CompilerThread1 9707 5766 4 com.google.gson.stream.JsonReader::nextQuotedValue (270 bytes)
|
||||||
|
C2 CompilerThread2 9707 5354 ! 4 org.eclipse.osgi.internal.loader.BundleLoader::findRequiredSource (283 bytes)
|
||||||
|
|
||||||
|
VM state: not at safepoint (normal execution)
|
||||||
|
|
||||||
|
VM Mutex/Monitor currently owned by a thread: None
|
||||||
|
|
||||||
|
Heap address: 0x00000000c0000000, size: 1024 MB, Compressed Oops mode: 32-bit
|
||||||
|
|
||||||
|
CDS archive(s) not mapped
|
||||||
|
Compressed class space mapped at: 0x0000000100000000-0x0000000140000000, reserved size: 1073741824
|
||||||
|
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x140000000
|
||||||
|
|
||||||
|
GC Precious Log:
|
||||||
|
CPUs: 12 total, 12 available
|
||||||
|
Memory: 32714M
|
||||||
|
Large Page Support: Disabled
|
||||||
|
NUMA Support: Disabled
|
||||||
|
Compressed Oops: Enabled (32-bit)
|
||||||
|
Alignments: Space 512K, Generation 512K, Heap 2M
|
||||||
|
Heap Min Capacity: 100M
|
||||||
|
Heap Initial Capacity: 100M
|
||||||
|
Heap Max Capacity: 1G
|
||||||
|
Pre-touch: Disabled
|
||||||
|
Parallel Workers: 10
|
||||||
|
|
||||||
|
Heap:
|
||||||
|
PSYoungGen total 24064K, used 8064K [0x00000000eab00000, 0x00000000ec600000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 27% used [0x00000000eab00000,0x00000000eb0ec8a0,0x00000000ec080000)
|
||||||
|
from space 2048K, 97% used [0x00000000ec400000,0x00000000ec5f3ab0,0x00000000ec600000)
|
||||||
|
to space 2560K, 0% used [0x00000000ec100000,0x00000000ec100000,0x00000000ec380000)
|
||||||
|
ParOldGen total 68608K, used 20749K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 30% used [0x00000000c0000000,0x00000000c14437a0,0x00000000c4300000)
|
||||||
|
Metaspace used 50404K, committed 51328K, reserved 1114112K
|
||||||
|
class space used 5407K, committed 5760K, reserved 1048576K
|
||||||
|
|
||||||
|
Card table byte_map: [0x0000023870da0000,0x0000023870fb0000] _byte_map_base: 0x00000238707a0000
|
||||||
|
|
||||||
|
Marking Bits: (ParMarkBitMap*) 0x00007ffd92f6d7d0
|
||||||
|
Begin Bits: [0x0000023871110000, 0x0000023872110000)
|
||||||
|
End Bits: [0x0000023872110000, 0x0000023873110000)
|
||||||
|
|
||||||
|
Polling page: 0x000002385d800000
|
||||||
|
|
||||||
|
Metaspace:
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
Non-class: 43.94 MB used.
|
||||||
|
Class: 5.28 MB used.
|
||||||
|
Both: 49.22 MB used.
|
||||||
|
|
||||||
|
Virtual space:
|
||||||
|
Non-class space: 64.00 MB reserved, 44.50 MB ( 70%) committed, 1 nodes.
|
||||||
|
Class space: 1.00 GB reserved, 5.62 MB ( <1%) committed, 1 nodes.
|
||||||
|
Both: 1.06 GB reserved, 50.12 MB ( 5%) committed.
|
||||||
|
|
||||||
|
Chunk freelists:
|
||||||
|
Non-Class: 3.42 MB
|
||||||
|
Class: 10.31 MB
|
||||||
|
Both: 13.73 MB
|
||||||
|
|
||||||
|
MaxMetaspaceSize: unlimited
|
||||||
|
CompressedClassSpaceSize: 1.00 GB
|
||||||
|
Initial GC threshold: 21.00 MB
|
||||||
|
Current GC threshold: 58.38 MB
|
||||||
|
CDS: off
|
||||||
|
MetaspaceReclaimPolicy: balanced
|
||||||
|
- commit_granule_bytes: 65536.
|
||||||
|
- commit_granule_words: 8192.
|
||||||
|
- virtual_space_node_default_size: 8388608.
|
||||||
|
- enlarge_chunks_in_place: 1.
|
||||||
|
- new_chunks_are_fully_committed: 0.
|
||||||
|
- uncommit_free_chunks: 1.
|
||||||
|
- use_allocation_guard: 0.
|
||||||
|
- handle_deallocations: 1.
|
||||||
|
|
||||||
|
|
||||||
|
Internal statistics:
|
||||||
|
|
||||||
|
num_allocs_failed_limit: 6.
|
||||||
|
num_arena_births: 528.
|
||||||
|
num_arena_deaths: 14.
|
||||||
|
num_vsnodes_births: 2.
|
||||||
|
num_vsnodes_deaths: 0.
|
||||||
|
num_space_committed: 802.
|
||||||
|
num_space_uncommitted: 0.
|
||||||
|
num_chunks_returned_to_freelist: 20.
|
||||||
|
num_chunks_taken_from_freelist: 2425.
|
||||||
|
num_chunk_merges: 11.
|
||||||
|
num_chunk_splits: 1486.
|
||||||
|
num_chunks_enlarged: 885.
|
||||||
|
num_inconsistent_stats: 0.
|
||||||
|
|
||||||
|
CodeHeap 'non-profiled nmethods': size=120000Kb used=2557Kb max_used=2703Kb free=117443Kb
|
||||||
|
bounds [0x0000023869690000, 0x0000023869950000, 0x0000023870bc0000]
|
||||||
|
CodeHeap 'profiled nmethods': size=120000Kb used=9950Kb max_used=11217Kb free=110049Kb
|
||||||
|
bounds [0x0000023861bc0000, 0x00000238626c0000, 0x00000238690f0000]
|
||||||
|
CodeHeap 'non-nmethods': size=5760Kb used=1293Kb max_used=1369Kb free=4466Kb
|
||||||
|
bounds [0x00000238690f0000, 0x0000023869360000, 0x0000023869690000]
|
||||||
|
total_blobs=5569 nmethods=4941 adapters=541
|
||||||
|
compilation: enabled
|
||||||
|
stopped_count=0, restarted_count=0
|
||||||
|
full_count=0
|
||||||
|
|
||||||
|
Compilation events (20 events):
|
||||||
|
Event: 9.648 Thread 0x0000023878608980 5718 4 java.math.BigDecimal::checkScale (78 bytes)
|
||||||
|
Event: 9.648 Thread 0x000002387b342050 nmethod 5717 0x0000023869766f10 code [0x0000023869767080, 0x0000023869767118]
|
||||||
|
Event: 9.648 Thread 0x000002387b342050 5414 4 org.eclipse.sisu.inject.Implementations$ClassFinder::visit (6 bytes)
|
||||||
|
Event: 9.648 Thread 0x0000023878608980 nmethod 5718 0x0000023869766b10 code [0x0000023869766c80, 0x0000023869766d38]
|
||||||
|
Event: 9.648 Thread 0x0000023878608980 5724 4 java.lang.Integer::parseInt (264 bytes)
|
||||||
|
Event: 9.649 Thread 0x000002387b342050 nmethod 5414 0x00000238698d9210 code [0x00000238698d93a0, 0x00000238698d9478]
|
||||||
|
Event: 9.649 Thread 0x000002387b342050 5721 4 java.lang.Math::addExact (32 bytes)
|
||||||
|
Event: 9.649 Thread 0x000002387b342050 nmethod 5721 0x00000238698d8f10 code [0x00000238698d9080, 0x00000238698d9118]
|
||||||
|
Event: 9.649 Thread 0x000002387b342050 5402 4 java.lang.StringConcatHelper::simpleConcat (94 bytes)
|
||||||
|
Event: 9.659 Thread 0x00000238786093e0 5730 1 org.eclipse.jdt.ls.core.internal.LogReader$LogEntry::getSession (5 bytes)
|
||||||
|
Event: 9.660 Thread 0x00000238786093e0 nmethod 5730 0x00000238698d8c10 code [0x00000238698d8da0, 0x00000238698d8e78]
|
||||||
|
Event: 9.660 Thread 0x000002387b342050 nmethod 5402 0x00000238697b6290 code [0x00000238697b6440, 0x00000238697b6ab8]
|
||||||
|
Event: 9.660 Thread 0x000002387b342050 5729 4 java.lang.ThreadLocal::set (30 bytes)
|
||||||
|
Event: 9.660 Thread 0x00000238786093e0 5731 3 org.eclipse.core.internal.runtime.Log::isLoggable (32 bytes)
|
||||||
|
Event: 9.661 Thread 0x00000238786093e0 nmethod 5731 0x0000023861ded010 code [0x0000023861ded1e0, 0x0000023861ded568]
|
||||||
|
Event: 9.661 Thread 0x00000238786093e0 5732 3 org.eclipse.osgi.internal.framework.FilterImpl::match (19 bytes)
|
||||||
|
Event: 9.662 Thread 0x00000238786093e0 nmethod 5732 0x0000023862035910 code [0x0000023862035b40, 0x0000023862036638]
|
||||||
|
Event: 9.662 Thread 0x00000238786093e0 5733 3 org.eclipse.osgi.internal.framework.FilterImpl$ServiceReferenceMap::asMap (27 bytes)
|
||||||
|
Event: 9.663 Thread 0x00000238786093e0 nmethod 5733 0x000002386200d610 code [0x000002386200d820, 0x000002386200e128]
|
||||||
|
Event: 9.663 Thread 0x00000238786093e0 5734 3 java.util.Calendar::internalGet (7 bytes)
|
||||||
|
|
||||||
|
GC Heap History (20 events):
|
||||||
|
Event: 7.085 GC heap before
|
||||||
|
{Heap before GC invocations=11 (full 1):
|
||||||
|
PSYoungGen total 26624K, used 26601K [0x00000000eab00000, 0x00000000ecc00000, 0x0000000100000000)
|
||||||
|
eden space 23552K, 100% used [0x00000000eab00000,0x00000000ec200000,0x00000000ec200000)
|
||||||
|
from space 3072K, 99% used [0x00000000ec480000,0x00000000ec77a5d0,0x00000000ec780000)
|
||||||
|
to space 4608K, 0% used [0x00000000ec780000,0x00000000ec780000,0x00000000ecc00000)
|
||||||
|
ParOldGen total 68608K, used 12851K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 18% used [0x00000000c0000000,0x00000000c0c8ccb0,0x00000000c4300000)
|
||||||
|
Metaspace used 34688K, committed 35392K, reserved 1114112K
|
||||||
|
class space used 3405K, committed 3712K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.090 GC heap after
|
||||||
|
{Heap after GC invocations=11 (full 1):
|
||||||
|
PSYoungGen total 25088K, used 2001K [0x00000000eab00000, 0x00000000ec980000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec180000)
|
||||||
|
from space 2048K, 97% used [0x00000000ec780000,0x00000000ec974658,0x00000000ec980000)
|
||||||
|
to space 3072K, 0% used [0x00000000ec380000,0x00000000ec380000,0x00000000ec680000)
|
||||||
|
ParOldGen total 68608K, used 14844K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e7f378,0x00000000c4300000)
|
||||||
|
Metaspace used 34688K, committed 35392K, reserved 1114112K
|
||||||
|
class space used 3405K, committed 3712K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.262 GC heap before
|
||||||
|
{Heap before GC invocations=12 (full 1):
|
||||||
|
PSYoungGen total 25088K, used 5587K [0x00000000eab00000, 0x00000000ec980000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 15% used [0x00000000eab00000,0x00000000eae808e8,0x00000000ec180000)
|
||||||
|
from space 2048K, 97% used [0x00000000ec780000,0x00000000ec974658,0x00000000ec980000)
|
||||||
|
to space 3072K, 0% used [0x00000000ec380000,0x00000000ec380000,0x00000000ec680000)
|
||||||
|
ParOldGen total 68608K, used 14844K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e7f378,0x00000000c4300000)
|
||||||
|
Metaspace used 35079K, committed 35840K, reserved 1114112K
|
||||||
|
class space used 3468K, committed 3840K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.264 GC heap after
|
||||||
|
{Heap after GC invocations=12 (full 1):
|
||||||
|
PSYoungGen total 26112K, used 338K [0x00000000eab00000, 0x00000000ec800000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec180000)
|
||||||
|
from space 3072K, 11% used [0x00000000ec380000,0x00000000ec3d48a0,0x00000000ec680000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec800000)
|
||||||
|
ParOldGen total 68608K, used 16666K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c1046a10,0x00000000c4300000)
|
||||||
|
Metaspace used 35079K, committed 35840K, reserved 1114112K
|
||||||
|
class space used 3468K, committed 3840K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.264 GC heap before
|
||||||
|
{Heap before GC invocations=13 (full 2):
|
||||||
|
PSYoungGen total 26112K, used 338K [0x00000000eab00000, 0x00000000ec800000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec180000)
|
||||||
|
from space 3072K, 11% used [0x00000000ec380000,0x00000000ec3d48a0,0x00000000ec680000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec800000)
|
||||||
|
ParOldGen total 68608K, used 16666K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c1046a10,0x00000000c4300000)
|
||||||
|
Metaspace used 35079K, committed 35840K, reserved 1114112K
|
||||||
|
class space used 3468K, committed 3840K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.299 GC heap after
|
||||||
|
{Heap after GC invocations=13 (full 2):
|
||||||
|
PSYoungGen total 26112K, used 0K [0x00000000eab00000, 0x00000000ec800000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec180000)
|
||||||
|
from space 3072K, 0% used [0x00000000ec380000,0x00000000ec380000,0x00000000ec680000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec800000)
|
||||||
|
ParOldGen total 68608K, used 14898K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e8c8a8,0x00000000c4300000)
|
||||||
|
Metaspace used 35079K, committed 35840K, reserved 1114112K
|
||||||
|
class space used 3468K, committed 3840K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.743 GC heap before
|
||||||
|
{Heap before GC invocations=14 (full 2):
|
||||||
|
PSYoungGen total 26112K, used 23040K [0x00000000eab00000, 0x00000000ec800000, 0x0000000100000000)
|
||||||
|
eden space 23040K, 100% used [0x00000000eab00000,0x00000000ec180000,0x00000000ec180000)
|
||||||
|
from space 3072K, 0% used [0x00000000ec380000,0x00000000ec380000,0x00000000ec680000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec800000)
|
||||||
|
ParOldGen total 68608K, used 14898K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e8c8a8,0x00000000c4300000)
|
||||||
|
Metaspace used 36748K, committed 37440K, reserved 1114112K
|
||||||
|
class space used 3691K, committed 3968K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 7.744 GC heap after
|
||||||
|
{Heap after GC invocations=14 (full 2):
|
||||||
|
PSYoungGen total 23552K, used 750K [0x00000000eab00000, 0x00000000ec780000, 0x0000000100000000)
|
||||||
|
eden space 22528K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec100000)
|
||||||
|
from space 1024K, 73% used [0x00000000ec680000,0x00000000ec73bbb8,0x00000000ec780000)
|
||||||
|
to space 1024K, 0% used [0x00000000ec580000,0x00000000ec580000,0x00000000ec680000)
|
||||||
|
ParOldGen total 68608K, used 14906K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e8e8a8,0x00000000c4300000)
|
||||||
|
Metaspace used 36748K, committed 37440K, reserved 1114112K
|
||||||
|
class space used 3691K, committed 3968K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.027 GC heap before
|
||||||
|
{Heap before GC invocations=15 (full 2):
|
||||||
|
PSYoungGen total 23552K, used 23278K [0x00000000eab00000, 0x00000000ec780000, 0x0000000100000000)
|
||||||
|
eden space 22528K, 100% used [0x00000000eab00000,0x00000000ec100000,0x00000000ec100000)
|
||||||
|
from space 1024K, 73% used [0x00000000ec680000,0x00000000ec73bbb8,0x00000000ec780000)
|
||||||
|
to space 1024K, 0% used [0x00000000ec580000,0x00000000ec580000,0x00000000ec680000)
|
||||||
|
ParOldGen total 68608K, used 14906K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 21% used [0x00000000c0000000,0x00000000c0e8e8a8,0x00000000c4300000)
|
||||||
|
Metaspace used 37979K, committed 38720K, reserved 1114112K
|
||||||
|
class space used 3847K, committed 4160K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.028 GC heap after
|
||||||
|
{Heap after GC invocations=15 (full 2):
|
||||||
|
PSYoungGen total 23040K, used 955K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 1024K, 93% used [0x00000000ec580000,0x00000000ec66eec8,0x00000000ec680000)
|
||||||
|
to space 512K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec700000)
|
||||||
|
ParOldGen total 68608K, used 15509K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 22% used [0x00000000c0000000,0x00000000c0f25470,0x00000000c4300000)
|
||||||
|
Metaspace used 37979K, committed 38720K, reserved 1114112K
|
||||||
|
class space used 3847K, committed 4160K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.370 GC heap before
|
||||||
|
{Heap before GC invocations=16 (full 2):
|
||||||
|
PSYoungGen total 23040K, used 22971K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 100% used [0x00000000eab00000,0x00000000ec080000,0x00000000ec080000)
|
||||||
|
from space 1024K, 93% used [0x00000000ec580000,0x00000000ec66eec8,0x00000000ec680000)
|
||||||
|
to space 512K, 0% used [0x00000000ec680000,0x00000000ec680000,0x00000000ec700000)
|
||||||
|
ParOldGen total 68608K, used 15509K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 22% used [0x00000000c0000000,0x00000000c0f25470,0x00000000c4300000)
|
||||||
|
Metaspace used 40063K, committed 40832K, reserved 1114112K
|
||||||
|
class space used 4100K, committed 4416K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.371 GC heap after
|
||||||
|
{Heap after GC invocations=16 (full 2):
|
||||||
|
PSYoungGen total 22528K, used 484K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 512K, 94% used [0x00000000ec680000,0x00000000ec6f9088,0x00000000ec700000)
|
||||||
|
to space 2048K, 0% used [0x00000000ec300000,0x00000000ec300000,0x00000000ec500000)
|
||||||
|
ParOldGen total 68608K, used 16665K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c10467c8,0x00000000c4300000)
|
||||||
|
Metaspace used 40063K, committed 40832K, reserved 1114112K
|
||||||
|
class space used 4100K, committed 4416K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.680 GC heap before
|
||||||
|
{Heap before GC invocations=17 (full 2):
|
||||||
|
PSYoungGen total 22528K, used 22500K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 100% used [0x00000000eab00000,0x00000000ec080000,0x00000000ec080000)
|
||||||
|
from space 512K, 94% used [0x00000000ec680000,0x00000000ec6f9088,0x00000000ec700000)
|
||||||
|
to space 2048K, 0% used [0x00000000ec300000,0x00000000ec300000,0x00000000ec500000)
|
||||||
|
ParOldGen total 68608K, used 16665K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c10467c8,0x00000000c4300000)
|
||||||
|
Metaspace used 43288K, committed 44096K, reserved 1114112K
|
||||||
|
class space used 4497K, committed 4864K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 8.682 GC heap after
|
||||||
|
{Heap after GC invocations=17 (full 2):
|
||||||
|
PSYoungGen total 24064K, used 1282K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 2048K, 62% used [0x00000000ec300000,0x00000000ec440be0,0x00000000ec500000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec580000,0x00000000ec580000,0x00000000ec700000)
|
||||||
|
ParOldGen total 68608K, used 17144K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c10be300,0x00000000c4300000)
|
||||||
|
Metaspace used 43288K, committed 44096K, reserved 1114112K
|
||||||
|
class space used 4497K, committed 4864K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.101 GC heap before
|
||||||
|
{Heap before GC invocations=18 (full 2):
|
||||||
|
PSYoungGen total 24064K, used 23298K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 100% used [0x00000000eab00000,0x00000000ec080000,0x00000000ec080000)
|
||||||
|
from space 2048K, 62% used [0x00000000ec300000,0x00000000ec440be0,0x00000000ec500000)
|
||||||
|
to space 1536K, 0% used [0x00000000ec580000,0x00000000ec580000,0x00000000ec700000)
|
||||||
|
ParOldGen total 68608K, used 17144K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 24% used [0x00000000c0000000,0x00000000c10be300,0x00000000c4300000)
|
||||||
|
Metaspace used 46022K, committed 46976K, reserved 1114112K
|
||||||
|
class space used 4837K, committed 5248K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.103 GC heap after
|
||||||
|
{Heap after GC invocations=18 (full 2):
|
||||||
|
PSYoungGen total 23552K, used 1519K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 1536K, 98% used [0x00000000ec580000,0x00000000ec6fbc40,0x00000000ec700000)
|
||||||
|
to space 3072K, 0% used [0x00000000ec100000,0x00000000ec100000,0x00000000ec400000)
|
||||||
|
ParOldGen total 68608K, used 18296K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 26% used [0x00000000c0000000,0x00000000c11de0b8,0x00000000c4300000)
|
||||||
|
Metaspace used 46022K, committed 46976K, reserved 1114112K
|
||||||
|
class space used 4837K, committed 5248K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.367 GC heap before
|
||||||
|
{Heap before GC invocations=19 (full 2):
|
||||||
|
PSYoungGen total 23552K, used 23535K [0x00000000eab00000, 0x00000000ec700000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 100% used [0x00000000eab00000,0x00000000ec080000,0x00000000ec080000)
|
||||||
|
from space 1536K, 98% used [0x00000000ec580000,0x00000000ec6fbc40,0x00000000ec700000)
|
||||||
|
to space 3072K, 0% used [0x00000000ec100000,0x00000000ec100000,0x00000000ec400000)
|
||||||
|
ParOldGen total 68608K, used 18296K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 26% used [0x00000000c0000000,0x00000000c11de0b8,0x00000000c4300000)
|
||||||
|
Metaspace used 48615K, committed 49536K, reserved 1114112K
|
||||||
|
class space used 5186K, committed 5568K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.370 GC heap after
|
||||||
|
{Heap after GC invocations=19 (full 2):
|
||||||
|
PSYoungGen total 25088K, used 1119K [0x00000000eab00000, 0x00000000ec600000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 3072K, 36% used [0x00000000ec100000,0x00000000ec217d58,0x00000000ec400000)
|
||||||
|
to space 2048K, 0% used [0x00000000ec400000,0x00000000ec400000,0x00000000ec600000)
|
||||||
|
ParOldGen total 68608K, used 19742K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 28% used [0x00000000c0000000,0x00000000c1347b68,0x00000000c4300000)
|
||||||
|
Metaspace used 48615K, committed 49536K, reserved 1114112K
|
||||||
|
class space used 5186K, committed 5568K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.650 GC heap before
|
||||||
|
{Heap before GC invocations=20 (full 2):
|
||||||
|
PSYoungGen total 25088K, used 23135K [0x00000000eab00000, 0x00000000ec600000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 100% used [0x00000000eab00000,0x00000000ec080000,0x00000000ec080000)
|
||||||
|
from space 3072K, 36% used [0x00000000ec100000,0x00000000ec217d58,0x00000000ec400000)
|
||||||
|
to space 2048K, 0% used [0x00000000ec400000,0x00000000ec400000,0x00000000ec600000)
|
||||||
|
ParOldGen total 68608K, used 19742K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 28% used [0x00000000c0000000,0x00000000c1347b68,0x00000000c4300000)
|
||||||
|
Metaspace used 49965K, committed 50944K, reserved 1114112K
|
||||||
|
class space used 5352K, committed 5760K, reserved 1048576K
|
||||||
|
}
|
||||||
|
Event: 9.652 GC heap after
|
||||||
|
{Heap after GC invocations=20 (full 2):
|
||||||
|
PSYoungGen total 24064K, used 1998K [0x00000000eab00000, 0x00000000ec600000, 0x0000000100000000)
|
||||||
|
eden space 22016K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec080000)
|
||||||
|
from space 2048K, 97% used [0x00000000ec400000,0x00000000ec5f3ab0,0x00000000ec600000)
|
||||||
|
to space 2560K, 0% used [0x00000000ec100000,0x00000000ec100000,0x00000000ec380000)
|
||||||
|
ParOldGen total 68608K, used 20749K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
|
||||||
|
object space 68608K, 30% used [0x00000000c0000000,0x00000000c14437a0,0x00000000c4300000)
|
||||||
|
Metaspace used 49965K, committed 50944K, reserved 1114112K
|
||||||
|
class space used 5352K, committed 5760K, reserved 1048576K
|
||||||
|
}
|
||||||
|
|
||||||
|
Dll operation events (10 events):
|
||||||
|
Event: 0.017 Loaded shared library d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.dll
|
||||||
|
Event: 0.302 Loaded shared library d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\zip.dll
|
||||||
|
Event: 0.330 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\instrument.dll
|
||||||
|
Event: 0.369 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\net.dll
|
||||||
|
Event: 0.376 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\nio.dll
|
||||||
|
Event: 0.394 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\zip.dll
|
||||||
|
Event: 0.453 Loaded shared library D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\jimage.dll
|
||||||
|
Event: 0.659 Loaded shared library d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\verify.dll
|
||||||
|
Event: 2.692 Loaded shared library D:\Users\Leo\AppData\Roaming\Code\User\globalStorage\redhat.java\1.30.0\config_win\org.eclipse.equinox.launcher\org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.900.v20240213-1244\eclipse_11900.dll
|
||||||
|
Event: 8.663 Loaded shared library C:\Temp\jna-76278\jna10846131141340467812.dll
|
||||||
|
|
||||||
|
Deoptimization events (20 events):
|
||||||
|
Event: 9.522 Thread 0x000002387a729370 Uncommon trap: trap_request=0xffffffde fr.pc=0x00000238697e75f8 relative=0x0000000000000e58
|
||||||
|
Event: 9.522 Thread 0x000002387a729370 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000238697e75f8 method=java.util.concurrent.ConcurrentHashMap.putVal(Ljava/lang/Object;Ljava/lang/Object;Z)Ljava/lang/Object; @ 242 c2
|
||||||
|
Event: 9.522 Thread 0x000002387a729370 DEOPT PACKING pc=0x00000238697e75f8 sp=0x00000091378fdde0
|
||||||
|
Event: 9.522 Thread 0x000002387a729370 DEOPT UNPACKING pc=0x00000238691466a3 sp=0x00000091378fdd50 mode 2
|
||||||
|
Event: 9.535 Thread 0x000002387a728e60 Uncommon trap: trap_request=0xffffff45 fr.pc=0x000002386989cdc0 relative=0x00000000000008c0
|
||||||
|
Event: 9.535 Thread 0x000002387a728e60 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000002386989cdc0 method=java.util.WeakHashMap.remove(Ljava/lang/Object;)Ljava/lang/Object; @ 92 c2
|
||||||
|
Event: 9.535 Thread 0x000002387a728e60 DEOPT PACKING pc=0x000002386989cdc0 sp=0x00000091377fe190
|
||||||
|
Event: 9.535 Thread 0x000002387a728e60 DEOPT UNPACKING pc=0x00000238691466a3 sp=0x00000091377fe0d8 mode 2
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 Uncommon trap: trap_request=0xffffffde fr.pc=0x00000238697e75f8 relative=0x0000000000000e58
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000238697e75f8 method=java.util.concurrent.ConcurrentHashMap.putVal(Ljava/lang/Object;Ljava/lang/Object;Z)Ljava/lang/Object; @ 242 c2
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 DEOPT PACKING pc=0x00000238697e75f8 sp=0x00000091377fdb70
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 DEOPT UNPACKING pc=0x00000238691466a3 sp=0x00000091377fdae0 mode 2
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 Uncommon trap: trap_request=0xffffff54 fr.pc=0x000002386994ae40 relative=0x00000000000035e0
|
||||||
|
Event: 9.543 Thread 0x000002387a728e60 Uncommon trap: reason=speculate_null_assert action=make_not_entrant pc=0x000002386994ae40 method=java.lang.invoke.MethodType$ConcurrentWeakInternSet.add(Ljava/lang/Object;)Ljava/lang/Object; @ 47 c2
|
||||||
|
Event: 9.544 Thread 0x000002387a728e60 DEOPT PACKING pc=0x000002386994ae40 sp=0x00000091377fdc20
|
||||||
|
Event: 9.544 Thread 0x000002387a728e60 DEOPT UNPACKING pc=0x00000238691466a3 sp=0x00000091377fdbb8 mode 2
|
||||||
|
Event: 9.569 Thread 0x000002387a729370 Uncommon trap: trap_request=0xffffffde fr.pc=0x00000238697e75f8 relative=0x0000000000000e58
|
||||||
|
Event: 9.570 Thread 0x000002387a729370 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000238697e75f8 method=java.util.concurrent.ConcurrentHashMap.putVal(Ljava/lang/Object;Ljava/lang/Object;Z)Ljava/lang/Object; @ 242 c2
|
||||||
|
Event: 9.570 Thread 0x000002387a729370 DEOPT PACKING pc=0x00000238697e75f8 sp=0x00000091378ff280
|
||||||
|
Event: 9.570 Thread 0x000002387a729370 DEOPT UNPACKING pc=0x00000238691466a3 sp=0x00000091378ff1f0 mode 2
|
||||||
|
|
||||||
|
Classes unloaded (7 events):
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100248400 'java/lang/invoke/LambdaForm$MH+0x0000000100248400'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100248000 'java/lang/invoke/LambdaForm$MH+0x0000000100248000'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100247c00 'java/lang/invoke/LambdaForm$MH+0x0000000100247c00'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100247800 'java/lang/invoke/LambdaForm$MH+0x0000000100247800'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100247400 'java/lang/invoke/LambdaForm$BMH+0x0000000100247400'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100247000 'java/lang/invoke/LambdaForm$DMH+0x0000000100247000'
|
||||||
|
Event: 4.505 Thread 0x00000238785d3870 Unloading class 0x0000000100244400 'java/lang/invoke/LambdaForm$DMH+0x0000000100244400'
|
||||||
|
|
||||||
|
Classes redefined (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Internal exceptions (20 events):
|
||||||
|
Event: 8.352 Thread 0x000002387a69bba0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebf8cfb8}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, int, int, int, int)'> (0x00000000ebf8cfb8)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 8.405 Thread 0x000002387a69bba0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ead275c8}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, int, int, int, int)'> (0x00000000ead275c8)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 8.478 Thread 0x000002387a69bba0 Exception <a 'java/lang/ClassNotFoundException'{0x00000000eb340330}: com/sun/org/apache/xml/internal/serializer/spi/XMLEntitiesProvider> (0x00000000eb340330)
|
||||||
|
thrown [s\src\hotspot\share\classfile\systemDictionary.cpp, line 256]
|
||||||
|
Event: 8.610 Thread 0x000002387a69bba0 Exception <a 'java/io/FileNotFoundException'{0x00000000ebba5ec8}> (0x00000000ebba5ec8)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
|
||||||
|
Event: 8.626 Thread 0x000002387a729370 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebce5ea8}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000000ebce5ea8)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 8.630 Thread 0x000002387a729370 Exception <a 'java/lang/ExceptionInInitializerError'{0x00000000ebd7e9a0}> (0x00000000ebd7e9a0)
|
||||||
|
thrown [s\src\hotspot\share\oops\instanceKlass.cpp, line 1218]
|
||||||
|
Event: 8.672 Thread 0x000002387a729370 Implicit null exception at 0x00000238697a5230 to 0x00000238697a53f4
|
||||||
|
Event: 8.673 Thread 0x000002387a729370 Implicit null exception at 0x0000023869721f09 to 0x000002386972321c
|
||||||
|
Event: 8.675 Thread 0x000002387a729370 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ec026e68}: 'java.lang.Object java.lang.invoke.Invokers$Holder.invokeExact_MT(java.lang.Object, int, java.lang.Object)'> (0x00000000ec026e68)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 8.720 Thread 0x000002387a69bba0 Exception <a 'java/lang/UnsatisfiedLinkError'{0x00000000ead8ea68}: Не найдена указанная процедура.
|
||||||
|
> (0x00000000ead8ea68)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 535]
|
||||||
|
Event: 8.729 Thread 0x000002387a69bba0 Exception <a 'java/io/FileNotFoundException'{0x00000000eadf35c8}> (0x00000000eadf35c8)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
|
||||||
|
Event: 8.742 Thread 0x000002387a69bba0 Exception <a 'java/io/FileNotFoundException'{0x00000000eaf3e728}> (0x00000000eaf3e728)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
|
||||||
|
Event: 8.752 Thread 0x000002387a69bba0 Exception <a 'java/lang/UnsatisfiedLinkError'{0x00000000eb007a50}: Не найдена указанная процедура.
|
||||||
|
> (0x00000000eb007a50)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 535]
|
||||||
|
Event: 8.853 Thread 0x000002385d7503c0 Exception <a 'sun/nio/fs/WindowsException'{0x00000000eb43b7d8}> (0x00000000eb43b7d8)
|
||||||
|
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
|
||||||
|
Event: 9.012 Thread 0x000002385d7503c0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebb93af0}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.lang.Object, java.lang.Object, long, java.lang.Object)'> (0x00000000ebb93af0)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 9.012 Thread 0x000002385d7503c0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebb97ed8}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, long, java.lang.Object)'> (0x00000000ebb97ed8)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 9.013 Thread 0x000002385d7503c0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebb9f5b0}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(java.lang.Object, java.lang.Object, long)'> (0x00000000ebb9f5b0)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 9.225 Thread 0x000002387a729370 Exception <a 'java/lang/NoClassDefFoundError'{0x00000000eb4efd78}: com/google/inject/servlet/ServletModuleTargetVisitor> (0x00000000eb4efd78)
|
||||||
|
thrown [s\src\hotspot\share\classfile\systemDictionary.cpp, line 245]
|
||||||
|
Event: 9.293 Thread 0x000002385d7503c0 Exception <a 'java/lang/NoSuchMethodError'{0x00000000ebc70a18}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeSpecial(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000000ebc70a18)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
|
||||||
|
Event: 9.298 Thread 0x000002385d7503c0 Exception <a 'java/lang/IncompatibleClassChangeError'{0x00000000ebc7a218}: Found class java.lang.Object, but interface was expected> (0x00000000ebc7a218)
|
||||||
|
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 826]
|
||||||
|
|
||||||
|
VM Operations (20 events):
|
||||||
|
Event: 8.733 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 8.733 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 8.868 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 8.868 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.101 Executing VM operation: ParallelGCFailedAllocation
|
||||||
|
Event: 9.103 Executing VM operation: ParallelGCFailedAllocation done
|
||||||
|
Event: 9.129 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 9.130 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.141 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 9.141 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.178 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 9.178 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.328 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 9.328 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.329 Executing VM operation: HandshakeAllThreads
|
||||||
|
Event: 9.329 Executing VM operation: HandshakeAllThreads done
|
||||||
|
Event: 9.366 Executing VM operation: ParallelGCFailedAllocation
|
||||||
|
Event: 9.372 Executing VM operation: ParallelGCFailedAllocation done
|
||||||
|
Event: 9.650 Executing VM operation: ParallelGCFailedAllocation
|
||||||
|
Event: 9.652 Executing VM operation: ParallelGCFailedAllocation done
|
||||||
|
|
||||||
|
Events (20 events):
|
||||||
|
Event: 9.450 loading class jdk/internal/math/FDBigInteger
|
||||||
|
Event: 9.452 loading class jdk/internal/math/FDBigInteger done
|
||||||
|
Event: 9.460 loading class jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl
|
||||||
|
Event: 9.461 loading class jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl done
|
||||||
|
Event: 9.544 loading class java/util/regex/Pattern$Pos
|
||||||
|
Event: 9.544 loading class java/util/regex/Pattern$Pos done
|
||||||
|
Event: 9.600 loading class sun/security/provider/MD5
|
||||||
|
Event: 9.600 loading class sun/security/provider/MD5 done
|
||||||
|
Event: 9.600 loading class sun/security/provider/ByteArrayAccess$LE
|
||||||
|
Event: 9.600 loading class sun/security/provider/ByteArrayAccess$LE done
|
||||||
|
Event: 9.610 loading class java/util/stream/MatchOps$MatchKind
|
||||||
|
Event: 9.610 loading class java/util/stream/MatchOps$MatchKind done
|
||||||
|
Event: 9.610 loading class java/util/stream/MatchOps
|
||||||
|
Event: 9.610 loading class java/util/stream/MatchOps done
|
||||||
|
Event: 9.610 loading class java/util/stream/MatchOps$MatchOp
|
||||||
|
Event: 9.611 loading class java/util/stream/MatchOps$MatchOp done
|
||||||
|
Event: 9.611 loading class java/util/stream/MatchOps$BooleanTerminalSink
|
||||||
|
Event: 9.611 loading class java/util/stream/MatchOps$BooleanTerminalSink done
|
||||||
|
Event: 9.611 loading class java/util/stream/MatchOps$1MatchSink
|
||||||
|
Event: 9.611 loading class java/util/stream/MatchOps$1MatchSink done
|
||||||
|
|
||||||
|
|
||||||
|
Dynamic libraries:
|
||||||
|
0x00007ff707200000 - 0x00007ff70720e000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.exe
|
||||||
|
0x00007ffe2d350000 - 0x00007ffe2d567000 C:\Windows\SYSTEM32\ntdll.dll
|
||||||
|
0x00007ffe2c1b0000 - 0x00007ffe2c274000 C:\Windows\System32\KERNEL32.DLL
|
||||||
|
0x00007ffe2aa30000 - 0x00007ffe2add6000 C:\Windows\System32\KERNELBASE.dll
|
||||||
|
0x00007ffe2afc0000 - 0x00007ffe2b0d1000 C:\Windows\System32\ucrtbase.dll
|
||||||
|
0x00007ffdf3520000 - 0x00007ffdf353b000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\VCRUNTIME140.dll
|
||||||
|
0x00007ffdf9aa0000 - 0x00007ffdf9ab7000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\jli.dll
|
||||||
|
0x00007ffe2d080000 - 0x00007ffe2d22e000 C:\Windows\System32\USER32.dll
|
||||||
|
0x00007ffe169a0000 - 0x00007ffe16c33000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100\COMCTL32.dll
|
||||||
|
0x00007ffe2ade0000 - 0x00007ffe2ae06000 C:\Windows\System32\win32u.dll
|
||||||
|
0x00007ffe2c570000 - 0x00007ffe2c617000 C:\Windows\System32\msvcrt.dll
|
||||||
|
0x00007ffe2b370000 - 0x00007ffe2b399000 C:\Windows\System32\GDI32.dll
|
||||||
|
0x00007ffe2a6d0000 - 0x00007ffe2a7e8000 C:\Windows\System32\gdi32full.dll
|
||||||
|
0x00007ffe2a7f0000 - 0x00007ffe2a88a000 C:\Windows\System32\msvcp_win.dll
|
||||||
|
0x00007ffe2b330000 - 0x00007ffe2b361000 C:\Windows\System32\IMM32.DLL
|
||||||
|
0x00007ffdff6b0000 - 0x00007ffdff6bc000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\vcruntime140_1.dll
|
||||||
|
0x00007ffdf1cc0000 - 0x00007ffdf1d4d000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\msvcp140.dll
|
||||||
|
0x00007ffd923d0000 - 0x00007ffd93032000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\server\jvm.dll
|
||||||
|
0x00007ffe2cfc0000 - 0x00007ffe2d073000 C:\Windows\System32\ADVAPI32.dll
|
||||||
|
0x00007ffe2b260000 - 0x00007ffe2b308000 C:\Windows\System32\sechost.dll
|
||||||
|
0x00007ffe2aa00000 - 0x00007ffe2aa28000 C:\Windows\System32\bcrypt.dll
|
||||||
|
0x00007ffe2c620000 - 0x00007ffe2c737000 C:\Windows\System32\RPCRT4.dll
|
||||||
|
0x00007ffe2a5a0000 - 0x00007ffe2a5ed000 C:\Windows\SYSTEM32\POWRPROF.dll
|
||||||
|
0x00007ffe0c080000 - 0x00007ffe0c089000 C:\Windows\SYSTEM32\WSOCK32.dll
|
||||||
|
0x00007ffe2c9c0000 - 0x00007ffe2ca31000 C:\Windows\System32\WS2_32.dll
|
||||||
|
0x00007ffe226f0000 - 0x00007ffe22724000 C:\Windows\SYSTEM32\WINMM.dll
|
||||||
|
0x00007ffe23450000 - 0x00007ffe2345a000 C:\Windows\SYSTEM32\VERSION.dll
|
||||||
|
0x00007ffe2a580000 - 0x00007ffe2a593000 C:\Windows\SYSTEM32\UMPDC.dll
|
||||||
|
0x00007ffe29680000 - 0x00007ffe29698000 C:\Windows\SYSTEM32\kernel.appcore.dll
|
||||||
|
0x00007ffdfed50000 - 0x00007ffdfed5a000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\jimage.dll
|
||||||
|
0x00007ffe20d90000 - 0x00007ffe20fc3000 C:\Windows\SYSTEM32\DBGHELP.DLL
|
||||||
|
0x00007ffe2b3a0000 - 0x00007ffe2b729000 C:\Windows\System32\combase.dll
|
||||||
|
0x00007ffe2c290000 - 0x00007ffe2c367000 C:\Windows\System32\OLEAUT32.dll
|
||||||
|
0x00007ffdc94e0000 - 0x00007ffdc9512000 C:\Windows\SYSTEM32\dbgcore.DLL
|
||||||
|
0x00007ffe2ae10000 - 0x00007ffe2ae8a000 C:\Windows\System32\bcryptPrimitives.dll
|
||||||
|
0x00007ffdf7470000 - 0x00007ffdf747e000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\instrument.dll
|
||||||
|
0x00007ffdf33b0000 - 0x00007ffdf33d5000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\java.dll
|
||||||
|
0x00007ffdf1ca0000 - 0x00007ffdf1cb8000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\zip.dll
|
||||||
|
0x00007ffe2b8b0000 - 0x00007ffe2c10a000 C:\Windows\System32\SHELL32.dll
|
||||||
|
0x00007ffe28600000 - 0x00007ffe28ef6000 C:\Windows\SYSTEM32\windows.storage.dll
|
||||||
|
0x00007ffe284c0000 - 0x00007ffe285fe000 C:\Windows\SYSTEM32\wintypes.dll
|
||||||
|
0x00007ffe2b7b0000 - 0x00007ffe2b8a3000 C:\Windows\System32\SHCORE.dll
|
||||||
|
0x00007ffe2d2f0000 - 0x00007ffe2d34e000 C:\Windows\System32\shlwapi.dll
|
||||||
|
0x00007ffe2a600000 - 0x00007ffe2a626000 C:\Windows\SYSTEM32\profapi.dll
|
||||||
|
0x00007ffdf1c80000 - 0x00007ffdf1c99000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\net.dll
|
||||||
|
0x00007ffe24690000 - 0x00007ffe247c7000 C:\Windows\SYSTEM32\WINHTTP.dll
|
||||||
|
0x00007ffe29b60000 - 0x00007ffe29bc9000 C:\Windows\system32\mswsock.dll
|
||||||
|
0x00007ffdf1be0000 - 0x00007ffdf1bf6000 D:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\nio.dll
|
||||||
|
0x00007ffdf3510000 - 0x00007ffdf3520000 d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\verify.dll
|
||||||
|
0x00007ffdf0d60000 - 0x00007ffdf0d9e000 D:\Users\Leo\AppData\Roaming\Code\User\globalStorage\redhat.java\1.30.0\config_win\org.eclipse.equinox.launcher\org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.900.v20240213-1244\eclipse_11900.dll
|
||||||
|
0x00007ffe2c3d0000 - 0x00007ffe2c570000 C:\Windows\System32\ole32.dll
|
||||||
|
0x00007ffe29dc0000 - 0x00007ffe29ddb000 C:\Windows\SYSTEM32\CRYPTSP.dll
|
||||||
|
0x00007ffe29640000 - 0x00007ffe29675000 C:\Windows\system32\rsaenh.dll
|
||||||
|
0x00007ffe29c50000 - 0x00007ffe29c7c000 C:\Windows\SYSTEM32\USERENV.dll
|
||||||
|
0x00007ffe29db0000 - 0x00007ffe29dbc000 C:\Windows\SYSTEM32\CRYPTBASE.dll
|
||||||
|
0x00007ffe291a0000 - 0x00007ffe291cd000 C:\Windows\SYSTEM32\IPHLPAPI.DLL
|
||||||
|
0x00007ffe2b0e0000 - 0x00007ffe2b0e9000 C:\Windows\System32\NSI.dll
|
||||||
|
0x00007ffe25100000 - 0x00007ffe25119000 C:\Windows\SYSTEM32\dhcpcsvc6.DLL
|
||||||
|
0x00007ffe23cc0000 - 0x00007ffe23cdf000 C:\Windows\SYSTEM32\dhcpcsvc.DLL
|
||||||
|
0x00007ffe29220000 - 0x00007ffe29319000 C:\Windows\SYSTEM32\DNSAPI.dll
|
||||||
|
0x00007ffdefe30000 - 0x00007ffdefe75000 C:\Temp\jna-76278\jna10846131141340467812.dll
|
||||||
|
0x00007ffe2c280000 - 0x00007ffe2c288000 C:\Windows\System32\PSAPI.DLL
|
||||||
|
|
||||||
|
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
|
||||||
|
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100;d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\jre\17.0.10-win32-x86_64\bin\server;D:\Users\Leo\AppData\Roaming\Code\User\globalStorage\redhat.java\1.30.0\config_win\org.eclipse.equinox.launcher\org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.900.v20240213-1244;C:\Temp\jna-76278
|
||||||
|
|
||||||
|
VM Arguments:
|
||||||
|
jvm_args: --add-modules=ALL-SYSTEM --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -DDetectVMInstallationsJob.disabled=true -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\lombok\lombok-1.18.32.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=d:\Users\Leo\AppData\Roaming\Code\User\workspaceStorage\6df9095751c7a8980dc2d97141507ccf\redhat.java -Daether.dependencyCollector.impl=bf
|
||||||
|
java_command: d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.800.v20240330-1250.jar -configuration d:\Users\Leo\AppData\Roaming\Code\User\globalStorage\redhat.java\1.30.0\config_win -data d:\Users\Leo\AppData\Roaming\Code\User\workspaceStorage\6df9095751c7a8980dc2d97141507ccf\redhat.java\jdt_ws --pipe=\\.\pipe\lsp-caf0488237ebe000a356048faf0dfab7-sock
|
||||||
|
java_class_path (initial): d:\Users\Leo\.vscode\extensions\redhat.java-1.30.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.800.v20240330-1250.jar
|
||||||
|
Launcher Type: SUN_STANDARD
|
||||||
|
|
||||||
|
[Global flags]
|
||||||
|
uintx AdaptiveSizePolicyWeight = 90 {product} {command line}
|
||||||
|
intx CICompilerCount = 4 {product} {ergonomic}
|
||||||
|
uintx GCTimeRatio = 4 {product} {command line}
|
||||||
|
bool HeapDumpOnOutOfMemoryError = true {manageable} {command line}
|
||||||
|
ccstr HeapDumpPath = d:\Users\Leo\AppData\Roaming\Code\User\workspaceStorage\6df9095751c7a8980dc2d97141507ccf\redhat.java {manageable} {command line}
|
||||||
|
size_t InitialHeapSize = 104857600 {product} {command line}
|
||||||
|
size_t MaxHeapSize = 1073741824 {product} {command line}
|
||||||
|
size_t MaxNewSize = 357564416 {product} {ergonomic}
|
||||||
|
size_t MinHeapDeltaBytes = 524288 {product} {ergonomic}
|
||||||
|
size_t MinHeapSize = 104857600 {product} {command line}
|
||||||
|
size_t NewSize = 34603008 {product} {ergonomic}
|
||||||
|
uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic}
|
||||||
|
uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
|
||||||
|
size_t OldSize = 70254592 {product} {ergonomic}
|
||||||
|
uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
|
||||||
|
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
|
||||||
|
bool SegmentedCodeCache = true {product} {ergonomic}
|
||||||
|
size_t SoftMaxHeapSize = 1073741824 {manageable} {ergonomic}
|
||||||
|
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
|
||||||
|
bool UseCompressedOops = true {product lp64_product} {ergonomic}
|
||||||
|
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
|
||||||
|
bool UseParallelGC = true {product} {command line}
|
||||||
|
|
||||||
|
Logging:
|
||||||
|
Log output configuration:
|
||||||
|
#0: stdout all=off uptime,level,tags
|
||||||
|
#1: stderr all=off uptime,level,tags
|
||||||
|
|
||||||
|
Environment Variables:
|
||||||
|
PATH=C:\Program Files\Eclipse Adoptium\jdk-21.0.3.9-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;D:\Users\Leo\AppData\Local\Microsoft\WindowsApps;D:\Users\Leo\AppData\Local\Programs\Microsoft VS Code\bin;D:\Users\Leo\.dotnet\tools
|
||||||
|
USERNAME=Leo
|
||||||
|
OS=Windows_NT
|
||||||
|
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
|
||||||
|
TMP=C:\Temp
|
||||||
|
TEMP=C:\Temp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Periodic native trim disabled
|
||||||
|
|
||||||
|
|
||||||
|
--------------- S Y S T E M ---------------
|
||||||
|
|
||||||
|
OS:
|
||||||
|
Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
|
||||||
|
OS uptime: 0 days 7:45 hours
|
||||||
|
|
||||||
|
CPU: total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10 microcode 0xde, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, rtm, adx, fma, vzeroupper, clflush, clflushopt
|
||||||
|
Processor Information for all 12 processors :
|
||||||
|
Max Mhz: 3192, Current Mhz: 3192, Mhz Limit: 3192
|
||||||
|
|
||||||
|
Memory: 4k page, system-wide physical 32714M (6112M free)
|
||||||
|
TotalPageFile size 32714M (AvailPageFile size 5M)
|
||||||
|
current process WorkingSet (physical memory assigned to process): 213M, peak: 218M
|
||||||
|
current process commit charge ("private bytes"): 309M, peak: 316M
|
||||||
|
|
||||||
|
vm_info: OpenJDK 64-Bit Server VM (17.0.10+7) for windows-amd64 JRE (17.0.10+7), built on Jan 16 2024 23:25:11 by "admin" with MS VC++ 16.10 / 16.11 (VS2019)
|
||||||
|
|
||||||
|
END.
|
15
2 семестр/Lab4-5/readme.md
Normal file
15
2 семестр/Lab4-5/readme.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
H2 Console: \
|
||||||
|
http://localhost:8080/h2-console
|
||||||
|
|
||||||
|
JDBC URL: jdbc:h2:file:./data \
|
||||||
|
User Name: sa \
|
||||||
|
Password: password
|
||||||
|
|
||||||
|
Почитать:
|
||||||
|
|
||||||
|
- Spring Boot CRUD Application with Thymeleaf https://www.baeldung.com/spring-boot-crud-thymeleaf
|
||||||
|
- Thymeleaf Layout Dialect https://ultraq.github.io/thymeleaf-layout-dialect/
|
||||||
|
- Tutorial: Using Thymeleaf https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html#introducing-thymeleaf
|
||||||
|
- Working with Cookies in Spring MVC using @CookieValue Annotation https://www.geeksforgeeks.org/working-with-cookies-in-spring-mvc-using-cookievalue-annotation/
|
||||||
|
- Session Attributes in Spring MVC https://www.baeldung.com/spring-mvc-session-attributes
|
||||||
|
- LazyInitializationException – What it is and the best way to fix it https://thorben-janssen.com/lazyinitializationexception/
|
6031
2 семестр/Lab4-5/replay_pid6804.log
Normal file
6031
2 семестр/Lab4-5/replay_pid6804.log
Normal file
File diff suppressed because one or more lines are too long
1
2 семестр/Lab4-5/settings.gradle
Normal file
1
2 семестр/Lab4-5/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'demo'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user