nebulous_stomp 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d829397b774f8ca1f753608232eb30c093b472aa
4
- data.tar.gz: 96cf42699373c6a8aa211a438070bc2ef80987fb
3
+ metadata.gz: 8263873ebd87c126cae0e78178a0c3b5e6388429
4
+ data.tar.gz: 266d35ec2d7e97741865635443cc24399539dbeb
5
5
  SHA512:
6
- metadata.gz: 0462b28f99ac571c52ea71af2cc8fac798236f9241fdb8b1d674a0e17e058b09a63faa0293d1bb40799d9944c04c8524752f055214d06495ac107f61a7a97081
7
- data.tar.gz: aa2a93daddef2ace0a6c8460bcd824caef96805e340b566d9aa3bb08ba378a71bfe735d4053051ac08f48dace6a73b3b52b73d0f44be9fb31bc1cf0ca93f3142
6
+ metadata.gz: aa8eae3582fec3acfd756e3a5f0840068c7d7043794032a918cda932fe2e6a8538c34b65bab87ca96e9cab877ed1a841699786b18ffd789909814e92b0a72e7f
7
+ data.tar.gz: 6c5e70125308561d3e19a7c2683feb5cd70cb31be44b42d4a7d37b9ae9ec532357ed702e0dbc4e0a48b6c58edb072f3774cf8697c0d866146bbc1a912490ba9d
@@ -25,7 +25,8 @@ module NebulousStomp
25
25
  attr_reader :message
26
26
 
27
27
  # If you are testing you can write these with a test object like StompHandlerNull for example
28
- attr_writer :stomp_handler, :redis_handler
28
+ attr_reader :stomp_handler
29
+ attr_writer :redis_handler
29
30
 
30
31
  ##
31
32
  # :call-seq:
@@ -37,9 +38,11 @@ module NebulousStomp
37
38
  @target = parse_target(target)
38
39
  @message = parse_message(message, @target)
39
40
  NebulousStomp.logger.debug(__FILE__) { "New Request for verb #{@message.verb}" }
41
+ end
40
42
 
41
- # Get a connection to StompHandler ASAP and set reply_id on @message
42
- ensure_stomp_connected if NebulousStomp.on?
43
+ def stomp_handler=(handler)
44
+ @stomp_handler = handler
45
+ ensure_stomp_connected # so that we get a reply_id on the message ASAP.
43
46
  end
44
47
 
45
48
  ##
@@ -1,5 +1,5 @@
1
1
  module NebulousStomp
2
2
 
3
3
  # Nebulous version number
4
- VERSION = "3.0.3"
4
+ VERSION = "3.0.4"
5
5
  end
@@ -1,5 +1,5 @@
1
- require 'nebulous_stomp/listener'
2
- require 'nebulous_stomp/stomp_handler_null'
1
+ require "nebulous_stomp/listener"
2
+ require "nebulous_stomp/stomp_handler_null"
3
3
 
4
4
  include NebulousStomp
5
5
 
@@ -10,6 +10,13 @@ describe Listener do
10
10
  let(:listener1) { Listener.new(target1) }
11
11
  let(:handler) { StompHandlerNull.new }
12
12
 
13
+ before(:each) do
14
+ # These tests should not call the Stomp gem. Now if they do, we get an error, because our
15
+ # fakestomp object doesn't have any methods.
16
+ fakestomp = double("fakestomp")
17
+ allow( Stomp::Client ).to receive(:new).and_return( fakestomp )
18
+ end
19
+
13
20
 
14
21
  describe "#new" do
15
22
 
@@ -20,7 +27,7 @@ describe Listener do
20
27
  expect{ Listener.new "alpha" }.not_to raise_error
21
28
  end
22
29
 
23
- end
30
+ end # of #new
24
31
 
25
32
 
26
33
  describe "#queue" do
@@ -33,7 +40,7 @@ describe Listener do
33
40
  expect( Listener.new(target1).queue ).to eq target1.receive_queue
34
41
  end
35
42
 
36
- end
43
+ end # of #queue
37
44
 
38
45
 
39
46
  describe "#stomp_handler" do
@@ -47,12 +54,11 @@ describe Listener do
47
54
  expect( listener1.send(:stomp_handler).class ).to eq StompHandler
48
55
  end
49
56
 
50
- end
57
+ end # of #stomp_handler
51
58
 
52
59
 
53
60
  describe "#consume_messages" do
54
-
55
- before do
61
+ before(:each) do
56
62
  listener1.stomp_handler = handler
57
63
  handler.insert_fake "foo"
58
64
  handler.insert_fake "bar"
@@ -63,14 +69,11 @@ describe Listener do
63
69
  expect{|b| listener1.consume_messages &b }.to yield_successive_args("foo", "bar", "baz")
64
70
  end
65
71
 
66
- end
72
+ end # of consume_messages
67
73
 
68
74
 
69
75
  describe "#reply" do
70
-
71
- before do
72
- listener1.stomp_handler = handler
73
- end
76
+ before(:each) { listener1.stomp_handler = handler }
74
77
 
75
78
  it "takes a queue name and a Message object" do
76
79
  expect{ listener1.reply }.to raise_error ArgumentError
@@ -85,7 +88,7 @@ describe Listener do
85
88
  listener1.reply("beta", "bar")
86
89
  end
87
90
 
88
- end
91
+ end # of #reply
89
92
 
90
93
 
91
94
  describe "#quit" do
@@ -95,9 +98,8 @@ describe Listener do
95
98
  expect( handler ).to receive(:stomp_disconnect)
96
99
  listener1.quit
97
100
  end
98
-
99
101
 
100
- end
102
+ end # of #quit
101
103
 
102
104
 
103
105
  end
@@ -1,6 +1,6 @@
1
- require 'nebulous_stomp/message'
1
+ require "nebulous_stomp/message"
2
2
 
3
- require_relative 'helpers'
3
+ require_relative "helpers"
4
4
 
5
5
  include NebulousStomp
6
6
 
@@ -25,7 +25,6 @@ describe Message do
25
25
 
26
26
  end
27
27
 
28
-
29
28
  let(:new_hash_body) do
30
29
  { verb: 'Velma', parameters: 'Shaggy', description:'Scooby' }
31
30
  end
@@ -66,14 +65,21 @@ describe Message do
66
65
 
67
66
  let(:msg_cache) { Message.from_cache( json_hash.to_json ) }
68
67
 
68
+ before(:each) do
69
+ # These tests should not call the Stomp gem. Now if they do, we get an error, because our
70
+ # fakestomp object doesn't have any methods.
71
+ fakestomp = double("fakestomp")
72
+ allow( Stomp::Client ).to receive(:new).and_return( fakestomp )
73
+ end
74
+
69
75
 
70
- describe 'Message.new' do
76
+ describe "Message.new" do
71
77
 
72
- it 'returns a Message object' do
78
+ it "returns a Message object" do
73
79
  expect( msg_new ).to be_a_kind_of(Message)
74
80
  end
75
81
 
76
- it 'sets protocol attributes when they are given' do
82
+ it "sets protocol attributes when they are given" do
77
83
  expect( msg_new.reply_to ).to eq new_hash[:replyTo]
78
84
  expect( msg_new.in_reply_to ).to eq new_hash[:inReplyTo]
79
85
  expect( msg_new.verb ).to eq new_hash[:verb]
@@ -126,7 +132,7 @@ describe Message do
126
132
  expect( m.body ).to eq([])
127
133
  end
128
134
 
129
- it 'takes the content type from the input arguments' do
135
+ it "takes the content type from the input arguments" do
130
136
  msg = Message.new( new_hash.merge(contentType: 'foo') )
131
137
  expect( msg.content_type ).to eq "foo"
132
138
  end
@@ -141,11 +147,10 @@ describe Message do
141
147
  expect{ Message.new(body: 'bar') }.not_to raise_exception
142
148
  end
143
149
 
144
- end
145
- ##
150
+ end # of Message.new
146
151
 
147
152
 
148
- describe 'Message.in_reply_to' do
153
+ describe "Message.in_reply_to" do
149
154
 
150
155
  it "requires a message to reply to and a hash" do
151
156
  expect{ Message.in_reply_to() }.to raise_error ArgumentError
@@ -170,24 +175,23 @@ describe Message do
170
175
  expect( msg.in_reply_to ).to eq msg_new2.reply_id
171
176
  end
172
177
 
173
- end
174
- ##
178
+ end # of Message.in_reply_to
175
179
 
176
180
 
177
- describe 'Message.from_stomp' do
181
+ describe "Message.from_stomp" do
178
182
 
179
- it 'requires a Stomp::Message' do
183
+ it "requires a Stomp::Message" do
180
184
  expect{ Message.from_stomp }.to raise_exception ArgumentError
181
185
  expect{ Message.from_stomp('foo') }.to raise_exception ArgumentError
182
186
  expect{ Message.from_stomp(smess) }.not_to raise_exception
183
187
  end
184
188
 
185
- it 'sets stomp attributes' do
189
+ it "sets stomp attributes" do
186
190
  expect( msg_stomp.stomp_headers ).to include smess.headers
187
191
  expect( msg_stomp.stomp_body ).to eq smess.body
188
192
  end
189
193
 
190
- it 'still works if there are no Protocol attributes to set' do
194
+ it "still works if there are no Protocol attributes to set" do
191
195
  expect( msg_stomp.verb ).to eq nil
192
196
  expect( msg_stomp.params ).to eq nil
193
197
  expect( msg_stomp.desc ).to eq nil
@@ -195,7 +199,7 @@ describe Message do
195
199
  expect( msg_stomp.in_reply_to ).to eq nil
196
200
  end
197
201
 
198
- it 'sets the content type to whatever the headers say it is' do
202
+ it "sets the content type to whatever the headers say it is" do
199
203
  b = { verb: 'tom',
200
204
  params: 'dick',
201
205
  desc: 'harry' }.to_json
@@ -205,12 +209,11 @@ describe Message do
205
209
  end
206
210
 
207
211
  context "when the message body is text" do
208
-
209
- it 'returns a Message object' do
212
+ it "returns a Message object" do
210
213
  expect( msg_stomp ).to be_a_kind_of Message
211
214
  end
212
215
 
213
- it 'sets Protocol attributes if it can' do
216
+ it "sets Protocol attributes if it can" do
214
217
  body = {verb: 'Dougal', params: 'Florence', desc: 'Ermintrude'}
215
218
  mess = stomp_message('application/json', body.to_json, '23')
216
219
  msg = Message.from_stomp(mess)
@@ -219,37 +222,31 @@ describe Message do
219
222
  expect( msg.desc ).to eq 'Ermintrude'
220
223
  expect( msg.in_reply_to ).to eq '23'
221
224
  end
222
-
223
225
  end
224
226
 
225
-
226
227
  context "when the message body is JSON" do
227
-
228
228
  let(:msg_stomp_json) do
229
229
  m = {verb: 'one', params: 'two', desc: 'three'}.to_json
230
230
  x = stomp_message('application/json', m, '19')
231
231
  Message.from_stomp(x)
232
232
  end
233
233
 
234
- it 'returns a Message object' do
234
+ it "returns a Message object" do
235
235
  expect( msg_stomp_json ).to be_a_kind_of Message
236
236
  end
237
237
 
238
- it 'sets Protocol attributes if it can' do
238
+ it "sets Protocol attributes if it can" do
239
239
  expect( msg_stomp_json.verb ).to eq 'one'
240
240
  expect( msg_stomp_json.params ).to eq 'two'
241
241
  expect( msg_stomp_json.desc ).to eq 'three'
242
242
  expect( msg_stomp_json.in_reply_to ).to eq '19'
243
243
  end
244
-
245
244
  end
246
245
 
247
- end
248
- ##
249
-
246
+ end # of Message.from_stomp
250
247
 
251
- describe 'Message.from_cache' do
252
248
 
249
+ describe "Message.from_cache" do
253
250
  let(:msg2) do
254
251
  x = { replyId: '1234',
255
252
  contentType: 'application/json' }.to_json
@@ -257,8 +254,7 @@ describe Message do
257
254
  Message.from_cache(x)
258
255
  end
259
256
 
260
-
261
- it 'requires some json in the right format' do
257
+ it "requires some json in the right format" do
262
258
  expect{ Message.from_cache }.to raise_exception ArgumentError
263
259
  expect{ Message.from_cache('foo') }.to raise_exception ArgumentError
264
260
  expect{ Message.from_cache({}) }.to raise_exception ArgumentError
@@ -277,7 +273,7 @@ describe Message do
277
273
  expect{ Message.from_cache(loony2.to_json) }.not_to raise_exception
278
274
  end
279
275
 
280
- it 'still works if there are no Protocol attributes to set' do
276
+ it "still works if there are no Protocol attributes to set" do
281
277
  expect( msg2.verb ).to eq nil
282
278
  expect( msg2.params ).to eq nil
283
279
  expect( msg2.desc ).to eq nil
@@ -285,7 +281,7 @@ describe Message do
285
281
  expect( msg2.in_reply_to ).to eq nil
286
282
  end
287
283
 
288
- it 'sets Protocol attributes if it can' do
284
+ it "sets Protocol attributes if it can" do
289
285
  expect( msg_cache.verb ).to eq 'tom'
290
286
  expect( msg_cache.params ).to eq 'dick'
291
287
  expect( msg_cache.desc ).to eq 'harry'
@@ -293,30 +289,27 @@ describe Message do
293
289
  expect( msg_cache.in_reply_to ).to eq '4321'
294
290
  end
295
291
 
296
-
297
292
  context "when the message body is JSON" do
298
293
  # msg_cache has a json body
299
294
 
300
- it 'returns a Message object' do
295
+ it "returns a Message object" do
301
296
  expect( msg_cache ).to be_a_kind_of Message
302
297
  end
303
298
 
304
- it 'sets the stomp attributes' do
299
+ it "sets the stomp attributes" do
305
300
  expect( msg_cache.stomp_headers ).
306
301
  to eq symbolise( json_hash[:stompHeaders] )
307
302
 
308
303
  expect( msg_cache.stomp_body ).to eq json_hash[:stompBody]
309
304
  end
310
305
 
311
- it 'sets the content type' do
306
+ it "sets the content type" do
312
307
  expect( msg_cache.content_type ).to eq json_hash[:contentType]
313
308
  end
314
309
 
315
310
  end
316
311
 
317
-
318
312
  context "when the message body is text" do
319
-
320
313
  let(:msg3_cache) do
321
314
  { stompHeaders: msg_stomp.stomp_headers,
322
315
  stompBody: msg_stomp.stomp_body,
@@ -332,12 +325,11 @@ describe Message do
332
325
 
333
326
  let(:msg3) { Message.from_cache( msg3_cache.to_json ) }
334
327
 
335
-
336
- it 'returns a Message object' do
328
+ it "returns a Message object" do
337
329
  expect( msg3 ).to be_a_kind_of Message
338
330
  end
339
331
 
340
- it 'sets the stomp attributes' do
332
+ it "sets the stomp attributes" do
341
333
  heads = msg3_cache[:stompHeaders].each_with_object({}) do |(k,v),m|
342
334
  m[k.to_sym] = v
343
335
  end
@@ -346,34 +338,33 @@ describe Message do
346
338
  expect( msg3.stomp_body ).to eq msg3_cache[:stompBody]
347
339
  end
348
340
 
349
- it 'sets the content type' do
341
+ it "sets the content type" do
350
342
  expect( msg3.content_type ).to eq msg3_cache[:contentType]
351
343
  end
352
-
353
344
  end
354
345
 
346
+ end # of Message.from_cache
355
347
 
356
- end
357
- ##
358
348
 
349
+ describe "#parameters" do
359
350
 
360
- describe '#parameters' do
361
- it 'returns the same as @param' do
351
+ it "returns the same as @param" do
362
352
  expect(msg_new.parameters).to eq msg_new.params
363
353
  end
364
- end
365
- ##
354
+
355
+ end # of #parameters
366
356
 
367
357
 
368
- describe '#description' do
369
- it 'returns the same as @desc' do
358
+ describe "#description" do
359
+
360
+ it "returns the same as @desc" do
370
361
  expect(msg_new.description).to eq msg_new.desc
371
362
  end
372
- end
373
- ##
374
363
 
364
+ end # of #description
375
365
 
376
- describe '#content_is_json?' do
366
+
367
+ describe "#content_is_json?" do
377
368
 
378
369
  it "returns true if the content type is JSON" do
379
370
  expect( msg_new.content_is_json? ).to be true
@@ -384,13 +375,12 @@ describe Message do
384
375
  expect( msg.content_type ).to eq "foo"
385
376
  end
386
377
 
387
- end
388
- ##
378
+ end # of #content_is_json?
389
379
 
390
380
 
391
- describe '#to_h' do
381
+ describe "#to_h" do
392
382
 
393
- it 'returns the message as a hash' do
383
+ it "returns the message as a hash" do
394
384
  hash = msg_new.to_h
395
385
 
396
386
  expect( hash ).to be_a_kind_of Hash
@@ -403,11 +393,11 @@ describe Message do
403
393
  expect( hash[:contentType] ).to match /json$/i
404
394
  end
405
395
 
406
- it 'always returns all the keys' do
396
+ it "always returns all the keys" do
407
397
  expect( msg_stomp.to_h.keys ).to include(*json_hash.keys)
408
398
  end
409
399
 
410
- it "returns a hash that Message.from_cache doesn''t freak out over" do
400
+ it "returns a hash that Message.from_cache doesn't freak out over" do
411
401
  expect{ Message.from_cache(msg_cache.to_h.to_json) }.
412
402
  not_to raise_exception
413
403
 
@@ -415,12 +405,11 @@ describe Message do
415
405
  expect(mess.to_h).to include symbolise(json_hash)
416
406
  end
417
407
 
408
+ end # of #to_h
418
409
 
419
- end
420
- ##
421
410
 
411
+ describe "#protocol_json" do
422
412
 
423
- describe '#protocol_json' do
424
413
  it "returns the Protocol as a JSON string" do
425
414
  hash = JSON.parse( msg_new.protocol_json, symbolize_names: true )
426
415
 
@@ -433,8 +422,8 @@ describe Message do
433
422
  or include(description: 'Scooby')
434
423
 
435
424
  end
436
- end
437
- ##
425
+
426
+ end # of #protocol_json
438
427
 
439
428
 
440
429
  describe "#body" do
@@ -462,13 +451,12 @@ describe Message do
462
451
  expect( nr.body ).to eq "foo"
463
452
  end
464
453
 
465
- end
466
- ##
454
+ end # of #body
467
455
 
468
456
 
469
- describe '#headers_for_stomp' do
457
+ describe "#headers_for_stomp" do
470
458
 
471
- it 'always returns a Hash' do
459
+ it "always returns a Hash" do
472
460
  expect( msg_new.headers_for_stomp ).to be_a_kind_of Hash
473
461
  expect( msg_stomp.headers_for_stomp ).to be_a_kind_of Hash
474
462
  expect( msg_cache.headers_for_stomp ).to be_a_kind_of Hash
@@ -488,11 +476,10 @@ describe Message do
488
476
  expect( hdrs ).to include("neb-reply-id" => nil)
489
477
  end
490
478
 
491
- end
492
- ##
479
+ end # of #headers_for_stomp
493
480
 
494
481
 
495
- describe '#body_for_stomp' do
482
+ describe "#body_for_stomp" do
496
483
 
497
484
  it "returns a JSON string for content type JSON" do
498
485
  expect{ JSON.parse(msg_cache.body_for_stomp) }.not_to raise_exception
@@ -533,11 +520,10 @@ describe Message do
533
520
 
534
521
  end
535
522
 
536
- end
537
- ##
523
+ end # of #body_for_stomp
538
524
 
539
525
 
540
- describe '#respond_with_success' do
526
+ describe "#respond_with_success" do
541
527
 
542
528
  it "raises an error if we have no @reply_to" do
543
529
  expect{ msg_stomp.respond_with_success }.to raise_exception NebulousError
@@ -554,16 +540,15 @@ describe Message do
554
540
  expect( m.verb ).to eq 'success'
555
541
  end
556
542
 
557
- it 'sets the content type from the source message' do
543
+ it "sets the content type from the source message" do
558
544
  _,m = msg_cache.respond_with_success
559
545
  expect( m.content_type ).to eq msg_cache.content_type
560
546
  end
561
547
 
562
- end
563
- ##
548
+ end # of #respond_with_success
564
549
 
565
550
 
566
- describe '#respond_with_error' do
551
+ describe "#respond_with_error" do
567
552
  let(:err) { NebulousError.new("test error") }
568
553
 
569
554
  it "raises an error if we have no @reply_to" do
@@ -605,16 +590,15 @@ describe Message do
605
590
  expect( m.desc ).to eq err.message
606
591
  end
607
592
 
608
- it 'sets the content type from the source message' do
593
+ it "sets the content type from the source message" do
609
594
  _,m = msg_cache.respond_with_error('foo')
610
595
  expect( m.content_type ).to eq msg_cache.content_type
611
596
  end
612
597
 
613
- end
614
- ##
598
+ end # of #respond_with_error
615
599
 
616
600
 
617
- describe '#respond_with_protocol' do
601
+ describe "#respond_with_protocol" do
618
602
 
619
603
  it "raises an error if we have no @reply_to" do
620
604
  expect{ msg_stomp.respond_with_protocol('foo') }.to raise_exception NebulousError
@@ -644,16 +628,15 @@ describe Message do
644
628
  expect( m.desc ).to eq 'flang'
645
629
  end
646
630
 
647
- it 'sets the content type from the source message' do
631
+ it "sets the content type from the source message" do
648
632
  _,m = msg_cache.respond_with_protocol('bleem', 'drort', 'flang')
649
633
  expect( m.content_type ).to eq msg_cache.content_type
650
634
  end
651
635
 
652
- end
653
- ##
636
+ end # of #respond_with_protocol
654
637
 
655
638
 
656
- describe '#respond' do
639
+ describe "#respond" do
657
640
 
658
641
  let(:msg) { msg_cache.respond("desmond") }
659
642
 
@@ -677,13 +660,12 @@ describe Message do
677
660
  expect( m.body ).to eq 'desmond'
678
661
  end
679
662
 
680
- it 'sets the content type from the source message' do
663
+ it "sets the content type from the source message" do
681
664
  _,m = msg
682
665
  expect( m.content_type ).to eq msg_cache.content_type
683
666
  end
684
667
 
685
- end
686
- ##
668
+ end # of #respond
687
669
 
688
670
 
689
671
  end
@@ -1,4 +1,4 @@
1
- require 'nebulous_stomp/redis_handler_null'
1
+ require "nebulous_stomp/redis_handler_null"
2
2
 
3
3
  include NebulousStomp
4
4
 
@@ -11,61 +11,64 @@ describe RedisHandlerNull do
11
11
 
12
12
  let(:handler) { RedisHandlerNull.new(redis_hash) }
13
13
 
14
+ before(:each) do
15
+ # by definition we should not be calling the Redis gem.
16
+ # Arrange that if we do we get an error; because our double has no methods on it
17
+ redisfake = double("redisfake")
18
+ allow( Redis ).to receive(:new).and_return( redisfake )
19
+ end
20
+
14
21
 
15
- describe '#connect' do
22
+ describe "#connect" do
16
23
 
17
- it 'returns self' do
24
+ it "returns self" do
18
25
  expect( handler.connect ).to eq handler
19
26
  end
20
27
 
21
- end
22
- ##
28
+ end
23
29
 
24
30
 
25
- describe '#insert_fake' do
31
+ describe "#insert_fake" do
26
32
 
27
- it 'sets the key/value to return' do
33
+ it "sets the key/value to return" do
28
34
  handler.insert_fake('one', 'two')
29
35
  expect( handler.fake_pair ).to eq({"one" => "two"})
30
36
  end
31
37
 
32
38
  end
33
- ##
34
39
 
35
40
 
36
- describe '#connected?' do
41
+ describe "#connected?" do
37
42
 
38
- it 'returns false if we didnt call run insert_fake' do
43
+ it "returns false if we didnt call run insert_fake" do
39
44
  expect( handler.connected? ).to be_falsey
40
45
  end
41
46
 
42
- it 'returns true if we did call insert_fake' do
47
+ it "returns true if we did call insert_fake" do
43
48
  handler.insert_fake('one', 'two')
44
49
  expect( handler.connected? ).to be_truthy
45
50
  end
46
51
 
47
52
  end
48
- ##
49
53
 
50
54
 
51
- describe '#set#' do
55
+ describe "#set#" do
52
56
 
53
- it 'supports a key, value, option parameter like the real thing' do
57
+ it "supports a key, value, option parameter like the real thing" do
54
58
  expect{ handler.set('foo', 'bar', {baz: 1}) }.not_to raise_exception
55
59
  end
56
60
 
57
- it 'acts like insert_fake' do
61
+ it "acts like insert_fake" do
58
62
  handler.set('alice', 'tom')
59
63
  expect( handler.fake_pair ).to eq({'alice' => 'tom'})
60
64
  end
61
65
 
62
66
  end
63
- ##
64
67
 
65
68
 
66
- describe '#get#' do
69
+ describe "#get#" do
67
70
 
68
- it 'retreives the fake message regardless' do
71
+ it "retreives the fake message regardless" do
69
72
  handler.insert_fake('grr', 'arg')
70
73
  expect( handler.get('woo') ).to eq 'arg'
71
74
  end
@@ -75,19 +78,17 @@ describe RedisHandlerNull do
75
78
  end
76
79
 
77
80
  end
78
- ##
79
81
 
80
82
 
81
- describe '#del#' do
83
+ describe "#del#" do
82
84
 
83
- it 'resets the fake message' do
85
+ it "resets the fake message" do
84
86
  handler.insert_fake('grr', 'arg')
85
87
  handler.del('woo')
86
88
  expect( handler.fake_pair ).to eq({})
87
89
  end
88
90
 
89
91
  end
90
- ##
91
92
 
92
93
  end
93
94
 
@@ -1,37 +1,13 @@
1
- require 'nebulous_stomp/request'
2
- require 'nebulous_stomp/stomp_handler_null'
3
- require 'nebulous_stomp/redis_handler_null'
1
+ require "stomp"
2
+ require "nebulous_stomp/request"
3
+ require "nebulous_stomp/stomp_handler_null"
4
+ require "nebulous_stomp/redis_handler_null"
4
5
 
5
6
  include NebulousStomp
6
7
 
7
8
 
8
9
  describe Request do
9
10
 
10
- before do
11
- @stomp_hash = { hosts: [{ login: 'guest',
12
- passcode: 'guest',
13
- host: '10.0.0.150',
14
- port: 61613,
15
- ssl: false }],
16
- reliable: false }
17
-
18
- @redis_hash = {host: '127.0.0.1', port: 6379, db: 0}
19
-
20
- @stomp_handler = StompHandlerNull.new(@stomp_hash)
21
- @redis_handler = RedisHandlerNull.new(@redis_hash)
22
-
23
- NebulousStomp.init( :stompConnectHash => @stomp_hash,
24
- :redisConnectHash => @redis_hash,
25
- :messageTimeout => 5,
26
- :cacheTimeout => 20 )
27
-
28
- NebulousStomp.add_target( :accord,
29
- :sendQueue => "/queue/laplace.dev",
30
- :receiveQueue => "/queue/laplace.out",
31
- :messageTimeout => 1 )
32
-
33
- end
34
-
35
11
  def new_request(target, message)
36
12
  r = Request.new(target, message)
37
13
  r.stomp_handler = @stomp_handler
@@ -78,6 +54,37 @@ describe Request do
78
54
  request
79
55
  end
80
56
 
57
+ before(:each) do
58
+ # We shouldn't be calling Stomp or Redis in these tests. If we are, this will give us an error.
59
+ fakestomp = double("fakestomp")
60
+ fakeredis = double("fakeredis")
61
+ allow( Stomp::Client ).to receive(:new).and_return( fakestomp )
62
+ allow( Redis ).to receive(:new).and_return( fakeredis )
63
+
64
+ @stomp_hash = { hosts: [{ login: 'guest',
65
+ passcode: 'guest',
66
+ host: '10.0.0.150',
67
+ port: 61613,
68
+ ssl: false }],
69
+ reliable: false }
70
+
71
+ @redis_hash = {host: '127.0.0.1', port: 6379, db: 0}
72
+
73
+ @stomp_handler = StompHandlerNull.new(@stomp_hash)
74
+ @redis_handler = RedisHandlerNull.new(@redis_hash)
75
+
76
+ NebulousStomp.init( :stompConnectHash => @stomp_hash,
77
+ :redisConnectHash => @redis_hash,
78
+ :messageTimeout => 5,
79
+ :cacheTimeout => 20 )
80
+
81
+ NebulousStomp.add_target( :accord,
82
+ :sendQueue => "/queue/laplace.dev",
83
+ :receiveQueue => "/queue/laplace.out",
84
+ :messageTimeout => 1 )
85
+
86
+ end
87
+
81
88
 
82
89
  describe "Request.new" do
83
90
 
@@ -114,10 +121,10 @@ describe Request do
114
121
  expect( r.message.reply_to ).to eq target1.send_queue
115
122
  end
116
123
 
117
- end
124
+ end # of Request.new
118
125
 
119
126
 
120
- describe "message_timeout" do
127
+ describe "#message_timeout" do
121
128
 
122
129
  it "takes the timeout on the target over the default" do
123
130
  r = new_request(target2, message1)
@@ -129,20 +136,20 @@ describe Request do
129
136
  expect( r.message_timeout ).to eq 5
130
137
  end
131
138
 
132
- end
139
+ end # of #message_timeout
133
140
 
134
141
 
135
- describe "cache_timeout" do
142
+ describe "#cache_timeout" do
136
143
 
137
144
  it "returns the cache timeout value stored in Param" do
138
145
  r = new_request(target1, message1)
139
146
  expect( r.cache_timeout ).to eq 20
140
147
  end
141
148
 
142
- end
149
+ end # of #cache_timeout
143
150
 
144
151
 
145
- describe "send_no_cache" do
152
+ describe "#send_no_cache" do
146
153
 
147
154
  it "returns a response from StompHandler" do
148
155
  response = request1.send_no_cache
@@ -163,10 +170,10 @@ describe Request do
163
170
  expect( request.send_no_cache ).to be_nil
164
171
  end
165
172
 
166
- end
173
+ end # of #send_no_cache
167
174
 
168
175
 
169
- describe "clear_cache" do
176
+ describe "#clear_cache" do
170
177
 
171
178
  it "removes the redis cache for a single request" do
172
179
  @redis_handler.insert_fake('foo', 'bar')
@@ -189,10 +196,10 @@ describe Request do
189
196
  expect( r.clear_cache ).to eq r
190
197
  end
191
198
 
192
- end
199
+ end # of #clear_cache
193
200
 
194
201
 
195
- describe "send" do
202
+ describe "#send" do
196
203
 
197
204
  it "returns a Message object from STOMP the first time" do
198
205
  response = request1.send
@@ -216,7 +223,7 @@ describe Request do
216
223
  expect( response.verb ).to eq "frog"
217
224
  end
218
225
 
219
- fit "writes the response to the cache as JSON" do
226
+ it "writes the response to the cache as JSON" do
220
227
  response = request1.send
221
228
  expect{ JSON.parse @redis_handler.fake_pair.values.first }.not_to raise_exception
222
229
  end
@@ -247,7 +254,7 @@ describe Request do
247
254
  expect( request.send ).to be_nil
248
255
  end
249
256
 
250
- end
257
+ end # of #send
251
258
 
252
259
 
253
260
  end
@@ -1,21 +1,60 @@
1
- require 'time'
2
- require 'nebulous_stomp/stomp_handler_null'
1
+ require "time"
2
+ require "nebulous_stomp/stomp_handler_null"
3
+ require "nebulous_stomp/stomp_handler"
3
4
 
4
5
  include NebulousStomp
5
6
 
6
7
 
7
8
  describe StompHandlerNull do
8
9
 
10
+ def run_listen(secs)
11
+ got = []
12
+
13
+ handler.listen('/queue/foo') do |m|
14
+ got << m
15
+ end
16
+ sleep secs
17
+
18
+ got
19
+ end
20
+
21
+ def run_listen_with_timeout(secs)
22
+ got = []
23
+ handler.listen_with_timeout('/queue/foo', secs) do |m|
24
+ got << m
25
+ end
26
+
27
+ got
28
+ end
29
+
30
+ # Actually these are the real connection params, but we are going to stub, so
31
+ # hopefully it doesn't matter.
32
+ let(:stomp_hash) do
33
+ { hosts: [{ login: 'guest',
34
+ passcode: 'guest',
35
+ host: '10.0.0.150',
36
+ port: 61613,
37
+ ssl: false }],
38
+ reliable: false }
39
+ end
40
+
41
+ let(:fakestomp) { double("fakestomp") }
42
+
9
43
  let(:handler) do
10
- StompHandlerNull.new
44
+ allow(Stomp::Client).to receive(:new).and_return(fakestomp)
45
+
46
+ # Normally you wouldn't bother passing a stomp connection hash to StompHandlerNull, but we need
47
+ # to test that we don't connect to Stomp, so we need to give the ("presumably") underlying
48
+ # StompHandler class something to work with.
49
+ StompHandlerNull.new(stomp_hash)
11
50
  end
12
51
 
13
52
  let(:msg1) do
14
- stomp_message('application/text', 'verb:Foo', client.calc_reply_id)
53
+ stomp_message("application/text", "verb:Foo", client.calc_reply_id)
15
54
  end
16
55
 
17
56
  let(:msg2) do
18
- stomp_message('application/text', 'verb:Bar', client.calc_reply_id)
57
+ stomp_message("application/text", "verb:Bar", client.calc_reply_id)
19
58
  end
20
59
 
21
60
 
@@ -25,36 +64,39 @@ describe StompHandlerNull do
25
64
  expect{ StompHandlerNull.new(foo: 'bar') }.not_to raise_exception
26
65
  end
27
66
 
28
- end
29
- ##
67
+ end # of #initialize
30
68
 
31
69
 
32
70
  describe '#insert_fake' do
33
71
 
34
- it 'sets the message to send' do
72
+ it "sets the message to send" do
35
73
  handler.insert_fake( Message.new(verb: 'foo', params: 'bar', desc: 'baz') )
36
74
  expect( handler.fake_messages ).to be_a_kind_of Array
37
75
  expect( handler.fake_messages.first ).to be_a_kind_of NebulousStomp::Message
38
76
  expect( handler.fake_messages.first.verb ).to eq 'foo'
39
77
  end
40
78
 
41
- end
42
- ##
79
+ end # of #insert_fake
43
80
 
44
81
 
45
- describe '#connected?' do
82
+ describe "#connected?" do
46
83
 
47
- it 'returns false if fake_message was not called' do
84
+ it "returns false if fake_message was not called" do
48
85
  expect( handler.connected? ).to be_falsey
49
86
  end
50
87
 
51
- it 'returns true if fake_message was called' do
88
+ it "returns true if fake_message was called" do
52
89
  handler.insert_fake( Message.new(verb: 'one', params: 'two', desc: 'three') )
53
90
  expect( handler.connected? ).to be_truthy
54
91
  end
55
92
 
56
- end
57
- ##
93
+ it "does not call Stomp" do
94
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
95
+ expect( fakestomp ).not_to receive(:open?)
96
+ handler.connected?
97
+ end
98
+
99
+ end # of #connected?
58
100
 
59
101
 
60
102
  describe "#stomp_connect" do
@@ -63,8 +105,13 @@ describe StompHandlerNull do
63
105
  expect(handler.stomp_connect).to eq handler
64
106
  end
65
107
 
66
- end
67
- ##
108
+ it "does not call Stomp" do
109
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
110
+ expect( fakestomp ).not_to receive(:connection_frame)
111
+ handler.stomp_connect
112
+ end
113
+
114
+ end # of #stomp_connect
68
115
 
69
116
 
70
117
  describe "#calc_reply_id" do
@@ -74,11 +121,17 @@ describe StompHandlerNull do
74
121
  expect( handler.calc_reply_id ).to respond_to :upcase
75
122
  expect( handler.calc_reply_id.size ).to be > 12
76
123
  end
77
- end
78
- ##
124
+
125
+ it "does not call Stomp" do
126
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
127
+ expect( fakestomp ).not_to receive(:connection_frame)
128
+ handler.calc_reply_id
129
+ end
130
+
131
+ end # of #calc_reply_id
79
132
 
80
133
 
81
- describe "send_message" do
134
+ describe "#send_message" do
82
135
  let(:mess) { NebulousStomp::Message.new(verb: 'foo') }
83
136
 
84
137
  it "accepts a queue name and a Message" do
@@ -89,23 +142,16 @@ describe StompHandlerNull do
89
142
  expect( handler.send_message('foo', mess) ).to eq mess
90
143
  end
91
144
 
92
- end
93
- ##
94
-
95
-
96
- describe "#listen" do
145
+ it "does not call Stomp" do
146
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
147
+ expect( fakestomp ).not_to receive(:publish)
148
+ handler.send_message('foo', mess)
149
+ end
97
150
 
98
- def run_listen(secs)
99
- got = []
151
+ end # of #send_message
100
152
 
101
- handler.listen('/queue/foo') do |m|
102
- got << m
103
- end
104
- sleep secs
105
-
106
- got
107
- end
108
153
 
154
+ describe "#listen" do
109
155
 
110
156
  it "yields each Message" do
111
157
  handler.insert_fake( Message.new(verb: 'foo', params: 'bar', desc: 'baz') )
@@ -121,23 +167,21 @@ describe StompHandlerNull do
121
167
  expect(messages.last.verb).to eq "one"
122
168
  end
123
169
 
124
- end
125
- ##
170
+ it "does not call Stomp" do
171
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
172
+ expect( fakestomp ).not_to receive(:subscribe)
126
173
 
174
+ handler.insert_fake( Message.new(verb: 'foo', params: 'bar', desc: 'baz') )
175
+ handler.insert_fake( Message.new(verb: 'one', params: 'two', desc: 'three') )
176
+ messages = run_listen(1)
177
+ end
127
178
 
128
- describe "listen_with_timeout" do
179
+ end # of #listen
129
180
 
130
- def run_listen_with_timeout(secs)
131
- got = []
132
- handler.listen_with_timeout('/queue/foo', secs) do |m|
133
- got << m
134
- end
135
181
 
136
- got
137
- end
182
+ describe "listen_with_timeout" do
138
183
 
139
184
  context "when there are messages" do
140
-
141
185
  it "yields each Message" do
142
186
  handler.insert_fake( Message.new(verb: 'foo', params: 'bar', desc: 'baz') )
143
187
  handler.insert_fake( Message.new(verb: 'one', params: 'two', desc: 'three') )
@@ -151,21 +195,26 @@ describe StompHandlerNull do
151
195
  expect(messages.last).to be_a_kind_of NebulousStomp::Message
152
196
  expect(messages.last.verb).to eq "one"
153
197
  end
154
-
155
198
  end
156
199
 
157
200
  context "when there is no message" do
158
-
159
- it 'raises NebulousTimeout' do
201
+ it "raises NebulousTimeout" do
160
202
  expect{handler.listen_with_timeout('foo', 2)}.
161
203
  to raise_exception NebulousStomp::NebulousTimeout
162
204
 
163
205
  end
206
+ end
207
+
208
+ it "does not call Stomp" do
209
+ # More generally if we call anything on our Stomp::Client.new fake, we'll get an error
210
+ expect( fakestomp ).not_to receive(:subscribe)
164
211
 
212
+ handler.insert_fake( Message.new(verb: 'foo', params: 'bar', desc: 'baz') )
213
+ handler.insert_fake( Message.new(verb: 'one', params: 'two', desc: 'three') )
214
+ messages = run_listen_with_timeout(1)
165
215
  end
166
216
 
167
- end
168
- ##
217
+ end # of #listen_with_timeout
169
218
 
170
219
 
171
220
  end
data/tags CHANGED
@@ -17,14 +17,22 @@ Nebulous lib/nebulous/stomp_handler.rb /^module Nebulous$/;" m
17
17
  Nebulous lib/nebulous/stomp_handler_null.rb /^module Nebulous$/;" m
18
18
  Nebulous lib/nebulous/version.rb /^module Nebulous$/;" m
19
19
  NebulousError lib/nebulous.rb /^ class NebulousError < StandardError; end$/;" c class:Nebulous inherits:StandardError
20
+ NebulousStomp lib/nebulous_stomp/redis_handler.rb /^module NebulousStomp$/;" m
21
+ NebulousStomp lib/nebulous_stomp/request.rb /^module NebulousStomp$/;" m
22
+ NebulousStomp lib/nebulous_stomp/stomp_handler.rb /^module NebulousStomp$/;" m
23
+ NebulousStomp lib/nebulous_stomp/stomp_handler_null.rb /^module NebulousStomp$/;" m
20
24
  NebulousStomp lib/nebulous_stomp/version.rb /^module NebulousStomp$/;" m
21
25
  NebulousTimeout lib/nebulous.rb /^ class NebulousTimeout < StandardError; end$/;" c class:Nebulous inherits:StandardError
22
26
  Param lib/nebulous/param.rb /^ module Param$/;" m class:Nebulous
23
27
  ParamDefaults lib/nebulous/param.rb /^ ParamDefaults = { stompConnectHash: {},$/;" C class:Nebulous.Param
24
28
  RedisHandler lib/nebulous/redis_handler.rb /^ class RedisHandler$/;" c class:Nebulous
29
+ RedisHandler lib/nebulous_stomp/redis_handler.rb /^ class RedisHandler$/;" c class:NebulousStomp
25
30
  RedisHandlerNull lib/nebulous/redis_handler_null.rb /^ class RedisHandlerNull < RedisHandler$/;" c class:Nebulous inherits:RedisHandler
31
+ Request lib/nebulous_stomp/request.rb /^ class Request$/;" c class:NebulousStomp
26
32
  StompHandler lib/nebulous/stomp_handler.rb /^ class StompHandler$/;" c class:Nebulous
33
+ StompHandler lib/nebulous_stomp/stomp_handler.rb /^ class StompHandler$/;" c class:NebulousStomp
27
34
  StompHandlerNull lib/nebulous/stomp_handler_null.rb /^ class StompHandlerNull < StompHandler$/;" c class:Nebulous inherits:StompHandler
35
+ StompHandlerNull lib/nebulous_stomp/stomp_handler_null.rb /^ class StompHandlerNull < StompHandler$/;" c class:NebulousStomp
28
36
  TargetDefaults lib/nebulous/param.rb /^ TargetDefaults = { sendQueue: nil,$/;" C class:Nebulous.Param
29
37
  VERSION lib/nebulous/version.rb /^ VERSION = "1.1.5"$/;" C class:Nebulous
30
38
  add_target lib/nebulous.rb /^ def self.add_target(name, targetHash) # -> nil$/;" F class:Nebulous
@@ -33,22 +41,34 @@ body_for_stomp lib/nebulous/message.rb /^ def body_for_stomp$/;" f class:Nebu
33
41
  body_to_h lib/nebulous/message.rb /^ def body_to_h$/;" f class:Nebulous.Message
34
42
  body_to_hash lib/nebulous/stomp_handler.rb /^ def body_to_hash(headers, body, contentType=nil)$/;" F class:Nebulous.StompHandler
35
43
  cTimeout lib/nebulous/nebrequest.rb /^ attr_reader :cTimeout$/;" f class:Nebulous.NebRequest
44
+ cache_read lib/nebulous_stomp/request.rb /^ def cache_read$/;" f class:NebulousStomp.Request
45
+ cache_timeout lib/nebulous_stomp/request.rb /^ def cache_timeout$/;" f class:NebulousStomp.Request
46
+ cache_write lib/nebulous_stomp/request.rb /^ def cache_write(response, timeout)$/;" f class:NebulousStomp.Request
36
47
  calc_reply_id lib/nebulous/stomp_handler.rb /^ def calc_reply_id$/;" f class:Nebulous.StompHandler
37
48
  calc_reply_id lib/nebulous/stomp_handler_null.rb /^ def calc_reply_id; 'ABCD123456789'; end$/;" f class:Nebulous.StompHandlerNull
49
+ calc_reply_id lib/nebulous_stomp/stomp_handler.rb /^ def calc_reply_id$/;" f class:send_message
50
+ calc_reply_id lib/nebulous_stomp/stomp_handler_null.rb /^ def calc_reply_id; 'ABCD123456789'; end$/;" f class:NebulousStomp.StompHandlerNull
38
51
  clear_cache lib/nebulous/nebrequest.rb /^ def clear_cache$/;" f class:Nebulous.NebRequest
52
+ clear_cache lib/nebulous_stomp/request.rb /^ def clear_cache$/;" f class:NebulousStomp.Request
39
53
  client lib/nebulous/stomp_handler.rb /^ attr_reader :client$/;" f class:Nebulous.StompHandler
40
54
  connect lib/nebulous/redis_handler.rb /^ def connect$/;" f class:Nebulous.RedisHandler
41
55
  connect lib/nebulous/redis_handler_null.rb /^ def connect$/;" f class:Nebulous.RedisHandlerNull
56
+ connect lib/nebulous_stomp/redis_handler.rb /^ def connect$/;" f class:NebulousStomp.RedisHandler
42
57
  connected? lib/nebulous/redis_handler.rb /^ def connected?$/;" f class:Nebulous.RedisHandler
43
58
  connected? lib/nebulous/redis_handler_null.rb /^ def connected?$/;" f class:Nebulous.RedisHandlerNull
44
59
  connected? lib/nebulous/stomp_handler.rb /^ def connected?$/;" f class:Nebulous.StompHandler
45
60
  connected? lib/nebulous/stomp_handler_null.rb /^ def connected? $/;" f class:Nebulous.StompHandlerNull
61
+ connected? lib/nebulous_stomp/redis_handler.rb /^ def connected?$/;" f class:NebulousStomp.RedisHandler
62
+ connected? lib/nebulous_stomp/stomp_handler.rb /^ def connected?$/;" f class:NebulousStomp
63
+ connected? lib/nebulous_stomp/stomp_handler_null.rb /^ def connected? $/;" f class:NebulousStomp.StompHandlerNull
46
64
  content_is_json? lib/nebulous/message.rb /^ def content_is_json?$/;" f class:Nebulous.Message
47
65
  content_type lib/nebulous/message.rb /^ attr_reader :content_type$/;" f class:Nebulous.Message
48
66
  del lib/nebulous/redis_handler_null.rb /^ def del(key); @fake_pair = {}; end$/;" f class:Nebulous.RedisHandlerNull
49
67
  desc lib/nebulous/message.rb /^ attr_reader :verb, :params, :desc$/;" f class:Nebulous.Message
50
68
  desc lib/nebulous/nebrequest.rb /^ attr_reader :desc$/;" f class:Nebulous.NebRequest
51
69
  description lib/nebulous/message.rb /^ alias :description :desc$/;" a class:Nebulous.Message
70
+ ensure_redis_connected lib/nebulous_stomp/request.rb /^ def ensure_redis_connected$/;" f class:NebulousStomp.Request
71
+ ensure_stomp_connected lib/nebulous_stomp/request.rb /^ def ensure_stomp_connected$/;" f class:NebulousStomp.Request
52
72
  example_pending spec/doc_no_pending.rb /^ def example_pending(notifications); end$/;" f class:DocNoPending
53
73
  fake_mess lib/nebulous/stomp_handler_null.rb /^ attr_reader :fake_mess$/;" f class:Nebulous.StompHandlerNull
54
74
  fake_pair lib/nebulous/redis_handler_null.rb /^ attr_reader :fake_pair$/;" f class:Nebulous.RedisHandlerNull
@@ -72,34 +92,54 @@ initialize lib/nebulous/redis_handler.rb /^ def initialize(connectHash, testR
72
92
  initialize lib/nebulous/redis_handler_null.rb /^ def initialize(connectHash={})$/;" f class:Nebulous.RedisHandlerNull
73
93
  initialize lib/nebulous/stomp_handler.rb /^ def initialize(connectHash, testClient=nil)$/;" f class:Nebulous.StompHandler
74
94
  initialize lib/nebulous/stomp_handler_null.rb /^ def initialize(hash={})$/;" f class:Nebulous.StompHandlerNull
95
+ initialize lib/nebulous_stomp/redis_handler.rb /^ def initialize(connectHash=nil, testRedis=nil)$/;" f class:NebulousStomp.RedisHandler
96
+ initialize lib/nebulous_stomp/request.rb /^ def initialize(target, message)$/;" f class:NebulousStomp.Request
97
+ initialize lib/nebulous_stomp/stomp_handler.rb /^ def initialize(connectHash=nil, testClient=nil)$/;" f class:NebulousStomp
98
+ initialize lib/nebulous_stomp/stomp_handler_null.rb /^ def initialize(hash={})$/;" f class:NebulousStomp.StompHandlerNull
75
99
  insert_fake lib/nebulous/redis_handler_null.rb /^ def insert_fake(key, value)$/;" f class:Nebulous.RedisHandlerNull
76
100
  insert_fake lib/nebulous/stomp_handler_null.rb /^ def insert_fake(message)$/;" f class:Nebulous.StompHandlerNull
101
+ insert_fake lib/nebulous_stomp/stomp_handler_null.rb /^ def insert_fake(message)$/;" f class:NebulousStomp.StompHandlerNull
102
+ insert_fake spec/redis_helper_spec.rb /^ def insert_fake( value={woof: true} )$/;" f
77
103
  insert_fake_redis lib/nebulous/nebrequest_null.rb /^ def insert_fake_redis(key, value)$/;" f class:Nebulous.NebRequestNull
78
104
  insert_fake_stomp lib/nebulous/nebrequest_null.rb /^ def insert_fake_stomp(message)$/;" f class:Nebulous.NebRequestNull
79
105
  listen lib/nebulous/stomp_handler.rb /^ def listen(queue)$/;" f class:Nebulous.StompHandler
80
106
  listen lib/nebulous/stomp_handler_null.rb /^ def listen(queue)$/;" f class:Nebulous.StompHandlerNull
107
+ listen lib/nebulous_stomp/stomp_handler.rb /^ def listen(queue)$/;" f class:NebulousStomp
108
+ listen lib/nebulous_stomp/stomp_handler_null.rb /^ def listen(queue)$/;" f class:NebulousStomp.StompHandlerNull
81
109
  listen_with_timeout lib/nebulous/stomp_handler.rb /^ def listen_with_timeout(queue, timeout)$/;" f class:Nebulous.StompHandler
82
110
  listen_with_timeout lib/nebulous/stomp_handler_null.rb /^ def listen_with_timeout(queue, timeout)$/;" f class:Nebulous.StompHandlerNull
111
+ listen_with_timeout lib/nebulous_stomp/stomp_handler.rb /^ def listen_with_timeout(queue, timeout)$/;" f
112
+ listen_with_timeout lib/nebulous_stomp/stomp_handler_null.rb /^ def listen_with_timeout(queue, timeout)$/;" f class:NebulousStomp.StompHandlerNull
83
113
  logger lib/nebulous.rb /^ def self.logger$/;" F class:Nebulous
84
114
  mTimeout lib/nebulous/nebrequest.rb /^ attr_reader :mTimeout$/;" f class:Nebulous.NebRequest
85
115
  message lib/nebulous/nebrequest.rb /^ attr_reader :message$/;" f class:Nebulous.NebRequest
116
+ message_timeout lib/nebulous_stomp/request.rb /^ def message_timeout$/;" f class:NebulousStomp.Request
86
117
  method_missing lib/nebulous/redis_handler.rb /^ def method_missing(meth, *args)$/;" f class:Nebulous.RedisHandler
118
+ method_missing lib/nebulous_stomp/redis_handler.rb /^ def method_missing(meth, *args)$/;" f class:NebulousStomp.RedisHandler
87
119
  neb_connect lib/nebulous/nebrequest.rb /^ def neb_connect$/;" f class:Nebulous.NebRequest
88
120
  neb_qna lib/nebulous/nebrequest.rb /^ def neb_qna(mTimeout)$/;" f class:Nebulous.NebRequest
121
+ neb_qna lib/nebulous_stomp/request.rb /^ def neb_qna(mTimeout)$/;" f class:NebulousStomp.Request
89
122
  nebulous_on? lib/nebulous/nebrequest.rb /^ def nebulous_on?$/;" f class:Nebulous.NebRequest
90
123
  nebulous_on? lib/nebulous/stomp_handler.rb /^ def nebulous_on?$/;" f class:Nebulous.StompHandler
124
+ nebulous_on? lib/nebulous_stomp/stomp_handler.rb /^ def nebulous_on?$/;" f class:NebulousStomp
125
+ new_request spec/request_spec.rb /^ def new_request(target, message)$/;" f
91
126
  on? lib/nebulous.rb /^ def self.on?$/;" F class:Nebulous
92
127
  parameters lib/nebulous/message.rb /^ alias :parameters :params$/;" a class:Nebulous.Message
93
128
  params lib/nebulous/message.rb /^ attr_reader :verb, :params, :desc$/;" f class:Nebulous.Message
94
129
  params lib/nebulous/nebrequest.rb /^ attr_reader :params $/;" f class:Nebulous.NebRequest
130
+ parse_message lib/nebulous_stomp/request.rb /^ def parse_message(message, target)$/;" f class:NebulousStomp.Request
131
+ parse_target lib/nebulous_stomp/request.rb /^ def parse_target(target)$/;" f class:NebulousStomp.Request
95
132
  protocol_hash lib/nebulous/message.rb /^ def protocol_hash$/;" f class:Nebulous.Message
96
133
  protocol_json lib/nebulous/message.rb /^ def protocol_json$/;" f class:Nebulous.Message
97
134
  quit lib/nebulous/redis_handler.rb /^ def quit$/;" f class:Nebulous.RedisHandler
98
135
  quit lib/nebulous/redis_handler_null.rb /^ def quit$/;" f class:Nebulous.RedisHandlerNull
136
+ quit lib/nebulous_stomp/redis_handler.rb /^ def quit$/;" f class:NebulousStomp.RedisHandler
99
137
  redis lib/nebulous/redis_handler.rb /^ attr_reader :redis$/;" f class:Nebulous.RedisHandler
138
+ redis_handler lib/nebulous_stomp/request.rb /^ def redis_handler$/;" f class:NebulousStomp.Request
100
139
  redis_on? lib/nebulous.rb /^ def self.redis_on?$/;" F class:Nebulous
101
140
  redis_on? lib/nebulous/nebrequest.rb /^ def redis_on?$/;" f class:Nebulous.NebRequest
102
141
  redis_on? lib/nebulous/redis_handler.rb /^ def redis_on?$/;" f class:Nebulous.RedisHandler
142
+ redis_on? lib/nebulous_stomp/redis_handler.rb /^ def redis_on?$/;" f class:NebulousStomp.RedisHandler
103
143
  replyID lib/nebulous/nebrequest.rb /^ attr_reader :replyID$/;" f class:Nebulous.NebRequest
104
144
  reply_id lib/nebulous/message.rb /^ attr_accessor :reply_id$/;" f class:Nebulous.Message
105
145
  reply_id= lib/nebulous/message.rb /^ attr_accessor :reply_id$/;" f class:Nebulous.Message
@@ -108,13 +148,21 @@ requestQ lib/nebulous/nebrequest.rb /^ attr_reader :requestQ$/;" f class:Nebu
108
148
  reset lib/nebulous/param.rb /^ def reset$/;" f class:Nebulous.Param
109
149
  respond_error lib/nebulous/message.rb /^ def respond_error(err,fields=[])$/;" f class:Nebulous.Message
110
150
  respond_error lib/nebulous/stomp_handler_null.rb /^ def respond_error(nebMess,err,fields=[])$/;" f class:Nebulous.StompHandlerNull
151
+ respond_error lib/nebulous_stomp/stomp_handler_null.rb /^ def respond_error(nebMess,err,fields=[])$/;" f class:NebulousStomp.StompHandlerNull
111
152
  respond_success lib/nebulous/message.rb /^ def respond_success$/;" f class:Nebulous.Message
112
153
  respond_success lib/nebulous/stomp_handler_null.rb /^ def respond_success(nebMess)$/;" f class:Nebulous.StompHandlerNull
154
+ respond_success lib/nebulous_stomp/stomp_handler_null.rb /^ def respond_success(nebMess)$/;" f class:NebulousStomp.StompHandlerNull
113
155
  responseQ lib/nebulous/nebrequest.rb /^ attr_reader :responseQ$/;" f class:Nebulous.NebRequest
156
+ run_listen spec/stomp_handler_null_spec.rb /^ def run_listen(secs)$/;" f
157
+ run_listen_with_timeout spec/stomp_handler_null_spec.rb /^ def run_listen_with_timeout(secs)$/;" f
114
158
  send lib/nebulous/nebrequest.rb /^ def send(mTimeout=@mTimeout, cTimeout=@cTimeout)$/;" f class:Nebulous.NebRequest
159
+ send lib/nebulous_stomp/request.rb /^ def send(mtimeout=message_timeout, ctimeout=cache_timeout)$/;" f class:NebulousStomp.Request
115
160
  send_message lib/nebulous/stomp_handler.rb /^ def send_message(queue, mess)$/;" f class:Nebulous.StompHandler
116
161
  send_message lib/nebulous/stomp_handler_null.rb /^ def send_message(queue, nebMess)$/;" f class:Nebulous.StompHandlerNull
162
+ send_message lib/nebulous_stomp/stomp_handler.rb /^ def send_message(queue, mess)$/;" f
163
+ send_message lib/nebulous_stomp/stomp_handler_null.rb /^ def send_message(queue, nebMess)$/;" f class:NebulousStomp.StompHandlerNull
117
164
  send_no_cache lib/nebulous/nebrequest.rb /^ def send_no_cache(mTimeout=@mTimeout)$/;" f class:Nebulous.NebRequest
165
+ send_no_cache lib/nebulous_stomp/request.rb /^ def send_no_cache(mtimeout=message_timeout)$/;" f class:NebulousStomp.Request
118
166
  set lib/nebulous/param.rb /^ def set(p={})$/;" f class:Nebulous.Param
119
167
  set lib/nebulous/redis_handler_null.rb /^ def set(key, value, hash=nil); insert_fake(key, value); end$/;" f class:Nebulous.RedisHandlerNull
120
168
  set_logger lib/nebulous.rb /^ def self.set_logger(logger)$/;" F class:Nebulous
@@ -122,14 +170,24 @@ set_logger lib/nebulous/param.rb /^ def set_logger(lg)$/;" f class:Nebulous.P
122
170
  stomp_body lib/nebulous/message.rb /^ attr_reader :stomp_headers, :stomp_body$/;" f class:Nebulous.Message
123
171
  stomp_connect lib/nebulous/stomp_handler.rb /^ def stomp_connect$/;" f class:Nebulous.StompHandler
124
172
  stomp_connect lib/nebulous/stomp_handler_null.rb /^ def stomp_connect$/;" f class:Nebulous.StompHandlerNull
173
+ stomp_connect lib/nebulous_stomp/stomp_handler.rb /^ def stomp_connect$/;" f class:NebulousStomp
174
+ stomp_connect lib/nebulous_stomp/stomp_handler_null.rb /^ def stomp_connect$/;" f class:NebulousStomp.StompHandlerNull
125
175
  stomp_disconnect lib/nebulous/stomp_handler.rb /^ def stomp_disconnect$/;" f class:Nebulous.StompHandler
126
176
  stomp_disconnect lib/nebulous/stomp_handler_null.rb /^ def stomp_disconnect$/;" f class:Nebulous.StompHandlerNull
177
+ stomp_disconnect lib/nebulous_stomp/stomp_handler.rb /^ def stomp_disconnect$/;" f class:NebulousStomp
178
+ stomp_disconnect lib/nebulous_stomp/stomp_handler_null.rb /^ def stomp_disconnect$/;" f class:NebulousStomp.StompHandlerNull
179
+ stomp_handler lib/nebulous_stomp/request.rb /^ def stomp_handler$/;" f class:NebulousStomp.Request
180
+ stomp_handler= lib/nebulous_stomp/request.rb /^ def stomp_handler=(handler)$/;" f class:NebulousStomp.Request
127
181
  stomp_headers lib/nebulous/message.rb /^ attr_reader :stomp_headers, :stomp_body$/;" f class:Nebulous.Message
128
182
  stomp_message spec/helpers.rb /^ def stomp_message(contentType, body, inReplyTo=nil)$/;" f class:Helpers
183
+ symbolise spec/message_spec.rb /^ def symbolise(hash)$/;" f
129
184
  target lib/nebulous/nebrequest.rb /^ attr_reader :target$/;" f class:Nebulous.NebRequest
130
185
  to_cache lib/nebulous/message.rb /^ def to_cache$/;" f class:Nebulous.Message
131
186
  to_s lib/nebulous/message.rb /^ def to_s$/;" f class:Nebulous.Message
187
+ turn_off_nebulous spec/request_spec.rb /^ def turn_off_nebulous$/;" f
188
+ turn_off_redis spec/request_spec.rb /^ def turn_off_redis$/;" f
132
189
  validate lib/nebulous/param.rb /^ def validate(exemplar, hash, message)$/;" f class:Nebulous.Param
133
190
  verb lib/nebulous/message.rb /^ attr_reader :verb, :params, :desc$/;" f class:Nebulous.Message
134
191
  verb lib/nebulous/nebrequest.rb /^ attr_reader :verb $/;" f class:Nebulous.NebRequest
135
192
  with_timeout lib/nebulous/stomp_handler.rb /^ def with_timeout(secs)$/;" F class:Nebulous.StompHandler
193
+ with_timeout lib/nebulous_stomp/stomp_handler.rb /^ def with_timeout(secs)$/;" f class:NebulousStomp.StompHandler
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nebulous_stomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jones
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2019-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler