Skip to content

Commit

Permalink
upgrade libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Weijers committed Apr 9, 2014
1 parent fd22ff8 commit 2a179f5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
7 changes: 4 additions & 3 deletions project.clj
Expand Up @@ -2,10 +2,11 @@
:description "Titanium a powerful Clojure graph library build on top of Aurelius Titan"
:url "http://titanium.clojurewerkz.org"
:license {:name "Eclipse Public License"}
:dependencies [[org.clojure/clojure "1.5.1"]
:jvm-opts ["-javaagent:lib/jamm-0.2.5.jar"]
:dependencies [[org.clojure/clojure "1.6.0"]
[clojurewerkz/support "0.15.0"]
[com.thinkaurelius.titan/titan-all "0.4.0"]
[potemkin "0.2.0"]
[com.thinkaurelius.titan/titan-all "0.4.2"]
[potemkin "0.3.4"]
[clojurewerkz/ogre "2.3.0.1"]
[clojurewerkz/archimedes "1.0.0-alpha4"]]
:source-paths ["src/clojure"]
Expand Down
8 changes: 4 additions & 4 deletions src/clojure/clojurewerkz/titanium/graph.clj
Expand Up @@ -38,7 +38,7 @@

(g/set-pre-fn! ensure-graph-is-transaction-safe)

(defn convert-config-map
(defn convert-config-map
[m]
(let [conf (org.apache.commons.configuration.BaseConfiguration.)]
(doseq [[k1 v1] m]
Expand Down Expand Up @@ -67,9 +67,9 @@

(defn open?
[]
(and
(bound? #'archimedes.core/*graph*)
(not (nil? archimedes.core/*graph*))
(and
(bound? #'archimedes.core/*graph*)
(not (nil? archimedes.core/*graph*))
(.isOpen archimedes.core/*graph*)))


Expand Down
12 changes: 7 additions & 5 deletions test/clojurewerkz/titanium/conf.clj
Expand Up @@ -2,19 +2,21 @@
(:import (org.apache.commons.io FileUtils)))


(def cs-dir (str (clojure.java.io/as-url
(clojure.java.io/as-file
(str (System/getProperty "user.dir")
(def cs-dir (str (clojure.java.io/as-url
(clojure.java.io/as-file
(str (System/getProperty "user.dir")
"/resources/test-cassandra.yaml")))))

(def conf {;; Embedded cassandra settings
"storage.backend" "embeddedcassandra"
"storage.cassandra-config-dir" cs-dir
;; Embedded elasticsearch settings
"storage.index.search.backend" "elasticsearch"
"storage.index.search.directory" "/tmp/cassandra/elasticsearch"
"storage.index.search.directory" "/tmp/titanium-test/elasticsearch"
"storage.index.search.client-only" false
"storage.index.search.local-mode" true})
"storage.index.search.local-mode" true
"storage.compression.enabled" false
"storage.cassandra.db.compression.enabled" false})

(defn clear-db []
(FileUtils/deleteDirectory (java.io.File. "/tmp/titanium-test")))
10 changes: 5 additions & 5 deletions test/clojurewerkz/titanium/edges_test.clj
Expand Up @@ -163,11 +163,11 @@
(testing "Refresh"
(let [v1 (tg/transact! (tv/create! {:name "v1"}))
v2 (tg/transact! (tv/create! {:name "v2"}))
edge (tg/transact!
edge (tg/transact!
(ted/connect! (tv/refresh v1) :connexion (tv/refresh v2) {:name "bob"}))]
(is (tg/transact!
(is (tg/transact!
(= (.getId edge) (.getId (ted/refresh edge)))))
(is (tg/transact!
(is (tg/transact!
(is (= "bob" (:name (ted/to-map (ted/refresh edge)))))))))

(testing "Edges between"
Expand All @@ -176,9 +176,9 @@
edge (tg/transact! (ted/connect! (tv/refresh v1) :connexion (tv/refresh v2)))]
(is edge)
(is (tg/transact! (= (ted/to-map (ted/refresh edge))
(ted/to-map (first
(ted/to-map (first
(ted/edges-between (tv/refresh v1) (tv/refresh v2)))))))))

(testing "Upconnect!"
(testing "Upconnecting once without data"
(tg/transact!
Expand Down
14 changes: 7 additions & 7 deletions test/clojurewerkz/titanium/graph_test.clj
Expand Up @@ -2,7 +2,7 @@
(:require [clojurewerkz.titanium.graph :as tg]
[clojurewerkz.titanium.vertices :as tv]
[clojurewerkz.titanium.edges :as ted]
[clojurewerkz.titanium.types :as tt]
[clojurewerkz.titanium.types :as tt]
[clojurewerkz.support.io :as sio]
[archimedes.core :as c])
(:use clojure.test
Expand Down Expand Up @@ -45,7 +45,7 @@
StandardTitanGraph)))

(testing "Stored graph"
(let [vertex (tg/transact! (.addVertex c/*graph*))]
(let [vertex (tg/transact! (.addVertex c/*graph*))]
(is (= StandardVertex (type vertex)))))

(testing "Stored graph"
Expand All @@ -64,16 +64,16 @@
(do @f1 @f2)) "The futures throw errors.")))
(testing "With retries"
(let [random-long (long (rand-int 100000))
f1 (future (tg/retry-transact! 3 100
f1 (future (tg/retry-transact! 3 100
(tv/upsert! :vertex-id {:vertex-id random-long})))
f2 (future (tg/retry-transact! 3 100
f2 (future (tg/retry-transact! 3 100
(tv/upsert! :vertex-id {:vertex-id random-long})))]

(is (= random-long
(tg/transact!
(tv/get (tv/refresh (first @f1)) :vertex-id))
(tg/transact!
(tv/get (tv/refresh (first @f2)) :vertex-id)))
(tv/get (tv/refresh (first @f2)) :vertex-id)))
"The futures have the correct values.")
(is (= 1 (count
(tg/transact! (tv/find-by-kv :vertex-id random-long))))
Expand All @@ -82,9 +82,9 @@
(testing "With retries and an exponential backoff function"
(let [backoff-fn (fn [try-count] (+ (Math/pow 10 try-count) (* try-count (rand-int 100))))
random-long (long (rand-int 100000))
f1 (future (tg/retry-transact! 3 backoff-fn
f1 (future (tg/retry-transact! 3 backoff-fn
(tv/upsert! :vertex-id {:vertex-id random-long})))
f2 (future (tg/retry-transact! 3 backoff-fn
f2 (future (tg/retry-transact! 3 backoff-fn
(tv/upsert! :vertex-id {:vertex-id random-long})))]

(is (= random-long
Expand Down

0 comments on commit 2a179f5

Please sign in to comment.