libeufin

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

commit dcb5093fc78ccdc61a328ea62c6c9d452d5a748e
parent 74461ab6f037c45f40c4f10e116462fb177bf008
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Wed,  1 Apr 2020 16:58:31 +0200

Avoid row collision with sample data.

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 28+++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -73,21 +73,18 @@ fun testData() { val pairA = CryptoUtil.generateRsaKeyPair(2048) val pairB = CryptoUtil.generateRsaKeyPair(2048) val pairC = CryptoUtil.generateRsaKeyPair(2048) - try { - transaction { - addLogger(StdOutSqlLogger) - EbicsSubscriberEntity.new(id = "default-customer") { - ebicsURL = "http://localhost:5000/ebicsweb" - userID = "USER1" - partnerID = "PARTNER1" - hostID = "host01" - signaturePrivateKey = SerialBlob(pairA.private.encoded) - encryptionPrivateKey = SerialBlob(pairB.private.encoded) - authenticationPrivateKey = SerialBlob(pairC.private.encoded) - } + val salt = Random().nextLong() + transaction { + addLogger(StdOutSqlLogger) + EbicsSubscriberEntity.new(id = "default-customer-$salt") { + ebicsURL = "http://localhost:5000/ebicsweb" + userID = "USER1" + partnerID = "PARTNER1" + hostID = "host01" + signaturePrivateKey = SerialBlob(pairA.private.encoded) + encryptionPrivateKey = SerialBlob(pairB.private.encoded) + authenticationPrivateKey = SerialBlob(pairC.private.encoded) } - } catch (e: ExposedSQLException) { - logger.info("Likely primary key collision for sample data: accepted") } } @@ -629,7 +626,6 @@ fun main() { return@get } - post("/ebics/taler/{id}/accounts/{acctid}/refund-invalid-payments") { transaction { val subscriber = expectIdTransaction(call.parameters["id"]) @@ -763,7 +759,6 @@ fun main() { get("/ebics/subscribers/{id}/transactions") { // FIXME(florian): Display local transaction history stored by the nexus. } - post("/ebics/subscribers/{id}/sendC52") { val id = expectId(call.parameters["id"]) val paramsJson = call.receive<EbicsStandardOrderParamsJson>() @@ -786,7 +781,6 @@ fun main() { } } } - post("/ebics/subscribers/{id}/sendCRZ") { val id = expectId(call.parameters["id"]) val paramsJson = call.receive<EbicsStandardOrderParamsJson>()