ruby_rabbitmq_janus 3.0.0.pre.385 → 4.0.0.pre.939113634

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -6
  3. data/config/default.yml +5 -5
  4. data/lib/rrj/errors/error.rb +3 -1
  5. data/lib/rrj/errors/janus/janus.rb +10 -11
  6. data/lib/rrj/errors/janus/responses/admin.rb +1 -1
  7. data/lib/rrj/errors/janus/responses/event.rb +1 -1
  8. data/lib/rrj/errors/janus/responses/standard.rb +1 -1
  9. data/lib/rrj/errors/rabbit/rabbit.rb +40 -13
  10. data/lib/rrj/errors/tools/tools.rb +45 -9
  11. data/lib/rrj/info.rb +1 -1
  12. data/lib/rrj/models/active_record.rb +1 -3
  13. data/lib/rrj/rabbit/connect.rb +7 -5
  14. data/lib/rrj/rails.rb +2 -2
  15. data/lib/rrj/tools/gem/config.rb +1 -1
  16. data/lib/rrj/tools/gem/config/gem.rb +1 -1
  17. data/lib/rrj/tools/gem/config/janus.rb +2 -0
  18. data/lib/rrj/tools/gem/config/queues.rb +8 -0
  19. data/lib/rrj/tools/gem/config/rabbit.rb +2 -0
  20. data/lib/rrj/tools/replaces/replace.rb +2 -2
  21. data/spec/config/database.yml +1 -0
  22. data/spec/ruby_rabbitmq_janus/models/janus_instance_instance_spec.rb +1 -1
  23. data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +1 -0
  24. data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +1 -0
  25. data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +1 -0
  26. data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +1 -0
  27. data/spec/ruby_rabbitmq_janus/{rrj_admin_list_handles_spec.Rb → rrj_admin_list_handles_spec.rb} +1 -0
  28. data/spec/ruby_rabbitmq_janus/rrj_admin_list_sessions_spec.rb +1 -0
  29. data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +1 -0
  30. data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +1 -0
  31. data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +1 -0
  32. data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +1 -0
  33. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +1 -0
  34. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +1 -0
  35. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +1 -0
  36. data/spec/ruby_rabbitmq_janus/rrj_admin_set_max_nack_queue_spec.rb +1 -0
  37. data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +1 -0
  38. data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +1 -0
  39. data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +1 -0
  40. data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +1 -0
  41. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +1 -0
  42. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +1 -0
  43. data/spec/ruby_rabbitmq_janus/rrj_answer_spec.rb +1 -0
  44. data/spec/ruby_rabbitmq_janus/rrj_attach_spec.rb +1 -0
  45. data/spec/ruby_rabbitmq_janus/rrj_create_spec.rb +1 -0
  46. data/spec/ruby_rabbitmq_janus/rrj_destroy_spec.rb +1 -0
  47. data/spec/ruby_rabbitmq_janus/rrj_detach_spec.rb +1 -0
  48. data/spec/ruby_rabbitmq_janus/rrj_info_spec.rb +1 -0
  49. data/spec/ruby_rabbitmq_janus/rrj_keepalive_spec.rb +1 -0
  50. data/spec/ruby_rabbitmq_janus/rrj_offer_spec.rb +1 -0
  51. data/spec/ruby_rabbitmq_janus/rrj_trickle_spec.rb +1 -0
  52. data/spec/ruby_rabbitmq_janus/rrj_trickles_spec.rb +2 -1
  53. data/spec/spec_helper.rb +11 -32
  54. metadata +150 -139
  55. data/lib/rrj/errors/base/admin.rb +0 -24
  56. data/lib/rrj/errors/base/base.rb +0 -5
  57. data/lib/rrj/errors/base/init.rb +0 -46
  58. data/lib/rrj/errors/base/task.rb +0 -32
  59. data/lib/rrj/errors/janus/messages/admin.rb +0 -33
  60. data/lib/rrj/errors/janus/messages/message.rb +0 -51
  61. data/lib/rrj/errors/janus/messages/standard.rb +0 -33
  62. data/lib/rrj/errors/janus/responses/base.rb +0 -15
  63. data/lib/rrj/errors/janus/transactions/admin.rb +0 -37
  64. data/lib/rrj/errors/janus/transactions/handle.rb +0 -52
  65. data/lib/rrj/errors/janus/transactions/session.rb +0 -38
  66. data/lib/rrj/errors/janus/transactions/transaction.rb +0 -23
  67. data/lib/rrj/errors/rabbit/base_event.rb +0 -25
  68. data/lib/rrj/errors/rabbit/connect.rb +0 -65
  69. data/lib/rrj/errors/rabbit/listener/base.rb +0 -46
  70. data/lib/rrj/errors/rabbit/listener/from.rb +0 -19
  71. data/lib/rrj/errors/rabbit/listener/from_admin.rb +0 -19
  72. data/lib/rrj/errors/rabbit/propertie.rb +0 -37
  73. data/lib/rrj/errors/rabbit/publisher/admin.rb +0 -32
  74. data/lib/rrj/errors/rabbit/publisher/base.rb +0 -39
  75. data/lib/rrj/errors/rabbit/publisher/exclusive.rb +0 -33
  76. data/lib/rrj/errors/rabbit/publisher/keepalive.rb +0 -19
  77. data/lib/rrj/errors/rabbit/publisher/non_exclusive.rb +0 -33
  78. data/lib/rrj/errors/tools/gem/cluster.rb +0 -42
  79. data/lib/rrj/errors/tools/gem/config.rb +0 -121
  80. data/lib/rrj/errors/tools/gem/log.rb +0 -81
  81. data/lib/rrj/errors/tools/gem/option.rb +0 -44
  82. data/lib/rrj/errors/tools/gem/request.rb +0 -23
  83. data/lib/rrj/errors/tools/replaces/replace.rb +0 -30
  84. data/lib/rrj/errors/tools/replaces/type.rb +0 -30
  85. data/tmp/coverage/assets/0.10.2/application.css +0 -799
  86. data/tmp/coverage/assets/0.10.2/application.js +0 -1707
  87. data/tmp/coverage/assets/0.10.2/colorbox/border.png +0 -0
  88. data/tmp/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  89. data/tmp/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  90. data/tmp/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  91. data/tmp/coverage/assets/0.10.2/favicon_green.png +0 -0
  92. data/tmp/coverage/assets/0.10.2/favicon_red.png +0 -0
  93. data/tmp/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  94. data/tmp/coverage/assets/0.10.2/loading.gif +0 -0
  95. data/tmp/coverage/assets/0.10.2/magnify.png +0 -0
  96. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  97. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  98. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  99. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  100. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  101. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  102. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  103. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  104. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  105. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  106. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  107. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  108. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  109. data/tmp/coverage/index.html +0 -21303
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f2ca0d58fac3e63edecd2943918395a4fe895899fe50ebbe98404fab974f8a2
4
- data.tar.gz: 18f8ef959a17619e9b2dedd2ca65f6ad407312230128ff5b7444d992ce78e381
3
+ metadata.gz: 6f1ce541747c48d06da968f51438155d38ce84c15f59b7610cb41e42ee588897
4
+ data.tar.gz: 10bb4edc2d13ff934c787f84454fde5844738051c9eb118738bcf66ecbbeaa6f
5
5
  SHA512:
6
- metadata.gz: 80b1d227f402bcb6df27f30e6e6ccf5f87e5dfc614dade152986f8ab5c146450cb4a7876eee551ebbce28dc9bcdd771e6746936a9f3dd4e4f76a30966106b313
7
- data.tar.gz: fb2d220836e330d50c26b89fdfcb7cb393e10fd7d2e9c5cd8c54e0b3d79c1b95fce1da43a70db7e9ffeaea14b47a97201fe2128c8b6cfdd636ea145d6c25bd68
6
+ metadata.gz: 6810f9782b8fcec0cb691e0bafc50708c970812b27a2c0a24d9a4327377746d2aec51a9c4bc3ef416ba1bb5df378c8f79e70d53f69e6ce881d93539ba268f2e0
7
+ data.tar.gz: 205ee2eee6067cba8698fe8a20a849f2575b880144089ee20655c53e8396a39d9bdbb89284f828eabe6ab66955e7dbd5b933096d29088e1696ba21bed71c4118
data/README.md CHANGED
@@ -33,7 +33,6 @@ This gem is product by [Dazzl.tv](http://dazzl.tv)
33
33
  * [Read documentation](#read-documentation)
34
34
  * [Generate developer documentation](#generate-developer-documentation)
35
35
  * [Contributing](#contributing)
36
- * [Plus](#plus)
37
36
 
38
37
  ## How to use
39
38
 
@@ -281,8 +280,3 @@ Bug reports and pull requests are welcome on GitHub at
281
280
  https://github.com/dazzl-tv/ruby-rabbitmq-janus This project is intended to be a
282
281
  safe, welcoming space for collaboration, and contributors are expected to adhere
283
282
  to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
284
-
285
- ## Plus
286
-
287
- Janus Admin Monitor project use this gem for manage data in Janus Meetecho with
288
- Admin/Monitor API.
data/config/default.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rabbit information connection
2
2
  rabbit:
3
3
  # Precise RabbitMQ host - Default 'localhost'
4
- host: localhost
4
+ host: rabbit
5
5
  # Precise RabbitMQ port - Default '5672'
6
6
  port: 5672
7
7
  # Precise RabbitMQ vhost - Default '/'
@@ -13,7 +13,7 @@ rabbit:
13
13
  # Password for admin request
14
14
  admin_pass: janusoverlord
15
15
  # Logger level for rabbitmq message
16
- level: info
16
+ level: error
17
17
 
18
18
  # RabbitMQ Queue information
19
19
  queues:
@@ -53,12 +53,12 @@ gem:
53
53
  log:
54
54
  # Define level to log
55
55
  # UNKNOW, FATAL, ERROR, WARN, INFO, DEBUG
56
- level: debug
56
+ level: info
57
57
  # Precise type logger
58
58
  # stdout : Output standard.
59
59
  # file : Create log file in path 'log/ruby-rabbitmq-janus.log'.
60
60
  # remote : Use RemoteSyslogLogger (for papertrail)
61
- type: file
61
+ type: stdout
62
62
  # Used with type. Complete missing data :
63
63
  # stdout : no option
64
64
  # file : filename used
@@ -73,7 +73,7 @@ gem:
73
73
  environment : 'development'
74
74
  # Precise ORM used :
75
75
  # mongoid or active_record
76
- orm: 'mongoid'
76
+ orm: <%= ENV['MONGO'].eql?('true') ? 'mongoid' : 'active_record' %>
77
77
  # Read response json for RSpec
78
78
  response_path: 'spec/supports/rrj/responses'
79
79
  # Number of process read public queue
@@ -34,9 +34,11 @@ module RubyRabbitmqJanus
34
34
  end
35
35
  end
36
36
 
37
- require 'rrj/errors/base/base'
38
37
  require 'rrj/errors/janus/janus'
38
+
39
39
  require 'rrj/errors/process/event'
40
40
  require 'rrj/errors/process/event_admin'
41
+
41
42
  require 'rrj/errors/tools/tools'
43
+
42
44
  require 'rrj/errors/rabbit/rabbit'
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rrj/errors/janus/messages/message'
4
- require 'rrj/errors/janus/messages/admin'
5
- require 'rrj/errors/janus/messages/standard'
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ class BaseJanus < RRJError
6
+ def initialize(klass, message, level = :warn)
7
+ super "[Response][#{klass}] #{message}", level
8
+ end
9
+ end
10
+ end
11
+ end
6
12
 
7
- require 'rrj/errors/janus/responses/base'
8
-
9
- require 'rrj/errors/janus/responses/code'
10
13
  require 'rrj/errors/janus/responses/admin'
14
+ require 'rrj/errors/janus/responses/code'
11
15
  require 'rrj/errors/janus/responses/event'
12
16
  require 'rrj/errors/janus/responses/standard'
13
-
14
- require 'rrj/errors/janus/transactions/transaction'
15
- require 'rrj/errors/janus/transactions/admin'
16
- require 'rrj/errors/janus/transactions/handle'
17
- require 'rrj/errors/janus/transactions/session'
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Admin
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Admin', message
11
11
  end
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Event
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Event', message
11
11
  end
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Standard
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Standard', message
11
11
  end
@@ -8,19 +8,46 @@ module RubyRabbitmqJanus
8
8
  super "[Rabbit]#{message}", level
9
9
  end
10
10
  end
11
- end
12
- end
13
11
 
14
- require 'rrj/errors/rabbit/base_event'
15
- require 'rrj/errors/rabbit/connect'
16
- require 'rrj/errors/rabbit/propertie'
12
+ module Connect
13
+ # Error when transaction hs no block
14
+ class MissingAction < RubyRabbitmqJanus::Errors::BaseRabbit
15
+ def initialize
16
+ super 'Transaction failed, missing block'
17
+ end
18
+ end
19
+
20
+ # Error When transaction timeout
21
+ class TransactionTimeout < RubyRabbitmqJanus::Errors::BaseRabbit
22
+ def initialize(error)
23
+ super error
24
+ end
25
+ end
26
+ end
27
+
28
+ module Listener
29
+ # Error when response is empty
30
+ class ResponseEmpty < RubyRabbitmqJanus::Errors::BaseRabbit
31
+ def initialize(response)
32
+ super "Response is empty ! (#{response})"
33
+ end
34
+ end
17
35
 
18
- require 'rrj/errors/rabbit/listener/base'
19
- require 'rrj/errors/rabbit/listener/from'
20
- require 'rrj/errors/rabbit/listener/from_admin'
36
+ # Error when response is nil
37
+ class ResponseNil < RubyRabbitmqJanus::Errors::BaseRabbit
38
+ def initialize(response)
39
+ super "Response is nil ! (#{response})"
40
+ end
41
+ end
42
+ end
21
43
 
22
- require 'rrj/errors/rabbit/publisher/base'
23
- require 'rrj/errors/rabbit/publisher/admin'
24
- require 'rrj/errors/rabbit/publisher/exclusive'
25
- require 'rrj/errors/rabbit/publisher/keepalive'
26
- require 'rrj/errors/rabbit/publisher/non_exclusive'
44
+ module Publisher
45
+ # Error when correlation string is not equal
46
+ class TestCorrelation < RubyRabbitmqJanus::Errors::BaseRabbit
47
+ def initialize(message, propertie)
48
+ super "Correlation doesn't equal (msg: #{message}) != (prp: #{propertie})"
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -6,17 +6,53 @@ module RubyRabbitmqJanus
6
6
  # Define a super class for all error in Option class
7
7
  class BaseTools < RRJError
8
8
  def initialize(message, level = :fatal)
9
- super("[Tools]#{message}", level)
9
+ super("[Tools][Config]#{message}", level)
10
+ end
11
+ end
12
+
13
+ module Config
14
+ class QueueFrom < RubyRabbitmqJanus::Errors::Tools::BaseTools
15
+ def initialize
16
+ super '[QueueFrom] Error for reading standard queue from'
17
+ end
18
+ end
19
+
20
+ class QueueTo < RubyRabbitmqJanus::Errors::Tools::BaseTools
21
+ def initialize
22
+ super '[QueueTo] Error for reading standard queue to'
23
+ end
24
+ end
25
+
26
+ class QueueAdminFrom < RubyRabbitmqJanus::Errors::Tools::BaseTools
27
+ def initialize
28
+ super '[QueueAdminFrom] Error for reading admin queue from'
29
+ end
30
+ end
31
+
32
+ class QueueAdminTo < RubyRabbitmqJanus::Errors::Tools::BaseTools
33
+ def initialize
34
+ super '[QueueAdminTo] Error for reading admin queue to'
35
+ end
36
+ end
37
+
38
+ class Plugins < RubyRabbitmqJanus::Errors::Tools::BaseTools
39
+ def initialize
40
+ super "[Plugins] Error for reading plugins at #{index}"
41
+ end
42
+ end
43
+
44
+ class AdminPassword < RubyRabbitmqJanus::Errors::Tools::BaseTools
45
+ def initialize
46
+ super '[AdminPassword] Error for reading option admin password', :warn
47
+ end
48
+ end
49
+
50
+ class Rabbitmq < RubyRabbitmqJanus::Errors::Tools::BaseTools
51
+ def initialize(value)
52
+ super "[RabbitMQConfig] Missing RabbitMQ configuration for key : #{value}", :fatal
53
+ end
10
54
  end
11
55
  end
12
56
  end
13
57
  end
14
58
  end
15
-
16
- require 'rrj/errors/tools/gem/cluster'
17
- require 'rrj/errors/tools/gem/log'
18
- require 'rrj/errors/tools/gem/option'
19
- require 'rrj/errors/tools/gem/request'
20
-
21
- require 'rrj/errors/tools/replaces/replace'
22
- require 'rrj/errors/tools/replaces/type'
data/lib/rrj/info.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # Define constant to gem.
7
7
  module RubyRabbitmqJanus
8
8
  # Define version to gem
9
- VERSION = '3.0.0'
9
+ VERSION = '4.0.0'
10
10
 
11
11
  # Name to gem
12
12
  GEM_NAME = 'ruby_rabbitmq_janus'
@@ -32,11 +32,9 @@ module RubyRabbitmqJanus
32
32
  #
33
33
  # @return [Hash] Current model
34
34
  #
35
- # rubocop:disable Style/HashTransformValues
36
35
  def unset(attributes)
37
- Hash[attributes.map { |key, _value| [key, nil] }]
36
+ [attributes.map { |key, _value| [key, nil] }].to_h
38
37
  end
39
- # rubocop:enable Style/HashTransformValues
40
38
  end
41
39
  end
42
40
  end
@@ -15,7 +15,7 @@ module RubyRabbitmqJanus
15
15
 
16
16
  # Create an transaction with rabbitmq and close after response is received
17
17
  def transaction_short(&block)
18
- raise Errors::Rabbit::Connect::MissingAction unless block
18
+ raise RubyRabbitmqJanus::Errors::Connect::MissingAction unless block
19
19
 
20
20
  response = nil
21
21
 
@@ -23,7 +23,8 @@ module RubyRabbitmqJanus
23
23
  response = transaction_long(&block)
24
24
  end
25
25
  rescue Timeout::Error
26
- ::Log.error 'The "Short transaction" have raised Timeout exception.'
26
+ raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
27
+ 'The "Short transaction" have raised Timeout exception.'
27
28
  ensure
28
29
  close
29
30
  response
@@ -31,14 +32,15 @@ module RubyRabbitmqJanus
31
32
 
32
33
  # Create an transaction with rabbitmq and not close
33
34
  def transaction_long
34
- raise Errors::Rabbit::Connect::MissingAction unless block_given?
35
+ raise RubyRabbitmqJanus::Errors::Connect::MissingAction unless block_given?
35
36
 
36
- Timeout.timeout(10) do
37
+ Timeout.timeout(60) do
37
38
  start
38
39
  yield
39
40
  end
40
41
  rescue Timeout::Error
41
- ::Log.error 'The "Long transaction" have raised Timeout exception.'
42
+ raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
43
+ 'The "Long transaction" have raised Timeout exception.'
42
44
  end
43
45
 
44
46
  # Opening a connection with RabbitMQ
data/lib/rrj/rails.rb CHANGED
@@ -22,8 +22,8 @@ module RubyRabbitmqJanus
22
22
 
23
23
  Log.debug "[RRJ] Create process : #{number}"
24
24
  process = RubyRabbitmqJanus::Process::Concurrencies
25
- actions = RubyRabbitmqJanus::ActionEvents.new.actions
26
- admin_actions = RubyRabbitmqJanus::ActionAdminEvents.new.actions
25
+ actions = ActionEvents.new.actions
26
+ admin_actions = ActionAdminEvents.new.actions
27
27
 
28
28
  listeners = []
29
29
  (1..number).each do
@@ -34,7 +34,7 @@ module RubyRabbitmqJanus
34
34
 
35
35
  # Define HOME RRJ gem
36
36
  RRJ_HOME = File.realpath(File.join(File.dirname(__FILE__),
37
- '..', '..', '..'))
37
+ '..', '..', '..', '..'))
38
38
 
39
39
  # Define a default name to file configuration
40
40
  CONF_DEFAULT = 'config/default.yml'
@@ -12,7 +12,7 @@ module RubyRabbitmqJanus
12
12
  module ConfigGem
13
13
  # @return [Boolean] Read option file for a janus cluster section
14
14
  def cluster
15
- @options['gem']['cluster']['enabled'].to_s.match?('true')
15
+ @options['gem']['cluster']['enabled'].to_s.match?('true') || false
16
16
  end
17
17
 
18
18
  # @return [Symbol] read configuration for log level used in this gem
@@ -19,6 +19,8 @@ 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
23
+ raise RubyRabbitmqJanus::Errors::Tools::Plugins, index
22
24
  end
23
25
 
24
26
  alias ttl time_to_live
@@ -11,21 +11,29 @@ 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
15
+ raise RubyRabbitmqJanus::Errors::Tools::QueueFrom
14
16
  end
15
17
 
16
18
  # @return [String] Get to name queue_to (pattern)
17
19
  def queue_to
18
20
  @options['queues']['standard']['to'].to_s
21
+ rescue
22
+ raise RubyRabbitmqJanus::Errors::Tools::QueueTo
19
23
  end
20
24
 
21
25
  # @return [String] Get to name queue_admin_from (pattern)
22
26
  def queue_admin_from
23
27
  @options['queues']['admin']['from'].to_s
28
+ rescue
29
+ raise RubyRabbitmqJanus::Errors::Tools::QueueAdminFrom
24
30
  end
25
31
 
26
32
  # @return [String] Get to name queue_admin_from (pattern)
27
33
  def queue_admin_to
28
34
  @options['queues']['admin']['to'].to_s
35
+ rescue
36
+ raise RubyRabbitmqJanus::Errors::Tools::QueueAdminTo
29
37
  end
30
38
  end
31
39
  end
@@ -13,6 +13,8 @@ module RubyRabbitmqJanus
13
13
  # @return [String] read configuration fir queue admin
14
14
  def admin_pass
15
15
  @options['rabbit']['admin_pass'].to_s
16
+ rescue
17
+ raise RubyRabbitmqJanus::Errors::Tools::AdminPassword
16
18
  end
17
19
 
18
20
  # @return [Symbol] read configuration for bunny log level
@@ -56,11 +56,11 @@ module RubyRabbitmqJanus
56
56
  end
57
57
 
58
58
  def rewrite_key_to_string(node)
59
- Hash[
59
+ [
60
60
  node.map do |key, value|
61
61
  [key.to_s, value?(value)]
62
62
  end
63
- ]
63
+ ].to_h
64
64
  end
65
65
 
66
66
  def value?(value)
@@ -6,3 +6,4 @@ adapter: sqlite3
6
6
  encoding: utf-8
7
7
  database: ':memory:'
8
8
  timeout: 5000
9
+ pool: 5
@@ -16,7 +16,7 @@ describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
16
16
  let(:id) { first.id }
17
17
 
18
18
  context 'when Janus instances are activated.' do
19
- let(:instances) { FactoryBot.create_list(:janus_instance, size) }
19
+ let(:instances) { FactoryBot.create_list(:janus_instance, size, enable: true) }
20
20
  let(:count_enabled) { size }
21
21
  let(:count_destroyed) { 0 }
22
22
  let(:count_disabled) { 0 }