ruby_rabbitmq_janus 3.0.0.pre.336 → 3.0.0.pre.351
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +80 -29
- data/bin/ruby_rabbitmq_janus +1 -1
- data/config/default.yml +1 -3
- data/config/requests/admin/allow_token.json +2 -1
- data/config/requests/admin/disallow_token.json +2 -1
- data/config/requests/admin/set_session_timeout.json +2 -3
- data/config/requests/peer/trickles.json +7 -0
- data/lib/rrj/admin.rb +0 -2
- data/lib/rrj/errors/error.rb +7 -2
- data/lib/rrj/errors/janus/janus.rb +3 -17
- data/lib/rrj/errors/janus/messages/message.rb +1 -1
- data/lib/rrj/errors/janus/responses/admin.rb +67 -23
- data/lib/rrj/errors/janus/responses/base.rb +15 -0
- data/lib/rrj/errors/janus/responses/code.rb +41 -0
- data/lib/rrj/errors/janus/responses/event.rb +23 -28
- data/lib/rrj/errors/janus/responses/standard.rb +43 -32
- data/lib/rrj/errors/janus/transactions/transaction.rb +1 -1
- data/lib/rrj/errors/process/concurency.rb +1 -1
- data/lib/rrj/errors/rabbit/listener/base.rb +8 -1
- data/lib/rrj/init.rb +5 -8
- data/lib/rrj/janus/janus.rb +6 -6
- data/lib/rrj/janus/messages/admin.rb +1 -5
- data/lib/rrj/janus/messages/message.rb +0 -10
- data/lib/rrj/janus/messages/standard.rb +0 -4
- data/lib/rrj/janus/responses/admin.rb +50 -9
- data/lib/rrj/janus/responses/error.rb +159 -0
- data/lib/rrj/janus/responses/event.rb +14 -14
- data/lib/rrj/janus/responses/response.rb +43 -13
- data/lib/rrj/janus/responses/standard.rb +46 -14
- data/lib/rrj/janus/transactions/admin.rb +0 -6
- data/lib/rrj/janus/transactions/handle.rb +0 -10
- data/lib/rrj/janus/transactions/session.rb +0 -6
- data/lib/rrj/janus/transactions/transaction.rb +0 -2
- data/lib/rrj/models/concerns/instances.rb +0 -4
- data/lib/rrj/process/concurrency.rb +0 -2
- data/lib/rrj/process/event.rb +0 -4
- data/lib/rrj/process/event_admin.rb +0 -4
- data/lib/rrj/rabbit/base_event.rb +0 -2
- data/lib/rrj/rabbit/connect.rb +0 -12
- data/lib/rrj/rabbit/listener/base.rb +10 -8
- data/lib/rrj/rabbit/listener/from.rb +0 -3
- data/lib/rrj/rabbit/listener/from_admin.rb +0 -3
- data/lib/rrj/rabbit/propertie.rb +7 -9
- data/lib/rrj/rabbit/publisher/admin.rb +0 -4
- data/lib/rrj/rabbit/publisher/base.rb +0 -4
- data/lib/rrj/rabbit/publisher/exclusive.rb +0 -4
- data/lib/rrj/rabbit/publisher/keepalive.rb +0 -4
- data/lib/rrj/rabbit/publisher/non_exclusive.rb +0 -4
- data/lib/rrj/task.rb +0 -2
- data/lib/rrj/tools/bin/config.rb +2 -1
- data/lib/rrj/tools/gem/cluster.rb +0 -4
- data/lib/rrj/tools/gem/config/queues.rb +0 -5
- data/lib/rrj/tools/gem/{log.rb → logger.rb} +0 -0
- data/lib/rrj/tools/gem/option.rb +1 -6
- data/lib/rrj/tools/gem/requests.rb +0 -2
- data/lib/rrj/tools/replaces/admin.rb +2 -5
- data/lib/rrj/tools/replaces/handle.rb +0 -6
- data/lib/rrj/tools/replaces/replace.rb +0 -10
- data/lib/rrj/tools/replaces/session.rb +0 -4
- data/lib/rrj/tools/replaces/type.rb +5 -4
- data/spec/config/database.rb +1 -2
- data/spec/config/initializer.rb +5 -5
- data/spec/rrj/ruby_rabbitmq_janus_spec.rb +1 -1
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_handles_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_info_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_level_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_libnice_debug_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_locking_debug_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_colors_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_timestamps_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_max_nack_queue_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_no_media_timer_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_sessions_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_spec.rb +1 -34
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_timeout_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_data_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_event_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_jsep_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_keys_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb +27 -15
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_data_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_data_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_sdp_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_sender_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_id_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/models/janus_instance_spec.rb +7 -2
- data/spec/ruby_rabbitmq_janus/rabbit/connect_spec.rb +0 -4
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_classic_spec.rb +12 -0
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_token_spec.rb +12 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +31 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +32 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_handles_spec.Rb +32 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_sessions_spec.rb +25 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +33 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +75 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_max_nack_queue_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +47 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +47 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +38 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +38 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_answer_spec.rb +79 -0
- data/spec/ruby_rabbitmq_janus/rrj_attach_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_create_spec.rb +25 -0
- data/spec/ruby_rabbitmq_janus/rrj_destroy_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_detach_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_info_spec.rb +36 -0
- data/spec/ruby_rabbitmq_janus/rrj_keepalive_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_offer_spec.rb +57 -0
- data/spec/ruby_rabbitmq_janus/rrj_trickle_spec.rb +41 -0
- data/spec/ruby_rabbitmq_janus/rrj_trickles_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/tools/cluster_spec.rb +12 -7
- data/spec/ruby_rabbitmq_janus/tools/config_gem_spec.rb +94 -0
- data/spec/ruby_rabbitmq_janus/tools/config_janus_spec.rb +44 -0
- data/spec/ruby_rabbitmq_janus/tools/config_queues_spec.rb +34 -0
- data/spec/ruby_rabbitmq_janus/tools/config_rabbit_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/tools/config_spec.rb +4 -77
- data/spec/ruby_rabbitmq_janus/tools/replaces/admin_spec.rb +13 -12
- data/spec/ruby_rabbitmq_janus/tools/replaces/handle_spec.rb +12 -11
- data/spec/ruby_rabbitmq_janus/tools/replaces/replace_spec.rb +15 -14
- data/spec/ruby_rabbitmq_janus/tools/replaces/session_spec.rb +12 -11
- data/spec/ruby_rabbitmq_janus/tools/type_spec.rb +20 -1
- data/spec/spec_helper.rb +23 -8
- data/spec/support/examples_admin.rb +43 -0
- data/spec/support/examples_base.rb +65 -0
- data/spec/support/examples_config.rb +4 -2
- data/spec/support/examples_message.rb +4 -2
- data/spec/support/initialize_janus_instance.rb +80 -0
- data/spec/support/schemas/config/{rabbit_options_admin.json → rabbit_options_admin_instance_classic.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options_admin2.json → rabbit_options_admin_instance_token.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options.json → rabbit_options_instance_classic.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options2.json → rabbit_options_instance_token.json} +0 -0
- data/spec/support/schemas/request/admin/set_libnice_debug.json +13 -0
- data/spec/support/schemas/request/admin/set_log_colors.json +13 -0
- data/spec/support/schemas/request/admin/set_log_level.json +4 -2
- data/spec/support/schemas/request/admin/set_log_timestamps.json +13 -0
- data/spec/support/schemas/request/admin/set_max_nack_queue.json +13 -0
- data/spec/support/schemas/request/admin/set_no_media_timer.json +13 -0
- data/spec/support/schemas/request/admin/set_session_timeout.json +13 -0
- data/spec/support/schemas/request/peer/trickles.json +13 -0
- data/spec/support/sdp.rb +2 -0
- data/spec/support/type.rb +9 -7
- metadata +93 -55
- data/lib/rrj/errors/janus/responses/response.rb +0 -44
- data/spec/config/instance.rb +0 -63
- data/spec/request/admin/request_add_token_spec.rb +0 -29
- data/spec/request/admin/request_allow_token_spec.rb +0 -21
- data/spec/request/admin/request_disallow_token_spec.rb +0 -21
- data/spec/request/admin/request_handle_info_spec.rb +0 -21
- data/spec/request/admin/request_list_handles_spec.rb +0 -20
- data/spec/request/admin/request_list_sessions_spec.rb +0 -21
- data/spec/request/admin/request_list_tokens_spec.rb +0 -18
- data/spec/request/admin/request_remove_token_spec.rb +0 -18
- data/spec/request/admin/request_set_libnice_debug_spec.rb +0 -28
- data/spec/request/admin/request_set_locking_debug_spec.rb +0 -28
- data/spec/request/admin/request_set_log_colors_spec.rb +0 -28
- data/spec/request/admin/request_set_log_level_spec.rb +0 -70
- data/spec/request/admin/request_set_log_timestamps_spec.rb +0 -28
- data/spec/request/admin/request_set_max_nack_queue_spec.rb +0 -28
- data/spec/request/admin/request_set_no_media_timer_spec.rb +0 -28
- data/spec/request/admin/request_set_session_timeout_spec.rb +0 -35
- data/spec/request/admin/request_start_pcap_spec.rb +0 -28
- data/spec/request/admin/request_start_text2pcap_spec.rb +0 -27
- data/spec/request/admin/request_stop_pcap_spec.rb +0 -21
- data/spec/request/admin/request_stop_text2pcap_spec.rb +0 -28
- data/spec/request/base/request_attach_spec.rb +0 -27
- data/spec/request/base/request_create_spec.rb +0 -22
- data/spec/request/base/request_destroy_spec.rb +0 -23
- data/spec/request/base/request_detach_spec.rb +0 -27
- data/spec/request/base/request_info_spec.rb +0 -22
- data/spec/request/base/request_keepalive_spec.rb +0 -23
- data/spec/request/peer/request_offer_spec.rb +0 -27
- data/spec/request/peer/request_trickle_spec.rb +0 -30
- data/spec/request/peer/request_trickles_spec.rb +0 -30
- data/spec/responses/admin_handle_info.json +0 -32
- data/spec/responses/admin_list_handles.json +0 -4
- data/spec/responses/admin_list_sessions.json +0 -4
- data/spec/responses/admin_set_libnice_debug.json +0 -4
- data/spec/responses/admin_set_locking_debug.json +0 -4
- data/spec/responses/admin_set_log_colors.json +0 -4
- data/spec/responses/admin_set_log_level.json +0 -4
- data/spec/responses/base_info.json +0 -5
- data/spec/ruby_rabbitmq_janus/janus/responses/event_spec.rb +0 -26
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_spec.rb +0 -44
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_2_spec.rb +0 -28
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_spec.rb +0 -29
- data/spec/ruby_rabbitmq_janus/tools/logger_spec.rb +0 -84
- data/spec/support/admin_requester.rb +0 -48
- data/spec/support/aruba.rb +0 -3
- data/spec/support/examples_request.rb +0 -65
- data/spec/support/examples_response.rb +0 -30
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
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
|
-
require 'spec_helper'
|
7
|
-
|
8
|
-
describe 'RubyRabbitmqJanus::RRJ -- message type trickles' do
|
9
|
-
before do
|
10
|
-
clear
|
11
|
-
attach_base
|
12
|
-
|
13
|
-
@type = 'peer::trickle'
|
14
|
-
candidate = { 'sdpMid' => '..', 'sdpMLineIndex' => 1, 'candidate' => '..' }
|
15
|
-
@options.merge!('candidates' => [candidate, candidate, candidate])
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#handle_endpoint_public', type: :request,
|
19
|
-
level: :base,
|
20
|
-
broken: true,
|
21
|
-
name: :trickles do
|
22
|
-
context 'when queue is exclusive' do
|
23
|
-
include_examples 'transaction handle should match json schema'
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when queue is not exclusive' do
|
27
|
-
include_examples 'transaction handle should match json empty'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"janus" : "success",
|
3
|
-
"transaction" : "<same as the request>",
|
4
|
-
"session_id" : 12345678,
|
5
|
-
"handle_id" : 98765432,
|
6
|
-
"info" : {
|
7
|
-
"session_id" : 12345678,
|
8
|
-
"session_last_activity": 7927759122,
|
9
|
-
"session_transport": "janus.transport.websockets",
|
10
|
-
"handle_id" : 98765432,
|
11
|
-
"opaque_id": "echotest-YZcsLRCI4uSV",
|
12
|
-
"loop-running": true,
|
13
|
-
"created": 18695669309,
|
14
|
-
"current_time": 18706199704,
|
15
|
-
"plugin": "janus.plugin.echotest",
|
16
|
-
"plugin_specific": {
|
17
|
-
},
|
18
|
-
"flags": {
|
19
|
-
},
|
20
|
-
"agent-created": 18696092523,
|
21
|
-
"ice-mode": "full",
|
22
|
-
"ice-role": "controlled",
|
23
|
-
"sdps": {
|
24
|
-
"profile": "UDP/TLS/RTP/SAVPF",
|
25
|
-
"local": "v=0[..]",
|
26
|
-
"remote": "v=0[..]"
|
27
|
-
},
|
28
|
-
"queued-packets": 0,
|
29
|
-
"streams": [
|
30
|
-
]
|
31
|
-
}
|
32
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe RubyRabbitmqJanus::Janus::Responses::Event, type: :responses,
|
6
|
-
name: :event,
|
7
|
-
broken: true do
|
8
|
-
let(:message) do
|
9
|
-
# Transaction not exclusive, response is public queue
|
10
|
-
@gateway.session_endpoint_public do |transaction|
|
11
|
-
@response = transaction.publish_message(type)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#event' do
|
16
|
-
subject(:thread) { @event.join }
|
17
|
-
|
18
|
-
let(:type) { 'base::info' }
|
19
|
-
let(:response) { @response }
|
20
|
-
|
21
|
-
it 'eqls {}' do
|
22
|
-
message
|
23
|
-
expect(@response.to_hash).to eql({})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe RubyRabbitmqJanus::Janus::Responses::Standard, type: :responses,
|
6
|
-
broken: true,
|
7
|
-
name: :standard do
|
8
|
-
let(:message) do
|
9
|
-
@gateway.session_endpoint_public do |transaction|
|
10
|
-
@response = transaction.publish_message(type)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'when just session' do
|
15
|
-
describe '#session' do
|
16
|
-
let(:type) { 'base::create' }
|
17
|
-
let(:response) { @response.session }
|
18
|
-
|
19
|
-
include_examples 'response is', Integer
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#sender' do
|
23
|
-
let(:type) { 'base::create' }
|
24
|
-
let(:response) { @response.sender }
|
25
|
-
|
26
|
-
include_examples 'response is', Integer
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'when session and sender' do
|
31
|
-
before do
|
32
|
-
@gateway.session_endpoint_public do |transaction|
|
33
|
-
@response = transaction.publish_message('base::create')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#session_id' do
|
38
|
-
let(:type) { 'base::attach' }
|
39
|
-
let(:response) { @response.session_id }
|
40
|
-
|
41
|
-
include_examples 'response with sender is', Integer
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe RubyRabbitmqJanus::Rabbit::Propertie, type: :rabbit,
|
6
|
-
name: :propertie do
|
7
|
-
let(:rabbit) { described_class.new }
|
8
|
-
|
9
|
-
describe '#options' do
|
10
|
-
it { expect(rabbit.options).to match_json_schema(:rabbit_options) }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#options_admin', broken: true do
|
14
|
-
context 'when admin request' do
|
15
|
-
it do
|
16
|
-
expect(rabbit.options_admin('admin::sessions')).to \
|
17
|
-
match_json_schema(:rabbit_options_admin)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when base request' do
|
22
|
-
it do
|
23
|
-
expect(rabbit.options_admin('request::create')).to \
|
24
|
-
match_json_schema(:rabbit_options)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe RubyRabbitmqJanus::Rabbit::Propertie, type: :rabbit,
|
6
|
-
name: :propertie,
|
7
|
-
instances: true do
|
8
|
-
let(:rabbit) { described_class.new(2) }
|
9
|
-
|
10
|
-
describe '#options' do
|
11
|
-
it { expect(rabbit.options).to match_json_schema(:rabbit_options2) }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#options_admin', broken: true do
|
15
|
-
context 'when admin request' do
|
16
|
-
it do
|
17
|
-
expect(rabbit.options_admin('admin::sessions')).to \
|
18
|
-
match_json_schema(:rabbit_options_admin2)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when base request' do
|
23
|
-
it do
|
24
|
-
expect(rabbit.options_admin('request::create')).to \
|
25
|
-
match_json_schema(:rabbit_options2)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'rrj/tools/gem/log.rb'
|
5
|
-
|
6
|
-
describe RubyRabbitmqJanus::Tools::Logger, type: :tools, name: :log, broken: true do
|
7
|
-
let(:levels) do
|
8
|
-
{
|
9
|
-
DEBUG: Logger::DEBUG,
|
10
|
-
INFO: Logger::INFO,
|
11
|
-
WARN: Logger::WARN,
|
12
|
-
ERROR: Logger::ERROR,
|
13
|
-
FATAL: Logger::FATAL,
|
14
|
-
UNKNOWN: Logger::UNKNOWN
|
15
|
-
}
|
16
|
-
end
|
17
|
-
let(:sensitives) { %i[admin_secret apisecret] }
|
18
|
-
let(:log) { described_class.instance }
|
19
|
-
let(:log_constant) { described_class }
|
20
|
-
let(:new_level) { Random.new.rand(5) }
|
21
|
-
let(:message) { '## test ##' }
|
22
|
-
let(:last_line) { IO.readlines('log/ruby-rabbitmq-janus.log')[-1..-1][0] }
|
23
|
-
|
24
|
-
it 'Default levels' do
|
25
|
-
expect(log_constant::LEVELS).to eql(levels)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'Defaults sensitives word' do
|
29
|
-
expect(log_constant::SENSITIVES).to eql(sensitives)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'Log instance is correctly loading' do
|
33
|
-
expect(log).not_to be(nil)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'Default level log is INFO' do
|
37
|
-
# 0 = debug
|
38
|
-
# ...
|
39
|
-
# 5 = unknown
|
40
|
-
expect(log.level).to eq(0)
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when write a message unknown' do
|
44
|
-
before { log.unknown(message) }
|
45
|
-
|
46
|
-
it { expect(last_line).to include('A, ## test ##') }
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'when write a message fatal' do
|
50
|
-
before { log.fatal(message) }
|
51
|
-
|
52
|
-
it { expect(last_line).to include('F, ## test ##') }
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'when write a message error' do
|
56
|
-
before { log.error(message) }
|
57
|
-
|
58
|
-
it { expect(last_line).to include('E, ## test ##') }
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'when write a message warn' do
|
62
|
-
before { log.warn(message) }
|
63
|
-
|
64
|
-
it { expect(last_line).to include('W, ## test ##') }
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when write a message info' do
|
68
|
-
before { log.info(message) }
|
69
|
-
|
70
|
-
it { expect(last_line).to include('I, ## test ##') }
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'when write a message debug' do
|
74
|
-
before { log.debug(message) }
|
75
|
-
|
76
|
-
it { expect(last_line).to include('D, ## test ##') }
|
77
|
-
end
|
78
|
-
|
79
|
-
context 'when level is changed' do
|
80
|
-
it 'Change level' do
|
81
|
-
expect(log.save_level(new_level)).to eql(log.level)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Helpers method for admin requester
|
4
|
-
# Use this methods before execute block 'it'
|
5
|
-
|
6
|
-
# Prepare variable for sending request to RabbitMQ
|
7
|
-
def help_admin_prepare
|
8
|
-
@opt_instance = instance
|
9
|
-
@opt_transaction = {}
|
10
|
-
@transaction = nil
|
11
|
-
end
|
12
|
-
|
13
|
-
# Create a session
|
14
|
-
def help_admin_create_session
|
15
|
-
@gateway.session_endpoint_public(@opt_instance) do |transaction|
|
16
|
-
session = transaction.publish_message('base::create', @opt_transaction).session
|
17
|
-
|
18
|
-
@opt_transaction['session_id'] = session
|
19
|
-
@opt_instance.merge!(@opt_transaction)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Create a handler (attached to plugin echo test)
|
24
|
-
def help_admin_create_handler
|
25
|
-
@gateway.session_endpoint_public(@opt_instance) do |transaction|
|
26
|
-
handler = transaction.publish_message('base::attach', @opt_transaction).sender
|
27
|
-
@opt_transaction['handle_id'] = handler
|
28
|
-
@opt_instance.merge!(@opt_transaction)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Execute an action before test requester result
|
33
|
-
def help_admin_request_before(type_before, admin_opt = {})
|
34
|
-
@opt_transaction.merge!(admin_opt)
|
35
|
-
|
36
|
-
@gateway.admin_endpoint(@opt_instance) do |transaction|
|
37
|
-
transaction.publish_message(type_before, @opt_transaction)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Request tested
|
42
|
-
def help_admin_request_tested(admin_opt = {})
|
43
|
-
@opt_transaction.merge!(admin_opt)
|
44
|
-
|
45
|
-
@gateway.admin_endpoint(@opt_instance) do |transaction|
|
46
|
-
@transaction = transaction.publish_message(type, @opt_transaction)
|
47
|
-
end
|
48
|
-
end
|
data/spec/support/aruba.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_examples 'empty response' do
|
4
|
-
it 'matches JSON empty' do
|
5
|
-
message
|
6
|
-
expect(@response.to_json).to eq('{}')
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
shared_examples 'schema response' do
|
11
|
-
it do
|
12
|
-
message
|
13
|
-
expect(@response.to_json).to match_json_schema(@type)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
shared_examples 'transaction should match json empty' do
|
18
|
-
let(:message) do
|
19
|
-
@gateway.session_endpoint_public(@session_instance) do |transaction|
|
20
|
-
@response = transaction.publish_message(@type, @options)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
include_examples 'empty response'
|
25
|
-
end
|
26
|
-
|
27
|
-
shared_examples 'transaction should match json schema' do
|
28
|
-
let(:message) do
|
29
|
-
@gateway.session_endpoint_private(@session_instance) do |transaction|
|
30
|
-
@response = transaction.publish_message(@type, @options)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
include_examples 'schema response'
|
35
|
-
end
|
36
|
-
|
37
|
-
shared_examples 'transaction handle should match json schema' do
|
38
|
-
let(:message) do
|
39
|
-
@gateway.handle_endpoint_private(@session_instance) do |transaction|
|
40
|
-
@response = transaction.publish_message(@type, @options)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
include_examples 'schema response'
|
45
|
-
end
|
46
|
-
|
47
|
-
shared_examples 'transaction handle should match json empty' do
|
48
|
-
let(:message) do
|
49
|
-
@gateway.handle_endpoint_public(@session_instance) do |transaction|
|
50
|
-
@response = transaction.publish_message(@type, @options)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
include_examples 'empty response'
|
55
|
-
end
|
56
|
-
|
57
|
-
shared_examples 'transaction admin should match json schema' do
|
58
|
-
let(:message) do
|
59
|
-
@gateway.admin_endpoint(@instance) do |transaction|
|
60
|
-
@response = transaction.publish_message(@type, @options)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
include_examples 'schema response'
|
65
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_examples 'response is' do |type|
|
4
|
-
it do
|
5
|
-
message
|
6
|
-
expect(response).to be_kind_of(type)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
shared_examples 'response with sender is' do |klass|
|
11
|
-
let(:message) do
|
12
|
-
@gateway.session_endpoint_public do |transaction|
|
13
|
-
opts = { 'handle_id' => @response.sender }
|
14
|
-
@response = transaction.publish_message(type, opts)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
include_examples 'response is', klass
|
19
|
-
end
|
20
|
-
|
21
|
-
shared_examples 'admin response with sender is' do |klass|
|
22
|
-
let(:message) do
|
23
|
-
opts = { 'handle_id' => @response.sender }
|
24
|
-
@gateway.admin_endpoint(opts) do |transaction|
|
25
|
-
@response = transaction.publish_message(type, opts)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
include_examples 'response is', klass
|
30
|
-
end
|