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/spec/user_spec.rb CHANGED
@@ -4,123 +4,123 @@ STATS_RECORD_RESOLUTION = 2 unless defined? STATS_RECORD_RESOLUTION
4
4
  STATS_RECORD_SIZE = 8 unless defined? STATS_RECORD_SIZE
5
5
 
6
6
  describe "User" do
7
- it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
8
- it "should not allow user created with reserved login" do
9
- Store.get_value('user:count').should == "2"
10
- lambda {
11
- User.create({:login => '__shared__'})
12
- }.should raise_error(ArgumentError, 'Reserved user id __shared__')
13
- Store.get_value('user:count').should == "2"
14
- end
7
+ include_examples "SharedRhoconnectHelper", :rhoconnect_data => true
8
+
9
+ it "should not allow user created with reserved login" do
10
+ Store.get_value('user:count').should == "2"
11
+ lambda {
12
+ User.create({:login => '__shared__'})
13
+ }.should raise_error(ArgumentError, 'Reserved user id __shared__')
14
+ Store.get_value('user:count').should == "2"
15
+ end
15
16
 
16
- it "should load user with fields" do
17
- @u.id.should == @u_fields[:login]
18
- @u1 = User.load(@u_fields[:login])
19
- @u1.id.should == @u.id
20
- @u1.login.should == @u_fields[:login]
21
- @u1.email.should == @u_fields[:email]
22
- Store.get_value('user:count').should == "2"
23
- end
17
+ it "should load user with fields" do
18
+ @u.id.should == @u_fields[:login]
19
+ @u1 = User.load(@u_fields[:login])
20
+ @u1.id.should == @u.id
21
+ @u1.login.should == @u_fields[:login]
22
+ @u1.email.should == @u_fields[:email]
23
+ Store.get_value('user:count').should == "2"
24
+ end
24
25
 
25
- it "should delete seats for user's clients" do
26
- @c_fields.delete(:id)
27
- Client.create(@c_fields,{:source_name => @s_fields[:name]})
28
- c_size = @u.clients.members.size
29
- current = Store.get_value(License::CLIENT_DOCKEY).to_i
30
- @u.delete
31
- Store.get_value(License::CLIENT_DOCKEY).to_i.should == current - c_size
32
- end
26
+ it "should delete seats for user's clients" do
27
+ @c_fields.delete(:id)
28
+ Client.create(@c_fields,{:source_name => @s_fields[:name]})
29
+ c_size = @u.clients.members.size
30
+ current = Store.get_value(License::CLIENT_DOCKEY).to_i
31
+ @u.delete
32
+ Store.get_value(License::CLIENT_DOCKEY).to_i.should == current - c_size
33
+ end
33
34
 
34
- it "should create token for user" do
35
- token = @u.create_token
36
- token.length.should == 32
37
- ApiToken.load(token).user_id.should == @u.id
38
- end
35
+ it "should create token for user" do
36
+ token = @u.create_token
37
+ token.length.should == 32
38
+ ApiToken.load(token).user_id.should == @u.id
39
+ end
39
40
 
40
- it "should get token for user" do
41
- token = @u.create_token
42
- @u.token.value.length.should == 32
43
- @u.token.value.should == token
44
- end
41
+ it "should get token for user" do
42
+ token = @u.create_token
43
+ @u.token.value.length.should == 32
44
+ @u.token.value.should == token
45
+ end
45
46
 
46
- it "should use token provisioned in settings if one" do
47
- token = User.load('rhoadmin').token_id
48
- token.should == Rhoconnect.api_token
49
- ApiToken.is_exist?(token).should == true
50
- end
47
+ it "should use token provisioned in settings if one" do
48
+ token = User.load('rhoadmin').token_id
49
+ token.should == Rhoconnect.api_token
50
+ ApiToken.is_exist?(token).should == true
51
+ end
51
52
 
52
- it "should delete token if one exists" do
53
- token = @u.create_token
54
- ApiToken.is_exist?(token).should == true
55
- token2 = @u.create_token
56
- ApiToken.is_exist?(token).should == false
57
- ApiToken.is_exist?(token2).should == true
58
- end
53
+ it "should delete token if one exists" do
54
+ token = @u.create_token
55
+ ApiToken.is_exist?(token).should == true
56
+ token2 = @u.create_token
57
+ ApiToken.is_exist?(token).should == false
58
+ ApiToken.is_exist?(token2).should == true
59
+ end
59
60
 
60
- it "should assign token to existing user" do
61
- token = @u.create_token
62
- @u.token = 'foo'
63
- @u.token.value.should == 'foo'
64
- ApiToken.is_exist?('foo').should == true
65
- ApiToken.is_exist?(token).should == false
66
- end
61
+ it "should assign token to existing user" do
62
+ token = @u.create_token
63
+ @u.token = 'foo'
64
+ @u.token.value.should == 'foo'
65
+ ApiToken.is_exist?('foo').should == true
66
+ ApiToken.is_exist?(token).should == false
67
+ end
67
68
 
68
- it "should authenticate with proper credentials" do
69
- @u1 = User.authenticate(@u_fields[:login],'testpass')
70
- @u1.should_not be_nil
71
- @u1.login.should == @u_fields[:login]
72
- @u1.email.should == @u_fields[:email]
73
- end
69
+ it "should authenticate with proper credentials" do
70
+ @u1 = User.authenticate(@u_fields[:login],'testpass')
71
+ @u1.should_not be_nil
72
+ @u1.login.should == @u_fields[:login]
73
+ @u1.email.should == @u_fields[:email]
74
+ end
74
75
 
75
- it "should fail to authenticate with invalid credentials" do
76
- User.authenticate(@u_fields[:login],'wrongpass').should be_nil
77
- end
76
+ it "should fail to authenticate with invalid credentials" do
77
+ User.authenticate(@u_fields[:login],'wrongpass').should be_nil
78
+ end
78
79
 
79
- it "should fail to authenticate with nil user" do
80
- User.authenticate('niluser','doesnotmatter').should be_nil
81
- end
80
+ it "should fail to authenticate with nil user" do
81
+ User.authenticate('niluser','doesnotmatter').should be_nil
82
+ end
83
+
84
+ it "should delete user and user clients" do
85
+ @c.put_data(:cd,@data)
86
+ cid = @c.id
87
+ @u.delete
88
+ Store.get_value('user:count').should == "1"
89
+ User.is_exist?(@u_fields[:login]).should == false
90
+ Client.is_exist?(cid).should == false
91
+ @c.get_data(:cd).should == {}
92
+ end
82
93
 
83
- it "should delete user and user clients" do
84
- @c.put_data(:cd,@data)
85
- cid = @c.id
86
- @u.delete
87
- Store.get_value('user:count').should == "1"
88
- User.is_exist?(@u_fields[:login]).should == false
89
- Client.is_exist?(cid).should == false
90
- @c.get_data(:cd).should == {}
94
+ it "should delete token for user" do
95
+ token = @u.create_token
96
+ @u.delete
97
+ ApiToken.is_exist?(token).should == false
98
+ end
99
+
100
+ describe "User Stats" do
101
+
102
+ before(:all) do
103
+ Store.stub(:lock).and_yield
91
104
  end
92
105
 
93
- it "should delete token for user" do
94
- token = @u.create_token
95
- @u.delete
96
- ApiToken.is_exist?(token).should == false
106
+ it "should increment user stats on create" do
107
+ Time.stub(:now).and_return(10)
108
+ Rhoconnect.stats = true
109
+ User.create({:login => 'testuser2'})
110
+ Rhoconnect::Stats::Record.range('users',0,-1).should == ["3:10"]
111
+ Store.get_value('user:count').should == "3"
112
+ Rhoconnect.stats = false
97
113
  end
98
114
 
99
- describe "User Stats" do
100
-
101
- before(:all) do
102
- Store.stub!(:lock).and_yield
103
- end
104
-
105
- it "should increment user stats on create" do
106
- Time.stub!(:now).and_return(10)
107
- Rhoconnect.stats = true
108
- User.create({:login => 'testuser2'})
109
- Rhoconnect::Stats::Record.range('users',0,-1).should == ["3:10"]
110
- Store.get_value('user:count').should == "3"
111
- Rhoconnect.stats = false
112
- end
113
-
114
- it "should decrement user stats on delete" do
115
- Time.stub!(:now).and_return(10)
116
- Rhoconnect.stats = true
117
- u = User.create({:login => 'testuser1'})
118
- Rhoconnect::Stats::Record.range('users',0,-1).should == ["3:10"]
119
- u.delete
120
- Rhoconnect::Stats::Record.range('users',0,-1).should == ["2:10"]
121
- Store.get_value('user:count').should == "2"
122
- Rhoconnect.stats = false
123
- end
115
+ it "should decrement user stats on delete" do
116
+ Time.stub(:now).and_return(10)
117
+ Rhoconnect.stats = true
118
+ u = User.create({:login => 'testuser1'})
119
+ Rhoconnect::Stats::Record.range('users',0,-1).should == ["3:10"]
120
+ u.delete
121
+ Rhoconnect::Stats::Record.range('users',0,-1).should == ["2:10"]
122
+ Store.get_value('user:count').should == "2"
123
+ Rhoconnect.stats = false
124
124
  end
125
125
  end
126
126
  end
data/tasks/redis.rake CHANGED
@@ -4,7 +4,7 @@ require_relative '../commands/utilities/redis_runner'
4
4
  include Utilities
5
5
  include Rake::DSL
6
6
 
7
- REDIS_RELEASE = "2.6.16"
7
+ REDIS_RELEASE = "2.8.17"
8
8
 
9
9
  namespace :redis do
10
10
  desc 'About redis'
@@ -40,7 +40,7 @@ namespace :redis do
40
40
 
41
41
  desc 'Install the latest verison of Redis from Github (requires git, duh)'
42
42
  task :install => [:about, :download, :make] do
43
- unless windows?
43
+ unless windows?
44
44
  ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "#{RedisRunner.prefix}bin"
45
45
 
46
46
  mk_bin_dir(bin_dir)
@@ -59,7 +59,7 @@ namespace :redis do
59
59
  end
60
60
 
61
61
  task :make do
62
- unless windows?
62
+ unless windows?
63
63
  sh "cd #{RedisRunner.redisdir} && make clean"
64
64
  sh "cd #{RedisRunner.redisdir} && make"
65
65
  end