ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [06/27] git commit: AMBARI-7266. Properly replace host names in Falcon properties during BP deployment.
Date Tue, 16 Sep 2014 12:50:46 GMT
AMBARI-7266.  Properly replace host names in Falcon properties during BP deployment.


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

Branch: refs/heads/branch-alerts-dev
Commit: 1719a5ce20ebc4f0b109e9c9e2ff1ba23c23e58a
Parents: db9b776
Author: Robert Nettleton <rnettleton@hortonworks.com>
Authored: Mon Sep 15 10:05:27 2014 -0400
Committer: John Speidel <jspeidel@hortonworks.com>
Committed: Mon Sep 15 10:05:27 2014 -0400

----------------------------------------------------------------------
 .../BlueprintConfigurationProcessor.java        | 30 +++++++++++++++++++-
 .../BlueprintConfigurationProcessorTest.java    | 21 ++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1719a5ce/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index c246f83..c31a869 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -274,6 +274,17 @@ public class BlueprintConfigurationProcessor {
     return hosts;
   }
 
+
+  /**
+   * Provides package-level access to the map of single host topology updaters.
+   * This is useful for facilitating unit-testing of this class.
+   *
+   * @return the map of single host topology updaters
+   */
+  static Map<String, Map<String, PropertyUpdater>> getSingleHostTopologyUpdaters()
{
+    return singleHostTopologyUpdaters;
+  }
+
   /**
    * Provides functionality to update a property value.
    */
@@ -296,7 +307,7 @@ public class BlueprintConfigurationProcessor {
    * Topology based updater which replaces the original host name of a property with the
host name
    * which runs the associated (master) component in the new cluster.
    */
-  private static class SingleHostTopologyUpdater implements PropertyUpdater {
+  static class SingleHostTopologyUpdater implements PropertyUpdater {
     /**
      * Component name
      */
@@ -341,6 +352,16 @@ public class BlueprintConfigurationProcessor {
         }
       }
     }
+
+    /**
+     * Provides access to the name of the component associated
+     *   with this updater instance.
+     *
+     * @return component name for this updater
+     */
+    public String getComponentName() {
+      return this.component;
+    }
   }
 
   /**
@@ -603,6 +624,8 @@ public class BlueprintConfigurationProcessor {
     Map<String, PropertyUpdater> hiveSiteMap = new HashMap<String, PropertyUpdater>();
     Map<String, PropertyUpdater> oozieSiteMap = new HashMap<String, PropertyUpdater>();
     Map<String, PropertyUpdater> stormSiteMap = new HashMap<String, PropertyUpdater>();
+    Map<String, PropertyUpdater> falconStartupPropertiesMap = new HashMap<String,
PropertyUpdater>();
+
 
     Map<String, PropertyUpdater> mapredEnvMap = new HashMap<String, PropertyUpdater>();
     Map<String, PropertyUpdater> hadoopEnvMap = new HashMap<String, PropertyUpdater>();
@@ -623,6 +646,7 @@ public class BlueprintConfigurationProcessor {
     singleHostTopologyUpdaters.put("hive-site", hiveSiteMap);
     singleHostTopologyUpdaters.put("oozie-site", oozieSiteMap);
     singleHostTopologyUpdaters.put("storm-site", stormSiteMap);
+    singleHostTopologyUpdaters.put("falcon-startup.properties", falconStartupPropertiesMap);
 
     mPropertyUpdaters.put("hadoop-env", hadoopEnvMap);
     mPropertyUpdaters.put("hbase-env", hbaseEnvMap);
@@ -686,6 +710,10 @@ public class BlueprintConfigurationProcessor {
     multiStormSiteMap.put("storm.zookeeper.servers",
         new YamlMultiValuePropertyDecorator(new MultipleHostTopologyUpdater("ZOOKEEPER_SERVER")));
 
+    // FALCON
+    falconStartupPropertiesMap.put("*.broker.url", new SingleHostTopologyUpdater("FALCON_SERVER"));
+
+
     // Required due to AMBARI-4933.  These no longer seem to be required as the default values
in the stack
     // are now correct but are left here in case an existing blueprint still contains an
old value.
     hadoopEnvMap.put("namenode_heapsize", new MPropertyUpdater());

http://git-wip-us.apache.org/repos/asf/ambari/blob/1719a5ce/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index a4b8ba9..3213b20 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -896,6 +896,27 @@ public class BlueprintConfigurationProcessorTest {
     assertEquals("jdbc:mysql://myHost.com/hive?createDatabaseIfNotExist=true", updatedVal);
   }
 
+  @Test
+  public void testFalconConfigPropertyUpdaterAdded() throws Exception {
+    Map<String, Map<String, BlueprintConfigurationProcessor.PropertyUpdater>>
singleHostUpdaters =
+      BlueprintConfigurationProcessor.getSingleHostTopologyUpdaters();
+
+    assertTrue("Falcon startup.properties map was not added to the list of updater maps",
+               singleHostUpdaters.containsKey("falcon-startup.properties"));
+
+    Map<String, BlueprintConfigurationProcessor.PropertyUpdater> fieldsToUpdaters =
+      singleHostUpdaters.get("falcon-startup.properties");
+
+    assertTrue("Expected Falcon config property was not present in updater map",
+               fieldsToUpdaters.containsKey("*.broker.url"));
+
+    assertTrue("PropertyUpdater was not of the expected type for Falcon config property",
+               fieldsToUpdaters.get("*.broker.url") instanceof BlueprintConfigurationProcessor.SingleHostTopologyUpdater);
+
+    assertEquals("PropertyUpdater was not associated with the expected component name",
+                 "FALCON_SERVER", ((BlueprintConfigurationProcessor.SingleHostTopologyUpdater)fieldsToUpdaters.get("*.broker.url")).getComponentName());
+  }
+
   private class TestHostGroup implements HostGroup {
 
     private String name;


Mime
View raw message