rhoconnect 4.0.4 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +54 -5
- data/CREDITS +219 -219
- data/Gemfile +2 -2
- data/Gemfile.lock +68 -79
- data/Rakefile +1 -2
- data/bench/benchapp/spec/models/ruby/mock_adapter_spec.rb +17 -17
- data/bench/benchapp/spec/models/ruby/queue_mock_adapter_spec.rb +17 -17
- data/bench/benchapp/spec/spec_helper.rb +3 -3
- data/bench/blobapp/spec/models/ruby/blob_adapter_spec.rb +17 -17
- data/bench/blobapp/spec/spec_helper.rb +3 -3
- data/bench/lib/bench/runner.rb +1 -69
- data/bench/lib/bench.rb +18 -18
- data/bench/spec/mock_adapter_spec.rb +54 -55
- data/bench/spec/mock_client_spec.rb +47 -48
- data/bench/spec/result_spec.rb +41 -44
- data/bench/spec/utils_spec.rb +24 -25
- data/commands/generators/app.rb +7 -5
- data/commands/generators/controller.rb +7 -5
- data/commands/generators/model.rb +7 -5
- data/commands/generators/source.rb +7 -5
- data/commands/parser.rb +1 -1
- data/commands/redis/redis_download.rb +1 -1
- data/doc/async-jobs.txt +9 -9
- data/doc/supported-platforms.txt +0 -2
- data/generators/rhoconnect.rb +92 -212
- data/generators/templates/application/rcgemfile +3 -3
- data/generators/templates/application/spec/application_controller_spec.rb +14 -16
- data/generators/templates/application/spec/js_spec.rb +20 -20
- data/generators/templates/application/spec/spec_helper.rb +1 -1
- data/generators/templates/source/controllers/ruby/controller_spec.rb +18 -19
- data/generators/templates/source/models/ruby/model_spec.rb +17 -17
- data/install.sh +10 -21
- data/installer/unix-like/rho_connect_install_constants.rb +5 -5
- data/installer/unix-like/rho_connect_install_installers.rb +4 -4
- data/installer/utils/constants.rb +6 -6
- data/installer/utils/nix_install_test.rb +29 -29
- data/installer/utils/package_upload/repos.rake +16 -26
- data/js-adapters/node.rb +4 -4
- data/js-adapters/node_channel.rb +4 -8
- data/lib/rhoconnect/db_adapter.rb +13 -13
- data/lib/rhoconnect/handler/changes/engine.rb +1 -1
- data/lib/rhoconnect/jobs/bulk_data_job.rb +29 -29
- data/lib/rhoconnect/license.rb +7 -7
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +13 -13
- data/lib/rhoconnect/ping/apple.rb +4 -4
- data/lib/rhoconnect/server.rb +2 -2
- data/lib/rhoconnect/source.rb +2 -2
- data/lib/rhoconnect/store.rb +12 -6
- data/lib/rhoconnect/utilities.rb +2 -2
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect.rb +6 -4
- data/rhoconnect.gemspec +5 -6
- data/spec/api/api_helper.rb +1 -1
- data/spec/api/app/fast_delete_spec.rb +22 -22
- data/spec/api/app/fast_insert_spec.rb +23 -23
- data/spec/api/app/fast_update_spec.rb +63 -63
- data/spec/api/app/push_deletes_spec.rb +11 -13
- data/spec/api/app/push_objects_spec.rb +39 -39
- data/spec/api/client/client_get_db_doc_spec.rb +29 -29
- data/spec/api/client/client_set_db_doc_spec.rb +11 -11
- data/spec/api/client/get_client_params_spec.rb +29 -29
- data/spec/api/client/list_client_docs_spec.rb +32 -34
- data/spec/api/client/reset_spec.rb +30 -30
- data/spec/api/readstate/set_refresh_time_spec.rb +43 -43
- data/spec/api/source/get_source_params_spec.rb +32 -34
- data/spec/api/source/list_sources_spec.rb +13 -13
- data/spec/api/source/update_source_params_spec.rb +19 -19
- data/spec/api/store/get_db_doc_spec.rb +27 -27
- data/spec/api/store/set_db_doc_spec.rb +38 -38
- data/spec/api/system/adapter_spec.rb +27 -29
- data/spec/api/system/get_license_info_spec.rb +11 -11
- data/spec/api/system/login_spec.rb +37 -37
- data/spec/api/system/reset_spec.rb +15 -15
- data/spec/api/system/stats_spec.rb +70 -71
- data/spec/api/user/create_user_spec.rb +37 -37
- data/spec/api/user/delete_client_spec.rb +7 -7
- data/spec/api/user/delete_user_spec.rb +62 -62
- data/spec/api/user/list_clients_spec.rb +24 -24
- data/spec/api/user/list_source_docs_spec.rb +29 -29
- data/spec/api/user/list_users_spec.rb +22 -22
- data/spec/api/user/ping_spec.rb +18 -18
- data/spec/api/user/show_user_spec.rb +10 -10
- data/spec/api/user/update_user_spec.rb +43 -43
- data/spec/api/user/user_get_db_doc_spec.rb +12 -12
- data/spec/api/user/user_set_db_doc_spec.rb +37 -37
- data/spec/api_token_spec.rb +8 -8
- data/spec/app_spec.rb +18 -17
- data/spec/apps/jstestapp/settings/settings.yml +2 -0
- data/spec/async_spec.rb +9 -11
- data/spec/bulk_data/bulk_data_spec.rb +120 -120
- data/spec/cli/cli_spec.rb +50 -53
- data/spec/client_spec.rb +105 -105
- data/spec/client_sync_spec.rb +529 -528
- data/spec/controllers/js_base_spec.rb +147 -141
- data/spec/doc/doc_spec.rb +51 -52
- data/spec/document_spec.rb +58 -58
- data/spec/dynamic_adapter_spec.rb +33 -36
- data/spec/generator/generator_spec.rb +76 -42
- data/spec/jobs/bulk_data_job_spec.rb +101 -102
- data/spec/jobs/ping_job_spec.rb +176 -177
- data/spec/jobs/source_job_spec.rb +24 -25
- data/spec/license_spec.rb +54 -55
- data/spec/models/js_base_spec.rb +121 -120
- data/spec/perf/bulk_data_perf_spec.rb +23 -24
- data/spec/perf/perf_spec_helper.rb +7 -7
- data/spec/perf/store_perf_spec.rb +139 -140
- data/spec/ping/apple_spec.rb +65 -65
- data/spec/ping/gcm_spec.rb +83 -84
- data/spec/ping/rhoconnect_push_spec.rb +52 -53
- data/spec/predefined_adapters/rho_internal_bench_adapter_controller_js_spec.rb +100 -101
- data/spec/predefined_adapters/rho_internal_js_bench_adapter_js_spec.rb +29 -31
- data/spec/read_state_spec.rb +24 -25
- data/spec/rhoconnect_spec.rb +7 -7
- data/spec/server/server_spec.rb +664 -662
- data/spec/server/stats_spec.rb +12 -12
- data/spec/source_adapter_spec.rb +124 -125
- data/spec/source_spec.rb +148 -149
- data/spec/source_sync_spec.rb +736 -736
- data/spec/spec_helper.rb +4 -5
- data/spec/stats/record_spec.rb +22 -21
- data/spec/store_orm_spec.rb +48 -48
- data/spec/store_spec.rb +428 -426
- data/spec/support/shared_examples.rb +5 -7
- data/spec/sync_states_spec.rb +67 -67
- data/spec/test_methods_spec.rb +121 -123
- data/spec/testdata/10000-data.txt +0 -0
- data/spec/testdata/5000-data.txt +0 -0
- data/spec/user_spec.rb +102 -102
- data/tasks/redis.rake +3 -3
- metadata +154 -195
- data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
- data/bench/benchapp/tmp/restart.txt +0 -0
- data/bench/blobapp/settings/license.key.bak +0 -2
- data/bench/blobapp/tmp/restart.txt +0 -0
- data/bench/lib/testdata/1-data.txt +0 -0
- data/bench/lib/testdata/10-data.txt +0 -0
- data/bench/lib/testdata/2-data.txt +0 -0
- data/bench/lib/testdata/250-data.txt +0 -0
- data/bench/lib/testdata/5-blob_data.txt +0 -0
- data/bench/lib/testdata/5-data.txt +0 -0
- data/bench/lib/testdata/50-data.txt +0 -0
- data/bench/lib/testdata/500-data.txt +0 -0
- data/doc/protocol.html +0 -1993
- data/spec/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +0 -19
- data/spec/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +0 -15
- data/spec/coverage/rcov/assets/0.2.3/print.css +0 -12
- data/spec/coverage/rcov/assets/0.2.3/rcov.js +0 -42
- data/spec/coverage/rcov/assets/0.2.3/screen.css +0 -270
- data/spec/coverage/rcov/index.html +0 -88
- data/spec/generator/generator_spec_helper.rb +0 -9
@@ -1,45 +1,45 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiPushObjects" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
4
|
+
include_examples "ApiHelper"
|
5
|
+
|
6
|
+
it "should push new objects to rhoconnect's :md" do
|
7
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
8
|
+
post "/app/#{Rhoconnect::API_VERSION}/#{@s_fields[:name]}/push_objects",
|
9
|
+
{:user_id => @u.id, :objects => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
10
|
+
last_response.should be_ok
|
11
|
+
verify_doc_result(@s, {:md => data, :md_size=>'3'})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should push new objects to rhoconnect's :md with old api/source route and deprecation warning" do
|
15
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
16
|
+
post "/api/source/push_objects",
|
17
|
+
{:user_id => @u.id, :source_id => @s_fields[:name], :objects => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
18
|
+
last_response.should be_ok
|
19
|
+
last_response.headers["Warning"].index('deprecated').should_not == nil
|
20
|
+
verify_doc_result(@s, {:md => data, :md_size=>'3'})
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should push new objects to rhoconnect's :md with oldest api route and deprecation warning" do
|
24
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
25
|
+
post "/api/push_objects",
|
26
|
+
{:user_id => @u.id, :source_id => @s_fields[:name], :objects => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
27
|
+
last_response.should be_ok
|
28
|
+
last_response.headers["Warning"].index('deprecated').should_not == nil
|
29
|
+
verify_doc_result(@s, {:md => data, :md_size=>'3'})
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
post "/app/#{Rhoconnect::API_VERSION}/#{@s_fields[:name]}/push_objects",
|
40
|
-
{:user_id => @u.id, :objects => {'2'=>update}}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
41
|
-
last_response.should be_ok
|
42
|
-
verify_doc_result(@s, {:md => data, :md_size=>'3'})
|
32
|
+
it "should push updates to existing objects to rhoconnect's :md" do
|
33
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
34
|
+
update = {'price' => '0.99', 'new_field' => 'value'}
|
35
|
+
@s = Source.load(@s_fields[:name],@s_params)
|
36
|
+
set_doc_state(@s, {:md => data, :md_size => '3'})
|
37
|
+
update.each do |key,value|
|
38
|
+
data['2'][key] = value
|
43
39
|
end
|
44
|
-
|
40
|
+
post "/app/#{Rhoconnect::API_VERSION}/#{@s_fields[:name]}/push_objects",
|
41
|
+
{:user_id => @u.id, :objects => {'2'=>update}}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
42
|
+
last_response.should be_ok
|
43
|
+
verify_doc_result(@s, {:md => data, :md_size=>'3'})
|
44
|
+
end
|
45
45
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiClientGetDbDoc" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
4
|
+
include_examples "ApiHelper"
|
5
|
+
|
6
|
+
it "should get clients's db document by doc key and data" do
|
7
|
+
data = {'1' => {'foo' => 'bar'}}
|
8
|
+
Client.define_valid_doctypes([:myclientdoc])
|
9
|
+
dockey = 'myclientdoc'
|
10
|
+
post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
11
|
+
last_response.should be_ok
|
12
|
+
get "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
13
|
+
last_response.should be_ok
|
14
|
+
JSON.parse(last_response.body).should == data
|
15
|
+
Client.valid_doctypes.delete(dockey.to_sym)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should append data to the client's db document by doc name and data" do
|
19
|
+
data = {'1' => {'foo' => 'bar'}}
|
20
|
+
data2 = {'2' => {'foo1' => 'bar1'}}
|
21
|
+
data3 = data.merge(data2)
|
22
|
+
dockey = 'abc:abc'
|
23
|
+
Client.define_valid_doctypes([dockey])
|
24
|
+
post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
25
|
+
last_response.should be_ok
|
26
|
+
verify_doc_result(@c, dockey => data)
|
27
|
+
|
28
|
+
post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data2, :append => true}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
29
|
+
last_response.should be_ok
|
30
|
+
verify_doc_result(@c, dockey => data3)
|
31
|
+
Client.valid_doctypes.delete(dockey.to_sym)
|
32
|
+
end
|
33
33
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiClientSetDbDoc" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
4
|
+
include_examples "ApiHelper"
|
5
|
+
|
6
|
+
it "should set client's db document by doc key and data" do
|
7
|
+
data = {'1' => {'foo' => 'bar'}}
|
8
|
+
dockey = 'myclientdoc'
|
9
|
+
Client.define_valid_doctypes([dockey])
|
10
|
+
post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
11
|
+
last_response.should be_ok
|
12
|
+
verify_doc_result(@c, dockey => data)
|
13
|
+
Client.valid_doctypes.delete(dockey.to_sym)
|
14
|
+
end
|
15
15
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiGetClientParams" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
4
|
+
include_examples "ApiHelper"
|
5
|
+
|
6
|
+
it "should list client attributes" do
|
7
|
+
get "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
8
|
+
res = JSON.parse(last_response.body)
|
9
|
+
res.delete_if { |attrib| attrib['name'] == 'rho__id' || attrib['name'] == 'last_sync'}
|
10
|
+
res.sort{|x,y| x['name']<=>y['name']}.should == [
|
11
|
+
{"name"=>"device_type", "value"=>"Apple", "type"=>"string"},
|
12
|
+
{"name"=>"device_pin", "value"=>"abcd", "type"=>"string"},
|
13
|
+
{"name"=>"device_port", "value"=>"3333", "type"=>"string"},
|
14
|
+
{"name"=>"device_push_type", "type"=>"string", "value"=>nil},
|
15
|
+
{"name"=>"user_id", "value"=>"testuser", "type"=>"string"},
|
16
|
+
{"name"=>"phone_id", "value"=>nil, "type"=>"string"},
|
17
|
+
{"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should list client attributes with old route and deprecation warning" do
|
21
|
+
post "/api/get_client_params", {:api_token => @api_token, :client_id =>@c.id}
|
22
|
+
res = JSON.parse(last_response.body)
|
23
|
+
res.delete_if { |attrib| attrib['name'] == 'rho__id' || attrib['name'] == 'last_sync'}
|
24
|
+
res.sort{|x,y| x['name']<=>y['name']}.should == [
|
25
|
+
{"name"=>"device_type", "value"=>"Apple", "type"=>"string"},
|
26
|
+
{"name"=>"device_pin", "value"=>"abcd", "type"=>"string"},
|
27
|
+
{"name"=>"device_port", "value"=>"3333", "type"=>"string"},
|
28
|
+
{"name"=>"device_push_type", "type"=>"string", "value"=>nil},
|
29
|
+
{"name"=>"user_id", "value"=>"testuser", "type"=>"string"},
|
30
|
+
{"name"=>"phone_id", "value"=>nil, "type"=>"string"},
|
31
|
+
{"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
|
32
|
+
end
|
33
33
|
end
|
@@ -1,42 +1,40 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiListClientDocs" do
|
4
|
-
|
5
|
-
it "should list client documents" do
|
6
|
-
source_id = "SimpleAdapter"
|
4
|
+
include_examples "ApiHelper"
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
6
|
+
it "should list client documents" do
|
7
|
+
source_id = "SimpleAdapter"
|
8
|
+
Client.define_valid_doctypes(['mycustomdoc'])
|
9
|
+
get "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{source_id}/docnames", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
10
|
+
JSON.parse(last_response.body).should == {
|
11
|
+
"cd"=>"client:application:testuser:#{@c.id}:#{source_id}:cd",
|
12
|
+
"cd_size"=>"client:application:testuser:#{@c.id}:#{source_id}:cd_size",
|
13
|
+
"page"=>"client:application:testuser:#{@c.id}:#{source_id}:page",
|
14
|
+
"delete_page"=>"client:application:testuser:#{@c.id}:#{source_id}:delete_page",
|
15
|
+
"create_links"=>"client:application:testuser:#{@c.id}:#{source_id}:create_links",
|
16
|
+
"create_links_page"=>"client:application:testuser:#{@c.id}:#{source_id}:create_links_page",
|
17
|
+
"metadata_page"=>"client:application:testuser:#{@c.id}:#{source_id}:metadata_page",
|
18
|
+
"total_count_page"=>"client:application:testuser:#{@c.id}:#{source_id}:total_count_page",
|
19
|
+
"page_token"=>"client:application:testuser:#{@c.id}:#{source_id}:page_token",
|
20
|
+
"schema_sha1"=>"client:application:testuser:#{@c.id}:#{source_id}:schema_sha1",
|
21
|
+
"schema_page"=>"client:application:testuser:#{@c.id}:#{source_id}:schema_page",
|
22
|
+
"metadata_sha1"=>"client:application:testuser:#{@c.id}:#{source_id}:metadata_sha1",
|
23
|
+
"search"=>"client:application:testuser:#{@c.id}:#{source_id}:search",
|
24
|
+
"search_token"=>"client:application:testuser:#{@c.id}:#{source_id}:search_token",
|
25
|
+
"search_page"=>"client:application:testuser:#{@c.id}:#{source_id}:search_page",
|
26
|
+
"search_errors"=>"client:application:testuser:#{@c.id}:#{source_id}:search_errors",
|
27
|
+
"create_errors"=>"client:application:testuser:#{@c.id}:#{source_id}:create_errors",
|
28
|
+
"create_errors_page"=>"client:application:testuser:#{@c.id}:#{source_id}:create_errors_page",
|
29
|
+
"update_errors"=>"client:application:testuser:#{@c.id}:#{source_id}:update_errors",
|
30
|
+
"update_errors_page"=>"client:application:testuser:#{@c.id}:#{source_id}:update_errors_page",
|
31
|
+
"update_rollback"=>"client:application:testuser:#{@c.id}:#{source_id}:update_rollback",
|
32
|
+
"update_rollback_page"=>"client:application:testuser:#{@c.id}:#{source_id}:update_rollback_page",
|
33
|
+
"delete_errors"=>"client:application:testuser:#{@c.id}:#{source_id}:delete_errors",
|
34
|
+
"delete_errors_page"=>"client:application:testuser:#{@c.id}:#{source_id}:delete_errors_page",
|
35
|
+
"mycustomdoc"=>"client:application:testuser:#{@c.id}:#{source_id}:mycustomdoc"}
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
Client.valid_doctypes.delete('mycustomdoc'.to_sym)
|
39
|
-
end
|
37
|
+
Client.valid_doctypes.delete('mycustomdoc'.to_sym)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
@@ -1,36 +1,36 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiClientReset" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
do_post "/rc/#{Rhoconnect::API_VERSION}/app/login", "login" => @u.login, "password" => 'testpass'
|
7
|
-
end
|
4
|
+
include_examples "ApiHelper"
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
6
|
+
before(:each) do
|
7
|
+
do_post "/rc/#{Rhoconnect::API_VERSION}/app/login", "login" => @u.login, "password" => 'testpass'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should handle client reset" do
|
11
|
+
set_doc_state(@c, :cd => @data)
|
12
|
+
post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/reset"
|
13
|
+
last_response.should be_ok
|
14
|
+
verify_doc_result(@c, :cd => {})
|
15
|
+
Client.load(@c.id,{:source_name => @s.name}).should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should handle client reset on individual source adapters" do
|
19
|
+
@c.source_name = 'SampleAdapter'
|
20
|
+
set_doc_state(@c, :cd => @data)
|
21
|
+
verify_doc_result(@c, :cd => @data)
|
22
|
+
|
23
|
+
@c.source_name = 'SimpleAdapter'
|
24
|
+
set_doc_state(@c, :cd => @data)
|
25
|
+
verify_doc_result(@c, :cd => @data)
|
26
|
+
|
27
|
+
sources = [{'name'=>'SimpleAdapter'}]
|
28
|
+
do_post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/reset", {:sources => sources}
|
29
|
+
last_response.should be_ok
|
30
|
+
|
31
|
+
@c.source_name = 'SampleAdapter'
|
32
|
+
verify_doc_result(@c, :cd => @data)
|
33
|
+
@c.source_name = 'SimpleAdapter'
|
34
|
+
verify_doc_result(@c, :cd => {})
|
35
35
|
end
|
36
36
|
end
|
@@ -1,49 +1,49 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiSetRefreshTime" do
|
4
|
-
|
5
|
-
it "should set refresh time to 100s from 'now'" do
|
6
|
-
before = Time.now.to_i
|
7
|
-
put "/rc/#{Rhoconnect::API_VERSION}/readstate/users/#{@u_fields[:login]}/sources/#{@s_fields[:name]}",
|
8
|
-
{:refresh_time => 100}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
9
|
-
after = Time.now.to_i
|
10
|
-
last_response.should be_ok
|
11
|
-
@s = Source.load(@s.id,@s_params)
|
12
|
-
@s.read_state.refresh_time.should >= before + 100
|
13
|
-
@s.read_state.refresh_time.should <= after + 100
|
14
|
-
end
|
4
|
+
include_examples "ApiHelper"
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
6
|
+
it "should set refresh time to 100s from 'now'" do
|
7
|
+
before = Time.now.to_i
|
8
|
+
put "/rc/#{Rhoconnect::API_VERSION}/readstate/users/#{@u_fields[:login]}/sources/#{@s_fields[:name]}",
|
9
|
+
{:refresh_time => 100}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
10
|
+
after = Time.now.to_i
|
11
|
+
last_response.should be_ok
|
12
|
+
@s = Source.load(@s.id,@s_params)
|
13
|
+
@s.read_state.refresh_time.should >= before + 100
|
14
|
+
@s.read_state.refresh_time.should <= after + 100
|
15
|
+
end
|
25
16
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
@
|
46
|
-
|
47
|
-
|
48
|
-
|
17
|
+
it "should set refresh time to 'now' if no refresh_time provided" do
|
18
|
+
before = Time.now.to_i
|
19
|
+
put "/rc/#{Rhoconnect::API_VERSION}/readstate/users/#{@u_fields[:login]}/sources/#{@s_fields[:name]}", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
20
|
+
after = Time.now.to_i
|
21
|
+
last_response.should be_ok
|
22
|
+
@s = Source.load(@s.id,@s_params)
|
23
|
+
@s.read_state.refresh_time.should >= before
|
24
|
+
@s.read_state.refresh_time.should <= after
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should set poll interval" do
|
28
|
+
put "/rc/#{Rhoconnect::API_VERSION}/readstate/users/#{@u_fields[:login]}/sources/#{@s_fields[:name]}", {:poll_interval => 100}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
29
|
+
last_response.should be_ok
|
30
|
+
@s = Source.load(@s.id,@s_params)
|
31
|
+
@s.poll_interval.should == 100
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should should not set nil poll interval with old route and deprecation warning" do
|
35
|
+
post "/api/set_refresh_time", :api_token => @api_token,
|
36
|
+
:source_name => @s_fields[:name], :user_name => @u_fields[:login], :poll_interval => nil
|
37
|
+
last_response.should be_ok
|
38
|
+
last_response.headers["Warning"].index('deprecated').should_not == nil
|
39
|
+
@s = Source.load(@s.id,@s_params)
|
40
|
+
@s.poll_interval.should == 300
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should should not set nil poll interval" do
|
44
|
+
put "/rc/#{Rhoconnect::API_VERSION}/readstate/users/#{@u_fields[:login]}/sources/#{@s_fields[:name]}", {:poll_interval => nil}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
45
|
+
last_response.should be_ok
|
46
|
+
@s = Source.load(@s.id,@s_params)
|
47
|
+
@s.poll_interval.should == 300
|
48
|
+
end
|
49
49
|
end
|
@@ -1,41 +1,39 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','api_helper')
|
2
2
|
|
3
3
|
describe "RhoconnectApiGetSourceParams" do
|
4
|
+
include_examples "ApiHelper"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
item['value'].should == expect['value']
|
37
|
-
item['type'].should == expect['type']
|
38
|
-
end
|
6
|
+
it "should list source attributes" do
|
7
|
+
source_id = "SampleAdapter"
|
8
|
+
get "/rc/#{Rhoconnect::API_VERSION}/sources/#{source_id}", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
9
|
+
result = JSON.parse(last_response.body).sort {|x,y| y["name"] <=> x["name"] }
|
10
|
+
expected = [
|
11
|
+
{"name"=>"rho__id", "value"=>"SampleAdapter", "type"=>"string"},
|
12
|
+
{"name"=>"source_id", "value"=>nil, "type"=>"integer"},
|
13
|
+
{"name"=>"name", "value"=>"SampleAdapter", "type"=>"string"},
|
14
|
+
{"name"=>"url", "value"=>"http://example.com", "type"=>"string"},
|
15
|
+
{"name"=>"login", "value"=>"testuser", "type"=>"string"},
|
16
|
+
{"name"=>"password", "value"=>"testpass", "type"=>"string"},
|
17
|
+
{"name"=>"priority", "value"=>1, "type"=>"integer"},
|
18
|
+
{"name"=>"callback_url", "value"=>nil, "type"=>"string"},
|
19
|
+
{"name"=>"poll_interval", "value"=>300, "type"=>"integer"},
|
20
|
+
{"name"=>"retry_limit", "type"=>"integer", "value"=>0},
|
21
|
+
{"name"=>"simulate_time", "value"=>0, "type"=>"integer"},
|
22
|
+
{"name"=>"partition_type", "value"=>"user", "type"=>"string"},
|
23
|
+
{"name"=>"push_notify", "value"=>"false", "type"=>"string"},
|
24
|
+
{"name"=>"sync_type", "value"=>"incremental", "type"=>"string"},
|
25
|
+
{"name"=>"belongs_to", "type"=>"string", "value"=>nil},
|
26
|
+
{"name"=>"has_many", "type"=>"string", "value"=>"FixedSchemaAdapter,brand"},
|
27
|
+
{"name"=>"id", "value"=>"SampleAdapter", "type"=>"string"},
|
28
|
+
{"name"=>"queue", "value"=>nil, "type"=>"string"},
|
29
|
+
{"name"=>"query_queue", "value"=>nil, "type"=>"string"},
|
30
|
+
{"name"=>"pass_through", "value"=>nil, "type"=>"string"},
|
31
|
+
{"name"=>"cud_queue", "value"=>nil, "type"=>"string"}].sort {|x,y| y["name"] <=> x["name"] }
|
32
|
+
result.each_with_index do |item,i|
|
33
|
+
expect = expected[i]
|
34
|
+
item['name'].should == expect['name']
|
35
|
+
item['value'].should == expect['value']
|
36
|
+
item['type'].should == expect['type']
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|