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.
- checksums.yaml +7 -0
- data/.ruby-version +1 -1
- data/Rakefile +1 -6
- data/lib/maestro_common/helpers/mq_helper.rb +5 -0
- data/lib/maestro_common/mq/messenger.rb +2 -1
- data/lib/maestro_common/version.rb +1 -1
- data/maestro_common.gemspec +7 -4
- data/spec/messenger_spec.rb +40 -0
- data/spec/mqhelper_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -12
- metadata +214 -190
checksums.yaml
ADDED
@@ -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
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jruby-1.
|
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, :
|
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
|
@@ -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
|
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
|
data/maestro_common.gemspec
CHANGED
@@ -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', '
|
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
|
data/spec/mqhelper_spec.rb
CHANGED
@@ -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
|
58
|
+
conn.connected?.should be true
|
59
59
|
Maestro::MQHelper.disconnect
|
60
|
-
conn.connected?.should
|
60
|
+
conn.connected?.should be false
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,11 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rspec'
|
3
3
|
require 'logger'
|
4
4
|
|
5
|
-
|
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.
|
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(:
|
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
|
-
|
5
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
6
|
+
authors:
|
7
|
+
- Doug Henderson
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
174
|
+
email:
|
175
|
+
- dhenderson@maestrodev.com
|
142
176
|
executables: []
|
143
|
-
|
144
177
|
extensions: []
|
145
|
-
|
146
178
|
extra_rdoc_files: []
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
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
|
-
|
168
|
-
|
198
|
+
licenses:
|
199
|
+
- Apache 2.0
|
200
|
+
metadata: {}
|
201
|
+
post_install_message:
|
169
202
|
rdoc_options: []
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
-
|
194
|
-
|
195
|
-
|
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
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
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
|