rhodes 3.3.3.beta.1 → 3.3.3.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Manifest.txt +23 -9
- data/Rakefile +13 -2
- data/doc/build.txt +18 -11
- data/doc/device-caps.txt +4 -68
- data/doc/rhom.txt +33 -0
- data/doc/test-log-debug.txt +18 -42
- data/lib/framework/rho/render.rb +1 -1
- data/lib/framework/rho/rho.rb +31 -1
- data/lib/framework/rho/rhocontroller.rb +2 -2
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +4 -0
- data/lib/framework/rholang/localization_simplified.rb +1 -1
- data/lib/framework/rhom/rhom_object_factory.rb +22 -1
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +25 -9
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_extmanager_RhoExtManagerImpl.h +21 -0
- data/platform/android/Rhodes/jni/src/extmanager.cpp +36 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +14 -5
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +5 -0
- data/platform/android/Rhodes/jni/src/signature.cpp +29 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +42 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +61 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +39 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +142 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +15 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +6 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +25 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +15 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +14 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +218 -51
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureProperties.java +94 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +122 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/{WebView.java → IRhoWebView.java} +2 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +4 -0
- data/platform/android/build/RhodesSRC_build.files +8 -1
- data/platform/android/build/android.rake +5 -1
- data/platform/android/build/librhodes_build.files +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +22 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +15 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +4 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +4 -2
- data/platform/bb/build/rhodes_build.files +2 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/PNGEncoder.java +613 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/SignatureCapture.java +314 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +1 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +11 -0
- data/platform/iphone/Classes/Rhodes.m +1 -1
- data/platform/iphone/Classes/Signature/SignatureDelegate.h +5 -1
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +186 -5
- data/platform/iphone/Classes/Signature/SignatureView.h +12 -0
- data/platform/iphone/Classes/Signature/SignatureView.m +11 -3
- data/platform/iphone/Classes/SimpleMainView.m +4 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +98 -3
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/rbuild/iphone.rake +18 -5
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
- data/platform/shared/common/ExtManager.h +64 -9
- data/platform/shared/common/RhoSimConf.h +1 -0
- data/platform/shared/common/RhodesApp.cpp +77 -28
- data/platform/shared/common/RhodesApp.h +9 -4
- data/platform/shared/common/RhodesAppBase.cpp +4 -3
- data/platform/shared/common/RhodesAppBase.h +5 -3
- data/platform/shared/net/HttpServer.cpp +4 -4
- data/platform/shared/net/HttpServer.h +2 -2
- data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +1 -1
- data/platform/shared/qt/rhodes/main.cpp +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +12 -2
- data/platform/shared/ruby/ext/rho/rhosupport.c +11 -1
- data/platform/shared/ruby/thread_win32.c +2 -1
- data/platform/shared/rubyext/System.cpp +6 -0
- data/platform/shared/sync/SyncSource.cpp +15 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +0 -4
- data/platform/wm/build/build_inf.js +34 -4
- data/platform/wm/build/wm.rake +75 -25
- data/platform/wm/rhodes/AppManager.cpp +14 -3
- data/platform/wm/rhodes/IBrowserEngine.h +7 -0
- data/platform/wm/rhodes/IEBrowserEngine.cpp +43 -0
- data/platform/wm/rhodes/IEBrowserEngine.h +7 -0
- data/platform/wm/rhodes/LogOptionsDlg.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +92 -7
- data/platform/wm/rhodes/MainWindow.h +28 -1
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -4
- data/platform/wm/rhodes/Rhodes.cpp +149 -10
- data/platform/wm/rhodes/resource.h +5 -1
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +307 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +14 -2
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +6 -3
- data/platform/wm/rhodes/rhodes.vcproj +5 -1
- data/platform/wm/rhodes/simulator/MainWindowQt.cpp +22 -1
- data/platform/wm/rhodes/simulator/MainWindowQt.h +4 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +1 -1
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +1 -1
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +33 -38
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +134 -29
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +12 -2
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +17 -1
- data/platform/wp7/RhoRubyLib/views/RhoTabHeader.xaml +3 -3
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +48 -8
- data/rakefile.rb +13 -2
- data/res/build-tools/iphonesim/build/Release/iphonesim_43 +0 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +158 -0
- data/res/generators/rhogen.rb +33 -28
- data/res/generators/templates/application/app/layout.erb +6 -5
- data/res/generators/templates/application/public/css/android.css +21 -315
- data/res/generators/templates/application/public/css/iphone.css +1 -499
- data/res/generators/templates/application/public/css/jqmobile-patch.css +18 -5
- data/res/generators/templates/application/public/css/windows_phone7.css +378 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.css → jquery.mobile-1.0.1.css} +33 -11
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.js → jquery.mobile-1.0.1.js} +249 -125
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.css +2 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.js +177 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile.structure-1.0.css → jquery.mobile.structure-1.0.1.css} +33 -11
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.1.min.css +2 -0
- data/res/generators/templates/application/public/jquery/jquery.json-2.3.js +193 -0
- data/res/generators/templates/application/public/jquery/jquery.json-2.3.min.js +23 -0
- data/res/generators/templates/application/public/js/jquery-wp7-patch.js +68 -20
- data/spec/phone_spec/app/Case/case.rb +22 -0
- data/spec/phone_spec/app/Customer/customer.rb +16 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +108 -11
- data/spec/phone_spec/app/spec/syncengine_spec.rb +43 -1
- data/spec/phone_spec/build.yml +2 -1
- data/version +1 -1
- metadata +27 -13
- data/platform/shared/common/ExtManager.cpp +0 -103
- data/res/generators/templates/application/public/jqmobile/jquery-mobile-iphone.css +0 -9
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +0 -2
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +0 -172
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +0 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
(function($){var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';}
|
3
|
+
var type=typeof o;if(type==='undefined'){return undefined;}
|
4
|
+
if(type==='number'||type==='boolean'){return''+o;}
|
5
|
+
if(type==='string'){return $.quoteString(o);}
|
6
|
+
if(type==='object'){if(typeof o.toJSON==='function'){return $.toJSON(o.toJSON());}
|
7
|
+
if(o.constructor===Date){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;}
|
8
|
+
if(day<10){day='0'+day;}
|
9
|
+
if(hours<10){hours='0'+hours;}
|
10
|
+
if(minutes<10){minutes='0'+minutes;}
|
11
|
+
if(seconds<10){seconds='0'+seconds;}
|
12
|
+
if(milli<100){milli='0'+milli;}
|
13
|
+
if(milli<10){milli='0'+milli;}
|
14
|
+
return'"'+year+'-'+month+'-'+day+'T'+
|
15
|
+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
|
16
|
+
if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i])||'null');}
|
17
|
+
return'['+ret.join(',')+']';}
|
18
|
+
var name,val,pairs=[];for(var k in o){type=typeof k;if(type==='number'){name='"'+k+'"';}else if(type==='string'){name=$.quoteString(k);}else{continue;}
|
19
|
+
type=typeof o[k];if(type==='function'||type==='undefined'){continue;}
|
20
|
+
val=$.toJSON(o[k]);pairs.push(name+':'+val);}
|
21
|
+
return'{'+pairs.join(',')+'}';}};$.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(src){return eval('('+src+')');};$.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(src){var filtered=src.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered)){return eval('('+src+')');}else{throw new SyntaxError('Error parsing JSON, source is not valid.');}};$.quoteString=function(string){if(string.match(escapeable)){return'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;}
|
22
|
+
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
|
23
|
+
return'"'+string+'"';};})(jQuery);
|
@@ -44,6 +44,27 @@
|
|
44
44
|
return {};
|
45
45
|
}
|
46
46
|
|
47
|
+
function normalizeAjaxData(data) {
|
48
|
+
// if it is an object then return as it is
|
49
|
+
if ('object' == typeof data) return data;
|
50
|
+
// if it is a query string then parse it and return as an object
|
51
|
+
if ('string' == typeof data) {
|
52
|
+
data = $.trim(data);
|
53
|
+
data = (0 <= data.indexOf('?')) ? data.substring(data.indexOf('?')) : data;
|
54
|
+
var items = {};
|
55
|
+
$.each(data.split('&'), function(idx, item){
|
56
|
+
var keyVal = item.split('=');
|
57
|
+
if (keyVal && keyVal[0]) {
|
58
|
+
items[keyVal[0]] = keyVal[1] || null;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
return items;
|
62
|
+
}
|
63
|
+
// if it is neither string nor object,
|
64
|
+
// then so far we have no idea how to handle it
|
65
|
+
return {};
|
66
|
+
}
|
67
|
+
|
47
68
|
var _ajax = $.ajax;
|
48
69
|
|
49
70
|
function wp7ajax() {
|
@@ -80,44 +101,64 @@
|
|
80
101
|
//console.log('typeof options.data: ' + typeof options.data);
|
81
102
|
//if ("string" == typeof options.data) console.log('options.data: ' + options.data);
|
82
103
|
|
83
|
-
var urlQueryParams = "";
|
84
104
|
// set next call id value
|
85
|
-
var cbIdValue =
|
105
|
+
var cbIdValue = (_rho_callbackId_valuePrefix + callbackCount++);
|
86
106
|
|
87
|
-
|
88
|
-
|
89
|
-
}
|
90
|
-
if ("object" != typeof options.data) {
|
91
|
-
options.data = {};
|
92
|
-
}
|
107
|
+
// ensure data is an object, not string
|
108
|
+
var data = normalizeAjaxData(options.data);
|
93
109
|
|
94
110
|
// set callback id param value
|
95
|
-
|
111
|
+
data[_rho_callbackId_paramName] = encodeURIComponent(cbIdValue);
|
112
|
+
|
96
113
|
// set deferred object to resolve/reject late
|
97
114
|
options[_rho_deferred_paramName] = $.Deferred();
|
115
|
+
|
98
116
|
// store options for pending callback
|
99
|
-
pendingCallbacks[
|
117
|
+
pendingCallbacks[cbIdValue] = options;
|
100
118
|
|
101
119
|
// compose GET request formatted URI
|
102
|
-
|
103
|
-
|
120
|
+
var urlQueryParams = "";
|
121
|
+
$.each(data, function(name, value){
|
122
|
+
urlQueryParams += ((0 < urlQueryParams.length ? "&" : "?")
|
104
123
|
+encodeURIComponent(name) +'=' +encodeURIComponent(value));
|
105
124
|
});
|
106
125
|
|
126
|
+
var request = $.extend({}, {
|
127
|
+
url: options.url,
|
128
|
+
type: options.type || 'GET',
|
129
|
+
contentType: options.contentType || 'application/x-www-form-urlencoded',
|
130
|
+
headers: options.headers || {},
|
131
|
+
username: options.username || null,
|
132
|
+
password: options.password || null,
|
133
|
+
data: data
|
134
|
+
});
|
135
|
+
|
136
|
+
if (options.accepts) {
|
137
|
+
request.headers['Accept'] = options.accepts;
|
138
|
+
}
|
139
|
+
|
107
140
|
//console.log('wp7notifyProxy: urlQueryParams: ' +urlQueryParams);
|
108
|
-
|
141
|
+
var reqObj = $.toJSON(request);
|
142
|
+
window.external.notify('request:' +reqObj);
|
143
|
+
//window.external.notify('request:' +options.url +urlQueryParams);
|
109
144
|
return options[_rho_deferred_paramName];
|
110
145
|
}
|
111
146
|
|
112
|
-
function fireHandlers(options, result, status, errCode) {
|
147
|
+
function fireHandlers(options, result, headers, status, errCode) {
|
113
148
|
// TODO: fake jqXHR needs to be provided
|
114
|
-
var jqXHR =
|
115
|
-
|
149
|
+
var jqXHR = {
|
150
|
+
getResponseHeader: function(name) {
|
151
|
+
return ("object" == typeof headers) ? headers[name] : undefined;
|
152
|
+
},
|
153
|
+
getAllResponseHeaders: function() {
|
154
|
+
return ("object" == typeof headers) ? headers : {};
|
155
|
+
}
|
156
|
+
};
|
116
157
|
if ("error" == status) {
|
117
158
|
if ('function' == typeof options.error) {
|
118
159
|
// start handler asynchronously
|
119
160
|
setTimeout(function(){
|
120
|
-
options.error.apply(
|
161
|
+
options.error.apply(options.context, [jqXHR, status, result]);
|
121
162
|
}, 1);
|
122
163
|
}
|
123
164
|
if ('object' == typeof options[_rho_deferred_paramName]) {
|
@@ -127,7 +168,7 @@
|
|
127
168
|
if ('function' == typeof options.success) {
|
128
169
|
// start handler asynchronously
|
129
170
|
setTimeout(function(){
|
130
|
-
options.success.apply(
|
171
|
+
options.success.apply(options.context, [result, status, jqXHR]);
|
131
172
|
}, 1);
|
132
173
|
}
|
133
174
|
if ('object' == typeof options[_rho_deferred_paramName]) {
|
@@ -136,14 +177,21 @@
|
|
136
177
|
}
|
137
178
|
}
|
138
179
|
|
139
|
-
window._rho_ajaxProxyCallback = function(callbackId, result, status, errCode) {
|
180
|
+
window._rho_ajaxProxyCallback = function(callbackId, result, headers, status, errCode) {
|
140
181
|
var cbId = decodeURIComponent(callbackId);
|
141
182
|
//console.log('_rho_ajaxProxyCallback: callback for: ' +cbId);
|
183
|
+
//console.log('_rho_ajaxProxyCallback: result: ' +result);
|
142
184
|
if (pendingCallbacks[cbId]) {
|
143
|
-
|
185
|
+
//console.log('_rho_ajaxProxyCallback: callback found!');
|
186
|
+
fireHandlers(pendingCallbacks[cbId], result,
|
187
|
+
("string" == typeof headers) ? $.parseJSON(headers) : headers,
|
188
|
+
status, errCode);
|
144
189
|
delete pendingCallbacks[cbId];
|
145
190
|
}
|
146
191
|
};
|
147
192
|
|
193
|
+
window._rho_execJsWrapper = function(expr) {
|
194
|
+
eval(expr);
|
195
|
+
};
|
148
196
|
|
149
197
|
})(jQuery);
|
@@ -4,4 +4,26 @@ class Case
|
|
4
4
|
include Rhom::PropertyBag
|
5
5
|
|
6
6
|
enable :full_update
|
7
|
+
|
8
|
+
#set :freezed, true
|
9
|
+
|
10
|
+
property :status, :string
|
11
|
+
property :assigned_user_id, :string
|
12
|
+
property :created_by_name, :string
|
13
|
+
property :work_log, :string
|
14
|
+
property :priority, :string
|
15
|
+
property :case_number, :string
|
16
|
+
property :account_id, :string
|
17
|
+
property :type, :string
|
18
|
+
property :modified_user_id, :string
|
19
|
+
property :name, :string
|
20
|
+
property :assigned_user_name, :string
|
21
|
+
property :modified_by_name, :string
|
22
|
+
property :description, :string
|
23
|
+
property :date_modified, :string
|
24
|
+
property :date_entered, :string
|
25
|
+
property :resolution, :string
|
26
|
+
property :created_by, :string
|
27
|
+
property :account_name, :string
|
28
|
+
|
7
29
|
end
|
@@ -4,4 +4,20 @@ class Customer
|
|
4
4
|
enable :sync
|
5
5
|
|
6
6
|
set :sync_priority, 2
|
7
|
+
|
8
|
+
#set :freezed, true
|
9
|
+
|
10
|
+
property :address, :string
|
11
|
+
property :created_at, :string
|
12
|
+
property :city, :string
|
13
|
+
property :email, :string
|
14
|
+
#property :first, :string
|
15
|
+
property :last, :string
|
16
|
+
property :updated_at, :string
|
17
|
+
property :lat, :string
|
18
|
+
property :long, :string
|
19
|
+
property :phone, :string
|
20
|
+
property :state, :string
|
21
|
+
property :zip, :string
|
22
|
+
|
7
23
|
end
|
@@ -22,11 +22,22 @@ require 'rho/rhoutils'
|
|
22
22
|
require 'json'
|
23
23
|
|
24
24
|
USE_HSQLDB = !System.get_property('has_sqlite')
|
25
|
-
USE_COPY_FILES =
|
25
|
+
USE_COPY_FILES = true
|
26
|
+
|
27
|
+
if defined? RHO_ME
|
28
|
+
USE_COPY_FILES = false
|
29
|
+
end
|
30
|
+
|
31
|
+
if defined? RHO_WP7
|
32
|
+
USE_COPY_FILES = false
|
33
|
+
end
|
34
|
+
|
26
35
|
if ( System.get_property('platform') == 'WINDOWS' && System.get_property('device_name') != 'Win32' )
|
27
36
|
USE_COPY_FILES = false
|
28
37
|
end
|
29
38
|
|
39
|
+
puts "USE_COPY_FILES: #{USE_COPY_FILES}"
|
40
|
+
|
30
41
|
def getAccount
|
31
42
|
return Account_s if $spec_settings[:schema_model]
|
32
43
|
|
@@ -61,6 +72,8 @@ def clean_db_data
|
|
61
72
|
getTestDB().delete_all_from_table('client_info')
|
62
73
|
getTestDB().delete_all_from_table('object_values')
|
63
74
|
getTestDB().delete_all_from_table('changed_values')
|
75
|
+
getTestDB().delete_all_from_table('Account_s')
|
76
|
+
getTestDB().delete_all_from_table('Case_s')
|
64
77
|
getTestDB().commit
|
65
78
|
end
|
66
79
|
|
@@ -117,6 +130,9 @@ class Test_Helper
|
|
117
130
|
else
|
118
131
|
clean_db_data
|
119
132
|
end
|
133
|
+
|
134
|
+
Rho::RhoConfig.sources()[getCase_str()]['freezed'] = false if !$spec_settings[:schema_model]
|
135
|
+
|
120
136
|
end
|
121
137
|
|
122
138
|
def before_each
|
@@ -164,11 +180,11 @@ describe "Rhom::RhomObject" do
|
|
164
180
|
account.name = 'hello name'
|
165
181
|
account.industry = 'hello industry'
|
166
182
|
account.object = '3560c0a0-ef58-2f40-68a5-fffffffffffff'
|
167
|
-
account.value = 'xyz industries'
|
183
|
+
#account.value = 'xyz industries'
|
168
184
|
account.name.should == 'hello name'
|
169
185
|
account.industry.should == 'hello industry'
|
170
186
|
account.object.should == '3560c0a0-ef58-2f40-68a5-fffffffffffff'
|
171
|
-
account.value.should == 'xyz industries'
|
187
|
+
#account.value.should == 'xyz industries'
|
172
188
|
end
|
173
189
|
|
174
190
|
it "should retrieve getCase models" do
|
@@ -570,15 +586,20 @@ end
|
|
570
586
|
end
|
571
587
|
|
572
588
|
it "should _NOT_ set 'attrib_type' field for a record" do
|
573
|
-
new_attributes = {"attrib_type"=>"Partner"}
|
574
|
-
@account = getAccount.find('44e804f2-4933-4e20-271c-48fcecd9450d')
|
575
|
-
@account.update_attributes(new_attributes)
|
576
589
|
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
590
|
+
if $spec_settings[:schema_model]
|
591
|
+
1.should == 1
|
592
|
+
else
|
593
|
+
new_attributes = {"attrib_type"=>"Partner"}
|
594
|
+
@account = getAccount.find('44e804f2-4933-4e20-271c-48fcecd9450d')
|
595
|
+
@account.update_attributes(new_attributes)
|
596
|
+
|
597
|
+
@new_acct = getAccount.find('44e804f2-4933-4e20-271c-48fcecd9450d')
|
598
|
+
|
599
|
+
@new_acct.name.should == "Mobio India"
|
600
|
+
@new_acct.instance_variables.each do |var|
|
601
|
+
var.to_s.gsub(/@/,'').match('\btype\b').should be_nil
|
602
|
+
end
|
582
603
|
end
|
583
604
|
end
|
584
605
|
|
@@ -1582,6 +1603,82 @@ end
|
|
1582
1603
|
|
1583
1604
|
end
|
1584
1605
|
#=end
|
1606
|
+
|
1607
|
+
it "should not add property to freezed model" do
|
1608
|
+
|
1609
|
+
if !$spec_settings[:schema_model]
|
1610
|
+
props = Rho::RhoConfig.sources()[getCase_str()]
|
1611
|
+
props['freezed'] = true
|
1612
|
+
|
1613
|
+
props['freezed'].should == true
|
1614
|
+
#props['property'].should_not be_nil
|
1615
|
+
#props['property']['description'].should_not be_nil
|
1616
|
+
end
|
1617
|
+
|
1618
|
+
lambda { obj = getCase().new( :wrong_address => 'test') }.should raise_error(ArgumentError)
|
1619
|
+
lambda { obj = getCase().create( :wrong_address => 'test') }.should raise_error(ArgumentError)
|
1620
|
+
|
1621
|
+
lambda {
|
1622
|
+
obj = getCase().new
|
1623
|
+
obj.wrong_address = 'test'
|
1624
|
+
}.should raise_error(ArgumentError)
|
1625
|
+
|
1626
|
+
lambda {
|
1627
|
+
obj = getCase().new
|
1628
|
+
obj.update_attributes(:wrong_address => 'test')
|
1629
|
+
}.should raise_error(ArgumentError)
|
1630
|
+
|
1631
|
+
if $spec_settings[:schema_model]
|
1632
|
+
lambda {
|
1633
|
+
getCase().find_by_sql("INSERT INTO #{getCase_str()}(object,wrong_address) values ('1234', 'my_addr')")
|
1634
|
+
}.should raise_error(ArgumentError)
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
end
|
1638
|
+
|
1639
|
+
it "should add property to freezed model" do
|
1640
|
+
if !$spec_settings[:schema_model]
|
1641
|
+
props = Rho::RhoConfig.sources()[getCase_str()]
|
1642
|
+
props['freezed'] = true
|
1643
|
+
|
1644
|
+
props['freezed'].should == true
|
1645
|
+
#props['property'].should_not be_nil
|
1646
|
+
#props['property']['description'].should_not be_nil
|
1647
|
+
end
|
1648
|
+
|
1649
|
+
obj = getCase().new( :description => 'test')
|
1650
|
+
obj.description.should == "test"
|
1651
|
+
|
1652
|
+
obj1 = getCase().create( :description => 'test1')
|
1653
|
+
obj1.description.should == "test1"
|
1654
|
+
res1 = getCase().find(obj1.object)
|
1655
|
+
res1.should_not be_nil
|
1656
|
+
res1.description.should == "test1"
|
1657
|
+
|
1658
|
+
obj2 = getCase().new
|
1659
|
+
obj2.description = 'test2'
|
1660
|
+
obj2.save()
|
1661
|
+
res2 = getCase().find(obj2.object)
|
1662
|
+
res2.should_not be_nil
|
1663
|
+
res2.description.should == "test2"
|
1664
|
+
|
1665
|
+
obj3 = getCase().new
|
1666
|
+
obj3.update_attributes(:description => 'test3')
|
1667
|
+
obj3.description.should == "test3"
|
1668
|
+
res3 = getCase().find(obj3.object)
|
1669
|
+
res3.should_not be_nil
|
1670
|
+
res3.description.should == "test3"
|
1671
|
+
|
1672
|
+
if $spec_settings[:schema_model]
|
1673
|
+
getCase().find_by_sql("INSERT INTO #{getCase_str()}(object,description) values ('1234', 'my_addr')")
|
1674
|
+
res4 = getCase().find('1234')
|
1675
|
+
res4.should_not be_nil
|
1676
|
+
res4.description.should == "my_addr"
|
1677
|
+
|
1678
|
+
end
|
1679
|
+
|
1680
|
+
end
|
1681
|
+
|
1585
1682
|
end
|
1586
1683
|
#=begin
|
1587
1684
|
describe "Rhom#paginate" do
|
@@ -59,9 +59,11 @@ def syncserver_url
|
|
59
59
|
when /apple/i then 'iphone'
|
60
60
|
when /symbian/i then 'symbian'
|
61
61
|
when /wp7/i then 'wp'
|
62
|
+
when /windows/i then 'wm'
|
62
63
|
end
|
63
64
|
platform = 'win32' if System.get_property('device_name') == 'Win32'
|
64
65
|
|
66
|
+
puts "platform: #{platform}"
|
65
67
|
exact_url = SYNC_SERVER_URL.gsub(/exact_platform/, platform)
|
66
68
|
puts "going to reset server: #{exact_url}"
|
67
69
|
exact_url
|
@@ -258,7 +260,7 @@ end
|
|
258
260
|
res['status'].should == 'complete'
|
259
261
|
res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
|
260
262
|
end
|
261
|
-
|
263
|
+
|
262
264
|
it "should sync all" do
|
263
265
|
SyncEngine.logged_in.should == 1
|
264
266
|
|
@@ -862,6 +864,46 @@ end
|
|
862
864
|
item2.vars.should_not be_nil
|
863
865
|
end
|
864
866
|
|
867
|
+
it "should not sync non-exist properties from freezed model" do
|
868
|
+
SyncEngine.logged_in.should == 1
|
869
|
+
|
870
|
+
res = ::Rho::RhoSupport::parse_query_parameters getCustomer.sync( "/app/Settings/sync_notify")
|
871
|
+
res['status'].should == 'ok'
|
872
|
+
res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
|
873
|
+
|
874
|
+
cust = getCustomer().find(:first, :conditions => {:first => 'CustTest2'} )
|
875
|
+
cust.should_not be_nil
|
876
|
+
|
877
|
+
Rhom::Rhom.database_full_reset
|
878
|
+
Rho::RhoConfig.bulksync_state='1'
|
879
|
+
|
880
|
+
cust1 = getCustomer().find(:first)
|
881
|
+
cust1.should be_nil
|
882
|
+
|
883
|
+
saved_src = Rho::RhoConfig.sources[getCustomer_str()]
|
884
|
+
begin
|
885
|
+
if !$spec_settings[:schema_model]
|
886
|
+
Rho::RhoConfig.sources[getCustomer_str()]['freezed'] = true
|
887
|
+
else
|
888
|
+
Rho::RhoConfig.sources[getCustomer_str()]['schema']['property'].delete('first')
|
889
|
+
end
|
890
|
+
::Rho::RHO.init_sync_source_properties(Rho::RhoConfig::sources.values)
|
891
|
+
|
892
|
+
res2 = ::Rho::RhoSupport::parse_query_parameters getCustomer.sync( "/app/Settings/sync_notify")
|
893
|
+
res2['status'].should == 'ok'
|
894
|
+
res2['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE
|
895
|
+
|
896
|
+
cust_all = getCustomer().find(:all)
|
897
|
+
cust_all.should_not be_nil
|
898
|
+
cust_all.size.should > 0
|
899
|
+
|
900
|
+
cust2 = getCustomer().find(:first, :conditions => {:first => 'CustTest2'} )
|
901
|
+
cust2.should be_nil
|
902
|
+
ensure
|
903
|
+
Rho::RhoConfig.sources[getCustomer_str()] = saved_src
|
904
|
+
end
|
905
|
+
end
|
906
|
+
|
865
907
|
it "should logout" do
|
866
908
|
SyncEngine.logout()
|
867
909
|
|