mirror of https://github.com/apache/jclouds.git
Update put-blob to new multipart API and add test.
How to do multipart on a put changed after the previous commit.
This commit is contained in:
parent
27189fba21
commit
a9f99f1b4e
|
@ -47,7 +47,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
[org.jclouds.blobstore
|
[org.jclouds.blobstore
|
||||||
AsyncBlobStore domain.BlobBuilder BlobStore BlobStoreContext
|
AsyncBlobStore domain.BlobBuilder BlobStore BlobStoreContext
|
||||||
BlobStoreContextFactory domain.BlobMetadata domain.StorageMetadata
|
BlobStoreContextFactory domain.BlobMetadata domain.StorageMetadata
|
||||||
domain.Blob domain.internal.BlobBuilderImpl
|
domain.Blob domain.internal.BlobBuilderImpl options.PutOptions
|
||||||
|
options.PutOptions$Builder
|
||||||
options.CreateContainerOptions options.ListContainerOptions]
|
options.CreateContainerOptions options.ListContainerOptions]
|
||||||
org.jclouds.io.Payloads
|
org.jclouds.io.Payloads
|
||||||
java.util.Arrays
|
java.util.Arrays
|
||||||
|
@ -225,9 +226,10 @@ Options can also be specified for extension modules
|
||||||
(defn put-blob
|
(defn put-blob
|
||||||
"Put a blob. Metadata in the blob determines location."
|
"Put a blob. Metadata in the blob determines location."
|
||||||
[^BlobStore blobstore container-name blob & {:keys [multipart?]}]
|
[^BlobStore blobstore container-name blob & {:keys [multipart?]}]
|
||||||
(if multipart?
|
(let [options (if multipart?
|
||||||
(.putBlobMultipart blobstore container-name blob)
|
(PutOptions$Builder/multipart)
|
||||||
(.putBlob blobstore container-name blob)))
|
(PutOptions.))]
|
||||||
|
(.putBlob blobstore container-name blob options)))
|
||||||
|
|
||||||
(defn blob-metadata
|
(defn blob-metadata
|
||||||
"Get metadata from given path"
|
"Get metadata from given path"
|
||||||
|
|
|
@ -107,6 +107,14 @@
|
||||||
(is (= "blob2" (Strings2/toStringAndClose (get-blob-stream *blobstore*
|
(is (= "blob2" (Strings2/toStringAndClose (get-blob-stream *blobstore*
|
||||||
"blob" "blob2")))))
|
"blob" "blob2")))))
|
||||||
|
|
||||||
|
(deftest put-blob-test
|
||||||
|
;; Check multipart works
|
||||||
|
(is (create-container *blobstore* "blobs"))
|
||||||
|
(is (put-blob *blobstore* "blobs"
|
||||||
|
(blob "blob1" :payload "blob1")
|
||||||
|
:multipart? true))
|
||||||
|
(is (= 1 (count (blobs *blobstore* "blobs")))))
|
||||||
|
|
||||||
(deftest sign-get-test
|
(deftest sign-get-test
|
||||||
(let [request (sign-get *blobstore* "container" "path")]
|
(let [request (sign-get *blobstore* "container" "path")]
|
||||||
(is (= "http://localhost/container/path" (str (.getEndpoint request))))
|
(is (= "http://localhost/container/path" (str (.getEndpoint request))))
|
||||||
|
|
Loading…
Reference in New Issue