Set GridFSInputFile closeStreamOnPersist flag
This commit is contained in:
parent
f499079bf7
commit
b1cfb5490a
2 changed files with 11 additions and 1 deletions
|
|
@ -116,7 +116,7 @@
|
||||||
|
|
||||||
(defn ^GridFSInputFile make-input-file
|
(defn ^GridFSInputFile make-input-file
|
||||||
[^GridFS fs input]
|
[^GridFS fs input]
|
||||||
(.createFile fs (to-input-stream input)))
|
(.createFile fs (to-input-stream input) true))
|
||||||
|
|
||||||
(defmacro store
|
(defmacro store
|
||||||
[^GridFSInputFile input & body]
|
[^GridFSInputFile input & body]
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,16 @@
|
||||||
(content-type "application/octet-stream"))
|
(content-type "application/octet-stream"))
|
||||||
(is (= 1 (count (gridfs/all-files fs))))))
|
(is (= 1 (count (gridfs/all-files fs))))))
|
||||||
|
|
||||||
|
(deftest ^{:gridfs true} test-deleting-file-instance-on-disk-after-storing
|
||||||
|
(let [tmp-file (File/createTempFile "monger.test.gridfs" "test-deleting-file-instance-on-disk-after-storing")
|
||||||
|
_ (spit tmp-file "to be deleted")]
|
||||||
|
(is (= 0 (count (gridfs/all-files fs))))
|
||||||
|
(store-file (make-input-file fs tmp-file)
|
||||||
|
(filename "test-deleting-file-instance-on-disk-after-storing")
|
||||||
|
(content-type "application/octet-stream"))
|
||||||
|
(is (= 1 (count (gridfs/all-files fs))))
|
||||||
|
(is (.delete tmp-file))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(deftest ^{:gridfs true} test-finding-individual-files-on-gridfs
|
(deftest ^{:gridfs true} test-finding-individual-files-on-gridfs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue