gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 02/02: rename DB table


From: gnunet
Subject: [libeufin] 02/02: rename DB table
Date: Tue, 08 Dec 2020 14:57:02 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit 826d4b45c34d1c3c3f543a718a580518a6719c6e
Author: MS <ms@taler.net>
AuthorDate: Tue Dec 8 14:56:45 2020 +0100

    rename DB table
---
 integration-tests/tests.py                         |  4 +-
 integration-tests/util.py                          | 43 ++++++++++++----------
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt    | 35 +++++++++---------
 .../kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt |  8 ++--
 4 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 703711a..011a39b 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -150,7 +150,7 @@ def teardown_function():
 def test_env():
     print("Nexus and Sandbox are up and running!")
     try:
-        input("press enter to stop LibEuFin test environment ...")
+        input("\npress enter to stop LibEuFin test environment ...")
     except:
         pass
     print("exiting!")
@@ -311,7 +311,7 @@ def test_payment_double_submission():
         )
     )
     check_call([
-        "psql", "-d", DB,
+        "psql", "-d", DB, "-h 127.0.0.1", "-U", "libeufin",
         f"UPDATE PaymentInitiations SET submitted = false WHERE id = 
'{PAYMENT_UUID}'"
     ]) 
     # Submit payment the _second_ time, expecting 500 from Nexus.
diff --git a/integration-tests/util.py b/integration-tests/util.py
index e2c026a..6e96c45 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -51,23 +51,22 @@ def removeStaleTables(dbName):
     flushTablesSandbox(dbName)
 
 def makeNexusSuperuser(dbName):
-    db_full_path = str(Path.cwd() / dbName)
-    check_call(
-        [
-            "../gradlew",
-            "-q",
-            "-p",
-            "..",
-            "nexus:run",
-            "--console=plain",
-            f"--args=superuser admin --password x --db-name={db_full_path}",
-        ]
-    )
+    check_call([
+        "../gradlew",
+        "-q", "--console=plain",
+        "-p", "..",
+        "nexus:run",
+        f"--args=superuser admin --password x --db-name={dbName}",
+    ])
 
 def drop_public_schema(dbName):
-    check_call(
-        ["psql", "-d", dbName, "-c", "DROP SCHEMA public CASCADE; CREATE 
SCHEMA public;"]
-     )
+    check_call([
+        "psql",
+        "-d", dbName, "-q",
+        "-h", "127.0.0.1", "-p", "5433",
+        "-U", "libeufin",
+        "-c", "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
+    ])
 def flushTablesSandbox(dbName):
     drop_public_schema(dbName)
 
@@ -75,10 +74,16 @@ def flushTablesNexus(dbName):
     drop_public_schema(dbName)
 
 def startSandbox(dbName):
-    check_call(["../gradlew", "-q", "-p", "..", "sandbox:assemble"])
+    check_call(["../gradlew", "-q", "--console=plain", "-p", "..", 
"sandbox:assemble"])
     checkPort(5000)
-    sandbox = Popen(
-        ["../gradlew", "-q", "-p", "..", "sandbox:run", "--console=plain", 
"--args=serve --db-name={}".format(db_full_path)],
+    sandbox = Popen([
+        "../gradlew",
+        "-q",
+        "-p",
+        "..",
+        "sandbox:run",
+        "--console=plain",
+        "--args=serve --db-name={}".format(dbName)],
         stdin=DEVNULL,
         stdout=open("sandbox-stdout.log", "w"),
         stderr=open("sandbox-stderr.log", "w"),
@@ -100,7 +105,7 @@ def startSandbox(dbName):
 
 def startNexus(dbName):
     check_call(
-        ["../gradlew", "-q", "-p", "..", "nexus:assemble",]
+        ["../gradlew", "-q", "--console=plain", "-p", "..", "nexus:assemble",]
     )
     checkPort(5001)
     nexus = Popen(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 5d5e4cf..6b939ad 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -30,7 +30,6 @@ import org.jetbrains.exposed.sql.transactions.transaction
 import tech.libeufin.nexus.iso20022.EntryStatus
 import tech.libeufin.util.EbicsInitState
 import tech.libeufin.util.amount
-import java.net.URLEncoder
 import java.sql.Connection
 
 /**
@@ -261,7 +260,7 @@ class NexusBankAccountEntity(id: EntityID<String>) : 
Entity<String>(id) {
     var lastNotificationCreationTimestamp by 
NexusBankAccountsTable.lastNotificationCreationTimestamp
 }
 
-object EbicsSubscribersTable : IntIdTable() {
+object NexusEbicsSubscribersTable : IntIdTable() {
     val ebicsURL = text("ebicsURL")
     val hostID = text("hostID")
     val partnerID = text("partnerID")
@@ -278,21 +277,21 @@ object EbicsSubscribersTable : IntIdTable() {
 }
 
 class EbicsSubscriberEntity(id: EntityID<Int>) : IntEntity(id) {
-    companion object : 
IntEntityClass<EbicsSubscriberEntity>(EbicsSubscribersTable)
-
-    var ebicsURL by EbicsSubscribersTable.ebicsURL
-    var hostID by EbicsSubscribersTable.hostID
-    var partnerID by EbicsSubscribersTable.partnerID
-    var userID by EbicsSubscribersTable.userID
-    var systemID by EbicsSubscribersTable.systemID
-    var signaturePrivateKey by EbicsSubscribersTable.signaturePrivateKey
-    var encryptionPrivateKey by EbicsSubscribersTable.encryptionPrivateKey
-    var authenticationPrivateKey by 
EbicsSubscribersTable.authenticationPrivateKey
-    var bankEncryptionPublicKey by 
EbicsSubscribersTable.bankEncryptionPublicKey
-    var bankAuthenticationPublicKey by 
EbicsSubscribersTable.bankAuthenticationPublicKey
-    var nexusBankConnection by NexusBankConnectionEntity referencedOn 
EbicsSubscribersTable.nexusBankConnection
-    var ebicsIniState by EbicsSubscribersTable.ebicsIniState
-    var ebicsHiaState by EbicsSubscribersTable.ebicsHiaState
+    companion object : 
IntEntityClass<EbicsSubscriberEntity>(NexusEbicsSubscribersTable)
+
+    var ebicsURL by NexusEbicsSubscribersTable.ebicsURL
+    var hostID by NexusEbicsSubscribersTable.hostID
+    var partnerID by NexusEbicsSubscribersTable.partnerID
+    var userID by NexusEbicsSubscribersTable.userID
+    var systemID by NexusEbicsSubscribersTable.systemID
+    var signaturePrivateKey by NexusEbicsSubscribersTable.signaturePrivateKey
+    var encryptionPrivateKey by NexusEbicsSubscribersTable.encryptionPrivateKey
+    var authenticationPrivateKey by 
NexusEbicsSubscribersTable.authenticationPrivateKey
+    var bankEncryptionPublicKey by 
NexusEbicsSubscribersTable.bankEncryptionPublicKey
+    var bankAuthenticationPublicKey by 
NexusEbicsSubscribersTable.bankAuthenticationPublicKey
+    var nexusBankConnection by NexusBankConnectionEntity referencedOn 
NexusEbicsSubscribersTable.nexusBankConnection
+    var ebicsIniState by NexusEbicsSubscribersTable.ebicsIniState
+    var ebicsHiaState by NexusEbicsSubscribersTable.ebicsHiaState
 }
 
 object NexusUsersTable : IdTable<String>() {
@@ -396,7 +395,7 @@ fun dbCreateTables(dbName: String) {
         SchemaUtils.create(
             NexusUsersTable,
             PaymentInitiationsTable,
-            EbicsSubscribersTable,
+            NexusEbicsSubscribersTable,
             NexusBankAccountsTable,
             NexusBankTransactionsTable,
             TalerIncomingPayments,
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
index 43e0275..fffc4f8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -325,7 +325,7 @@ private fun getEbicsSubscriberDetails(bankConnectionId: 
String): EbicsClientSubs
         throw NexusError(HttpStatusCode.NotFound, "transport not found")
     }
     val subscriber = EbicsSubscriberEntity.find {
-        EbicsSubscribersTable.nexusBankConnection eq transport.id
+        NexusEbicsSubscribersTable.nexusBankConnection eq transport.id
     }.first()
     // transport exists and belongs to caller.
     return getEbicsSubscriberDetailsInternal(subscriber)
@@ -433,7 +433,7 @@ fun Route.ebicsBankConnectionRoutes(client: HttpClient) {
         transaction {
             val conn = requireBankConnection(call, "connid")
             val subscriber =
-                EbicsSubscriberEntity.find { 
EbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
+                EbicsSubscriberEntity.find { 
NexusEbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
             subscriber.bankAuthenticationPublicKey = 
ExposedBlob((hpbData.authenticationPubKey.encoded))
             subscriber.bankEncryptionPublicKey = 
ExposedBlob((hpbData.encryptionPubKey.encoded))
         }
@@ -602,7 +602,7 @@ private suspend fun tentativeHpb(client: HttpClient, 
connId: String): Boolean {
             throw NexusError(HttpStatusCode.NotFound, "bank connection 
'$connId' not found")
         }
         val subscriberEntity =
-            EbicsSubscriberEntity.find { 
EbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
+            EbicsSubscriberEntity.find { 
NexusEbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
         subscriberEntity.ebicsIniState = EbicsInitState.SENT
         subscriberEntity.ebicsHiaState = EbicsInitState.SENT
         subscriberEntity.bankAuthenticationPublicKey =
@@ -648,7 +648,7 @@ suspend fun connectEbics(client: HttpClient, connId: 
String) {
             throw NexusError(HttpStatusCode.NotFound, "bank connection 
'$connId' not found")
         }
         val subscriberEntity =
-            EbicsSubscriberEntity.find { 
EbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
+            EbicsSubscriberEntity.find { 
NexusEbicsSubscribersTable.nexusBankConnection eq conn.id }.first()
         if (iniDone) {
             subscriberEntity.ebicsIniState = EbicsInitState.SENT
         }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]