mirror of https://github.com/apache/jclouds.git
Fix File method of download-blob multimethod.
This commit is contained in:
parent
5311b05192
commit
9ba88797a0
|
@ -258,7 +258,7 @@ container, name, string -> etag
|
||||||
(copy (.getContent blob) target)))
|
(copy (.getContent blob) target)))
|
||||||
|
|
||||||
(defmethod download-blob File [blobstore container-name name target]
|
(defmethod download-blob File [blobstore container-name name target]
|
||||||
(download-blob (FileOutputStream. target)))
|
(download-blob blobstore container-name name (FileOutputStream. target)))
|
||||||
|
|
||||||
(define-accessors StorageMetadata "blob" type id name
|
(define-accessors StorageMetadata "blob" type id name
|
||||||
location-id uri last-modfied)
|
location-id uri last-modfied)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns org.jclouds.blobstore-test
|
(ns org.jclouds.blobstore-test
|
||||||
(:use [org.jclouds.blobstore] :reload-all)
|
(:use [org.jclouds.blobstore] :reload-all)
|
||||||
(:use clojure.test)
|
(:use [clojure.test])
|
||||||
(:import [org.jclouds.blobstore BlobStoreContextFactory]
|
(:import [org.jclouds.blobstore BlobStoreContextFactory]
|
||||||
[java.io ByteArrayOutputStream]))
|
[java.io ByteArrayOutputStream]))
|
||||||
|
|
||||||
|
@ -65,11 +65,12 @@
|
||||||
(let [name "test"
|
(let [name "test"
|
||||||
container-name "test-container"
|
container-name "test-container"
|
||||||
data "test content"
|
data "test content"
|
||||||
baos (ByteArrayOutputStream.)]
|
data-file (java.io.File/createTempFile "jclouds" "data")]
|
||||||
(create-container container-name)
|
(try (create-container container-name)
|
||||||
(create-blob container-name name data)
|
(create-blob container-name name data)
|
||||||
(download-blob container-name name baos)
|
(download-blob container-name name data-file)
|
||||||
(is (= data (.toString baos)))))
|
(is (= data (slurp (.getAbsolutePath data-file))))
|
||||||
|
(finally (.delete data-file)))))
|
||||||
|
|
||||||
;; TODO: more tests involving blob-specific functions
|
;; TODO: more tests involving blob-specific functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue