jmx4r 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +2 -2
  2. data/lib/jmx4r.rb +7 -1
  3. data/test/tc_connection.rb +23 -0
  4. metadata +16 -10
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rubygems"
6
6
 
7
7
  dir = File.dirname(__FILE__)
8
8
  lib = File.join(dir, "lib", "jmx4r.rb")
9
- version = "0.0.4"
9
+ version = "0.0.5"
10
10
 
11
11
  task :default => [:test]
12
12
 
@@ -38,7 +38,7 @@ spec = Gem::Specification.new do |spec|
38
38
  spec.summary = "jmx4r is a JMX library for JRuby"
39
39
  spec.files = Dir.glob("{examples,lib,test}/**/*.rb") + ["Rakefile"]
40
40
 
41
- spec.test_suite_file = "test/ts_all.rb"
41
+ spec.test_files = "test/ts_all.rb"
42
42
  spec.has_rdoc = true
43
43
  spec.extra_rdoc_files = %w{README.txt LICENSE.txt}
44
44
  spec.rdoc_options << '--title' << 'jmx4r Documentation' <<
data/lib/jmx4r.rb CHANGED
@@ -110,6 +110,10 @@ module JMX
110
110
  #
111
111
  # [:host] the host of the MBean server (defaults to "localhost")
112
112
  # [:port] the port of the MBean server (defaults to 3000)
113
+ # [:url] the url of the MBean server.
114
+ # No default.
115
+ # if the url is specified, the host & port parameters are
116
+ # not taken into account
113
117
  # [:username] the name of the user (if the MBean server requires authentication).
114
118
  # No default
115
119
  # [:password] the password of the user (if the MBean server requires authentication).
@@ -125,7 +129,9 @@ module JMX
125
129
  password = args[:password]
126
130
  credentials = args[:credentials]
127
131
 
128
- url = "service:jmx:rmi:///jndi/rmi://#{host}:#{port}/jmxrmi"
132
+ # host & port are not taken into account if url is set (see issue #7)
133
+ standard_url = "service:jmx:rmi:///jndi/rmi://#{host}:#{port}/jmxrmi"
134
+ url = args[:url] || standard_url
129
135
 
130
136
  unless credentials
131
137
  if !username.nil? and username.length > 0
@@ -39,4 +39,27 @@ class TestConnection < Test::Unit::TestCase
39
39
  JConsole::stop 3001
40
40
  end
41
41
  end
42
+
43
+ def test_establish_connection_with_custom_url
44
+ begin
45
+ JConsole::start :port => 3001
46
+ url = "service:jmx:rmi:///jndi/rmi://localhost:3001/jmxrmi"
47
+ JMX::MBean.establish_connection :url => url
48
+ ensure
49
+ JConsole::stop 3001
50
+ end
51
+ end
52
+
53
+ def test_establish_connection_with_custom_url_overrides_host_and_port
54
+ begin
55
+ JConsole::start :port => 3001
56
+ good_url = "service:jmx:rmi:///jndi/rmi://localhost:3001/jmxrmi"
57
+ bad_port = 3000
58
+ # specifying a :url discards the :port & :host parameters
59
+ JMX::MBean.establish_connection :port => bad_port, :url => good_url
60
+ ensure
61
+ JConsole::stop 3001
62
+ end
63
+ end
64
+
42
65
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
- homepage: http://code.google.com/p/jmx4r/
3
2
  extensions: []
3
+ homepage: http://code.google.com/p/jmx4r/
4
4
  executables: []
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.4
6
+ version: 0.0.5
7
7
  post_install_message:
8
- date: 2007-07-26 22:00:00 +00:00
8
+ date: 2008-04-11 22:00:00 +00:00
9
9
  files:
10
10
  - examples/class_loading.rb
11
11
  - examples/jvm_mngmt.rb
@@ -24,36 +24,42 @@ files:
24
24
  - Rakefile
25
25
  - README.txt
26
26
  - LICENSE.txt
27
- rubygems_version: 0.9.4
27
+ rubygems_version: 1.0.1
28
28
  rdoc_options:
29
29
  - --title
30
30
  - jmx4r Documentation
31
31
  - --main
32
32
  - README.txt
33
33
  signing_key:
34
- cert_chain:
34
+ cert_chain: []
35
35
  name: jmx4r
36
36
  has_rdoc: true
37
37
  platform: ruby
38
38
  summary: jmx4r is a JMX library for JRuby
39
39
  default_executable:
40
40
  bindir: bin
41
- required_ruby_version: !ruby/object:Gem::Version::Requirement
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version:
43
43
  requirements:
44
- - - '>'
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.0.0
46
+ version: !str 0
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ version:
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: !str 0
47
53
  require_paths:
48
54
  - lib
49
- specification_version: 1
55
+ specification_version: 2
50
56
  test_files:
51
57
  - test/ts_all.rb
52
58
  dependencies: []
53
59
  description: jmx4r is a JMX library for JRuby
60
+ email: jmesnil@gmail.com
54
61
  authors:
55
62
  - Jeff Mesnil
56
- email: jmesnil@gmail.com
57
63
  extra_rdoc_files:
58
64
  - README.txt
59
65
  - LICENSE.txt