test impermanent database

master
Josha von Gizycki 5 years ago
parent b7df6c1d58
commit 421f5712fd

@ -1,9 +1,10 @@
(defproject joshavg/lein-neo4j "0.6.0"
(defproject joshavg/lein-neo4j "0.6.0-SNAPSHOT"
:description "neo4j server invokable from leiningen"
:url "https://gitea.heevyis.ninja/josha/lein-neo4j"
:license {:name "GPL-3.0"
:url "https://opensource.org/licenses/GPL-3.0"}
:dependencies [[org.clojure/clojure "1.10.0"]
[org.neo4j/neo4j "3.5.3"]
[org.neo4j.app/neo4j-server "3.5.3"]]
[org.neo4j/neo4j "3.5.8"]
[org.neo4j.app/neo4j-server "3.5.8"]
[org.neo4j.community/it-test-support "3.5.8"]]
:eval-in-leiningen true)

@ -1,5 +1,6 @@
(ns leiningen.neo4j
(:import org.neo4j.server.CommunityBootstrapper
org.neo4j.test.TestGraphDatabaseFactory
java.lang.Thread
java.util.Optional)
(:require [clojure.java.io :as io]))
@ -12,10 +13,8 @@
(.start server path (Optional/empty) config)
(while true (Thread/sleep 5000))))
(defn with-db [& {:keys [path config do-with-db]
:or {:path "target/neo4j"
:config {}}}]
(let [server (CommunityBootstrapper.)]
(.start server path (Optional/empty) config)
(do-with-db)
(.stop server)))
(defn with-test-db [path do-with-db]
(let [db (.newImpermanentDatabase
(TestGraphDatabaseFactory.)
(io/as-file path))]
(do-with-db)))

Loading…
Cancel
Save