From 57f0dcaf1558379b4f5d9e5d138d46b621906f78 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Mon, 4 Apr 2011 15:54:35 -0500 Subject: [PATCH] Add another arity to list-blobs so that it can be called without the blobstore argument. Also add some basic tests for list-blobs-test. --- blobstore/src/main/clojure/org/jclouds/blobstore.clj | 10 ++++++---- .../src/test/clojure/org/jclouds/blobstore_test.clj | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/blobstore/src/main/clojure/org/jclouds/blobstore.clj b/blobstore/src/main/clojure/org/jclouds/blobstore.clj index 91bc83f417..e65c9ad32e 100644 --- a/blobstore/src/main/clojure/org/jclouds/blobstore.clj +++ b/blobstore/src/main/clojure/org/jclouds/blobstore.clj @@ -169,10 +169,12 @@ Note: (apply concat coll) or (lazy-cat coll) are not lazy wrt coll itself." (defn list-blobs "Returns a lazy seq of all blobs in the given container." - ([container prefix #^BlobStore blobstore] - (concat-elements (list-blobs-chunks container prefix blobstore :start))) - ([container #^BlobStore blobstore] - (list-blobs container nil blobstore))) + ([container] + (list-blobs container *blobstore*)) + ([container blobstore] + (list-blobs container nil blobstore)) + ([container prefix blobstore] + (concat-elements (list-blobs-chunks container prefix blobstore :start)))) (defn locations "Retrieve the available container locations for the blobstore context." diff --git a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj index 1a347a7d1c..360f4ad5d2 100644 --- a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj +++ b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj @@ -77,6 +77,11 @@ (is (= 3 (count (list-container "container" :with-details true)))) (is (= 1 (count (list-container "container" :in-directory "dir"))))) +(deftest list-blobs-test + (is (create-container "container")) + (is (empty? (list-blobs "container"))) + (is (empty? (list-blobs "container" "/a" *blobstore*)))) + (deftest get-blob-test (is (create-container "blob")) (is (upload-blob "blob" "blob1" "blob1"))