소스 검색

AMBARI-12819 FE: Support SQLA as a DB option for Oozie, Hive, Ranger. (ababiichuk)

aBabiichuk 10 년 전
부모
커밋
3705d29684

+ 18 - 2
ambari-web/app/controllers/main/service/info/configs.js

@@ -380,8 +380,24 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     this.set('allConfigs', configs);
     //add configs as names of host components
     this.addHostNamesToConfig();
+    this.addDBProperties(configs);
   },
 
+  /**
+   * This method should add UI properties that are market as <code>'isRequiredByAgent': false<code>
+   * @param configs
+   */
+  addDBProperties: function(configs) {
+    if (this.get('content.serviceName') === 'HIVE') {
+      var propertyToAdd = App.config.get('preDefinedSitePropertiesMap')[App.config.configId('hive_hostname','hive-env')],
+        cfg = App.config.createDefaultConfig(propertyToAdd.name, propertyToAdd.serviceName, propertyToAdd.filename, true, propertyToAdd),
+        connectionUrl = configs.findProperty('name', 'javax.jdo.option.ConnectionURL');
+      if (cfg && connectionUrl) {
+        cfg.savedValue = cfg.value = databaseUtils.getDBLocationFromJDBC(connectionUrl.get('value'));
+        configs.pushObject(App.ServiceConfigProperty.create(cfg));
+      }
+    }
+  },
   /**
    * adds properties form stack that doesn't belong to cluster
    * to step configs
@@ -523,7 +539,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
       var configsByService = this.get('allConfigs').filter(function (c) {
         return serviceNames.contains(c.get('serviceName'));
       });
-      databaseUtils.bootstrapDatabaseProperties(configsByService, serviceName);
+      //databaseUtils.bootstrapDatabaseProperties(configsByService, serviceName);
       var serviceConfig = App.config.createServiceConfig(serviceName, configGroups, configsByService, configsByService.length);
       if (serviceConfig.get('serviceName') === 'HDFS') {
         if (App.get('isHaEnabled')) {
@@ -540,7 +556,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     var selectedService = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName'));
     this.set('selectedService', selectedService);
     this.checkOverrideProperty(selectedService);
-    this.checkDatabaseProperties(selectedService);
+    //this.checkDatabaseProperties(selectedService);
     if (!App.Service.find().someProperty('serviceName', 'RANGER')) {
       App.config.removeRangerConfigs(this.get('stepConfigs'));
     } else {

+ 2 - 2
ambari-web/app/controllers/wizard/step8_controller.js

@@ -345,12 +345,12 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   loadConfigs: function () {
     //storedConfigs contains custom configs as well
     var configs = this.get('content.serviceConfigProperties');
-    if (configs.someProperty('name', 'hive_database')) {
+    /*if (configs.someProperty('name', 'hive_database')) {
       configs = this.removeHiveConfigs(configs);
     }
     if (configs.someProperty('name', 'oozie_database')) {
       configs = this.removeOozieConfigs(configs);
-    }
+    }*/
     configs.forEach(function (_config) {
       _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
     });

+ 11 - 154
ambari-web/app/data/HDP2.3/site_properties.js

@@ -65,27 +65,25 @@ hdp23properties.push({
     "isReconfigurable": true,
     "options": [
       {
-        displayName: 'MYSQL',
-        foreignKeys: ['ranger_mysql_database', 'ranger_mysql_host']
+        displayName: 'MYSQL'
       },
       {
-        displayName: 'ORACLE',
-        foreignKeys: ['ranger_oracle_database', 'ranger_oracle_host']
+        displayName: 'ORACLE'
       },
       {
-        displayName: 'POSTGRES',
-        foreignKeys: ['ranger_postgres_database', 'ranger_postgres_host']
+        displayName: 'POSTGRES'
       },
       {
-        displayName: 'MSSQL',
-        foreignKeys: ['ranger_mssql_database', 'ranger_mssql_host']
+        displayName: 'MSSQL'
+      },
+      {
+        displayName: 'SQLA'
       }
     ],
     "displayType": "radio button",
     "radioName": "RANGER DB_FLAVOR",
     "isOverridable": false,
     "isVisible": true,
-    "isObserved": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
@@ -99,80 +97,12 @@ hdp23properties.push({
     "isReconfigurable": true,
     "displayType": "",
     "isOverridable": false,
-    "isVisible": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 2
-  },
-  {
-    "name": "ranger_mysql_database",
-    "id": "puppet var",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MySQL",
-    "description": "Using a MySQL database for Ranger",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 1
-  },
-  {
-    "name": "ranger_oracle_database",
-    "id": "puppet var",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "ORACLE",
-    "description": "Using an Oracle database for Ranger",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
+    "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
     "index": 2
   },
-  {
-    "name": "ranger_postgres_database",
-    "id": "puppet var",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "Postgres",
-    "description": "Using a Postgres database for Ranger",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 3
-  },
-  {
-    "name": "ranger_mssql_database",
-    "id": "puppet var",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MSSQL",
-    "description": "Using a MS SQL database for Ranger",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 4
-  },
   {
     "name": "rangerserver_host",
     "id": "puppet var",
@@ -547,74 +477,6 @@ hdp23properties.push({
     "category": "Advanced ranger-kafka-audit",
     "serviceName": "KAFKA"
   },
-  {
-    "name": "ranger_mysql_host",
-    "id": "puppet var",
-    "displayName": "Ranger DB host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "value": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isVisible": false,
-    "isObserved": true,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 6
-  },
-  {
-    "name": "ranger_oracle_host",
-    "id": "puppet var",
-    "displayName": "Ranger DB host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "value": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isVisible": false,
-    "isObserved": true,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 7
-  },
-  {
-    "name": "ranger_postgres_host",
-    "id": "puppet var",
-    "displayName": "Ranger DB host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "value": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isVisible": false,
-    "isObserved": true,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 8
-  },
-  {
-    "name": "ranger_mssql_host",
-    "id": "puppet var",
-    "displayName": "Ranger DB host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "value": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isVisible": false,
-    "isObserved": true,
-    "isRequiredByAgent": false,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 9
-  },
   {
     "name": "ranger.jpa.jdbc.url",
     "id": "site property",
@@ -623,7 +485,6 @@ hdp23properties.push({
     "isReconfigurable": true,
     "displayType": "",
     "isOverridable": false,
-    "isObserved": true,
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "ranger-admin-site.xml",
@@ -636,7 +497,6 @@ hdp23properties.push({
     "displayName": "Driver class name for a JDBC Ranger database",
     "recommendedValue": "",
     "isReconfigurable": true,
-    "isObserved": true,
     "displayType": "",
     "isOverridable": false,
     "isVisible": true,
@@ -651,7 +511,6 @@ hdp23properties.push({
     "displayName": "Ranger DB root user",
     "recommendedValue": "",
     "isReconfigurable": true,
-    "isObserved": true,
     "displayType": "",
     "isOverridable": false,
     "isVisible": true,
@@ -666,7 +525,6 @@ hdp23properties.push({
     "displayName": "Ranger DB root password",
     "recommendedValue": "",
     "isReconfigurable": true,
-    "isObserved": true,
     "displayType": "password",
     "isOverridable": false,
     "isVisible": true,
@@ -681,7 +539,6 @@ hdp23properties.push({
     "displayName": "Ranger DB name",
     "recommendedValue": "",
     "isReconfigurable": true,
-    "isObserved": true,
     "displayType": "",
     "isOverridable": false,
     "isVisible": true,
@@ -733,15 +590,15 @@ hdp23properties.push({
     "options": [
       {
         displayName: 'LDAP',
-        foreignKeys: ['xa_ldap_userDNpattern', 'xa_ldap_groupRoleAttribute', 'xa_ldap_url', 'xa_ldap_groupSearchBase', 'xa_ldap_groupSearchFilter']
+        foreignKeys: ['ranger.ldap.group.roleattribute', 'ranger.ldap.url', 'ranger.ldap.user.dnpattern']
       },
       {
         displayName: 'ACTIVE_DIRECTORY',
-        foreignKeys: ['xa_ldap_ad_domain', 'xa_ldap_ad_url']
+        foreignKeys: ['ranger.ldap.ad.domain', 'ranger.ldap.ad.url']
       },
       {
         displayName: 'UNIX',
-        foreignKeys: ['remoteLoginEnabled', 'authServiceHostName', 'authServicePort']
+        foreignKeys: ['ranger.unixauth.service.port', 'ranger.unixauth.service.hostname', 'ranger.unixauth.remote.login.enabled']
       },
       {
         displayName: 'NONE'

+ 13 - 389
ambari-web/app/data/HDP2/site_properties.js

@@ -392,7 +392,6 @@ var hdp2properties = [
     "displayName": "Database Name",
     "isOverridable": false,
     "displayType": "host",
-    "isObserved": true,
     "category": "OOZIE_SERVER",
     "serviceName": "OOZIE",
     "filename": "oozie-site.xml",
@@ -528,7 +527,6 @@ var hdp2properties = [
     "displayName": "Database Name",
     "displayType": "host",
     "isOverridable": false,
-    "isObserved": true,
     "serviceName": "HIVE",
     "filename": "hive-site.xml",
     "category": "HIVE_METASTORE",
@@ -3353,95 +3351,6 @@ var hdp2properties = [
     "serviceName": "HIVE",
     "filename": "hive-env.xml"
   },
-  // for existing MySQL
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mysql_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MySQL",
-    "description": "Using an existing MySQL database for Hive Metastore",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 1
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mssql_server_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MSSQL",
-    "description": "Using an existing MSSQL database for Hive Metastore",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 1
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mssql_server_2_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MSSQL",
-    "description": "Using an existing MSSQL database for Hive Metastore",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 1
-  },
-  // for existing PostgreSQL
-  {
-    "id": "puppet var",
-    "name": "hive_existing_postgresql_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "PostgreSQL",
-    "description": "Using an existing PostgreSQL database for Hive Metastore",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 1
-  },
-  // for existing Oracle
-  {
-    "id": "puppet var",
-    "name": "hive_existing_oracle_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "Oracle",
-    "description": "Using an existing Oracle database for Hive Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isOverridable": false,
-    "isReconfigurable": false,
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 1
-  },
-  // for new MySQL
   {
     "id": "puppet var",
     "name": "hive_ambari_database",
@@ -3468,22 +3377,22 @@ var hdp2properties = [
     "options": [
       {
         displayName: 'New MySQL Database',
-        foreignKeys: ['hive_ambari_database', 'hive_ambari_host'],
         hidden: false
       },
       {
         displayName: 'Existing MySQL Database',
-        foreignKeys: ['hive_existing_mysql_database', 'hive_existing_mysql_host'],
         hidden: false
       },
       {
         displayName: 'Existing PostgreSQL Database',
-        foreignKeys: ['hive_existing_postgresql_database', 'hive_existing_postgresql_host'],
         hidden: false
       },
       {
         displayName: 'Existing Oracle Database',
-        foreignKeys: ['hive_existing_oracle_database', 'hive_existing_oracle_host'],
+        hidden: false
+      },
+      {
+        displayName: 'Existing SQLA Database',
         hidden: false
       }
     ],
@@ -3503,62 +3412,12 @@ var hdp2properties = [
     "name": "hive_hostname",
     "displayName": "Database Host",
     "description": "Specify the host on which the database is hosted",
-    "savedValue": "",
     "recommendedValue": "",
     "isReconfigurable": true,
     "displayType": "host",
     "isOverridable": false,
     "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mysql_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_postgresql_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_oracle_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
+    "isVisible": true,
     "serviceName": "HIVE",
     "filename": "hive-env.xml",
     "category": "HIVE_METASTORE",
@@ -3581,38 +3440,6 @@ var hdp2properties = [
     "category": "HIVE_METASTORE",
     "index": 3
   },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mssql_server_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "hive_existing_mssql_server_2_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
   {
     "id": "puppet var",
     "name": "hive_metastore_port",
@@ -3742,13 +3569,13 @@ var hdp2properties = [
   {
     "id": "puppet var",
     "name": "hive_database_type",
-    "displayName": "hive_database_type",
+    "displayName": "Hive Database Type",
     "recommendedValue": "",
     "isOverridable": false,
-    "isVisible": false,
+    "isVisible": true,
     "serviceName": "HIVE",
     "filename": "hive-env.xml",
-    "category": "Advanced hive-env"
+    "category": "HIVE_METASTORE"
   },
 /**********************************************OOZIE***************************************/
   {
@@ -3767,43 +3594,6 @@ var hdp2properties = [
     "category": "OOZIE_SERVER",
     "index": 0
   },
-  // for existing Oracle
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_oracle_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "Oracle",
-    "description": "Using an existing Oracle database for Oozie Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isObserved": true,
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
-  // for existing PostgreSQL
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_postgresql_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "PostgreSQL",
-    "description": "Using an existing PostgreSQL database for Oozie Metastore",
-    "displayType": "masterHost",
-    "isOverridable": false,
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isReconfigurable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
   // for new MySQL
   {
     "id": "puppet var",
@@ -3821,75 +3611,6 @@ var hdp2properties = [
     "category": "OOZIE_SERVER",
     "index": 1
   },
-  // for current derby
-  {
-    "id": "puppet var",
-    "name": "oozie_derby_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "Derby",
-    "description": "Using current Derby database for Oozie Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
-  // for existing MySQL oozie
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mysql_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MySQL",
-    "description": "Using an existing MySQL database for Oozie Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mssql_server_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MSSQL",
-    "description": "Using an existing MSSQL database with SQL authentication for Oozie Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mssql_server_2_database",
-    "displayName": "Database Type",
-    "value": "",
-    "recommendedValue": "MSSQL",
-    "description": "Using an existing MSSQL database with integrated authentication for Oozie Metastore",
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 1
-  },
   {
     "id": "puppet var",
     "name": "oozie_database",
@@ -3899,22 +3620,22 @@ var hdp2properties = [
     "options": [
       {
         displayName: 'New Derby Database',
-        foreignKeys: ['oozie_derby_database'],
         hidden: false
       },
       {
         displayName: 'Existing MySQL Database',
-        foreignKeys: ['oozie_existing_mysql_database', 'oozie_existing_mysql_host'],
         hidden: false
       },
       {
         displayName: 'Existing PostgreSQL Database',
-        foreignKeys: ['oozie_existing_postgresql_database', 'oozie_existing_postgresql_host'],
         hidden: false
       },
       {
         displayName: 'Existing Oracle Database',
-        foreignKeys: ['oozie_existing_oracle_database', 'oozie_existing_oracle_host'],
+        hidden: false
+      },
+      {
+        displayName: 'Existing SQLA Database',
         hidden: false
       }
     ],
@@ -3949,110 +3670,13 @@ var hdp2properties = [
   {
     "id": "puppet var",
     "name": "oozie_hostname",
-    "savedValue": "",
     "recommendedValue": "",
     "displayName": "Database Host",
     "description": "The host where the Oozie database is located",
     "isReconfigurable": true,
     "isOverridable": false,
     "displayType": "host",
-    "isVisible": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mysql_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "isOverridable": false,
-    "displayType": "host",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isObserved": true,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_postgresql_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "isOverridable": false,
-    "displayType": "host",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isObserved": true,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_oracle_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "isOverridable": false,
-    "displayType": "host",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "isObserved": true,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_ambari_host",
-    "value": "",
-    "recommendedValue": "",
-    "displayName": "Database Host",
-    "description": "Host on which the database will be created by Ambari",
-    "isReconfigurable": false,
-    "isOverridable": false,
-    "displayType": "masterHost",
-    "isVisible": false,
-    "isRequiredByAgent": false,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER"
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mssql_server_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "id": "puppet var",
-    "name": "oozie_existing_mssql_server_2_host",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the existing database is hosted",
-    "recommendedValue": "",
-    "displayType": "host",
-    "isOverridable": false,
-    "isRequiredByAgent": false,
-    "isVisible": false,
-    "isObserved": true,
+    "isVisible": true,
     "serviceName": "OOZIE",
     "filename": "oozie-env.xml",
     "category": "OOZIE_SERVER",

+ 122 - 0
ambari-web/app/data/db_properties_info.js

@@ -0,0 +1,122 @@
+/**
+ * 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');
+
+module.exports = {
+  /**
+   * object that shows property names for different kind of config properties
+   * - radio button property (db_selector) - main config on which can depend other core properties
+   * - properties used to generate connection url (host_name, db_name)
+   * - properties that should be updated on radio buttons change (connection_url, driver, db_type, sql_jar_connector)
+   * @see <code>setConnectionUrl<code> for details for connection_url
+   * - properties that should be hidden in special case (user_name, password)
+   * @see <code>handleSpecialUserPassProperties<code> method
+   * @type {object}
+   */
+  dpPropertiesByServiceMap: {
+    'HIVE': {
+      db_selector: 'hive_database',
+
+      host_name: 'hive_hostname',
+      db_name: 'ambari.hive.db.schema.name',
+
+      connection_url: 'javax.jdo.option.ConnectionURL',
+      db_type: 'hive_database_type',
+      driver: 'javax.jdo.option.ConnectionDriverName',
+
+      user_name: 'javax.jdo.option.ConnectionUserName',
+      password: 'javax.jdo.option.ConnectionPassword'
+    },
+    'OOZIE': {
+      db_selector: 'oozie_database',
+
+      host_name: 'oozie_hostname',
+      db_name: 'oozie.db.schema.name',
+
+      connection_url: 'oozie.service.JPAService.jdbc.url',
+      driver: 'oozie.service.JPAService.jdbc.driver',
+
+      user_name: 'oozie.service.JPAService.jdbc.username',
+      password: 'oozie.service.JPAService.jdbc.password'
+    },
+    'RANGER': {
+      db_selector: 'DB_FLAVOR',
+
+      host_name: 'db_host',
+      db_name: 'db_name',
+
+      connection_url:  App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.url' : 'ranger_jdbc_connection_url',
+      driver: App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.driver' : 'ranger_jdbc_driver',
+      sql_jar_connector: 'SQL_CONNECTOR_JAR'
+    }
+  },
+
+  /**
+   * object that shows default(recommended) values for different db type;
+   * properties that should have default value ['connection_url', 'driver', 'sql_jar_connector', 'db_type']
+   * some properties can be skipped but be sure they are not used.
+   * @type {object}
+   */
+  dpPropertiesMap: {
+    'MYSQL': {
+      'connection_url': 'jdbc:mysql://{0}/{1}',
+      /** in case property has different default value for specific service it can be overriden in such way **/
+      'HIVE': {
+        'connection_url': 'jdbc:mysql://{0}/{1}?createDatabaseIfNotExist=true'
+      },
+      'driver': 'com.mysql.jdbc.Driver',
+      'sql_jar_connector': '/usr/share/java/mysql-connector-java.jar',
+      'db_type': 'mysql'
+    },
+    'POSTGRES': {
+      'connection_url': 'jdbc:postgresql://{0}:5432/{1}',
+      'driver': 'org.postgresql.Driver',
+      'sql_jar_connector': '/usr/share/java/postgresql.jar',
+      'db_type': 'postgres'
+    },
+    'ORACLE': {
+      'connection_url': 'jdbc:oracle:thin:@//{0}:1521/{1}',
+      'driver': 'oracle.jdbc.driver.OracleDriver',
+      'sql_jar_connector': '/usr/share/java/ojdbc6.jar',
+      'db_type': 'oracle'
+    },
+    'MSSQL': {
+      'connection_url': 'jdbc:sqlserver://{0};databaseName={1}',
+      'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+      'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
+      'db_type': 'mssql'
+    },
+    'MSSQL2': {
+      'connection_url': 'jdbc:sqlserver://{0};databaseName={1}',
+      'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+      'sql_jar_connector': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
+      'db_type': 'mssql'
+    },
+    'SQLA': {
+      'connection_url': 'jdbc:sqlanywhere:database={1};host={0}',
+      'driver': 'sap.jdbc4.sqlanywhere.IDriver',
+      'sql_jar_connector': '/path_to_driver/sajdbc4.jar',
+      'db_type': 'sqla'
+    },
+    'DERBY': {
+      'connection_url': 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
+      'driver': 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+  }
+};

+ 2 - 2
ambari-web/app/mixins/common/configs/configs_saver.js

@@ -331,8 +331,8 @@ App.ConfigsSaverMixin = Em.Mixin.create({
    * @method saveSiteConfigs
    */
   saveSiteConfigs: function (configs) {
-    configs = this.setHiveHostName(configs);
-    configs = this.setOozieHostName(configs);
+    //configs = this.setHiveHostName(configs);
+    //configs = this.setOozieHostName(configs);
     this.formatConfigValues(configs);
     return configs;
   },

+ 1 - 2
ambari-web/app/utils/config.js

@@ -303,7 +303,7 @@ App.config = Em.Object.create({
         var id = this.configId(index, siteConfig.type);
         var configsPropertyDef = this.get('preDefinedSitePropertiesMap')[id];
         var advancedConfig = App.StackConfigProperty.find(id);
-        var isStackProperty = !!advancedConfig.get('id');
+        var isStackProperty = !!advancedConfig.get('id') || !!configsPropertyDef;
         var template = this.createDefaultConfig(index, serviceName, filename, isStackProperty, configsPropertyDef);
         var serviceConfigObj = isStackProperty ? this.mergeStaticProperties(template, advancedConfig) : template;
 
@@ -366,7 +366,6 @@ App.config = Em.Object.create({
       id: 'site property',
       isRequiredByAgent:  true,
       isReconfigurable: true,
-      isObserved: false,
       unit: null,
       hasInitialValue: false,
       isOverridable: true,

+ 9 - 1
ambari-web/app/utils/configs/config_property_helper.js

@@ -139,6 +139,8 @@ module.exports = {
       case 'hivemetastore_host':
         configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'));
         break;
+      case 'hive_hostname':
+        configProperty.set('recommendedValue', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
       case 'hive_ambari_host':
         configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
         break;
@@ -159,6 +161,8 @@ module.exports = {
           Em.set(newMySQLDBOption, 'hidden', isNewMySQLDBOptionHidden);
         }
         break;
+      case 'oozie_hostname':
+        configProperty.set('recommendedValue', masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER').mapProperty('hostName'));
       case 'oozieserver_host':
         configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER').mapProperty('hostName'));
         break;
@@ -315,11 +319,15 @@ module.exports = {
         }
         break;
       case 'db_host':
+        var masterComponent =  masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN');
+        if (masterComponent) {
+          configProperty.set('recommendedValue', masterComponent.hostName);
+        }
       case 'rangerserver_host':
         var masterComponent =  masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN');
         if (masterComponent) {
           configProperty.set('value', masterComponent.hostName);
-        };
+        }
         break;
       case 'ranger_mysql_host':
       case 'ranger_oracle_host':

+ 156 - 299
ambari-web/app/views/common/controls_view.js

@@ -19,6 +19,8 @@
 var App = require('app');
 var validator = require('utils/validator');
 
+var dbInfo = require('data/db_properties_info') || {};
+
 var delay = (function(){
   var timer = 0;
   return function(callback, ms){
@@ -426,17 +428,16 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   didInsertElement: function () {
     // on page render, automatically populate JDBC URLs only for default database settings
     // so as to not lose the user's customizations on these fields
-    if (['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name'))) {
-      if (/^New\s\w+\sDatabase$/.test(this.get('serviceConfig.value')) ||
-        this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name'))) {
+    //if (['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name'))) {
+      if (this.get('isNewDb') || this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name'))) {
         this.onOptionsChange();
       } else {
-        if ((App.get('isHadoopWindowsStack') && /SQL\sauthentication/.test(this.get('serviceConfig.value'))) || this.get('serviceConfig.name') === 'DB_FLAVOR') {
+        if ((App.get('isHadoopWindowsStack') && this.get('inMSSQLWithIA')) || this.get('serviceConfig.name') === 'DB_FLAVOR') {
           this.onOptionsChange();
         }
         this.handleDBConnectionProperty();
       }
-    }
+    //}
   },
 
   /**
@@ -454,312 +455,168 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     return ['DB_FLAVOR', 'authentication_method'];
   }.property('App.currentStackName'),
 
-  configs: function () {
-    if (this.get('controller.name') == 'mainServiceInfoConfigsController') return this.get('categoryConfigsAll');
-    return this.get('categoryConfigsAll').filterProperty('isObserved', true);
-  }.property('categoryConfigsAll'),
-
-  ignoreRangerHostChange: false,
-  dbTypeChanged: false,
   serviceConfig: null,
   categoryConfigsAll: null,
 
+  /**
+   * defines if new db is selected;
+   * @type {boolean}
+   */
+  isNewDb: function() {
+    return /New /g.test(this.get('serviceConfig.value'));
+  }.property('serviceConfig.serviceName', 'serviceConfig.value'),
+
+  /**
+   * defines if 'Existing MSSQL Server database with integrated authentication' is selected
+   * in this case some properties can have different behaviour
+   * @type {boolean}
+   */
+  inMSSQLWithIA: function() {
+    return this.get('serviceConfig.value') === 'Existing MSSQL Server database with integrated authentication';
+  }.property('serviceConfig.value'),
+
+  /**
+   * Radio button has very uncomfortable values for managing it's state
+   * so it's better to use code values that easier to manipulate. Ex:
+   * "Existing MySQL Database" transforms to "MYSQL"
+   * @type {string}
+   */
+  getDbTypeFromRadioValue: function() {
+    var currentValue = this.get('serviceConfig.value');
+    var databases = /MySQL|Postgres|Oracle|Derby|MSSQL|SQLA/gi;
+    if (this.get('inMSSQLWithIA')) {
+      return 'MSSQL2';
+    } else {
+      var matches = currentValue.match(databases);
+      if (matches) {
+        return currentValue.match(databases)[0].toUpperCase();
+      } else {
+        return "MYSQL";
+      }
+    }
+  }.property('serviceConfig.serviceName', 'serviceConfig.value'),
+
   onOptionsChange: function () {
     // The following if condition will be satisfied only for installer wizard flow
-    if (this.get('configs').length) {
-      var connectionUrl = this.get('connectionUrl');
-      if (connectionUrl) {
-        var dbClass = this.get('dbClass');
-        var hostName = this.get('hostName');
-        var databaseName = this.get('databaseName');
-        var hostNameDefault;
-        var databaseNameDefault;
-        var connectionUrlValue = connectionUrl.get('value');
-        var connectionUrlDefaultValue = connectionUrl.get('recommendedValue');
-        var dbClassValue = dbClass.get('value');
-        var serviceName = this.get('serviceConfig.serviceName');
-        var isServiceInstalled = App.Service.find().someProperty('serviceName', serviceName);
-        var postgresUrl = 'jdbc:postgresql://{0}:5432/{1}';
-        var oracleUrl = 'jdbc:oracle:thin:@//{0}:1521/{1}';
-        var mssqlUrl = 'jdbc:sqlserver://{0};databaseName={1}';
-        var mssqlIntegratedAuthUrl = 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true';
-        var isNotExistingMySQLServer = this.get('serviceConfig.value') !== 'Existing MSSQL Server database with integrated authentication';
-        var categoryConfigsAll = this.get('categoryConfigsAll');
-        if (isServiceInstalled) {
-          hostNameDefault = this.get('hostNameProperty.recommendedValue');
-          databaseNameDefault = this.get('databaseNameProperty.recommendedValue');
-        } else {
-          hostNameDefault = hostName;
-          databaseNameDefault = databaseName;
-        }
-        switch (serviceName) {
-          case 'HIVE':
-            var hiveDbType = this.get('parentView.serviceConfigs').findProperty('name', 'hive_database_type');
-            var mysqlUrl = 'jdbc:mysql://{0}/{1}?createDatabaseIfNotExist=true';
-            switch (this.get('serviceConfig.value')) {
-              case 'New MySQL Database':
-              case 'Existing MySQL Database':
-                connectionUrlValue = mysqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mysqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.mysql.jdbc.Driver';
-                Em.set(hiveDbType, 'value', 'mysql');
-                break;
-              case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-                connectionUrlValue = postgresUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = postgresUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'org.postgresql.Driver';
-                Em.set(hiveDbType, 'value', 'postgres');
-                break;
-              case 'Existing Oracle Database':
-                connectionUrlValue = oracleUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = oracleUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'oracle.jdbc.driver.OracleDriver';
-                Em.set(hiveDbType, 'value', 'oracle');
-                break;
-              case 'Existing MSSQL Server database with SQL authentication':
-                connectionUrlValue = mssqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mssqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                Em.set(hiveDbType, 'value', 'mssql');
-                break;
-              case 'Existing MSSQL Server database with integrated authentication':
-                connectionUrlValue = mssqlIntegratedAuthUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mssqlIntegratedAuthUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                Em.set(hiveDbType, 'value', 'mssql');
-                break;
-            }
-            categoryConfigsAll.findProperty('name', 'javax.jdo.option.ConnectionUserName').setProperties({
-              isVisible: isNotExistingMySQLServer,
-              isRequired: isNotExistingMySQLServer
-            });
-            categoryConfigsAll.findProperty('name', 'javax.jdo.option.ConnectionPassword').setProperties({
-              isVisible: isNotExistingMySQLServer,
-              isRequired: isNotExistingMySQLServer
-            });
-            break;
-          case 'OOZIE':
-            var derbyUrl = 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true';
-            var mysqlUrl = 'jdbc:mysql://{0}/{1}';
-            switch (this.get('serviceConfig.value')) {
-              case 'New Derby Database':
-                connectionUrlValue = derbyUrl;
-                connectionUrlDefaultValue = derbyUrl;
-                dbClassValue = 'org.apache.derby.jdbc.EmbeddedDriver';
-                break;
-              case 'Existing MySQL Database':
-                connectionUrlValue = mysqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mysqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.mysql.jdbc.Driver';
-                break;
-              case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-                connectionUrlValue = postgresUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = postgresUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'org.postgresql.Driver';
-                break;
-              case 'Existing Oracle Database':
-                connectionUrlValue = oracleUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = oracleUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'oracle.jdbc.driver.OracleDriver';
-                break;
-              case 'Existing MSSQL Server database with SQL authentication':
-                connectionUrlValue = mssqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mssqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                break;
-              case 'Existing MSSQL Server database with integrated authentication':
-                connectionUrlValue = mssqlIntegratedAuthUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mssqlIntegratedAuthUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                break;
-            }
-            categoryConfigsAll.findProperty('name', 'oozie.service.JPAService.jdbc.username').setProperties({
-              isVisible: isNotExistingMySQLServer,
-              isRequired: isNotExistingMySQLServer
-            });
-            categoryConfigsAll.findProperty('name', 'oozie.service.JPAService.jdbc.password').setProperties({
-              isVisible: isNotExistingMySQLServer,
-              isRequired: isNotExistingMySQLServer
-            });
-            break;
-          case 'RANGER':
-            var mysqlUrl = 'jdbc:mysql://{0}/{1}',
-              sqlConnectorJARValue = '/usr/share/java/mysql-connector-java.jar',
-              sqlConnectorJAR = this.get('parentView.serviceConfigs').findProperty('name', 'SQL_CONNECTOR_JAR'),
-              dbFlavor = this.get('serviceConfig.value'),
-              databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
-              currentDBFlavor = dbFlavor.match(databasesTypes).length?dbFlavor.match(databasesTypes)[0]:'';
-
-            switch (currentDBFlavor.toUpperCase()) {
-              case 'ORACLE':
-                connectionUrlValue = oracleUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = oracleUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'oracle.jdbc.driver.OracleDriver';
-                sqlConnectorJARValue = '/usr/share/java/ojdbc6.jar';
-                break;
-              case 'MYSQL':
-                connectionUrlValue = mysqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mysqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.mysql.jdbc.Driver';
-                sqlConnectorJARValue = '/usr/share/java/mysql-connector-java.jar';
-                break;
-              case 'POSTGRES':
-                connectionUrlValue = postgresUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = postgresUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'org.postgresql.Driver';
-                sqlConnectorJARValue = '/usr/share/java/postgresql.jar';
-                break;
-              case 'MSSQL':
-                connectionUrlValue = mssqlUrl.format(hostName, databaseName);
-                connectionUrlDefaultValue = mssqlUrl.format(hostNameDefault, databaseNameDefault);
-                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                sqlConnectorJARValue = '/usr/share/java/sqljdbc4.jar';
-                break;
-            }
-            this.get('categoryConfigsAll').findProperty('name', 'db_host').set('value', this.get('hostNameProperty.value'));
-            if(!this.get('ignoreRangerHostChange')) {
-              sqlConnectorJAR.set('value',sqlConnectorJARValue);
-              sqlConnectorJAR.set('recommendedValue',sqlConnectorJARValue);
-            }
-            break;
-        }
-        connectionUrl.set('value', connectionUrlValue);
-        connectionUrl.set('recommendedValue', connectionUrlDefaultValue);
-        dbClass.set('value', dbClassValue);
+    if (this.getPropertyByType('connection_url') && this.get('hostNameProperty')) {
+      /** if new db is selected host name must be same as master of selected service (and can't be changed)**/
+      if (this.get('isNewDb')) {
+        var initProperty = this.get('hostNameProperty.recommendedValue') || this.get('hostNameProperty.savedValue');
+        this.get('hostNameProperty').set('value', initProperty.toString());
+        this.get('hostNameProperty').set('isEditable', false);
+      } else {
+        this.get('hostNameProperty').set('isEditable', true);
       }
+      this.setRequiredProperties(['driver', 'sql_jar_connector', 'db_type']);
+      this.setConnectionUrl(this.get('hostNameProperty.value'), this.get('databaseProperty.value'));
+      this.handleSpecialUserPassProperties();
     }
-  }.observes('databaseName', 'hostName'),
+  }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value'),
 
   nameBinding: 'serviceConfig.radioName',
 
-  databaseNameProperty: function () {
-    var databaseNameConfig = {
-      'HIVE': 'ambari.hive.db.schema.name',
-      'OOZIE':'oozie.db.schema.name',
-      'RANGER': 'db_name'
-    };
-    return Object.keys(databaseNameConfig).contains(this.get('serviceConfig.serviceName'))?
-      this.get('categoryConfigsAll').findProperty('name', databaseNameConfig[this.get('serviceConfig.serviceName')]):
-      null;
+  /**
+   * Just property object for database name
+   * @type {App.ServiceConfigProperty}
+   */
+  databaseProperty: function () {
+    return this.getPropertyByType('db_name');
   }.property('serviceConfig.serviceName'),
 
-  databaseName: function () {
-    return this.get('databaseNameProperty.value');
-  }.property('databaseNameProperty.value'),
-
+  /**
+   * Just property object for host name
+   * @type {App.ServiceConfigProperty}
+   */
   hostNameProperty: function () {
-    this.set('dbTypeChanged', true);
-    var value = this.get('serviceConfig.value');
-    var returnValue;
-    var hostname;
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      switch (value) {
-        case 'New MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_ambari_host');
-          break;
-        case 'Existing MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host');
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_postgresql_host');
-          break;
-        case 'Existing Oracle Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host');
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mssql_server_host');
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mssql_server_2_host');
-          break;
-      }
-      if (hostname) {
-        Em.set(hostname, 'isUserProperty', false);
-        returnValue = hostname;
-      } else {
-        returnValue = this.get('categoryConfigsAll').findProperty('name', 'hive_hostname');
-      }
-    } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
-      switch (value) {
-        case 'New Derby Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_ambari_host');
-          break;
-        case 'Existing MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host');
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_postgresql_host');
-          break;
-        case 'Existing Oracle Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host');
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mssql_server_host');
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mssql_server_2_host');
-          break;
-      }
-      if (hostname) {
-        Em.set(hostname, 'isUserProperty', false);
-        returnValue = hostname;
-      } else {
-        returnValue = this.get('categoryConfigsAll').findProperty('name', 'oozie_hostname');
-      }
-    } else if (this.get('serviceConfig.serviceName') === 'RANGER') {
-      if (value) {
-        var databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
-          currentDBFlavor = value.match(databasesTypes),
-          dbHost = this.get('categoryConfigsAll').findProperty('name', 'db_host'),
-          hostnameConfig = {
-            'MYSQL': 'ranger_mysql_host',
-            'ORACLE': 'ranger_oracle_host',
-            'POSTGRES': 'ranger_postgres_host',
-            'MSSQL': 'ranger_mssql_host'
-          };
-        if (currentDBFlavor) {
-          hostname = this.get('categoryConfigsAll').findProperty('name', hostnameConfig[currentDBFlavor[0].toUpperCase()]);
-        }
-        if (hostname) {
-          if (!hostname.value) {
-            hostname.set('value', this.get('categoryConfigsAll').findProperty('name', 'db_host').get('value'));
-          }
-          Em.set(hostname, 'isUserProperty', false);
-          if (dbHost) {
-            dbHost.set('value', hostname.value);
-          }
-          returnValue = hostname;
-        } else {
-          returnValue = this.get('categoryConfigsAll').findProperty('name', 'db_host');
-        }
+    var host = this.getPropertyByType('host_name');
+    if (host && !host.get('value')) {
+      if (host.get('savedValue')) {
+        host.set('value', host.get('savedValue'));
+      } else if (host.get('recommendedValue')) {
+        host.set('value', host.get('recommendedValue'));
       }
     }
-    return returnValue;
+    return host;
   }.property('serviceConfig.serviceName', 'serviceConfig.value'),
 
-  hostName: function () {
-    this.set('ignoreRangerHostChange', !this.get('dbTypeChanged'));
-    this.set('dbTypeChanged', false);
-    return this.get('hostNameProperty.value');
-  }.property('hostNameProperty.value'),
-
-  connectionUrl: function () {
-    var connectionUrlConfig = {
-      'HIVE': 'javax.jdo.option.ConnectionURL',
-      'OOZIE':'oozie.service.JPAService.jdbc.url',
-      'RANGER': App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.url' : 'ranger_jdbc_connection_url'
-    };
-    return this.get('categoryConfigsAll').findProperty('name', connectionUrlConfig[this.get('serviceConfig.serviceName')]);
-  }.property('serviceConfig.serviceName', 'App.isHadoop23Stack'),
-
-  dbClass: function () {
-    var dbClassConfig = {
-      'HIVE': 'javax.jdo.option.ConnectionDriverName',
-      'OOZIE':'oozie.service.JPAService.jdbc.driver',
-      'RANGER': App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.driver' : 'ranger_jdbc_driver'
-    };
-    return this.get('categoryConfigsAll').findProperty('name', dbClassConfig[this.get('serviceConfig.serviceName')]);
-  }.property('serviceConfig.serviceName', 'App.isHadoop23Stack'),
+  /**
+   *
+   * @param propertyType
+   * @returns {*}
+   */
+  getDefaultPropertyValue: function(propertyType) {
+    var dbProperties = dbInfo.dpPropertiesMap[this.get('getDbTypeFromRadioValue')],
+      serviceName = this.get('serviceConfig.serviceName');
+    return dbProperties[serviceName] && dbProperties[serviceName][propertyType]
+      ? dbProperties[serviceName][propertyType] : dbProperties[propertyType];
+  },
+
+  /**
+   *
+   * @param propertyType
+   * @returns {*|Object}
+   */
+  getPropertyByType: function(propertyType) {
+    if (dbInfo.dpPropertiesByServiceMap[this.get('serviceConfig.serviceName')]) {
+      /** check if selected service has db properties**/
+      return this.get('categoryConfigsAll').findProperty('name', dbInfo.dpPropertiesByServiceMap[this.get('serviceConfig.serviceName')][propertyType]);
+    }
+    return null;
+  },
+
+  /**
+   * This method update <code>connection_url<code> property, using template described in <code>dpPropertiesMap<code>
+   * and sets hostName as dbName in appropriate position of <code>connection_url<code> string
+   * @param {String} hostName
+   * @param {String} dbName
+   * @method setConnectionUrl
+   */
+  setConnectionUrl: function(hostName, dbName) {
+    var connectionUrlProperty = this.getPropertyByType('connection_url');
+    var connectionUrlTemplate = this.getDefaultPropertyValue('connection_url');
+    try {
+      var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName);
+      connectionUrlProperty.set('value', connectionUrlValue);
+      connectionUrlProperty.set('recommendedValue', connectionUrlValue);
+    } catch(e) {
+      console.error('connection url property or connection url template is missing');
+    }
+    return connectionUrlProperty;
+  },
+
+  /**
+   * This method sets recommended values for properties <code>propertiesToUpdate<code> when radio button is changed
+   * @param {String[]} propertiesToUpdate - contains type of properties that should be updated;
+   * @method setRequiredProperties
+   * @returns App.ServiceConfigProperty[]
+   */
+  setRequiredProperties: function (propertiesToUpdate) {
+    propertiesToUpdate.forEach(function(pType) {
+      var property = this.getPropertyByType(pType);
+      var value = this.getDefaultPropertyValue(pType);
+      if (property && value) {
+        property.set('value', value);
+        property.set('recommendedValue', value);
+      }
+    }, this);
+  },
+
+  /**
+   * This method hides properties <code>user_name<code> and <code>password<code> in case selected db is
+   * "Existing MSSQL Server database with integrated authentication" or similar
+   * @method handleSpecialUserPassProperties
+   */
+  handleSpecialUserPassProperties: function() {
+    ['user_name', 'password'].forEach(function(pType) {
+      var property = this.getPropertyByType(pType);
+      if (property) {
+        property.setProperties({
+          'isVisible': !this.get('inMSSQLWithIA'),
+          'isRequired': !this.get('inMSSQLWithIA')
+        });
+      }
+    }, this);
+  },
 
   /**
    * `Observer` that add <code>additionalView</code> to <code>App.ServiceConfigProperty</code>
@@ -775,9 +632,9 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     }
     var handledProperties = ['oozie_database', 'hive_database', 'DB_FLAVOR'];
     var currentValue = this.get('serviceConfig.value');
-    var databases = /MySQL|PostgreSQL|Postgres|Oracle|Derby|MSSQL/gi;
+    var databases = /MySQL|PostgreSQL|Postgres|Oracle|Derby|MSSQL|SQLA/gi;
     var currentDB = currentValue.match(databases)[0];
-    var databasesTypes = /MySQL|Postgres|Oracle|Derby|MSSQL/gi;
+    var databasesTypes = /MySQL|Postgres|Oracle|Derby|MSSQL|SQLA/gi;
     var currentDBType = currentValue.match(databasesTypes)[0];
     var checkDatabase = /existing/gi.test(currentValue);
     // db connection check button show up if existed db selected
@@ -1249,9 +1106,9 @@ App.CheckDBConnectionView = Ember.View.extend({
   /** @property {String} masterHostName - host name location of Master Component related to Service **/
   masterHostName: function() {
     var serviceMasterMap = {
-      'OOZIE': 'oozie_ambari_host',
+      'OOZIE': 'oozie_hostname',
       'HDFS': 'hadoop_host',
-      'HIVE': 'hive_ambari_host',
+      'HIVE': 'hive_hostname',
       'KERBEROS': 'kdc_host',
       'RANGER': 'rangerserver_host'
     };
@@ -1266,7 +1123,7 @@ App.CheckDBConnectionView = Ember.View.extend({
 
     if (this.get('parentView.service.serviceName') === 'RANGER') {
       var dbFlavor = this.get('parentView.categoryConfigsAll').findProperty('name','DB_FLAVOR').get('value'),
-        databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
+        databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL|SQLA/gi,
         dbType = dbFlavor.match(databasesTypes)?dbFlavor.match(databasesTypes)[0].toLowerCase():'';
 
       if (dbType==='oracle') {

+ 0 - 1
ambari-web/test/utils/config_test.js

@@ -1259,7 +1259,6 @@ describe('App.config', function () {
       id: 'site property',
       isRequiredByAgent:  true,
       isReconfigurable: true,
-      isObserved: false,
       unit: null,
       hasInitialValue: false,
       isOverridable: true,

+ 37 - 593
ambari-web/test/views/common/controls_view_test.js

@@ -22,617 +22,61 @@ var validator = require('utils/validator');
 
 describe('App.ServiceConfigRadioButtons', function () {
 
-  describe('#didInsertElement', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        categoryConfigsAll: [],
-        controller: Em.Object.create({
-          wizardController: Em.Object.create({})
-        }),
-        serviceConfig: Em.Object.create({
-          value: null
-        })
-      }),
-      cases = [
-        {
-          wizardControllerName: 'addServiceController',
-          serviceConfigValue: 'New MySQL Database',
-          onOptionsChangeCalledTwice: true,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Add Service Wizard, New MySQL Database'
-        },
-        {
-          wizardControllerName: 'addServiceController',
-          serviceConfigValue: 'Existing MySQL Database',
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: true,
-          title: 'Add Service Wizard, Existing MySQL Database'
-        },
-        {
-          wizardControllerName: 'installerController',
-          serviceConfigValue: 'New MySQL Database',
-          onOptionsChangeCalledTwice: true,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Install Wizard, New MySQL Database'
-        },
-        {
-          wizardControllerName: 'installerController',
-          serviceConfigValue: 'Existing MySQL Database',
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: true,
-          title: 'Install Wizard, Existing MySQL Database'
-        },
-        {
-          wizardControllerName: null,
-          serviceConfigValue: null,
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Service Configs Page'
-        }
-      ];
-
-    beforeEach(function () {
-      sinon.stub(view, 'onOptionsChange', Em.K);
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-    });
-
-    afterEach(function () {
-      view.onOptionsChange.restore();
-      view.handleDBConnectionProperty.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.title, function () {
-        view.set('controller.wizardController.name', item.wizardControllerName);
-        view.set('serviceConfig.value', item.serviceConfigValue);
-        view.didInsertElement();
-        expect(view.onOptionsChange.calledTwice).to.equal(item.onOptionsChangeCalledTwice);
-        expect(view.handleDBConnectionProperty.calledTwice).to.equal(item.handleDBConnectionPropertyCalledTwice);
+  describe('#setConnectionUrl', function() {
+    var view = App.ServiceConfigRadioButtons.create();
+    beforeEach(function() {
+      sinon.stub(view, 'getPropertyByType', function(name) {
+        return App.ServiceConfigProperty.create({'name': name});
       });
-    });
-
-  });
-
-  describe('#databaseNameProperty', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          {
-            name: 'ambari.hive.db.schema.name',
-            value: 'db0'
-          },
-          {
-            name: 'oozie.db.schema.name',
-            value: 'db1'
-          },
-          {
-            name: 'db_name',
-            value: 'db2'
-          }
-        ]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          value: 'db0'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'db1'
-        },
-        {
-          serviceName: 'RANGER',
-          value: 'db2'
-        }
-      ];
-
-    cases.forEach(function (item) {
-      it(item.serviceName, function () {
-        view.set('serviceConfig.serviceName', item.serviceName);
-        expect(view.get('databaseNameProperty.value')).to.equal(item.value);
-        expect(view.get('databaseName')).to.equal(item.value);
+      sinon.stub(view, 'getDefaultPropertyValue', function() {
+        return 'host:{0},db:{1}';
       });
     });
 
-    it('default case', function () {
-      view.set('serviceConfig.serviceName', 'YARN');
-      expect(view.get('databaseNameProperty')).to.be.null;
-      expect(view.get('databaseName')).to.be.null;
-    });
-
-  });
-
-  describe('#hostNameProperty', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          {
-            name: 'hive_ambari_host',
-            value: 'h0'
-          },
-          {
-            name: 'hive_existing_mysql_host',
-            value: 'h1'
-          },
-          {
-            name: 'hive_existing_postgresql_host',
-            value: 'h2'
-          },
-          {
-            name: 'hive_existing_oracle_host',
-            value: 'h3'
-          },
-          {
-            name: 'hive_existing_mssql_server_host',
-            value: 'h4'
-          },
-          {
-            name: 'hive_existing_mssql_server_2_host',
-            value: 'h5'
-          },
-          {
-            name: 'hive_hostname',
-            value: 'h6'
-          },
-          {
-            name: 'oozie_ambari_host',
-            value: 'h10'
-          },
-          {
-            name: 'oozie_existing_mysql_host',
-            value: 'h11'
-          },
-          {
-            name: 'oozie_existing_postgresql_host',
-            value: 'h12'
-          },
-          {
-            name: 'oozie_existing_oracle_host',
-            value: 'h13'
-          },
-          {
-            name: 'oozie_existing_mssql_server_host',
-            value: 'h14'
-          },
-          {
-            name: 'oozie_existing_mssql_server_2_host',
-            value: 'h15'
-          },
-          {
-            name: 'oozie_hostname',
-            value: 'h16'
-          },
-          {
-            name: 'ranger_mysql_host',
-            value: 'h17'
-          },
-          {
-            name: 'ranger_oracle_host',
-            value: 'h18'
-          },
-          {
-            name: 'ranger_postgres_host',
-            value: 'h19'
-          },
-          {
-            name: 'ranger_mssql_host',
-            value: 'h20'
-          },
-
-
-        ]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          value: 'New MySQL Database',
-          expected: 'h0'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MySQL Database',
-          expected: 'h1'
-        },
-        {
-          serviceName: 'HIVE',
-          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          expected: 'h2'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing Oracle Database',
-          expected: 'h3'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MSSQL Server database with SQL authentication',
-          expected: 'h4'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MSSQL Server database with integrated authentication',
-          expected: 'h5'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'default case',
-          expected: 'h6'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'New Derby Database',
-          expected: 'h10'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MySQL Database',
-          expected: 'h11'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          expected: 'h12'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing Oracle Database',
-          expected: 'h13'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MSSQL Server database with SQL authentication',
-          expected: 'h14'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MSSQL Server database with integrated authentication',
-          expected: 'h15'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'default case',
-          expected: 'h16'
-        },
-        {
-          serviceName: 'RANGER',
-          value: 'MYSQL',
-          expected: 'h17'
-        },
-        {
-          serviceName: 'RANGER',
-          value: 'ORACLE',
-          expected: 'h18'
-        },
-        {
-          serviceName: 'RANGER',
-          value: 'POSTGRES',
-          expected: 'h19'
-        },
-        {
-          serviceName: 'RANGER',
-          value: 'MSSQL',
-          expected: 'h20'
-        }
-      ];
-
-    before(function () {
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-    });
-
-    after(function () {
-      view.handleDBConnectionProperty.restore();
+    afterEach(function() {
+      view.getPropertyByType.restore();
+      view.getDefaultPropertyValue.restore();
     });
 
-    cases.forEach(function (item) {
-      it(item.serviceName + ', ' + item.value, function () {
-        view.get('serviceConfig').setProperties({
-          serviceName: item.serviceName,
-          value: item.value
-        });
-        expect(view.get('hostNameProperty.value')).to.equal(item.expected);
-        expect(view.get('hostName')).to.equal(item.expected);
-      });
+    it('updates value for connection url', function() {
+      expect(view.setConnectionUrl('hostName','dbName').get('value')).to.equal('host:hostName,db:dbName');
     });
-
   });
 
-  describe('#onOptionsChange', function () {
-
+  describe('#setRequiredProperties', function() {
     var view = App.ServiceConfigRadioButtons.create({
-        hostName: null,
-        databaseName: null,
-        hostNameProperty: null,
-        databaseNameProperty: null,
-        connectionUrl: Em.Object.create(),
-        dbClass: Em.Object.create(),
         serviceConfig: Em.Object.create(),
         categoryConfigsAll: [
-          Em.Object.create({
-            name: 'javax.jdo.option.ConnectionUserName'
-          }),
-          Em.Object.create({
-            name: 'javax.jdo.option.ConnectionPassword'
-          }),
-          Em.Object.create({
-            name: 'oozie.service.JPAService.jdbc.username'
+          App.ServiceConfigProperty.create({
+            name: 'p1',
+            value: 'v1'
           }),
-          Em.Object.create({
-            name: 'oozie.service.JPAService.jdbc.password'
-          }),
-          Em.Object.create({
-            name: 'db_host'
-          }),
-          Em.Object.create({
-            name: 'SQL_COMMAND_INVOKER'
+          App.ServiceConfigProperty.create({
+            name: 'p2',
+            value: 'v2'
           })
-        ],
-        parentView: Em.Object.create({
-          serviceConfigs: [
-            {
-              name: 'hive_database_type',
-              value: null
-            },
-            Em.Object.create({
-              name: 'SQL_CONNECTOR_JAR',
-              value: null
-            })
-          ]
-        }),
-        configs: [{}]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'New MySQL Database',
-          databaseName: 'db0',
-          hostName: 'h0',
-          databaseNameDefault: 'db0d',
-          hostNameDefault: 'h0d',
-          connectionUrlValue: 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true',
-          connectionUrlDefaultValue: 'jdbc:mysql://h0d/db0d?createDatabaseIfNotExist=true',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mysql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          databaseName: 'db1',
-          hostName: 'h1',
-          databaseNameDefault: 'db1d',
-          hostNameDefault: 'h1d',
-          connectionUrlValue: 'jdbc:postgresql://h1:5432/db1',
-          connectionUrlDefaultValue: 'jdbc:postgresql://h1d:5432/db1d',
-          dbClassValue: 'org.postgresql.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'postgres'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MySQL Database',
-          databaseName: 'db2',
-          hostName: 'h2',
-          databaseNameDefault: 'db2d',
-          hostNameDefault: 'h2d',
-          connectionUrlValue: 'jdbc:mysql://h2/db2?createDatabaseIfNotExist=true',
-          connectionUrlDefaultValue: 'jdbc:mysql://h2d/db2d?createDatabaseIfNotExist=true',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mysql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
-          databaseName: 'db3',
-          hostName: 'h3',
-          databaseNameDefault: 'db3d',
-          hostNameDefault: 'h3d',
-          connectionUrlValue: 'jdbc:sqlserver://h3;databaseName=db3',
-          connectionUrlDefaultValue: 'jdbc:sqlserver://h3d;databaseName=db3d',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mssql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing Oracle Database',
-          databaseName: 'db4',
-          hostName: 'h4',
-          databaseNameDefault: 'db4d',
-          hostNameDefault: 'h4d',
-          connectionUrlValue: 'jdbc:oracle:thin:@//h4:1521/db4',
-          connectionUrlDefaultValue: 'jdbc:oracle:thin:@//h4d:1521/db4d',
-          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'oracle'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
-          databaseName: 'db5',
-          hostName: 'h5',
-          databaseNameDefault: 'db5d',
-          hostNameDefault: 'h5d',
-          connectionUrlValue: 'jdbc:sqlserver://h5;databaseName=db5;integratedSecurity=true',
-          connectionUrlDefaultValue: 'jdbc:sqlserver://h5d;databaseName=db5d;integratedSecurity=true',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: false,
-          hiveDbTypeValue: 'mssql'
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'New Derby Database',
-          databaseName: 'db6',
-          hostName: 'h6',
-          databaseNameDefault: 'db6d',
-          hostNameDefault: 'h6d',
-          connectionUrlValue: 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
-          connectionUrlDefaultValue: 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
-          dbClassValue: 'org.apache.derby.jdbc.EmbeddedDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MySQL Database',
-          databaseName: 'db7',
-          hostName: 'h7',
-          databaseNameDefault: 'db7d',
-          hostNameDefault: 'h7d',
-          connectionUrlValue: 'jdbc:mysql://h7/db7',
-          connectionUrlDefaultValue: 'jdbc:mysql://h7/db7',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          databaseName: 'db8',
-          hostName: 'h8',
-          databaseNameDefault: 'db8d',
-          hostNameDefault: 'h8d',
-          connectionUrlValue: 'jdbc:postgresql://h8:5432/db8',
-          connectionUrlDefaultValue: 'jdbc:postgresql://h8:5432/db8',
-          dbClassValue: 'org.postgresql.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
-          databaseName: 'db9',
-          hostName: 'h9',
-          databaseNameDefault: 'db9d',
-          hostNameDefault: 'h9d',
-          connectionUrlValue: 'jdbc:sqlserver://h9;databaseName=db9',
-          connectionUrlDefaultValue: 'jdbc:sqlserver://h9;databaseName=db9',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing Oracle Database',
-          databaseName: 'db10',
-          hostName: 'h10',
-          databaseNameDefault: 'db10d',
-          hostNameDefault: 'h10d',
-          connectionUrlValue: 'jdbc:oracle:thin:@//h10:1521/db10',
-          connectionUrlDefaultValue: 'jdbc:oracle:thin:@//h10:1521/db10',
-          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
-          databaseName: 'db11',
-          hostName: 'h11',
-          databaseNameDefault: 'db11d',
-          hostNameDefault: 'h11d',
-          connectionUrlValue: 'jdbc:sqlserver://h11;databaseName=db11;integratedSecurity=true',
-          connectionUrlDefaultValue: 'jdbc:sqlserver://h11;databaseName=db11;integratedSecurity=true',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: false
-        },
-
-
-        {
-          serviceName: 'RANGER',
-          serviceConfigValue: 'MYSQL',
-          databaseName: 'db12',
-          hostName: 'h12',
-          databaseNameDefault: 'db12d',
-          hostNameDefault: 'h12d',
-          connectionUrlValue: 'jdbc:mysql://h12/db12',
-          connectionUrlDefaultValue: 'jdbc:mysql://h12/db12',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'RANGER',
-          serviceConfigValue: 'ORACLE',
-          databaseName: 'db13',
-          hostName: 'h13',
-          databaseNameDefault: 'db13d',
-          hostNameDefault: 'h13d',
-          connectionUrlValue: 'jdbc:oracle:thin:@//h13:1521/db13',
-          connectionUrlDefaultValue: 'jdbc:oracle:thin:@//h13:1521/db13',
-          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'RANGER',
-          serviceConfigValue: 'POSTGRES',
-          databaseName: 'db14',
-          hostName: 'h14',
-          databaseNameDefault: 'db14d',
-          hostNameDefault: 'h14d',
-          connectionUrlValue: 'jdbc:postgresql://h14:5432/db14',
-          connectionUrlDefaultValue: 'jdbc:postgresql://h14:5432/db14',
-          dbClassValue: 'org.postgresql.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'RANGER',
-          serviceConfigValue: 'MSSQL',
-          databaseName: 'db15',
-          hostName: 'h15',
-          databaseNameDefault: 'db15d',
-          hostNameDefault: 'h15d',
-          connectionUrlValue: 'jdbc:sqlserver://h15;databaseName=db15',
-          connectionUrlDefaultValue: 'jdbc:sqlserver://h15;databaseName=db15',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: true
-        }
-      ],
-      serviceAuthPropsMap = {
-        HIVE: ['javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword'],
-        OOZIE: ['oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password'],
-        RANGER: []
-      };
+        ]
+      });
 
-    beforeEach(function () {
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-      sinon.stub(App.Service, 'find').returns([
-        {
-          serviceName: 'HIVE'
-        }
-      ]);
+    beforeEach(function() {
+      sinon.stub(view, 'getPropertyByType', function(name) {
+        return view.get('categoryConfigsAll').findProperty('name', name);
+      });
+      sinon.stub(view, 'getDefaultPropertyValue', function(name) {
+        return name + '_v';
+      });
     });
 
-    afterEach(function () {
-      view.handleDBConnectionProperty.restore();
-      App.Service.find.restore();
+    afterEach(function() {
+      view.getPropertyByType.restore();
+      view.getDefaultPropertyValue.restore();
     });
 
-    cases.forEach(function (item) {
-      it(item.serviceName + ', ' + item.serviceConfigValue, function () {
-        view.get('serviceConfig').setProperties({
-          serviceName: item.serviceName,
-          value: item.serviceConfigValue
-        });
-        view.setProperties({
-          databaseName: item.databaseName,
-          hostName: item.hostName,
-          databaseNameProperty: Em.Object.create({
-            recommendedValue: item.databaseNameDefault
-          }),
-          hostNameProperty: Em.Object.create({
-            recommendedValue: item.hostNameDefault
-          })
-        });
-        expect(view.get('connectionUrl.value')).to.equal(item.connectionUrlValue);
-        expect(view.get('connectionUrl.recommendedValue')).to.equal(item.connectionUrlDefaultValue);
-        expect(view.get('dbClass.value')).to.equal(item.dbClassValue);
-        serviceAuthPropsMap[item.serviceName].forEach(function (propName) {
-          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isVisible')).to.equal(item.isAuthVisibleAndRequired);
-          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isRequired')).to.equal(item.isAuthVisibleAndRequired);
-        });
-        if (item.serviceName == 'HIVE') {
-          expect(view.get('parentView.serviceConfigs').findProperty('name', 'hive_database_type').value).to.equal(item.hiveDbTypeValue);
-        }
-      });
+    it('updates value for connection url', function() {
+      view.setRequiredProperties(['p2','p1']);
+      expect(view.get('categoryConfigsAll').findProperty('name', 'p1').get('value')).to.equal('p1_v');
+      expect(view.get('categoryConfigsAll').findProperty('name', 'p2').get('value')).to.equal('p2_v');
     });
-
   });
 
   describe('#handleDBConnectionProperty', function () {
@@ -920,7 +364,7 @@ describe('App.CheckDBConnectionView', function () {
       ],
       categoryConfigsAll = [
         Em.Object.create({
-          name: 'oozie_ambari_host',
+          name: 'oozie_hostname',
           value: 'h0'
         }),
         Em.Object.create({
@@ -928,7 +372,7 @@ describe('App.CheckDBConnectionView', function () {
           value: 'h1'
         }),
         Em.Object.create({
-          name: 'hive_ambari_host',
+          name: 'hive_hostname',
           value: 'h2'
         }),
         Em.Object.create({