diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..6078f28a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,37 @@
+# Copied from https://github.com/leviwilson/android-travis-ci-example
+language: java
+jdk:
+ - openjdk6
+before_install:
+ # needed to run SDK on x64 systems
+ - sudo apt-get update -qq
+ - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
+ # download the latest android sdk and unzip
+ - ifconfig
+ - export SDK_TAR=android-sdk_r21-linux.tgz
+ - wget http://dl.google.com/android/$SDK_TAR
+ - tar -zxf $SDK_TAR
+ # setup ANDROID_HOME and PATH environment variables
+ - export ANDROID_HOME=`pwd`/android-sdk-linux
+ - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+ # only update the sdk for the platform-tool
+ # and the api level you are building for.
+ # run "android list sdk --extended" to get the full list.
+ # android-14 = 4.0 or API level 14
+ - android update sdk --filter sysimg-16,platform-tool,android-14,android-16 --obsolete --no-ui --force
+install: echo "Skip install"
+before_script:
+ - echo no | android create avd -n emulator16DE -t android-16 -c 50M --abi x86 --skin WVGA800 --force
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
+ - sleep 6 # give xvfb some time to start
+ - emulator -avd emulator16DE -prop persist.sys.language=en -prop persist.sys.country=US -noaudio -no-boot-anim &
+ - sleep 60
+ - adb kill-server
+ - adb start-server
+ - adb devices
+script:
+ - mvn clean install
+after_script:
+ - adb kill-server
+ - killall -r emulator*
diff --git a/agit-integration-tests/AndroidManifest.xml b/agit-integration-tests/AndroidManifest.xml
index e37568d9..07ac5bc4 100644
--- a/agit-integration-tests/AndroidManifest.xml
+++ b/agit-integration-tests/AndroidManifest.xml
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -14,5 +15,4 @@
"adb shell am instrument -w com.example.android.apis.tests/android.test.InstrumentationTestRunner"
-->
-
-
\ No newline at end of file
+
diff --git a/agit-integration-tests/pom.xml b/agit-integration-tests/pom.xml
index 0e8d54af..0a27d0d3 100644
--- a/agit-integration-tests/pom.xml
+++ b/agit-integration-tests/pom.xml
@@ -111,6 +111,9 @@
val ipAddresses = java.net.NetworkInterface.getNetworkInterfaces().filter { !_.isLoopback }.flatMap { _.getInetAddresses }.map { _.getHostAddress }.mkString(",")
AndroidDebugBridge.init(false)
val androidDebugBridge = AndroidDebugBridge.createBridge
+ // skipping emulator here,
+ // 10.0.2.2 is used for emulator
+ // see agit-test-utils/src/main/java/com/madgag/agit/GitTestUtils.java
androidDebugBridge.getDevices.filter { !_.isEmulator } foreach { d =>
val command = "echo gitserver.host.address="+ipAddresses+" > "+d.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE)+"/agit-integration-test.properties"
diff --git a/agit-integration-tests/project.properties b/agit-integration-tests/project.properties
new file mode 100644
index 00000000..22d0dca6
--- /dev/null
+++ b/agit-integration-tests/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-7
diff --git a/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java b/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
index 49565198..94975dc9 100644
--- a/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
+++ b/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
@@ -66,6 +66,19 @@
import roboguice.RoboGuice;
+class OperationThreadError {
+ private String error;
+ public OperationThreadError() {
+ error = "";
+ }
+ public String get() {
+ return error;
+ }
+ public void set(String newError) {
+ error = newError;
+ }
+}
+
public class GitAsyncTaskTest extends ActivityInstrumentationTestCase2 {
private static final String TAG = "GitAsyncTaskTest";
@@ -239,7 +252,8 @@ private Repository executeAndWaitFor(final GitOperation operation)
throws InterruptedException, IOException {
final CountDownLatch latch = new CountDownLatch(1);
Log.d(TAG, "About to start " + operation);
- new Thread() {
+ final OperationThreadError operationThreadError = new OperationThreadError();
+ Thread operationThread = new Thread() {
public void run() {
Looper.prepare();
Log.d(TAG, "In run method for " + operation);
@@ -253,7 +267,8 @@ public void publish(Progress progress) {
}
public void error(OpNotification notification) {
- Log.i(TAG, "Errored " + operation + " with " + notification);
+ operationThreadError.set("Errored " + operation + " with " + notification);
+ Log.i(TAG, operationThreadError.get());
}
public void success(OpNotification completionNotification) {
@@ -268,7 +283,8 @@ public void completed(OpNotification completionNotification) {
Log.d(TAG, "Called execute() on task for " + operation);
Looper.loop();
}
- }.start();
+ };
+ operationThread.start();
long startTime = currentTimeMillis();
Log.i(TAG, "Waiting for " + operation + " to complete - currentThread=" + currentThread());
// http://stackoverflow.com/questions/5497324/why-arent-java-util-concurrent-timeunit-types-greater-than
@@ -277,6 +293,7 @@ public void completed(OpNotification completionNotification) {
long duration = currentTimeMillis() - startTime;
Log.i(TAG, "Finished waiting - timeout=" + timeout + " duration=" + duration);
assertThat("Timeout for " + operation, timeout, is(false));
+ assertEquals("", operationThreadError.get());
return new FileRepository(operation.getGitDir());
}
diff --git a/agit/src/main/java/com/madgag/agit/operations/OpNotification.java b/agit/src/main/java/com/madgag/agit/operations/OpNotification.java
index 817430a8..bdb33a96 100644
--- a/agit/src/main/java/com/madgag/agit/operations/OpNotification.java
+++ b/agit/src/main/java/com/madgag/agit/operations/OpNotification.java
@@ -26,16 +26,19 @@ public class OpNotification {
private final CharSequence tickerText, eventTitle, eventDetail;
private final boolean successful;
- public OpNotification(int icon, CharSequence tickerText, CharSequence eventDetail) {
+ public OpNotification(int icon, CharSequence tickerText,
+ CharSequence eventDetail) {
this(icon, tickerText, tickerText, eventDetail, true);
}
- public OpNotification(int icon, CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail) {
+ public OpNotification(int icon, CharSequence tickerText,
+ CharSequence eventTitle, CharSequence eventDetail) {
this(icon, tickerText, eventTitle, eventDetail, true);
}
- public OpNotification(int icon, CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail,
- boolean successful) {
+ public OpNotification(int icon, CharSequence tickerText,
+ CharSequence eventTitle, CharSequence eventDetail,
+ boolean successful) {
this.icon = icon;
this.tickerText = tickerText;
this.eventTitle = eventTitle;
@@ -59,12 +62,25 @@ public CharSequence getEventDetail() {
return eventDetail;
}
- public static OpNotification alert(CharSequence eventTitle, CharSequence eventDetail) {
+ public String toString() {
+ String repr = "";
+ repr += eventTitle;
+ repr += ", ";
+ repr += tickerText;
+ repr += ", ";
+ repr += eventDetail;
+ return repr;
+ }
+
+ public static OpNotification alert(CharSequence eventTitle,
+ CharSequence eventDetail) {
return alert(eventDetail, eventTitle, eventDetail);
}
- public static OpNotification alert(CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail) {
- return new OpNotification(stat_sys_warning, tickerText, eventTitle, eventDetail);
+ public static OpNotification alert(CharSequence tickerText,
+ CharSequence eventTitle, CharSequence eventDetail) {
+ return new OpNotification(stat_sys_warning, tickerText, eventTitle,
+ eventDetail);
}
}