diff --git a/project.clj b/project.clj index ea50701..f116c4d 100644 --- a/project.clj +++ b/project.clj @@ -38,9 +38,10 @@ :exclusions [ring/ring-core ring/ring-codec commons-io - commons-codec]]] + commons-codec]] + [joshavg/lein-neo4j "0.6.0-SNAPSHOT"]] :plugins [;; neo4j db - [joshavg/lein-neo4j "0.5.0"] + [joshavg/lein-neo4j "0.6.0-SNAPSHOT"] ;; webserver stuff [lein-less "1.7.5"] diff --git a/src/wanijo/framework/neo4j.clj b/src/wanijo/framework/neo4j.clj index cc663b4..4a197c3 100644 --- a/src/wanijo/framework/neo4j.clj +++ b/src/wanijo/framework/neo4j.clj @@ -14,7 +14,7 @@ #(re-matches #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" %)) -(def conn +(def ^:dynamic *conn* (let [env #(or (System/getenv %1) %2) port (env "NEO4J_PORT" "7687") host (env "NEO4J_HOST" "localhost") @@ -40,7 +40,7 @@ (cljs/join \newline))) (defn exec-query! [qry params] - (with-open [session (db/get-session @conn)] + (with-open [session (db/get-session @*conn*)] (devmode/send-to-bar (str (butiful-query qry) "
---Params---
" @@ -52,7 +52,7 @@ (spec/tuple fn? map?))) (defn exec-queries! [& tuples] {:pre [(spec/assert ::tuple-query-list tuples)]} - (db/with-transaction @conn tx + (db/with-transaction @*conn* tx (doseq [tuple tuples] (let [qry (first tuple) params (second tuple)] diff --git a/test/wanijo/instance/domain_test.clj b/test/wanijo/instance/domain_test.clj new file mode 100644 index 0000000..8f25ad0 --- /dev/null +++ b/test/wanijo/instance/domain_test.clj @@ -0,0 +1,13 @@ +(ns wanijo.instance.domain-test + (:require [clojure.test :refer :all] + [leiningen.neo4j :refer [with-test-db]] + [neo4j-clj.core :as db] + [wanijo.instance.domain :as domain])) + +(deftest instances-are-created + (with-test-db + "/tmp" + (fn [] + (binding [wanijo.framework.neo4j/*conn* + (atom (db/connect "bolt://localhost"))] + (println "jadda")))))