Changes

Jump to: navigation, search

CloudServices/NativeSync

361 bytes removed, 22:04, 1 February 2012
Native Sync
hw.ramSize=256
{{note|Target (in the example above, '<tt>android-10'</tt>) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}}
* to launch:
== Running everything ==
You'll be wanting to run test-The main <tt>android-sync</tt> source repository is hosted on github:
* https://github.com/mozilla-services/test-android-sync
This depends on the android-sync project, as described in [http://developer.android.com/guide/topics/testing/testing_android.html the Android testing docs]:Try
* https:// git clone git@github.com/:mozilla-services/android-sync.git
=== android-sync dependencies ===
* JUnit 4.1.
* org.simpleframework.simple, for HTTP testing.
* Tiny “un-stub” packages for android.util.Log and , android.util.Base64, and android.content.SharedPreferences.  These live on GitHubgithub, and must be built and installed. 
** https://github.com/rnewman/base64-unstub
** https://github.com/rnewman/log-unstub
** https://github.com/rnewman/sharedpreferences-stub
=== sync-crypto dependencies ===
sync-crypto relies on Apache commons-codec 1.5, which includes Base32. The Android system libraries include the 8-year-old version 1.2. As a result, sync-crypto is packaged as an assembly jar (aka über jar). Simply run <tt>build.sh</tt> to instruct Maven to do the right thing. An up-to-date version is checked in to the <tt>external</tt> directory in <tt>android-sync</tt>, with the <tt>mvnify</tt> script in that directory taking care of installing it in your local repository.
=== What you need to do ===
git clone https://github.com/rnewman/base64-unstub
git clone https://github.com/rnewman/log-unstub
git clone https://github.com/rnewman/sharedpreferences-stub
git clone https://github.com/mozilla-services/android-sync
git clone https://github.com/mozilla-services/test-android-sync pushd base64-unstub; mvn install; popd pushd log-unstub; mvn install; popd pushd androidsharedpreferences-sync/externalstub; ./mvnifymvn install; popd (Note: mvnify may not be available, in which case, skip this step)
pushd android-sync
git checkout develop ./depspreprocess.sh (Note: mvn assembly:assembly may fail, however, it is still ok to proceed.)
mvn test
To do real Android development and testing, you need to import both android-sync and test-android-sync as projects in Eclipse with the ADT installed.
{{note|<tt>mvn assembly:assembly</tt> may fail, however, it is still ok to proceed.}} To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed. Note that both android-sync and sync-crypto have JUnit 4 tests that run in both Eclipse and Maven. The subdirectory android-sync also provides functionality to /test-android-sync, which includes Android JUnit 3 tests for activity and store testing. This is to avoid the mammoth annoyance of testing in a VM without introducing robolectric.
=== Running Fennec ===
* Install Eclipse and the SDK plugin, as described in the Android SDK page.
* Correct formatting: <tt>Preferences > Java > Code style > Formatter > Edit...</tt>, set profile name to <tt>Mozilla</tt>, set <tt>Tab policy</tt> to <tt>Spaces only</tt> change both <tt>Indentation size</tt> and <tt>Tab size</tt> to 2, and check <tt>Align fields in columns</tt>.
* Run these commands in both your <tt>android-sync</tt> and <tt>test-android-sync</tt> git repository directories directory (don't forget to checkout the ''<tt>develop'' </tt> branch in both repositories):
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
mvn -DdownloadJavadocs=true -DdownloadSources=true eclipse:eclipse
* Install the project and classpath files (again in both your git repository directoresdirectory), making sure to update the paths where necessary in all both files:
cp example.project .project
cp example.classpath .classpath
* Open Eclipse, choose <tt>File > Import... > General > Existing Projects into Workspace</tt>, and specify each your git repository directory in turn.
{{note|You may need to set <tt>M2_REPO</tt> (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like <tt>$HOME/.m2/repository</tt>.}}
==== To run the android-sync unit test suite under Eclipse ====
* First configure the test suite launcher, under <tt>Preferences > Run/Debug > Launching > Default Launchers</tt>. Set the Debug and Run launchers to <tt>Android JUnit Test Launcher</tt>.
* Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>.
==== To run the test-android-sync integration test suite under Eclipse ==== * Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>. * Refresh and clean everything.
* Select the <tt>android-sync-test</tt> project (yes, the name is different from the git repository) and execute <tt>Run > Run As ... > Android JUnit Test</tt>.
== Development ==
We don't quite follow the [[Fennec/NativeUI/CodingStyle]]. See also [http://source.android.com/source/code-style.html the Android coding style].
=== Running unit test code coverage ===
To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run
mvn cobertura:cobertura
and click on <tt>org.mozilla.gecko</tt>.
 
{{note|At this time, you can't see the current integration test code coverage.}}
== Security ==
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
Confirm
355
edits

Navigation menu