Repository: jclouds Updated Branches: refs/heads/master e446b5b8b -> 0bc935dd5
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/compute/src/test/clojure/org/jclouds/compute2_test.clj ---------------------------------------------------------------------- diff --git a/compute/src/test/clojure/org/jclouds/compute2_test.clj b/compute/src/test/clojure/org/jclouds/compute2_test.clj deleted file mode 100644 index 379c26f..0000000 --- a/compute/src/test/clojure/org/jclouds/compute2_test.clj +++ /dev/null @@ -1,158 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.compute2-test - (:use [org.jclouds.compute2] :reload-all) - (:use clojure.test) - (:require [org.jclouds.ssh-test :as ssh-test]) - (:import - org.jclouds.compute.domain.OsFamily - java.net.InetAddress - org.jclouds.scriptbuilder.domain.Statements - org.jclouds.compute.options.TemplateOptions - org.jclouds.compute.options.TemplateOptions$Builder - org.jclouds.compute.options.RunScriptOptions - org.jclouds.compute.options.RunScriptOptions$Builder - org.jclouds.domain.LoginCredentials - java.util.NoSuchElementException - )) - -(defmacro with-private-vars [[ns fns] & tests] - "Refers private fns from ns and runs tests in context. From users mailing -list, Alan Dipert and MeikelBrandmeyer." - `(let ~(reduce #(conj %1 %2 `@(ns-resolve '~ns '~%2)) [] fns) - ~@tests)) - -(deftest os-families-test - (is (some #{"centos"} (map str (os-families))))) - -(def compute-stub (compute-service "stub" "compute2.clj" "" :extensions [(ssh-test/ssh-test-client ssh-test/no-op-ssh-client)])) - -(defn clean-stub-fixture - "This should allow basic tests to easily be run with another service." - [compute-service] - (fn [f] - (doseq [node (nodes compute-service)] - (destroy-node compute-service (.getId node))) - (f))) - -(use-fixtures :each (clean-stub-fixture compute-stub)) - -(deftest compute-service?-test - (is (compute-service? compute-stub))) - -(deftest as-compute-service-test - (is (compute-service? (compute-service "stub" "compute2.clj" ""))) - (is (compute-service? compute-stub)) - (is (compute-service? (compute-service (compute-context compute-stub))))) - -(deftest nodes-test - (is (create-node compute-stub "fred" (build-template compute-stub {} ))) - (is (= 1 (count (nodes-in-group compute-stub "fred")))) - ;; pass in a function that selects node metadata based on NodeMetadata field - (is (= 1 (count (nodes-with-details-matching compute-stub (in-group? "fred"))))) - ;; or make your query inline - (is (= 1 (count (nodes-with-details-matching compute-stub #(= (.getGroup %) "fred"))))) - ;; or get real fancy, and use the underlying Predicate object jclouds uses - (is (= 1 (count (nodes-with-details-matching compute-stub - (reify com.google.common.base.Predicate - (apply [this input] (= (.getGroup input) "fred"))))))) - (is (= 0 (count (nodes-with-details-matching compute-stub (in-group? "othergroup"))))) - (suspend-nodes-matching compute-stub (in-group? "fred")) - (is (suspended? (first (nodes-with-details-matching compute-stub (in-group? "fred"))))) - (resume-nodes-matching compute-stub (in-group? "fred")) - (is (running? (first (nodes-in-group compute-stub "fred")))) - (reboot-nodes-matching compute-stub (in-group? "fred")) - (is (running? (first (nodes-in-group compute-stub "fred")))) - (is (create-nodes compute-stub "fred" 2 (build-template compute-stub {} ))) - (is (= 3 (count (nodes-in-group compute-stub "fred")))) - (is (= "fred" (group (first (nodes compute-stub))))) - (destroy-nodes-matching compute-stub (in-group? "fred")) - (is (terminated? (first (nodes-in-group compute-stub "fred"))))) - -(defn localhost? [node] - "Returns true if the localhost address is in the node's private ips" - (seq? (some #(= "localhost" %) (private-ips node)))) - -(deftest compound-predicate-test - (is (create-node compute-stub "my-group" (build-template compute-stub {}))) - (is (= 0 (count (nodes-with-details-matching compute-stub #(and (suspended? %) (not (localhost? %))))))) - (is (= 0 (count (nodes-with-details-matching compute-stub #(and (suspended? %) (localhost? %)))))) - (is (= 0 (count (nodes-with-details-matching compute-stub #(and (running? %) (localhost? %)))))) - (is (= 1 (count (nodes-with-details-matching compute-stub #(and (running? %) (not (localhost? %)))))))) - -(deftest run-script-on-nodes-matching-with-options-test - (let [echo (Statements/exec "echo hello") - script-options (.. (RunScriptOptions$Builder/overrideLoginCredentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd"))) - (runAsRoot false) - (wrapInInitScript false)) - pred #(= (.getGroup %) "scriptednode")] - (is (create-node compute-stub "scriptednode" (build-template compute-stub {}))) - (is (run-script-on-nodes-matching compute-stub pred echo script-options)) - (is (thrown? NoSuchElementException - (run-script-on-nodes-matching compute-stub #(= (.getGroup %) "nonexistingnode") echo script-options))))) - -(deftest run-script-on-node-with-options-test - (let [echo (Statements/exec "echo hello") - script-options (.. (RunScriptOptions$Builder/overrideLoginCredentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd"))) - (runAsRoot false) - (wrapInInitScript false)) - test_node (create-node compute-stub "scriptednode" (build-template compute-stub {}))] - (is (run-script-on-node compute-stub (id test_node) echo script-options)) - (is (thrown? NoSuchElementException - (run-script-on-node compute-stub "nonexistingnode" echo script-options))))) - -(deftest build-template-test - (let [service (compute-service "stub" "compute2.clj" "")] - (testing "nullary" - (is (>= (-> (build-template service {:fastest true}) - bean :hardware bean :processors first bean :cores) - 8.0))) - (testing "one arg" - (is (> (-> (build-template service {:min-ram 512}) - bean :hardware bean :ram) - 512)) - (let [credentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd")) - f (juxt #(.identity %) #(.credential %)) - template (build-template - service - {:override-login-credentials credentials}) - node (create-node service "something" template)] - (is (= (-> node bean :credentials f) - (f credentials))) - (let [identity "fred" - f #(.identity %) - template (build-template service {:override-login-user identity}) - node (create-node service "something" template)] - (is (= (-> node bean :credentials f) identity))) - (let [credential "fred" - f #(.credential %) - template (build-template - service {:override-login-password credential}) - node (create-node service "something" template)] - (is (= (-> node bean :credentials f) credential))))) - (testing "enumerated" - (is (= OsFamily/CENTOS - (-> (build-template service {:os-family :centos}) - bean :image bean :operatingSystem bean :family)))) - (testing "varags" - (is (java.util.Arrays/equals - (int-array [22 8080]) - (-> (build-template service {:inbound-ports [22 8080]}) - bean :options bean :inboundPorts)))) - (testing "invalid" - (is (thrown? Exception (build-template service {:xx :yy})))))) http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/compute/src/test/clojure/org/jclouds/ssh_test.clj ---------------------------------------------------------------------- diff --git a/compute/src/test/clojure/org/jclouds/ssh_test.clj b/compute/src/test/clojure/org/jclouds/ssh_test.clj deleted file mode 100644 index 494c936..0000000 --- a/compute/src/test/clojure/org/jclouds/ssh_test.clj +++ /dev/null @@ -1,105 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.ssh-test - (:require - [clojure.tools.logging :as logging]) - (:import - org.jclouds.ssh.SshClient - org.jclouds.domain.Credentials - org.jclouds.domain.LoginCredentials - org.jclouds.io.Payload - com.google.common.net.HostAndPort - org.jclouds.compute.domain.ExecResponse)) - -(defn instantiate [impl-class & args] - (let [constructor (first - (filter - (fn [c] (= (count args) (count (.getParameterTypes c)))) - (.getDeclaredConstructors impl-class)))] - (.newInstance impl-class (object-array args)))) - - - - -;; define an instance or implementation of the following interfaces: - -(defn maybe-invoke [f & args] - (when f - (apply f args))) - -(defn default-exec - "Default exec function - replies to ./runscript status by returning 1" - [cmd] - (merge - {:exit (Integer. 0) :err "stderr" :out "stdout"} - (condp = cmd - "/tmp/init-bootstrap status" {:exit (Integer. 1) :out "[]"} - {}))) - - -(deftype NoOpClient - [socket username password] - SshClient - (connect [this]) - (disconnect [this]) - (exec [this cmd] - (logging/info (format "ssh cmd: %s" cmd)) - (let [response (default-exec cmd)] - (ExecResponse. (:out response) (:err response) (:exit response)))) - (get [this path] ) - (^void put [this ^String path ^String content]) - (^void put [this ^String path ^org.jclouds.io.Payload content]) - (getUsername [this] username) - (getHostAddress [this] (.getHostText socket)) ) - -(defn no-op-ssh-client - [socket username password] - (NoOpClient. socket username password)) - - -(deftype SshClientFactory - [factory-fn] - org.jclouds.ssh.SshClient$Factory - (^org.jclouds.ssh.SshClient - create - [_ ^HostAndPort socket ^LoginCredentials credentials] - (factory-fn socket (.identity credentials) (.credential credentials))) - ) - -(deftype Module - [factory binder] - com.google.inject.Module - (configure - [this abinder] - (reset! binder abinder) - (.. @binder (bind org.jclouds.ssh.SshClient$Factory) - (toInstance factory)))) - -(defn ssh-test-module - "Create a module that specifies the factory for creating a test service" - [factory] - (let [binder (atom nil)] - (Module. factory binder))) - -(defn ssh-test-client - "Create a module that can be passed to a compute-context, and which implements -an ssh client with the provided map of function implementations. Keys are -clojurefied versions of org.jclouds.ssh.SshClient's methods" - [factory-fn] - (ssh-test-module (SshClientFactory. factory-fn))) - http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 5c27f57..e806169 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -111,10 +111,6 @@ <build> <plugins> <plugin> - <groupId>com.theoryinpractise</groupId> - <artifactId>clojure-maven-plugin</artifactId> - </plugin> - <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/core/src/main/clojure/org/jclouds/core.clj ---------------------------------------------------------------------- diff --git a/core/src/main/clojure/org/jclouds/core.clj b/core/src/main/clojure/org/jclouds/core.clj deleted file mode 100644 index 766f142..0000000 --- a/core/src/main/clojure/org/jclouds/core.clj +++ /dev/null @@ -1,213 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.core - "Core functionality used across blobstore and compute." - (:use clojure.tools.logging) - (:import java.io.File - (com.google.common.collect ImmutableSet)) - (:require [clojure.string :as string])) - -(def ^{:dynamic :true} module-lookup - {:log4j 'org.jclouds.logging.log4j.config.Log4JLoggingModule - :slf4j 'org.jclouds.logging.slf4j.config.SLF4JLoggingModule - :lognull 'org.jclouds.logging.config.NullLoggingModule - :ssh 'org.jclouds.ssh.jsch.config.JschSshClientModule - :jsch 'org.jclouds.ssh.jsch.config.JschSshClientModule - :sshj 'org.jclouds.sshj.config.SshjSshClientModule - :enterprise 'org.jclouds.enterprise.config.EnterpriseConfigurationModule - :apachehc 'org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule - :okhttp 'org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule - :bouncycastle 'org.jclouds.encryption.bouncycastle.config.BouncyCastleCryptoModule - :joda 'org.jclouds.date.joda.config.JodaDateServiceModule - :gae 'org.jclouds.gae.config.GoogleAppEngineConfigurationModule}) - -(defn- instantiate [sym] - (let [loader (.getContextClassLoader (Thread/currentThread))] - (try - (.newInstance #^Class (.loadClass loader (name sym))) - (catch java.lang.ClassNotFoundException e - (warn (str "Could not find " (name sym) " module. -Ensure the module is on the classpath. You are maybe missing a dependency on - org.jclouds/jclouds-jsch - org.jclouds/jclouds-log4j - org.jclouds/jclouds-ning - or org.jclouds/jclouds-enterprise.")))))) - -(defn modules - "Build a list of modules suitable for passing to compute or blobstore context" - [& modules] - (.build #^com.google.common.collect.ImmutableSet$Builder - (reduce #(.add #^com.google.common.collect.ImmutableSet$Builder %1 %2) - (com.google.common.collect.ImmutableSet/builder) - (filter (complement nil?) - (map #(cond - (keyword? %) (-> % module-lookup instantiate) - (symbol? %) (instantiate %) - :else %) - modules))))) - -;;; Functions and macros to map keywords to java member functions -(defn dashed [a] - (apply - str (interpose "-" (map string/lower-case (re-seq #"[A-Z][^A-Z]*" a))))) - -(defn ^String map-str - "Apply f to each element of coll, concatenate all results into a - String." - [f coll] - (apply str (map f coll))) - -(defn camelize - "Takes a string, or anything named, and converts it to camel case - (capitalised initial component" - [a] - (map-str string/capitalize (.split (name a) "-"))) - -(defn camelize-mixed - "Takes a string, or anything named, and converts it to mixed camel case - (lower case initial component)" - [a] - (let [c (.split (name a) "-")] - (apply str (string/lower-case (first c)) (map string/capitalize (rest c))))) - -(defn kw-fn-symbol - "Converts a keyword into a camel cased symbol corresponding to a function - name" - [kw] - (symbol (camelize-mixed kw))) - -(defmacro memfn-apply - "Expands into a function that takes one argument," - [fn-name & args] - `(fn [target# [~@args]] - ((memfn ~fn-name ~@args) target# ~@args))) - -(defmacro kw-memfn - "Expands into code that creates a function that expects to be passed an - object and any args, and calls the instance method corresponding to - the camel cased version of the passed keyword, passing the arguments." - [kw & args] - `(memfn ~(kw-fn-symbol kw) ~@args)) - -(defmacro kw-memfn-apply - "Expands into code that creates a function that expects to be passed an object - and an arg vector containing the args, and calls the instance method - corresponding to the camel cased version of the passed keyword, passing the - arguments." - [kw & args] - `(fn [target# [~@args]] - ((memfn ~(kw-fn-symbol kw) ~@args) target# ~@args))) - -(defmacro kw-memfn-0arg - "Expands into code that creates a function that expects to be passed an - object, and calls the instance method corresponding to the camel cased - version of the passed keyword if the argument is non-nil." - [kw] - `(fn [target# arg#] - (if arg# - ((kw-memfn ~kw) target#) - target#))) - -(defmacro kw-memfn-1arg - "Expands into code that creates a function that expects to be passed an object - and an arg, and calls the instance method corresponding to the camel cased - version of the passed keyword, passing the argument." - [kw] - `(kw-memfn ~kw a#)) - -(defmacro kw-memfn-2arg - "Expands into code that creates a function that expects to be passed an object - and an arg vector containing 2 args, and calls the instance method - corresponding to the camel cased version of the passed keyword, passing the - arguments." - [kw] - `(kw-memfn-apply ~kw a# b#)) - -;; (defmacro memfn-overloads -;; "Construct a function that applies arguments to the given member function." -;; [name] -;; `(fn [target# args#] -;; (condp = (count args#) -;; 0 (. target# (~name)) -;; 1 (. target# (~name (first args#))) -;; 2 (. target# (~name (first args#) (second args#))) -;; 3 (. target# (~name (first args#) (second args#) (nth args# 2))) -;; 4 (. target# -;; (~name (first args#) (second args#) (nth args# 2) (nth args# 3))) -;; 5 (. target# -;; (~name (first args#) (second args#) (nth args# 2) (nth args# 3) -;; (nth args# 4))) -;; (throw -;; (java.lang.IllegalArgumentException. -;; (str -;; "too many arguments passed. Limit 5, passed " (count args#))))))) - -;; (defmacro kw-memfn-overloads -;; "Expands into code that creates a function that expects to be passed an -;; object and an arg vector, and calls the instance method corresponding to -;; the camel cased version of the passed keyword, passing the arguments. -;; The function accepts different arities at runtime." -;; [kw] -;; `(memfn-overloads ~(kw-fn-symbol kw))) - -(defmacro memfn-varargs - "Construct a function that applies an argument sequence to the given member - function, which accepts varargs. array-fn should accept a sequence and - return a suitable array for passing as varargs." - [name array-fn] - `(fn [target# args#] - (. target# - (~name - (if (or (seq? args#) (vector? args#)) (~array-fn args#) args#))))) - -(defmacro kw-memfn-varargs - "Expands into code that creates a function that expects to be passed an - object and an arg vector, and calls the instance method corresponding to - the camel cased version of the passed keyword, passing the arguments. - The function accepts different arities at runtime." - ([kw] `(kw-memfn-varargs ~kw int-array)) - ([kw array-fn] `(memfn-varargs ~(kw-fn-symbol kw) ~array-fn))) - -(defmacro make-option-map - "Builds a literal map from keyword, to a call on macro f with the keyword - as an argument." - [f keywords] - `(hash-map - ~@(reduce (fn [v# k#] (conj (conj v# k#) `(~f ~k#))) [] keywords))) - -(defmacro define-accessor - [class property obj-name] - (list 'defn (symbol (str obj-name "-" (name property))) - (vector (with-meta (symbol obj-name) {:tag (.getName class)})) - (list - (symbol (str ".get" (camelize (name property)))) - (symbol obj-name)))) - -(defmacro define-accessors - "Defines read accessors, modelled on class-name-property-name. If the second - argument is a string, it is used instead of the class-name prefix." - [class & properties] - (let [obj-name (if (string? (first properties)) - (first properties) - (dashed (.getName class))) - properties (if (string? (first properties)) - (rest properties) - properties)] - `(do - ~@(for [property properties] - `(define-accessor ~class ~property ~obj-name))))) http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/core/src/test/clojure/org/jclouds/core_test.clj ---------------------------------------------------------------------- diff --git a/core/src/test/clojure/org/jclouds/core_test.clj b/core/src/test/clojure/org/jclouds/core_test.clj deleted file mode 100644 index eba4f5c..0000000 --- a/core/src/test/clojure/org/jclouds/core_test.clj +++ /dev/null @@ -1,78 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.core-test - (:use - org.jclouds.core - clojure.test)) - -(defmacro with-private-vars [[ns fns] & tests] - "Refers private fns from ns and runs tests in context. From users mailing -list, Alan Dipert and MeikelBrandmeyer." - `(let ~(reduce #(conj %1 %2 `@(ns-resolve '~ns '~%2)) [] fns) - ~@tests)) - -(with-private-vars [org.jclouds.core [instantiate]] - (deftest instantiate-test - (is (instance? String (instantiate 'java.lang.String))))) - -(deftest modules-empty-test - (is (.isEmpty (modules)))) - -(deftest modules-instantiate-test - (binding [module-lookup - (assoc module-lookup - :string 'java.lang.String)] - (is (instance? String (first (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 - (binding [module-lookup - (assoc module-lookup - :non-existing 'this.doesnt.Exist)] - (is (.isEmpty (modules :non-existing))))) - -(deftest kw-fn-symbol-test - (is (= 'aB (kw-fn-symbol :a-b)))) - - -(deftest memfn-apply-test - (is (= "Ab" ((memfn-apply concat s) "A" ["b"]))) - (is (= "Ac" ((memfn-apply replace a b) "Ab" ["b" "c"])))) - -(deftest kw-memfn-test - (is (= "a" ((kw-memfn :to-lower-case) "A"))) - (is (= "Ab" ((kw-memfn :concat s) "A" "b"))) - (is (= "Ab" ((kw-memfn-apply :concat s) "A" ["b"]))) - (is (= "Ac" ((kw-memfn-apply :replace a b) "Ab" ["b" "c"])))) - -(deftest kw-memfn-0arg-test - (is (= "a" ((kw-memfn-0arg :to-lower-case) "A" true))) - (is (= "A" ((kw-memfn-0arg :to-lower-case) "A" nil)))) - -(deftest kw-memfn-1arg-test - (is (= "Ab" ((kw-memfn-1arg :concat) "A" "b")))) - -(deftest kw-memfn-2arg-test - (is (= "Ac" ((kw-memfn-2arg :replace) "Ab" ["b" "c"])))) - -(deftest kw-memfn-varargs-test - (is (fn? (kw-memfn-varargs :replace)))) http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/project/pom.xml ---------------------------------------------------------------------- diff --git a/project/pom.xml b/project/pom.xml index 24cbab1..33a19ba 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -221,7 +221,6 @@ <maven.compile.target>1.6</maven.compile.target> <maven.compile.deprecation>true</maven.compile.deprecation> <maven.site.url.base>gitsite:[email protected]/jclouds/jclouds-maven-site.git</maven.site.url.base> - <clojure.version>1.3.0</clojure.version> <guava.version>16.0.1</guava.version> <guava.osgi.import>com.google.common.*;version="[16.0.1,20.0.0)"</guava.osgi.import> <guice.version>3.0</guice.version> @@ -250,21 +249,6 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.clojure</groupId> - <artifactId>clojure</artifactId> - <version>${clojure.version}</version> - </dependency> - <dependency> - <groupId>org.clojure</groupId> - <artifactId>tools.logging</artifactId> - <version>0.2.3</version> - </dependency> - <dependency> - <groupId>org.clojure</groupId> - <artifactId>core.incubator</artifactId> - <version>0.1.0</version> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> @@ -394,21 +378,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.clojure</groupId> - <artifactId>clojure</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.clojure</groupId> - <artifactId>tools.logging</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.clojure</groupId> - <artifactId>core.incubator</artifactId> - <optional>true</optional> - </dependency> - <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <scope>test</scope> @@ -423,9 +392,6 @@ <build> <resources> <resource> - <directory>src/main/clojure</directory> - </resource> - <resource> <directory>src/main/resources</directory> </resource> <!-- For AutoService generated services. --> @@ -438,9 +404,6 @@ </resources> <testResources> <testResource> - <directory>src/test/clojure</directory> - </testResource> - <testResource> <directory>src/test/resources</directory> </testResource> </testResources> @@ -1129,32 +1092,6 @@ <version>1.2</version> </plugin> <plugin> - <groupId>com.theoryinpractise</groupId> - <artifactId>clojure-maven-plugin</artifactId> - <version>1.3.10</version> - <configuration> - <sourceDirectories> - <sourceDirectory>src/main/clojure</sourceDirectory> - </sourceDirectories> - <testSourceDirectories> - <testSourceDirectory>src/test/clojure</testSourceDirectory> - </testSourceDirectories> - <clojureOptions>-Xms128m -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=256m -Xss256k</clojureOptions> - <warnOnReflection>true</warnOnReflection> - <compileDeclaredNamespaceOnly>true</compileDeclaredNamespaceOnly> - <testDeclaredNamespaceOnly>false</testDeclaredNamespaceOnly> - </configuration> - <executions> - <execution> - <id>test-clojure</id> - <phase>test</phase> - <goals> - <goal>test</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9</version> http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/providers/aws-ec2/pom.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/pom.xml b/providers/aws-ec2/pom.xml index 9553a38..2d72bf1 100644 --- a/providers/aws-ec2/pom.xml +++ b/providers/aws-ec2/pom.xml @@ -125,15 +125,6 @@ </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>com.theoryinpractise</groupId> - <artifactId>clojure-maven-plugin</artifactId> - </plugin> - </plugins> - </build> - <profiles> <profile> <id>live</id> http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/providers/aws-ec2/src/main/clojure/org/jclouds/aws/ec2.clj ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/main/clojure/org/jclouds/aws/ec2.clj b/providers/aws-ec2/src/main/clojure/org/jclouds/aws/ec2.clj deleted file mode 100644 index 7bacecc..0000000 --- a/providers/aws-ec2/src/main/clojure/org/jclouds/aws/ec2.clj +++ /dev/null @@ -1,62 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.aws.ec2 - "AWS EC2 specific functionality" - (:require - [org.jclouds.core :as core]) - (:import - org.jclouds.aws.ec2.domain.SpotInstanceRequest - org.jclouds.aws.ec2.options.RequestSpotInstancesOptions)) - -(def - ^{:doc "TemplateBuilder functions" :private true} - spot-option-map - (core/make-option-map - core/kw-memfn-1arg - [:valid-from :valid-until :type :launch-group :availability-zone-group])) - -(defn spot-types [] - (. org.jclouds.aws.ec2.domain.SpotInstanceRequest$Type values)) - -(def enum-map {:type (spot-types)}) - -(defn translate-enum-value [kword value] - (or (-> (filter #(= (name value) (str %)) (kword enum-map)) first) - value)) - -(defn apply-option - [options [option value]] - (when-let [f (spot-option-map option)] - (f options (translate-enum-value option value))) - options) - -(defn spot-options - "Build a spot request options object, for passing to the :spot-options - key of the template builder options. - - Takes a hash-map of keys and values that correspond to the methods of - RequestSpotInstancesOptions. - - Options are: - :valid-from :valid-until :type :launch-group :availability-zone-group - - :type takes either :one-time or :persistent" - [request-map] - (reduce - apply-option - (RequestSpotInstancesOptions.) request-map)) http://git-wip-us.apache.org/repos/asf/jclouds/blob/0bc935dd/providers/aws-ec2/src/test/clojure/org/jclouds/aws/ec2_test.clj ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/clojure/org/jclouds/aws/ec2_test.clj b/providers/aws-ec2/src/test/clojure/org/jclouds/aws/ec2_test.clj deleted file mode 100644 index bd00ef7..0000000 --- a/providers/aws-ec2/src/test/clojure/org/jclouds/aws/ec2_test.clj +++ /dev/null @@ -1,32 +0,0 @@ -; -; Licensed to the Apache Software Foundation (ASF) under one or more -; contributor license agreements. See the NOTICE file distributed with -; this work for additional information regarding copyright ownership. -; The ASF licenses this file to You under the Apache License, Version 2.0 -; (the "License"); you may not use this file except in compliance with -; the License. You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; - -(ns org.jclouds.aws.ec2-test - (:use - org.jclouds.aws.ec2 - clojure.test)) - -(deftest translate-enum-value-test - (is (= org.jclouds.aws.ec2.domain.SpotInstanceRequest$Type/ONE_TIME - (org.jclouds.aws.ec2/translate-enum-value :type :one-time)))) - -(deftest spot-options-est - (is (spot-options {:type :one-time - :valid-from (java.util.Date.) - :valid-until (java.util.Date.) - :launch-group "lg" - :availability-zone-group "ag"})))
