Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 15 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -29,14 +25,15 @@ configurations {
compileOnly.extendsFrom(koraBom)
implementation.extendsFrom(koraBom)
api.extendsFrom(koraBom)
testImplementation.extendsFrom(koraBom)
testAnnotationProcessor.extendsFrom(koraBom)
}

dependencies {
koraBom platform("ru.tinkoff.kora:kora-parent:$koraVersion")
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"

Expand All @@ -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([
Expand Down Expand Up @@ -75,8 +78,10 @@ test {
exceptionFormat("full")
}

exclude("**/\$*")

jacoco {
excludes += ["**/Application*"]
excludes += ["**/generated/**", "**/Application*", "**/\$*"]
}

reports {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
groupId=ru.tinkoff.kora
koraVersion=1.2.0
koraVersion=1.2.3


##### GRADLE #####
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
44 changes: 26 additions & 18 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.tinkoff.kora.java;
package ru.tinkoff.kora.example;

import java.net.URI;
import java.nio.file.Paths;
Expand Down Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,10 +10,10 @@
class UnitTests {

@TestComponent
private SomeService someService;
private SomeService service;

@Test
void getSomeSuccess() {
assertEquals("1", someService.getSome());
assertEquals("1", service.getSome());
}
}
2 changes: 1 addition & 1 deletion src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</root>

<logger level="INFO" name="ru.tinkoff.kora"/>
<logger level="DEBUG" name="ru.tinkoff.kora.java"/>
<logger level="DEBUG" name="ru.tinkoff.kora.example"/>

<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="DEBUG" name="io.goodforgod.testcontainers.extensions"/>
Expand Down
Loading