rhoconnect 4.0.4 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG.md +54 -5
  3. data/CREDITS +219 -219
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +68 -79
  6. data/Rakefile +1 -2
  7. data/bench/benchapp/spec/models/ruby/mock_adapter_spec.rb +17 -17
  8. data/bench/benchapp/spec/models/ruby/queue_mock_adapter_spec.rb +17 -17
  9. data/bench/benchapp/spec/spec_helper.rb +3 -3
  10. data/bench/blobapp/spec/models/ruby/blob_adapter_spec.rb +17 -17
  11. data/bench/blobapp/spec/spec_helper.rb +3 -3
  12. data/bench/lib/bench/runner.rb +1 -69
  13. data/bench/lib/bench.rb +18 -18
  14. data/bench/spec/mock_adapter_spec.rb +54 -55
  15. data/bench/spec/mock_client_spec.rb +47 -48
  16. data/bench/spec/result_spec.rb +41 -44
  17. data/bench/spec/utils_spec.rb +24 -25
  18. data/commands/generators/app.rb +7 -5
  19. data/commands/generators/controller.rb +7 -5
  20. data/commands/generators/model.rb +7 -5
  21. data/commands/generators/source.rb +7 -5
  22. data/commands/parser.rb +1 -1
  23. data/commands/redis/redis_download.rb +1 -1
  24. data/doc/async-jobs.txt +9 -9
  25. data/doc/supported-platforms.txt +0 -2
  26. data/generators/rhoconnect.rb +92 -212
  27. data/generators/templates/application/rcgemfile +3 -3
  28. data/generators/templates/application/spec/application_controller_spec.rb +14 -16
  29. data/generators/templates/application/spec/js_spec.rb +20 -20
  30. data/generators/templates/application/spec/spec_helper.rb +1 -1
  31. data/generators/templates/source/controllers/ruby/controller_spec.rb +18 -19
  32. data/generators/templates/source/models/ruby/model_spec.rb +17 -17
  33. data/install.sh +10 -21
  34. data/installer/unix-like/rho_connect_install_constants.rb +5 -5
  35. data/installer/unix-like/rho_connect_install_installers.rb +4 -4
  36. data/installer/utils/constants.rb +6 -6
  37. data/installer/utils/nix_install_test.rb +29 -29
  38. data/installer/utils/package_upload/repos.rake +16 -26
  39. data/js-adapters/node.rb +4 -4
  40. data/js-adapters/node_channel.rb +4 -8
  41. data/lib/rhoconnect/db_adapter.rb +13 -13
  42. data/lib/rhoconnect/handler/changes/engine.rb +1 -1
  43. data/lib/rhoconnect/jobs/bulk_data_job.rb +29 -29
  44. data/lib/rhoconnect/license.rb +7 -7
  45. data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +13 -13
  46. data/lib/rhoconnect/ping/apple.rb +4 -4
  47. data/lib/rhoconnect/server.rb +2 -2
  48. data/lib/rhoconnect/source.rb +2 -2
  49. data/lib/rhoconnect/store.rb +12 -6
  50. data/lib/rhoconnect/utilities.rb +2 -2
  51. data/lib/rhoconnect/version.rb +1 -1
  52. data/lib/rhoconnect.rb +6 -4
  53. data/rhoconnect.gemspec +5 -6
  54. data/spec/api/api_helper.rb +1 -1
  55. data/spec/api/app/fast_delete_spec.rb +22 -22
  56. data/spec/api/app/fast_insert_spec.rb +23 -23
  57. data/spec/api/app/fast_update_spec.rb +63 -63
  58. data/spec/api/app/push_deletes_spec.rb +11 -13
  59. data/spec/api/app/push_objects_spec.rb +39 -39
  60. data/spec/api/client/client_get_db_doc_spec.rb +29 -29
  61. data/spec/api/client/client_set_db_doc_spec.rb +11 -11
  62. data/spec/api/client/get_client_params_spec.rb +29 -29
  63. data/spec/api/client/list_client_docs_spec.rb +32 -34
  64. data/spec/api/client/reset_spec.rb +30 -30
  65. data/spec/api/readstate/set_refresh_time_spec.rb +43 -43
  66. data/spec/api/source/get_source_params_spec.rb +32 -34
  67. data/spec/api/source/list_sources_spec.rb +13 -13
  68. data/spec/api/source/update_source_params_spec.rb +19 -19
  69. data/spec/api/store/get_db_doc_spec.rb +27 -27
  70. data/spec/api/store/set_db_doc_spec.rb +38 -38
  71. data/spec/api/system/adapter_spec.rb +27 -29
  72. data/spec/api/system/get_license_info_spec.rb +11 -11
  73. data/spec/api/system/login_spec.rb +37 -37
  74. data/spec/api/system/reset_spec.rb +15 -15
  75. data/spec/api/system/stats_spec.rb +70 -71
  76. data/spec/api/user/create_user_spec.rb +37 -37
  77. data/spec/api/user/delete_client_spec.rb +7 -7
  78. data/spec/api/user/delete_user_spec.rb +62 -62
  79. data/spec/api/user/list_clients_spec.rb +24 -24
  80. data/spec/api/user/list_source_docs_spec.rb +29 -29
  81. data/spec/api/user/list_users_spec.rb +22 -22
  82. data/spec/api/user/ping_spec.rb +18 -18
  83. data/spec/api/user/show_user_spec.rb +10 -10
  84. data/spec/api/user/update_user_spec.rb +43 -43
  85. data/spec/api/user/user_get_db_doc_spec.rb +12 -12
  86. data/spec/api/user/user_set_db_doc_spec.rb +37 -37
  87. data/spec/api_token_spec.rb +8 -8
  88. data/spec/app_spec.rb +18 -17
  89. data/spec/apps/jstestapp/settings/settings.yml +2 -0
  90. data/spec/async_spec.rb +9 -11
  91. data/spec/bulk_data/bulk_data_spec.rb +120 -120
  92. data/spec/cli/cli_spec.rb +50 -53
  93. data/spec/client_spec.rb +105 -105
  94. data/spec/client_sync_spec.rb +529 -528
  95. data/spec/controllers/js_base_spec.rb +147 -141
  96. data/spec/doc/doc_spec.rb +51 -52
  97. data/spec/document_spec.rb +58 -58
  98. data/spec/dynamic_adapter_spec.rb +33 -36
  99. data/spec/generator/generator_spec.rb +76 -42
  100. data/spec/jobs/bulk_data_job_spec.rb +101 -102
  101. data/spec/jobs/ping_job_spec.rb +176 -177
  102. data/spec/jobs/source_job_spec.rb +24 -25
  103. data/spec/license_spec.rb +54 -55
  104. data/spec/models/js_base_spec.rb +121 -120
  105. data/spec/perf/bulk_data_perf_spec.rb +23 -24
  106. data/spec/perf/perf_spec_helper.rb +7 -7
  107. data/spec/perf/store_perf_spec.rb +139 -140
  108. data/spec/ping/apple_spec.rb +65 -65
  109. data/spec/ping/gcm_spec.rb +83 -84
  110. data/spec/ping/rhoconnect_push_spec.rb +52 -53
  111. data/spec/predefined_adapters/rho_internal_bench_adapter_controller_js_spec.rb +100 -101
  112. data/spec/predefined_adapters/rho_internal_js_bench_adapter_js_spec.rb +29 -31
  113. data/spec/read_state_spec.rb +24 -25
  114. data/spec/rhoconnect_spec.rb +7 -7
  115. data/spec/server/server_spec.rb +664 -662
  116. data/spec/server/stats_spec.rb +12 -12
  117. data/spec/source_adapter_spec.rb +124 -125
  118. data/spec/source_spec.rb +148 -149
  119. data/spec/source_sync_spec.rb +736 -736
  120. data/spec/spec_helper.rb +4 -5
  121. data/spec/stats/record_spec.rb +22 -21
  122. data/spec/store_orm_spec.rb +48 -48
  123. data/spec/store_spec.rb +428 -426
  124. data/spec/support/shared_examples.rb +5 -7
  125. data/spec/sync_states_spec.rb +67 -67
  126. data/spec/test_methods_spec.rb +121 -123
  127. data/spec/testdata/10000-data.txt +0 -0
  128. data/spec/testdata/5000-data.txt +0 -0
  129. data/spec/user_spec.rb +102 -102
  130. data/tasks/redis.rake +3 -3
  131. metadata +154 -195
  132. data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
  133. data/bench/benchapp/tmp/restart.txt +0 -0
  134. data/bench/blobapp/settings/license.key.bak +0 -2
  135. data/bench/blobapp/tmp/restart.txt +0 -0
  136. data/bench/lib/testdata/1-data.txt +0 -0
  137. data/bench/lib/testdata/10-data.txt +0 -0
  138. data/bench/lib/testdata/2-data.txt +0 -0
  139. data/bench/lib/testdata/250-data.txt +0 -0
  140. data/bench/lib/testdata/5-blob_data.txt +0 -0
  141. data/bench/lib/testdata/5-data.txt +0 -0
  142. data/bench/lib/testdata/50-data.txt +0 -0
  143. data/bench/lib/testdata/500-data.txt +0 -0
  144. data/doc/protocol.html +0 -1993
  145. data/spec/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +0 -19
  146. data/spec/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +0 -15
  147. data/spec/coverage/rcov/assets/0.2.3/print.css +0 -12
  148. data/spec/coverage/rcov/assets/0.2.3/rcov.js +0 -42
  149. data/spec/coverage/rcov/assets/0.2.3/screen.css +0 -270
  150. data/spec/coverage/rcov/index.html +0 -88
  151. data/spec/generator/generator_spec_helper.rb +0 -9
@@ -1,15 +1,13 @@
1
1
  # When shared examples are called as
2
- # it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => false
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
- # it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true
6
- shared_examples_for "SharedRhoconnectHelper" do |params|
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
- shared_examples_for "BenchSpecHelper" do
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
- shared_examples_for "ApiHelper" do
97
+ shared_examples "ApiHelper" do
100
98
  include Rack::Test::Methods
101
99
  include Rhoconnect
102
100
  include TestHelpers
@@ -1,78 +1,78 @@
1
1
  require File.join(File.dirname(__FILE__),'spec_helper')
2
2
 
3
3
  describe "Sync Server States" do
4
- it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
5
- before(:each) do
6
- @s = Source.load(@s_fields[:name],@s_params)
7
- @model = Rhoconnect::Model::Base.create(@s)
8
- rhcud = lambda { @model.send(params[:operation].to_sym, params["#{params[:operation]}_object".to_sym]) }
9
- @sscud = Rhoconnect::Handler::Changes::Runner.new(['create', 'update', 'delete'], @model, @c, rhcud, {})
10
- rh = lambda { @model.query(params[:query]) }
11
- @ssq = Rhoconnect::Handler::Query::Runner.new(@model, @c, rh, {})
12
- end
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
- describe "client creates objects" do
15
+ describe "client creates objects" do
15
16
 
16
- it "should create object and create link for client" do
17
- @product1['link'] = 'temp1'
18
- params = {'create'=>{'1'=>@product1}}
19
- backend_data = {'backend_id'=>@product1}
20
- set_doc_state(@sscud.client, :cd_size => 0)
21
- set_doc_state(@s, :md_size => 0)
22
- @s.read_state.refresh_time = Time.now.to_i + 3600
23
- @sscud.params = params
24
- @sscud.run
25
- verify_source_queue_data(@s, :create => [])
26
- verify_doc_result(@c, {:cd_size => "1",
27
- :cd => backend_data,
28
- :create_links => {'1'=>{'l'=>'backend_id'}}})
29
- verify_doc_result(@s, {:md_size => "1",
30
- :md => backend_data})
31
- end
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
- it "should create object and send link to client" do
34
- @product1['link'] = 'temp1'
35
- params = {'create'=>{'1'=>@product1}}
36
- backend_data = {'backend_id'=>@product1}
37
- set_doc_state(@sscud.client, :cd_size => 0)
38
- set_doc_state(@s, :md_size => 0)
39
- @s.read_state.refresh_time = Time.now.to_i + 3600
40
- @sscud.params = params
41
- @sscud.run
42
- verify_source_queue_data(@s, :create => [])
43
- verify_doc_result(@c, {:cd_size => "1",
44
- :cd => backend_data,
45
- :create_links => {'1'=>{'l'=>'backend_id'}}})
46
- verify_doc_result(@s, {:md_size => "1",
47
- :md => backend_data})
48
- res = @ssq.run
49
- res.should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>res[1]['token']},
50
- {"count"=>0}, {"progress_count"=>0}, {"total_count"=>1},
51
- {"links"=> {'1'=>{'l'=>'backend_id'}}}]
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
- describe "client deletes objects" do
57
- it "should delete object" do
58
- params = {'delete'=>{'1'=>@product1}}
59
- data = {'1'=>@product1,'2'=>@product2,'3'=>@product3}
60
- expected = {'2'=>@product2,'3'=>@product3}
61
- set_doc_state(@sscud.client, {:cd => data,
62
- :cd_size => data.size})
63
- set_doc_state(@s, {:md => data,
64
- :md_size => data.size})
65
- @s.read_state.refresh_time = Time.now.to_i + 3600
66
- @sscud.params = params
67
- @sscud.run
68
- verify_source_queue_data(@s, :delete => [])
69
- verify_doc_result(@sscud.client, {:cd => expected,
70
- :delete_page => {},
71
- :cd_size => "2"})
72
- verify_doc_result(@s, {:md => expected,
73
- :md_size => "2"})
74
- verify_result('test_delete_storage' => {'1'=>@product1})
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
@@ -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
- it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
9
- before(:each) do
10
- Rhoconnect.bootstrap(get_testapp_path)
11
- setup_test_for(SampleAdapter,'user1')
12
- end
9
+ before(:each) do
10
+ Rhoconnect.bootstrap(get_testapp_path)
11
+ setup_test_for(SampleAdapter,'user1')
12
+ end
13
13
 
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
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
- test_query.should == expected
40
+ @query_engine.do_sync
41
+ JSON.parse(test_schema).should == JSON.parse(schema_string)
58
42
  end
59
-
60
- it "should include test_query helper when pass through" do
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
- @s.pass_through = 'true'
64
- test_query.should == expected
49
+ @query_engine.do_sync
50
+ JSON.parse(test_metadata).should == JSON.parse(foo_bar)
65
51
  end
52
+ end
66
53
 
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
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
- it "should include test_create helper" do
74
- @product4['link'] = 'test link'
75
- test_create(@product4).should == 'backend_id'
76
- end
77
-
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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- it "should include md helper" do
128
- set_doc_state(@s, :md => @data)
129
- md.should == @data
130
- end
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
- 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 == {}
145
- end
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
Binary file