You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/09/12 13:08:47 UTC

git commit: AMBARI-7276 Property: dfs.namenode.http-address has final flag - 'true' in downloaded hdfs-site.xml in HA cluster. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 59765552c -> 18f427dd1


AMBARI-7276 Property: dfs.namenode.http-address has final flag - 'true' in downloaded hdfs-site.xml in HA cluster. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 18f427dd12c016a11a81e80913b15ab40865c48f
Parents: 5976555
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Fri Sep 12 14:05:54 2014 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Fri Sep 12 14:05:54 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 .../highAvailability/progress_controller.js     |  15 +-
 ambari-web/app/utils/config.js                  |  14 +-
 .../progress_controller_test.js                 | 144 +++++++++++++++++++
 4 files changed, 163 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/18f427dd/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index c76bd52..0c5f875 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -46,6 +46,7 @@ var files = ['test/init_model_test',
   'test/controllers/main/admin/repositories_test',
   'test/controllers/main/admin/serviceAccounts_controller_test',
   'test/controllers/main/admin/highAvailability_controller_test',
+  'test/controllers/main/admin/highAvailability/progress_controller_test',
   'test/controllers/main/admin/security_test',
   'test/controllers/main/admin/security/disable_test',
   'test/controllers/main/admin/security/security_progress_controller_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/18f427dd/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 67ec07d..242a6b6 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -412,8 +412,8 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
    *
    * @param siteNames Array
    */
-  reconfigureSites: function(siteNames,data) {
-    var tagName =  'version' + (new Date).getTime();
+  reconfigureSites: function(siteNames, data) {
+    var tagName = App.get('testMode') ? 'version1' : 'version' + (new Date).getTime();
     var componentName;
     switch (this.get('content.controllerName')) {
       case 'rMHighAvailabilityWizardController':
@@ -422,13 +422,18 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
       default:
         componentName =  'NAMENODE';
     }
-    return siteNames.map(function(_siteName){
-      return {
+    return siteNames.map(function(_siteName) {
+      var config = data.items.findProperty('type', _siteName);
+      var configToSave = {
         type: _siteName,
         tag: tagName,
-        properties: data.items.findProperty('type', _siteName).properties,
+        properties: config && config.properties,
         service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role(componentName))
       }
+      if (config && config.properties_attributes) {
+        configToSave.properties_attributes = config.properties_attributes;
+      }
+      return configToSave;
     });
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/18f427dd/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 16089d9..35ca305 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -591,14 +591,16 @@ App.config = Em.Object.create({
   addAdvancedConfigs: function (serviceConfigs, advancedConfigs, serviceName) {
     var miscConfigs = serviceConfigs.filterProperty('serviceName', 'MISC');
     var configsToVerifying = (serviceName) ? serviceConfigs.filterProperty('serviceName', serviceName).concat(miscConfigs) : serviceConfigs.slice();
-    var definedConfigs = (serviceName) ? this.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName).get('configs') : [];
+    var definedService = this.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName);
+    if (definedService) {
+      var definedConfigs = (serviceName) ? definedService.get('configs') : [];
 
-    if (definedConfigs.length) {
-      advancedConfigs = advancedConfigs.filter(function(property) {
-        return !(definedConfigs.someProperty('name', property.name) && !serviceConfigs.someProperty('name', property.name));
-      }, this);
+      if (definedConfigs.length) {
+        advancedConfigs = advancedConfigs.filter(function(property) {
+          return !(definedConfigs.someProperty('name', property.name) && !serviceConfigs.someProperty('name', property.name));
+        }, this);
+      }
     }
-
     advancedConfigs.forEach(function (_config) {
       var configType = this.getConfigTagFromFileName(_config.filename);
       var configCategory = 'Advanced ' + configType;

http://git-wip-us.apache.org/repos/asf/ambari/blob/18f427dd/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
new file mode 100644
index 0000000..ff54663
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+require('controllers/main/admin/highAvailability_controller');
+require('models/host_component');
+require('models/host');
+require('utils/ajax/ajax');
+
+describe('App.HighAvailabilityProgressPageController', function () {
+
+  var controller = App.HighAvailabilityProgressPageController.create();
+
+  describe('#reconfigureSites()', function () {
+    var tests = [
+      {
+        content: {
+          controllerName: "rMHighAvailabilityWizardController"
+        },
+        siteNames: ["site1", "site2"],
+        data: {
+          items: [
+            {
+              type: "site1",
+              properties: {
+                site1_property1: "site1_property1_value",
+                site1_property2: "site1_property2_value"
+              },
+              properties_attributes: {
+                final: {
+                  site1_property1: "true"
+                }
+              }
+            },
+            {
+              type: "site2",
+              properties: {
+                site2_property1: "site2_property1_value",
+                site2_property2: "site2_property2_value"
+              }
+            },
+            {
+              type: "site3",
+              properties: {
+                site3_property: "site3_property_value"
+              }
+            }
+          ]
+        },
+        result: [
+          {
+            type: "site1",
+            tag: "version1",
+            properties: {
+              site1_property1: "site1_property1_value",
+              site1_property2: "site1_property2_value"
+            },
+            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("ResourceManager"),
+            properties_attributes: {
+              final: {
+                site1_property1: "true"
+              }
+            }
+          },
+          {
+            type: "site2",
+            tag: "version1",
+            properties: {
+              site2_property1: "site2_property1_value",
+              site2_property2: "site2_property2_value"
+            },
+            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("ResourceManager")
+          }
+        ]
+      },
+      {
+        content: {
+          controllerName: "anyOther"
+        },
+        siteNames: ["site1"],
+        data: {
+          items: [
+            {
+              type: "site1",
+              properties: {
+                site1_property1: "site1_property1_value",
+                site1_property2: "site1_property2_value"
+              },
+              properties_attributes: {
+                final: {
+                  site1_property1: "true"
+                }
+              }
+            }
+          ]
+        },
+        result: [
+          {
+            type: "site1",
+            tag: "version1",
+            properties: {
+              site1_property1: "site1_property1_value",
+              site1_property2: "site1_property2_value"
+            },
+            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("NameNode"),
+            properties_attributes: {
+              final: {
+                site1_property1: "true"
+              }
+            }
+          }
+        ]
+      }];
+    beforeEach(function() {
+      App.set('testMode', true);
+    });
+    afterEach(function() {
+      App.set('testMode', false);
+    });
+    it("reconfigures configs after HA", function() {
+      tests.forEach(function(t) {
+        controller.set('content', t.content);
+        expect(controller.reconfigureSites(t.siteNames, t.data)).to.eql(t.result);
+      });
+    });
+  });
+
+});