clean syntax
This commit is contained in:
@@ -41,7 +41,7 @@ tasks.test {
|
||||
useJUnit()
|
||||
useJUnitPlatform()
|
||||
systemProperty("junit.jupiter.execution.parallel.enabled", true)
|
||||
if (disableLint.toBoolean() == false) {
|
||||
if (!disableLint.toBoolean()) {
|
||||
finalizedBy(tasks.ktlintCheck)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
context: docker/postgresql
|
||||
restart: always
|
||||
ports:
|
||||
- 5555:5432
|
||||
- "5555:5432"
|
||||
environment:
|
||||
POSTGRES_DB: json_test
|
||||
POSTGRES_USER: test
|
||||
|
||||
@@ -21,7 +21,7 @@ class Function(
|
||||
|
||||
val queryMatch = functionRegex.find(script)
|
||||
if (queryMatch !== null) {
|
||||
val functionName = queryMatch.groups.get("name")?.value?.trim() ?: error("Function name not found")
|
||||
val functionName = queryMatch.groups["name"]?.value?.trim() ?: error("Function name not found")
|
||||
val functionParameters = queryMatch.groups["params"]?.value?.trim()
|
||||
this.returns = queryMatch.groups["return"]?.value?.trim() ?: ""
|
||||
|
||||
@@ -51,15 +51,12 @@ class Function(
|
||||
fun getDefinition(): String {
|
||||
return parameters
|
||||
.filter { it.direction == Parameter.Direction.IN }
|
||||
.joinToString(", ") { "${it.name} ${it.type}" }.let {
|
||||
"$name ($it)"
|
||||
}
|
||||
.joinToString(", ") { "${it.name} ${it.type}" }
|
||||
.let { "$name ($it)" }
|
||||
}
|
||||
|
||||
fun getParametersIndexedByName(): Map<String, Parameter> {
|
||||
return parameters.map {
|
||||
it.name to it
|
||||
}.toMap()
|
||||
return parameters.associateBy { it.name }
|
||||
}
|
||||
|
||||
infix fun `has same definition`(other: Function): Boolean {
|
||||
|
||||
@@ -6,5 +6,5 @@ import kotlin.properties.ReadOnlyProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
internal class LoggerDelegate<in R : Any> : ReadOnlyProperty<R, Logger> {
|
||||
override fun getValue(thisRef: R, property: KProperty<*>) = LoggerFactory.getLogger(thisRef.javaClass.packageName)
|
||||
override fun getValue(thisRef: R, property: KProperty<*>): Logger = LoggerFactory.getLogger(thisRef.javaClass.packageName)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import kotlin.streams.asSequence
|
||||
|
||||
fun URL.searchSqlFiles() = this.toURI().searchSqlFiles()
|
||||
|
||||
fun URI.searchSqlFiles() = sequence<Resource> {
|
||||
fun URI.searchSqlFiles() = sequence {
|
||||
val logger: Logger = LoggerFactory.getLogger("sqlFilesSearch")
|
||||
val uri: URI = this@searchSqlFiles
|
||||
logger.debug("""SQL files found in "${uri.toString().substringAfter('!')}" :""")
|
||||
|
||||
@@ -9,15 +9,15 @@ import fr.postgresjson.entity.Parameter
|
||||
import fr.postgresjson.entity.UuidEntity
|
||||
import fr.postgresjson.serializer.deserialize
|
||||
import fr.postgresjson.serializer.toTypeReference
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import java.util.UUID
|
||||
import kotlin.test.assertContains
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
class ConnectionTest : TestAbstract() {
|
||||
|
||||
Reference in New Issue
Block a user