ruby_rabbitmq_janus 2.5.0.pre.210 → 2.5.0.pre.213

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/config/requests/admin/{handles.json → list_handles.json} +0 -0
  3. data/config/requests/admin/{sessions.json → list_sessions.json} +0 -0
  4. data/config/requests/admin/{tokens.json → list_tokens.json} +0 -0
  5. data/config/requests/admin/set_libnice_debug.json +6 -0
  6. data/config/requests/admin/set_locking_debug.json +2 -2
  7. data/config/requests/admin/set_log_colors.json +6 -0
  8. data/config/requests/admin/set_log_level.json +2 -2
  9. data/config/requests/admin/set_log_timestamps.json +6 -0
  10. data/config/requests/admin/set_max_nack_queue.json +6 -0
  11. data/config/requests/admin/set_no_media_timer.json +6 -0
  12. data/config/requests/admin/set_session_timeout.json +7 -0
  13. data/config/requests/admin/start_pcap.json +5 -3
  14. data/config/requests/admin/stop_pcap.json +2 -0
  15. data/config/requests/admin/stop_text2pcap.json +1 -1
  16. data/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +1 -1
  17. data/lib/generators/ruby_rabbitmq_janus/install_generator.rb +1 -1
  18. data/lib/generators/ruby_rabbitmq_janus/migration_generator.rb +1 -1
  19. data/lib/rrj/info.rb +1 -1
  20. data/lib/rrj/janus/processus/event.rb +1 -1
  21. data/lib/rrj/janus/processus/event_admin.rb +5 -1
  22. data/lib/rrj/janus/processus/keepalive/keepalive_thread.rb +0 -4
  23. data/lib/rrj/janus/transactions/admin.rb +2 -0
  24. data/lib/rrj/rabbit/propertie.rb +6 -2
  25. data/lib/rrj/rabbit/publish/listener_admin.rb +3 -0
  26. data/lib/rrj/rabbit/publish/publisher_admin.rb +8 -7
  27. data/lib/rrj/tools/gem/config.rb +2 -0
  28. data/lib/rrj/tools/replaces/admin.rb +21 -35
  29. data/spec/request/admin/request_add_token_spec.rb +29 -0
  30. data/spec/request/admin/request_allow_token_spec.rb +20 -0
  31. data/spec/request/admin/request_disallow_token_spec.rb +20 -0
  32. data/spec/request/admin/request_handle_info_spec.rb +13 -14
  33. data/spec/request/admin/request_list_handles_spec.rb +19 -0
  34. data/spec/request/admin/request_list_sessions_spec.rb +20 -0
  35. data/spec/request/admin/request_list_tokens_spec.rb +18 -0
  36. data/spec/request/admin/request_remove_token_spec.rb +18 -0
  37. data/spec/request/admin/request_set_libnice_debug_spec.rb +28 -0
  38. data/spec/request/admin/request_set_locking_debug_spec.rb +20 -10
  39. data/spec/request/admin/request_set_log_colors_spec.rb +28 -0
  40. data/spec/request/admin/request_set_log_level_spec.rb +64 -12
  41. data/spec/request/admin/request_set_log_timestamps_spec.rb +28 -0
  42. data/spec/request/admin/request_set_max_nack_queue_spec.rb +28 -0
  43. data/spec/request/admin/request_set_no_media_timer_spec.rb +28 -0
  44. data/spec/request/admin/request_set_session_timeout_spec.rb +35 -0
  45. data/spec/request/admin/request_start_pcap_spec.rb +27 -0
  46. data/spec/request/admin/request_start_text2pcap_spec.rb +26 -0
  47. data/spec/request/admin/request_stop_pcap_spec.rb +20 -0
  48. data/spec/request/admin/request_stop_text2pcap_spec.rb +27 -0
  49. data/spec/spec_helper.rb +7 -1
  50. data/spec/support/admin_requester.rb +48 -0
  51. data/spec/support/schemas/request/admin/{handles.json → list_handles.json} +0 -0
  52. data/spec/support/schemas/request/admin/{sessions.json → list_sessions.json} +0 -0
  53. data/spec/support/schemas/request/base/error.json +22 -0
  54. data/spec/support/schemas/request/base/success.json +11 -0
  55. metadata +52 -15
  56. data/spec/request/admin/request_handles_spec.rb +0 -21
  57. data/spec/request/admin/request_sessions_spec.rb +0 -17
  58. data/spec/request/admin/request_tokens_spec.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c915b9a02b58b280c212d94bac96e0cc8b7bac8752e0c728fa66658d63ea2191
4
- data.tar.gz: 83d25b3aa52dacca03c7a45a9ea68261372f1a412340cadeba7049f7bdfbacaf
3
+ metadata.gz: 020d8174744036d661c515c3238626b5ae010e8cb5f720569bd5b9ed7eb1f0b2
4
+ data.tar.gz: e107eebc1d2c28ab8be3cb82b8fe5eeed8f887f6132bce3ad5b044515bd1e08d
5
5
  SHA512:
6
- metadata.gz: bb73fd9007791fc59aa4cfbd3cb22a2bdbed762876f50f98567e2bfbbefa528fd55a89f21515838cdfcdcaad4d445dc843c8e880c00fecb5835b739ac891d623
7
- data.tar.gz: 1c6abdd92e1b8ff36738955637add5df8266eadbed35957977962d842c2c3c9a8ea410b6b31aa7bc6d387061c28dbbffe7244d15a97ee5d862a84f8a6abe1a47
6
+ metadata.gz: 9da41b78b1d7bd8548885b1a9ed85822131450fe1f6b71e79fab75e3d1293c3e6b3a9e1202c90bf785a13f80bf7a086b9a2a5541de88a22fdede4e0b42ee3943
7
+ data.tar.gz: 121b9c5316bae6c8045a199fc853a276cab060fb378d033d4ff8f44f4294f3322d593d2430302a0e03aea0c816171e756b6a47e8934312a6f855cd99d664378e
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "set_libnice_debug",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "debug": "<boolean>"
6
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "janus" : "set_locking_debug",
3
- "debug" : "<boolean>",
4
3
  "transaction": "<transaction>",
5
- "admin_secret": "<string>"
4
+ "admin_secret": "<string>",
5
+ "debug" : "<boolean>"
6
6
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "set_log_colors",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "colors": "<boolean>"
6
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "janus": "set_log_level",
3
- "level": "<integer>",
4
3
  "transaction": "<transaction>",
5
- "admin_secret": "<string>"
4
+ "admin_secret": "<string>",
5
+ "level": "<integer>"
6
6
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "set_log_timestamps",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "timestamps": "<boolean>"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "set_max_nack_queue",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "max_nack_queue": "<integer>"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "set_no_media_timer",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "no_media_timer": "<integer>"
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "janus": "set_log_level",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>",
5
+ "session_timeout": "<integer>",
6
+ "level": "<integer>"
7
+ }
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "janus": "start_pcap",
3
+ "transaction": "<transaction>",
4
+ "session_id": "<number>",
5
+ "handle_id": "<number>",
6
+ "admin_secret": "<string>",
3
7
  "folder" : "<string>",
4
8
  "filename" : "<string>",
5
- "truncate" : "<number>",
6
- "transaction": "<transaction>",
7
- "admin_secret": "<string>"
9
+ "truncate" : "<number>"
8
10
  }
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "janus": "stop_pcap",
3
3
  "transaction": "<transaction>",
4
+ "session_id": "<number>",
5
+ "handle_id": "<number>",
4
6
  "admin_secret": "<string>"
5
7
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "janus": "stop_pcap",
2
+ "janus": "stop_text2pcap",
3
3
  "transaction": "<transaction>",
4
4
  "session_id": "<number>",
5
5
  "handle_id": "<number>",
@@ -6,7 +6,7 @@ module RubyRabbitmqJanus
6
6
  class InitializerGenerator < Rails::Generators::Base
7
7
  desc 'Generate a initializer to this gem for rails application.'
8
8
 
9
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('templates', __dir__)
10
10
 
11
11
  # Create an initializer
12
12
  def copy_initializer
@@ -11,7 +11,7 @@ module RubyRabbitmqJanus
11
11
  config.autoload_paths += Dir[Rails.root.join('app', 'ruby_rabbitmq_janus')]
12
12
  AUTOLOAD
13
13
 
14
- source_root File.expand_path('../templates', __FILE__)
14
+ source_root File.expand_path('templates', __dir__)
15
15
 
16
16
  # Generate files with default code
17
17
  def add_actions
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
 
15
15
  desc 'Add to rails project RubyRabbitmqJanus migration file.'
16
16
 
17
- source_root File.expand_path('../templates', __FILE__)
17
+ source_root File.expand_path('templates', __dir__)
18
18
 
19
19
  def install
20
20
  migration_template 'migration.rb',
data/lib/rrj/info.rb CHANGED
@@ -30,7 +30,7 @@ module RubyRabbitmqJanus
30
30
  RabbitMQ server in a queue for janus server. Janus processes a message and
31
31
  send to RabbitMQ server in a queue for gem. Once the received message is
32
32
  decoded and returned through the Rails API.
33
- DESC
33
+ DESC
34
34
 
35
35
  # Define homepage
36
36
  HOMEPAGE = 'https://github.com/dazzl-tv/ruby-rabbitmq-janus'
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
  class Event < Concurrency
15
15
  include Singleton
16
16
 
17
- NAME_VAR = :publish.freeze
17
+ NAME_VAR = :publish
18
18
 
19
19
  def initialize
20
20
  super
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :reek:InstanceVariableAssumption
4
+
3
5
  module RubyRabbitmqJanus
4
6
  module Janus
5
7
  module Concurrencies
8
+ # Manage admin message in queue public
9
+ # Work In Progress
6
10
  class EventAdmin < Event
7
11
  include Singleton
8
12
 
9
- NAME_VAR = :publish_adm.freeze
13
+ NAME_VAR = :publish_adm
10
14
 
11
15
  private
12
16
 
@@ -55,7 +55,6 @@ module RubyRabbitmqJanus
55
55
 
56
56
  # Start a timer for TTL
57
57
  # rubocop:disable Metrics/AbcSize
58
- # rubocop:disable Metrics/MethodLength
59
58
  # :reek:TooManyStatements
60
59
  def start
61
60
  @timer.loop_keepalive do
@@ -77,7 +76,6 @@ module RubyRabbitmqJanus
77
76
  raise Errors::Janus::KeepaliveThread::Start
78
77
  end
79
78
  # rubocop:enable Metrics/AbcSize
80
- # rubocop:enable Metrics/MethodLength
81
79
 
82
80
  # Kill session and disable instance
83
81
  def kill
@@ -87,7 +85,6 @@ module RubyRabbitmqJanus
87
85
  raise Errors::Janus::KeepaliveThread::Kill
88
86
  end
89
87
 
90
- # rubocop:disable Metrics/MethodLength
91
88
  # :reek:TooManyStatements
92
89
  def instance_is_down
93
90
  janus = find_model
@@ -105,7 +102,6 @@ module RubyRabbitmqJanus
105
102
  rescue
106
103
  raise Errors::Janus::KeepaliveThread::InstanceIsDown
107
104
  end
108
- # rubocop:enable Metrics/MethodLength
109
105
 
110
106
  private
111
107
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :reek:UncommunicativeMethodName
4
+
3
5
  module RubyRabbitmqJanus
4
6
  module Janus
5
7
  module Transactions
@@ -28,8 +28,8 @@ module RubyRabbitmqJanus
28
28
  end
29
29
 
30
30
  # Define option sending to rabbitmq for janus admin message
31
- def options_admin(type_request)
32
- base.merge(routing_key: Tools::Cluster.instance.queue_admin_to(@instance))
31
+ def options_admin(_type_request)
32
+ base.merge(routing_key: routing_key_admin)
33
33
  rescue
34
34
  raise Errors::Rabbit::Propertie::Options_admin
35
35
  end
@@ -49,6 +49,10 @@ module RubyRabbitmqJanus
49
49
  def base
50
50
  { correlation_id: @correlation, content_type: 'application/json' }
51
51
  end
52
+
53
+ def routing_key_admin
54
+ Tools::Cluster.instance.queue_admin_to(@instance)
55
+ end
52
56
  end
53
57
  end
54
58
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :reek:InstanceVariableAssumption
4
+
3
5
  module RubyRabbitmqJanus
4
6
  module Rabbit
5
7
  module Publisher
8
+ # Listener to admin queue
6
9
  class ListenerAdmin < Listener
7
10
  private
8
11
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :reek:InstanceVariableAssumption
4
+
3
5
  module RubyRabbitmqJanus
4
6
  module Rabbit
5
7
  module Publisher
@@ -10,7 +12,8 @@ module RubyRabbitmqJanus
10
12
  #
11
13
  # @param [String] exchange Exchange used for the transaction
12
14
  def initialize(exchange)
13
- @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
15
+ @reply = exchange.queue('', exclusive: true)
16
+ # @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
14
17
  super(exchange)
15
18
  subscribe_to_queue
16
19
  rescue
@@ -21,15 +24,13 @@ module RubyRabbitmqJanus
21
24
  #
22
25
  # @param [String] request JSON request sending to rabbitmq queue
23
26
  #
24
- # @return [Janus::Response::Standard] response for an request reading
27
+ # @return [Janus::Response::Admin] response for an request reading
25
28
  # by janus instance
26
29
  def publish(request)
27
- # super(request)
28
30
  @message = request
29
- concat = request.options.merge!(reply_to: reply.name)
30
- @exchange.publish(@message.to_json, concat)
31
- # p "Waiting response ...."
32
- # return_response
31
+ @exchange.publish(@message.to_json,
32
+ request.options.merge!(reply_to: reply.name))
33
+ return_response
33
34
  rescue
34
35
  raise Errors::Rabbit::PublisherAdmin::Pusblish
35
36
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Naming/MemoizedInstanceVariableName
3
4
  module RubyRabbitmqJanus
4
5
  module Tools
5
6
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
@@ -134,3 +135,4 @@ module RubyRabbitmqJanus
134
135
  end
135
136
  end
136
137
  end
138
+ # rubocop:enable Naming/MemoizedInstanceVariableName
@@ -10,6 +10,18 @@ module RubyRabbitmqJanus
10
10
  class Admin < Handle
11
11
  private
12
12
 
13
+ KEY_ACCEPTED = %w[colors
14
+ debug
15
+ level
16
+ filename
17
+ folder
18
+ max_nack_queue
19
+ no_media_timer
20
+ timestamps
21
+ token
22
+ truncate
23
+ session_timeout].freeze
24
+
13
25
  def replace_element_classic
14
26
  super
15
27
  replace_admins if request.key?('admin_secret')
@@ -23,47 +35,21 @@ module RubyRabbitmqJanus
23
35
 
24
36
  def replace_admins
25
37
  replace_admin
26
- replace_level if request.key?('level')
27
- replace_debug if request.key?('debug')
28
- replace_folder if request.key?('folder')
29
- replace_filename if request.key?('filename')
30
- replace_truncate if request.key?('truncate')
31
- end
32
-
33
- def replace_admin
34
- request['admin_secret'] = admin_pass
35
- rescue => message
36
- Tools::Log.instance.warn "Error replace admin_secret : #{message}"
37
- end
38
-
39
- def replace_level
40
- request['level'] = type.convert('level', opts)
41
- rescue => message
42
- Tools::Log.instance.warn "Error replace level : #{message}"
38
+ KEY_ACCEPTED.each do |key|
39
+ replace_component(key) if request.key?(key)
40
+ end
43
41
  end
44
42
 
45
- def replace_debug
46
- request['debug'] = type.convert('debug', opts)
43
+ def replace_component(key)
44
+ request[key] = type.convert(key, opts)
47
45
  rescue => message
48
- Tools::Log.instance.warn "Error replace debug : #{message}"
46
+ Tools::Log.instance.warn "Error replace #{key} : #{message}"
49
47
  end
50
48
 
51
- def replace_folder
52
- request['folder'] = type.convert('folder', opts)
53
- rescue => message
54
- Tools::Log.instance.warn "Error replace folder : #{message}"
55
- end
56
-
57
- def replace_filename
58
- request['filename'] = type.convert('filename', opts)
59
- rescue => message
60
- Tools::Log.instance.warn "Error replace filename : #{message}"
61
- end
62
-
63
- def replace_truncate
64
- request['truncate'] = type.convert('truncate', opts)
49
+ def replace_admin
50
+ request['admin_secret'] = admin_pass
65
51
  rescue => message
66
- Tools::Log.instance.warn "Error replace truncate : #{message}"
52
+ Tools::Log.instance.warn "Error replace admin_secret : #{message}"
67
53
  end
68
54
 
69
55
  def admin_pass
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Option token has disabled do response is automatically an error
6
+ describe 'RubyRabbitmqJanus::RRJAdmin -- add_token', type: :request,
7
+ level: :admin,
8
+ name: :add_token do
9
+ before do
10
+ help_admin_prepare
11
+ help_admin_request_tested(parameter)
12
+ end
13
+
14
+ let(:type) { 'admin::add_token' }
15
+
16
+ context 'when no configured in Janus' do
17
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
18
+ let(:parameter) { {} }
19
+
20
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
21
+ end
22
+
23
+ context 'when configured in janus' do
24
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('2').id.to_s } }
25
+ let(:parameter) { { 'token' => [*('a'..'z'), *('0'..'9')].sample(24).join } }
26
+
27
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Option token has disabled do response is automatically an error
6
+ describe 'RubyRabbitmqJanus::RRJAdmin -- allow_token', type: :request,
7
+ level: :admin,
8
+ name: :allow_token do
9
+ before do
10
+ help_admin_prepare
11
+ help_admin_create_session
12
+ help_admin_create_handler
13
+ help_admin_request_tested
14
+ end
15
+
16
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
17
+ let(:type) { 'admin::allow_token' }
18
+
19
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Option token has disabled do response is automatically an error
6
+ describe 'RubyRabbitmqJanus::RRJAdmin -- disallow_token', type: :request,
7
+ level: :admin,
8
+ name: :disallow_token do
9
+ before do
10
+ help_admin_prepare
11
+ help_admin_create_session
12
+ help_admin_create_handler
13
+ help_admin_request_tested
14
+ end
15
+
16
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
17
+ let(:type) { 'admin::disallow_token' }
18
+
19
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
20
+ end
@@ -1,21 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # LCO: tagged broken 2018/01/26 for v2.3.0
4
- # see: https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus/builds/333359315
5
-
6
3
  require 'spec_helper'
7
4
 
8
- describe 'RubyRabbitmqJanus::RRJ -- message type handle info' do
9
- before(:example) do
10
- clear
11
- attach_admin
12
- @type = 'admin::handle_info'
5
+ describe 'RubyRabbitmqJanus::RRJAdmin -- handle_info', type: :request,
6
+ level: :admin,
7
+ name: :handle_info do
8
+ before do
9
+ help_admin_prepare
10
+ help_admin_create_session
11
+ help_admin_create_handler
12
+ help_admin_request_tested
13
13
  end
14
14
 
15
- describe '#start_transaction_admin', type: :request,
16
- level: :admin,
17
- broken: true,
18
- name: :handle_info do
19
- include_examples 'transaction admin should match json schema'
20
- end
15
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
16
+ let(:type) { 'admin::handle_info' }
17
+
18
+ it { expect(@transaction.to_json).to match_json_schema(type) }
19
+ it { expect(@transaction.info).to be_a(Hash) }
21
20
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'RubyRabbitmqJanus::RRJAdmin -- list_handles', type: :request,
6
+ level: :admin,
7
+ name: :list_handles do
8
+ before do
9
+ help_admin_prepare
10
+ help_admin_create_session
11
+ help_admin_request_tested
12
+ end
13
+
14
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
15
+ let(:type) { 'admin::list_handles' }
16
+
17
+ it { expect(@transaction.to_json).to match_json_schema(type) }
18
+ it { expect(@transaction.handles).to be_a(Array) }
19
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'RubyRabbitmqJanus::RRJAdmin -- list_sessions', type: :request,
6
+ level: :admin,
7
+ name: :list_sessions do
8
+ before do
9
+ help_admin_prepare
10
+ help_admin_create_session
11
+ help_admin_create_handler
12
+ help_admin_request_tested
13
+ end
14
+
15
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
16
+ let(:type) { 'admin::list_sessions' }
17
+
18
+ it { expect(@transaction.to_json).to match_json_schema(type) }
19
+ it { expect(@transaction.sessions).to be_a(Array) }
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Dont configured in Janus Instance so return automatically an error
6
+ describe 'RubyRabbitmqJanus::RRJAdmin -- list_tokens', type: :request,
7
+ level: :admin,
8
+ name: :list_tokens do
9
+ before do
10
+ help_admin_prepare
11
+ help_admin_request_tested
12
+ end
13
+
14
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
15
+ let(:type) { 'admin::list_tokens' }
16
+
17
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Dont configured in Janus Instance so return automatically an error
6
+ describe 'RubyRabbitmqJanus::RRJAdmin -- remove_tokens', type: :request,
7
+ level: :admin,
8
+ name: :remove_token do
9
+ before do
10
+ help_admin_prepare
11
+ help_admin_request_tested
12
+ end
13
+
14
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
15
+ let(:type) { 'admin::remove_token' }
16
+
17
+ it { expect(@transaction.to_json).to match_json_schema('base::error') }
18
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'RubyRabbitmqJanus::RRJAdmin -- set_libnice_debug', type: :request,
6
+ level: :admin,
7
+ name: :set_libnice_debug do
8
+ before do
9
+ help_admin_prepare
10
+ help_admin_request_tested(parameters)
11
+ end
12
+
13
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
14
+ let(:type) { 'admin::set_libnice_debug' }
15
+ let(:parameters) { { 'debug' => debug } }
16
+
17
+ context 'when debug is true' do
18
+ let(:debug) { true }
19
+
20
+ it { expect(@transaction.to_json).to match_json_schema('base::success') }
21
+ end
22
+
23
+ context 'when debug is false' do
24
+ let(:debug) { false }
25
+
26
+ it { expect(@transaction.to_json).to match_json_schema('base::success') }
27
+ end
28
+ end
@@ -2,17 +2,27 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type set locking debug' do
6
- before(:example) do
7
- clear
8
- @type = 'admin::set_locking_debug'
9
- @options = { 'debug' => [true, false].sample }
5
+ describe 'RubyRabbitmqJanus::RRJAdmin -- set_locking_debug', type: :request,
6
+ level: :admin,
7
+ name: :set_locking_debug do
8
+ before do
9
+ help_admin_prepare
10
+ help_admin_request_tested(parameters)
10
11
  end
11
12
 
12
- describe '#start_transaction_admin', type: :request,
13
- level: :admin,
14
- name: :set_locking_debug,
15
- broken: true do
16
- include_examples 'transaction admin should match json schema'
13
+ let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('1').id.to_s } }
14
+ let(:type) { 'admin::set_locking_debug' }
15
+ let(:parameters) { { 'debug' => debug } }
16
+
17
+ context 'when debug is true' do
18
+ let(:debug) { true }
19
+
20
+ it { expect(@transaction.to_json).to match_json_schema(type) }
21
+ end
22
+
23
+ context 'when debug is false' do
24
+ let(:debug) { false }
25
+
26
+ it { expect(@transaction.to_json).to match_json_schema(type) }
17
27
  end
18
28
  end