forked from michaelklishin/neocons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce neocons.rest.nodes/create-batch
- Loading branch information
1 parent
0dc1218
commit 267fa05
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
test/clojurewerkz/neocons/rest/test/batch_operations_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(ns clojurewerkz.neocons.rest.test.batch-operations-test | ||
(:require [clojurewerkz.neocons.rest :as neorest] | ||
[clojurewerkz.neocons.rest.nodes :as nn]) | ||
(:use clojure.test)) | ||
|
||
(neorest/connect! "http://localhost:7474/db/data/") | ||
|
||
|
||
(deftest ^{:batching true} test-basic-batching-of-inserts | ||
(let [n 100 | ||
rng (range 0 n) | ||
xs (doall (map (fn [x] {:n x}) rng)) | ||
nodes (doall (nn/create-batch xs))] | ||
;; ensure that we aren't tripped by laziness | ||
(is (= (count nodes) n)) | ||
(is (= (count (map :id nodes)) n)) | ||
(nn/delete-many (vec nodes)))) |