AMBARI-22445. Warn the user appropriately for default MySQL server install for Hive (Part 2) (vsubramanian)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5caac19d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5caac19d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5caac19d Branch: refs/heads/branch-feature-AMBARI-21674 Commit: 5caac19def93748874f50661aabd87f5135d2a0f Parents: 47be7ed Author: Vivek Ratnavel Subramanian <[email protected]> Authored: Fri Dec 1 16:34:33 2017 -0800 Committer: Vivek Ratnavel Subramanian <[email protected]> Committed: Fri Dec 1 16:34:33 2017 -0800 ---------------------------------------------------------------------- ambari-web/app/data/db_properties_info.js | 15 +++++-- ambari-web/app/messages.js | 3 ++ ambari-web/app/views/common/controls_view.js | 5 ++- .../test/views/common/controls_view_test.js | 46 ++++++++------------ 4 files changed, 36 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5caac19d/ambari-web/app/data/db_properties_info.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/db_properties_info.js b/ambari-web/app/data/db_properties_info.js index 6d93c2a..3b4b856 100644 --- a/ambari-web/app/data/db_properties_info.js +++ b/ambari-web/app/data/db_properties_info.js @@ -68,19 +68,28 @@ module.exports = { }, 'driver': 'com.mysql.jdbc.Driver', 'sql_jar_connector': '/usr/share/java/mysql-connector-java.jar', - 'db_type': 'mysql' + 'db_type': 'mysql', + 'db_name': 'MySQL', + 'driver_download_url': 'https://dev.mysql.com/downloads/connector/j/', + 'driver_name': 'MySQL Connector/J JDBC Driver' }, 'POSTGRES': { 'connection_url': 'jdbc:postgresql://{0}:5432/{1}', 'driver': 'org.postgresql.Driver', 'sql_jar_connector': '/usr/share/java/postgresql.jar', - 'db_type': 'postgres' + 'db_type': 'postgres', + 'db_name': 'PostgreSQL', + 'driver_download_url': 'https://jdbc.postgresql.org/', + 'driver_name': 'PostgreSQL JDBC Driver' }, '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' + 'db_type': 'oracle', + 'db_name': 'Oracle', + 'driver_download_url': 'http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html', + 'driver_name': 'Oracle JDBC Driver' }, 'MSSQL': { 'connection_url': 'jdbc:sqlserver://{0};databaseName={1}', http://git-wip-us.apache.org/repos/asf/ambari/blob/5caac19d/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index b294877..06deecb 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -2262,6 +2262,9 @@ Em.I18n.translations = { 'services.service.config.configHistory.makeCurrent.message': 'Created from service config version {0}', 'services.service.config.configHistory.comparing': 'Comparing', 'services.service.config.setRecommendedValue': 'Set Recommended', + 'services.service.config.database.msg.jdbcSetup.detailed': 'To use {0} with Hive, you must <a href="{3}" target="_blank">' + + 'download the {4} from {0}</a>. Once downloaded to the Ambari Server host, run: <br/>' + + '<b>ambari-server setup --jdbc-db={1} --jdbc-driver=/path/to/{1}/{2}</b>', 'services.service.widgets.list-widget.nothingSelected': 'Nothing selected', http://git-wip-us.apache.org/repos/asf/ambari/blob/5caac19d/ambari-web/app/views/common/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js index 63d08ce..747d96c 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -762,11 +762,14 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId, var shouldAdditionalViewsBeSet = currentDB && checkDatabase && handledProperties.contains(this.get('serviceConfig.name')), driver = this.getDefaultPropertyValue('sql_jar_connector') ? this.getDefaultPropertyValue('sql_jar_connector').split("/").pop() : 'driver.jar', dbType = this.getDefaultPropertyValue('db_type'), + dbName = this.getDefaultPropertyValue('db_name'), + driverName = this.getDefaultPropertyValue('driver_name'), + driverDownloadUrl = this.getDefaultPropertyValue('driver_download_url'), additionalView1 = shouldAdditionalViewsBeSet && !this.get('isNewDb') ? App.CheckDBConnectionView.extend({databaseName: dbType}) : null, additionalView2 = shouldAdditionalViewsBeSet ? Ember.View.extend({ template: Ember.Handlebars.compile('<div class="alert alert-warning">{{{view.message}}}</div>'), message: function() { - return Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(dbType, driver); + return Em.I18n.t('services.service.config.database.msg.jdbcSetup.detailed').format(dbName, dbType, driver, driverDownloadUrl, driverName); }.property() }) : null; if (propertyAppendTo1) { http://git-wip-us.apache.org/repos/asf/ambari/blob/5caac19d/ambari-web/test/views/common/controls_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js index 76742fa..b6f19ef 100644 --- a/ambari-web/test/views/common/controls_view_test.js +++ b/ambari-web/test/views/common/controls_view_test.js @@ -35,6 +35,9 @@ describe('App.ServiceConfigRadioButtons', function () { { dbType: 'mysql', driver: 'mysql-connector-java.jar', + dbName: 'MySQL', + downloadUrl: 'https://dev.mysql.com/downloads/connector/j/', + driverName: 'MySQL Connector/J JDBC Driver', serviceConfig: { name: 'hive_database', value: 'New MySQL Database', @@ -65,6 +68,9 @@ describe('App.ServiceConfigRadioButtons', function () { { dbType: 'postgres', driver: 'postgresql.jar', + dbName: 'PostgreSQL', + downloadUrl: 'https://jdbc.postgresql.org/', + driverName: 'PostgreSQL JDBC Driver', serviceConfig: { name: 'hive_database', value: 'Existing PostgreSQL Database', @@ -95,6 +101,9 @@ describe('App.ServiceConfigRadioButtons', function () { { dbType: 'derby', driver: 'driver.jar', + dbName: 'Derby', + downloadUrl: 'http://', + driverName: 'Derby JDBC Driver', serviceConfig: { name: 'oozie_database', value: 'New Derby Database', @@ -125,6 +134,9 @@ describe('App.ServiceConfigRadioButtons', function () { { dbType: 'oracle', driver: 'ojdbc6.jar', + dbName: 'Oracle', + downloadUrl: 'http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html', + driverName: 'Oracle JDBC Driver', serviceConfig: { name: 'oozie_database', value: 'Existing Oracle Database', @@ -155,6 +167,9 @@ describe('App.ServiceConfigRadioButtons', function () { { dbType: 'mysql', driver: 'mysql-connector-java.jar', + dbName: 'MySQL', + downloadUrl: 'https://dev.mysql.com/downloads/connector/j/', + driverName: 'MySQL Connector/J JDBC Driver', serviceConfig: { name: 'DB_FLAVOR', value: 'MYSQL', @@ -179,34 +194,6 @@ describe('App.ServiceConfigRadioButtons', function () { isAdditionalView1Null: true, isAdditionalView2Null: true, title: 'Ranger, HDP 2.2, external database' - }, - { - dbType: 'mssql', - driver: 'sqljdbc4.jar', - serviceConfig: { - name: 'DB_FLAVOR', - value: 'MSSQL', - serviceName: 'RANGER' - }, - controller: Em.Object.create({ - selectedService: { - configs: [ - Em.Object.create({ - name: 'ranger.jpa.jdbc.url' - }), - Em.Object.create({ - name: 'DB_FLAVOR' - }) - ] - } - }), - currentStackVersion: 'HDP-2.3', - rangerVersion: '0.5.0', - propertyAppendTo1: 'ranger.jpa.jdbc.url', - propertyAppendTo2: 'DB_FLAVOR', - isAdditionalView1Null: false, - isAdditionalView2Null: false, - title: 'Ranger, HDP 2.3, external database' } ]; var rangerVersion = ''; @@ -266,7 +253,8 @@ describe('App.ServiceConfigRadioButtons', function () { if (!item.isAdditionalView2Null) { it('additionalView2.message is valid', function () { - expect(additionalView2.create().get('message')).to.equal(Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(item.dbType, item.driver)); + var message = Em.I18n.t('services.service.config.database.msg.jdbcSetup.detailed').format(item.dbName, item.dbType, item.driver, item.downloadUrl, item.driverName); + expect(additionalView2.create().get('message')).to.equal(message); }); }
