rhodes 2.0.0.beta10 → 2.0.0.beta11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/Manifest.txt +5297 -0
  2. data/README.textile +2 -2
  3. data/bin/rhodes-setup +1 -0
  4. data/lib/extensions/digest-md5/ext/Rakefile +6 -5
  5. data/lib/extensions/fcntl/ext.yml +1 -1
  6. data/lib/framework/rho/rho.rb +2 -34
  7. data/lib/framework/rho/rhoapplication.rb +6 -2
  8. data/lib/framework/rho/rhofsconnector.rb +9 -0
  9. data/lib/framework/rhodes.rb +1 -1
  10. data/lib/rhodes.rb +1 -1
  11. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
  12. data/platform/shared/common/RhoDefs.h +1 -1
  13. data/platform/shared/common/RhodesApp.cpp +20 -0
  14. data/platform/shared/common/RhodesApp.h +1 -0
  15. data/platform/shared/db/DBAdapter.cpp +34 -9
  16. data/platform/shared/db/DBAdapter.h +3 -3
  17. data/platform/shared/net/AsyncHttp.cpp +1 -1
  18. data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +1 -1
  19. data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +1 -1
  20. data/platform/shared/rubyJVM/src/com/rho/net/URI.java +4 -7
  21. data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +7 -7
  22. data/platform/shared/sync/SyncEngine.cpp +5 -9
  23. data/platform/shared/sync/SyncThread.cpp +3 -2
  24. data/platform/wm/rhodes/MainWindow.cpp +7 -2
  25. data/platform/wm/rhodes/MainWindow.h +2 -0
  26. data/platform/wm/rhodes/Rhodes.cpp +9 -7
  27. data/res/build-tools/db/syncdb.triggers +5 -0
  28. data/rhodes.gemspec +1 -1
  29. data/spec/framework_spec/app/BlobTest/blob_test.rb +11 -0
  30. data/spec/framework_spec/app/BlobTest/test.png +0 -0
  31. data/spec/framework_spec/app/BlobTest/test2.png +0 -0
  32. data/spec/framework_spec/app/spec/blobsync_spec.rb +155 -0
  33. data/spec/framework_spec/app/spec/syncengine_spec.rb +3 -0
  34. data/spec/framework_spec/app/spec_runner.rb +1 -0
  35. data/spec/framework_spec/build.yml +1 -1
  36. metadata +8 -3
@@ -0,0 +1,155 @@
1
+ #
2
+ # blobsync_spec.rb
3
+ # rhodes
4
+ #
5
+ # Copyright (C) 2008 Rhomobile, Inc. All rights reserved.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ #
20
+ require 'spec/spec_helper'
21
+ require 'rho/rho'
22
+ require 'fileutils'
23
+
24
+ describe "BlobSync_test" do
25
+
26
+ before(:all) do
27
+ SyncEngine.set_threaded_mode(false)
28
+
29
+ ::Rhom::Rhom.database_full_reset_and_logout
30
+
31
+ SyncEngine.set_syncserver('http://rhodes-samples-server.heroku.com/application')
32
+
33
+ end
34
+
35
+ it "should login" do
36
+ SyncEngine.login('lars', 'b', "/app/Settings/login_callback")
37
+
38
+ res = ::Rho::RhoSupport::parse_query_parameters C_login_callback
39
+ res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
40
+
41
+ SyncEngine.logged_in.should == 1
42
+ end
43
+
44
+ it "should sync BlobTest" do
45
+ SyncEngine.logged_in.should == 1
46
+
47
+ BlobTest.sync( "/app/Settings/sync_notify")
48
+
49
+ res = ::Rho::RhoSupport::parse_query_parameters C_sync_notify
50
+ res['status'].should == 'ok'
51
+ res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
52
+ end
53
+
54
+ it "should delete all Test Blobs" do
55
+ SyncEngine.logged_in.should == 1
56
+
57
+ items = BlobTest.find(:all ) #, :conditions => {:name => 'BlobTestItem'})
58
+ items.should_not == nil
59
+
60
+ items.each do |item|
61
+ file_name = File.join(Rho::RhoApplication::get_blob_path(item.image_uri))
62
+ File.exists?(file_name).should == true
63
+ item.destroy
64
+ File.exists?(file_name).should == false
65
+ end
66
+
67
+ BlobTest.sync( "/app/Settings/sync_notify")
68
+ sleep(2) #wait till sync server update data
69
+ BlobTest.sync( "/app/Settings/sync_notify")
70
+
71
+ res = ::Rho::RhoSupport::parse_query_parameters C_sync_notify
72
+ res['status'].should == 'ok'
73
+ res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
74
+
75
+ item2 = BlobTest.find(:first ) #, :conditions => {:name => 'BlobTestItem'})
76
+ item2.should == nil
77
+
78
+ end
79
+
80
+ it "should create new BlobTest" do
81
+ SyncEngine.logged_in.should == 1
82
+
83
+ file_name = File.join(Rho::RhoApplication::get_model_path('app','BlobTest'), 'test.png')
84
+ FileUtils.cp(file_name, Rho::RhoApplication::get_blob_folder() )
85
+ file_name = File.join(Rho::RhoApplication::get_blob_folder(), 'test.png')
86
+
87
+ file_size = File.size(file_name)
88
+ file_content = File.read(file_name)
89
+
90
+ item = BlobTest.new
91
+ #item.name = 'BlobTestItem'
92
+ item.image_uri = file_name
93
+ item.save
94
+ BlobTest.sync( "/app/Settings/sync_notify")
95
+ sleep(2) #wait till sync server update data
96
+ BlobTest.sync( "/app/Settings/sync_notify")
97
+
98
+ res = ::Rho::RhoSupport::parse_query_parameters C_sync_notify
99
+ res['status'].should == 'ok'
100
+ res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
101
+
102
+ items = BlobTest.find(:all ) #, :conditions => {:name => 'BlobTestItem'})
103
+ items.should_not == nil
104
+ items.length.should == 1
105
+
106
+ items[0].image_uri.should_not == file_name
107
+ new_file_name = File.join(Rho::RhoApplication::get_blob_path(items[0].image_uri))
108
+ File.size(new_file_name).should == file_size
109
+ content_new = File.read(new_file_name)
110
+ content_new.should == file_content
111
+ end
112
+
113
+ it "should modify BlobTest" do
114
+ SyncEngine.logged_in.should == 1
115
+
116
+ item = BlobTest.find(:first)
117
+ item.should_not == nil
118
+ saved_obj = item.object
119
+
120
+ file_name = File.join(Rho::RhoApplication::get_model_path('app','BlobTest'), 'test2.png')
121
+ FileUtils.cp(file_name, Rho::RhoApplication::get_blob_folder() )
122
+ file_name = File.join(Rho::RhoApplication::get_blob_folder(), 'test2.png')
123
+
124
+ # file_size = File.size(file_name)
125
+ # file_content = File.read(file_name)
126
+
127
+ old_file = item.image_uri
128
+ item.image_uri = file_name
129
+ item.save
130
+ File.exists?(old_file).should == false
131
+
132
+ BlobTest.sync( "/app/Settings/sync_notify")
133
+ sleep(2) #wait till sync server update data
134
+ BlobTest.sync( "/app/Settings/sync_notify")
135
+
136
+ res = ::Rho::RhoSupport::parse_query_parameters C_sync_notify
137
+ res['status'].should == 'ok'
138
+ res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
139
+
140
+ item2 = BlobTest.find(saved_obj)
141
+
142
+ item2.image_uri.should == file_name
143
+ # new_file_name = File.join(Rho::RhoApplication::get_blob_path(item2.image_uri))
144
+ # File.size(new_file_name).should == file_size
145
+ # content_new = File.read(new_file_name)
146
+ # content_new.should == file_content
147
+
148
+ end
149
+
150
+ it "should logout" do
151
+ SyncEngine.logout()
152
+
153
+ SyncEngine.logged_in.should == 0
154
+ end
155
+ end
@@ -26,6 +26,9 @@ describe "SyncEngine_test" do
26
26
  SyncEngine.set_threaded_mode(false)
27
27
 
28
28
  ::Rhom::Rhom.database_full_reset_and_logout
29
+
30
+ SyncEngine.set_syncserver('http://warm-flower-88.heroku.com/application')
31
+
29
32
  end
30
33
 
31
34
  =begin
@@ -23,6 +23,7 @@ class SpecRunner < MSpecScript
23
23
  config[:files] << 'spec/spec_helper'
24
24
  config[:files] << 'spec/webview_spec'
25
25
  #config[:files] << 'spec/syncengine_spec'
26
+ #config[:files] << 'spec/blobsync_spec'
26
27
  config[:files] << 'spec/rhom_db_adapter_spec'
27
28
  config[:files] << 'spec/rhoerror_spec'
28
29
  config[:files] << 'spec/bsearch_spec'
@@ -14,4 +14,4 @@ iphone:
14
14
  configuration: Debug
15
15
  extensions: ["digest-md5", "digest-sha1"]
16
16
 
17
- extensions: ["digest", "fcntl", "test-libs"]
17
+ extensions: ["digest", "fcntl", "test-libs", "fileutils"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhodes
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1967355490
4
+ hash: -1967355489
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
- - beta10
11
- version: 2.0.0.beta10
10
+ - beta11
11
+ version: 2.0.0.beta11
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rhomobile
@@ -348,6 +348,7 @@ files:
348
348
  - lib/test/rho_stubs.rb
349
349
  - lib/test/syncdb.sqlite
350
350
  - LICENSE
351
+ - Manifest.txt
351
352
  - platform/android/build/android.rake
352
353
  - platform/android/build/androidcommon.rb
353
354
  - platform/android/build/libcurl_build.files
@@ -3662,6 +3663,9 @@ files:
3662
3663
  - rhodes.gemspec
3663
3664
  - spec/framework_spec/app/Account/account.rb
3664
3665
  - spec/framework_spec/app/application.rb
3666
+ - spec/framework_spec/app/BlobTest/blob_test.rb
3667
+ - spec/framework_spec/app/BlobTest/test.png
3668
+ - spec/framework_spec/app/BlobTest/test2.png
3665
3669
  - spec/framework_spec/app/Case/case.rb
3666
3670
  - spec/framework_spec/app/Customer/customer.rb
3667
3671
  - spec/framework_spec/app/fileutils.rb
@@ -3785,6 +3789,7 @@ files:
3785
3789
  - spec/framework_spec/app/Product/product.rb
3786
3790
  - spec/framework_spec/app/Settings/controller.rb
3787
3791
  - spec/framework_spec/app/Settings/index.erb
3792
+ - spec/framework_spec/app/spec/blobsync_spec.rb
3788
3793
  - spec/framework_spec/app/spec/bsearch_spec.rb
3789
3794
  - spec/framework_spec/app/spec/core/argf/argf_spec.rb
3790
3795
  - spec/framework_spec/app/spec/core/argf/binmode_spec.rb