[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 05/06: moving code
From: |
gnunet |
Subject: |
[libeufin] 05/06: moving code |
Date: |
Wed, 23 Nov 2022 20:06:21 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit 52d5b56c65c9e7043e7cf205328f4cdb94662cd5
Author: MS <ms@taler.net>
AuthorDate: Wed Nov 23 20:05:03 2022 +0100
moving code
---
nexus/src/test/kotlin/DBTest.kt | 26 +-------------------------
nexus/src/test/kotlin/SelfContainedDBTest.kt | 24 ------------------------
2 files changed, 1 insertion(+), 49 deletions(-)
diff --git a/nexus/src/test/kotlin/DBTest.kt b/nexus/src/test/kotlin/DBTest.kt
index df187ff9..3b818942 100644
--- a/nexus/src/test/kotlin/DBTest.kt
+++ b/nexus/src/test/kotlin/DBTest.kt
@@ -4,33 +4,9 @@ import org.jetbrains.exposed.exceptions.ExposedSQLException
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.Test
+import withTestDatabase
import java.io.File
-/**
- * Run a block after connecting to the test database.
- * Cleans up the DB file afterwards.
- */
-fun withTestDatabase(f: () -> Unit) {
- val dbfile = "jdbc:sqlite:/tmp/nexus-test.sqlite3"
- File(dbfile).also {
- if (it.exists()) {
- it.delete()
- }
- }
- Database.connect("jdbc:sqlite:$dbfile")
- dbDropTables(dbfile)
- try {
- f()
- }
- finally {
- File(dbfile).also {
- if (it.exists()) {
- it.delete()
- }
- }
- }
-}
-
object MyTable : Table() {
val col1 = text("col1")
val col2 = text("col2")
diff --git a/nexus/src/test/kotlin/SelfContainedDBTest.kt
b/nexus/src/test/kotlin/SelfContainedDBTest.kt
index 5d7974f9..f0322fbc 100644
--- a/nexus/src/test/kotlin/SelfContainedDBTest.kt
+++ b/nexus/src/test/kotlin/SelfContainedDBTest.kt
@@ -13,30 +13,6 @@ import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.Test
import java.io.File
-/**
- * Run a block after connecting to the test database.
- * Cleans up the DB file afterwards.
- */
-fun withTestDatabase(f: () -> Unit) {
- val dbfile = "test-db.sqlite3"
- File(dbfile).also {
- if (it.exists()) {
- it.delete()
- }
- }
- Database.connect("jdbc:sqlite:$dbfile", "org.sqlite.JDBC")
- try {
- f()
- }
- finally {
- File(dbfile).also {
- if (it.exists()) {
- it.delete()
- }
- }
- }
-}
-
object ContainedTableWithIntId : IntIdTable() {
val column = text("column")
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated (1f70330a -> 39ece551), gnunet, 2022/11/23
- [libeufin] 03/06: Nexus tests., gnunet, 2022/11/23
- [libeufin] 04/06: comment, gnunet, 2022/11/23
- [libeufin] 01/06: debug, gnunet, 2022/11/23
- [libeufin] 05/06: moving code,
gnunet <=
- [libeufin] 02/06: remove newline, gnunet, 2022/11/23
- [libeufin] 06/06: EBICS payload prepare helper., gnunet, 2022/11/23