mirror of https://github.com/apache/jclouds.git
Rename create-blob to upload-blob.
This commit is contained in:
parent
94b6efe802
commit
91f09690b6
|
@ -237,11 +237,11 @@ example:
|
|||
(.list (as-blobstore blobstore) container-name
|
||||
(.inDirectory (new ListContainerOptions) dir))))
|
||||
|
||||
(defn create-blob
|
||||
(defn upload-blob
|
||||
"Create an blob representing text data:
|
||||
container, name, string -> etag"
|
||||
([container-name name data] ;; TODO: allow payload to be a stream
|
||||
(create-blob container-name name data *blobstore*))
|
||||
(upload-blob container-name name data *blobstore*))
|
||||
([container-name name data blobstore]
|
||||
(put-blob container-name
|
||||
(doto (.newBlob blobstore name)
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
(deftest list-container-test
|
||||
(is (create-container "container"))
|
||||
(is (empty? (list-container "container")))
|
||||
(is (create-blob "container" "blob1" "blob1"))
|
||||
(is (create-blob "container" "blob2" "blob2"))
|
||||
(is (upload-blob "container" "blob1" "blob1"))
|
||||
(is (upload-blob "container" "blob2" "blob2"))
|
||||
(is (= 2 (count (list-container "container"))))
|
||||
(is (= 1 (count (list-container "container" :max-results 1))))
|
||||
(create-directory "container" "dir")
|
||||
(is (create-blob "container" "dir/blob2" "blob2"))
|
||||
(is (upload-blob "container" "dir/blob2" "blob2"))
|
||||
(is (= 3 (count (list-container "container"))))
|
||||
(is (= 4 (count (list-container "container" :recursive))))
|
||||
(is (= 1 (count (list-container "container" :in-directory "dir")))))
|
||||
|
@ -57,7 +57,7 @@
|
|||
data "test content"
|
||||
data-file (java.io.File/createTempFile "jclouds" "data")]
|
||||
(try (create-container container-name)
|
||||
(create-blob container-name name data)
|
||||
(upload-blob container-name name data)
|
||||
(download-blob container-name name data-file)
|
||||
(is (= data (slurp (.getAbsolutePath data-file))))
|
||||
(finally (.delete data-file)))))
|
||||
|
@ -74,7 +74,7 @@
|
|||
data "test content"
|
||||
data-file (java.io.File/createTempFile "jclouds" "data")]
|
||||
(try (create-container container-name)
|
||||
(create-blob container-name name data)
|
||||
(upload-blob container-name name data)
|
||||
(is (thrown? Exception
|
||||
(download-blob container-name name data-file)))
|
||||
(finally (.delete data-file))))))
|
||||
|
@ -92,7 +92,7 @@
|
|||
(when-not (blob-exists? container-name name)
|
||||
(let [data-stream (java.io.ByteArrayOutputStream.)]
|
||||
(dotimes [i 5000000] (.write data-stream i))
|
||||
(create-blob container-name name (.toByteArray data-stream))))
|
||||
(upload-blob container-name name (.toByteArray data-stream))))
|
||||
|
||||
;; download
|
||||
(let [total (atom total-downloads)]
|
||||
|
|
Loading…
Reference in New Issue