Author: kamrul
Date: Tue Feb 7 03:05:22 2012
New Revision: 1241338
URL: http://svn.apache.org/viewvc?rev=1241338&view=rev
Log:
OZIE-608 testCoordChangeEndTime and testCoordChangeXCommand are failing(Mohamed)
Modified:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/util/DateUtils.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
incubator/oozie/branches/branch-3.1/release-log.txt
Modified:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/util/DateUtils.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/util/DateUtils.java?rev=1241338&r1=1241337&r2=1241338&view=diff
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/util/DateUtils.java
(original)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/util/DateUtils.java
Tue Feb 7 03:05:22 2012
@@ -259,4 +259,18 @@ public class DateUtils {
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
return sdf.format(date);
}
+
+ /**
+ * Return the UTC date and time in W3C format down to second
+ * (yyyy-MM-ddTHH:mm:ssZ). i.e.: 1997-07-16T19:20:30Z The input date is a
+ * long (Unix Time Stamp)
+ *
+ * @return the formatted time string.
+ */
+ public static String convertDateToString(long timeStamp) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return sdf.format(new Date(timeStamp));
+ }
+
}
Modified:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java?rev=1241338&r1=1241337&r2=1241338&view=diff
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
(original)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
Tue Feb 7 03:05:22 2012
@@ -58,7 +58,7 @@ public class TestCoordChangeXCommand ext
public void testCoordChangeXCommand() throws StoreException,
CommandException {
System.out.println("Running Test");
String jobId = "0000000-" + new Date().getTime() +
"-testCoordChangeXCommand-C";
- // CoordinatorStore store =
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
+
try {
addRecordToJobTable(jobId);
}
@@ -66,37 +66,41 @@ public class TestCoordChangeXCommand ext
ex.printStackTrace();
fail("Exception thrown " + ex);
}
- new CoordChangeXCommand(jobId,
"endtime=2011-12-01T05:00Z;concurrency=200").call();
+
+ String pauseTime = DateUtils.convertDateToString(new Date().getTime()
+ 10 * 60 * 1000);
+ String endTime = DateUtils.convertDateToString(new Date().getTime() +
20 * 60 * 1000);
+
+ new CoordChangeXCommand(jobId, "endtime=" + endTime +
";concurrency=200").call();
try {
- checkCoordJobs(jobId, DateUtils.parseDateUTC("2011-12-01T05:00Z"),
200, null, false);
+ checkCoordJobs(jobId, DateUtils.parseDateUTC(endTime), 200, null,
false);
}
catch (Exception ex) {
ex.printStackTrace();
fail("Invalid date" + ex);
}
- new CoordChangeXCommand(jobId,
"endtime=2011-12-01T05:00Z;concurrency=200;pausetime=2011-11-01T05:00Z").call();
+ String changeValue = "endtime=" + endTime +
";concurrency=200;pausetime=" + pauseTime;
+ new CoordChangeXCommand(jobId, changeValue).call();
try {
- checkCoordJobs(jobId, DateUtils.parseDateUTC("2011-12-01T05:00Z"),
200, DateUtils
- .parseDateUTC("2011-11-01T05:00Z"), true);
+ checkCoordJobs(jobId, DateUtils.parseDateUTC(endTime), 200,
DateUtils.parseDateUTC(pauseTime), true);
}
catch (Exception ex) {
ex.printStackTrace();
fail("Invalid date" + ex);
}
- new CoordChangeXCommand(jobId,
"endtime=2011-12-01T05:00Z;concurrency=200;pausetime=").call();
+ new CoordChangeXCommand(jobId, "endtime=" + endTime +
";concurrency=200;pausetime=").call();
try {
- checkCoordJobs(jobId, DateUtils.parseDateUTC("2011-12-01T05:00Z"),
200, null, true);
+ checkCoordJobs(jobId, DateUtils.parseDateUTC(endTime), 200, null,
true);
}
catch (Exception ex) {
ex.printStackTrace();
fail("Invalid date" + ex);
}
- new CoordChangeXCommand(jobId,
"endtime=2011-12-01T05:00Z;pausetime=;concurrency=200").call();
+ new CoordChangeXCommand(jobId, "endtime=" + endTime +
";pausetime=;concurrency=200").call();
try {
- checkCoordJobs(jobId, DateUtils.parseDateUTC("2011-12-01T05:00Z"),
200, null, true);
+ checkCoordJobs(jobId, DateUtils.parseDateUTC(endTime), 200, null,
true);
}
catch (Exception ex) {
ex.printStackTrace();
@@ -212,19 +216,25 @@ public class TestCoordChangeXCommand ext
}
/**
- * test end time change : pending should mark false if job is running with
pending true
- *
+ * test end time change : pending should mark false if job is running with
+ * pending true
+ *
* @throws Exception
*/
public void testCoordChangeEndTime() throws Exception {
- Date start = DateUtils.parseDateUTC("2011-02-01T01:00Z");
- Date end = DateUtils.parseDateUTC("2011-02-20T23:59Z");
- final CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, start, end, true, true,
0);
+ Date startTime = new Date();
+ Date endTime = new Date(startTime.getTime() + (20 * 60 * 1000));
+
+ final CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime,
+ true, true, 0);
+
+ String pauseTime = DateUtils.convertDateToString(startTime.getTime() +
10 * 60 * 1000);
+ String newEndTime = DateUtils.convertDateToString(startTime.getTime()
+ 40 * 60 * 1000);
- new CoordChangeXCommand(job.getId(),
"endtime=2012-12-01T05:00Z;pausetime=2011-11-01T05:00Z").call();
+ new CoordChangeXCommand(job.getId(), "endtime=" + newEndTime +
";pausetime=" + pauseTime).call();
try {
- checkCoordJobs(job.getId(),
DateUtils.parseDateUTC("2012-12-01T05:00Z"), null, DateUtils
- .parseDateUTC("2011-11-01T05:00Z"), true);
+ checkCoordJobs(job.getId(), DateUtils.parseDateUTC(newEndTime),
null, DateUtils.parseDateUTC(pauseTime),
+ true);
}
catch (Exception ex) {
ex.printStackTrace();
@@ -239,16 +249,16 @@ public class TestCoordChangeXCommand ext
}
/**
- * test pause time change : pending should mark false if job is running
with pending true.
- * two actions should be removed for pause time changes.
- *
+ * test pause time change : pending should mark false if job is running
with
+ * pending true. two actions should be removed for pause time changes.
+ *
* @throws Exception
*/
public void testCoordChangePauseTime() throws Exception {
Date start = new Date();
Date end = new Date(start.getTime() + (20 * 60 * 1000));
Date pauseTime = new Date(start.getTime() + (10 * 60 * 1000));
- String pauseTimeChangeStr = "pausetime="+
DateUtils.convertDateToString(pauseTime);
+ String pauseTimeChangeStr = "pausetime=" +
DateUtils.convertDateToString(pauseTime);
final CoordinatorJobBean job =
addRecordToCoordJobTableForPauseTimeTest(CoordinatorJob.Status.RUNNING, start,
end, end, true, false, 4);
addRecordToCoordActionTable(job.getId(), 1,
CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
@@ -264,7 +274,8 @@ public class TestCoordChangeXCommand ext
assertEquals(Job.Status.RUNNING, coordJob.getStatus());
assertEquals(2, coordJob.getLastActionNumber());
- CoordinatorActionBean actionBean = jpaService.execute(new
CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 3));
+ CoordinatorActionBean actionBean = jpaService.execute(new
CoordJobGetActionByActionNumberJPAExecutor(job
+ .getId(), 3));
assertNull(actionBean);
actionBean = jpaService.execute(new
CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 4));
@@ -409,12 +420,14 @@ public class TestCoordChangeXCommand ext
Date d = job.getPauseTime();
if (pauseTime == null) {
if (d != null) {
- fail("Pausetime is not updated properly
job_pause_time=" + d + ", expected_pause_time=" + pauseTime);
+ fail("Pausetime is not updated properly
job_pause_time=" + d + ", expected_pause_time="
+ + pauseTime);
}
}
else {
if (d.compareTo(pauseTime) != 0) {
- fail("Pausetime is not updated properly
job_pause_time=" + d + ", expected_pause_time=" + pauseTime);
+ fail("Pausetime is not updated properly
job_pause_time=" + d + ", expected_pause_time="
+ + pauseTime);
}
}
}
Modified: incubator/oozie/branches/branch-3.1/release-log.txt
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/release-log.txt?rev=1241338&r1=1241337&r2=1241338&view=diff
==============================================================================
--- incubator/oozie/branches/branch-3.1/release-log.txt (original)
+++ incubator/oozie/branches/branch-3.1/release-log.txt Tue Feb 7 03:05:22 2012
@@ -1,4 +1,5 @@
-- Oozie 3.1.3 release
+OOZIE-608 testCoordChangeEndTime and testCoordChangeXCommand are
failing(Mohamed).
OOZIE-678 Update NOTICE.txt to reflect the workcount binaries into oozie
src(Mohammad)
OOZIE-681 Update the contents of readme.txt.(Mohammad)
OOZIE-680 oozie's assembly creates an extra level of empty subdirectory for
docs. (rvs via tucu)