aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/clojure/clojure/contrib/jmx/data.clj4
-rw-r--r--src/test/clojure/clojure/contrib/test_jmx.clj11
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/clojure/clojure/contrib/jmx/data.clj b/src/main/clojure/clojure/contrib/jmx/data.clj
index 3a4c5275..8a914270 100644
--- a/src/main/clojure/clojure/contrib/jmx/data.clj
+++ b/src/main/clojure/clojure/contrib/jmx/data.clj
@@ -20,8 +20,8 @@
"Build a JMX URL from options."
([] (jmx-url {}))
([overrides]
- (let [opts (merge {:host "localhost", :port "3000"} overrides)]
- (format "service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi" (opts :host) (opts :port)))))
+ (let [opts (merge {:host "localhost", :port "3000", :jndi-path "jmxrmi"} overrides)]
+ (format "service:jmx:rmi:///jndi/rmi://%s:%s/%s" (opts :host) (opts :port) (opts :jndi-path)))))
(defmulti as-object-name
"Interpret an object as a JMX ObjectName."
diff --git a/src/test/clojure/clojure/contrib/test_jmx.clj b/src/test/clojure/clojure/contrib/test_jmx.clj
index d54a477b..24d6b975 100644
--- a/src/test/clojure/clojure/contrib/test_jmx.clj
+++ b/src/test/clojure/clojure/contrib/test_jmx.clj
@@ -117,9 +117,14 @@
(deftest test-jmx-url
(testing "creates default url"
- (is (= "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi" (jmx/jmx-url))))
+ (is (= "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi"
+ (jmx/jmx-url))))
(testing "creates custom url"
- (is (= "service:jmx:rmi:///jndi/rmi://example.com:4000/jmxrmi" (jmx/jmx-url {:host "example.com" :port 4000})))))
+ (is (= "service:jmx:rmi:///jndi/rmi://example.com:4000/jmxrmi"
+ (jmx/jmx-url {:host "example.com" :port 4000}))))
+ (testing "creates custom jndi path"
+ (is (= "service:jmx:rmi:///jndi/rmi://example.com:4000/jmxconnector"
+ (jmx/jmx-url {:host "example.com" :port 4000 :jndi-path "jmxconnector"})))))
;; ----------------------------------------------------------------------
;; tests for clojure.contrib.jmx.Bean.
@@ -163,4 +168,4 @@
"int" 10
"boolean" false
"java.lang.String" "foo"
- "long" (long 10))) \ No newline at end of file
+ "long" (long 10)))