rhoconnect 5.5.18 → 7.4.1
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 +4 -4
- data/Gemfile +18 -11
- data/Gemfile.lock +178 -100
- data/README.md +2 -0
- data/Rakefile +4 -3
- data/commands/dtach/dtach_install.rb +29 -24
- data/commands/rhoconnect/start.rb +5 -4
- data/generators/templates/application/rcgemfile +1 -1
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +1 -1
- data/lib/rhoconnect/ping/fcm.rb +74 -0
- data/lib/rhoconnect/ping.rb +1 -1
- data/lib/rhoconnect/store.rb +3 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/rhoconnect.gemspec +15 -11
- data/spec/api/client/get_client_params_spec.rb +4 -0
- data/spec/apps/rhotestapp/models/ruby/sample_adapter.rb +1 -1
- data/spec/client_sync_spec.rb +7 -7
- data/spec/dynamic_adapter_spec.rb +13 -13
- data/spec/generator/generator_spec.rb +7 -7
- data/spec/jobs/ping_job_spec.rb +229 -105
- data/spec/perf/perf_spec_helper.rb +5 -5
- data/spec/ping/apple_spec.rb +24 -26
- data/spec/ping/fcm_spec.rb +116 -0
- data/spec/ping/gcm_spec.rb +27 -29
- data/spec/ping/rhoconnect_push_spec.rb +13 -13
- data/spec/rhoconnect_spec.rb +2 -2
- data/spec/server/cors_spec.rb +22 -22
- data/spec/server/server_spec.rb +308 -310
- data/spec/server/stats_spec.rb +7 -7
- data/spec/server/x_domain_session_wrapper_spec.rb +40 -40
- data/spec/source_adapter_spec.rb +2 -2
- data/spec/source_sync_spec.rb +4 -4
- data/spec/spec_helper.rb +8 -8
- data/spec/stats/record_spec.rb +7 -7
- data/spec/store_orm_spec.rb +97 -94
- data/spec/store_spec.rb +23 -23
- data/spec/user_spec.rb +3 -3
- metadata +98 -27
data/lib/rhoconnect/ping.rb
CHANGED
data/lib/rhoconnect/store.rb
CHANGED
@@ -879,7 +879,7 @@ module Rhoconnect
|
|
879
879
|
Rhoconnect.redis_url = url
|
880
880
|
ConnectionPool::Wrapper.new(:size => Rhoconnect.connection_pool_size,
|
881
881
|
:timeout => Rhoconnect.connection_pool_timeout) do
|
882
|
-
Redis.
|
882
|
+
Redis.new(:url => url, :timeout => Rhoconnect.redis_timeout, :thread_safe => true)
|
883
883
|
end
|
884
884
|
elsif server and server.is_a?(String)
|
885
885
|
Rhoconnect.redis_url = "redis://#{server}"
|
@@ -887,7 +887,7 @@ module Rhoconnect
|
|
887
887
|
ConnectionPool::Wrapper.new(:size => Rhoconnect.connection_pool_size,
|
888
888
|
:timeout => Rhoconnect.connection_pool_timeout) do
|
889
889
|
host = '127.0.0.1' if host == 'localhost'
|
890
|
-
Redis.
|
890
|
+
Redis.new(
|
891
891
|
:thread_safe => true,
|
892
892
|
:host => host,
|
893
893
|
:port => port,
|
@@ -901,7 +901,7 @@ module Rhoconnect
|
|
901
901
|
else
|
902
902
|
Rhoconnect.redis_url = "redis://localhost:6379"
|
903
903
|
ConnectionPool::Wrapper.new(:size => 5, :timeout => 30) do
|
904
|
-
Redis.
|
904
|
+
Redis.new(:timeout => 30, :thread_safe => true)
|
905
905
|
end
|
906
906
|
end
|
907
907
|
end
|
data/lib/rhoconnect/version.rb
CHANGED
data/rhoconnect.gemspec
CHANGED
@@ -39,15 +39,19 @@ Gem::Specification.new do |s|
|
|
39
39
|
'README.md'
|
40
40
|
]
|
41
41
|
|
42
|
-
s.add_dependency('bundler', '~> 1.
|
43
|
-
s.add_dependency('rack', '~>
|
44
|
-
s.add_dependency('sinatra', '~>
|
45
|
-
s.add_dependency('rake', '~>
|
46
|
-
s.add_dependency('json', '
|
47
|
-
s.add_dependency('rubyzip', '
|
48
|
-
s.add_dependency('connection_pool', '~>
|
49
|
-
s.add_dependency('redis', '
|
50
|
-
s.add_dependency('
|
51
|
-
s.add_dependency('
|
52
|
-
s.add_dependency('
|
42
|
+
s.add_dependency('bundler', '~> 1.17.3')
|
43
|
+
s.add_dependency('rack', '~> 2.0.6')
|
44
|
+
s.add_dependency('sinatra', '~> 2.0.5')
|
45
|
+
s.add_dependency('rake', '~> 12.3.2')
|
46
|
+
s.add_dependency('json', '>= 1.8', '< 2.0')
|
47
|
+
s.add_dependency('rubyzip', '>= 1.2.2', '< 2.1.0')
|
48
|
+
s.add_dependency('connection_pool', '~> 2.2.2')
|
49
|
+
s.add_dependency('redis-namespace', '~> 1.6.0')
|
50
|
+
s.add_dependency('redis', '~> 4.1.0')
|
51
|
+
s.add_dependency('resque', '>= 2.0.0')
|
52
|
+
s.add_dependency('rest-client', '~> 2.0.2')
|
53
|
+
s.add_dependency('thor', '~> 0.20.3')
|
54
|
+
s.add_dependency('signet', '~> 0.11.0')
|
55
|
+
s.add_dependency('google-api-client', '~> 0.31.0')
|
56
|
+
s.add_dependency('google-api-fcm', '~> 0.1.7')
|
53
57
|
end
|
@@ -12,6 +12,8 @@ describe "RhoconnectApiGetClientParams" do
|
|
12
12
|
{"name"=>"device_pin", "value"=>"abcd", "type"=>"string"},
|
13
13
|
{"name"=>"device_port", "value"=>"3333", "type"=>"string"},
|
14
14
|
{"name"=>"device_push_type", "type"=>"string", "value"=>nil},
|
15
|
+
{"name"=>"device_app_id", "type"=>"string", "value"=>nil},
|
16
|
+
{"name"=>"device_app_version", "type"=>"string", "value"=>nil},
|
15
17
|
{"name"=>"user_id", "value"=>"testuser", "type"=>"string"},
|
16
18
|
{"name"=>"phone_id", "value"=>nil, "type"=>"string"},
|
17
19
|
{"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
|
@@ -26,6 +28,8 @@ describe "RhoconnectApiGetClientParams" do
|
|
26
28
|
{"name"=>"device_pin", "value"=>"abcd", "type"=>"string"},
|
27
29
|
{"name"=>"device_port", "value"=>"3333", "type"=>"string"},
|
28
30
|
{"name"=>"device_push_type", "type"=>"string", "value"=>nil},
|
31
|
+
{"name"=>"device_app_id", "type"=>"string", "value"=>nil},
|
32
|
+
{"name"=>"device_app_version", "type"=>"string", "value"=>nil},
|
29
33
|
{"name"=>"user_id", "value"=>"testuser", "type"=>"string"},
|
30
34
|
{"name"=>"phone_id", "value"=>nil, "type"=>"string"},
|
31
35
|
{"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
|
@@ -40,7 +40,7 @@ class SampleAdapter < SourceAdapter
|
|
40
40
|
invalid_meta[index] ||= {}
|
41
41
|
invalid_meta[index][source_id] ||= {}
|
42
42
|
invalid_meta[index][source_id][objindex] ||= {}
|
43
|
-
invalid_meta[index][source_id][objindex][:error] = "Error during #{operation}: object
|
43
|
+
invalid_meta[index][source_id][objindex][:error] = "Error during #{operation}: object conflict detected"
|
44
44
|
end
|
45
45
|
if objvalue['duplicate_of_cid']
|
46
46
|
invalid_meta[index] ||= {}
|
data/spec/client_sync_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe "ClientSync" do
|
|
12
12
|
@model = Rhoconnect::Model::Base.create(@s2)
|
13
13
|
@cs1 = Rhoconnect::Handler::Changes::Runner.new(['create'],@model,@c,lv,params)
|
14
14
|
stub_request(:post, "http://test.com/rhoconnect/authenticate")
|
15
|
-
stub_request(:post, "http://test.com/rhoconnect/create").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5})
|
15
|
+
stub_request(:post, "http://test.com/rhoconnect/create").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}.to_json)
|
16
16
|
@cs1.run
|
17
17
|
verify_source_queue_data(@s2, {:create => [],
|
18
18
|
:update => [],
|
@@ -484,7 +484,7 @@ describe "ClientSync" do
|
|
484
484
|
@sync_handler.client.get_data(:cd).should == @data
|
485
485
|
end
|
486
486
|
|
487
|
-
|
487
|
+
xit "should resend page if page exists and no token provided" do
|
488
488
|
expected = {'1'=>@product1}
|
489
489
|
set_test_data('test_db_storage',{'1'=>@product1,'2'=>@product2,'4'=>@product4})
|
490
490
|
params = {'name' => 'iPhone'}
|
@@ -492,10 +492,10 @@ describe "ClientSync" do
|
|
492
492
|
@sync_handler.run
|
493
493
|
token = @c.get_value(:page_token)
|
494
494
|
@sync_handler.run.should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>token},
|
495
|
-
|
495
|
+
{"count"=>1}, {"progress_count"=>0},{"total_count"=>1},{'insert' => expected}]
|
496
496
|
@sync_handler.params[:token] = token
|
497
497
|
@sync_handler.run.should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>""},
|
498
|
-
|
498
|
+
{"count"=>0}, {"progress_count"=>0}, {"total_count"=>1}, {}]
|
499
499
|
@sync_handler.client.get_data(:page).should == {}
|
500
500
|
@c.get_value(:page_token).should be_nil
|
501
501
|
end
|
@@ -514,7 +514,7 @@ describe "ClientSync" do
|
|
514
514
|
end
|
515
515
|
end
|
516
516
|
|
517
|
-
|
517
|
+
xit "should send metadata with resend page" do
|
518
518
|
expected = {'1'=>@product1}
|
519
519
|
set_state('test_db_storage' => expected)
|
520
520
|
mock_metadata_method([SampleAdapter]) do
|
@@ -563,7 +563,7 @@ describe "ClientSync" do
|
|
563
563
|
end
|
564
564
|
end
|
565
565
|
|
566
|
-
|
566
|
+
xit "should re-send schema-changed if no token sent" do
|
567
567
|
mock_schema_method([SampleAdapter]) do
|
568
568
|
@c.put_value(:schema_sha1,'foo')
|
569
569
|
result = @sync_handler.run
|
@@ -629,4 +629,4 @@ describe "ClientSync" do
|
|
629
629
|
{"#{operation}-error"=>{"#{ERROR}-error"=>{"message"=>msg},ERROR=>op_data[operation][ERROR]}}]
|
630
630
|
end
|
631
631
|
end
|
632
|
-
end
|
632
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),'spec_helper')
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
2
|
|
3
3
|
describe "Rhoconnect::Model::DynamicAdapterModel" do
|
4
4
|
include_examples "SharedRhoconnectHelper", :rhoconnect_data => true
|
@@ -6,33 +6,33 @@ describe "Rhoconnect::Model::DynamicAdapterModel" do
|
|
6
6
|
it "should return login when backend service defined" do
|
7
7
|
stub_request(:post, "http://test.com/rhoconnect/authenticate").to_return(:body => "lucas")
|
8
8
|
Rhoconnect.appserver = 'http://test.com'
|
9
|
-
Rhoconnect::Model::DynamicAdapterModel.authenticate('lucas','').should == 'lucas'
|
9
|
+
Rhoconnect::Model::DynamicAdapterModel.authenticate('lucas', '').should == 'lucas'
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should query dynamic adapter service" do
|
13
|
-
data = {'1'
|
13
|
+
data = {'1' => @product1}
|
14
14
|
stub_request(:post, "http://test.com/rhoconnect/query").with(:headers => {'Content-Type' => 'application/json'}).to_return(:status => 200, :body => data.to_json)
|
15
|
-
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2,nil,'http://test.com')
|
15
|
+
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2, nil, 'http://test.com')
|
16
16
|
da.query.should == data
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should create new object using dynamic adapter" do
|
20
|
-
stub_request(:post, "http://test.com/rhoconnect/create").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5})
|
21
|
-
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2,nil,'http://test.com')
|
22
|
-
da.create(@product1).should == {:id => 5}
|
20
|
+
stub_request(:post, "http://test.com/rhoconnect/create").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}.to_json)
|
21
|
+
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2, nil, 'http://test.com')
|
22
|
+
da.create(@product1).should == {:id => 5}.to_json
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should update object using dynamic adapter" do
|
26
26
|
data = {'id' => 2}
|
27
|
-
stub_request(:post, "http://test.com/rhoconnect/update").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5})
|
28
|
-
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2,nil,'http://test.com')
|
29
|
-
da.update(data).should == {:id => 5}
|
27
|
+
stub_request(:post, "http://test.com/rhoconnect/update").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}.to_json)
|
28
|
+
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2, nil, 'http://test.com')
|
29
|
+
da.update(data).should == {:id => 5}.to_json
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should delete object using dynamic adapter" do
|
33
33
|
data = {'id' => 2}
|
34
|
-
stub_request(:post, "http://test.com/rhoconnect/delete").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5})
|
35
|
-
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2,nil,'http://test.com')
|
36
|
-
da.delete(data).should == {:id => 5}
|
34
|
+
stub_request(:post, "http://test.com/rhoconnect/delete").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}.to_json)
|
35
|
+
da = Rhoconnect::Model::DynamicAdapterModel.new(@s2, nil, 'http://test.com')
|
36
|
+
da.delete(data).should == {:id => 5}.to_json
|
37
37
|
end
|
38
38
|
end
|
@@ -37,7 +37,7 @@ describe "Generator" do
|
|
37
37
|
'settings/settings.yml',
|
38
38
|
'spec/spec_helper.rb'
|
39
39
|
].each do |template|
|
40
|
-
File.exist?("/tmp/#{appname}/#{template}").should
|
40
|
+
File.exist?("/tmp/#{appname}/#{template}").should be true
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -61,7 +61,7 @@ describe "Generator" do
|
|
61
61
|
'public',
|
62
62
|
'settings/settings.yml'
|
63
63
|
].each do |template|
|
64
|
-
File.exist?("/tmp/#{appname}/#{template}").should
|
64
|
+
File.exist?("/tmp/#{appname}/#{template}").should be true
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -85,14 +85,14 @@ describe "Generator" do
|
|
85
85
|
Dir.chdir appname do
|
86
86
|
Rhoconnect::SourceGenerator.start([source])
|
87
87
|
|
88
|
-
File.exist?("/tmp/#{appname}/models/ruby/#{source}.rb").should
|
89
|
-
File.exist?("/tmp/#{appname}/controllers/ruby/#{source}_controller.rb").should
|
90
|
-
File.exist?("/tmp/#{appname}/spec/models/ruby/#{source}_spec.rb").should
|
91
|
-
File.exist?("/tmp/#{appname}/spec/controllers/ruby/#{source}_controller_spec.rb").should
|
88
|
+
File.exist?("/tmp/#{appname}/models/ruby/#{source}.rb").should be true
|
89
|
+
File.exist?("/tmp/#{appname}/controllers/ruby/#{source}_controller.rb").should be true
|
90
|
+
File.exist?("/tmp/#{appname}/spec/models/ruby/#{source}_spec.rb").should be true
|
91
|
+
File.exist?("/tmp/#{appname}/spec/controllers/ruby/#{source}_controller_spec.rb").should be true
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
end
|
98
|
+
end
|