ruby_rabbitmq_janus 4.0.0.pre.939137013 → 4.0.0.pre.1001043172

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -1
  3. data/Rakefile +197 -11
  4. data/lib/rrj/janus/responses/admin.rb +1 -1
  5. data/lib/rrj/janus/responses/response.rb +1 -1
  6. data/lib/rrj/rabbit/publisher/admin.rb +1 -2
  7. data/lib/rrj/tools/replaces/replace.rb +2 -3
  8. data/spec/config/database.rb +13 -1
  9. data/spec/config/initializer.rb +2 -4
  10. data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +0 -1
  11. data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +0 -1
  12. data/spec/ruby_rabbitmq_janus/rabbit/publisher/exclusive_spec.rb +0 -1
  13. data/spec/ruby_rabbitmq_janus/rabbit/publisher/non_exclusive_spec.rb +0 -1
  14. data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +0 -1
  15. data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +0 -1
  16. data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +0 -1
  17. data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +0 -10
  18. data/spec/ruby_rabbitmq_janus/rrj_admin_list_handles_spec.rb +0 -10
  19. data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +0 -1
  20. data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +0 -1
  21. data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +0 -1
  22. data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +0 -1
  23. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +0 -1
  24. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +0 -1
  25. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +0 -1
  26. data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +0 -1
  27. data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +0 -1
  28. data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +0 -10
  29. data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +0 -10
  30. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +0 -21
  31. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +0 -21
  32. data/spec/spec_helper.rb +1 -1
  33. data/spec/support/actions.rb +26 -0
  34. data/spec/support/admin_actions.rb +26 -0
  35. data/spec/support/examples_base.rb +14 -0
  36. metadata +8 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 826e350f59661d1728915d109edf5b31b271b5c54f9c6416807f0e1c5a673aa7
4
- data.tar.gz: 141de1cec6f01becb59e658a3c199012f00defc9c3d55759236c4bd45e9519a0
3
+ metadata.gz: d6069e8e1ccf8f92943654f52100d7414de95b20a834da816d9ecf6a2b9bf231
4
+ data.tar.gz: dc412ef9a3573fc04a6d31e98657f6af752c059fb6dd8112fea261c8e5752f9b
5
5
  SHA512:
6
- metadata.gz: c7b9e383e3c16d3163336ab19b2bc8b6f9368a0a96356c3043cc6b5d4a333d6c2efbbb71ea66a985c5c768ad62c8d11c56be7478635a66243dd3f9b8287c868a
7
- data.tar.gz: c578835476ba0c0f3e796cf8deb54a6eb2d344f0418582bef6e9c749be95fbbccdc1de8ba0d00f3270e183c279965b89f47ca41748ac865b9ca169c62b73e658
6
+ metadata.gz: 6f0edfb9ab019e9d547300f17edc3d2a001d36767de2ec4551bae5b3f59288d4b64fa945c09015fd4e234b8414632f0499d992b8bd2558703fe778f28697d23c
7
+ data.tar.gz: 6a35acf79fe896f6380ed50de78cc4199831fd57aec2941b2d69070588153c7fe5275d202ab188751a135724c4d8b336fae9d08e155c9a0e28ff47164b104752
data/README.md CHANGED
@@ -1,4 +1,11 @@
1
- # Ruby RabbitMQ Janus | [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus) [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus) [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus) [![Known Vulnerabilities](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus/badge.svg)](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus)
1
+ # Ruby RabbitMQ Janus
2
+ [![RSpec](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/rspec.yml/badge.svg)](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/rspec.yml)
3
+ [![Linter](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/linter.yml/badge.svg)](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/linter.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus)
5
+ [![Docs](https://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](https://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/44e8680ad5e96d109be2/maintainability)](https://codeclimate.com/github/dazzl-tv/ruby-rabbitmq-janus/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/44e8680ad5e96d109be2/test_coverage)](https://codeclimate.com/github/dazzl-tv/ruby-rabbitmq-janus/test_coverage)
8
+ [![Known Vulnerabilities](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus/badge.svg)](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus)
2
9
 
3
10
  Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
4
11
 
data/Rakefile CHANGED
@@ -3,19 +3,205 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
- # Exclude all spec with type :thread
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- # Exclude all spec with type :thread
10
- RSpec::Core::RakeTask.new(:classic) do |t|
11
- t.rspec_opts = '--tag ~type:thread'
6
+ RSpec::Core::RakeTask.new(:config) do |t|
7
+ t.rspec_opts = '--tag name:config'
12
8
  end
13
9
 
14
- # Include just spec with type :thread
15
- RSpec::Core::RakeTask.new(:concurrency) do |t|
10
+ RSpec::Core::RakeTask.new(:thread) do |t|
16
11
  t.rspec_opts = '--tag type:thread'
17
12
  end
18
13
 
19
- task default: :spec
20
- task request: :classic
21
- task thread: :concurrency
14
+ RSpec::Core::RakeTask.new(:set_session_timeout) do |t|
15
+ t.rspec_opts = '--tag name:set_session_timeout'
16
+ end
17
+
18
+ RSpec::Core::RakeTask.new(:disallow_token) do |t|
19
+ t.rspec_opts = '--tag name:disallow_token'
20
+ end
21
+
22
+ RSpec::Core::RakeTask.new(:admin) do |t|
23
+ t.rspec_opts = '--tag name:admin'
24
+ end
25
+
26
+ RSpec::Core::RakeTask.new(:set_log_timestamps) do |t|
27
+ t.rspec_opts = '--tag name:set_log_timestamps'
28
+ end
29
+
30
+ RSpec::Core::RakeTask.new(:start_text2pcap) do |t|
31
+ t.rspec_opts = '--tag name:start_text2pcap'
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:set_log_colors) do |t|
35
+ t.rspec_opts = '--tag name:set_log_colors'
36
+ end
37
+
38
+ RSpec::Core::RakeTask.new(:stop_pcap) do |t|
39
+ t.rspec_opts = '--tag name:stop_pcap'
40
+ end
41
+
42
+ RSpec::Core::RakeTask.new(:set_no_media_timer) do |t|
43
+ t.rspec_opts = '--tag name:set_no_media_timer'
44
+ end
45
+
46
+ RSpec::Core::RakeTask.new(:pcap) do |t|
47
+ t.rspec_opts = '--tag name:pcap'
48
+ end
49
+
50
+ RSpec::Core::RakeTask.new(:attach) do |t|
51
+ t.rspec_opts = '--tag name:attach'
52
+ end
53
+
54
+ RSpec::Core::RakeTask.new(:list_sessions) do |t|
55
+ t.rspec_opts = '--tag name:list_sessions'
56
+ end
57
+
58
+ RSpec::Core::RakeTask.new(:create) do |t|
59
+ t.rspec_opts = '--tag name:create'
60
+ end
61
+
62
+ RSpec::Core::RakeTask.new(:event_admin) do |t|
63
+ t.rspec_opts = '--tag name:event_admin'
64
+ end
65
+
66
+ RSpec::Core::RakeTask.new(:info) do |t|
67
+ t.rspec_opts = '--tag name:info'
68
+ end
69
+
70
+ RSpec::Core::RakeTask.new(:add_token) do |t|
71
+ t.rspec_opts = '--tag name:add_token'
72
+ end
73
+
74
+ RSpec::Core::RakeTask.new(:set_log_level) do |t|
75
+ t.rspec_opts = '--tag name:set_log_level'
76
+ end
77
+
78
+ RSpec::Core::RakeTask.new(:set_locking_debug) do |t|
79
+ t.rspec_opts = '--tag name:set_locking_debug'
80
+ end
81
+
82
+ RSpec::Core::RakeTask.new(:remove_token) do |t|
83
+ t.rspec_opts = '--tag name:remove_token'
84
+ end
85
+
86
+ RSpec::Core::RakeTask.new(:answer) do |t|
87
+ t.rspec_opts = '--tag name:answer'
88
+ end
89
+
90
+ RSpec::Core::RakeTask.new(:offer) do |t|
91
+ t.rspec_opts = '--tag name:offer'
92
+ end
93
+
94
+ RSpec::Core::RakeTask.new(:set_libnice_debug) do |t|
95
+ t.rspec_opts = '--tag name:set_libnice_debug'
96
+ end
97
+
98
+ RSpec::Core::RakeTask.new(:allow_token) do |t|
99
+ t.rspec_opts = '--tag name:allow_token'
100
+ end
101
+
102
+ RSpec::Core::RakeTask.new(:janus_instance) do |t|
103
+ t.rspec_opts = '--tag name:janus_instance'
104
+ end
105
+
106
+ RSpec::Core::RakeTask.new(:detach) do |t|
107
+ t.rspec_opts = '--tag name:detach'
108
+ end
109
+
110
+ RSpec::Core::RakeTask.new(:destroy) do |t|
111
+ t.rspec_opts = '--tag name:destroy'
112
+ end
113
+
114
+ RSpec::Core::RakeTask.new(:trickles) do |t|
115
+ t.rspec_opts = '--tag name:trickles'
116
+ end
117
+
118
+ RSpec::Core::RakeTask.new(:standard) do |t|
119
+ t.rspec_opts = '--tag name:standard'
120
+ end
121
+
122
+ RSpec::Core::RakeTask.new(:message) do |t|
123
+ t.rspec_opts = '--tag name:message'
124
+ end
125
+
126
+ RSpec::Core::RakeTask.new(:errors) do |t|
127
+ t.rspec_opts = '--tag name:'
128
+ end
129
+
130
+ RSpec::Core::RakeTask.new(:event) do |t|
131
+ t.rspec_opts = '--tag name:event'
132
+ end
133
+
134
+ RSpec::Core::RakeTask.new(:response) do |t|
135
+ t.rspec_opts = '--tag name:response'
136
+ end
137
+
138
+ RSpec::Core::RakeTask.new(:list_handles) do |t|
139
+ t.rspec_opts = '--tag name:list_handles'
140
+ end
141
+
142
+ RSpec::Core::RakeTask.new(:list_tokens) do |t|
143
+ t.rspec_opts = '--tag name:list_tokens'
144
+ end
145
+
146
+ RSpec::Core::RakeTask.new(:keepalive) do |t|
147
+ t.rspec_opts = '--tag name:keepalive'
148
+ end
149
+
150
+ RSpec::Core::RakeTask.new(:logger) do |t|
151
+ t.rspec_opts = '--tag name:logger'
152
+ end
153
+
154
+ RSpec::Core::RakeTask.new(:replace) do |t|
155
+ t.rspec_opts = '--tag name:replace'
156
+ end
157
+
158
+ RSpec::Core::RakeTask.new(:set_max_nack_queue) do |t|
159
+ t.rspec_opts = '--tag name:set_max_nack_queue'
160
+ end
161
+
162
+ RSpec::Core::RakeTask.new(:tricke) do |t|
163
+ t.rspec_opts = '--tag name:tricke'
164
+ end
165
+
166
+ RSpec::Core::RakeTask.new(:handle_info) do |t|
167
+ t.rspec_opts = '--tag name:handle_info'
168
+ end
169
+
170
+ RSpec::Core::RakeTask.new(:connect) do |t|
171
+ t.rspec_opts = '--tag name:connect'
172
+ end
173
+
174
+ RSpec::Core::RakeTask.new(:listener) do |t|
175
+ t.rspec_opts = '--tag name:listener'
176
+ end
177
+
178
+ RSpec::Core::RakeTask.new(:base_event) do |t|
179
+ t.rspec_opts = '--tag name:base_event'
180
+ end
181
+
182
+ RSpec::Core::RakeTask.new(:publisher_admin) do |t|
183
+ t.rspec_opts = '--tag name:publisher_admin'
184
+ end
185
+
186
+ RSpec::Core::RakeTask.new(:exclusive) do |t|
187
+ t.rspec_opts = '--tag name:exclusive'
188
+ end
189
+
190
+ RSpec::Core::RakeTask.new(:non_exclusive) do |t|
191
+ t.rspec_opts = '--tag name:non_exclusive'
192
+ end
193
+
194
+ RSpec::Core::RakeTask.new(:propertie) do |t|
195
+ t.rspec_opts = '--tag name:propertie'
196
+ end
197
+
198
+ task spec: %I[config thread set_session_timeout disallow_token admin
199
+ set_log_timestamps set_log_colors start_text2pcap attach
200
+ set_no_media_timer stop_pcap pcap list_sessions create
201
+ event_admin info add_token set_log_level set_locking_debug
202
+ remove_token answer offer set_libnice_debug allow_token
203
+ janus_instance detach destroy trickles standard message errors
204
+ event response list_handles list_tokens keepalive logger
205
+ replace set_max_nack_queue tricke handle_info connect listener
206
+ base_event publisher_admin non_exclusive exclusive propertie
207
+ ]
@@ -6,7 +6,7 @@ module RubyRabbitmqJanus
6
6
  # Response for admin request
7
7
  #
8
8
  # @see Example request response https://janus.conf.meetecho.com/docs/admin.html
9
- class Admin < Standard
9
+ class Admin < Event
10
10
  # @return [Array] List of sessions running in Janus Instance.
11
11
  def sessions
12
12
  read_data(__method__.to_s)
@@ -95,6 +95,6 @@ end
95
95
 
96
96
  require 'rrj/janus/responses/error'
97
97
  require 'rrj/janus/responses/standard'
98
- require 'rrj/janus/responses/admin'
99
98
  require 'rrj/janus/responses/event'
99
+ require 'rrj/janus/responses/admin'
100
100
  require 'rrj/janus/responses/rspec'
@@ -12,8 +12,7 @@ module RubyRabbitmqJanus
12
12
  #
13
13
  # @param [String] exchange Exchange used for the transaction
14
14
  def initialize(exchange)
15
- @reply = exchange.queue('', exclusive: true)
16
- # @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
15
+ @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
17
16
  super(exchange)
18
17
  subscribe_to_queue
19
18
  end
@@ -46,8 +46,7 @@ module RubyRabbitmqJanus
46
46
  end
47
47
 
48
48
  def replace_other
49
- values = @opts['replace']
50
- running_hash(rewrite_key_to_string(values))
49
+ running_hash(rewrite_key_to_string(@opts['replace'])[0].to_h)
51
50
  end
52
51
 
53
52
  def add_other
@@ -60,7 +59,7 @@ module RubyRabbitmqJanus
60
59
  node.map do |key, value|
61
60
  [key.to_s, value?(value)]
62
61
  end
63
- ].to_h
62
+ ]
64
63
  end
65
64
 
66
65
  def value?(value)
@@ -26,6 +26,18 @@ def load_mongo
26
26
  end
27
27
 
28
28
  # :reek:UtilityFunction
29
- def after_load_database
29
+ def clean_db_and_queues
30
30
  DatabaseCleaner.clean
31
+
32
+ rb = RubyRabbitmqJanus::Rabbit::Connect.new
33
+ rb.start
34
+
35
+ channel = rb.channel
36
+
37
+ %w[from-janus from-janus-admin].each do |queue_name|
38
+ queue = channel.queue(queue_name, auto_delete: false)
39
+ queue.purge
40
+ end
41
+
42
+ rb.close
31
43
  end
@@ -10,7 +10,5 @@ class EventTest
10
10
  end
11
11
  end
12
12
 
13
- # Initialize listener
14
- # actions = EventTest.new.actions
15
- # @event = RubyRabbitmqJanus::Process::Concurrencies::Event.new
16
- # @event.run(&actions)
13
+ require_relative '../support/actions'
14
+ require_relative '../support/admin_actions'
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Listener::From, type: :rabbit,
6
- broken: true,
7
6
  name: :listener do
8
7
  let(:publish) do
9
8
  rabbit = RubyRabbitmqJanus::Rabbit::Connect.new.rabbit
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Publisher::Admin, type: :rabbit,
6
- broken: true,
7
6
  name: :publisher_admin do
8
7
  let(:pusblish) { described_class.new }
9
8
 
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Publisher::Exclusive, type: :rabbit,
6
- broken: true,
7
6
  name: :exclusive do
8
7
  let(:publish) { described_class.new }
9
8
 
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Publisher::NonExclusive, type: :rabbit,
6
- broken: true,
7
6
  name: :non_exclusive do
8
7
  let(:publish) { described_class.new }
9
8
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :add_token do
9
8
  let(:type) { 'admin::add_token' }
10
9
  let(:parameter) { { 'token' => [*('a'..'z'), *('0'..'9')].sample(24).join } }
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :allow_token do
9
8
  let(:type) { 'admin::allow_token' }
10
9
  let(:token) { [*('a'..'z'), *('0'..'9')].sample(24).join }
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :disallow_token do
9
8
  let(:type) { 'admin::disallow_token' }
10
9
  let(:token) { [*('a'..'z'), *('0'..'9')].sample(24).join }
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :handle_info do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -20,14 +19,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
20
19
 
21
20
  include_examples 'when transaction admin exception'
22
21
  end
23
-
24
- context 'when session/handle exist' do
25
- before { helper_janus_instance_create_handle }
26
-
27
- let(:info) { :info }
28
- let(:info_type) { Hash }
29
-
30
- include_examples 'when transaction admin success info'
31
- end
32
22
  end
33
23
  end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :list_handles do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -20,14 +19,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
20
19
 
21
20
  include_examples 'when transaction admin exception'
22
21
  end
23
-
24
- context 'when session/handle exist' do
25
- before { helper_janus_instance_create_handle }
26
-
27
- let(:info) { :handles }
28
- let(:info_type) { Array }
29
-
30
- include_examples 'when transaction admin success info'
31
- end
32
22
  end
33
23
  end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :list_tokens do
9
8
  let(:type) { 'admin::list_tokens' }
10
9
  let(:number) { '2' }
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :remove_token do
9
8
  let(:type) { 'admin::remove_token' }
10
9
  let(:token) { [*('a'..'z'), *('0'..'9')].sample(24).join }
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_libnice_debug do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_locking_debug do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_log_colors do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_log_level do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_log_timestamps do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_no_media_timer do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :set_session_timeout do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :pcap do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -26,14 +25,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
26
25
 
27
26
  include_examples 'when transaction admin exception'
28
27
  end
29
-
30
- context 'when session/handle exist' do
31
- before { helper_janus_instance_create_handle }
32
-
33
- let(:info) { :janus }
34
- let(:info_type) { String }
35
-
36
- include_examples 'when transaction admin success info'
37
- end
38
28
  end
39
29
  end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :start_text2pcap do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -26,14 +25,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
26
25
 
27
26
  include_examples 'when transaction admin exception'
28
27
  end
29
-
30
- context 'when session/handle exist' do
31
- before { helper_janus_instance_create_handle }
32
-
33
- let(:info) { :janus }
34
- let(:info_type) { String }
35
-
36
- include_examples 'when transaction admin success info'
37
- end
38
28
  end
39
29
  end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :stop_pcap do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -20,25 +19,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
20
19
 
21
20
  include_examples 'when transaction admin exception'
22
21
  end
23
-
24
- context 'when session/handle exist' do
25
- before { helper_janus_instance_create_handle }
26
-
27
- context "with pcap don't started" do
28
- let(:exception_class) { RubyRabbitmqJanus::Errors::Janus::Responses::Unknown }
29
- let(:exception_message) { '[490] Reason : Capture not started' }
30
-
31
- include_examples 'when transaction admin exception'
32
- end
33
-
34
- context 'with pcap started' do
35
- before { helper_janus_start_pcap }
36
-
37
- let(:info) { :janus }
38
- let(:info_type) { String }
39
-
40
- include_examples 'when transaction admin success info'
41
- end
42
- end
43
22
  end
44
23
  end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::RRJAdmin, type: :request,
6
6
  level: :admin,
7
- broken: true,
8
7
  name: :pcap do
9
8
  before { helper_janus_instance_without_token }
10
9
 
@@ -20,25 +19,5 @@ describe RubyRabbitmqJanus::RRJAdmin, type: :request,
20
19
 
21
20
  include_examples 'when transaction admin exception'
22
21
  end
23
-
24
- context 'when session/handle exist' do
25
- before { helper_janus_instance_create_handle }
26
-
27
- context "with pcap don't started" do
28
- let(:exception_class) { RubyRabbitmqJanus::Errors::Janus::Responses::Unknown }
29
- let(:exception_message) { '[490] Reason : Capture not started' }
30
-
31
- include_examples 'when transaction admin exception'
32
- end
33
-
34
- context 'with pcap started' do
35
- before { helper_janus_start_pcap }
36
-
37
- let(:info) { :janus }
38
- let(:info_type) { String }
39
-
40
- include_examples 'when transaction admin success info'
41
- end
42
- end
43
22
  end
44
23
  end
data/spec/spec_helper.rb CHANGED
@@ -87,7 +87,7 @@ RSpec.configure do |config|
87
87
  # Clean database before execute an example
88
88
  DatabaseCleaner.strategy = ENV['MONGO'] == 'true' ? :deletion : :truncation
89
89
  config.before do |example|
90
- after_load_database unless example.metadata[:type].include?(:tools)
90
+ clean_db_and_queues unless example.metadata[:type].eql?(:tools)
91
91
  end
92
92
 
93
93
  # Use timeout for requester
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Execute this code when janus return an events in standard queue
4
+ class Actions
5
+ def initialize
6
+ puts 'Initialize listener Actions'
7
+ end
8
+
9
+ # Default method using for sending a block of code
10
+ def actions
11
+ response = nil
12
+
13
+ lambda do |reason, data|
14
+ puts "Execute block code with reason : #{reason}"
15
+ break response = data
16
+ end
17
+
18
+ response
19
+ end
20
+
21
+ private
22
+
23
+ def case_events(data)
24
+ puts "Event : #{data}"
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Execute this code when janus return an events in admin queue
4
+ class AdminActions
5
+ def initialize
6
+ puts '[admin] Initialize listener AdminActions'
7
+ end
8
+
9
+ # Default method using for sending a block of code
10
+ def actions
11
+ response = nil
12
+
13
+ lambda do |_reason, data|
14
+ puts "[admin] Execute block code with reason : #{reason}"
15
+ case_events(data.to_hash)
16
+ end
17
+
18
+ response
19
+ end
20
+
21
+ private
22
+
23
+ def case_events(data)
24
+ puts "[admin] Event : #{data}"
25
+ end
26
+ end
@@ -55,6 +55,20 @@ RSpec.shared_examples 'when transaction not exclusive success' do
55
55
  include_examples 'when transaction not exclusive'
56
56
 
57
57
  it { expect(transaction.to_json).to eql('{}') }
58
+
59
+ =begin
60
+ describe 'read listener' do
61
+ before do
62
+ listener
63
+ transaction
64
+ end
65
+
66
+ let(:listener) { @act = Actions.new.actions }
67
+ let(:response) { RubyRabbitmqJanus::Process::Concurrencies::Event.new.run(&@act) }
68
+
69
+ it { expect(response).to match_json_schema(schema_success) }
70
+ end
71
+ =end
58
72
  end
59
73
 
60
74
  RSpec.shared_examples 'when transaction not exclusive exception' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_rabbitmq_janus
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre.939137013
4
+ version: 4.0.0.pre.1001043172
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -424,14 +424,14 @@ dependencies:
424
424
  requirements:
425
425
  - - "~>"
426
426
  - !ruby/object:Gem::Version
427
- version: '2.17'
427
+ version: '2.19'
428
428
  type: :runtime
429
429
  prerelease: false
430
430
  version_requirements: !ruby/object:Gem::Requirement
431
431
  requirements:
432
432
  - - "~>"
433
433
  - !ruby/object:Gem::Version
434
- version: '2.17'
434
+ version: '2.19'
435
435
  - !ruby/object:Gem::Dependency
436
436
  name: key_path
437
437
  requirement: !ruby/object:Gem::Requirement
@@ -714,6 +714,8 @@ files:
714
714
  - spec/ruby_rabbitmq_janus/tools/replaces/session_spec.rb
715
715
  - spec/ruby_rabbitmq_janus/tools/type_spec.rb
716
716
  - spec/spec_helper.rb
717
+ - spec/support/actions.rb
718
+ - spec/support/admin_actions.rb
717
719
  - spec/support/examples_admin.rb
718
720
  - spec/support/examples_base.rb
719
721
  - spec/support/examples_config.rb
@@ -780,14 +782,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
780
782
  requirements:
781
783
  - - ">="
782
784
  - !ruby/object:Gem::Version
783
- version: 2.6.0
785
+ version: 2.7.0
784
786
  required_rubygems_version: !ruby/object:Gem::Requirement
785
787
  requirements:
786
788
  - - ">"
787
789
  - !ruby/object:Gem::Version
788
790
  version: 1.3.1
789
791
  requirements: []
790
- rubygems_version: 3.0.3.1
792
+ rubygems_version: 3.1.6
791
793
  signing_key:
792
794
  specification_version: 4
793
795
  summary: Ruby RabbitMQ Janus