Add override-login-user-with and override-login-credential-with to clojure apis

The tests for these currently fail.
This commit is contained in:
Hugo Duncan 2011-09-02 17:04:09 -04:00
parent d97a5a9f0c
commit 9a17a48b7b
4 changed files with 46 additions and 5 deletions

View File

@ -396,10 +396,12 @@ See http://code.google.com/p/jclouds for details."
(make-option-map (make-option-map
kw-memfn-1arg kw-memfn-1arg
[:run-script :install-private-key :authorize-public-key [:run-script :install-private-key :authorize-public-key
:override-credentials-with :override-login-user-with
:override-login-credential-with
;; aws ec2 options ;; aws ec2 options
:spot-price :spot-options :placement-group :subnet-id :spot-price :spot-options :placement-group :subnet-id
:block-device-mappings :unmapDeviceNamed :security-groups :block-device-mappings :unmapDeviceNamed :security-groups
:key-pair :user-data :override-credentials-with]) :key-pair :user-data])
(make-option-map kw-memfn-varargs [:inbound-ports]) (make-option-map kw-memfn-varargs [:inbound-ports])
(make-option-map (make-option-map
kw-memfn-2arg kw-memfn-2arg

View File

@ -349,11 +349,12 @@ Here's an example of creating and running a small linux node in the group webser
(make-option-map (make-option-map
kw-memfn-1arg kw-memfn-1arg
[:run-script :install-private-key :authorize-public-key [:run-script :install-private-key :authorize-public-key
:override-credentials-with :override-login-user-with
:override-login-credential-with
;; aws ec2 options ;; aws ec2 options
:spot-price :spot-options :placement-group :subnet-id :spot-price :spot-options :placement-group :subnet-id
:block-device-mappings :unmapDeviceNamed :security-groups :block-device-mappings :unmapDeviceNamed :security-groups
:key-pair :user-data :key-pair :user-data])
:override-credentials-with])
(make-option-map kw-memfn-varargs [:inbound-ports]) (make-option-map kw-memfn-varargs [:inbound-ports])
(make-option-map (make-option-map
kw-memfn-2arg kw-memfn-2arg

View File

@ -128,7 +128,27 @@ list, Alan Dipert and MeikelBrandmeyer."
(testing "one arg" (testing "one arg"
(is (> (-> (build-template service {:min-ram 512}) (is (> (-> (build-template service {:min-ram 512})
bean :hardware bean :ram) bean :hardware bean :ram)
512))) 512))
(let [credentials (org.jclouds.domain.Credentials. "user" "pwd")
f (juxt #(.identity %) #(.credential %))
template (build-template
service
{:override-credentials-with credentials})
node (create-node service "something" template)]
(is (= (-> node bean :credentials f)
(f credentials)))
(let [credentials (org.jclouds.domain.Credentials. "user" "pwd")
f #(.identity %)
template (build-template service {:override-login-user-with "fred"})
node (create-node service "something" template)]
(is (= (-> node bean :credentials f)
(f credentials))))
(let [credential "fred"
f #(.credential %)
template (build-template
service {:override-login-credential-with credential})
node (create-node service "something" template)]
(is (= (-> node bean :credentials f) credential)))))
(testing "enumerated" (testing "enumerated"
(is (= OsFamily/CENTOS (is (= OsFamily/CENTOS
(-> (build-template service {:os-family :centos}) (-> (build-template service {:os-family :centos})

View File

@ -99,7 +99,25 @@ list, Alan Dipert and MeikelBrandmeyer."
(testing "one arg" (testing "one arg"
(is (> (-> (build-template service {:min-ram 512}) (is (> (-> (build-template service {:min-ram 512})
bean :hardware bean :ram) bean :hardware bean :ram)
512))) 512))
(let [credentials (org.jclouds.domain.Credentials. "user" "pwd")
f (juxt #(.identity %) #(.credential %))
template (build-template
service {:override-credentials-with credentials})
node (create-node "something" template service)]
(is (= (-> node bean :credentials f)
(f credentials))))
(let [user "fred"
f #(.identity %)
template (build-template service {:override-login-user-with user})
node (create-node "something" template service)]
(is (= (-> node bean :credentials f) user)))
(let [credential "fred"
f #(.credential %)
template (build-template
service {:override-login-credential-with credential})
node (create-node "something" template service)]
(is (= (-> node bean :credentials f) credential))))
(testing "enumerated" (testing "enumerated"
(is (= OsFamily/CENTOS (is (= OsFamily/CENTOS
(-> (build-template service {:os-family :centos}) (-> (build-template service {:os-family :centos})