ruby_rabbitmq_janus 4.0.0.pre.949167646 → 4.0.0.pre.1001345090
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +196 -11
- data/lib/rrj/errors/rabbit/rabbit.rb +34 -32
- data/lib/rrj/janus/responses/admin.rb +1 -1
- data/lib/rrj/janus/responses/response.rb +1 -1
- data/lib/rrj/process/thread_runner_concern.rb +1 -1
- data/lib/rrj/rabbit/publisher/admin.rb +1 -2
- data/lib/rrj/tools/bin/config.rb +4 -3
- data/lib/rrj/tools/gem/config/janus.rb +1 -1
- data/lib/rrj/tools/gem/config/queues.rb +4 -4
- data/lib/rrj/tools/gem/config/rabbit.rb +1 -1
- data/spec/config/database.rb +13 -1
- data/spec/config/initializer.rb +2 -4
- data/spec/ruby_rabbitmq_janus/janus/messages/message_spec.rb +0 -2
- data/spec/ruby_rabbitmq_janus/rabbit/{publisher/base_spec.rb → base_event_spec.rb} +2 -2
- data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/exclusive_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/non_exclusive_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +0 -10
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_handles_spec.rb +0 -10
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +0 -1
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +0 -10
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +0 -10
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +0 -21
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +0 -21
- data/spec/spec_helper.rb +5 -2
- data/spec/support/actions.rb +26 -0
- data/spec/support/admin_actions.rb +26 -0
- data/tmp/coverage/index.html +21519 -0
- metadata +10 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5210b75f77a8ba1740c4d1214226aa7cbbf4649b9dee74a43f49cf3e579813bd
|
4
|
+
data.tar.gz: 01604f74eb2a0fae1374f25439cb08279cbf2addbe1bdb61d032a7fa668614e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd9bebe544f63f5c2c86a9f24bee316a3abd9e9dad088edeec0261f8b4bfadf42265fd53dbd16fd9b247804382bf54c29e905a194aff0d0439f5a1b6abf3271c
|
7
|
+
data.tar.gz: ceb76af8e220d8e3c11833b61841b2811d345b5a4d46bdd9d34a66eb65840ed3022d30a2cb7d817d02c80085c4aaa522f3217e5c6a6ba12d1e7f24d11c015cb1
|
data/Rakefile
CHANGED
@@ -3,19 +3,204 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
|
6
|
-
|
7
|
-
|
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
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
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]
|
@@ -2,50 +2,52 @@
|
|
2
2
|
|
3
3
|
module RubyRabbitmqJanus
|
4
4
|
module Errors
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
module Rabbit
|
6
|
+
# Define a super class for all error in module Rabbit
|
7
|
+
class Base < RRJError
|
8
|
+
def initialize(message, level = :fatal)
|
9
|
+
super "[Rabbit]#{message}", level
|
10
|
+
end
|
9
11
|
end
|
10
|
-
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
module Connect
|
14
|
+
# Error when transaction hs no block
|
15
|
+
class MissingAction < RubyRabbitmqJanus::Errors::Rabbit::Base
|
16
|
+
def initialize
|
17
|
+
super 'Transaction failed, missing block'
|
18
|
+
end
|
17
19
|
end
|
18
|
-
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
# Error When transaction timeout
|
22
|
+
class TransactionTimeout < RubyRabbitmqJanus::Errors::Rabbit::Base
|
23
|
+
def initialize(error)
|
24
|
+
super error
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
module Listener
|
30
|
+
# Error when response is empty
|
31
|
+
class ResponseEmpty < RubyRabbitmqJanus::Errors::Rabbit::Base
|
32
|
+
def initialize(response)
|
33
|
+
super "Response is empty ! (#{response})"
|
34
|
+
end
|
33
35
|
end
|
34
|
-
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# Error when response is nil
|
38
|
+
class ResponseNil < RubyRabbitmqJanus::Errors::Rabbit::Base
|
39
|
+
def initialize(response)
|
40
|
+
super "Response is nil ! (#{response})"
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
module Publisher
|
46
|
+
# Error when correlation string is not equal
|
47
|
+
class TestCorrelation < RubyRabbitmqJanus::Errors::Rabbit::Base
|
48
|
+
def initialize(message, propertie)
|
49
|
+
super "Correlation doesn't equal (msg: #{message}) != (prp: #{propertie})"
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -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 <
|
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)
|
@@ -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(
|
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
|
data/lib/rrj/tools/bin/config.rb
CHANGED
@@ -14,7 +14,8 @@ begin
|
|
14
14
|
Config.load_and_set_settings(config_conf)
|
15
15
|
end
|
16
16
|
rescue LoadError => exception
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
puts 'Custom configuration is not present,' \
|
18
|
+
" use default configuration. (#{exception})"
|
19
|
+
rescue StandardError => exception
|
20
|
+
puts exception
|
20
21
|
end
|
@@ -19,7 +19,7 @@ module RubyRabbitmqJanus
|
|
19
19
|
# @return [String] read configuration for plugin with index
|
20
20
|
def plugin_at(index = 0)
|
21
21
|
@options['janus']['plugins'][index].to_s
|
22
|
-
rescue
|
22
|
+
rescue StandardError
|
23
23
|
raise RubyRabbitmqJanus::Errors::Tools::Plugins, index
|
24
24
|
end
|
25
25
|
|
@@ -11,28 +11,28 @@ module RubyRabbitmqJanus
|
|
11
11
|
# @return [String] Get to name queue_from (pattern)
|
12
12
|
def queue_from
|
13
13
|
@options['queues']['standard']['from'].to_s
|
14
|
-
rescue
|
14
|
+
rescue StandardError
|
15
15
|
raise RubyRabbitmqJanus::Errors::Tools::QueueFrom
|
16
16
|
end
|
17
17
|
|
18
18
|
# @return [String] Get to name queue_to (pattern)
|
19
19
|
def queue_to
|
20
20
|
@options['queues']['standard']['to'].to_s
|
21
|
-
rescue
|
21
|
+
rescue StandardError
|
22
22
|
raise RubyRabbitmqJanus::Errors::Tools::QueueTo
|
23
23
|
end
|
24
24
|
|
25
25
|
# @return [String] Get to name queue_admin_from (pattern)
|
26
26
|
def queue_admin_from
|
27
27
|
@options['queues']['admin']['from'].to_s
|
28
|
-
rescue
|
28
|
+
rescue StandardError
|
29
29
|
raise RubyRabbitmqJanus::Errors::Tools::QueueAdminFrom
|
30
30
|
end
|
31
31
|
|
32
32
|
# @return [String] Get to name queue_admin_from (pattern)
|
33
33
|
def queue_admin_to
|
34
34
|
@options['queues']['admin']['to'].to_s
|
35
|
-
rescue
|
35
|
+
rescue StandardError
|
36
36
|
raise RubyRabbitmqJanus::Errors::Tools::QueueAdminTo
|
37
37
|
end
|
38
38
|
end
|
data/spec/config/database.rb
CHANGED
@@ -26,6 +26,18 @@ def load_mongo
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# :reek:UtilityFunction
|
29
|
-
def
|
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
|
data/spec/config/initializer.rb
CHANGED
@@ -10,7 +10,5 @@ class EventTest
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
# @event = RubyRabbitmqJanus::Process::Concurrencies::Event.new
|
16
|
-
# @event.run(&actions)
|
13
|
+
require_relative '../support/actions'
|
14
|
+
require_relative '../support/admin_actions'
|