Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lehvolk committed Oct 10, 2023
1 parent 78727c5 commit dff5e16
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ object Versions {
const val dokka = "1.7.20"
const val gradle_download = "5.3.0"
const val gradle_versions = "0.47.0"
const val hikaricp = "5.0.1"
const val guava = "31.1-jre"
const val javax_activation = "1.1"
const val javax_mail = "1.4.7"
Expand Down Expand Up @@ -158,6 +159,13 @@ object Libs {
version = Versions.kotlinx_cli
)

// https://github.com/brettwooldridge/HikariCP
val hikaricp = dep(
group = "com.zaxxer",
name = "HikariCP",
version = Versions.hikaricp
)

// https://github.com/xerial/sqlite-jdbc
val sqlite = dep(
group = "org.xerial",
Expand Down
1 change: 1 addition & 0 deletions jacodb-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
testImplementation(Libs.javax_mail)
testImplementation(Libs.joda_time)
testImplementation(Libs.slf4j_simple)
testImplementation(Libs.hikaricp)

testFixturesImplementation(project(":jacodb-api"))
testFixturesImplementation(kotlin("reflect"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import org.jacodb.impl.features.Usages
import org.jacodb.impl.storage.jooq.tables.references.APPLICATIONMETADATA
import org.jacodb.impl.storage.jooq.tables.references.REFACTORINGS
import org.jooq.DSLContext
import kotlin.time.ExperimentalTime
import kotlin.time.measureTime

abstract class JcRefactoring {

Expand All @@ -40,6 +42,7 @@ class JcRefactoringChain(private val chain: List<JcRefactoring>) {

private val applied = hashSetOf<String>()

@OptIn(ExperimentalTime::class)
fun execute(jooq: DSLContext) {
try {
applied.addAll(jooq.select(REFACTORINGS.NAME).from(REFACTORINGS).fetchArray(REFACTORINGS.NAME))
Expand All @@ -50,8 +53,11 @@ class JcRefactoringChain(private val chain: List<JcRefactoring>) {
chain.forEach { ref ->
jooq.connection {
if (!applied.contains(ref.name)) {
ref.run(jooq)
jooq.insertInto(REFACTORINGS).set(REFACTORINGS.NAME, ref.name).execute()
val time = measureTime {
ref.run(jooq)
jooq.insertInto(REFACTORINGS).set(REFACTORINGS.NAME, ref.name).execute()
}
logger.info("Refactoring ${ref.name} took $time msc")
}
}
}
Expand Down

0 comments on commit dff5e16

Please sign in to comment.