ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-10295. Refactor Hive/Oozie configs removing (onechiporenko)
Date Tue, 31 Mar 2015 17:05:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk fe39b6460 -> 1212fb42a


AMBARI-10295. Refactor Hive/Oozie configs removing (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 1212fb42a18fa914151d40fa7b8da782b879c011
Parents: fe39b64
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Mar 31 19:57:36 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Mar 31 19:57:36 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 .../controllers/main/service/info/configs.js    | 260 +++++--------------
 .../app/controllers/wizard/step8_controller.js  |  10 +-
 ambari-web/app/utils/data_manipulation.js       |   2 +-
 .../main/service/info/config_test.js            | 188 ++++++++++++++
 ambari-web/test/utils/data_manipulation_test.js |   4 +-
 6 files changed, 263 insertions(+), 202 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/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 01dbdb3..0b417a2 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -154,6 +154,7 @@ var files = ['test/init_model_test',
   'test/utils/blueprint_test',
   'test/utils/config_test',
   'test/utils/date_test',
+  'test/utils/data_manipulation_test',
   'test/utils/config_test',
   'test/utils/form_field_test',
   'test/utils/host_progress_popup_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 881d7ff..e2b8299 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -19,6 +19,7 @@
 var App = require('app');
 require('controllers/wizard/slave_component_groups_controller');
 var batchUtils = require('utils/batch_scheduled_requests');
+var dataManipulationUtils = require('utils/data_manipulation');
 var lazyLoading = require('utils/lazy_loading');
 
 App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin,
App.ConfigOverridable, App.PreloadRequestsChainMixin, {
@@ -1470,101 +1471,45 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * @method setHiveHostName
    */
   setHiveHostName: function (configs) {
-    var dbHostPropertyName = null;
+    var dbHostPropertyName = null, configsToRemove = [];
     if (configs.someProperty('name', 'hive_database')) {
       var hiveDb = configs.findProperty('name', 'hive_database');
-      if (hiveDb.value === 'New MySQL Database' || hiveDb.value === 'New PostgreSQL Database')
{
-        var ambariHost = configs.findProperty('name', 'hive_ambari_host');
-        if (ambariHost) {
-          dbHostPropertyName = 'hive_ambari_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_host'));
-      } else if (hiveDb.value === 'Existing MySQL Database') {
-        var existingMySqlHost = configs.findProperty('name', 'hive_existing_mysql_host');
-        if (existingMySqlHost) {
-          dbHostPropertyName = 'hive_existing_mysql_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_host'));
-      } else if (hiveDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql'))
{
-        var existingPostgreSqlHost = configs.findProperty('name', 'hive_existing_postgresql_host');
-        if (existingPostgreSqlHost) {
-          dbHostPropertyName = 'hive_existing_postgresql_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_host'));
-      } else if (hiveDb.value === 'Existing Oracle Database') {
-        var existingOracleHost = configs.findProperty('name', 'hive_existing_oracle_host');
-        if (existingOracleHost) {
-          dbHostPropertyName = 'hive_existing_oracle_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_host'));
-      } else if (hiveDb.value === 'Existing MSSQL Server database with SQL authentication')
{
-        var existingMSSQLServerHost = configs.findProperty('name', 'hive_existing_mssql_server_host');
-        if (existingMSSQLServerHost) {
-          dbHostPropertyName = 'hive_existing_mssql_server_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_2_host'));
-      } else if (hiveDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-        var existingMSSQL2ServerHost = configs.findProperty('name', 'hive_existing_mssql_server_2_host');
-        if (existingMSSQL2ServerHost) {
-          dbHostPropertyName = 'hive_existing_mssql_server_2_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'hive_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'hive_existing_mssql_server_host'));
+
+      switch(hiveDb.value) {
+        case 'New MySQL Database':
+        case 'New PostgreSQL Database':
+          dbHostPropertyName = configs.someProperty('name', 'hive_ambari_host') ? 'hive_ambari_host'
: dbHostPropertyName;
+          configsToRemove = ['hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_oracle_host', 'hive_existing_oracle_database', 'hive_existing_postgresql_host',
'hive_existing_postgresql_database', 'hive_existing_mssql_server_database', 'hive_existing_mssql_server_host',
'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MySQL Database':
+          dbHostPropertyName = configs.someProperty('name', 'hive_existing_mysql_host') ?
'hive_existing_mysql_host' : dbHostPropertyName;
+          configsToRemove = ['hive_ambari_database', 'hive_existing_oracle_host', 'hive_existing_oracle_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'];
+          break;
+        case 'Existing PostgreSQL Database':
+          dbHostPropertyName = configs.someProperty('name', 'hive_existing_postgresql_host')
? 'hive_existing_postgresql_host' : dbHostPropertyName;
+          configsToRemove = ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_oracle_host', 'hive_existing_oracle_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'];
+          break;
+        case 'Existing Oracle Database':
+          dbHostPropertyName = configs.someProperty('name', 'hive_existing_oracle_host')
? 'hive_existing_oracle_host' : dbHostPropertyName;
+          configsToRemove = ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MSSQL Server database with SQL authentication':
+          dbHostPropertyName = configs.someProperty('name', 'hive_existing_mssql_server_host')
? 'hive_existing_mssql_server_host' : dbHostPropertyName;
+          configsToRemove = ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MSSQL Server database with integrated authentication':
+          dbHostPropertyName = configs.someProperty('name', 'hive_existing_mssql_server_2_host')
? 'hive_existing_mssql_server_2_host' : dbHostPropertyName;
+          configsToRemove = ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_mssql_server_database', 'hive_existing_mssql_server_host'];
+          break;
       }
+      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', configsToRemove);
     }
     if (dbHostPropertyName) {
       var hiveHostNameProperty = App.ServiceConfigProperty.create(App.config.get('preDefinedSiteProperties').findProperty('name',
'hive_hostname'));
       hiveHostNameProperty.set('value', configs.findProperty('name', dbHostPropertyName).get('value'));
       configs.pushObject(hiveHostNameProperty);
     }
+    return configs;
   },
 
   /**
@@ -1574,114 +1519,42 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * @method setOozieHostName
    */
   setOozieHostName: function (configs) {
-    var dbHostPropertyName = null;
+    var dbHostPropertyName = null, configsToRemove = [];
     if (configs.someProperty('name', 'oozie_database')) {
       var oozieDb = configs.findProperty('name', 'oozie_database');
-      if (oozieDb.value === 'New Derby Database') {
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-      } else if (oozieDb.value === 'New MySQL Database') {
-        var ambariHost = configs.findProperty('name', 'oozie_ambari_host');
-        if (ambariHost) {
-          ambariHost.name = 'oozie_hostname';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_derby_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-
-      } else if (oozieDb.value === 'Existing MySQL Database') {
-        var existingMySqlHost = configs.findProperty('name', 'oozie_existing_mysql_host');
-        if (existingMySqlHost) {
-          dbHostPropertyName = 'oozie_existing_mysql_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_derby_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-      } else if (oozieDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql'))
{
-        var existingPostgreSqlHost = configs.findProperty('name', 'oozie_existing_postgresql_host');
-
-
-        if (existingPostgreSqlHost) {
-          dbHostPropertyName = 'oozie_existing_postgresql_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-      }
-      else if (oozieDb.value === 'Existing Oracle Database') {
-        var existingOracleHost = configs.findProperty('name', 'oozie_existing_oracle_host');
-        if (existingOracleHost) {
-          dbHostPropertyName = 'oozie_existing_oracle_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_derby_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-      } else if (oozieDb.value === 'Existing MSSQL Server database with SQL authentication')
{
-        var existingMySqlServerHost = configs.findProperty('name', 'oozie_existing_mssql_server_host');
-        if (existingMySqlServerHost) {
-          dbHostPropertyName = 'oozie_existing_mssql_server_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_derby_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_2_host'));
-      } else if (oozieDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-        var existingMySql2ServerHost = configs.findProperty('name', 'oozie_existing_mssql_server_2_host');
-        if (existingMySql2ServerHost) {
-          dbHostPropertyName = 'oozie_existing_mssql_server_2_host';
-        }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_derby_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_postgresql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_database'));
-        configs = configs.without(configs.findProperty('name', 'oozie_existing_mssql_server_host'));
+      switch (oozieDb.value) {
+        case 'New Derby Database':
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_existing_oracle_host', 'oozie_existing_oracle_database', 'oozie_existing_postgresql_host',
'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'New MySQL Database':
+          var ambariHost = configs.findProperty('name', 'oozie_ambari_host');
+          if (ambariHost) {
+            ambariHost.name = 'oozie_hostname';
+          }
+          configsToRemove = ['oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_existing_oracle_host', 'oozie_existing_oracle_database', 'oozie_derby_database', 'oozie_existing_postgresql_host',
'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MySQL Database':
+          dbHostPropertyName = configs.someProperty('name', 'oozie_existing_mysql_host')
? 'oozie_existing_mysql_host' : dbHostPropertyName;
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host', 'oozie_existing_mssql_server_2_database',
'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'Existing PostgreSQL Database':
+          dbHostPropertyName = configs.someProperty('name', 'oozie_existing_postgresql_host')
? 'oozie_existing_postgresql_host' : dbHostPropertyName;
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_existing_oracle_host', 'oozie_existing_oracle_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_host', 'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'Existing Oracle Database':
+          dbHostPropertyName = configs.someProperty('name', 'oozie_existing_oracle_host')
? 'oozie_existing_oracle_host' : dbHostPropertyName;
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_derby_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MSSQL Server database with SQL authentication':
+          dbHostPropertyName = configs.someProperty('name', 'oozie_existing_mssql_server_host')
? 'oozie_existing_mssql_server_host' : dbHostPropertyName;
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mysql_host', 'oozie_existing_mysql_database', 'oozie_existing_mssql_server_2_database',
'oozie_existing_mssql_server_2_host'];
+          break;
+        case 'Existing MSSQL Server database with integrated authentication':
+          dbHostPropertyName = configs.someProperty('name', 'oozie_existing_mssql_server_2_host')
? 'oozie_existing_mssql_server_2_host' : dbHostPropertyName;
+          configsToRemove = ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mysql_host', 'oozie_existing_mysql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_host'];
+          break;
       }
+      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', configsToRemove);
     }
 
     if (dbHostPropertyName) {
@@ -1689,6 +1562,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       oozieHostNameProperty.set('value', configs.findProperty('name', dbHostPropertyName).get('value'));
       configs.pushObject(oozieHostNameProperty);
     }
+    return configs;
   },
 
   /**
@@ -1699,8 +1573,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    */
   saveSiteConfigs: function (configs) {
     //storedConfigs contains custom configs as well
-    this.setHiveHostName(configs);
-    this.setOozieHostName(configs);
+    configs = this.setHiveHostName(configs);
+    configs = this.setOozieHostName(configs);
     this.formatConfigValues(configs);
     var mappedConfigs = App.config.excludeUnsupportedConfigs(this.get('configMapping').all(),
App.Service.find().mapProperty('serviceName'));
     var allUiConfigs = this.loadUiSideConfigs(mappedConfigs);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index b2fc1f2..e2a858a 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 var stringUtils = require('utils/string_utils');
+var dataManipulationUtils = require('utils/data_manipulation');
 
 App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wizardDeployProgressControllerMixin,
App.ConfigOverridable, {
 
@@ -286,9 +287,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
       }
 
       hive_properties.push('hive_master_hosts');
-      hive_properties.forEach(function (property) {
-        configs = configs.without(configs.findProperty('name', property));
-      });
+      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', hive_properties);
     }
     return configs;
   },
@@ -336,9 +335,8 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
             'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_2_database']);
           break;
       }
-      oozie_properties.forEach(function (property) {
-        configs = configs.without(configs.findProperty('name', property));
-      });
+
+      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', oozie_properties);
     }
     return configs;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/ambari-web/app/utils/data_manipulation.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/data_manipulation.js b/ambari-web/app/utils/data_manipulation.js
index 7aab73b..09ef79e 100644
--- a/ambari-web/app/utils/data_manipulation.js
+++ b/ambari-web/app/utils/data_manipulation.js
@@ -36,7 +36,7 @@ module.exports = {
   rejectPropertyValues: function(collection, key, valuesToReject) {
     return collection.filter(function (item) {
       var propertyValue = Em.get(item, key);
-      return valuesToReject.contains(propertyValue);
+      return !valuesToReject.contains(propertyValue);
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index 47acdcd..cdf0056 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -1320,4 +1320,192 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
+  describe('#setHiveHostName', function () {
+
+    Em.A([
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'New MySQL Database'}),
+            Em.Object.create({name: 'hive_database_type', value: 'mysql'}),
+            Em.Object.create({name: 'hive_ambari_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database',
'hive_existing_mssql_server_database', 'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database',
'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: New MySQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'New PostgreSQL Database'}),
+            Em.Object.create({name: 'hive_database_type', value: 'mysql'}),
+            Em.Object.create({name: 'hive_ambari_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database',
'hive_existing_mssql_server_database', 'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database',
'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: New PostgreSQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'Existing MySQL Database'}),
+            Em.Object.create({name: 'hive_database_type', value: 'mysql'}),
+            Em.Object.create({name: 'hive_existing_mysql_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_ambari_database', 'hive_existing_oracle_host', 'hive_existing_oracle_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: Existing MySQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'Existing PostgreSQL Database'}),
+            Em.Object.create({name: 'hive_database_type', value: 'postgresql'}),
+            Em.Object.create({name: 'hive_existing_postgresql_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_oracle_host', 'hive_existing_oracle_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: Existing PostgreSQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'Existing Oracle Database'}),
+            Em.Object.create({name: 'hive_database_type', value: 'oracle'}),
+            Em.Object.create({name: 'hive_existing_oracle_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_mssql_server_database',
'hive_existing_mssql_server_host', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: Existing Oracle Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'Existing MSSQL Server database
with SQL authentication'}),
+            Em.Object.create({name: 'hive_database_type', value: 'mssql'}),
+            Em.Object.create({name: 'hive_existing_mssql_server_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_mssql_server_2_database', 'hive_existing_mssql_server_2_host'],
+          m: 'hive_database: Existing MSSQL Server database with SQL authentication',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'hive_database', value: 'Existing MSSQL Server database
with integrated authentication'}),
+            Em.Object.create({name: 'hive_database_type', value: 'mssql'}),
+            Em.Object.create({name: 'hive_existing_mssql_server_2_host', value: 'h1'}),
+            Em.Object.create({name: 'hive_hostname', value: 'h2'})
+          ],
+          removed: ['hive_ambari_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database',
'hive_existing_postgresql_host', 'hive_existing_postgresql_database', 'hive_existing_oracle_host',
'hive_existing_oracle_database', 'hive_existing_mssql_server_database', 'hive_existing_mssql_server_host'],
+          m: 'hive_database: Existing MSSQL Server database with integrated authentication',
+          host: 'h2'
+        }
+      ]).forEach(function (test) {
+        it(test.m, function () {
+          var configs = test.globals.slice();
+          test.removed.forEach(function (c) {
+            configs.pushObject(Em.Object.create({name: c}))
+          });
+          configs = mainServiceInfoConfigsController.setHiveHostName(configs);
+          test.removed.forEach(function (name) {
+            if (!Em.isNone(configs.findProperty('name', name))) console.log('!!!!', name);
+            expect(Em.isNone(configs.findProperty('name', name))).to.equal(true);
+          });
+          expect(configs.findProperty('name', 'hive_hostname').value).to.equal(test.host);
+        });
+      });
+
+  });
+
+  describe('#setOozieHostName', function () {
+
+    Em.A([
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'New Derby Database'}),
+            Em.Object.create({name: 'oozie_ambari_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_existing_oracle_host', 'oozie_existing_oracle_database', 'oozie_existing_postgresql_host',
'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: New Derby Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'New MySQL Database'}),
+            Em.Object.create({name: 'oozie_ambari_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_existing_mysql_host', 'oozie_existing_mysql_database', 'oozie_existing_oracle_host',
'oozie_existing_oracle_database', 'oozie_derby_database', 'oozie_existing_postgresql_host',
'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: New MySQL Database',
+          host: 'h1'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'Existing MySQL Database'}),
+            Em.Object.create({name: 'oozie_existing_mysql_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host', 'oozie_existing_mssql_server_2_database',
'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: Existing MySQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'Existing PostgreSQL Database'}),
+            Em.Object.create({name: 'oozie_existing_postgresql_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_existing_oracle_host', 'oozie_existing_oracle_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_host', 'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: Existing PostgreSQL Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'Existing Oracle Database'}),
+            Em.Object.create({name: 'oozie_existing_oracle_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database',
'oozie_derby_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_host',
'oozie_existing_mssql_server_2_database', 'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: Existing Oracle Database',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'Existing MSSQL Server database
with SQL authentication'}),
+            Em.Object.create({name: 'oozie_existing_oracle_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mysql_host', 'oozie_existing_mysql_database', 'oozie_existing_mssql_server_2_database',
'oozie_existing_mssql_server_2_host'],
+          m: 'oozie_database: Existing MSSQL Server database with SQL authentication',
+          host: 'h2'
+        },
+        {
+          globals: [
+            Em.Object.create({name: 'oozie_database', value: 'Existing MSSQL Server database
with integrated authentication'}),
+            Em.Object.create({name: 'oozie_existing_oracle_host', value: 'h1'}),
+            Em.Object.create({name: 'oozie_hostname', value: 'h2'})
+          ],
+          removed: ['oozie_ambari_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database',
'oozie_existing_mysql_host', 'oozie_existing_mysql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_host'],
+          m: 'oozie_database: Existing MSSQL Server database with integrated authentication',
+          host: 'h2'
+        }
+      ]).forEach(function (test) {
+        it(test.m, function () {
+          var configs = test.globals.slice();
+          test.removed.forEach(function (c) {
+            if (!configs.findProperty('name', c)) {
+              configs.pushObject(Em.Object.create({name: c}))
+            }
+          });
+          configs = mainServiceInfoConfigsController.setOozieHostName(configs);
+          test.removed.forEach(function (name) {
+            expect(Em.isNone(configs.findProperty('name', name))).to.equal(true);
+          });
+          expect(configs.findProperty('name', 'oozie_hostname').value).to.equal(test.host);
+        });
+      });
+
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/1212fb42/ambari-web/test/utils/data_manipulation_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/data_manipulation_test.js b/ambari-web/test/utils/data_manipulation_test.js
index 16f834f..fec5625 100644
--- a/ambari-web/test/utils/data_manipulation_test.js
+++ b/ambari-web/test/utils/data_manipulation_test.js
@@ -71,7 +71,7 @@ describe('data_manipulation', function () {
         ],
         key = 'n';
       var result = data_manipulation.groupPropertyValues(collection, key);
-      expect(result).to.eql({
+      expect(JSON.stringify(result)).to.equal(JSON.stringify({
         v1: [
           {n: 'v1'}
         ],
@@ -81,7 +81,7 @@ describe('data_manipulation', function () {
         ],
         v4: [
           {n: 'v4'}
-        ]});
+        ]}));
     });
 
   });


Mime
View raw message