jruby-jms 1.1.0-java → 1.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +24 -7
  3. data/README.md +49 -49
  4. data/Rakefile +17 -12
  5. data/lib/jms.rb +8 -17
  6. data/lib/jms/bytes_message.rb +3 -19
  7. data/lib/jms/connection.rb +63 -83
  8. data/lib/jms/map_message.rb +9 -25
  9. data/lib/jms/message.rb +22 -173
  10. data/lib/jms/message_consumer.rb +23 -35
  11. data/lib/jms/message_listener_impl.rb +22 -38
  12. data/lib/jms/message_producer.rb +9 -25
  13. data/lib/jms/mq_workaround.rb +11 -26
  14. data/lib/jms/object_message.rb +1 -17
  15. data/lib/jms/oracle_a_q_connection_factory.rb +4 -21
  16. data/lib/jms/queue_browser.rb +2 -18
  17. data/lib/jms/session.rb +92 -106
  18. data/lib/jms/session_pool.rb +34 -41
  19. data/lib/jms/text_message.rb +0 -16
  20. data/lib/jms/version.rb +1 -1
  21. data/test/connection_test.rb +35 -81
  22. data/test/jms.yml +18 -8
  23. data/test/message_test.rb +27 -43
  24. data/test/session_pool_test.rb +30 -46
  25. data/test/session_test.rb +30 -45
  26. data/test/test_helper.rb +33 -0
  27. metadata +20 -26
  28. data/Gemfile +0 -8
  29. data/Gemfile.lock +0 -36
  30. data/examples/advanced/session_pool.rb +0 -37
  31. data/examples/client-server/replier.rb +0 -29
  32. data/examples/client-server/requestor.rb +0 -40
  33. data/examples/file-to-q/files_to_q.rb +0 -51
  34. data/examples/file-to-q/q_to_files.rb +0 -44
  35. data/examples/invm/invm.rb +0 -44
  36. data/examples/invm/log4j.properties +0 -58
  37. data/examples/jms.yml +0 -149
  38. data/examples/performance/consumer.rb +0 -25
  39. data/examples/performance/producer.rb +0 -31
  40. data/examples/producer-consumer/browser.rb +0 -24
  41. data/examples/producer-consumer/consumer.rb +0 -24
  42. data/examples/producer-consumer/consumer_async.rb +0 -41
  43. data/examples/producer-consumer/producer.rb +0 -25
  44. data/examples/publish-subscribe/publish.rb +0 -24
  45. data/examples/publish-subscribe/subscribe.rb +0 -31
  46. data/lib/jms/logging.rb +0 -50
  47. data/nbproject/private/private.properties +0 -3
  48. data/nbproject/private/rake-d.txt +0 -5
  49. data/parallel_minion.gemspec +0 -21
@@ -1,65 +1,49 @@
1
- # Allow examples to be run in-place without requiring a gem install
2
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
1
+ require_relative 'test_helper'
2
+ require 'timeout'
3
3
 
4
- require 'rubygems'
5
- require 'test/unit'
6
- require 'shoulda'
7
- require 'jms'
8
- require 'yaml'
9
-
10
- class JMSTest < Test::Unit::TestCase
11
- context 'JMS Session' do
12
- # Load configuration from jms.yml
13
- setup do
14
- # To change the JMS provider, edit jms.yml and change :default
15
-
16
- # Load Connection parameters from configuration file
17
- cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
18
- jms_provider = cfg['default']
19
- @config = cfg[jms_provider]
20
- raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless @config
21
- @queue_name = @config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
22
- @topic_name = @config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
23
- @pool_params = {
24
- :pool_name => 'Test::JMS::SessionPool',
25
- :pool_size => 10,
26
- :pool_warn_timeout => 5.0,
27
- #:pool_logger =>
4
+ class SessionPoolTest < Minitest::Test
5
+ describe JMS::SessionPool do
6
+ before do
7
+ @config, @queue_name, @topic_name = read_config
8
+ @pool_params = {
9
+ pool_size: 10,
10
+ pool_warn_timeout: 5.0
28
11
  }
29
12
  end
30
13
 
31
- should 'create a session pool' do
14
+ it 'create a session pool' do
32
15
  JMS::Connection.start(@config) do |connection|
33
16
  pool = connection.create_session_pool(@pool_params)
34
17
  pool.session do |session|
35
- assert_not_nil session
18
+ assert session
36
19
  assert session.is_a?(javax.jms.Session)
37
20
  end
38
21
  pool.close
39
22
  end
40
23
  end
41
24
 
42
- should 'remove bad session from pool' do
25
+ it 'remove bad session from pool' do
43
26
  JMS::Connection.start(@config) do |connection|
44
- pool = connection.create_session_pool(@pool_params.merge(:pool_size=>1))
45
- s = nil
46
- r = begin
47
- pool.session do |session|
48
- assert_not_nil session
49
- assert session.is_a?(javax.jms.Session)
50
- s = session
51
- s.close
52
- s.create_map_message
53
- false
27
+ pool = connection.create_session_pool(@pool_params.merge(pool_size: 1))
28
+ s = nil
29
+ r =
30
+ begin
31
+ pool.session do |session|
32
+ assert session
33
+ assert session.is_a?(javax.jms.Session)
34
+ s = session
35
+ s.close
36
+ s.create_map_message
37
+ false
38
+ end
39
+ rescue javax.jms.IllegalStateException
40
+ true
54
41
  end
55
- rescue javax.jms.IllegalStateException
56
- true
57
- end
58
42
  assert r == true
59
43
 
60
44
  # Now verify that the previous closed session was removed from the pool
61
45
  pool.session do |session|
62
- assert_not_nil session
46
+ assert session
63
47
  assert session.is_a?(javax.jms.Session)
64
48
  assert s != session
65
49
  session.create_map_message
@@ -67,14 +51,14 @@ class JMSTest < Test::Unit::TestCase
67
51
  end
68
52
  end
69
53
 
70
- should 'allow multiple sessions to be used concurrently' do
54
+ it 'allow multiple sessions to be used concurrently' do
71
55
  JMS::Connection.start(@config) do |connection|
72
56
  pool = connection.create_session_pool(@pool_params)
73
57
  pool.session do |session|
74
- assert_not_nil session
58
+ assert session
75
59
  assert session.is_a?(javax.jms.Session)
76
60
  pool.session do |session2|
77
- assert_not_nil session2
61
+ assert session2
78
62
  assert session2.is_a?(javax.jms.Session)
79
63
  assert session != session2
80
64
  end
data/test/session_test.rb CHANGED
@@ -1,47 +1,32 @@
1
- # Allow examples to be run in-place without requiring a gem install
2
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
-
4
- require 'rubygems'
5
- require 'test/unit'
6
- require 'shoulda'
7
- require 'jms'
1
+ require_relative 'test_helper'
8
2
  require 'yaml'
9
3
 
10
- class JMSTest < Test::Unit::TestCase
11
- context 'JMS Session' do
12
- # Load configuration from jms.yml
13
- setup do
14
- # To change the JMS provider, edit jms.yml and change :default
15
-
16
- # Load Connection parameters from configuration file
17
- cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
18
- jms_provider = cfg['default']
19
- @config = cfg[jms_provider]
20
- raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless @config
21
- @queue_name = @config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
22
- @topic_name = @config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
4
+ class SessionTest < Minitest::Test
5
+ describe 'JMS::Session' do
6
+ before do
7
+ @config, @queue_name, @topic_name = read_config
23
8
  end
24
9
 
25
- should 'create a session' do
10
+ it 'create a session' do
26
11
  JMS::Connection.session(@config) do |session|
27
- assert_not_nil session
12
+ assert session
28
13
  end
29
14
  end
30
15
 
31
- should 'create automatic messages' do
16
+ it 'create automatic messages' do
32
17
  JMS::Connection.session(@config) do |session|
33
- assert_not_nil session
18
+ assert session
34
19
  # Create Text Message
35
20
  assert_equal session.message("Hello").java_kind_of?(JMS::TextMessage), true
36
21
 
37
22
  # Create Map Message
38
- assert_equal session.message('hello'=>'world').java_kind_of?(JMS::MapMessage), true
23
+ assert_equal session.message('hello' => 'world').java_kind_of?(JMS::MapMessage), true
39
24
  end
40
25
  end
41
26
 
42
- should 'create explicit messages' do
27
+ it 'create explicit messages' do
43
28
  JMS::Connection.session(@config) do |session|
44
- assert_not_nil session
29
+ assert session
45
30
  # Create Text Message
46
31
  assert_equal session.create_text_message("Hello").java_kind_of?(JMS::TextMessage), true
47
32
 
@@ -50,71 +35,71 @@ class JMSTest < Test::Unit::TestCase
50
35
  end
51
36
  end
52
37
 
53
- should 'create temporary destinations in blocks' do
38
+ it 'create temporary destinations in blocks' do
54
39
  JMS::Connection.session(@config) do |session|
55
- assert_not_nil session
40
+ assert session
56
41
 
57
42
  # Temporary Queue
58
- session.destination(:queue_name => :temporary) do |destination|
43
+ session.destination(queue_name: :temporary) do |destination|
59
44
  assert_equal destination.java_kind_of?(JMS::TemporaryQueue), true
60
45
  end
61
46
 
62
47
  # Temporary Topic
63
- session.create_destination(:topic_name => :temporary) do |destination|
48
+ session.create_destination(topic_name: :temporary) do |destination|
64
49
  assert_equal destination.java_kind_of?(JMS::TemporaryTopic), true
65
50
  end
66
51
  end
67
52
  end
68
53
 
69
- should 'create temporary destinations' do
54
+ it 'create temporary destinations' do
70
55
  JMS::Connection.session(@config) do |session|
71
- assert_not_nil session
56
+ assert session
72
57
 
73
58
  # Temporary Queue
74
- destination = session.create_destination(:queue_name => :temporary)
59
+ destination = session.create_destination(queue_name: :temporary)
75
60
  assert_equal destination.java_kind_of?(JMS::TemporaryQueue), true
76
61
  destination.delete
77
62
 
78
63
  # Temporary Topic
79
- destination = session.create_destination(:topic_name => :temporary)
64
+ destination = session.create_destination(topic_name: :temporary)
80
65
  assert_equal destination.java_kind_of?(JMS::TemporaryTopic), true
81
66
  destination.delete
82
67
  end
83
68
  end
84
69
 
85
- should 'create destinations in blocks' do
70
+ it 'create destinations in blocks' do
86
71
  JMS::Connection.session(@config) do |session|
87
- assert_not_nil session
72
+ assert session
88
73
 
89
74
  # Temporary Queue
90
- session.destination(:queue_name => @queue_name) do |destination|
75
+ session.destination(queue_name: @queue_name) do |destination|
91
76
  assert_equal destination.java_kind_of?(JMS::Queue), true
92
77
  end
93
78
 
94
79
  # Temporary Topic
95
- session.create_destination(:topic_name => @topic_name) do |destination|
80
+ session.create_destination(topic_name: @topic_name) do |destination|
96
81
  assert_equal destination.java_kind_of?(JMS::Topic), true
97
82
  end
98
83
  end
99
84
  end
100
85
 
101
- should 'create destinations' do
86
+ it 'create destinations' do
102
87
  JMS::Connection.session(@config) do |session|
103
- assert_not_nil session
88
+ assert session
104
89
 
105
90
  # Queue
106
- queue = session.create_destination(:queue_name => @queue_name)
91
+ queue = session.create_destination(queue_name: @queue_name)
107
92
  assert_equal queue.java_kind_of?(JMS::Queue), true
108
93
 
109
94
  # Topic
110
- topic = session.create_destination(:topic_name => @topic_name)
95
+ topic = session.create_destination(topic_name: @topic_name)
111
96
  assert_equal topic.java_kind_of?(JMS::Topic), true
112
97
  end
113
98
  end
114
99
 
115
- should 'create destinations using direct methods' do
100
+ it 'create destinations using direct methods' do
116
101
  JMS::Connection.session(@config) do |session|
117
- assert_not_nil session
102
+ assert session
118
103
 
119
104
  # Queue
120
105
  queue = session.queue(@queue_name)
@@ -0,0 +1,33 @@
1
+ # Allow test to be run in-place without requiring a gem install
2
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
+
4
+ # Configure Rails Environment
5
+ ENV['RAILS_ENV'] = 'test'
6
+
7
+ require 'minitest/autorun'
8
+ require 'minitest/reporters'
9
+ require 'yaml'
10
+ require 'jms'
11
+
12
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
13
+
14
+ SemanticLogger.add_appender('test.log', &SemanticLogger::Appender::Base.colorized_formatter)
15
+ SemanticLogger.default_level = :trace
16
+
17
+ # Set Log4J properties file so that it does not need to be in the CLASSPATH
18
+ java.lang.System.properties['log4j.configuration'] = 'test/log4j.properties'
19
+
20
+ # Load configuration from jms.yml
21
+ # Returns [Hash, String, String] the configuration, queue_name and topic_name
22
+ def read_config
23
+ # To change the JMS provider, edit jms.yml and change :default
24
+
25
+ # Load Connection parameters from configuration file
26
+ cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
27
+ jms_provider = cfg['default']
28
+ config = cfg[jms_provider]
29
+ raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless config
30
+ queue_name = config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
31
+ topic_name = config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
32
+ [config, queue_name, topic_name]
33
+ end
metadata CHANGED
@@ -1,63 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-jms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2015-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - '>='
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
14
19
  name: gene_pool
20
+ prerelease: false
21
+ type: :runtime
15
22
  version_requirements: !ruby/object:Gem::Requirement
16
23
  requirements:
17
24
  - - '>='
18
25
  - !ruby/object:Gem::Version
19
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
20
28
  requirement: !ruby/object:Gem::Requirement
21
29
  requirements:
22
30
  - - '>='
23
31
  - !ruby/object:Gem::Version
24
32
  version: '0'
33
+ name: semantic_logger
25
34
  prerelease: false
26
35
  type: :runtime
27
- description: JRuby-JMS is a Java and Ruby library that exposes the Java JMS API in a ruby friendly way. For JRuby only.
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: jruby-jms is a complete JRuby API into Java Messaging Specification (JMS) V1.1. For JRuby only.
28
42
  email:
29
43
  - reidmo@gmail.com
30
44
  executables: []
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
34
- - Gemfile
35
- - Gemfile.lock
36
48
  - HISTORY.md
37
49
  - LICENSE.txt
38
50
  - README.md
39
51
  - Rakefile
40
- - examples/advanced/session_pool.rb
41
- - examples/client-server/replier.rb
42
- - examples/client-server/requestor.rb
43
- - examples/file-to-q/files_to_q.rb
44
- - examples/file-to-q/q_to_files.rb
45
- - examples/invm/invm.rb
46
- - examples/invm/log4j.properties
47
- - examples/jms.yml
48
- - examples/performance/consumer.rb
49
- - examples/performance/producer.rb
50
- - examples/producer-consumer/browser.rb
51
- - examples/producer-consumer/consumer.rb
52
- - examples/producer-consumer/consumer_async.rb
53
- - examples/producer-consumer/producer.rb
54
- - examples/publish-subscribe/publish.rb
55
- - examples/publish-subscribe/subscribe.rb
56
52
  - lib/jms.rb
57
53
  - lib/jms/bytes_message.rb
58
54
  - lib/jms/connection.rb
59
55
  - lib/jms/imports.rb
60
- - lib/jms/logging.rb
61
56
  - lib/jms/map_message.rb
62
57
  - lib/jms/message.rb
63
58
  - lib/jms/message_consumer.rb
@@ -71,15 +66,13 @@ files:
71
66
  - lib/jms/session_pool.rb
72
67
  - lib/jms/text_message.rb
73
68
  - lib/jms/version.rb
74
- - nbproject/private/private.properties
75
- - nbproject/private/rake-d.txt
76
- - parallel_minion.gemspec
77
69
  - test/connection_test.rb
78
70
  - test/jms.yml
79
71
  - test/log4j.properties
80
72
  - test/message_test.rb
81
73
  - test/session_pool_test.rb
82
74
  - test/session_test.rb
75
+ - test/test_helper.rb
83
76
  homepage: https://github.com/reidmorrison/jruby-jms
84
77
  licenses:
85
78
  - Apache License V2.0
@@ -100,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
93
  version: '0'
101
94
  requirements: []
102
95
  rubyforge_project:
103
- rubygems_version: 2.2.2
96
+ rubygems_version: 2.4.8
104
97
  signing_key:
105
98
  specification_version: 4
106
99
  summary: JRuby interface into JMS
@@ -111,3 +104,4 @@ test_files:
111
104
  - test/message_test.rb
112
105
  - test/session_pool_test.rb
113
106
  - test/session_test.rb
107
+ - test/test_helper.rb
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rake'
4
- gem 'gene_pool'
5
-
6
- group :development do
7
- gem 'shoulda'
8
- end
data/Gemfile.lock DELETED
@@ -1,36 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- activesupport (4.0.2)
5
- i18n (~> 0.6, >= 0.6.4)
6
- minitest (~> 4.2)
7
- multi_json (~> 1.3)
8
- thread_safe (~> 0.1)
9
- tzinfo (~> 0.3.37)
10
- atomic (1.1.14)
11
- atomic (1.1.14-java)
12
- gene_pool (1.3.2)
13
- i18n (0.6.9)
14
- minitest (4.7.5)
15
- multi_json (1.8.4)
16
- rake (10.1.1)
17
- shoulda (3.5.0)
18
- shoulda-context (~> 1.0, >= 1.0.1)
19
- shoulda-matchers (>= 1.4.1, < 3.0)
20
- shoulda-context (1.1.6)
21
- shoulda-matchers (2.5.0)
22
- activesupport (>= 3.0.0)
23
- thread_safe (0.1.3)
24
- atomic
25
- thread_safe (0.1.3-java)
26
- atomic
27
- tzinfo (0.3.38)
28
-
29
- PLATFORMS
30
- java
31
- ruby
32
-
33
- DEPENDENCIES
34
- gene_pool
35
- rake
36
- shoulda