ruby_rabbitmq_janus 2.2.0.pre.159 → 2.2.0.pre.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00285c936506050da48005b5aa88d3d1a807033d
4
- data.tar.gz: 4936bc5671f055b7916566c9c5bd538151ac8910
3
+ metadata.gz: 182b09224c0eb5b640dcd29c9a5265db471cd769
4
+ data.tar.gz: 99833ee6c55b7274ab3e24d6952e84e053c3c15d
5
5
  SHA512:
6
- metadata.gz: 503a9222f16ea2e6b1cd67b5a0155dd884be45e866bca9186470b080540bfe608963054cde66f765c568acc2e70dfe62abd8469f4e79abefd7cd2b0679809957
7
- data.tar.gz: d1983a18e3d50b7565ac64f872655f9f3a741f4214ea45d6a4483313c3bb4a268145d85cfc6a8939ee0f97de0943f47fe803cc9745ce4bd4727ac8f891bcbe03
6
+ metadata.gz: e62fd19a4055f94140711753854286529a931efa682b6defd849895a77adb21440e34489cfb8e6bdadb948fbfd9aef3062ffffb6372c65fbd23e7c3aeedb868b
7
+ data.tar.gz: 5de6c2f983e83669028a4deaf4e227d964328c1b8ce87be486d6586402910d2b4154edaa37ac4d7d7cf0985bc11391cc3b71c96baee4c6f37244580a25108bd2
@@ -6,7 +6,6 @@
6
6
  class CreateRubyRabbitmqJanusTables < ActiveRecord::Migration[5.0]
7
7
  def change
8
8
  create_table :janus_instances do |table|
9
- table.integer :instance
10
9
  table.integer :session, limit: 8
11
10
  table.boolean :enable
12
11
  table.integer :thread, limit: 8
@@ -10,6 +10,8 @@ module RubyRabbitmqJanus
10
10
  include RubyRabbitmqJanus::Models::JanusInstanceMethods
11
11
  include RubyRabbitmqJanus::Models::JanusInstanceValidations
12
12
 
13
+ alias_attribute :instance, :id
14
+
13
15
  after_create { callback_create_after }
14
16
  after_update { callback_update_after }
15
17
  after_destroy { callback_destroy_after }
@@ -7,10 +7,6 @@ module RubyRabbitmqJanus
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
10
- # Instance number it's mandatory, unique and with type Integer
11
- validates :instance, presence: true,
12
- numericality: { only_integer: true },
13
- uniqueness: true
14
10
  # This instance it's a state (enable or disable)
15
11
  validates :enable, presence: true,
16
12
  inclusion: { in: [true, false] }
@@ -11,10 +11,10 @@ module RubyRabbitmqJanus
11
11
  include RubyRabbitmqJanus::Models::JanusInstanceMethods
12
12
  include RubyRabbitmqJanus::Models::JanusInstanceValidations
13
13
 
14
- field :instance, type: Integer
15
- field :session, type: Integer
16
- field :enable, type: Boolean
17
- field :thread, type: Integer
14
+ field :_id, type: String, as: :instance
15
+ field :session, type: Integer
16
+ field :enable, type: Boolean
17
+ field :thread, type: Integer
18
18
 
19
19
  set_callback(:create, :after) { callback_create_after }
20
20
  set_callback(:update, :after) { callback_update_after }
@@ -8,9 +8,46 @@ def create_janus_instances
8
8
  end
9
9
  end
10
10
 
11
+ def attach_base
12
+ res = nil
13
+ @gateway.start_transaction(true, @session_instance) do |tr|
14
+ res = tr.publish_message('base::attach', @session_instance)
15
+ end
16
+ @options.merge!('handle_id' => res.sender).merge!(@session_instance)
17
+ end
18
+
19
+ def attach_admin
20
+ res = nil
21
+ @gateway.start_transaction_admin(@session_instance) do |tr|
22
+ res = tr.publish_message('base::attach', @session_instance)
23
+ end
24
+ @options.merge!('handle_id' => res.sender).merge!(@session_instance)
25
+ end
26
+
27
+ def session
28
+ res = nil
29
+ @gateway.start_transaction(true, @instance) do |tr|
30
+ res = tr.publish_message('base::create', @instance)
31
+ end
32
+ @options.merge!('session_id' => res.session).merge!(@instance)
33
+ end
34
+
35
+ def clear
36
+ @response = nil
37
+ @options = {}
38
+ end
39
+
11
40
  def find_instance
12
- ji = RubyRabbitmqJanus::Models::JanusInstance.first
41
+ ji = RubyRabbitmqJanus::Models::JanusInstance.all.sample
13
42
  @session = { 'session_id' => ji.session }
14
43
  @instance = { 'instance' => ji.instance }
15
44
  @session_instance = @session.merge(@instance)
16
45
  end
46
+
47
+ def initializer_rrj(metadata)
48
+ @gateway = if metadata[:level].eql?(:admin)
49
+ RubyRabbitmqJanus::RRJAdmin.new
50
+ else
51
+ RubyRabbitmqJanus::RRJ.new
52
+ end
53
+ end
@@ -4,13 +4,9 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type handle info' do
6
6
  before(:example) do
7
+ clear
8
+ attach_admin
7
9
  @type = 'admin::handle_info'
8
- sender = nil
9
- @gateway.start_transaction_admin(@session_instance) do |transaction|
10
- sender = transaction.publish_message('base::attach',
11
- @session_instance).sender
12
- end
13
- @options = { 'handle_id' => sender }.merge(@session_instance)
14
10
  end
15
11
 
16
12
  describe '#start_transaction_admin', type: :request,
@@ -4,13 +4,9 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type handles list' do
6
6
  before(:example) do
7
+ clear
8
+ attach_admin
7
9
  @type = 'admin::handles'
8
- sender = nil
9
- @gateway.start_transaction_admin(@session_instance) do |transaction|
10
- sender = transaction.publish_message('base::attach',
11
- @session_instance).sender
12
- end
13
- @options = { 'handle_id' => sender }.merge(@session_instance)
14
10
  end
15
11
 
16
12
  describe '#start_transaction_admin', type: :request,
@@ -3,7 +3,10 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type sessions list' do
6
- before(:example) { @type = 'admin::sessions' }
6
+ before(:example) do
7
+ clear
8
+ @type = 'admin::sessions'
9
+ end
7
10
 
8
11
  describe '#start_transaction_admin', type: :request,
9
12
  level: :admin,
@@ -2,8 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type set locking debug', broken: true do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type set locking debug' do
6
6
  before(:example) do
7
+ clear
7
8
  @type = 'admin::set_locking_debug'
8
9
  @options = { 'debug' => [true, false].sample }
9
10
  end
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type set log level' do
6
6
  before(:example) do
7
+ clear
7
8
  @type = 'admin::set_log_level'
8
9
  @options = { 'level' => Random.rand(7) }
9
10
  end
@@ -4,15 +4,14 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type attach' do
6
6
  before(:example) do
7
- @gateway = RubyRabbitmqJanus::RRJ.new
8
-
7
+ clear
9
8
  @type = 'base::attach'
10
9
  end
11
10
 
12
11
  describe '#start_transaction', type: :request,
13
12
  level: :base,
14
13
  name: :attach do
15
- context 'when queue is exclusive' do
14
+ context 'when queue is exclusive', broken: true do
16
15
  include_examples 'transaction should match json schema'
17
16
  end
18
17
 
@@ -4,8 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type create' do
6
6
  before(:example) do
7
- @gateway = RubyRabbitmqJanus::RRJ.new
8
-
7
+ clear
9
8
  @type = 'base::create'
10
9
  end
11
10
 
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type destroy' do
6
6
  before(:example) do
7
- @gateway = RubyRabbitmqJanus::RRJ.new
8
-
7
+ clear
8
+ session
9
9
  @type = 'base::destroy'
10
10
  end
11
11
 
@@ -2,8 +2,12 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- mesage type detach', broken: true do
6
- before(:example) { @type = 'base::detach' }
5
+ describe 'RubyRabbitmqJanus::RRJ -- mesage type detach' do
6
+ before(:example) do
7
+ clear
8
+ attach_base
9
+ @type = 'base::detach'
10
+ end
7
11
 
8
12
  describe '#start_transaction_handle', type: :request,
9
13
  level: :base,
@@ -4,8 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type info' do
6
6
  before(:example) do
7
- @gateway = RubyRabbitmqJanus::RRJ.new
8
-
7
+ clear
9
8
  @type = 'base::info'
10
9
  end
11
10
 
@@ -2,8 +2,12 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type keepalive', broken: true do
6
- before(:example) { @type = 'base::keepalive' }
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type keepalive' do
6
+ before(:example) do
7
+ clear
8
+ session
9
+ @type = 'base::keepalive'
10
+ end
7
11
 
8
12
  describe '#start_transaction', type: :request,
9
13
  level: :base,
@@ -2,12 +2,14 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
+ # @todo Create a message reading by janus
5
6
  describe 'RubyRabbitmqJanus::RRJ -- message type offer', broken: true do
6
7
  before(:example) do
7
- @gateway = RubyRabbitmqJanus::RRJ.new
8
+ clear
9
+ attach_base
8
10
 
9
11
  @type = 'peer::offer'
10
- @options = {
12
+ @options.merge!({
11
13
  'sdp' => <<-SDP
12
14
  v=0
13
15
  o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com
@@ -22,7 +24,7 @@ describe 'RubyRabbitmqJanus::RRJ -- message type offer', broken: true do
22
24
  a=rtpmap:31 H261/90000
23
25
  a=rtpmap:32 MPV/90000
24
26
  SDP
25
- }
27
+ })
26
28
  end
27
29
 
28
30
  describe '#start_transaction_handle', type: :request,
@@ -2,11 +2,14 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type trickle', broken: true do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type trickle' do
6
6
  before(:example) do
7
+ clear
8
+ attach_base
9
+
7
10
  @type = 'peer::trickle'
8
11
  candidate = { 'sdpMid' => '..', 'sdpMLineIndex' => 1, 'candidate' => '..' }
9
- @options = { 'candidate' => candidate }.merge(@session_instance)
12
+ @options.merge!('candidate' => candidate)
10
13
  end
11
14
 
12
15
  describe '#start_transaction_handle', type: :request,
@@ -2,11 +2,14 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type trickles', broken: true do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type trickles' do
6
6
  before(:example) do
7
+ clear
8
+ attach_base
9
+
7
10
  @type = 'peer::trickle'
8
11
  candidate = { 'sdpMid' => '..', 'sdpMLineIndex' => 1, 'candidate' => '..' }
9
- @options = { 'candidate' => [candidate, candidate, candidate] }
12
+ @options.merge!('candidates' => [candidate, candidate, candidate])
10
13
  end
11
14
 
12
15
  describe '#start_transaction_handle', type: :request,
data/spec/spec_helper.rb CHANGED
@@ -53,18 +53,10 @@ RSpec.configure do |config|
53
53
  # Exclude request with tag broken
54
54
  config.filter_run_excluding broken: true
55
55
 
56
+ # Configure Initializer RRJ and create session with Janus Instance
56
57
  config.before(:example) do |example|
57
- @gateway = if example.metadata[:level]
58
- RubyRabbitmqJanus::RRJAdmin.new
59
- else
60
- RubyRabbitmqJanus::RRJ.new
61
- end
62
-
63
- ji = RubyRabbitmqJanus::Models::JanusInstance.first
64
- @response = nil
65
- @options = {}
66
- @session = { 'session_id' => ji.session }
67
- @instance = { 'instance' => ji.instance }
68
- @session_instance = @session.merge(@instance)
58
+ initializer_rrj(example.metadata)
59
+ clear
60
+ find_instance
69
61
  end
70
62
  end
@@ -17,7 +17,7 @@ end
17
17
  shared_examples 'transaction should match json empty' do
18
18
  let(:message) do
19
19
  @gateway.start_transaction(false, @session_instance) do |transaction|
20
- @response = transaction.publish_message(@type)
20
+ @response = transaction.publish_message(@type, @options)
21
21
  end
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ end
27
27
  shared_examples 'transaction should match json schema' do
28
28
  let(:message) do
29
29
  @gateway.start_transaction(true, @session_instance) do |transaction|
30
- @response = transaction.publish_message(@type)
30
+ @response = transaction.publish_message(@type, @options)
31
31
  end
32
32
  end
33
33
 
@@ -56,7 +56,7 @@ end
56
56
 
57
57
  shared_examples 'transaction admin should match json schema' do
58
58
  let(:message) do
59
- @gateway.start_transaction_admin do |transaction|
59
+ @gateway.start_transaction_admin(@instance) do |transaction|
60
60
  @response = transaction.publish_message(@type, @options)
61
61
  end
62
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_rabbitmq_janus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.pre.159
4
+ version: 2.2.0.pre.161
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-24 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler