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,15 +1,13 @@
|
|
1
1
|
# When shared examples are called as
|
2
|
-
#
|
2
|
+
# include_examples "SharedRhoconnectHelper", :rhoconnect_data => false
|
3
3
|
# then :rhoconnect_data group (@product1, ..., @data) skipped.
|
4
4
|
# To enable this group call examples as
|
5
|
-
#
|
6
|
-
|
5
|
+
# include_examples "SharedRhoconnectHelper", :rhoconnect_data => true
|
6
|
+
shared_examples "SharedRhoconnectHelper" do |params|
|
7
7
|
include TestHelpers
|
8
|
-
# "TestappHelper"
|
9
8
|
let(:test_app_name) { 'application' }
|
10
9
|
|
11
10
|
before(:each) do
|
12
|
-
# "RhoconnectHelper"
|
13
11
|
Store.create
|
14
12
|
Store.flush_all
|
15
13
|
Rhoconnect.use_node = false
|
@@ -82,7 +80,7 @@ shared_examples_for "SharedRhoconnectHelper" do |params|
|
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
85
|
-
|
83
|
+
shared_examples "BenchSpecHelper" do
|
86
84
|
before(:each) do
|
87
85
|
Store.create
|
88
86
|
Store.flush_all
|
@@ -96,7 +94,7 @@ shared_examples_for "BenchSpecHelper" do
|
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
99
|
-
|
97
|
+
shared_examples "ApiHelper" do
|
100
98
|
include Rack::Test::Methods
|
101
99
|
include Rhoconnect
|
102
100
|
include TestHelpers
|
data/spec/sync_states_spec.rb
CHANGED
@@ -1,78 +1,78 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'spec_helper')
|
2
2
|
|
3
3
|
describe "Sync Server States" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
include_examples "SharedRhoconnectHelper", :rhoconnect_data => true
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@s = Source.load(@s_fields[:name],@s_params)
|
8
|
+
@model = Rhoconnect::Model::Base.create(@s)
|
9
|
+
rhcud = lambda { @model.send(params[:operation].to_sym, params["#{params[:operation]}_object".to_sym]) }
|
10
|
+
@sscud = Rhoconnect::Handler::Changes::Runner.new(['create', 'update', 'delete'], @model, @c, rhcud, {})
|
11
|
+
rh = lambda { @model.query(params[:query]) }
|
12
|
+
@ssq = Rhoconnect::Handler::Query::Runner.new(@model, @c, rh, {})
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
+
describe "client creates objects" do
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
it "should create object and create link for client" do
|
18
|
+
@product1['link'] = 'temp1'
|
19
|
+
params = {'create'=>{'1'=>@product1}}
|
20
|
+
backend_data = {'backend_id'=>@product1}
|
21
|
+
set_doc_state(@sscud.client, :cd_size => 0)
|
22
|
+
set_doc_state(@s, :md_size => 0)
|
23
|
+
@s.read_state.refresh_time = Time.now.to_i + 3600
|
24
|
+
@sscud.params = params
|
25
|
+
@sscud.run
|
26
|
+
verify_source_queue_data(@s, :create => [])
|
27
|
+
verify_doc_result(@c, {:cd_size => "1",
|
28
|
+
:cd => backend_data,
|
29
|
+
:create_links => {'1'=>{'l'=>'backend_id'}}})
|
30
|
+
verify_doc_result(@s, {:md_size => "1",
|
31
|
+
:md => backend_data})
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
34
|
+
it "should create object and send link to client" do
|
35
|
+
@product1['link'] = 'temp1'
|
36
|
+
params = {'create'=>{'1'=>@product1}}
|
37
|
+
backend_data = {'backend_id'=>@product1}
|
38
|
+
set_doc_state(@sscud.client, :cd_size => 0)
|
39
|
+
set_doc_state(@s, :md_size => 0)
|
40
|
+
@s.read_state.refresh_time = Time.now.to_i + 3600
|
41
|
+
@sscud.params = params
|
42
|
+
@sscud.run
|
43
|
+
verify_source_queue_data(@s, :create => [])
|
44
|
+
verify_doc_result(@c, {:cd_size => "1",
|
45
|
+
:cd => backend_data,
|
46
|
+
:create_links => {'1'=>{'l'=>'backend_id'}}})
|
47
|
+
verify_doc_result(@s, {:md_size => "1",
|
48
|
+
:md => backend_data})
|
49
|
+
res = @ssq.run
|
50
|
+
res.should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>res[1]['token']},
|
51
|
+
{"count"=>0}, {"progress_count"=>0}, {"total_count"=>1},
|
52
|
+
{"links"=> {'1'=>{'l'=>'backend_id'}}}]
|
52
53
|
|
53
|
-
end
|
54
54
|
end
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
57
|
+
describe "client deletes objects" do
|
58
|
+
it "should delete object" do
|
59
|
+
params = {'delete'=>{'1'=>@product1}}
|
60
|
+
data = {'1'=>@product1,'2'=>@product2,'3'=>@product3}
|
61
|
+
expected = {'2'=>@product2,'3'=>@product3}
|
62
|
+
set_doc_state(@sscud.client, {:cd => data,
|
63
|
+
:cd_size => data.size})
|
64
|
+
set_doc_state(@s, {:md => data,
|
65
|
+
:md_size => data.size})
|
66
|
+
@s.read_state.refresh_time = Time.now.to_i + 3600
|
67
|
+
@sscud.params = params
|
68
|
+
@sscud.run
|
69
|
+
verify_source_queue_data(@s, :delete => [])
|
70
|
+
verify_doc_result(@sscud.client, {:cd => expected,
|
71
|
+
:delete_page => {},
|
72
|
+
:cd_size => "2"})
|
73
|
+
verify_doc_result(@s, {:md => expected,
|
74
|
+
:md_size => "2"})
|
75
|
+
verify_result('test_delete_storage' => {'1'=>@product1})
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|
78
78
|
end
|
data/spec/test_methods_spec.rb
CHANGED
@@ -4,145 +4,143 @@ require File.join(File.dirname(__FILE__),'spec_helper')
|
|
4
4
|
describe "TestMethods" do
|
5
5
|
# The module we're testing
|
6
6
|
include Rhoconnect::TestMethods
|
7
|
+
include_examples "SharedRhoconnectHelper", :rhoconnect_data => true
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
before(:each) do
|
10
|
+
Rhoconnect.bootstrap(get_testapp_path)
|
11
|
+
setup_test_for(SampleAdapter,'user1')
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
expected = {'1'=>@product1,'2'=>@product2}
|
39
|
-
set_state('test_db_storage' => expected)
|
40
|
-
@query_engine.do_sync
|
41
|
-
JSON.parse(test_schema).should == JSON.parse(schema_string)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should include test_metadata helper" do
|
46
|
-
mock_metadata_method([SampleAdapter]) do
|
47
|
-
expected = {'1'=>@product1,'2'=>@product2}
|
48
|
-
set_state('test_db_storage' => expected)
|
49
|
-
@query_engine.do_sync
|
50
|
-
JSON.parse(test_metadata).should == JSON.parse(foo_bar)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should include test_query helper" do
|
14
|
+
let(:schema_string) { "{\"property\":{\"brand\":\"string\",\"name\":\"string\"},\"version\":\"1.0\"}" }
|
15
|
+
let(:foo_bar) { "{\"foo\":\"bar\"}" }
|
16
|
+
|
17
|
+
it "should setup_test_for an adapter and user" do
|
18
|
+
@u.is_a?(User).should == true
|
19
|
+
@s.is_a?(Source).should == true
|
20
|
+
@query_engine.is_a?(Rhoconnect::Handler::Query::Engine).should == true
|
21
|
+
@cud_engine.is_a?(Rhoconnect::Handler::Changes::Engine).should == true
|
22
|
+
@search_engine.is_a?(Rhoconnect::Handler::Search::Engine).should == true
|
23
|
+
@query_engine.model.is_a?(SampleAdapter).should == true
|
24
|
+
@cud_engine.model.is_a?(SampleAdapter).should == true
|
25
|
+
@search_engine.model.is_a?(SampleAdapter).should == true
|
26
|
+
@u.login.should == 'user1'
|
27
|
+
@s.name.should == 'SampleAdapter'
|
28
|
+
@c.id.size.should == 32
|
29
|
+
@c.device_pin.should == 'abcd'
|
30
|
+
@c.device_port.should == '3333'
|
31
|
+
@c.device_type.should == 'Apple'
|
32
|
+
@c.user_id.should == 'user1'
|
33
|
+
@c.app_id.should == 'application'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should include test_schema helper" do
|
37
|
+
mock_schema_method([SampleAdapter]) do
|
55
38
|
expected = {'1'=>@product1,'2'=>@product2}
|
56
39
|
set_state('test_db_storage' => expected)
|
57
|
-
|
40
|
+
@query_engine.do_sync
|
41
|
+
JSON.parse(test_schema).should == JSON.parse(schema_string)
|
58
42
|
end
|
59
|
-
|
60
|
-
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should include test_metadata helper" do
|
46
|
+
mock_metadata_method([SampleAdapter]) do
|
61
47
|
expected = {'1'=>@product1,'2'=>@product2}
|
62
48
|
set_state('test_db_storage' => expected)
|
63
|
-
@
|
64
|
-
|
49
|
+
@query_engine.do_sync
|
50
|
+
JSON.parse(test_metadata).should == JSON.parse(foo_bar)
|
65
51
|
end
|
52
|
+
end
|
66
53
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
54
|
+
it "should include test_query helper" do
|
55
|
+
expected = {'1'=>@product1,'2'=>@product2}
|
56
|
+
set_state('test_db_storage' => expected)
|
57
|
+
test_query.should == expected
|
58
|
+
end
|
72
59
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
@s.pass_through = 'true'
|
80
|
-
test_create(@product4).should == {'processed' => ["temp-id"]}.to_json
|
81
|
-
end
|
60
|
+
it "should include test_query helper when pass through" do
|
61
|
+
expected = {'1'=>@product1,'2'=>@product2}
|
62
|
+
set_state('test_db_storage' => expected)
|
63
|
+
@s.pass_through = 'true'
|
64
|
+
test_query.should == expected
|
65
|
+
end
|
82
66
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
67
|
+
it "should include query_errors helper" do
|
68
|
+
expected = {"query-error"=>{'message'=>'failed'}}
|
69
|
+
set_doc_state(@s, :errors => expected)
|
70
|
+
query_errors.should == expected
|
71
|
+
end
|
88
72
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should include test_update helper when pass through" do
|
96
|
-
record = {'4'=> { 'price' => '199.99' }}
|
97
|
-
@s.pass_through = 'true'
|
98
|
-
test_update(record).should == {'processed' => ["4"]}.to_json
|
99
|
-
verify_source_queue_data(@s, "update:post:/" => [])
|
100
|
-
end
|
73
|
+
it "should include test_create helper" do
|
74
|
+
@product4['link'] = 'test link'
|
75
|
+
test_create(@product4).should == 'backend_id'
|
76
|
+
end
|
101
77
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
78
|
+
it "should include test_create helper when pass through" do
|
79
|
+
@s.pass_through = 'true'
|
80
|
+
test_create(@product4).should == {'processed' => ["temp-id"]}.to_json
|
81
|
+
end
|
107
82
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
it "should include test_delete helper when pass through" do
|
115
|
-
record = {'4'=> { 'price' => '199.99' }}
|
116
|
-
@s.pass_through = 'true'
|
117
|
-
test_delete(record).should == {'processed' => ["4"]}.to_json
|
118
|
-
verify_source_queue_data(@s, "delete:post:/" => [])
|
119
|
-
end
|
83
|
+
it "should include create_errors helper" do
|
84
|
+
expected = {"create-error"=>{'message'=>'failed'}}
|
85
|
+
set_doc_state(@c, :create_errors => expected)
|
86
|
+
create_errors.should == expected
|
87
|
+
end
|
120
88
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
89
|
+
it "should include test_update helper" do
|
90
|
+
record = {'4'=> { 'price' => '199.99' }}
|
91
|
+
test_update(record)
|
92
|
+
verify_source_queue_data(@s, "update:post:/" => [])
|
93
|
+
end
|
126
94
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
95
|
+
it "should include test_update helper when pass through" do
|
96
|
+
record = {'4'=> { 'price' => '199.99' }}
|
97
|
+
@s.pass_through = 'true'
|
98
|
+
test_update(record).should == {'processed' => ["4"]}.to_json
|
99
|
+
verify_source_queue_data(@s, "update:post:/" => [])
|
100
|
+
end
|
131
101
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
102
|
+
it "should include update_errors helper" do
|
103
|
+
expected = {"update-error"=>{'message'=>'failed'}}
|
104
|
+
set_doc_state(@c, :update_errors => expected)
|
105
|
+
update_errors.should == expected
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should include test_delete helper" do
|
109
|
+
record = {'4'=> { 'price' => '199.99' }}
|
110
|
+
test_delete(record)
|
111
|
+
verify_source_queue_data(@s, "delete:post:/" => [])
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should include test_delete helper when pass through" do
|
115
|
+
record = {'4'=> { 'price' => '199.99' }}
|
116
|
+
@s.pass_through = 'true'
|
117
|
+
test_delete(record).should == {'processed' => ["4"]}.to_json
|
118
|
+
verify_source_queue_data(@s, "delete:post:/" => [])
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should include delete_errors helper" do
|
122
|
+
expected = {"delete-error"=>{'message'=>'failed'}}
|
123
|
+
set_doc_state(@c, :delete_errors => expected)
|
124
|
+
delete_errors.should == expected
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should include md helper" do
|
128
|
+
set_doc_state(@s, :md => @data)
|
129
|
+
md.should == @data
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should include cd helper" do
|
133
|
+
set_doc_state(@c, :cd => @data)
|
134
|
+
cd.should == @data
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should search backend based on params and build a hash of hashes" do
|
138
|
+
expected = {'1'=>@product1,'2'=>@product2, '3'=>@product3}
|
139
|
+
set_state('test_db_storage' => expected)
|
140
|
+
# SampleAdapter has search method by key 'name'
|
141
|
+
test_search({'name' => 'iPhone'}).should == { '1' => @product1 }
|
142
|
+
test_search('name' => 'G2').should == { '2' => @product2 }
|
143
|
+
test_search({'name' => 'Fuze'}).should == { '3' => @product3 }
|
144
|
+
test_search({'name' => 'Some Cool Gadget'}).should == {}
|
147
145
|
end
|
148
146
|
end
|
Binary file
|
data/spec/testdata/5000-data.txt
CHANGED
Binary file
|