You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by tu...@apache.org on 2012/02/08 21:47:46 UTC

svn commit: r1242086 - in /incubator/oozie/trunk: core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java release-log.txt

Author: tucu
Date: Wed Feb  8 20:47:46 2012
New Revision: 1242086

URL: http://svn.apache.org/viewvc?rev=1242086&view=rev
Log:
OOZIE-582 Adding new test cases for the feature - viewing log for coordinator actions in a given date range (harsh via tucu)

Modified:
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java?rev=1242086&r1=1242085&r2=1242086&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java Wed Feb  8 20:47:46 2012
@@ -22,6 +22,8 @@ import java.util.Date;
 
 import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.CoordinatorJobBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.XException;
 import org.apache.oozie.client.CoordinatorAction;
 import org.apache.oozie.client.CoordinatorJob;
 import org.apache.oozie.command.CommandException;
@@ -66,9 +68,45 @@ public class TestCoordActionsInDateRange
             long nominalTimeMilliseconds = nominalTime.getTime();
             long noOfMillisecondsinOneHour = 3600000;
 
-            // Testing for the number of coordinator actions in a date range that spans from half an hour prior to the nominal time to 1 hour after the nominal time
             String date1 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds - (noOfMillisecondsinOneHour / 2)));
             String date2 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds + noOfMillisecondsinOneHour));
+
+            // Test a bad date format.
+            try {
+              String badDate = "bad" + date1;
+              CoordActionsInDateRange.getCoordActionsFromDates(
+                  job.getId().toString(),
+                  badDate + "::" + date2);
+              fail("Accepted badly formatted date: " + badDate);
+            } catch (XException e) {
+              // Pass
+              assertEquals(ErrorCode.E0308, e.getErrorCode());
+            }
+
+            // Test a bad scope.
+            try {
+              String badScope = date1 + "0xbad5c09e" + date2;
+              CoordActionsInDateRange.getCoordActionsFromDates(
+                  job.getId().toString(),
+                  badScope);
+              fail("Accepted bad range scope: " + badScope);
+            } catch (XException e) {
+              // Pass
+              assertEquals(ErrorCode.E0308, e.getErrorCode());
+            }
+
+            // Test inverted start and end dates.
+            try {
+              CoordActionsInDateRange.getCoordActionsFromDates(
+                  job.getId().toString(),
+                  date2 + "::" + date1);
+              fail("Accepted inverted dates: [Start::End] = " + date2 + "::" + date1);
+            } catch (XException e) {
+              // Pass
+              assertEquals(ErrorCode.E0308, e.getErrorCode());
+            }
+
+            // Testing for the number of coordinator actions in a date range that spans from half an hour prior to the nominal time to 1 hour after the nominal time
             int noOfActions = CoordActionsInDateRange.getCoordActionsFromDates(job.getId().toString(), date1 + "::" + date2).size();
             assertEquals(1, noOfActions);
 

Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1242086&r1=1242085&r2=1242086&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Wed Feb  8 20:47:46 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-582 Adding new test cases for the feature - viewing log for coordinator actions in a given date range (harsh via tucu)
 OOZIE-499 Broken link in maven docs to config files (harsh via tucu)
 OOZIE-636 Validate fork-join (virag via tucu)
 OOZIE-685 Update License file with 3rd party license information. (Mohammad)