diff --git a/deps.edn b/deps.edn index d6b1c50..63dcd5e 100644 --- a/deps.edn +++ b/deps.edn @@ -21,7 +21,8 @@ :1.11 {:override-deps {org.clojure/clojure {:mvn/version "1.11.0-alpha1"}}} :test {:extra-paths ["test" "test_resources"] - :extra-deps {clj-http/clj-http {:mvn/version "3.12.2"}}} + :extra-deps {clj-http/clj-http {:mvn/version "3.12.2"} + test/jar {:local/root "./test_resources/test.jar"}}} :runner {:extra-deps {io.github.cognitect-labs/test-runner {:git/url "https://github.com/cognitect-labs/test-runner" diff --git a/pom.xml b/pom.xml index 26ccbb6..a436499 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.xapix paos - 0.2.5 + 0.2.6-SNAPSHOT paos diff --git a/src/paos/wsdl.clj b/src/paos/wsdl.clj index 76692b0..d7c909e 100644 --- a/src/paos/wsdl.clj +++ b/src/paos/wsdl.clj @@ -66,7 +66,7 @@ (defn net-url->wsdl [net-url] (-> net-url - (java.net.URL.) + (io/as-url) make-wsdl)) (defn wsdl-content->wsdl [wsdl-content] @@ -80,11 +80,14 @@ (defn ->wsdl [path-or-content] (cond - (.exists (io/file path-or-content)) + (try + (.exists (io/file path-or-content)) + (catch IllegalArgumentException e + false)) (file->wsdl path-or-content) (try - (java.net.URL. path-or-content) + (io/as-url path-or-content) (catch MalformedURLException e false)) (net-url->wsdl path-or-content) diff --git a/test/paos/wsdl_test.clj b/test/paos/wsdl_test.clj new file mode 100644 index 0000000..7fd088b --- /dev/null +++ b/test/paos/wsdl_test.clj @@ -0,0 +1,8 @@ +(ns paos.wsdl-test + (:require [paos.wsdl :as sut] + [clojure.test :as t] + [clojure.java.io :as io])) + +(t/deftest parse-from-jar + (t/is (map? (sut/parse (io/resource "hello.wsdl"))) + "should be able to parse from URL to classpath JAR")) diff --git a/test_resources/test.jar b/test_resources/test.jar new file mode 100644 index 0000000..cca4c41 Binary files /dev/null and b/test_resources/test.jar differ