You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2014/01/09 19:40:57 UTC
git commit: AMBARI-4243. Tests broken in trunk: TestDateUtils.
(swagle)
Updated Branches:
refs/heads/trunk 24e58d5c6 -> 00ba34dfe
AMBARI-4243. Tests broken in trunk: TestDateUtils. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/00ba34df
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/00ba34df
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/00ba34df
Branch: refs/heads/trunk
Commit: 00ba34dfe886ff45921c1bb30dbef6c24c10604c
Parents: 24e58d5
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Jan 9 10:16:28 2014 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Jan 9 10:16:28 2014 -0800
----------------------------------------------------------------------
.../java/org/apache/ambari/server/utils/TestDateUtils.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/00ba34df/ambari-server/src/test/java/org/apache/ambari/server/utils/TestDateUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestDateUtils.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestDateUtils.java
index 354544a..c9eed52 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestDateUtils.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestDateUtils.java
@@ -27,7 +27,6 @@ import java.util.TimeZone;
public class TestDateUtils {
- @Ignore
@Test
public void testConvertToReadableTime() throws Exception {
Long timestamp = 1389125737000L;
@@ -37,11 +36,11 @@ public class TestDateUtils {
@Test
public void testConvertToDate() throws Exception {
- String time = "2013-11-18T14:29:29-0800";
+ String time = "2013-11-18T14:29:29-0000";
Date date = DateUtils.convertToDate(time);
Assert.assertNotNull(date);
Calendar calendar = Calendar.getInstance();
- calendar.setTimeZone(TimeZone.getTimeZone("PST"));
+ calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(Calendar.YEAR, 2013);
calendar.set(Calendar.MONTH, Calendar.NOVEMBER);
calendar.set(Calendar.DAY_OF_MONTH, 18);
@@ -52,10 +51,10 @@ public class TestDateUtils {
Assert.assertEquals(0, date.compareTo(calendar.getTime()));
}
- @Ignore
@Test
public void testGetDateDifferenceInMinutes() throws Exception {
Calendar calendar = Calendar.getInstance();
+ calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(Calendar.YEAR, 2013);
calendar.set(Calendar.MONTH, Calendar.NOVEMBER);
calendar.set(Calendar.DAY_OF_MONTH, 18);
@@ -63,7 +62,7 @@ public class TestDateUtils {
calendar.set(Calendar.MINUTE, 49);
calendar.set(Calendar.SECOND, 29);
calendar.set(Calendar.MILLISECOND, 0);
- String time = "2013-11-18T14:29:29-0800";
+ String time = "2013-11-18T14:29:29-0000";
Date date = DateUtils.convertToDate(time);
Long diff = (Math.abs(date.getTime() - calendar.getTimeInMillis())) / (60 * 1000) % 60;
Assert.assertEquals(Long.valueOf(20L).longValue(), diff.longValue());