diff --git a/Dockerfile b/Dockerfile
index 7443bda..7f2577d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-ARG RUN_IMAGE=eclipse-temurin:21-jre-jammy
+ARG RUN_IMAGE=eclipse-temurin:25-jre-jammy
FROM ${RUN_IMAGE}
ARG TARGET_DIR=/opt/app
diff --git a/build.gradle b/build.gradle
index 5b121ef..8a7439c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,15 +9,11 @@ plugins {
group = groupId
version = koraVersion
-application {
- applicationName = "application"
- mainClassName = "ru.tinkoff.kora.java.Application"
- applicationDefaultJvmArgs = ["-Dfile.encoding=UTF-8"]
+java {
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
}
-sourceCompatibility = JavaVersion.VERSION_21
-targetCompatibility = JavaVersion.VERSION_21
-
repositories {
mavenCentral()
maven { url "https://central.sonatype.com/repository/maven-snapshots" }
@@ -29,6 +25,8 @@ configurations {
compileOnly.extendsFrom(koraBom)
implementation.extendsFrom(koraBom)
api.extendsFrom(koraBom)
+ testImplementation.extendsFrom(koraBom)
+ testAnnotationProcessor.extendsFrom(koraBom)
}
dependencies {
@@ -36,7 +34,6 @@ dependencies {
annotationProcessor "ru.tinkoff.kora:annotation-processors"
implementation "ru.tinkoff.kora:http-server-undertow"
- implementation "ru.tinkoff.kora:micrometer-module"
implementation "ru.tinkoff.kora:config-hocon"
implementation "ru.tinkoff.kora:logging-logback"
@@ -45,6 +42,12 @@ dependencies {
testImplementation "org.testcontainers:junit-jupiter:1.19.8"
}
+application {
+ applicationName = "application"
+ mainClass = "ru.tinkoff.kora.example.Application"
+ applicationDefaultJvmArgs = ["-Dfile.encoding=UTF-8"]
+}
+
//noinspection GroovyAssignabilityCheck
run {
environment([
@@ -75,8 +78,10 @@ test {
exceptionFormat("full")
}
+ exclude("**/\$*")
+
jacoco {
- excludes += ["**/Application*"]
+ excludes += ["**/generated/**", "**/Application*", "**/\$*"]
}
reports {
@@ -91,6 +96,7 @@ jacocoTestReport {
xml.required = true
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
+ classDirectories = files(classDirectories.files.collect { fileTree(dir: it, excludes: test.jacoco.excludes) })
}
compileJava {
diff --git a/gradle.properties b/gradle.properties
index 728d8e5..dd3d556 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,5 @@
groupId=ru.tinkoff.kora
-koraVersion=1.2.0
+koraVersion=1.2.3
##### GRADLE #####
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 249e583..8bdaf60 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e1adfb4..2e11132 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index a69d9cb..adff685 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright © 2015-2021 the original authors.
+# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,11 @@ do
esac
done
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
+# This is normally unused
+# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -133,22 +132,29 @@ location of your Java installation."
fi
else
JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -165,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -193,16 +198,19 @@ if "$cygwin" || "$msys" ; then
done
fi
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
- -classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
diff --git a/gradlew.bat b/gradlew.bat
index f127cfd..c4bdd3a 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -26,6 +28,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -42,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -56,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/src/main/java/ru/tinkoff/kora/java/Application.java b/src/main/java/ru/tinkoff/kora/example/Application.java
similarity index 83%
rename from src/main/java/ru/tinkoff/kora/java/Application.java
rename to src/main/java/ru/tinkoff/kora/example/Application.java
index edabde2..1061d6b 100644
--- a/src/main/java/ru/tinkoff/kora/java/Application.java
+++ b/src/main/java/ru/tinkoff/kora/example/Application.java
@@ -1,16 +1,14 @@
-package ru.tinkoff.kora.java;
+package ru.tinkoff.kora.example;
import ru.tinkoff.kora.application.graph.KoraApplication;
import ru.tinkoff.kora.common.KoraApp;
import ru.tinkoff.kora.config.hocon.HoconConfigModule;
import ru.tinkoff.kora.http.server.undertow.UndertowModule;
import ru.tinkoff.kora.logging.logback.LogbackModule;
-import ru.tinkoff.kora.micrometer.module.MetricsModule;
@KoraApp
public interface Application extends
UndertowModule, // only private server for health & metrics
- MetricsModule,
HoconConfigModule,
LogbackModule {
diff --git a/src/main/java/ru/tinkoff/kora/java/SomeService.java b/src/main/java/ru/tinkoff/kora/example/SomeService.java
similarity index 77%
rename from src/main/java/ru/tinkoff/kora/java/SomeService.java
rename to src/main/java/ru/tinkoff/kora/example/SomeService.java
index 1706943..6f3c1d0 100644
--- a/src/main/java/ru/tinkoff/kora/java/SomeService.java
+++ b/src/main/java/ru/tinkoff/kora/example/SomeService.java
@@ -1,8 +1,9 @@
-package ru.tinkoff.kora.java;
+package ru.tinkoff.kora.example;
import ru.tinkoff.kora.common.Component;
import ru.tinkoff.kora.common.annotation.Root;
+//TODO remove this class
@Root
@Component
public final class SomeService {
diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf
index e330200..c8ea2aa 100644
--- a/src/main/resources/application.conf
+++ b/src/main/resources/application.conf
@@ -9,6 +9,14 @@ httpServer {
logging.level {
"root": "WARN"
+ "root": ${?LOGGING_LEVEL_ALL}
+ "root": ${?LOGGING_LEVEL_ROOT}
+
"ru.tinkoff.kora": "INFO"
- "ru.tinkoff.kora.java": "INFO"
+ "ru.tinkoff.kora": ${?LOGGING_LEVEL_ALL}
+ "ru.tinkoff.kora": ${?LOGGING_LEVEL_KORA}
+
+ "ru.tinkoff.kora.example": "INFO"
+ "ru.tinkoff.kora.example": ${?LOGGING_LEVEL_ALL}
+ "ru.tinkoff.kora.example": ${?LOGGING_LEVEL_APP}
}
diff --git a/src/test/java/ru/tinkoff/kora/java/AppContainer.java b/src/test/java/ru/tinkoff/kora/example/AppContainer.java
similarity index 94%
rename from src/test/java/ru/tinkoff/kora/java/AppContainer.java
rename to src/test/java/ru/tinkoff/kora/example/AppContainer.java
index 482f42a..bd2fefc 100644
--- a/src/test/java/ru/tinkoff/kora/java/AppContainer.java
+++ b/src/test/java/ru/tinkoff/kora/example/AppContainer.java
@@ -1,4 +1,4 @@
-package ru.tinkoff.kora.java;
+package ru.tinkoff.kora.example;
import java.net.URI;
import java.nio.file.Paths;
@@ -32,7 +32,7 @@ public static AppContainer build() {
protected void configure() {
super.configure();
withExposedPorts(8085);
- withStartupTimeout(Duration.ofSeconds(120));
+ withStartupTimeout(Duration.ofSeconds(10));
withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(AppContainer.class)));
waitingFor(Wait.forHttp("/system/readiness").forPort(8085).forStatusCode(200));
}
diff --git a/src/test/java/ru/tinkoff/kora/java/BlackBoxTests.java b/src/test/java/ru/tinkoff/kora/example/BlackBoxTests.java
similarity index 85%
rename from src/test/java/ru/tinkoff/kora/java/BlackBoxTests.java
rename to src/test/java/ru/tinkoff/kora/example/BlackBoxTests.java
index 02d7e38..5bc0401 100644
--- a/src/test/java/ru/tinkoff/kora/java/BlackBoxTests.java
+++ b/src/test/java/ru/tinkoff/kora/example/BlackBoxTests.java
@@ -1,4 +1,4 @@
-package ru.tinkoff.kora.java;
+package ru.tinkoff.kora.example;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
@@ -12,7 +12,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
-@Disabled("example of black box testing against default /metric endpoint")
+@Disabled("example of black box testing against default /system/readiness endpoint")
class BlackBoxTests {
private static final AppContainer container = AppContainer.build()
@@ -36,7 +36,7 @@ public static void cleanup() {
void serviceReady() throws Exception {
var request = HttpRequest.newBuilder()
.GET()
- .uri(container.getPrivateURI().resolve("/metrics"))
+ .uri(container.getPrivateURI().resolve("/system/readiness"))
.timeout(Duration.ofSeconds(1))
.build();
diff --git a/src/test/java/ru/tinkoff/kora/java/UnitTests.java b/src/test/java/ru/tinkoff/kora/example/UnitTests.java
similarity index 74%
rename from src/test/java/ru/tinkoff/kora/java/UnitTests.java
rename to src/test/java/ru/tinkoff/kora/example/UnitTests.java
index 7b0d428..e9e98a0 100644
--- a/src/test/java/ru/tinkoff/kora/java/UnitTests.java
+++ b/src/test/java/ru/tinkoff/kora/example/UnitTests.java
@@ -1,4 +1,4 @@
-package ru.tinkoff.kora.java;
+package ru.tinkoff.kora.example;
import org.junit.jupiter.api.Test;
import ru.tinkoff.kora.test.extension.junit5.KoraAppTest;
@@ -10,10 +10,10 @@
class UnitTests {
@TestComponent
- private SomeService someService;
+ private SomeService service;
@Test
void getSomeSuccess() {
- assertEquals("1", someService.getSome());
+ assertEquals("1", service.getSome());
}
}
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
index 7d30637..43db022 100644
--- a/src/test/resources/logback-test.xml
+++ b/src/test/resources/logback-test.xml
@@ -17,7 +17,7 @@
-
+