rhoconnect 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. data/CHANGELOG +208 -0
  2. data/CREDITS +38 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +97 -0
  5. data/LICENSE +75 -0
  6. data/README.md +10 -0
  7. data/Rakefile +82 -0
  8. data/bench/bench +7 -0
  9. data/bench/bench_runner.rb +112 -0
  10. data/bench/benchapp/Gemfile +21 -0
  11. data/bench/benchapp/Gemfile.lock +76 -0
  12. data/bench/benchapp/Rakefile +22 -0
  13. data/bench/benchapp/application.rb +39 -0
  14. data/bench/benchapp/config.ru +36 -0
  15. data/bench/benchapp/settings/license.key +1 -0
  16. data/bench/benchapp/settings/settings.yml +20 -0
  17. data/bench/benchapp/sources/mock_adapter.rb +55 -0
  18. data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
  19. data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
  20. data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
  21. data/bench/benchapp/spec/spec_helper.rb +42 -0
  22. data/bench/blobapp/Gemfile +31 -0
  23. data/bench/blobapp/Gemfile.lock +103 -0
  24. data/bench/blobapp/Rakefile +25 -0
  25. data/bench/blobapp/application.rb +44 -0
  26. data/bench/blobapp/config.ru +36 -0
  27. data/bench/blobapp/settings/license.key +1 -0
  28. data/bench/blobapp/settings/settings.yml +16 -0
  29. data/bench/blobapp/sources/blob_adapter.rb +71 -0
  30. data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
  31. data/bench/blobapp/spec/spec_helper.rb +42 -0
  32. data/bench/lib/bench/cli.rb +16 -0
  33. data/bench/lib/bench/logging.rb +13 -0
  34. data/bench/lib/bench/mock_client.rb +41 -0
  35. data/bench/lib/bench/result.rb +50 -0
  36. data/bench/lib/bench/runner.rb +107 -0
  37. data/bench/lib/bench/session.rb +67 -0
  38. data/bench/lib/bench/statistics.rb +56 -0
  39. data/bench/lib/bench/test_data.rb +98 -0
  40. data/bench/lib/bench/timer.rb +10 -0
  41. data/bench/lib/bench/utils.rb +49 -0
  42. data/bench/lib/bench.rb +129 -0
  43. data/bench/lib/testdata/100-data.txt +148 -0
  44. data/bench/lib/testdata/5-data.txt +9 -0
  45. data/bench/lib/testdata/images/icon.ico +0 -0
  46. data/bench/lib/testdata/images/icon.png +0 -0
  47. data/bench/lib/testdata/images/loading-Landscape.png +0 -0
  48. data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
  49. data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
  50. data/bench/lib/testdata/images/loading-Portrait.png +0 -0
  51. data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
  52. data/bench/lib/testdata/images/loading.png +0 -0
  53. data/bench/lib/testdata/images/loading@2x.png +0 -0
  54. data/bench/run_bench.sh +42 -0
  55. data/bench/run_blob_script.sh +3 -0
  56. data/bench/run_cud_script.sh +3 -0
  57. data/bench/run_query_md_script.sh +3 -0
  58. data/bench/run_query_only_script.sh +3 -0
  59. data/bench/run_query_script.sh +3 -0
  60. data/bench/scripts/blob_cud_script.rb +98 -0
  61. data/bench/scripts/cud_script.rb +92 -0
  62. data/bench/scripts/helpers.rb +101 -0
  63. data/bench/scripts/query_md_script.rb +45 -0
  64. data/bench/scripts/query_only_script.rb +51 -0
  65. data/bench/scripts/query_script.rb +45 -0
  66. data/bench/spec/bench_spec_helper.rb +33 -0
  67. data/bench/spec/logging_spec.rb +15 -0
  68. data/bench/spec/mock_adapter_spec.rb +61 -0
  69. data/bench/spec/mock_client_spec.rb +65 -0
  70. data/bench/spec/result_spec.rb +61 -0
  71. data/bench/spec/utils_spec.rb +36 -0
  72. data/bin/rhoconnect +34 -0
  73. data/bin/rhoconnect-setup +84 -0
  74. data/doc/async-jobs.txt +69 -0
  75. data/doc/authentication.txt +76 -0
  76. data/doc/benchmarks.txt +168 -0
  77. data/doc/blob-sync.txt +130 -0
  78. data/doc/bulk-sync.txt +102 -0
  79. data/doc/client.txt +432 -0
  80. data/doc/command-line.txt +210 -0
  81. data/doc/contributing.txt +60 -0
  82. data/doc/deploying.txt +82 -0
  83. data/doc/install.txt +28 -0
  84. data/doc/introduction.txt +20 -0
  85. data/doc/licensing.txt +18 -0
  86. data/doc/metadata.txt +458 -0
  87. data/doc/migration.txt +182 -0
  88. data/doc/public/css/print.css +29 -0
  89. data/doc/public/css/screen.css +257 -0
  90. data/doc/public/css/style.css +20 -0
  91. data/doc/push.txt +135 -0
  92. data/doc/release.txt +41 -0
  93. data/doc/rest-api.txt +367 -0
  94. data/doc/source-adapters.txt +325 -0
  95. data/doc/stats-middleware.txt +69 -0
  96. data/doc/testing.txt +222 -0
  97. data/doc/tutorial.txt +315 -0
  98. data/doc/web-console.txt +35 -0
  99. data/examples/simple/Rakefile +14 -0
  100. data/examples/simple/application.rb +27 -0
  101. data/examples/simple/config.ru +49 -0
  102. data/examples/simple/settings/license.key +1 -0
  103. data/examples/simple/settings/settings.yml +23 -0
  104. data/examples/simple/sources/sample_adapter.rb +5 -0
  105. data/examples/simple/sources/simple_adapter.rb +5 -0
  106. data/generators/rhoconnect.rb +119 -0
  107. data/generators/templates/application/Gemfile +21 -0
  108. data/generators/templates/application/Rakefile +22 -0
  109. data/generators/templates/application/application.rb +39 -0
  110. data/generators/templates/application/config.ru +36 -0
  111. data/generators/templates/application/settings/license.key +1 -0
  112. data/generators/templates/application/settings/settings.yml +14 -0
  113. data/generators/templates/application/spec/spec_helper.rb +42 -0
  114. data/generators/templates/source/source_adapter.rb +47 -0
  115. data/generators/templates/source/source_spec.rb +25 -0
  116. data/install.sh +408 -0
  117. data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
  118. data/installer/unix-like/rho_connect_install_constants.rb +51 -0
  119. data/installer/unix-like/rho_connect_install_debian.rb +63 -0
  120. data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
  121. data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
  122. data/installer/unix-like/rho_connect_install_installers.rb +142 -0
  123. data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
  124. data/installer/unix-like/rho_connect_install_yum.rb +63 -0
  125. data/installer/unix-like/rhoinstaller.rb +89 -0
  126. data/installer/utils/create_texts.rb +366 -0
  127. data/installer/utils/install_test.rb +140 -0
  128. data/installer/windows/EnvVarUpdate.nsh +328 -0
  129. data/installer/windows/ServiceLib.nsh +369 -0
  130. data/installer/windows/configUi.ini +44 -0
  131. data/installer/windows/icon.ico +0 -0
  132. data/installer/windows/rhosync.nsi +418 -0
  133. data/installer/windows/uninstall.bat +7 -0
  134. data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
  135. data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
  136. data/lib/rhoconnect/api/admin/login.rb +6 -0
  137. data/lib/rhoconnect/api/admin/reset.rb +10 -0
  138. data/lib/rhoconnect/api/admin/stats.rb +21 -0
  139. data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
  140. data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
  141. data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
  142. data/lib/rhoconnect/api/application/clientregister.rb +6 -0
  143. data/lib/rhoconnect/api/application/clientreset.rb +6 -0
  144. data/lib/rhoconnect/api/application/query.rb +7 -0
  145. data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
  146. data/lib/rhoconnect/api/application/search.rb +6 -0
  147. data/lib/rhoconnect/api/client/create_client.rb +3 -0
  148. data/lib/rhoconnect/api/client/delete_client.rb +5 -0
  149. data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
  150. data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
  151. data/lib/rhoconnect/api/client/list_clients.rb +3 -0
  152. data/lib/rhoconnect/api/client/ping.rb +7 -0
  153. data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
  154. data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
  155. data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
  156. data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
  157. data/lib/rhoconnect/api/source/list_sources.rb +15 -0
  158. data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
  159. data/lib/rhoconnect/api/source/push_objects.rb +8 -0
  160. data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
  161. data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
  162. data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
  163. data/lib/rhoconnect/api/source/upload_file.rb +4 -0
  164. data/lib/rhoconnect/api/user/create_user.rb +7 -0
  165. data/lib/rhoconnect/api/user/delete_user.rb +9 -0
  166. data/lib/rhoconnect/api/user/list_users.rb +3 -0
  167. data/lib/rhoconnect/api/user/update_user.rb +4 -0
  168. data/lib/rhoconnect/api_token.rb +19 -0
  169. data/lib/rhoconnect/app.rb +76 -0
  170. data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
  171. data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
  172. data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
  173. data/lib/rhoconnect/bulk_data.rb +2 -0
  174. data/lib/rhoconnect/client.rb +96 -0
  175. data/lib/rhoconnect/client_sync.rb +412 -0
  176. data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
  177. data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
  178. data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
  179. data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
  180. data/lib/rhoconnect/console/app/public/home.css +438 -0
  181. data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
  182. data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
  183. data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
  184. data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
  185. data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
  186. data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
  187. data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
  188. data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
  189. data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
  190. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
  191. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
  192. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
  193. data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
  194. data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
  195. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
  196. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
  197. data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
  198. data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
  199. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
  200. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
  201. data/lib/rhoconnect/console/app/public/main.css +7 -0
  202. data/lib/rhoconnect/console/app/public/reset.css +76 -0
  203. data/lib/rhoconnect/console/app/public/style.css +2201 -0
  204. data/lib/rhoconnect/console/app/public/text.txt +0 -0
  205. data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
  206. data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
  207. data/lib/rhoconnect/console/app/routes/client.rb +31 -0
  208. data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
  209. data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
  210. data/lib/rhoconnect/console/app/routes/home.rb +63 -0
  211. data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
  212. data/lib/rhoconnect/console/app/routes/user.rb +117 -0
  213. data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
  214. data/lib/rhoconnect/console/app/views/client.erb +30 -0
  215. data/lib/rhoconnect/console/app/views/content.erb +14 -0
  216. data/lib/rhoconnect/console/app/views/doc.erb +8 -0
  217. data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
  218. data/lib/rhoconnect/console/app/views/docs.erb +30 -0
  219. data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
  220. data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
  221. data/lib/rhoconnect/console/app/views/home.erb +24 -0
  222. data/lib/rhoconnect/console/app/views/index.erb +58 -0
  223. data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
  224. data/lib/rhoconnect/console/app/views/layout.erb +165 -0
  225. data/lib/rhoconnect/console/app/views/login.erb +26 -0
  226. data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
  227. data/lib/rhoconnect/console/app/views/ping.erb +28 -0
  228. data/lib/rhoconnect/console/app/views/result.erb +11 -0
  229. data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
  230. data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
  231. data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
  232. data/lib/rhoconnect/console/app/views/user.erb +29 -0
  233. data/lib/rhoconnect/console/app/views/users.erb +12 -0
  234. data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
  235. data/lib/rhoconnect/console/server.rb +32 -0
  236. data/lib/rhoconnect/console.rb +3 -0
  237. data/lib/rhoconnect/cors.rb +229 -0
  238. data/lib/rhoconnect/credential.rb +9 -0
  239. data/lib/rhoconnect/db_adapter.rb +46 -0
  240. data/lib/rhoconnect/document.rb +49 -0
  241. data/lib/rhoconnect/dynamic_adapter.rb +91 -0
  242. data/lib/rhoconnect/generator.rb +1 -0
  243. data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
  244. data/lib/rhoconnect/jobs/ping_job.rb +46 -0
  245. data/lib/rhoconnect/jobs/source_job.rb +16 -0
  246. data/lib/rhoconnect/license.rb +86 -0
  247. data/lib/rhoconnect/lock_ops.rb +11 -0
  248. data/lib/rhoconnect/model.rb +414 -0
  249. data/lib/rhoconnect/ping/android.rb +56 -0
  250. data/lib/rhoconnect/ping/apple.rb +52 -0
  251. data/lib/rhoconnect/ping/blackberry.rb +56 -0
  252. data/lib/rhoconnect/ping.rb +3 -0
  253. data/lib/rhoconnect/read_state.rb +31 -0
  254. data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
  255. data/lib/rhoconnect/server/views/index.erb +13 -0
  256. data/lib/rhoconnect/server.rb +286 -0
  257. data/lib/rhoconnect/source.rb +289 -0
  258. data/lib/rhoconnect/source_adapter.rb +123 -0
  259. data/lib/rhoconnect/source_sync.rb +302 -0
  260. data/lib/rhoconnect/stats/middleware.rb +20 -0
  261. data/lib/rhoconnect/stats/record.rb +108 -0
  262. data/lib/rhoconnect/store.rb +232 -0
  263. data/lib/rhoconnect/tasks.rb +350 -0
  264. data/lib/rhoconnect/test_methods.rb +220 -0
  265. data/lib/rhoconnect/user.rb +95 -0
  266. data/lib/rhoconnect/version.rb +3 -0
  267. data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
  268. data/lib/rhoconnect.rb +285 -0
  269. data/rhoconnect.gemspec +67 -0
  270. data/spec/api/admin/api_token_spec.rb +14 -0
  271. data/spec/api/admin/get_api_token_spec.rb +36 -0
  272. data/spec/api/admin/get_license_info_spec.rb +38 -0
  273. data/spec/api/admin/reset_spec.rb +22 -0
  274. data/spec/api/admin/stats_spec.rb +66 -0
  275. data/spec/api/api_helper.rb +21 -0
  276. data/spec/api/application/rhoconnect_api_spec.rb +548 -0
  277. data/spec/api/client/create_client_spec.rb +13 -0
  278. data/spec/api/client/delete_client_spec.rb +13 -0
  279. data/spec/api/client/get_client_params_spec.rb +18 -0
  280. data/spec/api/client/list_client_docs_spec.rb +32 -0
  281. data/spec/api/client/list_clients_spec.rb +22 -0
  282. data/spec/api/client/ping_spec.rb +23 -0
  283. data/spec/api/rhosync_api_spec.rb.orig +606 -0
  284. data/spec/api/source/adapter_spec.rb +29 -0
  285. data/spec/api/source/get_db_doc_spec.rb +21 -0
  286. data/spec/api/source/get_source_params_spec.rb +32 -0
  287. data/spec/api/source/list_source_docs_spec.rb +25 -0
  288. data/spec/api/source/list_sources_spec.rb +26 -0
  289. data/spec/api/source/push_deletes_spec.rb +18 -0
  290. data/spec/api/source/push_objects_spec.rb +27 -0
  291. data/spec/api/source/set_db_doc_spec.rb +19 -0
  292. data/spec/api/source/set_refresh_time_spec.rb +43 -0
  293. data/spec/api/source/upload_file_spec.rb +26 -0
  294. data/spec/api/user/create_user_spec.rb +16 -0
  295. data/spec/api/user/delete_user_spec.rb +36 -0
  296. data/spec/api/user/list_users_spec.rb +30 -0
  297. data/spec/api/user/update_user_spec.rb +31 -0
  298. data/spec/api_token_spec.rb +14 -0
  299. data/spec/app_spec.rb +18 -0
  300. data/spec/apps/emptyapp/application.rb +27 -0
  301. data/spec/apps/emptyapp/settings/license.key +1 -0
  302. data/spec/apps/emptyapp/settings/settings.yml +14 -0
  303. data/spec/apps/rhotestapp/Rakefile +1 -0
  304. data/spec/apps/rhotestapp/application.rb +19 -0
  305. data/spec/apps/rhotestapp/config.ru +1 -0
  306. data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
  307. data/spec/apps/rhotestapp/settings/license.key +1 -0
  308. data/spec/apps/rhotestapp/settings/settings.yml +36 -0
  309. data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
  310. data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
  311. data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
  312. data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
  313. data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
  314. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
  315. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
  316. data/spec/bulk_data/bulk_data_spec.rb +97 -0
  317. data/spec/client_spec.rb +124 -0
  318. data/spec/client_sync_spec.rb +774 -0
  319. data/spec/doc/base.html +72 -0
  320. data/spec/doc/doc_spec.rb +376 -0
  321. data/spec/doc/footer.html +4 -0
  322. data/spec/doc/header.html +30 -0
  323. data/spec/document_spec.rb +31 -0
  324. data/spec/dynamic_adapter_spec.rb +43 -0
  325. data/spec/factories/factories.rb +17 -0
  326. data/spec/generator/generator_spec.rb +58 -0
  327. data/spec/generator/generator_spec_helper.rb +9 -0
  328. data/spec/jobs/bulk_data_job_spec.rb +125 -0
  329. data/spec/jobs/ping_job_spec.rb +102 -0
  330. data/spec/jobs/source_job_spec.rb +29 -0
  331. data/spec/license_spec.rb +66 -0
  332. data/spec/model_spec.rb +273 -0
  333. data/spec/perf/bulk_data_perf_spec.rb +32 -0
  334. data/spec/perf/perf_spec_helper.rb +50 -0
  335. data/spec/perf/store_perf_spec.rb +27 -0
  336. data/spec/ping/android_spec.rb +91 -0
  337. data/spec/ping/apple_spec.rb +70 -0
  338. data/spec/ping/blackberry_spec.rb +62 -0
  339. data/spec/read_state_spec.rb +35 -0
  340. data/spec/rhosync_spec.rb +75 -0
  341. data/spec/server/cors_spec.rb +287 -0
  342. data/spec/server/server_spec.rb +470 -0
  343. data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
  344. data/spec/source_adapter_spec.rb +125 -0
  345. data/spec/source_spec.rb +114 -0
  346. data/spec/source_sync_spec.rb +328 -0
  347. data/spec/spec.opts +4 -0
  348. data/spec/spec_helper.rb +231 -0
  349. data/spec/stats/middleware_spec.rb +53 -0
  350. data/spec/stats/record_spec.rb +92 -0
  351. data/spec/store_spec.rb +251 -0
  352. data/spec/support/shared_examples.rb +168 -0
  353. data/spec/sync_states_spec.rb +72 -0
  354. data/spec/test_methods_spec.rb +134 -0
  355. data/spec/testdata/1000-data.txt +1414 -0
  356. data/spec/testdata/compressed/compress-data.txt +1 -0
  357. data/spec/testdata/upload1.txt +1 -0
  358. data/spec/testdata/upload2.txt +1 -0
  359. data/spec/user_spec.rb +139 -0
  360. data/tasks/redis.rake +206 -0
  361. metadata +706 -0
@@ -0,0 +1,129 @@
1
+ require 'rest_client'
2
+ require 'json'
3
+ require 'zip/zip'
4
+ $:.unshift File.dirname(__FILE__)
5
+ require 'bench/timer'
6
+ require 'bench/logging'
7
+ require 'bench/utils'
8
+ require 'bench/result'
9
+ require 'bench/session'
10
+ require 'bench/runner'
11
+ require 'bench/statistics'
12
+ require 'bench/cli'
13
+ require 'bench/test_data'
14
+ $:.unshift File.join(File.dirname(__FILE__),'..')
15
+ require 'scripts/helpers'
16
+
17
+ $:.unshift File.join(File.dirname(__FILE__),'..','..','..','lib')
18
+ require 'rhoconnect'
19
+
20
+ # Inspired by Trample: http://github.com/jamesgolick/trample
21
+
22
+ module Bench
23
+ class << self
24
+ include Logging
25
+ include TestData
26
+ include Utils
27
+
28
+ attr_accessor :concurrency, :iterations, :admin_login
29
+ attr_accessor :admin_password, :user_name
30
+ attr_accessor :password, :host, :base_url, :token
31
+ attr_accessor :total_time, :sessions, :verify_error
32
+ attr_accessor :adapter_name
33
+
34
+ def config
35
+ begin
36
+ @verify_error ||= 0
37
+ yield self
38
+ rescue Exception => e
39
+ puts "error in config: #{e.inspect}"
40
+ raise e
41
+ end
42
+ end
43
+
44
+ def get_server_state(doc)
45
+ token = get_token
46
+ @body = RestClient.post("#{@host}/api/source/get_db_doc",
47
+ {:api_token => token, :doc => doc}.to_json, :content_type => :json)
48
+ JSON.parse(@body.to_s)
49
+ end
50
+
51
+ def reset_app
52
+ RestClient.post("#{@host}/api/admin/reset",{:api_token => get_token}.to_json, :content_type => :json)
53
+ end
54
+
55
+ def create_user(user_name, password)
56
+ token = get_token
57
+ RestClient.post("#{@host}/api/user/create_user",
58
+ {:api_token => token, :app_name => @app_name,
59
+ :attributes => {:login => user_name, :password => password}}.to_json,
60
+ :content_type => :json)
61
+ end
62
+
63
+ def set_server_state(doc,data)
64
+ token = get_token
65
+ RestClient.post("#{@host}/api/source/set_db_doc",
66
+ {:api_token => token, :doc => doc, :data => data}.to_json, :content_type => :json)
67
+ end
68
+
69
+ def reset_refresh_time(source_name,poll_interval=nil)
70
+ token = get_token
71
+ RestClient.post("#{@host}/api/source/set_refresh_time",
72
+ {:api_token => token, :source_name => source_name,
73
+ :user_name => @user_name,
74
+ :poll_interval => poll_interval}.to_json,
75
+ :content_type => :json)
76
+ end
77
+
78
+ def get_token
79
+ unless @token
80
+ @token = RestClient.post("#{@host}/api/admin/login",
81
+ {:login => @admin_login, :password => @admin_password}.to_json, :content_type => :json)
82
+ end
83
+ @token
84
+ end
85
+
86
+ def get_test_server(app_name = nil)
87
+ app_name = 'benchapp' unless app_name
88
+ load_settings(File.join(File.dirname(__FILE__),'..',app_name,'settings','settings.yml'))
89
+ @base_url = $settings[:development][:syncserver].gsub(/\/$/,'')
90
+ uri = URI.parse(@base_url)
91
+ port = (uri.port and uri.port != 80) ? ":"+uri.port.to_s : ""
92
+ @host = "#{uri.scheme}://#{uri.host}#{port}"
93
+ puts "Test server is #{@host}..."
94
+ end
95
+
96
+ def test(&block)
97
+ Runner.new.test(@concurrency,@iterations,&block)
98
+ end
99
+
100
+ def verify(&block)
101
+ yield self,@sessions
102
+ end
103
+
104
+ # TODO: These functions are duplicates!
105
+
106
+ def compress(path)
107
+ path.sub!(%r[/$],'')
108
+ archive = File.join(path,File.basename(path))+'.zip'
109
+ FileUtils.rm archive, :force=>true
110
+ Zip::ZipFile.open(archive, 'w') do |zipfile|
111
+ Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file|
112
+ zipfile.add(file.sub(path+'/',''),file)
113
+ end
114
+ end
115
+ archive
116
+ end
117
+
118
+ # TODO: Share this code with the framework Rho class
119
+ def load_settings(file)
120
+ begin
121
+ $settings = YAML.load_file(file)
122
+ rescue Exception => e
123
+ puts "Error opening settings file #{file}: #{e}."
124
+ puts e.backtrace.join("\n")
125
+ raise e
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,148 @@
1
+ {i"%c08391d273254acda969beca963b2cbc{ "
2
+ Jairo" Phone1"697.236.6498" Company"Lakin and Sons" mock_id"%c08391d273254acda969beca963b2cbc"
3
+ Email"stone_quigley@gmail.com"%d700d3dad9cb4bfab569a444a9410f3a{ @"
4
+ Zieme@
5
+ "General Mechanic@ "
6
+ "Production Mechanic@ "
7
+ Amely@"108.018.6096 x4892@"!Pfeffer, Carroll and Lockman@"%29247590f6754aaaabf1d9db8beffa0b@"lawrence_dibbert@gmail.com"%59669d5da6c746d886544152b3e39577{ @"
8
+ Price@
9
+ "IT Analyst@ " Anthony@"449-900-6658 x047@""Leffler, Kilback and Homenick@"%59669d5da6c746d886544152b3e39577@"winston@yahoo.com"%5f815f4ccd8546fb8fdd53a09baaf8f0{ @"Halvorson@
10
+ "Quality Assurance Worker@ " Cathryn@"(851)759-4738 x95349@"Carroll LLC@"%5f815f4ccd8546fb8fdd53a09baaf8f0@"elenor@gmail.com"%94f40e319ebb4e88bf764e464349742f{ @" Cronin@
11
+ "Banking Technician@ "
12
+ Anais@"1-657-604-9806@"Reichert-Miller@"%94f40e319ebb4e88bf764e464349742f@"clemmie_hilll@yahoo.com"%e3db716887d14cd89a57d5c12490d57f{ @"Hodkiewicz@
13
+ "Advertising Superintendent@ " Izaiah@"(883)720-9926 x501@"Bartoletti-Hayes@"%e3db716887d14cd89a57d5c12490d57f@"aleen@yahoo.com"%f48556f5a0d44b59bafe8d89a9e7ccfc{ @" Ryan@
14
+ "Software Sales@ " Briana@"998-206-2552@"Klein-Zemlak@"%f48556f5a0d44b59bafe8d89a9e7ccfc@" sherwood.schinner@yahoo.com"%ad3fcad52002417dae5fdd29152262e7{ @" Mraz@
15
+ "Computer Superintendent@ " Curtis@"992-665-1817 x4787@"Lemke LLC@"%ad3fcad52002417dae5fdd29152262e7@"virgil@yahoo.com"%8afe2fdc114546128d1a9448c909ade1{ @" Durgan@
16
+ "Advertising Recruiter@ " Reva@"(140)525-3753@"Funk-Hintz@"%8afe2fdc114546128d1a9448c909ade1@"amir_renner@yahoo.com"%147184c0d468478f8a918e8a2eb2c00d{ @"O'Connell@
17
+ "Head Technician@ "
18
+ "Environmental Technician@ " Keaton@"922.367.5492 x44104@"Steuber, Orn and Conn@"%b59e4095d4024b7b8c53779c19fb365f@"darion.hand@yahoo.com"%114d5402385447ea831dc7c271f40cba{ @" Kessler@
19
+ "Assistant Superintendent@ "
20
+ Sarai@"(138)199-0332 x486@"Tillman-Prosacco@"%114d5402385447ea831dc7c271f40cba@"issac@yahoo.com"%6e2b6e694d0b425fbb83655ad1f57cfb{ @" Hudson@
21
+ "Laboratory Analyst@ " Diamond@"462.945.1432@"Boyle LLC@"%6e2b6e694d0b425fbb83655ad1f57cfb@"noah_okon@hotmail.com"%eb1b92d1f08844c486f2cd6f51166cad{ @"
22
+ Kutch@
23
+ "Senior Director@ "
24
+ Elyse@"1-206-345-6753 x8321@"Rohan-Powlowski@"%eb1b92d1f08844c486f2cd6f51166cad@"$kaitlyn_oberbrunner@hotmail.com"%e3a5ea4393124d53b25642db0d4f1d10{ @" Kuhn@
25
+ "Computer Foreman@ "
26
+ Trace@"1-195-038-8248 x176@"Bins-Pollich@"%e3a5ea4393124d53b25642db0d4f1d10@"jonathon.johns@hotmail.com"%003a882e004a4e85a8d3907341d270f6{ @" Klocko@
27
+ "Business Systems Recruiter@ " Virgil@"013.811.2613@"Zulauf, Zieme and Hilpert@"%003a882e004a4e85a8d3907341d270f6@"cayla_howell@gmail.com"%c10b369f628f44b39fa107783f0b0d2a{ @"
28
+ Weber@
29
+ "Senior Intern@ " Cortney@"(825)485-4328 x0372@"!Renner, Halvorson and Beatty@"%c10b369f628f44b39fa107783f0b0d2a@"maude@gmail.com"%89cf22da94c342db8419baeea8ed1732{ @" Walker@
30
+ "Medical Foreman@ " Eliane@"(048)916-0870 x354@"Mueller Group@"%89cf22da94c342db8419baeea8ed1732@"maureen@gmail.com"%b3f460a48f6a4c2c931b7c791cfc46a5{ @"
31
+ "Production Supervisor@ " Karlee@"011.847.2219 x94537@"Swaniawski Inc@"%b3f460a48f6a4c2c931b7c791cfc46a5@"mike.tromp@hotmail.com"%40bd6ca50b4e46ca94fb635f0690175f{ @"
32
+ Moore@
33
+ "Computer Engineer@ " Newell@"637-104-0330@"Cole-Kuhic@"%40bd6ca50b4e46ca94fb635f0690175f@"elmer@hotmail.com"%d3cc69213354468bb41d13482de24b00{ @" Jacobs@
34
+ "Computer Clerk@ " Khalid@"547.229.1460 x3883@"Nader Inc@"%d3cc69213354468bb41d13482de24b00@"ruthie_bayer@yahoo.com"%575618451bcd4cfeafd6ed84b943d693{ @"
35
+ "Software Technician@ " Carolyn@"920.318.5572 x19291@"Bernhard, Renner and Blick@"%575618451bcd4cfeafd6ed84b943d693@"benedict.purdy@hotmail.com"%9ee3605d57574d83b40f05285cec842f{ @"
36
+ Fahey@
37
+ "Account Manager@ " Maryam@"793.268.6813@"$Hermiston, Parisian and Monahan@"%9ee3605d57574d83b40f05285cec842f@"zelda.schaefer@yahoo.com"%3d62f8faff1c40f4909744b76c2a3553{ @"Buckridge@
38
+ "Environmental Recruiter@ "
39
+ "Environmental Estimator@ "
40
+ Ricky@"(340)038-5363@"Kautzer-Reilly@"%5ab0df9d5c684b2dbc2c9a6e27d014c6@"!keagan.buckridge@hotmail.com"%8dbba6c19cf94cf6b6beb0d1317f004d{ @"
41
+ Wolff@
42
+ "Environmental Supervisor@ " Gabriel@"1-724-037-7432 x56679@"Robel-Littel@"%8dbba6c19cf94cf6b6beb0d1317f004d@"adriana@yahoo.com"%2e6c0336f122470a9a96683160dcc9a7{ @" Bode@
43
+ "Administrative Sales@ " Ruby@"075.155.4874 x7247@"Huels Inc@"%2e6c0336f122470a9a96683160dcc9a7@"kylee@hotmail.com"%fdc22cf713d6478dad676faff5227e75{ @" Hermann@
44
+ "Head Helper@ "
45
+ "Administrative Worker@ "Celestine@"978.385.5848 x40815@"#Bins, Mosciski and Greenfelder@"%fd624cb38fda4c50bd8e73e8235bf593@"kieran@yahoo.com"%68b1dff75cfb42f7b246962101c9f1fb{ @" Lowe@
46
+ "%Quality Assurance Superintendent@ " Hillard@"169-059-1767@"Ritchie Group@"%68b1dff75cfb42f7b246962101c9f1fb@"selina@gmail.com"%7239cb4e983c4d2bb15d6d7641d5e674{ @" Streich@
47
+ "Senior Foreman@ " Katelyn@"546-882-7260 x300@"Yundt, Wuckert and Brakus@"%7239cb4e983c4d2bb15d6d7641d5e674@"esteban@yahoo.com"%9836b54de3d7481c9e56ab9a7a629550{ @"Morissette@
48
+ "Senior Accountant@ " Estella@"378.589.0480@""Homenick, Kassulke and Hessel@"%9836b54de3d7481c9e56ab9a7a629550@"phoebe@gmail.com"%2d1dfeac65034bd8a1f2b2b5a325bf90{ @"
49
+ "Medical Intern@ "Nicolette@"539-835-1470@"Marvin-Wunsch@"%2d1dfeac65034bd8a1f2b2b5a325bf90@" moriah_prohaska@hotmail.com"%2936b3ac3ee5446785356472f5258294{ @" Pfeffer@
50
+ "Distribution Recruiter@ "
51
+ "Software Executive@ "
52
+ Molly@"1-335-818-1533@"Weimann-O'Conner@"%b3f232e36b614191a859e325978d6429@"vivien.maggio@yahoo.com"%ee904f25e7e14ef99ae67d54113e4ad8{ @"Heathcote@
53
+ "Business Systems Worker@ "
54
+ Naomi@"753.363.0014@""Towne, Runolfsson and Okuneva@"%ee904f25e7e14ef99ae67d54113e4ad8@"kirsten@gmail.com"%6757eb3520644a4690a5bd9b199540a1{ @" Labadie@
55
+ "(Environmental Production Supervisor@ " Crystel@"021.780.4609 x47390@"%VonRueden, Lubowitz and Bogisich@"%6757eb3520644a4690a5bd9b199540a1@"cheyanne.lind@gmail.com"%8cbb0282ca834eaf9d497ea283d7e72c{ @" Schmitt@
56
+ "Production Officer@ "
57
+ "Technical Technician@ " Kale@"178-707-7142@"Haag Group@"%1a2fbceff2e14d79befe366aa55a9313@"velda@yahoo.com"%61c848e2babb4a43a39d64ceb52a4a61{ @" D'Amore@
58
+ "Laboratory Clerk@ "
59
+ Jayme@"(710)546-3261@"Quigley and Sons@"%61c848e2babb4a43a39d64ceb52a4a61@"brenna.rath@yahoo.com"%d893299dbcae406f94d5016a03c88b28{ @" Howe@
60
+ "Quality Assurance Sales@ "
61
+ Diana@"821.431.9270@"Powlowski-Fritsch@"%d893299dbcae406f94d5016a03c88b28@"jairo.nicolas@yahoo.com"%7db54de7cba64988923a1b2b87d8d32f{ @" Hamill@
62
+ "Computer Technologist@ " Kaitlin@"568-993-8201 x61082@"Bergnaum, Klein and Larkin@"%7db54de7cba64988923a1b2b87d8d32f@"may@yahoo.com"%b4811acda932474db3951eb518e3c5bc{ @" Maggio@
63
+ "General Planner@ " Ramiro@"(151)332-7848 x40109@"Glover Inc@"%b4811acda932474db3951eb518e3c5bc@"andreanne@hotmail.com"%3ffc68c35d1d41df8da8499e16713699{ @"
64
+ "Head Sales@ "
65
+ Laura@"(259)896-3850 x0309@"Emard and Sons@"%3ffc68c35d1d41df8da8499e16713699@"erik@gmail.com"%1a811060e3624799a40d00f8428e48d4{ @"
66
+ Kunde@
67
+ "Production Clerk@ " Melvina@"1-895-950-4971@"!Haley, Cummerata and Goldner@"%1a811060e3624799a40d00f8428e48d4@"mark.kuhlman@yahoo.com"%8c694501afa14d679f4abd84e32c1a97{ @"
68
+ "Production Worker@ "Cassandra@"1-985-386-5359@"$Steuber, Denesik and Schowalter@"%8c694501afa14d679f4abd84e32c1a97@"mariah_mayert@hotmail.com"%a2f831ea41814501929df177f400ae56{ @"Cummerata@
69
+ "Distribution Scientist@ "
70
+ Baron@"1-683-024-9321@"Gutkowski LLC@"%a2f831ea41814501929df177f400ae56@"cecilia@hotmail.com"%f91562cbcc8349ac951e4513ac2ae0ce{ @"Heidenreich@
71
+ "!Administrative Plant Manager@ "
72
+ "$Business Systems Superintendent@ " Melany@"064.188.5891 x968@" Wilkinson, Jacobi and Bosco@"%b1fddefda07f4525841ad8b038e76a30@"larry@hotmail.com"%053e2c7ca3034a55921bc6daf60b9a1a{ @" Lowe@
73
+ "Assistant Intern@ " Kendra@"890-184-8673 x4198@"Wolff LLC@"%053e2c7ca3034a55921bc6daf60b9a1a@" cletus_konopelski@yahoo.com"%0ae90d4403fc4700824905df3a37eb1c{ @" Weimann@
74
+ "Financial Recruiter@ "
75
+ Devon@"1-731-894-6556 x046@"Stark, Krajcik and Strosin@"%0ae90d4403fc4700824905df3a37eb1c@"orval@hotmail.com"%ecf34a4626de4f179962295b21212d80{ @" Leffler@
76
+ "General Engineer@ " Jettie@"090-951-5426@"Mertz Inc@"%ecf34a4626de4f179962295b21212d80@"audra@yahoo.com"%ba5a858326954d5a9cbd9d6b38bb0c74{ @" Treutel@
77
+ "Financial Accountant@ "
78
+ Jamar@"1-081-970-6940@"Grady-Schuppe@"%ba5a858326954d5a9cbd9d6b38bb0c74@"abigail@hotmail.com"%23e1a729d9a44154af47ede1c59401b7{ @"
79
+ O'Kon@
80
+ "Environmental Officer@ " Cali@"1-873-569-4080 x32697@"Rowe, Homenick and Boehm@"%23e1a729d9a44154af47ede1c59401b7@"nona@hotmail.com"%142d35cda45b432e9c163b5bc56456ae{ @"
81
+ "General Sales@ " Cruz@"723-073-9751 x0796@"Weimann-Terry@"%142d35cda45b432e9c163b5bc56456ae@"anthony@gmail.com"%6f3d68974bbf487180733ecdc343e3f9{ @" Volkman@
82
+ "Account Vice President@ " Korbin@"051.835.8273 x949@"Vandervort-Mertz@"%6f3d68974bbf487180733ecdc343e3f9@"brionna_miller@hotmail.com"%c900681c5b7144efa8e1628a46a3da18{ @" Huel@
83
+ "Quality Assurance Buyer@ "
84
+ Laura@"1-597-568-5049 x030@"Mraz, Ruecker and Quigley@"%c900681c5b7144efa8e1628a46a3da18@"destini@hotmail.com"%2e29702dddfd4c52af3a6b98779fae35{ @" Schmitt@
85
+ "Technical Vice President@ " Jamaal@"(623)162-4944 x58440@"Shields, Block and Lehner@"%2e29702dddfd4c52af3a6b98779fae35@"demarcus@gmail.com"%8dce66fd8bdf49dbbe355c7f51414c12{ @"
86
+ Blick@
87
+ "Assistant Accountant@ " Jaycee@"(145)183-8650 x40103@"Bogisich and Sons@"%8dce66fd8bdf49dbbe355c7f51414c12@"oral_wyman@gmail.com"%480612d511694c868ec2667a0cf9e600{ @"Hermiston@
88
+ ""Business Systems Technologist@ "
89
+ Jayda@"859.182.5818 x8059@"Langworth Inc@"%480612d511694c868ec2667a0cf9e600@"sherman@hotmail.com"%1f9356e0e3274e2ab5f3873b1476f41e{ @"McLaughlin@
90
+ "Maintenance Clerk@ " Devonte@"060-037-1615 x134@"#Dietrich, Greenholt and Reilly@"%1f9356e0e3274e2ab5f3873b1476f41e@"beth@hotmail.com"%e44b1458c24b449ab6ce9238010c92c9{ @" Cronin@
91
+ "Medical Nurse@ " Darrel@"(885)689-0185@"Rippin-Purdy@"%e44b1458c24b449ab6ce9238010c92c9@"savannah@yahoo.com"%dc09a77040f04afd82ca282ac94aaa93{ @" Bins@
92
+ "Chief Chef@ " Alva@"281-100-2650@"Bailey-Eichmann@"%dc09a77040f04afd82ca282ac94aaa93@"juwan_herman@gmail.com"%071e6d0df05a46419490d0b69bf1629f{ @" Walter@
93
+ "Account Technician@ "Pat@"978-131-1170 x029@""Beahan, Daugherty and Johnson@"%071e6d0df05a46419490d0b69bf1629f@"herman@gmail.com"%867e6c99fa044be0bf6d666729a2efb8{ @"
94
+ Hills@
95
+ ""Administrative Superintendent@ "
96
+ "Laboratory Director@ " Ebba@"(089)520-0655 x154@"Hilll LLC@"%d4285b651f4e4f58bbfa4ab3567ee474@"amari@gmail.com"%b7c5acd0f7a54c31bdda56e227b09acc{ @"Cartwright@
97
+ "Maintenance Mechanic@ " Sallie@"(101)460-9042@"Abshire and Sons@"%b7c5acd0f7a54c31bdda56e227b09acc@"raheem@gmail.com"%2735244b97274cb59e0ad68717c8c7d2{ @" Kautzer@
98
+ "Financial Engineer@ " Junior@"(755)939-4108@"Corwin-Koepp@"%2735244b97274cb59e0ad68717c8c7d2@"elenor@hotmail.com"%df31f493eb524d6d811c2aa74bde699e{ @" Rempel@
99
+ "Maintenance Buyer@ " Elmira@"107.903.0257 x06716@"Rosenbaum LLC@"%df31f493eb524d6d811c2aa74bde699e@"lorenz_rohan@hotmail.com"%df0c18aa41a640389b8ee655f6d24c52{ @"
100
+ "Technical Clerk@ "
101
+ Laura@"421-131-1237@"Kuphal Inc@"%df0c18aa41a640389b8ee655f6d24c52@"jeremie_ward@yahoo.com"%b8a0a08cd4404790a97c42d186853ded{ @" Mohr@
102
+ "Technical Estimator@ "Toy@"498-701-9786@"Spinka Group@"%b8a0a08cd4404790a97c42d186853ded@"jonas@gmail.com"%daf1d01a834946b6b6399075897064ac{ @" Strosin@
103
+ "&Advertising Production Supervisor@ " Colton@"1-645-472-6399@"Tromp, Carroll and Torp@"%daf1d01a834946b6b6399075897064ac@"amely@gmail.com"%23729792791645e7b61dfec3077b4df8{ @"Aufderhar@
104
+ "Electronics Superintendent@ "
105
+ Dario@"292.170.8017@"Bernhard-Ullrich@"%23729792791645e7b61dfec3077b4df8@"mike@yahoo.com"%d4f59bf957544f448c8d8d90f19db2ad{ @"
106
+ Kunze@
107
+ "Advertising Recruiter@ " Kenyon@"329.872.9009 x238@"Jakubowski-Pfeffer@"%d4f59bf957544f448c8d8d90f19db2ad@"buster@hotmail.com"%f7cadc51d6994ae1aefbb75712f8d619{ @"
108
+ Swift@
109
+ "Environmental Chef@ " Carmen@"155-356-7364 x3428@"$Runolfsdottir, King and Goldner@"%f7cadc51d6994ae1aefbb75712f8d619@"arvel.west@hotmail.com"%1c1395556a1344b49fab4cf14ea592ff{ @" Turner@
110
+ "Environmental Accountant@ " Thad@"1-972-620-8412 x8494@""Shields, Pollich and Tremblay@"%1c1395556a1344b49fab4cf14ea592ff@"jasmin@gmail.com"%000d766aa6ab4415a65ce5f198fb062c{ @"Runolfsdottir@
111
+ "Production Mechanic@ "
112
+ Sasha@"081-776-7716@"Schulist Inc@"%000d766aa6ab4415a65ce5f198fb062c@"winona_rogahn@yahoo.com"%34c25a1d475a497c8c10cb8a4bf6e460{ @" Littel@
113
+ "Banking Supervisor@ "
114
+ Nella@"755-904-0756@" Beier, Mills and Bartoletti@"%34c25a1d475a497c8c10cb8a4bf6e460@"consuelo@yahoo.com"%8abb9fc4c8a94301b643178a0a4d59dc{ @" Cassin@
115
+ "Chief Recruiter@ " Kole@"(565)707-1120 x87431@"Konopelski Inc@"%8abb9fc4c8a94301b643178a0a4d59dc@"justus_corkery@gmail.com"%85d465cee78a4ec681fa12510db342e7{ @"
116
+ Kutch@
117
+ "Computer Accountant@ " Julius@"1-860-883-0880@" Lehner, Kiehn and Armstrong@"%85d465cee78a4ec681fa12510db342e7@"maci@yahoo.com"%187ed16356eb4c0f8828feb9a30adfa3{ @"
118
+ White@
119
+ "Software Intern@ "
120
+ Sandy@"(179)705-5606@"Padberg Inc@"%187ed16356eb4c0f8828feb9a30adfa3@"beryl@yahoo.com"%e5bcd879d8ad4e62b854f86c4d59036c{ @"Wintheiser@
121
+ "Medical Superintendent@ "
122
+ Green@"134-871-5965@"#Walter, Satterfield and Erdman@"%e5bcd879d8ad4e62b854f86c4d59036c@"elza_nicolas@gmail.com"%8be397a0df604e33b8aa38f39d7e92d2{ @" Gaylord@
123
+ "Advertising Engineer@ " Annabel@"(625)111-7197 x2321@"McLaughlin-Paucek@"%8be397a0df604e33b8aa38f39d7e92d2@"cydney.bailey@gmail.com"%27c57ecd137b4b319675e6829088b5da{ @" Langosh@
124
+ "Medical Technician@ " Wilson@"(974)391-2042 x47203@"Funk and Sons@"%27c57ecd137b4b319675e6829088b5da@"danial.hane@hotmail.com"%1ba633ee3b524e8e815f429f6e2614fb{ @" Hirthe@
125
+ "Senior Helper@ "
126
+ Susie@"(287)013-3449 x81885@"Kuhn and Sons@"%1ba633ee3b524e8e815f429f6e2614fb@"sydney@gmail.com"%6d81d5792f874e139ac6385e64306ea1{ @"
127
+ Swift@
128
+ "Computer Recruiter@ " Idella@"(889)675-8534 x78991@"Murray-Rice@"%6d81d5792f874e139ac6385e64306ea1@"cristina.windler@yahoo.com"%de20f7825aae4c08af2625bc04337e7f{ @"
129
+ Mertz@
130
+ "Business Systems Clerk@ " Drew@"140.008.9955 x012@"Jacobi and Sons@"%de20f7825aae4c08af2625bc04337e7f@"dominic@yahoo.com"%88a172f48e354c90a0c4871c5e4927eb{ @" Dach@
131
+ "Distribution Engineer@ "Ida@"054-571-7862@"Monahan Group@"%88a172f48e354c90a0c4871c5e4927eb@"monica@yahoo.com"%9f088576fc2a47ed99b055782fb48e04{ @"Hettinger@
132
+ "General Helper@ " Novella@"1-258-382-9374 x04751@"!Dietrich, Hyatt and Schaefer@"%9f088576fc2a47ed99b055782fb48e04@"leann_sauer@hotmail.com"%5d9949fcda7c48d69758636a303c0548{ @"
133
+ Sipes@
134
+ "Environmental Planner@ " Norwood@"1-796-035-5549 x009@"Osinski Group@"%5d9949fcda7c48d69758636a303c0548@"marquis_olson@hotmail.com"%d172c71571694c09968672a1fdcecea3{ @" Barton@
135
+ "Software Director@ "Wilhelmine@"(864)234-6746 x945@" Fritsch, Jenkins and Little@"%d172c71571694c09968672a1fdcecea3@"mario@hotmail.com"%57ae6561dea947ffa4101fd455f13f50{ @" Rowe@
136
+ "Banking Mechanic@ "
137
+ Evans@"437-449-4962@"Oberbrunner LLC@"%57ae6561dea947ffa4101fd455f13f50@"freddie.walsh@yahoo.com"%11c73bdbf8b54b009f7a5244347a25ea{ @"Runolfsdottir@
138
+ "Administrative Recruiter@ " Elmore@"1-945-054-2695@"Schneider-Donnelly@"%11c73bdbf8b54b009f7a5244347a25ea@"vaughn.auer@hotmail.com"%faeecac1abbf43b7a049401f6728b6ea{ @"
139
+ Sipes@
140
+ "Maintenance Superintendent@ " Harvey@"(530)567-3688 x704@"Boyle-Langosh@"%faeecac1abbf43b7a049401f6728b6ea@"neha_hand@gmail.com"%e53a51b756da4107b4d8a433a0f8820d{ @"
141
+ Jones@
142
+ "%Production Production Supervisor@ "Charlotte@"1-559-435-9887 x058@"
143
+ Kozey@
144
+ "Business Systems Chef@ " Arnoldo@"1-009-148-2186@"Leuschke Inc@"%37f66fa6df1843f5ada96db42bf0b4c0@"otha_quitzon@gmail.com"%69a97548bc654ef4b5c4be6c6b29e2dd{ @" Russel@
145
+ "General Specialist@ " Kody@"1-469-207-9688 x82595@"Halvorson, Kris and Skiles@"%69a97548bc654ef4b5c4be6c6b29e2dd@"johnny@yahoo.com"%6282d6d61e794c2a8dc40e02bee8f8f5{ @" Roberts@
146
+ "Electronics Director@ "Henriette@"(774)721-6745 x9115@"Wolf, Green and Veum@"%6282d6d61e794c2a8dc40e02bee8f8f5@"bridie.stamm@yahoo.com"%641db14221d64aea9ca8488bfb5bcbbd{ @" Pacocha@
147
+ "Chief Buyer@ "
148
+ Uriel@"1-299-633-8600@"Brakus-Greenfelder@"%641db14221d64aea9ca8488bfb5bcbbd@"ivy@hotmail.com
@@ -0,0 +1,9 @@
1
+ {
2
+ "%2e5fefd374664c5d86f8f009c85afc28{ "
3
+ Email"michale.auer@gmail.com"%67ef04b9284d4a5094a98c7d56a27859{ @" Lowe@
4
+ "General Officer@ " Orville@"734.203.2180 x42267@"Kuhlman Inc@"%67ef04b9284d4a5094a98c7d56a27859@"cary@yahoo.com"%c36c66d52c864bbd8c9a41fccff9d9fb{ @"Bartoletti@
5
+ "Advertising Analyst@ " Mariam@"(638)143-4952@"Schuppe-Jast@"%c36c66d52c864bbd8c9a41fccff9d9fb@"kay.abernathy@gmail.com"%34bc13a1b8624f6d84a9d7130d450bf1{ @" Cormier@
6
+ "Computer Helper@ "
7
+ Ciara@"(902)741-9606@"Fahey-Champlin@"%34bc13a1b8624f6d84a9d7130d450bf1@"birdie@gmail.com"%8f24b30290d24d5c8edf4627468d686c{ @"
8
+ Robel@
9
+ "Technical Chef@ " Lourdes@"(920)866-0921 x28299@"Brown, Stracke and Ratke@"%8f24b30290d24d5c8edf4627468d686c@"gladyce@yahoo.com
Binary file
Binary file
@@ -0,0 +1,42 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Add the following line to crontab to execute benchmarks as a cron job on workdays at 1AM
5
+ #
6
+ # 0 1 * * 1-5 /Users/rhomobile/workspace/rhoconnect/bench/run_bench.sh
7
+ #
8
+
9
+ # ALL log messages go to '/tmp/bench.log' file
10
+ echo '' > /tmp/bench.log
11
+
12
+ if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
13
+ # First try to load from a user install
14
+ source "$HOME/.rvm/scripts/rvm"
15
+ elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
16
+ # Then try to load from a root install
17
+ source "/usr/local/rvm/scripts/rvm"
18
+ else
19
+ printf "ERROR: An RVM installation was not found.\n" >> /tmp/bench.log
20
+ exit
21
+ fi
22
+
23
+ RHOCONNECT_HOME="$HOME/workspace/rhoconnect"
24
+ cd $RHOCONNECT_HOME
25
+
26
+ echo "Pull rhoconnect code from remote repository ..." | tee -a /tmp/bench.log
27
+ git reset --hard HEAD | tee -a /tmp/bench.log 2>&1
28
+ git pull origin master | tee -a /tmp/bench.log 2>&1
29
+ echo '' | tee -a /tmp/bench.log
30
+
31
+ # Run benchmarks for ruby 1.8.7, ree, and 1.9.2
32
+ # TODO: 'jruby'
33
+ for ruby in '1.9.2' '1.8.7' 'ree'
34
+ do
35
+ rvm use $ruby > /dev/null
36
+ ruby_version=$(rvm current)
37
+ echo "Running benchmarks under $ruby_version ..." | tee -a /tmp/bench.log
38
+ echo "" | tee -a /tmp/bench.log
39
+ ruby bench/bench_runner.rb $RHOCONNECT_HOME 2>&1 | tee -a /tmp/bench.log
40
+ done
41
+
42
+
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ ruby bench start 'scripts/blob_cud_script.rb' 'rhoadmin' ''
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ ruby bench start 'scripts/cud_script.rb' 'rhoadmin' ''
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ ruby bench start 'scripts/query_md_script.rb' 'rhoadmin' ''
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ ruby bench start 'scripts/query_only_script.rb' 'rhoadmin' ''
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ ruby bench start 'scripts/query_script.rb' 'rhoadmin' ''
@@ -0,0 +1,98 @@
1
+ require 'rhoconnect'
2
+
3
+ include BenchHelpers
4
+ bench_log "Simulate creating multiple blob objects"
5
+
6
+ Bench.config do |config|
7
+ config.concurrency = 5 # users
8
+ config.iterations = 2 # devices
9
+ config.user_name = "benchuser"
10
+ config.password = "password"
11
+ config.adapter_name = 'BlobAdapter'
12
+ config.get_test_server("blobapp")
13
+ config.reset_app
14
+ config.reset_refresh_time('BlobAdapter',0)
15
+ config.set_server_state("test_db_storage:application:#{config.user_name}",{})
16
+
17
+ @create_objects = []
18
+ @create_count = 5 #50
19
+
20
+ @users = Bench.get_bench_users(config.concurrency)
21
+ @users.each do |u|
22
+ Bench.create_user(u.user_name, u.password)
23
+ end
24
+
25
+ config.concurrency.times do |i|
26
+ @create_objects << []
27
+ config.iterations.times do
28
+ @create_objects[i] << Bench.get_test_data(@create_count, true, true)
29
+ end
30
+ end
31
+
32
+ @datasize = config.iterations * @create_count # calculate datasize per user
33
+ @expected_md = {}
34
+ @create_objects.each do |iteration|
35
+ iteration.each do |objects|
36
+ @expected_md.merge!(objects)
37
+ end
38
+ end
39
+ end
40
+
41
+
42
+ Bench.test do |config, session|
43
+ sleep rand(10)
44
+
45
+ user = @users[session.thread_id]
46
+ session.post "clientlogin", "#{config.base_url}/clientlogin", :content_type => :json do
47
+ {:login => user.user_name, :password => user.password}.to_json
48
+ end
49
+ sleep rand(10)
50
+
51
+ session.get "clientcreate", "#{config.base_url}/clientcreate"
52
+ session.client_id = JSON.parse(session.last_result.body)['client']['client_id']
53
+ create_objs = @create_objects[session.thread_id][session.iteration]
54
+ body = { :cud => {:source_name => 'BlobAdapter', :client_id => session.client_id,
55
+ :blob_fields => ['img_file-rhoblob'],
56
+ :create => create_objs, :version => 3}.to_json
57
+ }
58
+ session.post "create-object", "#{config.base_url}/queue_updates" do
59
+ body.merge!(Bench.get_image_data(create_objs)) # Add images to miltipart post
60
+ end
61
+ session.last_result.verify_code(200)
62
+ sleep rand(10)
63
+
64
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loop to get available objects ..."
65
+ count = get_all_objects(current_line,config,session,@expected_md,create_objs)
66
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Got #{count} available objects ..."
67
+ end
68
+
69
+ Bench.verify do |config,sessions|
70
+ sessions.each do |session|
71
+ user = @users[session.thread_id]
72
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loop to load all objects..."
73
+ session.results['create-object'][0].verification_error +=
74
+ verify_numbers(
75
+ @datasize,get_all_objects(
76
+ caller(0)[0].to_s,config,session,@expected_md,nil,0),session,current_line)
77
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loaded all objects..."
78
+ end
79
+
80
+ sessions.each do |session|
81
+ actual = config.get_server_state(
82
+ client_docname( @users[session.thread_id].user_name, # config.user_name,
83
+ session.client_id,
84
+ 'BlobAdapter',:cd))
85
+ actual.keys.each do |k|
86
+ session.results['create-object'][0].verification_error +=
87
+ Bench.compare_and_log(@expected_md[k], actual[k], current_line)
88
+ end
89
+ end
90
+
91
+ master_doc = {}
92
+ @users.each do |user|
93
+ user_doc = config.get_server_state(
94
+ source_docname(user.user_name, 'BlobAdapter',:md))
95
+ master_doc.merge!(user_doc)
96
+ end
97
+ Bench.verify_error = Bench.compare_and_log(@expected_md, master_doc, current_line)
98
+ end
@@ -0,0 +1,92 @@
1
+ include BenchHelpers
2
+ bench_log "Simulate creating multiple objects"
3
+
4
+ Bench.config do |config|
5
+ config.concurrency = 5
6
+ config.iterations = 2
7
+ config.user_name = "benchuser"
8
+ config.password = "password"
9
+ config.adapter_name = 'MockAdapter'
10
+ config.get_test_server
11
+ config.reset_app
12
+ config.reset_refresh_time('MockAdapter',0)
13
+ config.set_server_state("test_db_storage:application:#{config.user_name}",{})
14
+ @create_objects = []
15
+ @create_count = 5
16
+
17
+ @users = Bench.get_bench_users(config.concurrency)
18
+ @users.each do |u|
19
+ Bench.create_user(u.user_name, u.password)
20
+ end
21
+
22
+ config.concurrency.times do |i|
23
+ @create_objects << []
24
+ config.iterations.times do
25
+ @create_objects[i] << Bench.get_test_data(@create_count,true)
26
+ end
27
+ end
28
+
29
+ @datasize = config.iterations * @create_count # calculate datasize per user
30
+ @expected_md = {}
31
+
32
+ @create_objects.each do |iteration|
33
+ iteration.each do |objects|
34
+ @expected_md.merge!(objects)
35
+ end
36
+ end
37
+ end
38
+
39
+ Bench.test do |config,session|
40
+ sleep rand(10)
41
+
42
+ user = @users[session.thread_id]
43
+ session.post "clientlogin", "#{config.base_url}/clientlogin", :content_type => :json do
44
+ {:login => user.user_name, :password => user.password}.to_json
45
+ end
46
+ sleep rand(10)
47
+
48
+ session.get "clientcreate", "#{config.base_url}/clientcreate"
49
+ session.client_id = JSON.parse(session.last_result.body)['client']['client_id']
50
+ create_objs = @create_objects[session.thread_id][session.iteration]
51
+ session.post "create-object", "#{config.base_url}/queue_updates", :content_type => :json do
52
+ {:source_name => 'MockAdapter', :client_id => session.client_id,
53
+ :create => create_objs, :version => 3}.to_json
54
+ end
55
+ session.last_result.verify_code(200)
56
+ sleep rand(10)
57
+
58
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loop to get available objects ..."
59
+ count = get_all_objects(current_line,config,session,@expected_md,create_objs)
60
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Got #{count} available objects ..."
61
+ end
62
+
63
+ Bench.verify do |config,sessions|
64
+ sessions.each do |session|
65
+ user = @users[session.thread_id]
66
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loop to load all objects..."
67
+ session.results['create-object'][0].verification_error +=
68
+ verify_numbers(
69
+ @datasize,get_all_objects(
70
+ caller(0)[0].to_s,config,session,@expected_md,nil,0),session,current_line)
71
+ bench_log "#{session.log_prefix} User \"#{user.user_name}\": Loaded all objects..."
72
+ end
73
+
74
+ sessions.each do |session|
75
+ actual = config.get_server_state(
76
+ client_docname( @users[session.thread_id].user_name, # config.user_name,
77
+ session.client_id,
78
+ 'MockAdapter',:cd))
79
+ actual.keys.each do |k|
80
+ session.results['create-object'][0].verification_error +=
81
+ Bench.compare_and_log(@expected_md[k], actual[k], current_line)
82
+ end
83
+ end
84
+
85
+ master_doc = {}
86
+ @users.each do |user|
87
+ user_doc = config.get_server_state(
88
+ source_docname(user.user_name, 'MockAdapter',:md))
89
+ master_doc.merge!(user_doc)
90
+ end
91
+ Bench.verify_error = Bench.compare_and_log(@expected_md, master_doc, current_line)
92
+ end