ruby_rabbitmq_janus 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12aafd54721da33f128d3c79cfefc33897355465
4
- data.tar.gz: 19a810e4e28a331646086aa31b01289978b0a7e8
3
+ metadata.gz: 66f20d8377739e714f7694bb0a5094501c89f41d
4
+ data.tar.gz: a655ab4468aaf165bbe4aba9391cf1df7010e0aa
5
5
  SHA512:
6
- metadata.gz: b46b0ecf3a06109c8bb395c3aadef37638db794b3cb0fc53cc63b1135dbbdb3ca53c4376557d99cbbf2e80f252d81a731d3f49251b943de74d557acdda8fcef6
7
- data.tar.gz: 4291d4479d6c597649994962d333d32179f0bc91488fed09f38d0d7f01fbca9ddb7713ec915911ac90c27ee732bb15f36aaf497a110c461349fae86c73878021
6
+ metadata.gz: b9e11959cda823b1bac8d167ac04d61cfa6a789de29cb7d42a2375bd1f5a19850eac643ef975e55a59e1d98fda94673ad108a4c7feb2851d7211c0b46197f0c2
7
+ data.tar.gz: 86a773c15454746076dfa43b5c49d15b00c37ad0cf0ef07b399c8f9124bc808c80dd180d23646669cb99cb58548af8871989e28ab4dda8c34239a0012324a034
@@ -16,56 +16,10 @@ module RubyRabbitmqJanus
16
16
  Tools::Log.instance_method(level).bind(log).call(message)
17
17
  end
18
18
  end
19
-
20
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
21
-
22
- # Define an exception if gem dont initialize correctly
23
- class RRJErrorInit < RRJError
24
- # Initialize a error for instanciate class. It's a fatal error
25
- # @param [String] message Text returning in raise
26
- def initialize(message)
27
- super "Gem is not instanciate correctly : #{message}", :fatal
28
- end
29
- end
30
-
31
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
32
-
33
- # Define an error if method message_post given an exception
34
- class RRJErrorPost < RRJError
35
- # Initialize a error for message posting. It's a fatal error
36
- # @param [String] message Text returning in raise
37
- def initialize(message)
38
- super "Post message is failed : #{message}", :fatal
39
- end
40
- end
41
-
42
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
43
-
44
- # Define an error if method transaction given an exception
45
- class RRJErrorTransaction < RRJError
46
- # Initialize a error for transaction failed. It's a fatal error
47
- # @param [String] message Text returning in raise
48
- def initialize(message)
49
- super "Transaction is failed : #{message}", :fatal
50
- end
51
- end
52
-
53
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
54
- # Define an error if method start_handle given an exception
55
- class RRJErrorHandle < RRJError
56
- # Initialize a error for transaction with a handle. It's a fatal error
57
- # @param [String] message Text returning in raise
58
- def initialize(message)
59
- super "Transaction handle is failed : #{message}", :fatal
60
- end
61
- end
62
19
  end
63
20
  end
64
21
 
65
- require 'rrj/errors/janus'
66
- require 'rrj/errors/janus_message'
67
- require 'rrj/errors/janus_response'
68
- require 'rrj/errors/janus_transaction'
69
-
70
- require 'rrj/errors/config'
71
- require 'rrj/errors/rabbit'
22
+ require 'rrj/errors/init'
23
+ require 'rrj/errors/janus/janus'
24
+ require 'rrj/errors/tools/tools'
25
+ require 'rrj/errors/rabbit/rabbit'
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
3
+
4
+ module RubyRabbitmqJanus
5
+ # Define all error in gem
6
+ module Errors
7
+ # Define a super class for all errors in RRJ Class
8
+ class RRJ < RRJError
9
+ # Define a message error and level
10
+ # @param [String] message Text returning in raise
11
+ # @param [Symbol] level Level to message in log
12
+ def initalize(message, level)
13
+ super "[RRJ] #{message}", level
14
+ end
15
+ end
16
+
17
+ # Define an exception if gem dont initialize correctly
18
+ class InstaciateGemFailed < RRJ
19
+ # Initialize a error for instanciate class. It's a fatal error
20
+ # @param [String] message Text returning in raise
21
+ def initialize(message)
22
+ super "Gem is not instanciate correctly : #{message}", :fatal
23
+ end
24
+ end
25
+
26
+ # Define an error if method message_post given an exception
27
+ class TransactionSessionFailed < RRJ
28
+ # Initialize a error for message posting. It's a fatal error
29
+ # @param [String] message Text returning in raise
30
+ def initialize(message)
31
+ super "Transaction SESSION failed : #{message}", :fatal
32
+ end
33
+ end
34
+
35
+ # Define a error if method transaction given an exception
36
+ class TransactionMessageFailed < RRJ
37
+ # Initialize a error for transaction failed. It's a fatal error
38
+ # @param [String] message Text returning in raise
39
+ def initialize(message)
40
+ super "Message in a transaction HANDLE failed : #{message}", :fatal
41
+ end
42
+ end
43
+
44
+ # Define a error if method start_handle given an exception
45
+ class TransactionHandleFailed < RRJ
46
+ # Initialize a error for transaction with a handle. It's a fatal error
47
+ # @param [String] message Text returning in raise
48
+ def initialize(message)
49
+ super "Transaction HANDLE failed : #{message}", :fatal
50
+ end
51
+ end
52
+
53
+ # define a error for Admin Transaction
54
+ class TransactionAdminFailed < RRJ
55
+ # Initialize a error for transaction admin
56
+ # @param [String] message Text returning in raise
57
+ def initialize(message)
58
+ super "Transaction ADMIN failed : #{message}", :fatal
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
2
3
 
3
4
  module RubyRabbitmqJanus
4
5
  module Errors
5
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
-
7
6
  # Define errors to message sending and response to janus
8
- class JanusError < RRJError
7
+ class Janus < RRJError
9
8
  # Initialize a error standard for janus module
10
9
  # @param [String] message Text returning in raise
11
10
  def initialize(message)
@@ -14,3 +13,8 @@ module RubyRabbitmqJanus
14
13
  end
15
14
  end
16
15
  end
16
+
17
+ require 'rrj/errors/janus/janus_processus_keepalive'
18
+ require 'rrj/errors/janus/janus_message'
19
+ require 'rrj/errors/janus/janus_response'
20
+ require 'rrj/errors/janus/janus_transaction'
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
6
 
7
7
  # Define an exception for janus message class
8
- class JanusMessage < JanusError
8
+ class JanusMessage < Janus
9
9
  # Initialize a error for janus message module
10
10
  # @param [String] message Text returning in raise
11
11
  def initialize(message)
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
3
+ # @see RubyRabbitmqJanus::Janus::Keepalive Keepalive thread
4
+
5
+ module RubyRabbitmqJanus
6
+ module Errors
7
+ # Define errors for keepalive class
8
+ class Keepalive < Janus
9
+ # Write a message with a tag keepalive in log
10
+ def initialize(message)
11
+ super "[Keepalive] #{message}"
12
+ end
13
+ end
14
+
15
+ # Define error for session_return method
16
+ class KeepaliveSessionReturn < Keepalive
17
+ # Initialize a error message
18
+ def initialize(message)
19
+ super "Fixnum Session return failed : #{message}"
20
+ end
21
+ end
22
+
23
+ # Define error for create_session method
24
+ class KeepaliveCreateSession < Keepalive
25
+ # Initialize a error message
26
+ def initialize(message)
27
+ super "Session create error : #{message}"
28
+ end
29
+ end
30
+
31
+ # Define a error in loop_session method
32
+ class KeepaliveLoopSession < Keepalive
33
+ # Initialize a error message
34
+ def initialize(message)
35
+ super "Loop session failed (session will die) : #{message}"
36
+ end
37
+ end
38
+
39
+ # Define a error in message keepalive created
40
+ class KeepaliveMessage < Keepalive
41
+ # Initialize a error message
42
+ def initialize(message)
43
+ super "Keepalive message failed : #{message}"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
6
  #
7
7
  # Define an error primary for response
8
- class JanusResponse < JanusError
8
+ class JanusResponse < Janus
9
9
  # Initialize a error for janus response module
10
10
  # @param [String] message Text returning in raise
11
11
  def initialize(message)
@@ -4,11 +4,11 @@ module RubyRabbitmqJanus
4
4
  module Errors
5
5
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
6
  # Define an exception for initalizer transaction
7
- class JanusTransaction < JanusError
7
+ class JanusTransaction < Janus
8
8
  # Initialize a error for janus transaction class
9
9
  # @param [String] message Text returning in raise
10
10
  def initialize(message)
11
- super "[Transaction] Error initialize : #{message}"
11
+ super "[Transaction]#{message}"
12
12
  end
13
13
  end
14
14
 
File without changes
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
3
+
4
+ module RubyRabbitmqJanus
5
+ module Errors
6
+ # Define a super class for all error in class Config
7
+ class Config < RRJError
8
+ # Initalize a error for Config class
9
+ def initialize(message, level)
10
+ msg = "[Config] #{message} -- #{Tools::Log.instance.configuration}"
11
+ super(msg, level)
12
+ end
13
+ end
14
+
15
+ # Define an error if the configuration file is not here
16
+ class FileNotFound < Config
17
+ # Initialize a error for Config class if file don't exist.
18
+ # It's a fatal error
19
+ # @param [String] file Is a file path
20
+ def initialize
21
+ super 'Error for configuration file, does on exist.', :fatal
22
+ end
23
+ end
24
+
25
+ # Define and error if rubrik level is not present
26
+ class LevelNotDefine < Config
27
+ # Initialize a error for config class if log level option is not present.
28
+ # It's a warning error
29
+ def initialize
30
+ super \
31
+ 'Error in configuration file : option level is not present.', :fatal
32
+ end
33
+ end
34
+
35
+ # Define a error if janus/session/keepalive is not present
36
+ class TTLNotFound < Config
37
+ # Initialize a message error and level
38
+ def initialize
39
+ super 'Keepalive TTL option is not present in config file.', :fatal
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rrj/errors/tools/config'
data/lib/rrj/info.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # Define constant to gem.
4
4
  module RubyRabbitmqJanus
5
5
  # Define version to gem
6
- VERSION = '1.2.1'
6
+ VERSION = '1.2.2'
7
7
 
8
8
  # Define a summary description to gem
9
9
  SUMMARY = 'Ruby RabbitMQ Janus'
data/lib/rrj/init.rb CHANGED
@@ -45,6 +45,8 @@ module RubyRabbitmqJanus
45
45
  Tools::Log.instance.info "Create an session janus with id : #{@session}"
46
46
 
47
47
  @transaction = nil
48
+ rescue => error
49
+ raise Errors::InstanciateGemFailed, error
48
50
  end
49
51
 
50
52
  # Send an simple message to janus.
@@ -71,6 +73,8 @@ module RubyRabbitmqJanus
71
73
  Janus::Transactions::Session.new(@session).connect(exclusive) do
72
74
  Janus::Messages::Standard.new(type, options)
73
75
  end
76
+ rescue => error
77
+ raise Errors::TransactionSessionFailed, error
74
78
  end
75
79
 
76
80
  # Send an message simple in current session.
@@ -95,7 +99,7 @@ module RubyRabbitmqJanus
95
99
  Janus::Messages::Standard.new(type, use_current_session?(options))
96
100
  end
97
101
  rescue => error
98
- raise Errors::RRJErrorPost, error
102
+ raise Errors::TransactionSessionFailed, error
99
103
  end
100
104
 
101
105
  # Send a message simple for admin Janus.
@@ -121,8 +125,10 @@ module RubyRabbitmqJanus
121
125
  def message_admin(type, options = { 'replace' => {}, 'add' => {} })
122
126
  @transaction = Janus::Transactions::Admin.new(@session,
123
127
  true,
124
- handle?(options['replace']))
128
+ handle?(options))
125
129
  @transaction.connect { Janus::Messages::Admin.new(type, options) }
130
+ rescue => error
131
+ raise Errors::TransactionAdminFailed, error
126
132
  end
127
133
 
128
134
  # Send an message in handle session in current session.
@@ -145,6 +151,8 @@ module RubyRabbitmqJanus
145
151
  # @since 1.0.0
146
152
  def message_handle(type, options = { 'replace' => {}, 'add' => {} })
147
153
  @transaction.publish_message_handle(type, options)
154
+ rescue => error
155
+ raise Errors::TransactionMessageFailed, error
148
156
  end
149
157
 
150
158
  # Define an handle transaction and establish connection with janus
@@ -166,7 +174,7 @@ module RubyRabbitmqJanus
166
174
  @transaction = Janus::Transactions::Handle.new(@session, exclusive)
167
175
  @transaction.connect { yield }
168
176
  rescue => error
169
- raise Errors::RRJErrorHandle, error
177
+ raise Errors::TransactionHandleFailed, error
170
178
  end
171
179
 
172
180
  # Start an short transaction. Create an handle and send one message to
@@ -199,7 +207,7 @@ module RubyRabbitmqJanus
199
207
  handle?(options))
200
208
  @transaction.connect { message_handle(type, options) }
201
209
  rescue => error
202
- raise Errors::RRJErrorHandle, error
210
+ raise Errors::TransactionHandleFailed, error
203
211
  end
204
212
 
205
213
  private
@@ -211,7 +219,8 @@ module RubyRabbitmqJanus
211
219
  end
212
220
 
213
221
  def handle?(options)
214
- options['replace'].key?('handle_id') ? replace['handle_id'] : 0
222
+ replace = options['replace']
223
+ replace.key?('handle_id') ? replace['handle_id'] : 0
215
224
  end
216
225
  end
217
226
  end
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
 
15
15
  # Create a thread
16
16
  def initialize
17
- @response = nil
17
+ @response = @publish = nil
18
18
  super
19
19
  end
20
20
 
@@ -22,7 +22,6 @@ module RubyRabbitmqJanus
22
22
  def session
23
23
  lock.synchronize do
24
24
  condition.wait(lock)
25
- Tools::Log.instance.info 'Waitting signal'
26
25
  running_session
27
26
  end
28
27
  end
@@ -32,39 +31,38 @@ module RubyRabbitmqJanus
32
31
  def transaction_running
33
32
  @response = Janus::Responses::Standard.new(create_session)
34
33
  lock.synchronize do
35
- Tools::Log.instance.info 'Sending signal'
36
34
  condition.signal
37
35
  end
38
- session_keepalive(ttl)
36
+ loop_session(Tools::Config.instance.ttl)
39
37
  end
40
38
 
41
- def session_keepalive(time_to_live)
39
+ def loop_session(time_to_live)
42
40
  loop do
43
41
  sleep time_to_live
44
- publish.send_a_message(message_keepalive)
42
+ @publish.send_a_message(message_keepalive)
45
43
  end
46
- rescue => message
47
- Tools::Log.instance.debug "Error keepalive : #{message}"
48
- end
49
-
50
- def ttl
51
- Tools::Config.instance.options['gem']['session']['keepalive'].to_i
52
44
  rescue => error
53
- Tools::Log.instance.debug "TTL Not loading - #{error}"
45
+ raise Errors::KeepaliveLoopSession, error
54
46
  end
55
47
 
56
48
  def create_session
57
- publish = Rabbit::Publisher::PublishExclusive.new(rabbit.channel, '')
58
- publish.send_a_message(Janus::Messages::Standard.new('base::create'))
49
+ @publish = Rabbit::Publisher::PublishExclusive.new(rabbit.channel, '')
50
+ @publish.send_a_message(Janus::Messages::Standard.new('base::create'))
51
+ rescue => error
52
+ raise Errors::KeepaliveCreateSession, error
59
53
  end
60
54
 
61
55
  def running_session
62
56
  @response.session
57
+ rescue => error
58
+ raise Errors::KeepaliveSessionReturn, error
63
59
  end
64
60
 
65
61
  def message_keepalive
66
- Janus::Messages::Standard.new('base::keepalive',
67
- 'session_id' => running_session)
62
+ opt = { 'session_id' => running_session }
63
+ Janus::Messages::Standard.new('base::keepalive', opt)
64
+ rescue => error
65
+ raise Errors::KeepaliveMessage, error
68
66
  end
69
67
  end
70
68
  end
@@ -7,21 +7,6 @@ module RubyRabbitmqJanus
7
7
 
8
8
  # This class work with janus and send a series of message
9
9
  class Admin < Handle
10
- # Opening a long transaction with rabbitmq. If handle is equal to 0
11
- # create an handle, send request 'type::atach' before message.
12
- #
13
- # @yield Send a message to Janus
14
- #
15
- # @return [Fixnum] Sender using in current transaction
16
- def connect
17
- rabbit.transaction_short do
18
- choose_queue
19
- create_handle if handle.eql?(0)
20
- yield
21
- end
22
- handle
23
- end
24
-
25
10
  # Publish an message in handle
26
11
  def publish_message_handle(type, options)
27
12
  opts = {
@@ -26,7 +26,7 @@ module RubyRabbitmqJanus
26
26
  def connect
27
27
  rabbit.transaction_short do
28
28
  choose_queue
29
- create_handle
29
+ create_handle if @handle.eql?(0)
30
30
  yield
31
31
  end
32
32
  handle
@@ -12,7 +12,7 @@ module RubyRabbitmqJanus
12
12
  class Config
13
13
  include Singleton
14
14
 
15
- attr_reader :options
15
+ attr_reader :options, :configuration
16
16
 
17
17
  # Define HOME RRJ gem
18
18
  RRJ_HOME = File.realpath(File.join(File.dirname(__FILE__),
@@ -29,7 +29,7 @@ module RubyRabbitmqJanus
29
29
 
30
30
  # Initialize configuration file default or customize if exist
31
31
  def initialize
32
- @options = nil
32
+ @options = @configuration = nil
33
33
  conf_customize
34
34
  conf_default
35
35
  Tools::Log.instance.save_level(log_level)
@@ -37,29 +37,37 @@ module RubyRabbitmqJanus
37
37
 
38
38
  # @return [String] read configuration for queue `from`
39
39
  def queue_from
40
- @options['queues']['standard']['from']
40
+ @options['queues']['standard']['from'].to_s
41
41
  end
42
42
 
43
43
  # @return [String] read configuration for queue `to`
44
44
  def queue_to
45
- @options['queues']['standard']['to']
45
+ @options['queues']['standard']['to'].to_s
46
46
  end
47
47
 
48
48
  # @return [String] read configuration for queue admin `from`
49
49
  def queue_admin_from
50
- @options['queues']['admin']['from']
50
+ @options['queues']['admin']['from'].to_s
51
51
  end
52
52
 
53
53
  # @return [String] read configuration for queue admin `to`
54
54
  def queue_admin_to
55
- @options['queues']['admin']['to']
55
+ @options['queues']['admin']['to'].to_s
56
56
  end
57
57
 
58
58
  # @return [Symbol] read configuration for log level used in this gem
59
59
  def log_level
60
60
  @options['gem']['log']['level'].upcase.to_sym
61
61
  rescue
62
- raise Errors::LevelNotDefine
62
+ raise Errors::LevelNotDefine, @configuration
63
+ end
64
+
65
+ # @return [Integer]
66
+ # read configuration for janus time to live for keepalive messages
67
+ def time_to_live
68
+ @options['janus']['session']['keepalive'].to_i
69
+ rescue
70
+ raise Errors::TTLNotFound, @configuration
63
71
  end
64
72
 
65
73
  # @param [Fixnum] index determine what field is readint in array plugins
@@ -69,23 +77,26 @@ module RubyRabbitmqJanus
69
77
  @options['janus']['plugins'][index].to_s
70
78
  end
71
79
 
80
+ alias ttl time_to_live
81
+
72
82
  private
73
83
 
74
- def load_configuration(file)
75
- Tools::Log.instance.info("Loading configuration file : #{file}")
76
- YAML.load(ERB.new(File.read(file)).result)
84
+ def load_configuration
85
+ log_message = "Loading configuration file : #{@configuration}"
86
+ Tools::Log.instance.info(log_message)
87
+ YAML.load(ERB.new(File.read(@configuration)).result)
77
88
  rescue
78
- raise Errors::ConfigFileNotFound, file
89
+ raise Errors::FileNotFound, @configuration
79
90
  end
80
91
 
81
92
  def conf_customize
82
- file = File.join(Dir.pwd, CONF_CUSTOM)
83
- @options = load_configuration(file) if File.exist?(file)
93
+ @configuration = File.join(Dir.pwd, CONF_CUSTOM)
94
+ @options = load_configuration if File.exist?(@configuration)
84
95
  end
85
96
 
86
97
  def conf_default
87
- file = PATH_DEFAULT
88
- @options ||= load_configuration(file)
98
+ @configuration = PATH_DEFAULT
99
+ @options ||= load_configuration
89
100
  end
90
101
  end
91
102
  end
@@ -2,9 +2,66 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::Config', type: :config, name: :config do
6
- it 'Configuration is corectly loading' do
7
- expect(RubyRabbitmqJanus::Tools::Config.instance.options).to \
8
- match_json_schema(:config)
5
+ describe RubyRabbitmqJanus::Tools::Config, type: :config, name: :config do
6
+ before(:context) { @cfg = RubyRabbitmqJanus::Tools::Config.instance }
7
+
8
+ it 'When file is correct' do
9
+ expect(@cfg.options).to match_json_schema(:config)
10
+ end
11
+
12
+ it 'When janus/session/keepalive is correct type' do
13
+ expect(@cfg.ttl).to be_a(Integer)
14
+ end
15
+
16
+ it 'When janus/session/keepalive default value is loading' do
17
+ expect(@cfg.ttl).to eq 55
18
+ end
19
+
20
+ it 'When janus/plugins/0 is correct type' do
21
+ expect(@cfg.plugin_at).to be_a(String)
22
+ end
23
+
24
+ it 'When janus/plugins/0 defualt value is lading' do
25
+ expect(@cfg.plugin_at).to eq 'janus.plugin.echotest'
26
+ end
27
+
28
+ it 'When queues/standard/from is correct type' do
29
+ expect(@cfg.queue_from).to be_a(String)
30
+ end
31
+
32
+ it 'When queues/standard/from default value is loading' do
33
+ expect(@cfg.queue_from).to eq 'from-janus'
34
+ end
35
+
36
+ it 'When queues/standard/to is correct type' do
37
+ expect(@cfg.queue_to).to be_a(String)
38
+ end
39
+
40
+ it 'When queues/standard/to default value is loading' do
41
+ expect(@cfg.queue_to).to eq 'to-janus'
42
+ end
43
+
44
+ it 'When queues/admin/from is correct type' do
45
+ expect(@cfg.queue_admin_from).to be_a(String)
46
+ end
47
+
48
+ it 'When queues/admin/from default value is loading' do
49
+ expect(@cfg.queue_admin_from).to eq 'from-janus-admin'
50
+ end
51
+
52
+ it 'When queues/admin/to is correct type' do
53
+ expect(@cfg.queue_admin_to).to be_a(String)
54
+ end
55
+
56
+ it 'When queues/admin/to default value is loading' do
57
+ expect(@cfg.queue_admin_to).to eq 'to-janus-admin'
58
+ end
59
+
60
+ it 'When gem/log/level is correct type' do
61
+ expect(@cfg.log_level).to be_a(Symbol)
62
+ end
63
+
64
+ it 'When gem/log/level default value is loading' do
65
+ expect(@cfg.log_level).to eq :INFO
9
66
  end
10
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_rabbitmq_janus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
@@ -315,13 +315,16 @@ files:
315
315
  - lib/generators/ruby_rabbitmq_janus/default_request_generator.rb
316
316
  - lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
317
317
  - lib/generators/ruby_rabbitmq_janus/install_generator.rb
318
- - lib/rrj/errors/config.rb
319
318
  - lib/rrj/errors/error.rb
320
- - lib/rrj/errors/janus.rb
321
- - lib/rrj/errors/janus_message.rb
322
- - lib/rrj/errors/janus_response.rb
323
- - lib/rrj/errors/janus_transaction.rb
324
- - lib/rrj/errors/rabbit.rb
319
+ - lib/rrj/errors/init.rb
320
+ - lib/rrj/errors/janus/janus.rb
321
+ - lib/rrj/errors/janus/janus_message.rb
322
+ - lib/rrj/errors/janus/janus_processus_keepalive.rb
323
+ - lib/rrj/errors/janus/janus_response.rb
324
+ - lib/rrj/errors/janus/janus_transaction.rb
325
+ - lib/rrj/errors/rabbit/rabbit.rb
326
+ - lib/rrj/errors/tools/config.rb
327
+ - lib/rrj/errors/tools/tools.rb
325
328
  - lib/rrj/info.rb
326
329
  - lib/rrj/init.rb
327
330
  - lib/rrj/janus/janus.rb
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyRabbitmqJanus
4
- module Errors
5
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
-
7
- # Define an error if the configuration file is not here
8
- class ConfigFileNotFound < Errors::RRJError
9
- # Initialize a error for Config class if file don't exist.
10
- # It's a fatal error
11
- # @param [String] file Is a file path
12
- def initialize(file)
13
- super \
14
- "Error for configuration file (#{file}), does on exist.", :fatal
15
- end
16
- end
17
-
18
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
19
-
20
- # Define and error if rubrik level is not present
21
- class LevelNotDefine < Errors::RRJError
22
- # Initialize a error for config class if log level option is not present.
23
- # It's a warning error
24
- def initialize
25
- super \
26
- 'Error in configuration file : option level is not present.', :warn
27
- end
28
- end
29
- end
30
- end