libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 59e7c11203557fa5da4a5818d259ae6a88a82019
parent 1cf29ab00155e2e16a593a6f4b43016fbccb1883
Author: Antoine A <>
Date:   Wed, 18 Sep 2024 12:26:05 +0200

common: update dependencies

Diffstat:
Mbank/build.gradle | 2++
Mbank/src/main/kotlin/tech/libeufin/bank/Main.kt | 1+
Mbank/src/main/kotlin/tech/libeufin/bank/cli/BenchPwh.kt | 5++++-
Mbank/src/main/kotlin/tech/libeufin/bank/cli/ChangePw.kt | 5++++-
Mbank/src/main/kotlin/tech/libeufin/bank/cli/CreateAccount.kt | 8++++----
Mbank/src/main/kotlin/tech/libeufin/bank/cli/DbInit.kt | 5++++-
Mbank/src/main/kotlin/tech/libeufin/bank/cli/EditAccount.kt | 8++++----
Mbank/src/main/kotlin/tech/libeufin/bank/cli/Gc.kt | 8++++----
Mbank/src/main/kotlin/tech/libeufin/bank/cli/Serve.kt | 5++++-
Mbuild.gradle | 6+++---
Mcommon/build.gradle | 3++-
Mcommon/src/main/kotlin/Cli.kt | 17+++++++++++++----
Mnexus/build.gradle | 2++
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 1+
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/DbInit.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsFetch.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSetup.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSubmit.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/InitiatePayment.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/Serve.kt | 5++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt | 25+++++++++++++++++++------
Mtestbench/src/main/kotlin/Main.kt | 6+++++-
22 files changed, 100 insertions(+), 37 deletions(-)

diff --git a/bank/build.gradle b/bank/build.gradle @@ -50,6 +50,8 @@ shadowJar { exclude(dependency("io.ktor:ktor-serialization-kotlinx-json:.*")) // Postgres unix socket driver exclude(dependency("com.kohlschutter.junixsocket:junixsocket-core:.*")) + // CLI + exclude(dependency("com.github.ajalt.mordant:mordant:.*")) // Logging exclude(dependency("ch.qos.logback:logback-classic:.*")) } diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Main.kt b/bank/src/main/kotlin/tech/libeufin/bank/Main.kt @@ -29,6 +29,7 @@ import tech.libeufin.bank.api.* import tech.libeufin.bank.cli.LibeufinBank import tech.libeufin.bank.db.Database import tech.libeufin.common.api.talerApi +import com.github.ajalt.clikt.core.main val logger: Logger = LoggerFactory.getLogger("libeufin-bank") diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/BenchPwh.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/BenchPwh.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import tech.libeufin.bank.bankConfig import tech.libeufin.bank.logger @@ -27,7 +28,9 @@ import tech.libeufin.common.CommonOption import tech.libeufin.common.cliCmd import tech.libeufin.common.crypto.PwCrypto -class BenchPwh : CliktCommand("Benchmark password hashin algorithm and configuration", name = "bench-pwh") { +class BenchPwh : CliktCommand("bench-pwh") { + override fun help(context: Context) = "Benchmark password hashin algorithm and configuration" + private val common by CommonOption() override fun run() = cliCmd(logger, common.log) { diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/ChangePw.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/ChangePw.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.groups.provideDelegate import tech.libeufin.bank.bankConfig @@ -29,7 +30,9 @@ import tech.libeufin.bank.withDb import tech.libeufin.common.CommonOption import tech.libeufin.common.cliCmd -class ChangePw : CliktCommand("Change account password", name = "passwd") { +class ChangePw : CliktCommand("passwd") { + override fun help(context: Context) = "Change account password" + private val common by CommonOption() private val username by argument("username", help = "Account username") private val password by argument( diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/CreateAccount.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/CreateAccount.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.convert import com.github.ajalt.clikt.parameters.arguments.optional @@ -69,10 +70,9 @@ class CreateAccountOption: OptionGroup() { } -class CreateAccount : CliktCommand( - "Create an account, returning the payto://-URI associated with it", - name = "create-account" -) { +class CreateAccount : CliktCommand("create-account") { + override fun help(context: Context) = "Create an account, returning the payto://-URI associated with it" + private val common by CommonOption() private val json by argument().convert { Json.decodeFromString<RegisterAccountRequest>(it) }.optional() private val options by CreateAccountOption().cooccurring() diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/DbInit.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/DbInit.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option @@ -33,7 +34,9 @@ import tech.libeufin.common.cliCmd import tech.libeufin.common.db.dbInit import tech.libeufin.common.db.pgDataSource -class DbInit : CliktCommand("Initialize the libeufin-bank database", name = "dbinit") { +class DbInit : CliktCommand("dbinit") { + override fun help(context: Context) = "Initialize the libeufin-bank database" + private val common by CommonOption() private val reset by option( "--reset", "-r", diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/EditAccount.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/EditAccount.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.groups.provideDelegate import com.github.ajalt.clikt.parameters.options.convert @@ -31,10 +32,9 @@ import tech.libeufin.bank.db.AccountDAO.AccountPatchResult import tech.libeufin.common.* -class EditAccount : CliktCommand( - "Edit an existing account", - name = "edit-account" -) { +class EditAccount : CliktCommand("edit-account") { + override fun help(context: Context) = "Edit an existing account" + private val common by CommonOption() private val username: String by argument( "username", diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/Gc.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/Gc.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import tech.libeufin.bank.bankConfig import tech.libeufin.bank.logger @@ -28,10 +29,9 @@ import tech.libeufin.common.CommonOption import tech.libeufin.common.cliCmd import java.time.Instant -class GC : CliktCommand( - "Run garbage collection: abort expired operations and clean expired data", - name = "gc" -) { +class GC : CliktCommand("gc") { + override fun help(context: Context) = "Run garbage collection: abort expired operations and clean expired data" + private val common by CommonOption() override fun run() = cliCmd(logger, common.log) { diff --git a/bank/src/main/kotlin/tech/libeufin/bank/cli/Serve.kt b/bank/src/main/kotlin/tech/libeufin/bank/cli/Serve.kt @@ -20,6 +20,7 @@ package tech.libeufin.bank.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import tech.libeufin.bank.bankConfig import tech.libeufin.bank.corebankWebApp @@ -32,7 +33,9 @@ import kotlin.io.path.Path import kotlin.io.path.exists import kotlin.io.path.readText -class Serve: CliktCommand("Run libeufin-bank HTTP server", name = "serve") { +class Serve: CliktCommand("serve") { + override fun help(context: Context) = "Run libeufin-bank HTTP server" + private val common by CommonOption() override fun run() = cliCmd(logger, common.log) { diff --git a/build.gradle b/build.gradle @@ -21,11 +21,11 @@ allprojects { ext { set("kotlin_version", "2.0.20") set("ktor_version", "2.3.12") - set("clikt_version", "4.4.0") - set("coroutines_version", "1.8.1") + set("clikt_version", "5.0.0") + set("coroutines_version", "1.9.0") set("postgres_version", "42.7.3") set("junixsocket_version", "2.10.0") - set("shadow_version", "8.3.0") + set("shadow_version", "8.3.1") } repositories { diff --git a/common/build.gradle b/common/build.gradle @@ -16,7 +16,8 @@ compileTestKotlin.kotlinOptions.jvmTarget = "17" sourceSets.main.java.srcDirs = ["src/main/kotlin"] dependencies { - implementation("ch.qos.logback:logback-classic:1.5.6") + implementation("ch.qos.logback:logback-classic:1.5.8") + implementation("org.slf4j:slf4j-api:2.0.16") // Crypto implementation("org.bouncycastle:bcprov-jdk18on:1.78.1") implementation("org.bouncycastle:bcpkix-jdk18on:1.78.1") diff --git a/common/src/main/kotlin/Cli.kt b/common/src/main/kotlin/Cli.kt @@ -20,6 +20,7 @@ package tech.libeufin.common import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.ProgramResult import com.github.ajalt.clikt.core.subcommands import com.github.ajalt.clikt.parameters.arguments.argument @@ -75,15 +76,19 @@ class CommonOption: OptionGroup() { ).enum<Level>().default(Level.INFO) } -class CliConfigCmd(configSource: ConfigSource) : CliktCommand("Inspect or change the configuration", name = "config") { +class CliConfigCmd(configSource: ConfigSource) : CliktCommand("config") { init { subcommands(CliConfigDump(configSource), CliConfigPathsub(configSource), CliConfigGet(configSource)) } + override fun help(context: Context) = "Inspect or change the configuration" + override fun run() = Unit } -private class CliConfigGet(private val configSource: ConfigSource) : CliktCommand("Lookup config value", name = "get") { +private class CliConfigGet(private val configSource: ConfigSource) : CliktCommand("get") { + override fun help(context: Context) = "Lookup config value" + private val common by CommonOption() private val isPath by option( "--filename", "-f", @@ -105,7 +110,9 @@ private class CliConfigGet(private val configSource: ConfigSource) : CliktComman -private class CliConfigPathsub(private val configSource: ConfigSource) : CliktCommand("Substitute variables in a path", name = "pathsub") { +private class CliConfigPathsub(private val configSource: ConfigSource) : CliktCommand("pathsub") { + override fun help(context: Context) = "Substitute variables in a path" + private val common by CommonOption() private val pathExpr by argument() @@ -115,7 +122,9 @@ private class CliConfigPathsub(private val configSource: ConfigSource) : CliktCo } } -private class CliConfigDump(private val configSource: ConfigSource) : CliktCommand("Dump the configuration", name = "dump") { +private class CliConfigDump(private val configSource: ConfigSource) : CliktCommand("dump") { + override fun help(context: Context) = "Dump the configuration" + private val common by CommonOption() override fun run() = cliCmd(logger, common.log) { diff --git a/nexus/build.gradle b/nexus/build.gradle @@ -63,5 +63,7 @@ shadowJar { exclude(dependency("io.ktor:ktor-client-cio:.*")) // Crypto exclude(dependency("org.bouncycastle:.*")) + // CLI + exclude(dependency("com.github.ajalt.mordant:mordant:.*")) } } \ No newline at end of file diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -33,6 +33,7 @@ import tech.libeufin.nexus.api.revenueApi import tech.libeufin.nexus.api.wireGatewayApi import tech.libeufin.nexus.cli.LibeufinNexus import tech.libeufin.nexus.db.Database +import com.github.ajalt.clikt.core.main internal val logger: Logger = LoggerFactory.getLogger("libeufin-nexus") diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/DbInit.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/DbInit.kt @@ -19,6 +19,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option @@ -29,7 +30,9 @@ import tech.libeufin.common.db.pgDataSource import tech.libeufin.nexus.dbConfig import tech.libeufin.nexus.logger -class DbInit : CliktCommand("Initialize the libeufin-nexus database", name = "dbinit") { +class DbInit : CliktCommand("dbinit") { + override fun help(context: Context) = "Initialize the libeufin-nexus database" + private val common by CommonOption() private val reset by option( "--reset", "-r", diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsFetch.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsFetch.kt @@ -20,6 +20,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.ProgramResult import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.multiple @@ -291,7 +292,9 @@ private suspend fun fetchEbicsDocuments( } } -class EbicsFetch: CliktCommand("Downloads and parse EBICS files from the bank and register them into the database") { +class EbicsFetch: CliktCommand() { + override fun help(context: Context) = "Downloads and parse EBICS files from the bank and register them into the database" + private val common by CommonOption() private val transient by transientOption() private val documents: Set<OrderDoc> by argument( diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSetup.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSetup.kt @@ -20,6 +20,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option @@ -144,7 +145,9 @@ private fun makePdf(privs: ClientPrivateKeysFile, cfg: NexusEbicsConfig) { /** * CLI class implementing the "ebics-setup" subcommand. */ -class EbicsSetup: CliktCommand("Set up the EBICS subscriber") { +class EbicsSetup: CliktCommand() { + override fun help(context: Context) = "Set up the EBICS subscriber" + private val common by CommonOption() private val forceKeysResubmission by option( help = "Resubmits all the keys to the bank" diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSubmit.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsSubmit.kt @@ -20,6 +20,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.groups.provideDelegate import kotlinx.coroutines.delay import tech.libeufin.common.* @@ -96,7 +97,9 @@ private suspend fun submitBatch(client: EbicsClient) { } } -class EbicsSubmit : CliktCommand("Submits pending initiated payments found in the database") { +class EbicsSubmit : CliktCommand() { + override fun help(context: Context) = "Submits pending initiated payments found in the database" + private val common by CommonOption() private val transient by transientOption() private val ebicsLog by ebicsLogOption() diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/InitiatePayment.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/InitiatePayment.kt @@ -19,6 +19,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.convert import com.github.ajalt.clikt.parameters.groups.provideDelegate @@ -32,7 +33,9 @@ import tech.libeufin.nexus.nexusConfig import tech.libeufin.nexus.withDb import java.time.Instant -class InitiatePayment: CliktCommand("Initiate an outgoing payment") { +class InitiatePayment: CliktCommand() { + override fun help(context: Context) = "Initiate an outgoing payment" + private val common by CommonOption() private val amount by option( "--amount", diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Serve.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Serve.kt @@ -20,6 +20,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.ProgramResult import com.github.ajalt.clikt.parameters.groups.provideDelegate import com.github.ajalt.clikt.parameters.options.flag @@ -33,7 +34,9 @@ import tech.libeufin.nexus.nexusConfig import tech.libeufin.nexus.withDb -class Serve : CliktCommand("Run libeufin-nexus HTTP server", name = "serve") { +class Serve : CliktCommand("serve") { + override fun help(context: Context) = "Run libeufin-nexus HTTP server" + private val common by CommonOption() private val check by option( help = "Check whether an API is in use (if it's useful to start the HTTP server). Exit with 0 if at least one API is enabled, otherwise 1" diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt @@ -20,6 +20,7 @@ package tech.libeufin.nexus.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.subcommands import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.convert @@ -35,7 +36,9 @@ import tech.libeufin.nexus.ebics.* import tech.libeufin.nexus.iso20022.* import java.time.Instant -class Wss: CliktCommand("Listen to EBICS instant notification over websocket") { +class Wss: CliktCommand() { + override fun help(context: Context) = "Listen to EBICS instant notification over websocket" + private val common by CommonOption() private val ebicsLog by ebicsLogOption() @@ -63,7 +66,9 @@ class Wss: CliktCommand("Listen to EBICS instant notification over websocket") { } } -class FakeIncoming: CliktCommand("Genere a fake incoming payment") { +class FakeIncoming: CliktCommand() { + override fun help(context: Context) = "Genere a fake incoming payment" + private val common by CommonOption() private val amount by option( "--amount", @@ -100,7 +105,9 @@ class FakeIncoming: CliktCommand("Genere a fake incoming payment") { } } -class TxCheck: CliktCommand("Check transaction semantic") { +class TxCheck: CliktCommand() { + override fun help(context: Context) = "Check transaction semantic" + private val common by CommonOption() override fun run() = cliCmd(logger, common.log) { @@ -126,7 +133,9 @@ enum class ListKind { } } -class EbicsDownload: CliktCommand("Perform EBICS requests", name = "ebics-btd") { +class EbicsDownload: CliktCommand("ebics-btd") { + override fun help(context: Context) = "Perform EBICS requests" + private val common by CommonOption() private val type by option().default("BTD") private val name by option() @@ -185,7 +194,9 @@ class EbicsDownload: CliktCommand("Perform EBICS requests", name = "ebics-btd") } } -class ListCmd: CliktCommand("List nexus transactions", name = "list") { +class ListCmd: CliktCommand("list") { + override fun help(context: Context) = "List nexus transactions" + private val common by CommonOption() private val kind: ListKind by argument( help = "Which list to print", @@ -267,10 +278,12 @@ class ListCmd: CliktCommand("List nexus transactions", name = "list") { } } -class TestingCmd : CliktCommand("Testing helper commands", name = "testing") { +class TestingCmd : CliktCommand("testing") { init { subcommands(FakeIncoming(), ListCmd(), EbicsDownload(), TxCheck(), Wss()) } + override fun help(context: Context) = "Testing helper commands" + override fun run() = Unit } \ No newline at end of file diff --git a/testbench/src/main/kotlin/Main.kt b/testbench/src/main/kotlin/Main.kt @@ -20,7 +20,9 @@ package tech.libeufin.testbench import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.ProgramResult +import com.github.ajalt.clikt.core.main import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.testing.test import io.ktor.client.* @@ -71,7 +73,9 @@ data class Config( val payto: Map<String, String> ) -class Cli : CliktCommand("Run integration tests on banks provider") { +class Cli : CliktCommand() { + override fun help(context: Context) = "Run integration tests on banks provider" + val platform by argument() override fun run() {