add ad-hoc test method

master
Josha von Gizycki 5 years ago
parent 185a860243
commit b7df6c1d58

1
.gitignore vendored

@ -9,3 +9,4 @@ pom.xml.asc
/.nrepl-port /.nrepl-port
.hgignore .hgignore
.hg/ .hg/
*.iml

@ -1,4 +1,4 @@
(defproject joshavg/lein-neo4j "0.5.0" (defproject joshavg/lein-neo4j "0.6.0"
:description "neo4j server invokable from leiningen" :description "neo4j server invokable from leiningen"
:url "https://gitea.heevyis.ninja/josha/lein-neo4j" :url "https://gitea.heevyis.ninja/josha/lein-neo4j"
:license {:name "GPL-3.0" :license {:name "GPL-3.0"

@ -1,7 +1,5 @@
(ns leiningen.neo4j (ns leiningen.neo4j
(:import org.neo4j.graphdb.factory.GraphDatabaseFactory (:import org.neo4j.server.CommunityBootstrapper
org.neo4j.server.CommunityBootstrapper
java.lang.Runtime
java.lang.Thread java.lang.Thread
java.util.Optional) java.util.Optional)
(:require [clojure.java.io :as io])) (:require [clojure.java.io :as io]))
@ -13,3 +11,11 @@
server (CommunityBootstrapper.)] server (CommunityBootstrapper.)]
(.start server path (Optional/empty) config) (.start server path (Optional/empty) config)
(while true (Thread/sleep 5000)))) (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)))

Loading…
Cancel
Save