Repository: tez
Updated Branches:
  refs/heads/branch-0.7 896861301 -> f2908599a


TEZ-1670. Add tests for all converter functions in 
HistoryEventTimelineConversion. (Tatsuya Nishiyama via hitesh)

(cherry picked from commit 6562a9d882fc455f511dd9d93af1d159d3e3e71b)

Conflicts:
        CHANGES.txt


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/f2908599
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/f2908599
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/f2908599

Branch: refs/heads/branch-0.7
Commit: f2908599ae035120c96dc688c2eed9660b3305b5
Parents: 8968613
Author: Hitesh Shah <[email protected]>
Authored: Wed Nov 11 11:33:21 2015 -0800
Committer: Hitesh Shah <[email protected]>
Committed: Wed Nov 11 11:37:41 2015 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../ats/TestHistoryEventTimelineConversion.java | 61 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/f2908599/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4714ff0..535f595 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES
   TEZ-2679. Admin forms of launch env settings
 
 ALL CHANGES
+  TEZ-1670. Add tests for all converter functions in 
HistoryEventTimelineConversion.
   TEZ-2929. Tez UI: Dag details page displays vertices to be running even when 
dag have completed
   TEZ-2927. Tez UI: Graciously fail when system-metrics-publisher is disabled
   TEZ-2915. Tez UI: Getting back to the DAG details page is difficult

http://git-wip-us.apache.org/repos/asf/tez/blob/f2908599/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestHistoryEventTimelineConversion.java
----------------------------------------------------------------------
diff --git 
a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestHistoryEventTimelineConversion.java
 
b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestHistoryEventTimelineConversion.java
index 0ad1b43..3a56f17 100644
--- 
a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestHistoryEventTimelineConversion.java
+++ 
b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestHistoryEventTimelineConversion.java
@@ -317,6 +317,33 @@ public class TestHistoryEventTimelineConversion {
   }
 
   @Test(timeout = 5000)
+  public void testConvertAMStartedEvent() {
+    long startTime = random.nextLong();
+
+    AMStartedEvent event = new AMStartedEvent(applicationAttemptId, startTime, 
user);
+
+    TimelineEntity timelineEntity = 
HistoryEventTimelineConversion.convertToTimelineEntity(event);
+
+    Assert.assertEquals("tez_" + applicationAttemptId.toString(), 
timelineEntity.getEntityId());
+    Assert.assertEquals(EntityTypes.TEZ_APPLICATION_ATTEMPT.name(), 
timelineEntity.getEntityType());
+
+    final Map<String, Set<String>> relatedEntities = 
timelineEntity.getRelatedEntities();
+    Assert.assertEquals(0, relatedEntities.size());
+
+    final Map<String, Set<Object>> primaryFilters = 
timelineEntity.getPrimaryFilters();
+    Assert.assertEquals(2, primaryFilters.size());
+    Assert.assertTrue(primaryFilters.get(ATSConstants.USER).contains(user));
+    Assert.assertTrue(primaryFilters.get(ATSConstants.APPLICATION_ID)
+            .contains(applicationId.toString()));
+
+    Assert.assertEquals(1, timelineEntity.getEvents().size());
+    TimelineEvent evt = timelineEntity.getEvents().get(0);
+    Assert.assertEquals(HistoryEventType.AM_STARTED.name(), 
evt.getEventType());
+    Assert.assertEquals(startTime, evt.getTimestamp());
+
+  }
+
+  @Test(timeout = 5000)
   public void testConvertContainerLaunchedEvent() {
     long launchTime = random.nextLong();
     ContainerLaunchedEvent event = new ContainerLaunchedEvent(containerId, 
launchTime,
@@ -678,6 +705,40 @@ public class TestHistoryEventTimelineConversion {
   }
 
   @Test(timeout = 5000)
+  public void testConvertVertexStartedEvent() {
+    long startRequestedTime = random.nextLong();
+    long startTime = random.nextLong();
+
+    VertexStartedEvent event = new VertexStartedEvent(tezVertexID, 
startRequestedTime, startTime);
+
+    TimelineEntity timelineEntity = 
HistoryEventTimelineConversion.convertToTimelineEntity(event);
+    Assert.assertEquals(EntityTypes.TEZ_VERTEX_ID.name(), 
timelineEntity.getEntityType());
+    Assert.assertEquals(tezVertexID.toString(), timelineEntity.getEntityId());
+
+    Assert.assertEquals(0, timelineEntity.getRelatedEntities().size());
+
+    Assert.assertEquals(2, timelineEntity.getPrimaryFilters().size());
+    
Assert.assertTrue(timelineEntity.getPrimaryFilters().get(ATSConstants.APPLICATION_ID)
+            .contains(applicationId.toString()));
+    Assert.assertTrue(
+            
timelineEntity.getPrimaryFilters().get(EntityTypes.TEZ_DAG_ID.name()).contains(
+                    tezDAGID.toString()));
+
+    Assert.assertEquals(1, timelineEntity.getEvents().size());
+    TimelineEvent timelineEvent = timelineEntity.getEvents().get(0);
+    Assert.assertEquals(HistoryEventType.VERTEX_STARTED.name(), 
timelineEvent.getEventType());
+    Assert.assertEquals(startTime, timelineEvent.getTimestamp());
+
+    Assert.assertEquals(3, timelineEntity.getOtherInfo().size());
+    Assert.assertEquals(startRequestedTime,
+            ((Long) 
timelineEntity.getOtherInfo().get(ATSConstants.START_REQUESTED_TIME)).longValue());
+    Assert.assertEquals(startTime,
+            ((Long) 
timelineEntity.getOtherInfo().get(ATSConstants.START_TIME)).longValue());
+    Assert.assertEquals(VertexState.RUNNING.name(),
+            timelineEntity.getOtherInfo().get(ATSConstants.STATUS));
+  }
+
+  @Test(timeout = 5000)
   public void testConvertVertexFinishedEvent() {
     long initRequestedTime = random.nextLong();
     long initedTime = random.nextLong();

Reply via email to