diff options
author | Antoine A <> | 2024-01-30 18:32:04 +0100 |
---|---|---|
committer | Antoine A <> | 2024-01-30 19:09:54 +0100 |
commit | 16e0190f5337ce4c0c5c61df204e811e84960d75 (patch) | |
tree | 3b56b67cc2269a4093f6ea89727f0dc49dc7fb7f /testbench | |
parent | d65afec46d35967c52fea9f145dab8ea0fffca3c (diff) | |
download | libeufin-16e0190f5337ce4c0c5c61df204e811e84960d75.tar.gz libeufin-16e0190f5337ce4c0c5c61df204e811e84960d75.tar.bz2 libeufin-16e0190f5337ce4c0c5c61df204e811e84960d75.zip |
Improve xml logic and fix ebics testbench
Diffstat (limited to 'testbench')
-rw-r--r-- | testbench/src/main/kotlin/Main.kt | 11 | ||||
-rw-r--r-- | testbench/src/test/kotlin/Iso20022Test.kt | 52 |
2 files changed, 57 insertions, 6 deletions
diff --git a/testbench/src/main/kotlin/Main.kt b/testbench/src/main/kotlin/Main.kt index 076d5001..4b999072 100644 --- a/testbench/src/main/kotlin/Main.kt +++ b/testbench/src/main/kotlin/Main.kt @@ -116,9 +116,6 @@ class Cli : CliktCommand("Run integration tests on banks provider") { val clientKeysPath = cfg.requirePath("nexus-ebics", "client_private_keys_file") val bankKeysPath = cfg.requirePath("nexus-ebics", "bank_public_keys_file") - var hasClientKeys = clientKeysPath.exists() - var hasBankKeys = bankKeysPath.exists() - // Alternative payto ? val payto = "payto://iban/CH6208704048981247126?receiver-name=Grothoff%20Hans" @@ -157,8 +154,7 @@ class Cli : CliktCommand("Run integration tests on banks provider") { put("reset-keys", suspend { clientKeysPath.deleteIfExists() bankKeysPath.deleteIfExists() - hasClientKeys = false - hasBankKeys = false + Unit }) put("tx", suspend { step("Test submit one transaction") @@ -201,6 +197,9 @@ class Cli : CliktCommand("Run integration tests on banks provider") { } while (true) { + var hasClientKeys = clientKeysPath.exists() + var hasBankKeys = bankKeysPath.exists() + if (!hasClientKeys) { if (kind.test) { step("Test INI order") @@ -219,7 +218,7 @@ class Cli : CliktCommand("Run integration tests on banks provider") { .assertOk("ebics-setup should succeed the second time") } - val arg = ask("testbench >")!!.trim() + val arg = ask("testbench> ")!!.trim() if (arg == "exit") break val cmd = cmds[arg] if (cmd != null) { diff --git a/testbench/src/test/kotlin/Iso20022Test.kt b/testbench/src/test/kotlin/Iso20022Test.kt new file mode 100644 index 00000000..49d78d4d --- /dev/null +++ b/testbench/src/test/kotlin/Iso20022Test.kt @@ -0,0 +1,52 @@ +/* + * This file is part of LibEuFin. + * Copyright (C) 2024 Taler Systems S.A. + + * LibEuFin is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3, or + * (at your option) any later version. + + * LibEuFin is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + + * You should have received a copy of the GNU Affero General Public + * License along with LibEuFin; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/> + */ + +import tech.libeufin.nexus.* +import org.junit.Test +import java.nio.file.* +import kotlin.io.path.* + +class Iso20022Test { + @Test + fun logs() { + for (platform in Path("test").listDirectoryEntries()) { + for (file in platform.listDirectoryEntries()) { + val fetch = file.resolve("fetch") + if (file.isDirectory() && fetch.exists()) { + for (log in fetch.listDirectoryEntries()) { + val str = log.readBytes() + val name = log.toString() + println(name) + if (name.contains("HAC")) { + parseCustomerAck(str) + } else if (name.contains("pain.002")) { + parseCustomerPaymentStatusReport(str) + } else { + try { + parseTxNotif(str, "CHF", mutableListOf(), mutableListOf()) + } catch (e: Exception) { + println(e) // TODO import tx notif + } + } + } + } + } + } + } +}
\ No newline at end of file |