Merge pull request #31 from flecomte/update

Update dependencies
This commit was merged in pull request #31.
This commit is contained in:
2022-10-14 22:53:26 +02:00
committed by GitHub
5 changed files with 29 additions and 31 deletions

3
.idea/kotlinc.xml generated
View File

@@ -3,4 +3,7 @@
<component name="Kotlin2JvmCompilerArguments"> <component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="11" /> <option name="jvmTarget" value="11" />
</component> </component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.7.20" />
</component>
</project> </project>

View File

@@ -6,12 +6,12 @@ plugins {
jacoco jacoco
id("maven-publish") id("maven-publish")
kotlin("jvm") version "1.5.10" kotlin("jvm") version "1.7.20"
id("org.jlleitschuh.gradle.ktlint") version "10.0.0" id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("org.owasp.dependencycheck") version "6.1.1" id("org.owasp.dependencycheck") version "7.2.0"
id("fr.coppernic.versioning") version "3.2.1" id("fr.coppernic.versioning") version "3.2.1"
id("com.avast.gradle.docker-compose") version "0.14.4" id("com.avast.gradle.docker-compose") version "0.16.9"
id("org.sonarqube") version "+" id("org.sonarqube") version "+"
} }
@@ -20,14 +20,11 @@ version = versioning.info.tag
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
} }
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions { kotlinOptions {
jvmTarget = "11" jvmTarget = "11"
sourceCompatibility = "11"
targetCompatibility = "11"
} }
} }
@@ -65,20 +62,19 @@ tasks.publishToMavenLocal {
} }
dependencies { dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.20") implementation("org.jetbrains.kotlin:kotlin-reflect:1.7.20")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1") implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0-rc1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.1") implementation("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.14.0-rc1")
implementation("com.github.jasync-sql:jasync-postgresql:1.1.7") implementation("com.github.jasync-sql:jasync-postgresql:2.1.7")
implementation("org.slf4j:slf4j-api:1.7.30") implementation("org.slf4j:slf4j-api:2.0.3")
implementation("com.avast.gradle:gradle-docker-compose-plugin:0.14.0")
testImplementation("ch.qos.logback:logback-classic:1.2.3") testImplementation("ch.qos.logback:logback-classic:1.4.3")
testImplementation("ch.qos.logback:logback-core:1.2.3") testImplementation("ch.qos.logback:logback-core:1.4.3")
testImplementation("io.mockk:mockk:1.10.6") testImplementation("io.mockk:mockk:1.13.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.1") testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.20") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.7.20")
testImplementation("org.amshove.kluent:kluent:1.65") testImplementation("org.amshove.kluent:kluent:1.68")
} }
val sourcesJar by tasks.creating(Jar::class) { val sourcesJar by tasks.creating(Jar::class) {
@@ -88,9 +84,9 @@ val sourcesJar by tasks.creating(Jar::class) {
apply(plugin = "docker-compose") apply(plugin = "docker-compose")
dockerCompose { dockerCompose {
projectName = "postgres-json" setProjectName("postgres-json")
useComposeFiles = listOf("docker-compose.yml") setProperty("useComposeFiles", listOf("docker-compose.yml"))
stopContainers = !containerAlwaysOn.toBoolean() setProperty("stopContainers", !containerAlwaysOn.toBoolean())
isRequiredBy(project.tasks.test) isRequiredBy(project.tasks.test)
} }

View File

@@ -1,5 +1,4 @@
kotlin.code.style=official kotlin.code.style=official
kotlin_version=1.5.10
systemProp.sonar.host.url=https://sonarcloud.io systemProp.sonar.host.url=https://sonarcloud.io
systemProp.sonar.projectKey=postgres-json systemProp.sonar.projectKey=postgres-json
systemProp.sonar.projectName=PostgresJson systemProp.sonar.projectName=PostgresJson

View File

@@ -106,7 +106,7 @@ class Connection(
val result = exec(sql, values) val result = exec(sql, values)
val json = result.rows[0].getString(0) val json = result.rows[0].getString(0)
return if (json === null) { return if (json === null) {
listOf<EntityI>() as List<R> emptyList()
} else { } else {
serializer.deserializeList(json, typeReference) serializer.deserializeList(json, typeReference)
}.also { }.also {
@@ -160,7 +160,7 @@ class Connection(
} }
val json = firstLine.getString(0) val json = firstLine.getString(0)
val entities = if (json == null) { val entities = if (json == null) {
listOf<EntityI>() as List<R> emptyList()
} else { } else {
serializer.deserializeList(json, typeReference) serializer.deserializeList(json, typeReference)
} }
@@ -220,7 +220,7 @@ class Connection(
} }
private fun <T> replaceArgs(sql: String, values: Map<String, Any?>, block: ParametersQuery.() -> T): T { private fun <T> replaceArgs(sql: String, values: Map<String, Any?>, block: ParametersQuery.() -> T): T {
val paramRegex = "(?<!:):([a-zA-Z0-9_-]+)".toRegex(RegexOption.IGNORE_CASE) val paramRegex = "(?<!:):([a-z0-9_-]+)".toRegex(RegexOption.IGNORE_CASE)
val orderedArgs = paramRegex.findAll(sql).map { match -> val orderedArgs = paramRegex.findAll(sql).map { match ->
val name = match.groups[1]!!.value val name = match.groups[1]!!.value
values[name] ?: values[name.trimStart('_')] ?: queryError("""Parameter "$name" missing""", sql, values) values[name] ?: values[name.trimStart('_')] ?: queryError("""Parameter "$name" missing""", sql, values)
@@ -230,7 +230,7 @@ class Connection(
} }
private fun replaceNamedArgByQuestionMark(sql: String): String = private fun replaceNamedArgByQuestionMark(sql: String): String =
"(?<!:):([a-zA-Z0-9_-]+)" "(?<!:):([a-z0-9_-]+)"
.toRegex(RegexOption.IGNORE_CASE) .toRegex(RegexOption.IGNORE_CASE)
.replace(sql, "?") .replace(sql, "?")
@@ -328,7 +328,7 @@ class Connection(
""" """
|$msg |$msg
| |
|${parameters.joinToString(", ") { it.toString() }.prependIndent(" > ") ?: ""} |${parameters.joinToString(", ") { it.toString() }.prependIndent(" > ")}
|${sql.prependIndent(" > ")} |${sql.prependIndent(" > ")}
|${result?.let { "-----" }?.prependIndent(" > ") ?: ""} |${result?.let { "-----" }?.prependIndent(" > ") ?: ""}
|${result?.columnNames()?.joinToString(" | ")?.prependIndent(" > ") ?: ""} |${result?.columnNames()?.joinToString(" | ")?.prependIndent(" > ") ?: ""}
@@ -345,7 +345,7 @@ class Connection(
""" """
|$msg |$msg
| |
|${parameters.map { ":" + it.key + " = " + it.value }.joinToString(", ").prependIndent(" > ") ?: ""} |${parameters.map { ":" + it.key + " = " + it.value }.joinToString(", ").prependIndent(" > ")}
|${sql.prependIndent(" > ")} |${sql.prependIndent(" > ")}
|${result?.let { "-----" }?.prependIndent(" > ") ?: ""} |${result?.let { "-----" }?.prependIndent(" > ") ?: ""}
|${result?.columnNames()?.joinToString(" | ")?.prependIndent(" > ") ?: ""} |${result?.columnNames()?.joinToString(" | ")?.prependIndent(" > ") ?: ""}

View File

@@ -4,9 +4,9 @@ import fr.postgresjson.connexion.Requester
import fr.postgresjson.connexion.selectOne import fr.postgresjson.connexion.selectOne
import fr.postgresjson.migration.Migration import fr.postgresjson.migration.Migration
import fr.postgresjson.migration.Migrations import fr.postgresjson.migration.Migrations
import org.amshove.kluent.invoking
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should contain` import org.amshove.kluent.`should contain`
import org.amshove.kluent.invoking
import org.amshove.kluent.shouldThrow import org.amshove.kluent.shouldThrow
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test