Added passing of constucted modules to compute-service options

This commit is contained in:
Hugo Duncan 2010-07-19 16:31:25 -04:00
parent 887bb7adfe
commit 2fd0ac55b5
2 changed files with 10 additions and 2 deletions

View File

@ -57,7 +57,11 @@ Ensure the module is on the classpath. You are maybe missing a dependency on
(reduce #(.add #^com.google.common.collect.ImmutableSet$Builder %1 %2) (reduce #(.add #^com.google.common.collect.ImmutableSet$Builder %1 %2)
(com.google.common.collect.ImmutableSet/builder) (com.google.common.collect.ImmutableSet/builder)
(filter (complement nil?) (filter (complement nil?)
(map (comp instantiate module-lookup) modules))))) (map #(cond
(keyword? %) (-> % module-lookup instantiate)
(symbol? %) (instantiate %)
:else %)
modules)))))
(defn dashed [a] (defn dashed [a]
(apply str (interpose "-" (map string/lower-case (re-seq #"[A-Z][^A-Z]*" a))))) (apply str (interpose "-" (map string/lower-case (re-seq #"[A-Z][^A-Z]*" a)))))

View File

@ -38,7 +38,11 @@ list, Alan Dipert and MeikelBrandmeyer."
(assoc module-lookup (assoc module-lookup
:string 'java.lang.String)] :string 'java.lang.String)]
(is (instance? String (first (modules :string)))) (is (instance? String (first (modules :string))))
(is (= 1 (count (modules :string)))))) (is (= 1 (count (modules :string)))))
(testing "pre-instantiated"
(is (instance? String (first (modules "string")))))
(testing "symbol"
(is (instance? String (first (modules 'java.lang.String))))))
(deftest modules-instantiate-fail-test (deftest modules-instantiate-fail-test
(binding [module-lookup (binding [module-lookup