Permalink
Browse files

Support for travis-ci

  • Loading branch information...
1 parent a0c7810 commit e3f746175b10f25da1be5d1bf60ee691f6f72955 @jberkel jberkel committed May 8, 2012
View
@@ -0,0 +1,2 @@
+language: java
+install: ant prepare-travis-ci
View
@@ -221,4 +221,29 @@
<arg line="install:install-file -DgroupId=com.google.android.maps -DartifactId=maps -Dversion=10_r2 -Dpackaging=jar -Dfile=${sdk.dir}/add-ons/addon-google_apis-google_inc_-10/libs/maps.jar" />
</exec>
</target>
+
+ <!-- used by travis-ci -->
+ <target name="prepare-travis-ci" description="Prepare for travis ci build">
+ <mkdir dir="tmp"/>
+ <get src="http://dl.google.com/android/android-sdk_r18-linux.tgz" dest="tmp" skipexisting="true"/>
+ <untar src="tmp/android-sdk_r18-linux.tgz" compression="gzip" dest="tmp/sdk"/>
+ <echo file="tmp/install-sdk">#!/bin/sh -e
+ ANDROID="tmp/sdk/android-sdk-linux/tools/android"
+ chmod +x $ANDROID
+ SDKS=$($ANDROID list sdk | awk \
+ '/SDK Platform.* API 10/ || /Google APIs, Android API 10, revision 2/ \
+ { s=s "," int($1) } \
+ END { print substr(s, 2, length(s)) }' \
+ )
+ $ANDROID update sdk --no-ui --filter $SDKS
+ </echo>
+ <chmod file="tmp/install-sdk" perm="u+x"/>
+ <exec executable="tmp/install-sdk"/>
+ <propertyfile file="local.properties">
+ <entry key="sdk.dir" value="${basedir}/tmp/sdk/android-sdk-linux/"/>
+ </propertyfile>
+ <exec executable="mvn">
+ <arg line="install:install-file -DgroupId=com.google.android.maps -DartifactId=maps -Dversion=10_r2 -Dpackaging=jar -Dfile=tmp/sdk/android-sdk-linux/add-ons/addon-google_apis-google-10/libs/maps.jar"/>
+ </exec>
+ </target>
</project>
@@ -194,8 +194,8 @@ public boolean parse(String timeString) {
} else {
tz = TimeZone.getTimeZone(time.timezone);
}
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
- SimpleDateFormat dfShort = new SimpleDateFormat("yyyyMMdd");
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH);
+ SimpleDateFormat dfShort = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH);
df.setTimeZone(tz);
dfShort.setTimeZone(tz);
time.timezone = tz.getID();
@@ -213,7 +213,9 @@ public boolean parse(String timeString) {
@Implementation
public String format(String format) {
- return new Strftime(format, Locale.getDefault()).format(new Date(toMillis(false)));
+ Strftime strftime = new Strftime(format, Locale.getDefault());
+ strftime.setTimeZone(TimeZone.getTimeZone(time.timezone));
+ return strftime.format(new Date(toMillis(false)));
}
@Implementation
@@ -130,7 +130,7 @@ public void shouldHaveCompareAndBeforeAfter() throws Exception {
@Test
public void shouldHaveParse() throws Exception {
- Time t = new Time();
+ Time t = new Time("Europe/Berlin");
assertFalse(t.parse("20081013T160000"));
assertEquals(2008, t.year);
assertEquals(9, t.month);
@@ -180,7 +180,7 @@ public void shouldFormat2445() throws Exception {
@Test
public void shouldFormat3339() throws Exception {
- Time t = new Time();
+ Time t = new Time("Europe/Berlin");
assertEquals("1970-01-01T00:00:00.000+00:00", t.format3339(false));
assertEquals("1970-01-01", t.format3339(true));
}

0 comments on commit e3f7461

Please sign in to comment.