Skip to content

Commit

Permalink
[TH2-5179] migrated to gradle 8.7 and added toml to share dependency …
Browse files Browse the repository at this point in the history
…versions between projects (#25)

Co-authored-by: Oleg Smirnov <oleg.smirnov@exactprosystems.com>
  • Loading branch information
Nikita-Smirnov-Exactpro and OptimumCode authored Apr 8, 2024
1 parent ebeb69e commit 1bcab2c
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 59 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("application")
id("com.exactpro.th2.gradle.component")
alias(libs.plugins.th2.component)
}

configurations.all {
Expand 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")) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
39 changes: 19 additions & 20 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
Expand All @@ -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")
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions grpc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -10,7 +10,7 @@ configurations.all {
}

dependencies {
api("com.exactpro.th2:grpc-common:4.4.0-dev")
api(libs.th2.grpc.common)
}

th2Grpc {
Expand Down
32 changes: 16 additions & 16 deletions oracle/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down

0 comments on commit 1bcab2c

Please sign in to comment.