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
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gem 'win32-process', :platforms => [:mswin, :mingw]
7
7
 
8
8
  # use thin and eventmachine everywhere except JRuby
9
9
  platforms :ruby, :mingw do
10
- gem "eventmachine", "~> 1.0.0"
10
+ gem "eventmachine", "~> 1.0.5"
11
11
  # using thin by default
12
12
  gem 'thin'
13
13
  # for async framework
@@ -36,7 +36,7 @@ group :development do
36
36
  end
37
37
 
38
38
  group :test do
39
- gem 'rspec', '~> 2.10.0'
39
+ gem 'rspec', '~> 2.14.0'
40
40
  gem 'simplecov', '>= 0.7.1', :require => false
41
41
  gem 'simplecov-rcov', '~> 0.2.3'
42
42
  gem 'rack-test', '~> 0.6', :require => 'rack/test'
data/Gemfile.lock CHANGED
@@ -1,24 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (4.0.4)
4
+ rhoconnect (5.1.1)
5
5
  bundler (~> 1.0)
6
- connection_pool (~> 1.0.0)
7
- json (~> 1.7.7)
6
+ connection_pool (~> 1.2.0)
7
+ json (~> 1.8)
8
8
  rack (~> 1.5.2)
9
- rake (~> 10.0.0)
9
+ rake (~> 10.4.0)
10
10
  redis (>= 3.0.1)
11
11
  resque (>= 1.22.0)
12
12
  rest-client (~> 1.6.1)
13
- rubyzip (~> 0.9.4)
14
- sinatra (~> 1.3)
15
- templater (~> 1.0.0)
13
+ rubyzip (~> 1.1)
14
+ sinatra (~> 1.4)
16
15
  thor (~> 0.18.0)
17
16
 
18
17
  GEM
19
18
  remote: https://rubygems.org/
20
19
  specs:
21
- addressable (2.3.6)
20
+ addressable (2.3.7)
22
21
  arr-pm (0.0.9)
23
22
  cabin (> 0)
24
23
  async-rack (0.5.1)
@@ -27,28 +26,27 @@ GEM
27
26
  builder
28
27
  mime-types
29
28
  xml-simple
30
- backports (3.6.0)
29
+ backports (3.6.4)
31
30
  builder (3.2.2)
32
- cabin (0.6.1)
33
- childprocess (0.5.2)
31
+ cabin (0.7.1)
32
+ childprocess (0.5.5)
34
33
  ffi (~> 1.0, >= 1.0.11)
35
- clamp (0.6.3)
36
- coffee-script (2.2.0)
34
+ clamp (0.6.4)
35
+ coffee-script (2.3.0)
37
36
  coffee-script-source
38
37
  execjs
39
- coffee-script-source (1.7.0)
40
- connection_pool (1.0.0)
38
+ coffee-script-source (1.9.1)
39
+ connection_pool (1.2.0)
41
40
  crack (0.4.2)
42
41
  safe_yaml (~> 1.0.0)
43
- daemons (1.1.9)
44
- diff-lcs (1.1.3)
45
- docile (1.1.3)
46
- eventmachine (1.0.3)
42
+ daemons (1.2.1)
43
+ diff-lcs (1.2.5)
44
+ docile (1.1.5)
45
+ eventmachine (1.0.7)
47
46
  excon (0.22.1)
48
- execjs (2.0.2)
49
- extlib (0.9.16)
47
+ execjs (2.4.0)
50
48
  ffaker (1.14.0)
51
- ffi (1.9.3)
49
+ ffi (1.9.7)
52
50
  fog (1.11.1)
53
51
  builder
54
52
  excon (~> 0.20)
@@ -59,24 +57,16 @@ GEM
59
57
  net-ssh (>= 2.1.3)
60
58
  nokogiri (~> 1.5.0)
61
59
  ruby-hmac
62
- formatador (0.2.4)
63
- fpm (1.0.2)
64
- arr-pm (~> 0.0.8)
60
+ formatador (0.2.5)
61
+ fpm (1.3.3)
62
+ arr-pm (~> 0.0.9)
65
63
  backports (>= 2.6.2)
66
64
  cabin (>= 0.6.0)
67
65
  childprocess
68
66
  clamp (~> 0.6)
69
67
  ffi
70
- ftw (~> 0.0.30)
71
68
  json (>= 1.7.7)
72
- ftw (0.0.39)
73
- addressable
74
- backports (>= 2.6.2)
75
- cabin (> 0)
76
- http_parser.rb (= 0.5.3)
77
- highline (1.6.21)
78
69
  hike (1.2.3)
79
- http_parser.rb (0.5.3)
80
70
  jasmine (1.3.2)
81
71
  jasmine-core (~> 1.3.1)
82
72
  rack (~> 1.0)
@@ -89,74 +79,73 @@ GEM
89
79
  multi_json
90
80
  rainbow
91
81
  sprockets (~> 2)
92
- json (1.7.7)
93
- mime-types (2.2)
82
+ json (1.8.2)
83
+ mime-types (1.25.1)
94
84
  mono_logger (1.1.0)
95
- multi_json (1.9.2)
96
- net-scp (1.1.2)
85
+ multi_json (1.11.0)
86
+ net-scp (1.2.1)
97
87
  net-ssh (>= 2.6.5)
98
- net-ssh (2.8.0)
88
+ net-ssh (2.9.2)
99
89
  nokogiri (1.5.11)
100
90
  rack (1.5.2)
101
91
  rack-fiber_pool (0.9.3)
102
- rack-protection (1.5.2)
92
+ rack-protection (1.5.3)
103
93
  rack
104
- rack-test (0.6.2)
94
+ rack-test (0.6.3)
105
95
  rack (>= 1.0)
106
96
  rainbow (2.0.0)
107
- rake (10.0.4)
108
- redis (3.0.7)
109
- redis-namespace (1.4.1)
110
- redis (~> 3.0.4)
97
+ rake (10.4.2)
98
+ rdoc (4.2.0)
99
+ json (~> 1.4)
100
+ redis (3.2.1)
101
+ redis-namespace (1.5.1)
102
+ redis (~> 3.0, >= 3.0.4)
111
103
  resque (1.25.2)
112
104
  mono_logger (~> 1.0)
113
105
  multi_json (~> 1.0)
114
106
  redis-namespace (~> 1.3)
115
107
  sinatra (>= 0.9.2)
116
108
  vegas (~> 0.1.2)
117
- rest-client (1.6.7)
118
- mime-types (>= 1.16)
119
- rspec (2.10.0)
120
- rspec-core (~> 2.10.0)
121
- rspec-expectations (~> 2.10.0)
122
- rspec-mocks (~> 2.10.0)
123
- rspec-core (2.10.1)
124
- rspec-expectations (2.10.0)
125
- diff-lcs (~> 1.1.3)
126
- rspec-mocks (2.10.1)
109
+ rest-client (1.6.8)
110
+ mime-types (~> 1.16)
111
+ rdoc (>= 2.4.2)
112
+ rspec (2.14.1)
113
+ rspec-core (~> 2.14.0)
114
+ rspec-expectations (~> 2.14.0)
115
+ rspec-mocks (~> 2.14.0)
116
+ rspec-core (2.14.8)
117
+ rspec-expectations (2.14.5)
118
+ diff-lcs (>= 1.1.3, < 2.0)
119
+ rspec-mocks (2.14.6)
127
120
  ruby-hmac (0.4.0)
128
- rubyzip (0.9.9)
129
- safe_yaml (1.0.1)
130
- selenium-webdriver (2.35.1)
131
- childprocess (>= 0.2.5)
121
+ rubyzip (1.1.7)
122
+ safe_yaml (1.0.4)
123
+ selenium-webdriver (2.45.0)
124
+ childprocess (~> 0.5)
132
125
  multi_json (~> 1.0)
133
- rubyzip (< 1.0.0)
134
- websocket (~> 1.0.4)
135
- simplecov (0.8.2)
126
+ rubyzip (~> 1.0)
127
+ websocket (~> 1.0)
128
+ simplecov (0.9.2)
136
129
  docile (~> 1.1.0)
137
- multi_json
138
- simplecov-html (~> 0.8.0)
139
- simplecov-html (0.8.0)
130
+ multi_json (~> 1.0)
131
+ simplecov-html (~> 0.9.0)
132
+ simplecov-html (0.9.0)
140
133
  simplecov-rcov (0.2.3)
141
134
  simplecov (>= 0.4.1)
142
- sinatra (1.4.4)
135
+ sinatra (1.4.5)
143
136
  rack (~> 1.4)
144
137
  rack-protection (~> 1.4)
145
138
  tilt (~> 1.3, >= 1.3.4)
146
- sprockets (2.12.0)
139
+ sprockets (2.12.3)
147
140
  hike (~> 1.2)
148
141
  multi_json (~> 1.0)
149
142
  rack (~> 1.0)
150
143
  tilt (~> 1.1, != 1.3.0)
151
- sqlite3 (1.3.9)
152
- templater (1.0.0)
153
- diff-lcs (>= 1.1.2)
154
- extlib (>= 0.9.5)
155
- highline (>= 1.4.0)
156
- thin (1.6.2)
157
- daemons (>= 1.0.9)
158
- eventmachine (>= 1.0.0)
159
- rack (>= 1.0.0)
144
+ sqlite3 (1.3.10)
145
+ thin (1.6.3)
146
+ daemons (~> 1.0, >= 1.0.9)
147
+ eventmachine (~> 1.0)
148
+ rack (~> 1.0)
160
149
  thor (0.18.1)
161
150
  tilt (1.4.1)
162
151
  vegas (0.1.11)
@@ -164,8 +153,8 @@ GEM
164
153
  webmock (1.9.3)
165
154
  addressable (>= 2.2.7)
166
155
  crack (>= 0.3.2)
167
- websocket (1.0.7)
168
- xml-simple (1.1.3)
156
+ websocket (1.2.1)
157
+ xml-simple (1.1.5)
169
158
 
170
159
  PLATFORMS
171
160
  ruby
@@ -175,7 +164,7 @@ DEPENDENCIES
175
164
  aws-s3 (>= 0.6.2)
176
165
  dbd-jdbc (>= 0.1.4)
177
166
  dbi (>= 0.4.5)
178
- eventmachine (~> 1.0.0)
167
+ eventmachine (~> 1.0.5)
179
168
  excon (~> 0.22.1)
180
169
  ffaker (~> 1.14.0)
181
170
  fog (~> 1.11.1)
@@ -188,7 +177,7 @@ DEPENDENCIES
188
177
  rack-fiber_pool
189
178
  rack-test (~> 0.6)
190
179
  rhoconnect!
191
- rspec (~> 2.10.0)
180
+ rspec (~> 2.14.0)
192
181
  simplecov (>= 0.7.1)
193
182
  simplecov-rcov (~> 0.2.3)
194
183
  sqlite3 (>= 1.3.3)
data/Rakefile CHANGED
@@ -29,7 +29,6 @@ begin
29
29
  :ping => 'spec/ping/*_spec.rb',
30
30
  :generator => 'spec/generator/*_spec.rb',
31
31
  :bench => 'bench/spec/*_spec.rb',
32
- :models => 'spec/models/*_spec.rb',
33
32
  :controllers => 'spec/controllers/**/*_spec.rb',
34
33
  :models => 'spec/models/**/*_spec.rb',
35
34
  :cli => 'spec/cli/*_spec.rb'
@@ -56,7 +55,7 @@ begin
56
55
  t.rcov = false
57
56
  end
58
57
 
59
- rescue LoadError => e
58
+ rescue LoadError
60
59
  # Array of groups whose gems are not installed
61
60
  # if bundle install called with the --without option
62
61
  unless Bundler.settings.without.include? :test
@@ -1,25 +1,25 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "MockAdapter" do
4
- it_should_behave_like "SpecHelper" do
5
- before(:each) do
6
- setup_test_for MockAdapter,'testuser'
7
- end
4
+ include_examples "SpecHelper"
8
5
 
9
- it "should process MockAdapter query" do
10
- pending
11
- end
6
+ before(:each) do
7
+ setup_test_for MockAdapter,'testuser'
8
+ end
12
9
 
13
- it "should process MockAdapter create" do
14
- pending
15
- end
10
+ it "should process MockAdapter query" do
11
+ pending
12
+ end
16
13
 
17
- it "should process MockAdapter update" do
18
- pending
19
- end
14
+ it "should process MockAdapter create" do
15
+ pending
16
+ end
20
17
 
21
- it "should process MockAdapter delete" do
22
- pending
23
- end
24
- end
18
+ it "should process MockAdapter update" do
19
+ pending
20
+ end
21
+
22
+ it "should process MockAdapter delete" do
23
+ pending
24
+ end
25
25
  end
@@ -1,25 +1,25 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "QueueMockAdapter" do
4
- it_should_behave_like "SpecHelper" do
5
- before(:each) do
6
- setup_test_for QueueMockAdapter,'testuser'
7
- end
4
+ include_examples "SpecHelper"
8
5
 
9
- it "should process QueueMockAdapter query" do
10
- pending
11
- end
6
+ before(:each) do
7
+ setup_test_for QueueMockAdapter,'testuser'
8
+ end
12
9
 
13
- it "should process QueueMockAdapter create" do
14
- pending
15
- end
10
+ it "should process QueueMockAdapter query" do
11
+ pending
12
+ end
16
13
 
17
- it "should process QueueMockAdapter update" do
18
- pending
19
- end
14
+ it "should process QueueMockAdapter create" do
15
+ pending
16
+ end
20
17
 
21
- it "should process QueueMockAdapter delete" do
22
- pending
23
- end
24
- end
18
+ it "should process QueueMockAdapter update" do
19
+ pending
20
+ end
21
+
22
+ it "should process QueueMockAdapter delete" do
23
+ pending
24
+ end
25
25
  end
@@ -19,11 +19,11 @@ include Rhoconnect
19
19
 
20
20
  require 'rhoconnect/test_methods'
21
21
 
22
- shared_examples_for "SpecHelper" do
22
+ shared_examples "SpecHelper" do
23
23
  include Rhoconnect::TestMethods
24
-
24
+
25
25
  before(:each) do
26
26
  Store.flush_all
27
27
  Application.initializer(ROOT_PATH)
28
- end
28
+ end
29
29
  end
@@ -1,25 +1,25 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "BlobAdapter" do
4
- it_should_behave_like "SpecHelper" do
5
- before(:each) do
6
- setup_test_for BlobAdapter,'testuser'
7
- end
4
+ include_examples "SpecHelper"
8
5
 
9
- it "should process BlobAdapter query" do
10
- pending
11
- end
6
+ before(:each) do
7
+ setup_test_for BlobAdapter,'testuser'
8
+ end
12
9
 
13
- it "should process BlobAdapter create" do
14
- pending
15
- end
10
+ it "should process BlobAdapter query" do
11
+ pending
12
+ end
16
13
 
17
- it "should process BlobAdapter update" do
18
- pending
19
- end
14
+ it "should process BlobAdapter create" do
15
+ pending
16
+ end
20
17
 
21
- it "should process BlobAdapter delete" do
22
- pending
23
- end
24
- end
18
+ it "should process BlobAdapter update" do
19
+ pending
20
+ end
21
+
22
+ it "should process BlobAdapter delete" do
23
+ pending
24
+ end
25
25
  end
@@ -19,11 +19,11 @@ include Rhoconnect
19
19
 
20
20
  require 'rhoconnect/test_methods'
21
21
 
22
- shared_examples_for "SpecHelper" do
22
+ shared_examples "SpecHelper" do
23
23
  include Rhoconnect::TestMethods
24
-
24
+
25
25
  before(:each) do
26
26
  Store.flush_all
27
27
  Application.initializer(ROOT_PATH)
28
- end
28
+ end
29
29
  end
@@ -3,7 +3,7 @@ module Bench
3
3
  include Logging
4
4
  include Timer
5
5
  attr_reader :threads
6
-
6
+
7
7
  def initialize
8
8
  @threads = []
9
9
  @sessions = []
@@ -37,73 +37,5 @@ module Bench
37
37
  Bench.start_time = total_times[1]
38
38
  Bench.end_time = total_times[2]
39
39
  end
40
-
41
- =begin
42
- if defined?(JRUBY_VERSION)
43
- def test(concurrency,iterations,&block)
44
- total_time = time do
45
- 0.upto(concurrency - 1) do |thread_id|
46
- sleep rand(2)
47
- threads << Thread.new(block) do |t|
48
- 0.upto(iterations - 1) do |iteration|
49
- s = Session.new(thread_id, iteration)
50
- @sessions << s
51
- begin
52
- yield Bench,s
53
- rescue Exception => e
54
- puts "error running script: #{e.inspect}"
55
- puts e.backtrace.join("\n")
56
- end
57
- end
58
- end
59
- end
60
- begin
61
- threads.each { |t| t.join }
62
- rescue RestClient::RequestTimeout => e
63
- bench_log "Request timed out #{e}"
64
- end
65
- end
66
- Bench.sessions = @sessions
67
- Bench.total_time = total_time
68
- end
69
- else
70
- def test(concurrency,iterations,&block)
71
- total_time = time do
72
- 0.upto(concurrency - 1) do |thread_id|
73
- sleep rand(2)
74
- threads << Process.fork do
75
- pid = $$ # child process id
76
- 0.upto(iterations - 1) do |iteration|
77
- s = Session.new(thread_id, iteration)
78
- begin
79
- yield Bench,s
80
- rescue Exception => e
81
- puts "error running script: #{e.inspect}"
82
- puts e.backtrace.join("\n")
83
- end
84
- File.open("/tmp/runner_#{iteration}.#{pid}", "w+") { |f| Marshal.dump(s, f) }
85
- end
86
- end
87
- end
88
- begin
89
- @pid_stats = Process.waitall # returning an array of pid/status pairs
90
- rescue RestClient::RequestTimeout => e
91
- bench_log "Request timed out #{e}"
92
- end
93
- end
94
- @pid_stats.each do |ps|
95
- 0.upto(iterations - 1) do |iteration|
96
- filename = "/tmp/runner_#{iteration}.#{ps[0]}"
97
- s = Marshal.load(File.open(filename))
98
- @sessions << s
99
- File.delete(filename)
100
- end
101
- end
102
- Bench.sessions = @sessions
103
- Bench.total_time = total_time
104
- end
105
- end
106
- =end
107
-
108
40
  end
109
41
  end
data/bench/lib/bench.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rest_client'
2
- require 'zip/zip'
2
+ require 'zip'
3
3
  require 'securerandom'
4
4
  $:.unshift File.dirname(__FILE__)
5
5
  require 'bench/timer'
@@ -32,10 +32,10 @@ module Bench
32
32
  attr_accessor :total_time, :sessions, :verify_error
33
33
  attr_accessor :adapter_name, :datasize, :result_filename
34
34
  attr_accessor :main_marker, :start_time, :end_time
35
-
35
+
36
36
  # these attributes for distributed testing
37
37
  attr_accessor :processor_id, :save_to_redis, :sync_key
38
-
38
+
39
39
  def config
40
40
  begin
41
41
  @verify_error ||= 0
@@ -45,7 +45,7 @@ module Bench
45
45
  raise e
46
46
  end
47
47
  end
48
-
48
+
49
49
  def synchronize
50
50
  begin
51
51
  yield self
@@ -54,7 +54,7 @@ module Bench
54
54
  raise e
55
55
  end
56
56
  end
57
-
57
+
58
58
  def get_server_license_info
59
59
  token = get_token
60
60
  @body = RestClient.get(
@@ -62,7 +62,7 @@ module Bench
62
62
  {'X-RhoConnect-API-TOKEN' => token, :content_type => :json})
63
63
  JSON.parse(@body.to_s)
64
64
  end
65
-
65
+
66
66
  def get_server_state(doc)
67
67
  token = get_token
68
68
  @body = RestClient.get(
@@ -70,21 +70,21 @@ module Bench
70
70
  {'X-RhoConnect-API-TOKEN' => token})
71
71
  JSON.parse(@body.to_s)
72
72
  end
73
-
73
+
74
74
  def get_server_value(doc)
75
75
  token = get_token
76
76
  @body = RestClient.get(
77
77
  "#{@host}/rc/#{Rhoconnect::API_VERSION}/store/#{doc}",
78
78
  {'X-RhoConnect-API-TOKEN' => token, :content_type => :json})
79
79
  end
80
-
80
+
81
81
  def reset_app
82
82
  RestClient.post(
83
83
  "#{@host}/rc/#{Rhoconnect::API_VERSION}/system/reset",
84
84
  {},
85
85
  {:content_type => :json, 'X-RhoConnect-API-TOKEN' => get_token})
86
86
  end
87
-
87
+
88
88
  def create_user(user_name, password)
89
89
  token = get_token
90
90
  RestClient.post(
@@ -108,7 +108,7 @@ module Bench
108
108
  params.to_json,
109
109
  {'X-RhoConnect-API-TOKEN' => token, :content_type => :json})
110
110
  end
111
-
111
+
112
112
  def reset_refresh_time(source_name,poll_interval=nil)
113
113
  token = get_token
114
114
  RestClient.put(
@@ -116,7 +116,7 @@ module Bench
116
116
  {:poll_interval => poll_interval}.to_json,
117
117
  {'X-RhoConnect-API-TOKEN' => token, :content_type => :json})
118
118
  end
119
-
119
+
120
120
  def set_simulate_time(source_name,simulate_time=0)
121
121
  token = get_token
122
122
  RestClient.put(
@@ -124,7 +124,7 @@ module Bench
124
124
  {:data => {:simulate_time => simulate_time}}.to_json,
125
125
  {'X-RhoConnect-API-TOKEN' => token, :content_type => :json})
126
126
  end
127
-
127
+
128
128
  def get_token
129
129
  unless @token
130
130
  @token = RestClient.post(
@@ -134,7 +134,7 @@ module Bench
134
134
  end
135
135
  @token
136
136
  end
137
-
137
+
138
138
  def get_test_server(app_name = nil)
139
139
  if @base_url.nil?
140
140
  app_name = 'benchapp' unless app_name
@@ -149,22 +149,22 @@ module Bench
149
149
  @host = "#{uri.scheme}://#{uri.host}#{port}"
150
150
  puts "Test server is #{@host}..."
151
151
  end
152
-
152
+
153
153
  def test(&block)
154
154
  Runner.new.test(@concurrency,@iterations,&block)
155
155
  end
156
-
156
+
157
157
  def verify(&block)
158
158
  yield self,@sessions
159
159
  end
160
-
160
+
161
161
  # TODO: These functions are duplicates!
162
-
162
+
163
163
  def compress(path)
164
164
  path.sub!(%r[/$],'')
165
165
  archive = File.join(path,File.basename(path))+'.zip'
166
166
  FileUtils.rm archive, :force=>true
167
- Zip::ZipFile.open(archive, 'w') do |zipfile|
167
+ Zip::File.open(archive, 'w') do |zipfile|
168
168
  Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file|
169
169
  zipfile.add(file.sub(path+'/',''),file)
170
170
  end