Repository: ambari
Updated Branches:
  refs/heads/trunk 70f9bd620 -> 7302da4e5


AMBARI-21261 : NiFi Metrics are not displaying in Ambari. (avijayan)


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

Branch: refs/heads/trunk
Commit: 7302da4e557f7a3b6a1d069c1858e5ac4d2d2bf6
Parents: 70f9bd6
Author: Aravindan Vijayan <[email protected]>
Authored: Thu Jun 15 08:55:34 2017 -0700
Committer: Aravindan Vijayan <[email protected]>
Committed: Thu Jun 15 08:55:34 2017 -0700

----------------------------------------------------------------------
 .../ambari/server/stack/ComponentModule.java    |  4 ++++
 .../server/stack/ComponentModuleTest.java       | 25 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7302da4e/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
index 3910abb..339eab8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java
@@ -119,6 +119,10 @@ public class ComponentModule extends 
BaseModule<ComponentModule, ComponentInfo>
         componentInfo.setReassignAllowed(parentInfo.getReassignAllowed());
       }
 
+      if (componentInfo.getTimelineAppid() == null) {
+        componentInfo.setTimelineAppid(parentInfo.getTimelineAppid());
+      }
+
       mergeComponentDependencies(parentInfo.getDependencies(),
               componentInfo.getDependencies());
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7302da4e/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
index 198a1dd..990561a 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java
@@ -178,6 +178,31 @@ public class ComponentModuleTest {
   }
 
   @Test
+  public void testResolve_TimelineAppId() {
+    String timelineAppId = "app";
+
+    ComponentInfo info = new ComponentInfo();
+    assertEquals(null, resolveComponent(info, 
null).getModuleInfo().getTimelineAppid());
+
+    ComponentInfo parentInfo = new ComponentInfo();
+    info = new ComponentInfo();
+    // parent has value set, child value is null
+    parentInfo.setTimelineAppid(timelineAppId);
+    assertEquals(timelineAppId, resolveComponent(info, 
parentInfo).getModuleInfo().getTimelineAppid());
+
+    // child has value set, parent value is null
+    info.setTimelineAppid(timelineAppId);
+    parentInfo.setTimelineAppid(null);
+    assertEquals(timelineAppId, resolveComponent(info, 
parentInfo).getModuleInfo().getTimelineAppid());
+
+    // value set in both parent and child; child overwrites
+    String timelineAppId2 = "app2";
+    info.setTimelineAppid(timelineAppId2);
+    parentInfo.setTimelineAppid(timelineAppId);
+    assertEquals(timelineAppId2, resolveComponent(info, 
parentInfo).getModuleInfo().getTimelineAppid());
+  }
+
+  @Test
   public void testResolve_AutoDeploy() {
     AutoDeployInfo autoDeployInfo = new AutoDeployInfo();
     autoDeployInfo.setEnabled(true);

Reply via email to