Repository: falcon Updated Branches: refs/heads/master 016999b6d -> f8ee60986
FALCON-1398 CrossEntityValidations contains incorrect validations. Contributed by Pragya Mittal. Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/e3dd84ed Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/e3dd84ed Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/e3dd84ed Branch: refs/heads/master Commit: e3dd84edf0651a7f51087e14ac3c6116e86dbdd1 Parents: 016999b Author: Ajay Yadava <[email protected]> Authored: Fri Aug 14 07:36:25 2015 +0530 Committer: Ajay Yadava <[email protected]> Committed: Fri Aug 14 07:36:25 2015 +0530 ---------------------------------------------------------------------- CHANGES.txt | 2 + .../entity/parser/CrossEntityValidations.java | 8 +-- .../entity/parser/ProcessEntityParserTest.java | 62 ++++++++++++++++---- 3 files changed, 55 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/e3dd84ed/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index fa154ac..a790384 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -87,6 +87,8 @@ Trunk (Unreleased) (Suhas Vasu) BUG FIXES + FALCON-1398 CrossEntityValidations contains incorrect validations(Pragya Mittal via Ajay Yadava) + FALCON-1396 Disable the faulty test(Ajay Yadava via Sowmya Ramesh) FALCON-1251 FeedEvictor UT fails intermittently(Sandeep Samudrala via Ajay Yadava) http://git-wip-us.apache.org/repos/asf/falcon/blob/e3dd84ed/common/src/main/java/org/apache/falcon/entity/parser/CrossEntityValidations.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/falcon/entity/parser/CrossEntityValidations.java b/common/src/main/java/org/apache/falcon/entity/parser/CrossEntityValidations.java index 7a01d1e..2696552 100644 --- a/common/src/main/java/org/apache/falcon/entity/parser/CrossEntityValidations.java +++ b/common/src/main/java/org/apache/falcon/entity/parser/CrossEntityValidations.java @@ -55,19 +55,13 @@ public final class CrossEntityValidations { Validity processValidity = ProcessHelper.getCluster(process, clusterName).getValidity(); ExpressionHelper.setReferenceDate(processValidity.getStart()); Date instStart = evaluator.evaluate(instStartEL, Date.class); + Date instEnd = evaluator.evaluate(instEndEL, Date.class); if (instStart.before(feedStart)) { throw new ValidationException("Start instance " + instStartEL + " of feed " + feed.getName() + " is before the start of feed " + feedValidity.getStart() + " for cluster " + clusterName); } - Date instEnd = evaluator.evaluate(instEndEL, Date.class); - if (instEnd.after(feedEnd)) { - throw new ValidationException("End instance " + instEndEL + " of feed " + feed.getName() - + " is before the start of feed " + feedValidity.getStart() + " for cluster " - + clusterName); - } - if (instEnd.before(instStart)) { throw new ValidationException("End instance " + instEndEL + " for feed " + feed.getName() + " is before the start instance " + instStartEL + " for cluster " + clusterName); http://git-wip-us.apache.org/repos/asf/falcon/blob/e3dd84ed/common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java ---------------------------------------------------------------------- diff --git a/common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java b/common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java index 8783081..675fd46 100644 --- a/common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java +++ b/common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java @@ -231,16 +231,6 @@ public class ProcessEntityParserTest extends AbstractTestBase { //RESUME CHECKSTYLE CHECK HiddenFieldCheck @Test(expectedExceptions = ValidationException.class) - public void testInvalidProcessValidity() throws Exception { - Process process = parser - .parseAndValidate((ProcessEntityParserTest.class - .getResourceAsStream(PROCESS_XML))); - process.getClusters().getClusters().get(0).getValidity().setStart( - SchemaHelper.parseDateUTC("2011-12-31T00:00Z")); - parser.validate(process); - } - - @Test(expectedExceptions = ValidationException.class) public void testInvalidDependentFeedsRetentionLimit() throws Exception { Process process = parser .parseAndValidate((ProcessEntityParserTest.class @@ -508,4 +498,56 @@ public class ProcessEntityParserTest extends AbstractTestBase { Assert.assertEquals(javax.xml.bind.UnmarshalException.class, e.getCause().getClass()); } } + + @Test(expectedExceptions = ValidationException.class) + public void testEndTimeProcessBeforeStartTime() throws Exception { + Process process = parser + .parseAndValidate((ProcessEntityParserTest.class + .getResourceAsStream(PROCESS_XML))); + process.getClusters().getClusters().get(0).getValidity().setEnd( + SchemaHelper.parseDateUTC("2010-12-31T00:00Z")); + parser.validate(process); + } + + @Test(expectedExceptions = ValidationException.class) + public void testInstanceStartTimeBeforeFeedStartTimeForInput() throws Exception { + Process process = parser + .parseAndValidate((ProcessEntityParserTest.class + .getResourceAsStream(PROCESS_XML))); + process.getClusters().getClusters().get(0).getValidity().setStart( + SchemaHelper.parseDateUTC("2011-10-31T00:00Z")); + parser.validate(process); + } + + @Test(expectedExceptions = ValidationException.class) + public void testInstanceEndTimeAfterFeedEndTimeForInput() throws Exception { + Process process = parser + .parseAndValidate((ProcessEntityParserTest.class + .getResourceAsStream(PROCESS_XML))); + process.getClusters().getClusters().get(0).getValidity().setStart( + SchemaHelper.parseDateUTC("2011-12-31T00:00Z")); + parser.validate(process); + } + + @Test(expectedExceptions = ValidationException.class) + public void testInstanceTimeBeforeFeedStartTimeForOutput() throws Exception { + Process process = parser + .parseAndValidate((ProcessEntityParserTest.class + .getResourceAsStream(PROCESS_XML))); + process.getClusters().getClusters().get(0).getValidity().setStart( + SchemaHelper.parseDateUTC("2011-11-02T00:00Z")); + process.getOutputs().getOutputs().get(0).setInstance("yesterday(-60,0)"); + parser.validate(process); + } + + @Test(expectedExceptions = ValidationException.class) + public void testInstanceTimeAfterFeedEndTimeForOutput() throws Exception { + Process process = parser + .parseAndValidate((ProcessEntityParserTest.class + .getResourceAsStream(PROCESS_XML))); + process.getClusters().getClusters().get(0).getValidity().setStart( + SchemaHelper.parseDateUTC("2011-12-30T00:00Z")); + process.getOutputs().getOutputs().get(0).setInstance("today(120,0)"); + parser.validate(process); + } }
