Skip to content

Commit fe2422c

Browse files
committed
Adding travis ci build file. Updated the DataFormatter to use GMT for all times so that unit tests will work regardless of what timezone the end user is in. This also will make it easier to debug since everything will be in GMT from now on.
1 parent 396e044 commit fe2422c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
- oraclejdk7
5+
- openjdk7
6+
script: ./gradlew -S clean ds3-sdk:test

ds3-sdk/src/main/java/com/spectralogic/ds3client/utils/DateFormatter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.text.SimpleDateFormat;
1919
import java.util.Date;
20+
import java.util.TimeZone;
2021

2122
public class DateFormatter {
2223
final static private String RFC822FORMAT = "EEE, dd MMM yyyy HH:mm:ss Z";
@@ -29,6 +30,7 @@ public static String dateToRfc882() {
2930

3031
public static String dateToRfc882(final Date date) {
3132
final SimpleDateFormat sdf = new SimpleDateFormat(RFC822FORMAT);
33+
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
3234
return sdf.format(date);
3335
}
3436

ds3-sdk/src/test/java/com/spectralogic/ds3client/utils/DateFormatter_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public class DateFormatter_Test {
2929
public void formatDate() {
3030
final Date date = new Date(1390414308132L);
3131

32-
assertThat(DateFormatter.dateToRfc882(date), is("Wed, 22 Jan 2014 11:11:48 -0700"));
32+
assertThat(DateFormatter.dateToRfc882(date), is("Wed, 22 Jan 2014 18:11:48 +0000"));
3333
}
3434
}

0 commit comments

Comments
 (0)