rhoconnect-client 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/CREDITS +0 -0
- data/LICENSE +9 -0
- data/README.md +47 -0
- data/ext/rhoconnect-client/RhoConnectClient.rb +190 -0
- data/ext/rhoconnect-client/ext/RhoConnectClient.xml +726 -0
- data/ext/rhoconnect-client/ext/build +26 -0
- data/ext/rhoconnect-client/ext/build.bat +30 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_java.files +1 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_native.files +14 -0
- data/ext/rhoconnect-client/ext/platform/android/src/com/rhoconnectclient/RhoconnectClient.java +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/.gitignore +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/Rakefile +74 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient.xcodeproj/project.pbxproj +390 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient_Prefix.pch +7 -0
- data/ext/rhoconnect-client/ext/platform/iphone/impl/readme.txt +7 -0
- data/ext/rhoconnect-client/ext/platform/qt/Rakefile +35 -0
- data/ext/rhoconnect-client/ext/platform/qt/rhoconnect-client.pro +88 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.sln +36 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vcproj +774 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vsprops +15 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.cpp +40 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.h +2 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.props +22 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.sln +32 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj +220 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj.filters +103 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.cpp +273 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.h +60 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientSingletonImpl.h +53 -0
- data/ext/rhoconnect-client/ext/shared/initRhoconnectClient.cpp +207 -0
- data/ext/rhoconnect-client/ext/shared/rhoconnectclient.c +18 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.cpp +398 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.h +147 -0
- data/ext/rhoconnect-client/ext/shared/sync/ISyncProtocol.h +91 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp +1245 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.h +213 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.cpp +737 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.h +209 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_3.h +220 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_4.h +259 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.cpp +1694 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.h +212 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.cpp +583 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.h +250 -0
- data/ext/rhoconnect-client/ext.yml +12 -0
- data/lib/build/run_rhoconnect_spec.rb +135 -0
- data/lib/rhoconnect-client.rb +3 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1673 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +181 -0
- data/platform/shared/RhoConnectClient/RhoError.h +77 -0
- data/rhoconnect-client/C++/Tests/RhoConnectClientTest.cpp +830 -0
- data/rhoconnect-client/C++/Tests/win32/.gitignore +3 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.sln +65 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.vcproj +634 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/RhoConnectClientTest.vcproj +222 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/stdafx.h +65 -0
- data/rhoconnect-client/C++/Tests/win32/stdafx.h +65 -0
- data/rhoconnect-client/CHANGELOG +18 -0
- data/rhoconnect-client/Java/Android/build/android.rake +387 -0
- data/rhoconnect-client/Java/Android/build/android_sdk.rb +582 -0
- data/rhoconnect-client/Java/Android/build/libcurl_build.files +73 -0
- data/rhoconnect-client/Java/Android/build/libjson_build.files +9 -0
- data/rhoconnect-client/Java/Android/build/librhocommon_build.files +14 -0
- data/rhoconnect-client/Java/Android/build/librhodb_build.files +5 -0
- data/rhoconnect-client/Java/Android/build/librhoimpl_build.files +13 -0
- data/rhoconnect-client/Java/Android/build/librholog_build.files +4 -0
- data/rhoconnect-client/Java/Android/build/libsqlite_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/libsync_build.files +7 -0
- data/rhoconnect-client/Java/Android/build/libunzip_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/rhoconnectclient_build.files +3 -0
- data/rhoconnect-client/Java/Android/build/rhoimpljava_build.files +21 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/Capabilities.java +63 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/MemoryInfoCollector.java +79 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/util/ContextFactory.java +63 -0
- data/rhoconnect-client/Java/Android/test/.classpath +9 -0
- data/rhoconnect-client/Java/Android/test/.project +33 -0
- data/rhoconnect-client/Java/Android/test/AndroidManifest.xml +14 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/androidtest.png +0 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/Android/test/assets/rho.dat +9 -0
- data/rhoconnect-client/Java/Android/test/proguard.cfg +36 -0
- data/rhoconnect-client/Java/Android/test/project.properties +11 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/layout/main.xml +12 -0
- data/rhoconnect-client/Java/Android/test/res/values/strings.xml +5 -0
- data/rhoconnect-client/Java/Android/test/rhoimpl.jar +0 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClient.java +343 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClientBlobs.java +219 -0
- data/rhoconnect-client/Java/RhoConnect/.classpath +6 -0
- data/rhoconnect-client/Java/RhoConnect/.project +93 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/RhoConnect/assets/rho.dat +8 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/RhoConnectJniNotify.h +61 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectClient.h +181 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhomModel.h +103 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/rhojava.inc +76 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniClient.cpp +401 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniModel.cpp +332 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniNotify.cpp +223 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectUtil.cpp +82 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhodesApp.cpp +114 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectClient.java +108 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectNotify.java +78 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectObjectNotify.java +71 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhomModel.java +195 -0
- data/rhoconnect-client/JavaScript/.classpath +10 -0
- data/rhoconnect-client/JavaScript/.gitignore +4 -0
- data/rhoconnect-client/JavaScript/.project +17 -0
- data/rhoconnect-client/JavaScript/README.textile +1 -0
- data/rhoconnect-client/JavaScript/build.xml +185 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.js +44 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.png +0 -0
- data/rhoconnect-client/JavaScript/src/RhoSyncJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/RhoSyncStubsJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Capabilities.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/IRhoRubyHelper.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Mutex.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoAppAdapter.java +39 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoClassFactory.java +29 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoConf.java +100 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyLogger.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyProfiler.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoLogger.java +32 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoProfiler.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhodesApp.java +25 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/TimeInterval.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Tokenizer.java +23 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAdapter.java +174 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAttrManager.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBException.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/IDBResult.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/IFileAccess.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/SimpleFile.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/IHttpConnection.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetRequest.java +324 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetResponse.java +51 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/URI.java +64 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/ClientRegister.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONArrayIterator.java +37 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONEntry.java +48 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONStructIterator.java +41 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncNotify.java +98 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncThread.java +92 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet-deps.jar +0 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet.jar +0 -0
- data/rhoconnect-client/JavaScript/war/js/fsm-sample.js +54 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-api.js +237 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-fsm.js +307 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/4C71D69C9BBC9E6F05C6BA49B01BCBC1.cache.html +3122 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5146F4FFF34511C8BB2661E920B49E3A.cache.html +3254 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5248C67481D9D27AD0703D15CDBD2A1C.cache.html +3147 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/EE1DC2692C9C32367B53A39E2358AF23.cache.html +3195 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/clear.cache.gif +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topleft.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topright.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/splitPanelThumb.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard.css +1144 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard_rtl.css +1145 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/hosted.html +350 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/rhosyncjs.nocache.js +314 -0
- data/rhoconnect-client/JavaScript/war/test/SpecRunner.html +35 -0
- data/rhoconnect-client/JavaScript/war/test/dbtest.html +38 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/MIT.LICENSE +20 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine-html.js +188 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.css +166 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.js +2421 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SpecHelper.js +7 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SyncApiSpec.js +573 -0
- data/rhoconnect-client/JavaScript/war/test/spec/samples/PlayerSpec.js +58 -0
- data/rhoconnect-client/JavaScript/war/test/worker-test.js +17 -0
- data/rhoconnect-client/LICENSE +41 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.h +118 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.m +641 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.xcodeproj/project.pbxproj +1434 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.h +83 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.m +181 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.h +65 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.m +73 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.h +101 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.m +320 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/MainWindow.xib +198 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest.xcodeproj/project.pbxproj +373 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.h +58 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.m +84 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest_Prefix.pch +8 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/invalid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/main.m +1096 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test2.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/valid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.h +62 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.m +35 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.h +78 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.m +549 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/MainWindow.xib +227 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/main.m +17 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests.xcodeproj/project.pbxproj +363 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptestsViewController.xib +641 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests_Prefix.pch +8 -0
- data/rhoconnect-client/README.textile +23 -0
- data/rhoconnect-client/Rakefile +20 -0
- data/rhoconnect-client/Samples/Java/android_store/.classpath +8 -0
- data/rhoconnect-client/Samples/Java/android_store/.project +33 -0
- data/rhoconnect-client/Samples/Java/android_store/AndroidManifest.xml +24 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/rho.dat +8 -0
- data/rhoconnect-client/Samples/Java/android_store/default.properties +11 -0
- data/rhoconnect-client/Samples/Java/android_store/project.properties +14 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/layout/main.xml +12 -0
- data/rhoconnect-client/Samples/Java/android_store/res/values/strings.xml +5 -0
- data/rhoconnect-client/Samples/Java/android_store/rhoimpl.jar +0 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreActivity.java +68 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreApplication.java +15 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.h +70 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.m +94 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.h +82 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.m +119 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.h +63 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.m +314 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.h +65 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.m +110 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.h +61 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.m +171 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/LoginViewController.xib +779 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/MainWindow.xib +580 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/RootViewController.xib +384 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/WaitLoginController.xib +557 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/icon.png +0 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/main.m +22 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store-Info.plist +30 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store.xcodeproj/project.pbxproj +367 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store_Prefix.pch +14 -0
- data/rhoconnect-client/build.yml +3 -0
- data/rhoconnect-client/version +1 -0
- metadata +314 -0
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
// Rhodes js sync client API test spec
|
|
2
|
+
|
|
3
|
+
describe("Sync client API", function() {
|
|
4
|
+
|
|
5
|
+
it("have namespaces defined", function() {
|
|
6
|
+
expect(Rhomobile).toBeSet();
|
|
7
|
+
expect(Rhomobile.event).toBeSet();
|
|
8
|
+
expect(Rhomobile.internal).toBeSet();
|
|
9
|
+
expect(Rhomobile.sync).toBeSet();
|
|
10
|
+
expect(Rhomobile.db).toBeSet();
|
|
11
|
+
expect(Rhomobile.fsm).toBeSet();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("loadModules is defined", function() {
|
|
15
|
+
expect(Rhomobile.loadModules).toBeSet();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe("Rhomobile.fsm.Machine", function() {
|
|
19
|
+
var api = Rhomobile.fsm;
|
|
20
|
+
|
|
21
|
+
var fsmName = 'sample Machine';
|
|
22
|
+
var fsmInst = null;
|
|
23
|
+
|
|
24
|
+
beforeEach(function(){
|
|
25
|
+
fsmInst = new api.Machine(fsmName);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("is defined", function() {
|
|
29
|
+
expect(api.Machine).toBeSet();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("is able to construct an instance", function() {
|
|
33
|
+
expect(api.define).toBeSet();
|
|
34
|
+
var fsmInst2 = api.define('another '+fsmName);
|
|
35
|
+
expect(fsmInst2.name).not.toEqual(fsmName);
|
|
36
|
+
expect(fsmInst.name).toEqual(fsmName);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("is able to obtain definition", function() {
|
|
40
|
+
var def1 = jasmine.createSpy('Machine1 definition');
|
|
41
|
+
var def2 = jasmine.createSpy('Machine2 definition');
|
|
42
|
+
// states can be defined after creation
|
|
43
|
+
fsmInst.define(def1);
|
|
44
|
+
// or while creating the instance
|
|
45
|
+
var fsmInst2 = api.define('another '+fsmName, def2);
|
|
46
|
+
expect(def1).toHaveBeenCalledWith(fsmInst);
|
|
47
|
+
expect(def2).toHaveBeenCalledWith(fsmInst2);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("prohibits to define the same status twice", function() {
|
|
51
|
+
var stateName1 = 'sample input';
|
|
52
|
+
var stateName2 = stateName1;
|
|
53
|
+
|
|
54
|
+
fsmInst.state(stateName1);
|
|
55
|
+
|
|
56
|
+
var exceptionHappens = false;
|
|
57
|
+
try {
|
|
58
|
+
fsmInst.state(stateName2);
|
|
59
|
+
} catch(ex) {
|
|
60
|
+
jasmine.log('Exception thrown: '+ex);
|
|
61
|
+
exceptionHappens = true;
|
|
62
|
+
}
|
|
63
|
+
expect(exceptionHappens).toEqual(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("is able to have states", function() {
|
|
67
|
+
var stName1 = 'sample state';
|
|
68
|
+
var stName2 = 'another '+stName1;
|
|
69
|
+
|
|
70
|
+
expect(fsmInst.state).toBeSet();
|
|
71
|
+
fsmInst.state(stName1);
|
|
72
|
+
fsmInst.state(stName2);
|
|
73
|
+
|
|
74
|
+
expect(fsmInst.states).toBeSet();
|
|
75
|
+
expect(fsmInst.states[stName1].name).toEqual(stName1);
|
|
76
|
+
expect(fsmInst.states[stName2].name).toEqual(stName2);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("is able to have current state", function() {
|
|
80
|
+
var stName1 = 'sample state';
|
|
81
|
+
var stName2 = 'another '+stName1;
|
|
82
|
+
|
|
83
|
+
// if no states has been defined yet,
|
|
84
|
+
// then first one becomes current state
|
|
85
|
+
var st1 = fsmInst.state(stName1);
|
|
86
|
+
var st2 = fsmInst.state(stName2);
|
|
87
|
+
expect(fsmInst.currentState).toBeSet();
|
|
88
|
+
expect(fsmInst.currentState).toEqual(st1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("is able to have initial state", function() {
|
|
92
|
+
var stName1 = 'sample state';
|
|
93
|
+
var stName2 = 'another '+stName1;
|
|
94
|
+
|
|
95
|
+
// if no states has been defined yet,
|
|
96
|
+
// then first one becomes initial state
|
|
97
|
+
var st1 = fsmInst.state(stName1);
|
|
98
|
+
var st2 = fsmInst.state(stName2);
|
|
99
|
+
expect(fsmInst.initialState).toBeSet();
|
|
100
|
+
expect(fsmInst.initialState).toEqual(st1);
|
|
101
|
+
|
|
102
|
+
// and then we can change it to any defined
|
|
103
|
+
expect(fsmInst.withInitialState).toBeSet();
|
|
104
|
+
fsmInst.withInitialState(stName2);
|
|
105
|
+
// it changes
|
|
106
|
+
expect(fsmInst.initialState).toEqual(st2);
|
|
107
|
+
// but current state doesn't
|
|
108
|
+
expect(fsmInst.currentState).toEqual(st1);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("is able to be reset", function() {
|
|
112
|
+
var stName1 = 'sample state';
|
|
113
|
+
var stName2 = 'another '+stName1;
|
|
114
|
+
|
|
115
|
+
var st1 = fsmInst.state(stName1);
|
|
116
|
+
var st2 = fsmInst.state(stName2);
|
|
117
|
+
|
|
118
|
+
// first defined state becomes current one
|
|
119
|
+
expect(fsmInst.currentState).toEqual(st1);
|
|
120
|
+
|
|
121
|
+
// define initial state explicitly
|
|
122
|
+
fsmInst.withInitialState(stName2);
|
|
123
|
+
|
|
124
|
+
// reset to initial state
|
|
125
|
+
expect(fsmInst.reset).toBeSet();
|
|
126
|
+
fsmInst.reset();
|
|
127
|
+
expect(fsmInst.currentState).toEqual(st2);
|
|
128
|
+
|
|
129
|
+
// reset to any state
|
|
130
|
+
fsmInst.resetTo(stName1);
|
|
131
|
+
// it changes
|
|
132
|
+
expect(fsmInst.currentState).toEqual(st1);
|
|
133
|
+
// but initial state still the same
|
|
134
|
+
expect(fsmInst.initialState).toEqual(st2);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("is able to receive an input", function() {
|
|
138
|
+
expect(fsmInst.inputWith).toBeSet();
|
|
139
|
+
var inputSpy = spyOn(fsmInst, 'inputWith');
|
|
140
|
+
fsmInst.inputWith('button pressed', 5);
|
|
141
|
+
expect(inputSpy).toHaveBeenCalledWith('button pressed', 5);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("can change state on appropriate input applied", function() {
|
|
145
|
+
|
|
146
|
+
var lampSwitchFsm = api.define('Lamp switch FSM', function(fsm){
|
|
147
|
+
fsm.state('Light is OFF')
|
|
148
|
+
.on('turn switch on').transitsTo('Light is ON');
|
|
149
|
+
fsm.state('Light is ON')
|
|
150
|
+
.on('turn switch off').transitsTo('Light is OFF');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
expect(lampSwitchFsm).toBeSet();
|
|
154
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
155
|
+
|
|
156
|
+
lampSwitchFsm.inputWith('turn switch off');
|
|
157
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
158
|
+
|
|
159
|
+
lampSwitchFsm.inputWith('turn switch on');
|
|
160
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is ON');
|
|
161
|
+
|
|
162
|
+
lampSwitchFsm.inputWith('turn switch on');
|
|
163
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is ON');
|
|
164
|
+
|
|
165
|
+
lampSwitchFsm.inputWith('turn switch off');
|
|
166
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("can handle states with immediate transition", function() {
|
|
170
|
+
|
|
171
|
+
var lampSwitchFsm = api.define('Lamp switch FSM', function(fsm){
|
|
172
|
+
expect(fsm.state('some fake intact state w/o transitions').immediateTransitsTo).toBeSet();
|
|
173
|
+
|
|
174
|
+
fsm.state('Light is OFF')
|
|
175
|
+
.on('turn switch on').transitsTo('ON click sound produced');
|
|
176
|
+
fsm.state('ON click sound produced')
|
|
177
|
+
.immediateTransitsTo('Light is ON');
|
|
178
|
+
fsm.state('Light is ON')
|
|
179
|
+
.on('turn switch off').transitsTo('OFF click sound produced');
|
|
180
|
+
fsm.state('OFF click sound produced')
|
|
181
|
+
.immediateTransitsTo('Light is OFF');
|
|
182
|
+
}).withInitialState('Light is OFF').reset();
|
|
183
|
+
|
|
184
|
+
expect(lampSwitchFsm).toBeSet();
|
|
185
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
186
|
+
|
|
187
|
+
lampSwitchFsm.inputWith('turn switch off');
|
|
188
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
189
|
+
|
|
190
|
+
lampSwitchFsm.inputWith('turn switch on');
|
|
191
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is ON');
|
|
192
|
+
|
|
193
|
+
lampSwitchFsm.inputWith('turn switch on');
|
|
194
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is ON');
|
|
195
|
+
|
|
196
|
+
lampSwitchFsm.inputWith('turn switch off');
|
|
197
|
+
expect(lampSwitchFsm.currentState.name).toEqual('Light is OFF');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("can be rendered as a graph in a DOT notation", function() {
|
|
201
|
+
|
|
202
|
+
var lampSwitchFsm = api.define('Lamp switch FSM', function(fsm){
|
|
203
|
+
expect(fsm.state('some fake intact state w/o transitions').immediateTransitsTo).toBeSet();
|
|
204
|
+
|
|
205
|
+
fsm.state('Light is OFF')
|
|
206
|
+
.on('turn switch on').transitsTo('ON click sound produced');
|
|
207
|
+
fsm.state('ON click sound produced')
|
|
208
|
+
.immediateTransitsTo('Light is ON');
|
|
209
|
+
fsm.state('Light is ON')
|
|
210
|
+
.on('turn switch off').transitsTo('OFF click sound produced');
|
|
211
|
+
fsm.state('OFF click sound produced')
|
|
212
|
+
.immediateTransitsTo('Light is OFF');
|
|
213
|
+
}).withInitialState('Light is OFF').reset();
|
|
214
|
+
|
|
215
|
+
var dot = lampSwitchFsm.renderAsDot();
|
|
216
|
+
expect(dot).toBeSet();
|
|
217
|
+
expect(dot.length).toBeSet();
|
|
218
|
+
expect(dot.length).toBeGreaterThan("graph".length);
|
|
219
|
+
jasmine.log(dot);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
describe("Rhomobile.fsm.State", function() {
|
|
225
|
+
var api = Rhomobile.fsm;
|
|
226
|
+
|
|
227
|
+
var fsmName = 'sample Machine';
|
|
228
|
+
var fsmInst = null;
|
|
229
|
+
|
|
230
|
+
var stateName = 'sample State';
|
|
231
|
+
var stateInst = null;
|
|
232
|
+
|
|
233
|
+
beforeEach(function(){
|
|
234
|
+
fsmInst = api.define(fsmName);
|
|
235
|
+
stateInst = fsmInst.state(stateName);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it("is defined", function() {
|
|
239
|
+
expect(api.State).toBeSet();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it("is able to construct an instance", function() {
|
|
243
|
+
var stateInst2 = fsmInst.state('another '+stateName);
|
|
244
|
+
expect(stateInst2.name).not.toEqual(stateName);
|
|
245
|
+
expect(stateInst.name).toEqual(stateName);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it("is able to receive an input from Machine", function() {
|
|
249
|
+
expect(stateInst.inputWith).toBeSet();
|
|
250
|
+
var inputSpy = spyOn(stateInst, 'inputWith');
|
|
251
|
+
fsmInst.inputWith('button pressed', 5);
|
|
252
|
+
expect(inputSpy).toHaveBeenCalledWith('button pressed', 5);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("is able to have inputs defined", function() {
|
|
256
|
+
var inputName1 = 'sample input';
|
|
257
|
+
var inputName2 = 'another '+inputName1;
|
|
258
|
+
|
|
259
|
+
expect(stateInst.on).toBeSet();
|
|
260
|
+
stateInst.on(inputName1);
|
|
261
|
+
stateInst.on(inputName2);
|
|
262
|
+
|
|
263
|
+
expect(stateInst.inputs).toBeSet();
|
|
264
|
+
expect(stateInst.inputs[inputName1].name).toEqual(inputName1);
|
|
265
|
+
expect(stateInst.inputs[inputName2].name).toEqual(inputName2);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it("prohibits to define the same input twice", function() {
|
|
269
|
+
var inputName1 = 'sample input';
|
|
270
|
+
var inputName2 = inputName1;
|
|
271
|
+
|
|
272
|
+
stateInst.on(inputName1);
|
|
273
|
+
|
|
274
|
+
var exceptionHappens = false;
|
|
275
|
+
try {
|
|
276
|
+
stateInst.on(inputName2);
|
|
277
|
+
} catch(ex) {
|
|
278
|
+
jasmine.log('Exception thrown: '+ex);
|
|
279
|
+
exceptionHappens = true;
|
|
280
|
+
}
|
|
281
|
+
expect(exceptionHappens).toEqual(true);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it("can fire actions properly", function() {
|
|
285
|
+
|
|
286
|
+
var unknownInput = 'unknown input';
|
|
287
|
+
var knownInput = 'well known input w/o transition follows';
|
|
288
|
+
var turnOnInput = 'turn switch on';
|
|
289
|
+
var turnOffInput = 'turn switch off';
|
|
290
|
+
|
|
291
|
+
var stateOn = 'Light is ON';
|
|
292
|
+
var stateOff = 'Light is OFF';
|
|
293
|
+
|
|
294
|
+
var spyOnEntry = jasmine.createSpy('spy on entry action');
|
|
295
|
+
var spyOnExit = jasmine.createSpy('spy on exit action');
|
|
296
|
+
var spyOnInput = jasmine.createSpy('spy on input action');
|
|
297
|
+
var spyOnTransit = jasmine.createSpy('spy on transition action');
|
|
298
|
+
|
|
299
|
+
var lampSwitchFsm = api.define('Lamp switch FSM', function(fsm){
|
|
300
|
+
|
|
301
|
+
fsm.state('Light is OFF')
|
|
302
|
+
.on(turnOnInput).transitsTo(stateOn)
|
|
303
|
+
.withEntryAction('entry action1', spyOnEntry)
|
|
304
|
+
.withExitAction('exit action1', spyOnExit)
|
|
305
|
+
.withActionOnInput(knownInput, 'input action1', spyOnInput)
|
|
306
|
+
.withActionOnTransitTo(stateOff, 'transit action1', spyOnTransit)
|
|
307
|
+
.withActionOnTransitTo(stateOn, 'transit action1', spyOnTransit)
|
|
308
|
+
;
|
|
309
|
+
|
|
310
|
+
fsm.state('Light is ON')
|
|
311
|
+
.on(turnOffInput).transitsTo(stateOff)
|
|
312
|
+
.withEntryAction('entry action2', spyOnEntry)
|
|
313
|
+
.withExitAction('exit action2', spyOnExit)
|
|
314
|
+
.withActionOnInput(knownInput, 'input action3', spyOnInput)
|
|
315
|
+
.withActionOnTransitTo(stateOn, 'transit action2', spyOnTransit)
|
|
316
|
+
.withActionOnTransitTo(stateOff, 'transit action2', spyOnTransit)
|
|
317
|
+
;
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
var cntEntry = 0;
|
|
321
|
+
var cntExit = 0;
|
|
322
|
+
var cntInput = 0;
|
|
323
|
+
var cntTrans = 0;
|
|
324
|
+
|
|
325
|
+
var reportCounts = function(logMsg) {
|
|
326
|
+
jasmine.log(logMsg);
|
|
327
|
+
jasmine.log('-- entry'); expect(spyOnEntry.callCount).toEqual(cntEntry);
|
|
328
|
+
jasmine.log('-- exit'); expect(spyOnExit.callCount).toEqual(cntExit);
|
|
329
|
+
jasmine.log('-- input'); expect(spyOnInput.callCount).toEqual(cntInput);
|
|
330
|
+
jasmine.log('-- transition'); expect(spyOnTransit.callCount).toEqual(cntTrans);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
reportCounts(stateOff+': initial state');
|
|
334
|
+
|
|
335
|
+
lampSwitchFsm.inputWith(unknownInput);
|
|
336
|
+
// nothing should happen
|
|
337
|
+
reportCounts(stateOff+': '+unknownInput);
|
|
338
|
+
|
|
339
|
+
lampSwitchFsm.inputWith(knownInput, 123);
|
|
340
|
+
cntInput++;
|
|
341
|
+
// still at the same state, but action happens
|
|
342
|
+
reportCounts(stateOff+': '+knownInput);
|
|
343
|
+
expect(spyOnInput).toHaveBeenCalledWith(123);
|
|
344
|
+
|
|
345
|
+
lampSwitchFsm.inputWith(turnOffInput);
|
|
346
|
+
// nothing should happen
|
|
347
|
+
reportCounts(stateOff+': '+turnOffInput);
|
|
348
|
+
|
|
349
|
+
lampSwitchFsm.inputWith(turnOnInput);
|
|
350
|
+
// three more actions should be performed:
|
|
351
|
+
// exit current state, transition to the new one, and entry to the new state
|
|
352
|
+
cntEntry++;
|
|
353
|
+
cntTrans++;
|
|
354
|
+
cntExit++;
|
|
355
|
+
reportCounts(stateOff+': '+turnOnInput);
|
|
356
|
+
|
|
357
|
+
lampSwitchFsm.inputWith(unknownInput);
|
|
358
|
+
// no changes should happen
|
|
359
|
+
reportCounts(stateOn+': '+unknownInput);
|
|
360
|
+
|
|
361
|
+
lampSwitchFsm.inputWith(knownInput, 123);
|
|
362
|
+
// still at the same state, but action happens
|
|
363
|
+
cntInput++;
|
|
364
|
+
reportCounts(stateOn+': '+knownInput);
|
|
365
|
+
expect(spyOnInput).toHaveBeenCalledWith(123);
|
|
366
|
+
|
|
367
|
+
lampSwitchFsm.inputWith(turnOnInput);
|
|
368
|
+
// nothing should happen
|
|
369
|
+
reportCounts(stateOn+': '+turnOnInput);
|
|
370
|
+
|
|
371
|
+
lampSwitchFsm.inputWith(turnOffInput);
|
|
372
|
+
// three more actions should be performed:
|
|
373
|
+
// exit current state, transition to the new one, and entry to the new state
|
|
374
|
+
cntEntry++;
|
|
375
|
+
cntTrans++;
|
|
376
|
+
cntExit++;
|
|
377
|
+
reportCounts(stateOn+': '+turnOffInput);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
describe("Rhomobile.fsm.Input", function() {
|
|
382
|
+
var api = Rhomobile.fsm;
|
|
383
|
+
|
|
384
|
+
var fsmName = 'sample Machine';
|
|
385
|
+
var fsmInst = null;
|
|
386
|
+
|
|
387
|
+
var stateName = 'sample State';
|
|
388
|
+
var stateInst = null;
|
|
389
|
+
|
|
390
|
+
var inputName = 'sample Input';
|
|
391
|
+
var inputInst = null;
|
|
392
|
+
|
|
393
|
+
beforeEach(function(){
|
|
394
|
+
fsmInst = api.define(fsmName);
|
|
395
|
+
stateInst = fsmInst.state(stateName);
|
|
396
|
+
inputInst = stateInst.on(inputName);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it("is defined", function() {
|
|
400
|
+
expect(api.Input).toBeSet();
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
it("is able to construct an instance", function() {
|
|
404
|
+
var inputInst2 = stateInst.on('another '+inputName);
|
|
405
|
+
expect(inputInst2.name).not.toEqual(inputName);
|
|
406
|
+
expect(inputInst.name).toEqual(inputName);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it("is able to have transition defined", function() {
|
|
410
|
+
var transName1 = 'sample sample transition';
|
|
411
|
+
|
|
412
|
+
expect(inputInst.transitsTo).toBeSet();
|
|
413
|
+
|
|
414
|
+
var stateCheck = inputInst.transitsTo(transName1);
|
|
415
|
+
// state should be returned
|
|
416
|
+
expect(stateCheck).toEqual(stateInst);
|
|
417
|
+
|
|
418
|
+
expect(inputInst.transition).toBeSet();
|
|
419
|
+
expect(inputInst.transition).toEqual(transName1);
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
describe("Rhomobile.data.Model", function() {
|
|
425
|
+
var api = Rhomobile.data;
|
|
426
|
+
|
|
427
|
+
it("is defined", function() {
|
|
428
|
+
expect(api.Model).toBeSet();
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it("is able to construct an instance", function() {
|
|
432
|
+
var name = "sampleModel";
|
|
433
|
+
var inst1 = new api.Model(name);
|
|
434
|
+
var inst2 = new api.Model('another '+name);
|
|
435
|
+
expect(inst2.name).not.toEqual(name);
|
|
436
|
+
expect(inst1.name).toEqual(name);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
describe("Rhomobile.Config", function() {
|
|
442
|
+
var api = Rhomobile;
|
|
443
|
+
|
|
444
|
+
var models = [
|
|
445
|
+
new Rhomobile.data.Model("Customer", {
|
|
446
|
+
// options
|
|
447
|
+
'enable': ['sync'],
|
|
448
|
+
'set': {'sync_priority': 1, 'schema_version': '1.0'}
|
|
449
|
+
}, {
|
|
450
|
+
// properties
|
|
451
|
+
'address': 'string',
|
|
452
|
+
'created_at': 'string',
|
|
453
|
+
'city': 'string',
|
|
454
|
+
'email': 'string',
|
|
455
|
+
'first': 'string',
|
|
456
|
+
'last': 'string',
|
|
457
|
+
'updated_at': 'string',
|
|
458
|
+
'lat': 'string',
|
|
459
|
+
'long': 'string',
|
|
460
|
+
'phone': 'string',
|
|
461
|
+
'state': 'string',
|
|
462
|
+
'zip': 'string',
|
|
463
|
+
|
|
464
|
+
'SurveySectionID': 'string',
|
|
465
|
+
'SurveyID': 'string',
|
|
466
|
+
'CallID': 'string',
|
|
467
|
+
'SurveyResultID': 'string'
|
|
468
|
+
}),
|
|
469
|
+
|
|
470
|
+
new Rhomobile.data.Model("Product", {
|
|
471
|
+
// options
|
|
472
|
+
'enable': ['sync', 'pass_through'],
|
|
473
|
+
'set': {'sync_priority': 2, 'schema_version': '1.0'},
|
|
474
|
+
'belongs_to': [{'quantity': 'Customer_s'}, {'sku': 'Customer_s'}]
|
|
475
|
+
}, {
|
|
476
|
+
// properties
|
|
477
|
+
'brand': 'string',
|
|
478
|
+
'created_at': 'string',
|
|
479
|
+
'name': 'string',
|
|
480
|
+
'price': 'string',
|
|
481
|
+
'quantity': 'string',
|
|
482
|
+
'sku': 'string',
|
|
483
|
+
'updated_at': 'string'
|
|
484
|
+
})
|
|
485
|
+
];
|
|
486
|
+
|
|
487
|
+
it("is defined", function() {
|
|
488
|
+
expect(api.Config).toBeSet();
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it("is able to add a source", function() {
|
|
492
|
+
expect(api.Config.addSource).toBeSet();
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
describe("Rhomobile.db.DbStorage", function() {
|
|
497
|
+
var api = Rhomobile.db;
|
|
498
|
+
|
|
499
|
+
var dbName = "sampleSyncDb";
|
|
500
|
+
|
|
501
|
+
it("is defined", function() {
|
|
502
|
+
expect(api.DbStorage).toBeSet();
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it("is able to construct an instance", function() {
|
|
506
|
+
var inst1 = new api.DbStorage(dbName);
|
|
507
|
+
var inst2 = new api.DbStorage('another '+dbName);
|
|
508
|
+
expect(inst2.dbName).not.toEqual(dbName);
|
|
509
|
+
expect(inst1.dbName).toEqual(dbName);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it("is able to open database", function() {
|
|
513
|
+
var inst = new api.DbStorage(dbName);
|
|
514
|
+
var errHdlr = jasmine.createSpy('for error');
|
|
515
|
+
expect(inst.open).toBeSet();
|
|
516
|
+
inst.open(function(db){}, errHdlr);
|
|
517
|
+
expect(errHdlr).not.toHaveBeenCalled();
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it("is able to perform a query", function() {
|
|
521
|
+
var inst = new api.DbStorage(dbName);
|
|
522
|
+
var errHdlr = jasmine.createSpy('for error');
|
|
523
|
+
expect(inst.open).toBeSet();
|
|
524
|
+
inst.open("SELECT name FROM sqlite_master WHERE type='table'", errHdlr);
|
|
525
|
+
expect(errHdlr).not.toHaveBeenCalled();
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it("is able to initialized", function() {
|
|
529
|
+
var inst = new api.DbStorage(dbName);
|
|
530
|
+
var errHdlr = jasmine.createSpy('for error');
|
|
531
|
+
expect(inst.initSchema).toBeSet();
|
|
532
|
+
inst.initSchema(errHdlr);
|
|
533
|
+
expect(errHdlr).not.toHaveBeenCalled();
|
|
534
|
+
var names = inst.getAllTableNames(true, errHdlr);
|
|
535
|
+
expect(errHdlr).not.toHaveBeenCalled();
|
|
536
|
+
// expect(names).toBeSet();
|
|
537
|
+
// expect(names.length).toEqual(4+1);
|
|
538
|
+
// expect(names).toContain('sources');
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
describe("Rhomobile.sync.SyncThread", function() {
|
|
544
|
+
var api = Rhomobile.sync;
|
|
545
|
+
|
|
546
|
+
var OK_LOGIN = "lars";
|
|
547
|
+
var OK_PASSWD = "larspass";
|
|
548
|
+
var WRONG_LOGIN = "not-lars";
|
|
549
|
+
var WRONG_PASSWD = "not-larspass";
|
|
550
|
+
|
|
551
|
+
it("is defined", function() {
|
|
552
|
+
expect(api.Thread).toBeSet();
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
/*
|
|
556
|
+
it("shouldn't login with wrong credentials", function() {
|
|
557
|
+
expect(api.Thread.login).toBeSet();
|
|
558
|
+
var result = api.Thread.login(WRONG_LOGIN, WRONG_PASSWD);
|
|
559
|
+
expect(result).not.toBeNull();
|
|
560
|
+
expect(result).toBeFalsy();
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
it("should login OK with proper credentials", function() {
|
|
564
|
+
expect(api.Thread.login).toBeSet();
|
|
565
|
+
var result = api.Thread.login(OK_LOGIN, OK_PASSWD);
|
|
566
|
+
expect(result).not.toBeNull();
|
|
567
|
+
expect(result).toBeTruthy();
|
|
568
|
+
});
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
});
|