Fix File method of download-blob multimethod.

This commit is contained in:
Phil Hagelberg 2010-03-09 17:01:24 -08:00
parent 5311b05192
commit 9ba88797a0
2 changed files with 8 additions and 7 deletions

View File

@ -258,7 +258,7 @@ container, name, string -> etag
(copy (.getContent blob) 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
location-id uri last-modfied)

View File

@ -1,6 +1,6 @@
(ns org.jclouds.blobstore-test
(:use [org.jclouds.blobstore] :reload-all)
(:use clojure.test)
(:use [clojure.test])
(:import [org.jclouds.blobstore BlobStoreContextFactory]
[java.io ByteArrayOutputStream]))
@ -65,11 +65,12 @@
(let [name "test"
container-name "test-container"
data "test content"
baos (ByteArrayOutputStream.)]
(create-container container-name)
data-file (java.io.File/createTempFile "jclouds" "data")]
(try (create-container container-name)
(create-blob container-name name data)
(download-blob container-name name baos)
(is (= data (.toString baos)))))
(download-blob container-name name data-file)
(is (= data (slurp (.getAbsolutePath data-file))))
(finally (.delete data-file)))))
;; TODO: more tests involving blob-specific functions