maestro_common 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eefc532fbc9e519cdb59fee8fdcb9f6ea9f79022
4
+ data.tar.gz: 5401c8662ee7cec61992b53f4aebd7028ee1a547
5
+ SHA512:
6
+ metadata.gz: 162f2498e5d3ef1bfe1a4adcce434c97532ee63a2a67933fd837273128948812c9f788503cc72da78ee68bc80b57bf7d470d1a8d0bbe649a8897244bb56b5258
7
+ data.tar.gz: 11548e5f6e8d2fc0ef3ce39e0f357ec26474519fec68887c7fe34d9c4bfd651dfcc991782dc14f05c0eb613cfe053195e2a6e5b9e529e1cfb92d273aaf44ea9a
@@ -1 +1 @@
1
- jruby-1.6.8
1
+ jruby-1.7.4
data/Rakefile CHANGED
@@ -7,11 +7,6 @@ require File.expand_path('../lib/maestro_common/version', __FILE__)
7
7
  CLEAN.include('pkg')
8
8
  CLOBBER.include('.bundle', '.config', 'coverage', 'InstalledFiles', 'spec/reports', 'rdoc', 'test', 'tmp')
9
9
 
10
- task :default => [:clean, :bundle, :spec, :build]
10
+ task :default => [:clean, :spec, :build]
11
11
 
12
12
  RSpec::Core::RakeTask.new
13
-
14
- desc 'Get dependencies with Bundler'
15
- task :bundle do
16
- sh %{bundle install}
17
- end
@@ -30,6 +30,11 @@ module Maestro
30
30
  @@stomp
31
31
  end
32
32
 
33
+ # only for testing
34
+ def MQHelper.connection=(stomp)
35
+ @@stomp = stomp
36
+ end
37
+
33
38
  def MQHelper.connect
34
39
  if @@stomp.nil?
35
40
  Maestro.log.info "Request for stomp connection - creating"
@@ -1,5 +1,6 @@
1
1
  # Copyright 2011(c) MaestroDev. All rights reserved.
2
2
  require File.join(File.dirname(__FILE__), '..', 'helpers', 'mq_helper')
3
+ require 'multi_json'
3
4
 
4
5
  module Maestro
5
6
  class MessageSendError < StandardError
@@ -208,7 +209,7 @@ module Maestro
208
209
 
209
210
  Maestro.log.debug "[seq #{my_seq}] Sending #{custom_text}" if debug
210
211
 
211
- Maestro::MQHelper.connection.send( destination_queue, message.to_json, options ) do |r|
212
+ Maestro::MQHelper.connection.send( destination_queue, MultiJson.dump(message), options ) do |r|
212
213
  Maestro.log.debug "[seq #{my_seq}] Sent #{custom_text} to '#{destination_queue}'" if debug
213
214
 
214
215
  yield(r) if block
@@ -1,5 +1,5 @@
1
1
  module Maestro
2
2
  module Common
3
- VERSION = '0.0.5'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -21,13 +21,16 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'onstomp'
22
22
  spec.add_dependency 'logging', '>= 1.8.0'
23
23
  spec.add_dependency 'rubyzip', '>= 0.9.8', "< 1.0.0" # 1.0 requires newer ruby/jruby
24
- spec.add_dependency 'json', '>= 1.4.6'
25
24
  spec.add_dependency 'eventmachine', ">=0.12.10"
25
+ spec.add_dependency 'multi_json', '>= 1.9.0'
26
+
27
+ # jrjackson is the only json parser implementation that properly converts java objects
28
+ # https://github.com/jruby/jruby/issues/1931
29
+ spec.add_development_dependency 'jrjackson'
26
30
 
27
- spec.add_development_dependency 'bundler', '>= 1.3'
28
31
  spec.add_development_dependency 'rake'
29
- spec.add_development_dependency 'jruby-openssl'
30
- spec.add_development_dependency 'rspec', '>= 2.13.0'
32
+ spec.add_development_dependency 'jruby-openssl' if RUBY_PLATFORM == 'java'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
34
  spec.add_development_dependency 'stompserver_ng'
32
35
  spec.add_development_dependency "mocha", '>=0.10.0'
33
36
 
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Maestro::Messenger do
4
+
5
+ shared_examples :json_parsing do
6
+ it 'should correctly convert json' do
7
+ Maestro::MQHelper.connection = double()
8
+
9
+ expect(Maestro::MQHelper.connection).to receive(:send).with(
10
+ nil,
11
+ "{\"__msg_content__\":{\"workitem\":{\"fields\":{\"__context_outputs__\":{\"list\":[]}}}},\"__msg_seq__\":1}",
12
+ {:persistent=>true, :content_type=>"application/json"})
13
+
14
+ subject.send_message_async(nil, message)
15
+ end
16
+ end
17
+
18
+ context 'send_message_async' do
19
+ let(:map) {{ 'list' => [] }}
20
+ let(:fields) {{ '__context_outputs__' => map }}
21
+ let(:workitem) {{ 'fields' => fields }}
22
+ let(:message) {{
23
+ '__msg_content__' => {
24
+ 'workitem' => workitem
25
+ }
26
+ }}
27
+
28
+ it_behaves_like :json_parsing
29
+
30
+ context 'when using Java objects', :java do
31
+ require 'java'
32
+ let(:map) {
33
+ m = java.util.HashMap.new()
34
+ m['list'] = java.util.ArrayList.new()
35
+ m
36
+ }
37
+ it_behaves_like :json_parsing
38
+ end
39
+ end
40
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'tmpdir'
3
3
 
4
- describe Maestro::MQHelper do
4
+ describe Maestro::MQHelper, :stomp do
5
5
  after :each do
6
6
  Maestro::MQHelper.disconnect
7
7
  end
@@ -55,9 +55,9 @@ describe Maestro::MQHelper do
55
55
  describe 'disconnect' do
56
56
  it 'should close connection, but leave object instantiated' do
57
57
  conn = Maestro::MQHelper.connect
58
- conn.connected?.should be_true
58
+ conn.connected?.should be true
59
59
  Maestro::MQHelper.disconnect
60
- conn.connected?.should be_false
60
+ conn.connected?.should be false
61
61
  end
62
62
  end
63
63
 
@@ -2,11 +2,7 @@ require 'rubygems'
2
2
  require 'rspec'
3
3
  require 'logger'
4
4
 
5
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')
6
- unless defined?(SPEC_ROOT)
7
- SPEC_ROOT = File.expand_path("../", __FILE__)
8
- end
9
-
5
+ SPEC_ROOT = File.expand_path("../", __FILE__)
10
6
  require File.join('maestro_common', 'common')
11
7
  Dir[File.join(SPEC_ROOT, 'support/**/*.rb')].each { |f| require(f) }
12
8
  include Maestro::Support::Stomp
@@ -37,16 +33,11 @@ module Maestro
37
33
  end
38
34
 
39
35
  RSpec.configure do |config|
40
- config.mock_with :mocha
41
-
42
- config.before(:suite) do
36
+ config.before(:context, :stomp) do
43
37
  start_stomp_server(File.join(File.dirname(__FILE__), "../log")) unless ENV['START_STOMP']=='false'
44
38
  end
45
39
 
46
- config.after(:suite) do
40
+ config.after(:context, :stomp) do
47
41
  stop_stomp_server
48
42
  end
49
43
  end
50
-
51
-
52
-
metadata CHANGED
@@ -1,202 +1,226 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: maestro_common
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
6
5
  platform: ruby
7
- authors:
8
- - Doug Henderson
9
- autorequire:
6
+ authors:
7
+ - Doug Henderson
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2013-09-17 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: onstomp
17
- version_requirements: &id001 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
23
- requirement: *id001
24
- prerelease: false
25
- type: :runtime
26
- - !ruby/object:Gem::Dependency
27
- name: logging
28
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- requirement: *id002
35
- prerelease: false
36
- type: :runtime
37
- - !ruby/object:Gem::Dependency
38
- name: rubyzip
39
- version_requirements: &id003 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: 0.9.8
45
- - - <
46
- - !ruby/object:Gem::Version
47
- version: 1.0.0
48
- requirement: *id003
49
- prerelease: false
50
- type: :runtime
51
- - !ruby/object:Gem::Dependency
52
- name: json
53
- version_requirements: &id004 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: 1.4.6
59
- requirement: *id004
60
- prerelease: false
61
- type: :runtime
62
- - !ruby/object:Gem::Dependency
63
- name: eventmachine
64
- version_requirements: &id005 !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 0.12.10
70
- requirement: *id005
71
- prerelease: false
72
- type: :runtime
73
- - !ruby/object:Gem::Dependency
74
- name: bundler
75
- version_requirements: &id006 !ruby/object:Gem::Requirement
76
- none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: "1.3"
81
- requirement: *id006
82
- prerelease: false
83
- type: :development
84
- - !ruby/object:Gem::Dependency
85
- name: rake
86
- version_requirements: &id007 !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: "0"
92
- requirement: *id007
93
- prerelease: false
94
- type: :development
95
- - !ruby/object:Gem::Dependency
96
- name: jruby-openssl
97
- version_requirements: &id008 !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: "0"
103
- requirement: *id008
104
- prerelease: false
105
- type: :development
106
- - !ruby/object:Gem::Dependency
107
- name: rspec
108
- version_requirements: &id009 !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: 2.13.0
114
- requirement: *id009
115
- prerelease: false
116
- type: :development
117
- - !ruby/object:Gem::Dependency
118
- name: stompserver_ng
119
- version_requirements: &id010 !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: "0"
125
- requirement: *id010
126
- prerelease: false
127
- type: :development
128
- - !ruby/object:Gem::Dependency
129
- name: mocha
130
- version_requirements: &id011 !ruby/object:Gem::Requirement
131
- none: false
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- version: 0.10.0
136
- requirement: *id011
137
- prerelease: false
138
- type: :development
11
+ date: 2014-08-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: onstomp
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: logging
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 1.8.0
39
+ prerelease: false
40
+ type: :runtime
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubyzip
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.8
48
+ - - <
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.0
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: 0.9.8
56
+ - - <
57
+ - !ruby/object:Gem::Version
58
+ version: 1.0.0
59
+ prerelease: false
60
+ type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: eventmachine
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: 0.12.10
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 0.12.10
73
+ prerelease: false
74
+ type: :runtime
75
+ - !ruby/object:Gem::Dependency
76
+ name: multi_json
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: 1.9.0
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: 1.9.0
87
+ prerelease: false
88
+ type: :runtime
89
+ - !ruby/object:Gem::Dependency
90
+ name: jrjackson
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirement: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ prerelease: false
102
+ type: :development
103
+ - !ruby/object:Gem::Dependency
104
+ name: rake
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ prerelease: false
116
+ type: :development
117
+ - !ruby/object:Gem::Dependency
118
+ name: jruby-openssl
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirement: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ prerelease: false
130
+ type: :development
131
+ - !ruby/object:Gem::Dependency
132
+ name: rspec
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ version: '3.0'
138
+ requirement: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: '3.0'
143
+ prerelease: false
144
+ type: :development
145
+ - !ruby/object:Gem::Dependency
146
+ name: stompserver_ng
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirement: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ prerelease: false
158
+ type: :development
159
+ - !ruby/object:Gem::Dependency
160
+ name: mocha
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - '>='
164
+ - !ruby/object:Gem::Version
165
+ version: 0.10.0
166
+ requirement: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - '>='
169
+ - !ruby/object:Gem::Version
170
+ version: 0.10.0
171
+ prerelease: false
172
+ type: :development
139
173
  description: A bunch of utility classes that are used in multiple places
140
- email:
141
- - dhenderson@maestrodev.com
174
+ email:
175
+ - dhenderson@maestrodev.com
142
176
  executables: []
143
-
144
177
  extensions: []
145
-
146
178
  extra_rdoc_files: []
147
-
148
- files:
149
- - .gitignore
150
- - .ruby-version
151
- - Gemfile
152
- - README.md
153
- - Rakefile
154
- - lib/maestro_common/common.rb
155
- - lib/maestro_common/helpers/mq_helper.rb
156
- - lib/maestro_common/logging/maestro_logging.rb
157
- - lib/maestro_common/mq/messenger.rb
158
- - lib/maestro_common/utils/retryable.rb
159
- - lib/maestro_common/version.rb
160
- - maestro_common.gemspec
161
- - spec/mqhelper_spec.rb
162
- - spec/retryable_spec.rb
163
- - spec/spec_helper.rb
164
- - spec/support/stomp.rb
179
+ files:
180
+ - .gitignore
181
+ - .ruby-version
182
+ - Gemfile
183
+ - README.md
184
+ - Rakefile
185
+ - lib/maestro_common/common.rb
186
+ - lib/maestro_common/helpers/mq_helper.rb
187
+ - lib/maestro_common/logging/maestro_logging.rb
188
+ - lib/maestro_common/mq/messenger.rb
189
+ - lib/maestro_common/utils/retryable.rb
190
+ - lib/maestro_common/version.rb
191
+ - maestro_common.gemspec
192
+ - spec/messenger_spec.rb
193
+ - spec/mqhelper_spec.rb
194
+ - spec/retryable_spec.rb
195
+ - spec/spec_helper.rb
196
+ - spec/support/stomp.rb
165
197
  homepage: https://github.com/maestrodev/maestro-ruby-common
166
- licenses:
167
- - Apache 2.0
168
- post_install_message:
198
+ licenses:
199
+ - Apache 2.0
200
+ metadata: {}
201
+ post_install_message:
169
202
  rdoc_options: []
170
-
171
- require_paths:
172
- - lib
173
- required_ruby_version: !ruby/object:Gem::Requirement
174
- none: false
175
- requirements:
176
- - - ">="
177
- - !ruby/object:Gem::Version
178
- hash: 2
179
- segments:
180
- - 0
181
- version: "0"
182
- required_rubygems_version: !ruby/object:Gem::Requirement
183
- none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 2
188
- segments:
189
- - 0
190
- version: "0"
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - '>='
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
191
215
  requirements: []
192
-
193
- rubyforge_project:
194
- rubygems_version: 1.8.24
195
- signing_key:
196
- specification_version: 3
216
+ rubyforge_project:
217
+ rubygems_version: 2.2.2
218
+ signing_key:
219
+ specification_version: 4
197
220
  summary: Maestro common classes
198
- test_files:
199
- - spec/mqhelper_spec.rb
200
- - spec/retryable_spec.rb
201
- - spec/spec_helper.rb
202
- - spec/support/stomp.rb
221
+ test_files:
222
+ - spec/messenger_spec.rb
223
+ - spec/mqhelper_spec.rb
224
+ - spec/retryable_spec.rb
225
+ - spec/spec_helper.rb
226
+ - spec/support/stomp.rb