diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2e60847..70d97b6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("application") - id("com.exactpro.th2.gradle.component") + alias(libs.plugins.th2.component) } configurations.all { @@ -12,19 +12,19 @@ dependencies { implementation(project(":read-db-core")) //region postgresql - runtimeOnly("org.postgresql:postgresql:42.7.3") { + runtimeOnly(libs.postgresql) { because("prostresql support") } //endregion //region mysql - runtimeOnly("com.mysql:mysql-connector-j:8.3.0") { + runtimeOnly(libs.mysql.connector.j) { because("mysql support") } //endregion //region oracle - runtimeOnly("com.oracle.database.jdbc:ojdbc11:23.3.0.23.09") { + runtimeOnly(libs.ojdbc11) { because("oracle support") } runtimeOnly(project(":read-db-oracle-extension")) { @@ -33,7 +33,7 @@ dependencies { //endregion //region mssql - runtimeOnly("com.microsoft.sqlserver:mssql-jdbc:12.4.0.jre11") { + runtimeOnly(libs.mssql.jdbc) { because("mssql support") } //endregion diff --git a/app/gradle.properties b/app/gradle.properties index b83022a..dc88f59 100644 --- a/app/gradle.properties +++ b/app/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -release_version=0.9.0 +release_version=0.9.1 description=read-db component for extracting data from databases using JDBC technology \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 8f46185..9dca229 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ plugins { - id("com.exactpro.th2.gradle.base") version "0.0.4" - id("com.exactpro.th2.gradle.publish") version "0.0.4" + alias(libs.plugins.th2.base) + alias(libs.plugins.th2.publish) - kotlin("jvm") version "1.8.22" apply false - kotlin("kapt") version "1.8.22" apply false - id("com.exactpro.th2.gradle.grpc") version "0.0.4" apply false - id("com.exactpro.th2.gradle.component") version "0.0.4" apply false + alias(libs.plugins.kotlin) apply false + alias(libs.plugins.kapt) apply false + alias(libs.plugins.th2.grpc) apply false + alias(libs.plugins.th2.component) apply false } allprojects { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index ae69e58..022b943 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,11 +1,9 @@ plugins { - kotlin("jvm") - id("java-library") - id("maven-publish") + alias(libs.plugins.kotlin) + `java-library` + `maven-publish` } -val coroutinesVersion by extra("1.7.3") - kotlin { jvmToolchain(11) } @@ -18,43 +16,44 @@ configurations.all { dependencies { implementation(project(":grpc-read-db")) - implementation("com.exactpro.th2:common:5.10.0-dev") - implementation("com.exactpro.th2:common-utils:2.2.2-dev") - implementation("com.exactpro.th2:lw-data-provider-utils:0.0.1-dev") + implementation(libs.th2.common) + implementation(libs.th2.common.utils) + implementation(libs.th2.lw.data.provider.utils) implementation("org.slf4j:slf4j-api") - implementation("org.apache.commons:commons-dbcp2:2.9.0") { + implementation(libs.commons.dbcp2) { because("connection pool") } implementation("org.apache.commons:commons-text") - implementation("com.opencsv:opencsv:5.9") { + implementation(libs.opencsv) { because("publishes raw messages in csv format") } - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - implementation("io.github.microutils:kotlin-logging:3.0.5") + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlin.logging) + implementation(libs.kotlin.logging) implementation("com.fasterxml.jackson.core:jackson-databind") - testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") + testImplementation(libs.junit.jupiter) testImplementation("org.jetbrains.kotlin:kotlin-test-junit") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0") - testImplementation("io.strikt:strikt-core:0.34.1") + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockito.kotlin) + testImplementation(libs.strikt.core) - testImplementation(platform("org.testcontainers:testcontainers-bom:1.19.7")) + testImplementation(platform(libs.testcontainers.bom)) testImplementation("org.testcontainers:testcontainers") testImplementation("org.testcontainers:mysql") testImplementation("org.testcontainers:oracle-xe") testImplementation("io.grpc:grpc-testing") testImplementation("io.grpc:grpc-inprocess") - testImplementation("com.exactpro.th2:junit-jupiter-integration:0.0.1") + testImplementation(libs.th2.junit.jupiter.integration) - testRuntimeOnly("com.mysql:mysql-connector-j:8.3.0") { + testRuntimeOnly(libs.mysql.connector.j) { because("mysql support") } - testRuntimeOnly("com.oracle.database.jdbc:ojdbc11:23.3.0.23.09") { + testRuntimeOnly(libs.ojdbc11) { because("oracle support") } } diff --git a/core/gradle.properties b/core/gradle.properties index c86019c..f807824 100644 --- a/core/gradle.properties +++ b/core/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -release_version=0.9.0 +release_version=0.9.1 description=core part of read db to create an application with required JDBC drivers in the classpath \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a4006de --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,42 @@ +[versions] +kotlin = "1.8.22" +kotlinx-coroutines = "1.7.3" +auto-service = "1.1.1" +th2-plugin = "0.0.4" + +[libraries] +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } + +postgresql = { group = "org.postgresql", name = "postgresql", version = "42.7.3" } +mysql-connector-j = { group = "com.mysql", name = "mysql-connector-j", version = "8.3.0" } +ojdbc11 = { group = "com.oracle.database.jdbc", name = "ojdbc11", version = "23.3.0.23.09" } +mssql-jdbc = { group = "com.microsoft.sqlserver", name = "mssql-jdbc", version = "12.4.0.jre11" } + +th2-common-utils = { group = "com.exactpro.th2", name = "common-utils", version = "2.2.2-dev" } +th2-common = { group = "com.exactpro.th2", name = "common", version = "5.10.0-dev" } +th2-grpc-common = { group = "com.exactpro.th2", name = "grpc-common", version = "4.4.0-dev" } +th2-lw-data-provider-utils = { group = "com.exactpro.th2", name = "lw-data-provider-utils", version = "0.0.1-dev" } +th2-junit-jupiter-integration = { group = "com.exactpro.th2", name = "junit-jupiter-integration", version = "0.0.1" } + +auto-service-annotations = { group = "com.google.auto.service", name = "auto-service-annotations", version.ref = "auto-service" } +auto-service = { group = "com.google.auto.service", name = "auto-service", version.ref = "auto-service" } + +opencsv = { group = "com.opencsv", name = "opencsv", version = "5.9" } +kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging", version = "3.0.5" } +strikt-core = { group = "io.strikt", name = "strikt-core", version = "0.34.1" } +commons-dbcp2 = { group = "org.apache.commons", name = "commons-dbcp2", version = "2.9.0" } + +testcontainers-bom = { group = "org.testcontainers", name = "testcontainers-bom", version = "1.19.7" } + +awaitility = { group = "org.awaitility", name = "awaitility", version = "4.2.1" } +junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.10.0" } +mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version = "5.1.0" } + +[plugins] +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +th2-base = { id = "com.exactpro.th2.gradle.base", version.ref = "th2-plugin" } +th2-publish = { id = "com.exactpro.th2.gradle.publish", version.ref = "th2-plugin" } +th2-grpc = { id = "com.exactpro.th2.gradle.grpc", version.ref = "th2-plugin" } +th2-component = { id = "com.exactpro.th2.gradle.component", version.ref = "th2-plugin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb70..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/grpc/build.gradle.kts b/grpc/build.gradle.kts index 9a762ac..6e9b7bd 100644 --- a/grpc/build.gradle.kts +++ b/grpc/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("java-library") - id("maven-publish") - id("com.exactpro.th2.gradle.grpc") + `java-library` + `maven-publish` + alias(libs.plugins.th2.grpc) } configurations.all { @@ -10,7 +10,7 @@ configurations.all { } dependencies { - api("com.exactpro.th2:grpc-common:4.4.0-dev") + api(libs.th2.grpc.common) } th2Grpc { diff --git a/oracle/build.gradle.kts b/oracle/build.gradle.kts index 56180c9..229b699 100644 --- a/oracle/build.gradle.kts +++ b/oracle/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - kotlin("jvm") - kotlin("kapt") - id("java-library") - id("maven-publish") + alias(libs.plugins.kotlin) + alias(libs.plugins.kapt) + `java-library` + `maven-publish` } kotlin { @@ -17,33 +17,33 @@ configurations.all { dependencies { implementation(project(":read-db-core")) - compileOnly("com.oracle.database.jdbc:ojdbc11:23.3.0.23.09") { + compileOnly(libs.ojdbc11) { because("oracle support") } // Auto service - compileOnly("com.google.auto.service:auto-service-annotations:1.1.1") - kapt("com.google.auto.service:auto-service:1.1.1") + compileOnly(libs.auto.service.annotations) + kapt(libs.auto.service) - testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") + testImplementation(libs.junit.jupiter) testImplementation("org.jetbrains.kotlin:kotlin-test-junit") - testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0") + testImplementation(libs.mockito.kotlin) - testImplementation(platform("org.testcontainers:testcontainers-bom:1.19.7")) + testImplementation(platform(libs.testcontainers.bom)) testImplementation("org.testcontainers:testcontainers") testImplementation("org.testcontainers:oracle-xe") testImplementation("io.grpc:grpc-testing") testImplementation("io.grpc:grpc-inprocess") - testImplementation("com.exactpro.th2:junit-jupiter-integration:0.0.1") - testImplementation("org.awaitility:awaitility:4.2.1") + testImplementation(libs.th2.junit.jupiter.integration) + testImplementation(libs.awaitility) testImplementation(project(":grpc-read-db")) - testImplementation("io.github.microutils:kotlin-logging:3.0.5") - testImplementation("com.exactpro.th2:common-utils:2.2.2-dev") - testImplementation("com.exactpro.th2:lw-data-provider-utils:0.0.1-dev") + testImplementation(libs.kotlin.logging) + testImplementation(libs.th2.common.utils) + testImplementation(libs.th2.lw.data.provider.utils) - testImplementation("com.oracle.database.jdbc:ojdbc11:23.3.0.23.09") { + testImplementation(libs.ojdbc11) { because("oracle support") } } diff --git a/oracle/src/test/kotlin/com/exactpro/th2/read/db/app/FullReadDbOracleIntegrationTest.kt b/oracle/src/test/kotlin/com/exactpro/th2/read/db/app/FullReadDbOracleIntegrationTest.kt index eef3e73..a67e9cf 100644 --- a/oracle/src/test/kotlin/com/exactpro/th2/read/db/app/FullReadDbOracleIntegrationTest.kt +++ b/oracle/src/test/kotlin/com/exactpro/th2/read/db/app/FullReadDbOracleIntegrationTest.kt @@ -161,20 +161,24 @@ internal class FullReadDbOracleIntegrationTest { } }, MESSAGE_OUT_PIN) - - + val now = Instant.now() val readDb = test.grpcRouter.getService(ReadDbService::class.java) ResourceRegister().use { register -> setupApp(factory, register::add) - - execute { insertData(listOf(Record(1, Instant.now(), Instant.now(), Instant.now(), Instant.now()))) } + execute { + val date = now.minusSeconds(1) + insertData(listOf(Record(1, date, date, date, date))) + } readDb.startPulling(dbPullRequest) await("first message").atMost(5, TimeUnit.SECONDS).until { publishedMessages.size == 1 } } ResourceRegister().use { register -> setupApp(factory, register::add) - execute { insertData(listOf(Record(2, Instant.now(), Instant.now(), Instant.now(), Instant.now()))) } + execute { + val date = now.plusSeconds(1) + insertData(listOf(Record(2, date, date, date, date))) + } readDb.startPulling(dbPullRequest) await("second message").atMost(5, TimeUnit.SECONDS).until { publishedMessages.size == 2 } }