Repository: oozie Updated Branches: refs/heads/master b8c6b702b -> ed6a85232
OOZIE-2429 TestEventGeneration test is flakey addendum (fdenes via rkanter) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/ed6a8523 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/ed6a8523 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/ed6a8523 Branch: refs/heads/master Commit: ed6a85232d85b56817927e9e87ae58a14520ec80 Parents: b8c6b70 Author: Robert Kanter <[email protected]> Authored: Tue Mar 22 18:23:55 2016 -0700 Committer: Robert Kanter <[email protected]> Committed: Tue Mar 22 18:23:55 2016 -0700 ---------------------------------------------------------------------- .../apache/oozie/event/TestEventGeneration.java | 48 +++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/ed6a8523/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java b/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java index 5aaa344..f662d8a 100644 --- a/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java +++ b/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java @@ -23,6 +23,7 @@ import java.io.Reader; import java.io.Writer; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -570,18 +571,41 @@ public class TestEventGeneration extends XDataTestCase { }); assertEquals(3, queue.size()); - JobEvent coordActionEvent = (JobEvent) queue.poll(); - assertEquals(EventStatus.FAILURE, coordActionEvent.getEventStatus()); - assertEquals(action.getId(), coordActionEvent.getId()); - assertEquals(AppType.COORDINATOR_ACTION, coordActionEvent.getAppType()); - JobEvent wfActionEvent = (JobEvent) queue.poll(); - assertEquals(EventStatus.FAILURE, wfActionEvent.getEventStatus()); - assertEquals(waId, wfActionEvent.getId()); - assertEquals(AppType.WORKFLOW_ACTION, wfActionEvent.getAppType()); - JobEvent wfJobEvent = (JobEvent) queue.poll(); - assertEquals(EventStatus.FAILURE, wfJobEvent.getEventStatus()); - assertEquals(wf.getId(), wfJobEvent.getId()); - assertEquals(AppType.WORKFLOW_JOB, wfJobEvent.getAppType()); + + HashMap<AppType,JobEvent> eventsMap = new HashMap<AppType,JobEvent>(); + while (queue.size() > 0){ + JobEvent event = (JobEvent) queue.poll(); + eventsMap.put(event.getAppType(), event); + } + + assertEquals(3, eventsMap.size()); + + //Check the WF action + { + JobEvent wfActionEvent = eventsMap.get(AppType.WORKFLOW_ACTION); + assertNotNull("There should be a WF action", wfActionEvent); + assertEquals(EventStatus.FAILURE, wfActionEvent.getEventStatus()); + assertEquals(waId, wfActionEvent.getId()); + assertEquals(AppType.WORKFLOW_ACTION, wfActionEvent.getAppType()); + } + + //Check the WF job + { + JobEvent wfJobEvent = eventsMap.get(AppType.WORKFLOW_JOB); + assertNotNull("There should be a WF job", wfJobEvent); + assertEquals(EventStatus.FAILURE, wfJobEvent.getEventStatus()); + assertEquals(wf.getId(), wfJobEvent.getId()); + assertEquals(AppType.WORKFLOW_JOB, wfJobEvent.getAppType()); + } + + //Check the Coordinator action + { + JobEvent coordActionEvent = eventsMap.get(AppType.COORDINATOR_ACTION); + assertNotNull("There should be a Coordinator action", coordActionEvent); + assertEquals(EventStatus.FAILURE, coordActionEvent.getEventStatus()); + assertEquals(action.getId(), coordActionEvent.getId()); + assertEquals(AppType.COORDINATOR_ACTION, coordActionEvent.getAppType()); + } queue.clear(); }
