gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: sandbox db test


From: gnunet
Subject: [libeufin] branch master updated: sandbox db test
Date: Mon, 18 May 2020 15:52:22 +0200

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

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new d40f0c4  sandbox db test
d40f0c4 is described below

commit d40f0c42e8bb2a4654a50346e16b9ea946d66865
Author: MS <address@hidden>
AuthorDate: Mon May 18 15:52:13 2020 +0200

    sandbox db test
---
 sandbox/src/test/kotlin/DBTest.kt | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/sandbox/src/test/kotlin/DBTest.kt 
b/sandbox/src/test/kotlin/DBTest.kt
new file mode 100644
index 0000000..fba5715
--- /dev/null
+++ b/sandbox/src/test/kotlin/DBTest.kt
@@ -0,0 +1,48 @@
+import org.jetbrains.exposed.sql.Database
+import org.jetbrains.exposed.sql.SchemaUtils
+import org.jetbrains.exposed.sql.StdOutSqlLogger
+import org.jetbrains.exposed.sql.addLogger
+import org.jetbrains.exposed.sql.transactions.TransactionManager
+import org.jetbrains.exposed.sql.transactions.transaction
+import org.joda.time.DateTime
+import org.junit.Test
+import tech.libeufin.sandbox.PaymentEntity
+import tech.libeufin.sandbox.PaymentsTable
+import tech.libeufin.util.parseDashedDate
+import java.sql.Connection
+
+
+class DBTest {
+    @Test
+    fun exist() {
+        println("x")
+    }
+
+    @Test
+    fun betweenDates() {
+        Database.connect("jdbc:sqlite:sandbox-test.sqlite3", "org.sqlite.JDBC")
+        TransactionManager.manager.defaultIsolationLevel = 
Connection.TRANSACTION_SERIALIZABLE
+        transaction {
+            SchemaUtils.create(PaymentsTable)
+            PaymentEntity.new {
+                creditorIban = "earns"
+                debitorIban = "spends"
+                subject = "deal"
+                amount = "EUR:1"
+                date = DateTime.now().millis
+            }
+        }
+        val result = transaction {
+            addLogger(StdOutSqlLogger)
+            PaymentEntity.find {
+                PaymentsTable.date.between(
+                    parseDashedDate(
+                        "1970-01-01"
+                    ).millis,
+                    DateTime.now().millis
+                )
+            }.firstOrNull()
+        }
+        assert(result != null)
+    }
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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