diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2020-04-01 16:58:31 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2020-04-01 16:58:31 +0200 |
commit | dcb5093fc78ccdc61a328ea62c6c9d452d5a748e (patch) | |
tree | 31136eb9a087ee12112767723ba9d76e3860df22 | |
parent | 74461ab6f037c45f40c4f10e116462fb177bf008 (diff) | |
download | libeufin-dcb5093fc78ccdc61a328ea62c6c9d452d5a748e.tar.gz libeufin-dcb5093fc78ccdc61a328ea62c6c9d452d5a748e.tar.bz2 libeufin-dcb5093fc78ccdc61a328ea62c6c9d452d5a748e.zip |
Avoid row collision with sample data.
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 28 |
1 files 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 index c68b61aa..15d20eec 100644 --- 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>() |