commit
bbcf83b463
@ -0,0 +1,17 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
### Reference Documentation
|
||||||
|
For further reference, please consider the following sections:
|
||||||
|
|
||||||
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||||
|
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/)
|
||||||
|
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/#build-image)
|
||||||
|
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.3/reference/htmlsingle/index.html#web)
|
||||||
|
|
||||||
|
### Guides
|
||||||
|
The following guides illustrate how to use some features concretely:
|
||||||
|
|
||||||
|
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
|
||||||
|
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
|
||||||
|
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
# API REST SpringBoot 3.01-QCM_MuscuMaths (Maths'Educ)
|
||||||
|
|
||||||
|
## Les Parties Prenantes
|
||||||
|
|
||||||
|
1. **GUITARD Maxence**
|
||||||
|
|
||||||
|
2. **VAN BRABRANDT Jade**
|
||||||
|
|
||||||
|
3. **DUCOURTHIAL Jérémy**
|
||||||
|
|
||||||
|
4. **CALATAYUD Yvan**
|
||||||
|
|
||||||
|
5. **NORTIER Damien**
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
2024-03-17 12:43:31,049 INFO o.s.b.StartupInfoLogger [main] Starting ApiMathsEducApplication using Java 17.0.10 with PID 18820 (C:\Users\Utilisateur\Music\ApiMathsEduc\target\classes started by Utilisateur in C:\Users\Utilisateur\Music\ApiMathsEduc)
|
||||||
|
2024-03-17 12:43:31,050 INFO o.s.b.SpringApplication [main] No active profile set, falling back to 1 default profile: "default"
|
||||||
|
2024-03-17 12:43:31,401 INFO o.s.d.r.c.RepositoryConfigurationDelegate [main] Bootstrapping Spring Data JPA repositories in DEFAULT mode.
|
||||||
|
2024-03-17 12:43:31,429 INFO o.s.d.r.c.RepositoryConfigurationDelegate [main] Finished Spring Data repository scanning in 24 ms. Found 1 JPA repository interface.
|
||||||
|
2024-03-17 12:43:31,793 INFO o.s.b.w.e.t.TomcatWebServer [main] Tomcat initialized with port 8080 (http)
|
||||||
|
2024-03-17 12:43:31,800 INFO o.a.j.l.DirectJDKLog [main] Initializing ProtocolHandler ["http-nio-8080"]
|
||||||
|
2024-03-17 12:43:31,803 INFO o.a.j.l.DirectJDKLog [main] Starting service [Tomcat]
|
||||||
|
2024-03-17 12:43:31,803 INFO o.a.j.l.DirectJDKLog [main] Starting Servlet engine: [Apache Tomcat/10.1.19]
|
||||||
|
2024-03-17 12:43:31,855 INFO o.a.j.l.DirectJDKLog [main] Initializing Spring embedded WebApplicationContext
|
||||||
|
2024-03-17 12:43:31,858 INFO o.s.b.w.s.c.ServletWebServerApplicationContext [main] Root WebApplicationContext: initialization completed in 780 ms
|
||||||
|
2024-03-17 12:43:31,952 INFO o.h.j.i.u.LogHelper [main] HHH000204: Processing PersistenceUnitInfo [name: default]
|
||||||
|
2024-03-17 12:43:31,987 INFO o.h.Version [main] HHH000412: Hibernate ORM core version 6.4.4.Final
|
||||||
|
2024-03-17 12:43:32,007 INFO o.h.c.i.RegionFactoryInitiator [main] HHH000026: Second-level cache disabled
|
||||||
|
2024-03-17 12:43:32,161 INFO o.s.o.j.p.SpringPersistenceUnitInfo [main] No LoadTimeWeaver setup: ignoring JPA class transformer
|
||||||
|
2024-03-17 12:43:32,177 INFO c.z.h.HikariDataSource [main] HikariPool-1 - Starting...
|
||||||
|
2024-03-17 12:43:32,456 INFO c.z.h.p.HikariPool [main] HikariPool-1 - Added connection org.mariadb.jdbc.Connection@3ef3f661
|
||||||
|
2024-03-17 12:43:32,460 INFO c.z.h.HikariDataSource [main] HikariPool-1 - Start completed.
|
||||||
|
2024-03-17 12:43:33,076 INFO o.h.e.t.j.p.i.JtaPlatformInitiator [main] HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
|
||||||
|
2024-03-17 12:43:33,212 INFO o.s.o.j.AbstractEntityManagerFactoryBean [main] Initialized JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-03-17 12:43:33,376 WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration [main] spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
||||||
|
2024-03-17 12:43:33,567 INFO o.a.j.l.DirectJDKLog [main] Starting ProtocolHandler ["http-nio-8080"]
|
||||||
|
2024-03-17 12:43:33,580 INFO o.s.b.w.e.t.TomcatWebServer [main] Tomcat started on port 8080 (http) with context path ''
|
||||||
|
2024-03-17 12:43:33,589 INFO o.s.b.StartupInfoLogger [main] Started ApiMathsEducApplication in 2.755 seconds (process running for 3.088)
|
||||||
|
2024-03-17 12:43:39,173 INFO o.a.j.l.DirectJDKLog [http-nio-8080-exec-1] Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||||
|
2024-03-17 12:43:39,174 INFO o.s.w.s.FrameworkServlet [http-nio-8080-exec-1] Initializing Servlet 'dispatcherServlet'
|
||||||
|
2024-03-17 12:43:39,175 INFO o.s.w.s.FrameworkServlet [http-nio-8080-exec-1] Completed initialization in 1 ms
|
||||||
|
2024-03-17 12:48:09,824 INFO o.s.o.j.AbstractEntityManagerFactoryBean [SpringApplicationShutdownHook] Closing JPA EntityManagerFactory for persistence unit 'default'
|
||||||
|
2024-03-17 12:48:09,825 INFO c.z.h.HikariDataSource [SpringApplicationShutdownHook] HikariPool-1 - Shutdown initiated...
|
||||||
|
2024-03-17 12:48:09,975 INFO c.z.h.HikariDataSource [SpringApplicationShutdownHook] HikariPool-1 - Shutdown completed.
|
@ -0,0 +1,308 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you 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.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "$(uname)" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||||
|
else
|
||||||
|
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=$(java-config --jre-home)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="$(which javac)"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=$(which readlink)
|
||||||
|
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||||
|
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||||
|
fi
|
||||||
|
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||||
|
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
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
|
||||||
|
else
|
||||||
|
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
# Remove \r in case we run on Windows within Git Bash
|
||||||
|
# and check out the repository with auto CRLF management
|
||||||
|
# enabled. Otherwise, we may read lines that are delimited with
|
||||||
|
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||||
|
# splitting rules.
|
||||||
|
tr -s '\r\n' ' ' < "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
printf '%s\n' "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||||
|
log "$MAVEN_PROJECTBASEDIR"
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if [ -r "$wrapperJarPath" ]; then
|
||||||
|
log "Found $wrapperJarPath"
|
||||||
|
else
|
||||||
|
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||||
|
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
else
|
||||||
|
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||||
|
safeValue=$(echo "$value" | tr -d '\r')
|
||||||
|
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
log "Downloading from: $wrapperUrl"
|
||||||
|
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
log "Found wget ... using wget"
|
||||||
|
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
log "Found curl ... using curl"
|
||||||
|
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "Falling back to using Java to download"
|
||||||
|
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaSource=$(cygpath --path --windows "$javaSource")
|
||||||
|
javaClass=$(cygpath --path --windows "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$javaSource" ]; then
|
||||||
|
if [ ! -e "$javaClass" ]; then
|
||||||
|
log " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
log " - Running MavenWrapperDownloader.java ..."
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||||
|
wrapperSha256Sum=""
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||||
|
esac
|
||||||
|
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ -n "$wrapperSha256Sum" ]; then
|
||||||
|
wrapperSha256Result=false
|
||||||
|
if command -v sha256sum > /dev/null; then
|
||||||
|
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||||
|
wrapperSha256Result=true
|
||||||
|
fi
|
||||||
|
elif command -v shasum > /dev/null; then
|
||||||
|
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||||
|
wrapperSha256Result=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||||
|
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $wrapperSha256Result = false ]; then
|
||||||
|
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||||
|
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||||
|
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086 # safe args
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
@ -0,0 +1,205 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. 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,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %WRAPPER_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||||
|
SET WRAPPER_SHA_256_SUM=""
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||||
|
)
|
||||||
|
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||||
|
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||||
|
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||||
|
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||||
|
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||||
|
" exit 1;"^
|
||||||
|
"}"^
|
||||||
|
"}"
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.2.3</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.Sae301</groupId>
|
||||||
|
<artifactId>ApiMathsEduc</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>ApiMathsEduc</name>
|
||||||
|
<description>Demo project for Spring Boot</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-hateoas</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc;
|
||||||
|
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.springframework.data.crossstore.ChangeSetPersister.NotFoundException;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.ErrorResponse;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
@ControllerAdvice
|
||||||
|
public class ApiControllerAdvice extends ResponseEntityExceptionHandler{/
|
||||||
|
@ExceptionHandler(value = { IllegalArgumentException.class, IllegalStateException.class })
|
||||||
|
|
||||||
|
protected ResponseEntity<Object> handleConflict( RuntimeException ex, WebRequest request) {
|
||||||
|
//Logger logger = LoggerFactory.getLogger(ApiControllerAdvice.class);
|
||||||
|
//logger.info(request.toString());
|
||||||
|
|
||||||
|
String bodyOfResponse = "This should be application specific";
|
||||||
|
return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class ApiControllerAdvice {
|
||||||
|
|
||||||
|
@ExceptionHandler(ServiceException.class)
|
||||||
|
public ResponseEntity<String> handleINTERNAL_SERVER_ERROR(ServiceException ex) {
|
||||||
|
return new ResponseEntity<>(ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(NotFoundException.class)
|
||||||
|
public ResponseEntity<String> handleNOT_FOUND(NotFoundException ex) {
|
||||||
|
return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.Sae301.ApiMathsEduc;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ApiMathsEducApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ApiMathsEducApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class JacksonConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectMapper objectMapper() {
|
||||||
|
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.answer;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "answers")
|
||||||
|
public class Answer {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "content")
|
||||||
|
private String content;
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.answer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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 static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/answers")
|
||||||
|
public class AnswerController {
|
||||||
|
private final AnswerService answerService;
|
||||||
|
Logger logger = LoggerFactory.getLogger(AnswerController.class);
|
||||||
|
String idAppelTable = "03"; // Table Answers
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AnswerController(AnswerService answerService) {
|
||||||
|
this.answerService = answerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<List<EntityModel<Answer>>> getAllAnswers() {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0");
|
||||||
|
logger.info("Getting all answers");
|
||||||
|
|
||||||
|
List<Answer> answers = answerService.getAllAnswers();
|
||||||
|
List<EntityModel<Answer>> answerModels = new ArrayList<>();
|
||||||
|
for (Answer answer : answers) {
|
||||||
|
EntityModel<Answer> model = EntityModel.of(answer);
|
||||||
|
Link selfLink = linkTo(methodOn(AnswerController.class).getAnswerById(answer.getId())).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
answerModels.add(model);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(answerModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}//qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<EntityModel<Answer>> getAnswerById(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0" + id);
|
||||||
|
logger.info("Getting answer by ID: {}", id);
|
||||||
|
|
||||||
|
Optional<Answer> optionalAnswer = answerService.getAnswerById(id);
|
||||||
|
if (optionalAnswer.isPresent()) {
|
||||||
|
Answer answer = optionalAnswer.get();
|
||||||
|
|
||||||
|
EntityModel<Answer> model = EntityModel.of(answer);
|
||||||
|
|
||||||
|
// Ajouter un lien vers le chapitre lui-même
|
||||||
|
Link selfLink = linkTo(methodOn(AnswerController.class).getAnswerById(id)).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
|
||||||
|
// Ajouter un lien vers la liste complète des chapitres
|
||||||
|
Link allAnswersLink = linkTo(methodOn(AnswerController.class).getAllAnswers()).withRel("allAnswers");
|
||||||
|
model.add(allAnswersLink);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(model);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Answer> addAnswer(@RequestBody Answer answer) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "1");
|
||||||
|
logger.info("Adding answer: {}", answer);
|
||||||
|
Answer addedAnswer = answerService.addAnswer(answer);
|
||||||
|
return new ResponseEntity<>(addedAnswer, HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Answer> updateAnswer(@PathVariable Integer id, @RequestBody Answer answer) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "2" + id);
|
||||||
|
logger.info("Updating answer with ID {}: {}", id, answer);
|
||||||
|
Answer updatedAnswer = answerService.updateAnswer(id, answer);
|
||||||
|
return new ResponseEntity<>(updatedAnswer, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Void> deleteAnswer(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "3" + id);
|
||||||
|
logger.info("Deleting answer with ID: {}", id);
|
||||||
|
answerService.deleteAnswer(id);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.answer;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface AnswerRepository extends JpaRepository<Answer, Integer> {
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.answer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AnswerService {
|
||||||
|
private final AnswerRepository answerRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(AnswerService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AnswerService(AnswerRepository answerRepository) {
|
||||||
|
this.answerRepository = answerRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Answer> getAllAnswers() {
|
||||||
|
try {
|
||||||
|
return answerRepository.findAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while fetching all answers", ex);
|
||||||
|
throw new ServiceException("Error while fetching all answers", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Answer> getAnswerById(Integer id) {
|
||||||
|
if (!answerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while fetching answer by ID: {}", id);
|
||||||
|
throw new ServiceException("Error while fetching answer by ID: " + id);
|
||||||
|
}
|
||||||
|
return answerRepository.findById(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Answer addAnswer(Answer answer) {
|
||||||
|
try {
|
||||||
|
return answerRepository.save(answer);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while adding answer: {}", answer, ex);
|
||||||
|
throw new ServiceException("Error while adding answer: " + answer, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Answer updateAnswer(Integer id, Answer answer) {
|
||||||
|
if (!answerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while updating answer with ID {}: {}", id, answer);
|
||||||
|
throw new ServiceException("Error while updating answer with ID " + id + ": " + answer);
|
||||||
|
}
|
||||||
|
answer.setId(id);
|
||||||
|
return answerRepository.save(answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAnswer(Integer id) {
|
||||||
|
if (!answerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while deleting answer with ID: {}", id);
|
||||||
|
throw new ServiceException("Error while deleting answer with ID: " + id);
|
||||||
|
}
|
||||||
|
answerRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.chapter;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "chapters")
|
||||||
|
public class Chapter {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "name")
|
||||||
|
private String name;
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.chapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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 static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/chapters")
|
||||||
|
public class ChapterController {
|
||||||
|
private final ChapterService chapterService;
|
||||||
|
Logger logger = LoggerFactory.getLogger(ChapterController.class);
|
||||||
|
String idAppelTable = "01"; // Table Chapters
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ChapterController(ChapterService chapterService) {
|
||||||
|
this.chapterService = chapterService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<List<EntityModel<Chapter>>> getAllChapters() {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0");
|
||||||
|
logger.info("Getting all chapters");
|
||||||
|
|
||||||
|
List<Chapter> chapters = chapterService.getAllChapters();
|
||||||
|
List<EntityModel<Chapter>> chapterModels = new ArrayList<>();
|
||||||
|
for (Chapter chapter : chapters) {
|
||||||
|
EntityModel<Chapter> model = EntityModel.of(chapter);
|
||||||
|
Link selfLink = linkTo(methodOn(ChapterController.class).getChapterById(chapter.getId())).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
chapterModels.add(model);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(chapterModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<EntityModel<Chapter>> getChapterById(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0" + id);
|
||||||
|
logger.info("Getting chapter by ID: {}", id);
|
||||||
|
|
||||||
|
Optional<Chapter> optionalChapter = chapterService.getChapterById(id);
|
||||||
|
if (optionalChapter.isPresent()) {
|
||||||
|
Chapter chapter = optionalChapter.get();
|
||||||
|
|
||||||
|
EntityModel<Chapter> model = EntityModel.of(chapter);
|
||||||
|
|
||||||
|
Link selfLink = linkTo(methodOn(ChapterController.class).getChapterById(id)).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
|
||||||
|
Link allChaptersLink = linkTo(methodOn(ChapterController.class).getAllChapters()).withRel("allChapters");
|
||||||
|
model.add(allChaptersLink);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(model);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Chapter> addChapter(@RequestBody Chapter chapter) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "1");
|
||||||
|
logger.info("Adding chapter: {}", chapter);
|
||||||
|
Chapter addedChapter = chapterService.addChapter(chapter);
|
||||||
|
return new ResponseEntity<>(addedChapter, HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Chapter> updateChapter(@PathVariable Integer id, @RequestBody Chapter chapter) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "2" + id);
|
||||||
|
logger.info("Updating chapter with ID {}: {}", id, chapter);
|
||||||
|
Chapter updatedChapter = chapterService.updateChapter(id, chapter);
|
||||||
|
return new ResponseEntity<>(updatedChapter, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Void> deleteChapter(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "3" + id);
|
||||||
|
logger.info("Deleting chapter with ID: {}", id);
|
||||||
|
chapterService.deleteChapter(id);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.chapter;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface ChapterRepository extends JpaRepository<Chapter, Integer> {
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.chapter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ChapterService {
|
||||||
|
private final ChapterRepository chapterRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(ChapterService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ChapterService(ChapterRepository chapterRepository) {
|
||||||
|
this.chapterRepository = chapterRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Chapter> getAllChapters() {
|
||||||
|
try {
|
||||||
|
return chapterRepository.findAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while fetching all chapters", ex);
|
||||||
|
throw new ServiceException("Error while fetching all chapters", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Chapter> getChapterById(Integer id) {
|
||||||
|
if (!chapterRepository.existsById(id)) {
|
||||||
|
logger.error("Error while fetching chapter by ID: {}", id);
|
||||||
|
throw new ServiceException("Error while fetching chapter by ID: " + id);
|
||||||
|
}
|
||||||
|
return chapterRepository.findById(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chapter addChapter(Chapter chapter) {
|
||||||
|
try {
|
||||||
|
return chapterRepository.save(chapter);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while adding chapter: {}", chapter, ex);
|
||||||
|
throw new ServiceException("Error while adding chapter: " + chapter, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chapter updateChapter(Integer id, Chapter chapter) {
|
||||||
|
if (!chapterRepository.existsById(id)) {
|
||||||
|
logger.error("Error while updating chapter with ID {}: {}", id, chapter);
|
||||||
|
throw new ServiceException("Error while updating chapter with ID " + id + ": " + chapter);
|
||||||
|
}
|
||||||
|
chapter.setId(id);
|
||||||
|
return chapterRepository.save(chapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteChapter(Integer id) {
|
||||||
|
if (!chapterRepository.existsById(id)) {
|
||||||
|
logger.error("Error while deleting chapter with ID: {}", id);
|
||||||
|
throw new ServiceException("Error while deleting chapter with ID: " + id);
|
||||||
|
}
|
||||||
|
chapterRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.lobby;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "lobbies")
|
||||||
|
public class Lobby {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "name")
|
||||||
|
private String name;
|
||||||
|
@Column(name = "password")
|
||||||
|
private String password;
|
||||||
|
@Column(name = "nbplayers")
|
||||||
|
private Integer nbplayers;
|
||||||
|
@Column(name = "idplayercreator")
|
||||||
|
private Integer idplayercreator;
|
||||||
|
@Column(name = "idchapter")
|
||||||
|
private Integer idchapter;
|
||||||
|
@Column(name = "difficulty")
|
||||||
|
private Integer difficulty;
|
||||||
|
@Column(name = "launched")
|
||||||
|
private byte launched;
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.lobby;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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 static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/lobbies")
|
||||||
|
public class LobbyController {
|
||||||
|
private final LobbyService lobbyService;
|
||||||
|
Logger logger = LoggerFactory.getLogger(LobbyController.class);
|
||||||
|
String idAppelTable = "04"; // Table Lobbies
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public LobbyController(LobbyService lobbyService) {
|
||||||
|
this.lobbyService = lobbyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<List<EntityModel<Lobby>>> getAllLobbies() {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0");
|
||||||
|
logger.info("Getting all lobbies");
|
||||||
|
|
||||||
|
List<Lobby> lobbies = lobbyService.getAllLobbies();
|
||||||
|
List<EntityModel<Lobby>> lobbyModels = new ArrayList<>();
|
||||||
|
for (Lobby lobby : lobbies) {
|
||||||
|
EntityModel<Lobby> model = EntityModel.of(lobby);
|
||||||
|
Link selfLink = linkTo(methodOn(LobbyController.class).getLobbyById(lobby.getId())).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
lobbyModels.add(model);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(lobbyModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<EntityModel<Lobby>> getLobbyById(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0" + id);
|
||||||
|
logger.info("Getting lobby by ID: {}", id);
|
||||||
|
|
||||||
|
Optional<Lobby> optionalLobbies = lobbyService.getLobbyById(id);
|
||||||
|
if (optionalLobbies.isPresent()) {
|
||||||
|
Lobby lobby = optionalLobbies.get();
|
||||||
|
|
||||||
|
EntityModel<Lobby> model = EntityModel.of(lobby);
|
||||||
|
|
||||||
|
Link selfLink = linkTo(methodOn(LobbyController.class).getLobbyById(id)).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
|
||||||
|
Link allLobbiesLink = linkTo(methodOn(LobbyController.class).getAllLobbies()).withRel("allLobbies");
|
||||||
|
model.add(allLobbiesLink);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(model);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Lobby> addLobby(@RequestBody Lobby lobby) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "1");
|
||||||
|
logger.info("Adding lobby: {}", lobby);
|
||||||
|
Lobby addedLobby = lobbyService.addLobby(lobby);
|
||||||
|
return new ResponseEntity<>(addedLobby, HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Lobby> updateLobby(@PathVariable Integer id, @RequestBody Lobby lobby) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "2" + id);
|
||||||
|
logger.info("Updating lobby with ID {}: {}", id, lobby);
|
||||||
|
Lobby updatedLobby = lobbyService.updateLobby(id, lobby);
|
||||||
|
return new ResponseEntity<>(updatedLobby, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Void> deleteLobby(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "3" + id);
|
||||||
|
logger.info("Deleting lobby with ID: {}", id);
|
||||||
|
lobbyService.deleteLobby(id);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.lobby;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface LobbyRepository extends JpaRepository<Lobby, Integer> {
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.lobby;
|
||||||
|
|
||||||
|
import com.Sae301.ApiMathsEduc.lobby.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LobbyService {
|
||||||
|
private final LobbyRepository lobbyRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(LobbyService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public LobbyService(LobbyRepository lobbyRepository) {
|
||||||
|
this.lobbyRepository = lobbyRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Lobby> getAllLobbies() {
|
||||||
|
try {
|
||||||
|
return lobbyRepository.findAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while fetching all lobbies", ex);
|
||||||
|
throw new ServiceException("Error while fetching all lobbies", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Lobby> getLobbyById(Integer id) {
|
||||||
|
if (!lobbyRepository.existsById(id)) {
|
||||||
|
logger.error("Error while fetching lobby by ID: {}", id);
|
||||||
|
throw new ServiceException("Error while fetching lobby by ID: " + id);
|
||||||
|
}
|
||||||
|
return lobbyRepository.findById(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lobby addLobby(Lobby lobby) {
|
||||||
|
try {
|
||||||
|
return lobbyRepository.save(lobby);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while adding lobby: {}", lobby, ex);
|
||||||
|
throw new ServiceException("Error while adding lobby: " + lobby, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lobby updateLobby(Integer id, Lobby lobby) {
|
||||||
|
if (!lobbyRepository.existsById(id)) {
|
||||||
|
logger.error("Error while updating lobby with ID {}: {}", id, lobby);
|
||||||
|
throw new ServiceException("Error while updating lobby with ID " + id + ": " + lobby);
|
||||||
|
}
|
||||||
|
lobby.setId(id);
|
||||||
|
return lobbyRepository.save(lobby);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteLobby(Integer id) {
|
||||||
|
if (!lobbyRepository.existsById(id)) {
|
||||||
|
logger.error("Error while deleting lobby with ID: {}", id);
|
||||||
|
throw new ServiceException("Error while deleting lobby with ID: " + id);
|
||||||
|
}
|
||||||
|
lobbyRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.player;
|
||||||
|
|
||||||
|
import com.Sae301.ApiMathsEduc.player.*;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "players")
|
||||||
|
public class Player {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "nickname")
|
||||||
|
private String nickname;
|
||||||
|
@Column(name = "password")
|
||||||
|
private String password;
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.player;
|
||||||
|
|
||||||
|
import com.Sae301.ApiMathsEduc.question.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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 static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/players")
|
||||||
|
public class PlayerController {
|
||||||
|
private final PlayerService questionService;
|
||||||
|
Logger logger = LoggerFactory.getLogger(PlayerController.class);
|
||||||
|
String idAppelTable = "05"; // Table Players
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PlayerController(PlayerService questionService) {
|
||||||
|
this.questionService = questionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<List<EntityModel<Player>>> getAllPlayers() {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0");
|
||||||
|
logger.info("Getting all questions");
|
||||||
|
|
||||||
|
List<Player> questions = questionService.getAllPlayers();
|
||||||
|
List<EntityModel<Player>> questionModels = new ArrayList<>();
|
||||||
|
for (Player question : questions) {
|
||||||
|
EntityModel<Player> model = EntityModel.of(question);
|
||||||
|
Link selfLink = linkTo(methodOn(PlayerController.class).getPlayerById(question.getId())).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
questionModels.add(model);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(questionModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<EntityModel<Player>> getPlayerById(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0" + id);
|
||||||
|
logger.info("Getting question by ID: {}", id);
|
||||||
|
|
||||||
|
Optional<Player> optionalPlayers = questionService.getPlayerById(id);
|
||||||
|
if (optionalPlayers.isPresent()) {
|
||||||
|
Player question = optionalPlayers.get();
|
||||||
|
|
||||||
|
EntityModel<Player> model = EntityModel.of(question);
|
||||||
|
|
||||||
|
Link selfLink = linkTo(methodOn(PlayerController.class).getPlayerById(id)).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
|
||||||
|
Link allPlayersLink = linkTo(methodOn(PlayerController.class).getAllPlayers()).withRel("allPlayers");
|
||||||
|
model.add(allPlayersLink);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(model);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Player> addPlayer(@RequestBody Player question) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "1");
|
||||||
|
logger.info("Adding question: {}", question);
|
||||||
|
Player addedPlayer = questionService.addPlayer(question);
|
||||||
|
return new ResponseEntity<>(addedPlayer, HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Player> updatePlayer(@PathVariable Integer id, @RequestBody Player question) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "2" + id);
|
||||||
|
logger.info("Updating question with ID {}: {}", id, question);
|
||||||
|
Player updatedPlayer = questionService.updatePlayer(id, question);
|
||||||
|
return new ResponseEntity<>(updatedPlayer, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
public ResponseEntity<Void> deletePlayer(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "3" + id);
|
||||||
|
logger.info("Deleting question with ID: {}", id);
|
||||||
|
questionService.deletePlayer(id);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.player;
|
||||||
|
|
||||||
|
import com.Sae301.ApiMathsEduc.question.*;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface PlayerRepository extends JpaRepository<Player, Integer> {
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.player;
|
||||||
|
|
||||||
|
import com.Sae301.ApiMathsEduc.player.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayerService {
|
||||||
|
private final PlayerRepository playerRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(PlayerService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PlayerService(PlayerRepository playerRepository) {
|
||||||
|
this.playerRepository = playerRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Player> getAllPlayers() {
|
||||||
|
try {
|
||||||
|
return playerRepository.findAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while fetching all players", ex);
|
||||||
|
throw new ServiceException("Error while fetching all players", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Player> getPlayerById(Integer id) {
|
||||||
|
if (!playerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while fetching player by ID: {}", id);
|
||||||
|
throw new ServiceException("Error while fetching player by ID: " + id);
|
||||||
|
}
|
||||||
|
return playerRepository.findById(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player addPlayer(Player player) {
|
||||||
|
try {
|
||||||
|
return playerRepository.save(player);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while adding player: {}", player, ex);
|
||||||
|
throw new ServiceException("Error while adding player: " + player, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player updatePlayer(Integer id, Player player) {
|
||||||
|
if (!playerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while updating player with ID {}: {}", id, player);
|
||||||
|
throw new ServiceException("Error while updating player with ID " + id + ": " + player);
|
||||||
|
}
|
||||||
|
player.setId(id);
|
||||||
|
return playerRepository.save(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deletePlayer(Integer id) {
|
||||||
|
if (!playerRepository.existsById(id)) {
|
||||||
|
logger.error("Error while deleting player with ID: {}", id);
|
||||||
|
throw new ServiceException("Error while deleting player with ID: " + id);
|
||||||
|
}
|
||||||
|
playerRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.question;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "questions")
|
||||||
|
public class Question {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "content")
|
||||||
|
private String content;
|
||||||
|
@Column(name = "nbfails")
|
||||||
|
private Integer nbfails;
|
||||||
|
@Column(name = "difficulty")
|
||||||
|
private Integer difficulty;
|
||||||
|
@Column(name = "idchapter")
|
||||||
|
private Integer idchapter;
|
||||||
|
@Column(name = "idanswergood")
|
||||||
|
private Integer idanswergood;
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.question;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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 static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/questions")
|
||||||
|
public class QuestionController {
|
||||||
|
private final QuestionService questionService;
|
||||||
|
Logger logger = LoggerFactory.getLogger(QuestionController.class);
|
||||||
|
String idAppelTable = "02"; // Table Questions
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public QuestionController(QuestionService questionService) {
|
||||||
|
this.questionService = questionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<List<EntityModel<Question>>> getAllQuestions() {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0");
|
||||||
|
logger.info("Getting all questions");
|
||||||
|
|
||||||
|
List<Question> questions = questionService.getAllQuestions();
|
||||||
|
List<EntityModel<Question>> questionModels = new ArrayList<>();
|
||||||
|
for (Question question : questions) {
|
||||||
|
EntityModel<Question> model = EntityModel.of(question);
|
||||||
|
Link selfLink = linkTo(methodOn(QuestionController.class).getQuestionById(question.getId())).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
questionModels.add(model);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(questionModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ResponseEntity<EntityModel<Question>> getQuestionById(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "0" + id);
|
||||||
|
logger.info("Getting question by ID: {}", id);
|
||||||
|
|
||||||
|
Optional<Question> optionalQuestions = questionService.getQuestionById(id);
|
||||||
|
if (optionalQuestions.isPresent()) {
|
||||||
|
Question question = optionalQuestions.get();
|
||||||
|
|
||||||
|
EntityModel<Question> model = EntityModel.of(question);
|
||||||
|
|
||||||
|
Link selfLink = linkTo(methodOn(QuestionController.class).getQuestionById(id)).withSelfRel();
|
||||||
|
model.add(selfLink);
|
||||||
|
|
||||||
|
Link allQuestionsLink = linkTo(methodOn(QuestionController.class).getAllQuestions()).withRel("allQuestions");
|
||||||
|
model.add(allQuestionsLink);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(model);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Question> addQuestion(@RequestBody Question question) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "1");
|
||||||
|
logger.info("Adding question: {}", question);
|
||||||
|
Question addedQuestion = questionService.addQuestion(question);
|
||||||
|
return new ResponseEntity<>(addedQuestion, HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ResponseEntity<Question> updateQuestion(@PathVariable Integer id, @RequestBody Question question) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "2" + id);
|
||||||
|
logger.info("Updating question with ID {}: {}", id, question);
|
||||||
|
Question updatedQuestion = questionService.updateQuestion(id, question);
|
||||||
|
return new ResponseEntity<>(updatedQuestion, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Void> deleteQuestion(@PathVariable Integer id) {
|
||||||
|
MDC.put("idAppel", idAppelTable + "3" + id);
|
||||||
|
logger.info("Deleting question with ID: {}", id);
|
||||||
|
questionService.deleteQuestion(id);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.question;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface QuestionRepository extends JpaRepository<Question, Integer> {
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.Sae301.ApiMathsEduc.question;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Utilisateur
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class QuestionService {
|
||||||
|
private final QuestionRepository questionRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(QuestionService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public QuestionService(QuestionRepository questionRepository) {
|
||||||
|
this.questionRepository = questionRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Question> getAllQuestions() {
|
||||||
|
try {
|
||||||
|
return questionRepository.findAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while fetching all questions", ex);
|
||||||
|
throw new ServiceException("Error while fetching all questions", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Question> getQuestionById(Integer id) {
|
||||||
|
if (!questionRepository.existsById(id)) {
|
||||||
|
logger.error("Error while fetching question by ID: {}", id);
|
||||||
|
throw new ServiceException("Error while fetching question by ID: " + id);
|
||||||
|
}
|
||||||
|
return questionRepository.findById(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Question addQuestion(Question question) {
|
||||||
|
try {
|
||||||
|
return questionRepository.save(question);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error while adding question: {}", question, ex);
|
||||||
|
throw new ServiceException("Error while adding question: " + question, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Question updateQuestion(Integer id, Question question) {
|
||||||
|
if (!questionRepository.existsById(id)) {
|
||||||
|
logger.error("Error while updating question with ID {}: {}", id, question);
|
||||||
|
throw new ServiceException("Error while updating question with ID " + id + ": " + question);
|
||||||
|
}
|
||||||
|
question.setId(id);
|
||||||
|
return questionRepository.save(question);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteQuestion(Integer id) {
|
||||||
|
if (!questionRepository.existsById(id)) {
|
||||||
|
logger.error("Error while deleting question with ID: {}", id);
|
||||||
|
throw new ServiceException("Error while deleting question with ID: " + id);
|
||||||
|
}
|
||||||
|
questionRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
spring.application.name=ApiMathsEduc
|
||||||
|
|
||||||
|
spring.datasource.url=jdbc:mariadb://b62383e.online-server.cloud:3306/mathseduc
|
||||||
|
spring.datasource.username=mathseduc
|
||||||
|
spring.datasource.password=educ3306*
|
||||||
|
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
|
spring.jpa.hibernate.ddl-auto=validate
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
%d{HH:mm:ss.SSS} %X{idAppel} %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="ERROR">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.Sae301.ApiMathsEduc;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class ApiMathsEducApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
|||||||
|
spring.application.name=ApiMathsEduc
|
||||||
|
|
||||||
|
spring.datasource.url=jdbc:mariadb://b62383e.online-server.cloud:3306/mathseduc
|
||||||
|
spring.datasource.username=mathseduc
|
||||||
|
spring.datasource.password=educ3306*
|
||||||
|
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
|
spring.jpa.hibernate.ddl-auto=validate
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<property name="LOGS" value="./logs" />
|
||||||
|
<appender name="Console"
|
||||||
|
class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||||
|
<Pattern>
|
||||||
|
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1}):
|
||||||
|
%msg%n%throwable
|
||||||
|
</Pattern>
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
<appender name="RollingFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOGS}/spring-boot-logger.log</file>
|
||||||
|
<encoder
|
||||||
|
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<Pattern>%d %p %C{1} [%t] %m%n</Pattern>
|
||||||
|
</encoder>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- rollover daily and when the file reaches 10 MegaBytes -->
|
||||||
|
<fileNamePattern>${LOGS}/archived/spring-boot-logger-%d{yyyy-MM-dd}.%i.log
|
||||||
|
</fileNamePattern>
|
||||||
|
<timeBasedFileNamingAndTriggeringPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
</timeBasedFileNamingAndTriggeringPolicy>
|
||||||
|
</rollingPolicy>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- LOG everything at INFO level -->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="RollingFile" />
|
||||||
|
<appender-ref ref="Console" />
|
||||||
|
</root>
|
||||||
|
<!-- LOG "" at TRACE level -->
|
||||||
|
<logger name="example.serv" level="trace" additivity="false">
|
||||||
|
<appender-ref ref="RollingFile" />
|
||||||
|
<appender-ref ref="Console" />
|
||||||
|
</logger>
|
||||||
|
</configuration>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
%d{HH:mm:ss.SSS} %X{idAppel} %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="ERROR">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
@ -0,0 +1,3 @@
|
|||||||
|
artifactId=ApiMathsEduc
|
||||||
|
groupId=com.Sae301
|
||||||
|
version=0.0.1-SNAPSHOT
|
@ -0,0 +1,23 @@
|
|||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/ApiControllerAdvice.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/chapter/ChapterRepository.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/lobby/LobbyRepository.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/lobby/Lobby.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/answer/Answer.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/question/Question.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/player/PlayerService.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/player/PlayerController.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/question/QuestionController.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/ApiMathsEducApplication.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/question/QuestionRepository.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/question/QuestionService.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/player/PlayerRepository.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/player/Player.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/answer/AnswerService.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/JacksonConfiguration.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/lobby/LobbyService.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/chapter/ChapterController.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/chapter/Chapter.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/chapter/ChapterService.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/answer/AnswerController.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/lobby/LobbyController.java
|
||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/main/java/com/Sae301/ApiMathsEduc/answer/AnswerRepository.java
|
@ -0,0 +1 @@
|
|||||||
|
/home/UCA/jeducourth/Musique/ApiMathsEduc/src/test/java/com/Sae301/ApiMathsEduc/ApiMathsEducApplicationTests.java
|
@ -0,0 +1,293 @@
|
|||||||
|
# Created at 2024-03-17T12:27:03.764
|
||||||
|
Thread dump for process (23780@DESKTOP-33KKJVM):
|
||||||
|
"main"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.base@17.0.10/java.lang.ClassLoader.defineClass1(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
|
||||||
|
at java.base@17.0.10/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
|
||||||
|
at java.base@17.0.10/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getDefaultContextLoaderClass(SpringBootTestContextBootstrapper.java:145)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.resolveContextLoader(AbstractTestContextBootstrapper.java:507)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootTestContextBootstrapper.resolveContextLoader(SpringBootTestContextBootstrapper.java:132)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:256)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:215)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:111)
|
||||||
|
at app//org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:142)
|
||||||
|
at app//org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:126)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension$$Lambda$370/0x0000024ed90bef00.apply(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.lambda$getOrComputeIfAbsent$5(NamespacedHierarchicalStore.java:147)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$$Lambda$365/0x0000024ed90bbcd8.get(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.computeValue(NamespacedHierarchicalStore.java:372)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.get(NamespacedHierarchicalStore.java:361)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.evaluate(NamespacedHierarchicalStore.java:308)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.access$200(NamespacedHierarchicalStore.java:287)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:149)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:168)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.lambda$getOrComputeIfAbsent$3(NamespaceAwareStore.java:66)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore$$Lambda$363/0x0000024ed90bb650.get(Unknown Source)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.accessStore(NamespaceAwareStore.java:90)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:65)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension.getTestContextManager(SpringExtension.java:366)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:131)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:396)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$$Lambda$353/0x0000024ed90b9110.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:396)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:212)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:85)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$292/0x0000024ed90aa8d8.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$291/0x0000024ed90aa6b8.invoke(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$290/0x0000024ed90aa2a0.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$296/0x0000024ed90ab3c8.accept(Unknown Source)
|
||||||
|
at java.base@17.0.10/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$292/0x0000024ed90aa8d8.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$291/0x0000024ed90aa6b8.invoke(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$290/0x0000024ed90aa2a0.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda$246/0x0000024ed9098460.accept(Unknown Source)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
|
||||||
|
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
|
||||||
|
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
|
||||||
|
at app//org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
|
||||||
|
|
||||||
|
"Reference Handler"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference.processPendingReferences(Reference.java:253)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:215)
|
||||||
|
|
||||||
|
"Finalizer"
|
||||||
|
java.lang.Thread.State: WAITING
|
||||||
|
at java.base@17.0.10/java.lang.Object.wait(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:172)
|
||||||
|
|
||||||
|
"Signal Dispatcher"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Attach Listener"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Notification Thread"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Common-Cleaner"
|
||||||
|
java.lang.Thread.State: TIMED_WAITING
|
||||||
|
at java.base@17.0.10/java.lang.Object.wait(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
|
||||||
|
at java.base@17.0.10/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:140)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
at java.base@17.0.10/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:162)
|
||||||
|
|
||||||
|
"surefire-forkedjvm-stream-flusher"
|
||||||
|
java.lang.Thread.State: TIMED_WAITING
|
||||||
|
at java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
||||||
|
"surefire-forkedjvm-command-thread"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.management@17.0.10/sun.management.ThreadImpl.getThreadInfo1(Native Method)
|
||||||
|
at java.management@17.0.10/sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:197)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.generateThreadDump(ForkedBooter.java:579)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.access$600(ForkedBooter.java:79)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter$4.update(ForkedBooter.java:322)
|
||||||
|
at app//org.apache.maven.surefire.booter.CommandReader$CommandRunnable.callListeners(CommandReader.java:357)
|
||||||
|
at app//org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:309)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Created at 2024-03-17T12:27:03.766
|
||||||
|
Exiting self fork JVM. Received SHUTDOWN command from Maven shutdown hook.
|
||||||
|
Thread dump before exiting the process (23780@DESKTOP-33KKJVM):
|
||||||
|
"main"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.base@17.0.10/java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
|
||||||
|
at java.base@17.0.10/java.io.FileSystem.hasBooleanAttributes(FileSystem.java:125)
|
||||||
|
at java.base@17.0.10/java.io.File.exists(File.java:834)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.URLClassPath$FileLoader.getResource(URLClassPath.java:1264)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:321)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:757)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
|
||||||
|
at java.base@17.0.10/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
|
||||||
|
at java.base@17.0.10/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootContextLoader.detectDefaultConfigurationClasses(SpringBootContextLoader.java:343)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootContextLoader.processContextConfiguration(SpringBootContextLoader.java:328)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:315)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:267)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:215)
|
||||||
|
at app//org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
|
||||||
|
at app//org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:111)
|
||||||
|
at app//org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:142)
|
||||||
|
at app//org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:126)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension$$Lambda$370/0x0000024ed90bef00.apply(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.lambda$getOrComputeIfAbsent$5(NamespacedHierarchicalStore.java:147)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$$Lambda$365/0x0000024ed90bbcd8.get(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.computeValue(NamespacedHierarchicalStore.java:372)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.get(NamespacedHierarchicalStore.java:361)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.evaluate(NamespacedHierarchicalStore.java:308)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.access$200(NamespacedHierarchicalStore.java:287)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:149)
|
||||||
|
at app//org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:168)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.lambda$getOrComputeIfAbsent$3(NamespaceAwareStore.java:66)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore$$Lambda$363/0x0000024ed90bb650.get(Unknown Source)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.accessStore(NamespaceAwareStore.java:90)
|
||||||
|
at app//org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:65)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension.getTestContextManager(SpringExtension.java:366)
|
||||||
|
at app//org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:131)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:396)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$$Lambda$353/0x0000024ed90b9110.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:396)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:212)
|
||||||
|
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:85)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$292/0x0000024ed90aa8d8.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$291/0x0000024ed90aa6b8.invoke(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$290/0x0000024ed90aa2a0.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$296/0x0000024ed90ab3c8.accept(Unknown Source)
|
||||||
|
at java.base@17.0.10/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$292/0x0000024ed90aa8d8.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$291/0x0000024ed90aa6b8.invoke(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$290/0x0000024ed90aa2a0.execute(Unknown Source)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
|
||||||
|
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda$246/0x0000024ed9098460.accept(Unknown Source)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
|
||||||
|
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
|
||||||
|
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
|
||||||
|
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
|
||||||
|
at app//org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
|
||||||
|
at app//org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
|
||||||
|
|
||||||
|
"Reference Handler"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference.processPendingReferences(Reference.java:253)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:215)
|
||||||
|
|
||||||
|
"Finalizer"
|
||||||
|
java.lang.Thread.State: WAITING
|
||||||
|
at java.base@17.0.10/java.lang.Object.wait(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
|
||||||
|
at java.base@17.0.10/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:172)
|
||||||
|
|
||||||
|
"Signal Dispatcher"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Attach Listener"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Notification Thread"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
|
||||||
|
"Common-Cleaner"
|
||||||
|
java.lang.Thread.State: TIMED_WAITING
|
||||||
|
at java.base@17.0.10/java.lang.Object.wait(Native Method)
|
||||||
|
at java.base@17.0.10/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
|
||||||
|
at java.base@17.0.10/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:140)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
at java.base@17.0.10/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:162)
|
||||||
|
|
||||||
|
"surefire-forkedjvm-stream-flusher"
|
||||||
|
java.lang.Thread.State: TIMED_WAITING
|
||||||
|
at java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
|
||||||
|
at java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
||||||
|
"surefire-forkedjvm-command-thread"
|
||||||
|
java.lang.Thread.State: RUNNABLE
|
||||||
|
at java.management@17.0.10/sun.management.ThreadImpl.getThreadInfo1(Native Method)
|
||||||
|
at java.management@17.0.10/sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:197)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.generateThreadDump(ForkedBooter.java:579)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter.access$600(ForkedBooter.java:79)
|
||||||
|
at app//org.apache.maven.surefire.booter.ForkedBooter$4.update(ForkedBooter.java:315)
|
||||||
|
at app//org.apache.maven.surefire.booter.CommandReader$CommandRunnable.callListeners(CommandReader.java:357)
|
||||||
|
at app//org.apache.maven.surefire.booter.CommandReader$CommandRunnable.exitByConfiguration(CommandReader.java:367)
|
||||||
|
at app//org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:330)
|
||||||
|
at java.base@17.0.10/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# Created at 2024-03-17T12:27:03.765
|
||||||
|
TestSet has not finished before stream error has appeared >> initializing exit by non-null configuration: EXIT
|
||||||
|
java.io.EOFException
|
||||||
|
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.read(AbstractStreamDecoder.java:444)
|
||||||
|
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.read(AbstractStreamDecoder.java:419)
|
||||||
|
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.readMessageType(AbstractStreamDecoder.java:116)
|
||||||
|
at org.apache.maven.surefire.booter.stream.CommandDecoder.decode(CommandDecoder.java:77)
|
||||||
|
at org.apache.maven.surefire.booter.spi.CommandChannelDecoder.decode(CommandChannelDecoder.java:60)
|
||||||
|
at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:290)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
|||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Test set: com.Sae301.ApiMathsEduc.ApiMathsEducApplicationTests
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.388 s -- in com.Sae301.ApiMathsEduc.ApiMathsEducApplicationTests
|
Loading…
Reference in new issue