ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-12830 SQLA: UI fixes for oozie SQLA db. (ababiichuk)
Date Thu, 20 Aug 2015 13:27:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0562c9c7d -> 98727e22c


AMBARI-12830 SQLA: UI fixes for oozie SQLA db. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 98727e22cf9074e82c2f1d6df35e7b5919d92f23
Parents: 0562c9c
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu Aug 20 16:23:53 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu Aug 20 16:27:04 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step8_controller.js  |  92 +++-----------
 ambari-web/app/data/db_properties_info.js       |  10 +-
 ambari-web/app/messages.js                      |   2 +-
 ambari-web/app/views/common/controls_view.js    |  30 ++++-
 .../test/controllers/wizard/step8_test.js       | 124 -------------------
 .../test/views/common/controls_view_test.js     |   8 +-
 6 files changed, 53 insertions(+), 213 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 5b89e7a..04fa34f 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -611,46 +611,25 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
         hostsCount + ' ' + Em.I18n.t('installer.step8.hosts'));
   },
 
+  loadHiveDbValue: function() {
+    return this.loadDbValue('HIVE');
+  },
+
+  loadOozieDbValue: function() {
+    return this.loadDbValue('OOZIE');
+  },
+
   /**
    * Set displayed Hive DB value based on DB type
    * @method loadHiveDbValue
    */
-  loadHiveDbValue: function () {
-    var db, serviceConfigProperties = this.get('wizardController').getDBProperty('serviceConfigProperties'),
-      hiveDb = serviceConfigProperties.findProperty('name', 'hive_database');
-    if (hiveDb.value === 'New MySQL Database') {
-      return 'MySQL (New Database)';
-    } else if (hiveDb.value === 'New PostgreSQL Database') {
-      return 'Postgres (New Database)';
-    }
-    else {
-      if (hiveDb.value === 'Existing MySQL Database') {
-        db = serviceConfigProperties.findProperty('name', 'hive_existing_mysql_database');
-        return db.value + ' (' + hiveDb.value + ')';
-      }
-      else {
-        if (hiveDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql'))
{
-          db = serviceConfigProperties.findProperty('name', 'hive_existing_postgresql_database');
-          return db.value + ' (' + hiveDb.value + ')';
-        }
-        else {
-          if (hiveDb.value === 'Existing MSSQL Server database with SQL authentication')
{
-            db = serviceConfigProperties.findProperty('name', 'hive_existing_mssql_server_database');
-            return db.value + ' (' + hiveDb.value + ')';
-          }
-          else {
-            if (hiveDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-              db = serviceConfigProperties.findProperty('name', 'hive_existing_mssql_server_2_database');
-              return db.value + ' (' + hiveDb.value + ')';
-            }
-            else {
-              // existing oracle database
-              db = serviceConfigProperties.findProperty('name', 'hive_existing_oracle_database');
-              return db.value + ' (' + hiveDb.value + ')';
-            }
-          }
-        }
-      }
+  loadDbValue: function (serviceName) {
+    var dbFull = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
serviceName.toLowerCase() + '_database'),
+      db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
serviceName.toLowerCase() + '_ambari_database');
+    if (db && dbFull) {
+      return db.value + ' (' + dbFull.value + ')';
+    } else {
+      return '';
     }
   },
 
@@ -685,47 +664,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
   },
 
   /**
-   * Set displayed Oozie DB value based on DB type
-   * @method loadOozieDbValue
-   */
-  loadOozieDbValue: function () {
-    var db, oozieDb = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_database');
-    if (oozieDb.value === 'New Derby Database') {
-      db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_derby_database');
-      return db.value + ' (' + oozieDb.value + ')';
-    }
-    else {
-      if (oozieDb.value === 'Existing MySQL Database') {
-        db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_existing_mysql_database');
-        return db.value + ' (' + oozieDb.value + ')';
-      }
-      else {
-        if (oozieDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql'))
{
-          db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_existing_postgresql_database');
-          return db.value + ' (' + oozieDb.value + ')';
-        }
-        else {
-          if (oozieDb.value === 'Existing MSSQL Server database with SQL authentication')
{
-            db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_existing_mssql_server_database');
-            return db.value + ' (' + oozieDb.value + ')';
-          }
-          else {
-            if (oozieDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-              db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_existing_mssql_server_2_database');
-              return db.value + ' (' + oozieDb.value + ')';
-            }
-            else {
-              // existing oracle database
-              db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name',
'oozie_existing_oracle_database');
-              return db.value + ' (' + oozieDb.value + ')';
-            }
-          }
-        }
-      }
-    }
-  },
-
-  /**
    * Onclick handler for <code>next</code> button
    * @method submit
    * @return {void}

http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/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 dd5bfd8..7906648 100644
--- a/ambari-web/app/data/db_properties_info.js
+++ b/ambari-web/app/data/db_properties_info.js
@@ -103,16 +103,16 @@ module.exports = {
       'db_type': 'mssql'
     },
     'MSSQL2': {
-      'connection_url': 'jdbc:sqlserver://{0};databaseName={1}',
+      'connection_url': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
       'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-      'sql_jar_connector': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
+      'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
       'db_type': 'mssql'
     },
     'SQLA': {
-      'connection_url': 'jdbc:sqlanywhere:database={1};host={0}',
+      'connection_url': 'jdbc:sqlanywhere:uid={2};pwd={3};database={1};host={0}',
       'driver': 'sap.jdbc4.sqlanywhere.IDriver',
-      'sql_jar_connector': '/path_to_driver/sajdbc4.jar',
-      'db_type': 'sqla'
+      'sql_jar_connector': '/path_to_driver/sqla-client-jdbc.tar.gz',
+      'db_type': 'sqlanywhere'
     },
     'DERBY': {
       'connection_url': 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',

http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 47aa21f..53156d0 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1772,7 +1772,7 @@ Em.I18n.translations = {
   'services.service.config.kdc.btn.idle': 'Test KDC Connection',
   'services.service.config.database.btn.connecting': 'Connecting...',
   'services.service.config.database.msg.jdbcSetup': 'Be sure you have run:<br/>' +
-    '<b>ambari-server setup --jdbc-db={0} --jdbc-driver=/path/to/{1}/driver.jar</b>
' +
+    '<b>ambari-server setup --jdbc-db={0} --jdbc-driver=/path/to/{0}/{1}</b>
' +
     'on the Ambari Server host to make the JDBC driver available and to enable testing the
database connection.',
 
   'services.service.config.configHistory.configGroup': 'Config Group',

http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/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 84a98b5..d37b3af 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -508,10 +508,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
         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.setConnectionUrl(this.get('hostNameProperty.value'), this.get('databaseProperty.value'),
this.get('userProperty.value'), this.get('passwordProperty.value'));
       this.handleSpecialUserPassProperties();
     }
-  }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value'),
+  }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value', 'userProperty.value',
'passwordProperty.value'),
 
   nameBinding: 'serviceConfig.radioName',
 
@@ -540,6 +540,22 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   }.property('serviceConfig.serviceName', 'serviceConfig.value'),
 
   /**
+   * Just property object for database name
+   * @type {App.ServiceConfigProperty}
+   */
+  userProperty: function () {
+    return this.getPropertyByType('user_name');
+  }.property('serviceConfig.serviceName'),
+
+  /**
+   * Just property object for database name
+   * @type {App.ServiceConfigProperty}
+   */
+  passwordProperty: function () {
+    return this.getPropertyByType('password');
+  }.property('serviceConfig.serviceName'),
+
+  /**
    *
    * @param propertyType
    * @returns {*}
@@ -569,13 +585,15 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
    * and sets hostName as dbName in appropriate position of <code>connection_url<code>
string
    * @param {String} hostName
    * @param {String} dbName
+   * @param {String} user
+   * @param {String} password
    * @method setConnectionUrl
    */
-  setConnectionUrl: function(hostName, dbName) {
+  setConnectionUrl: function(hostName, dbName, user, password) {
     var connectionUrlProperty = this.getPropertyByType('connection_url');
     var connectionUrlTemplate = this.getDefaultPropertyValue('connection_url');
     try {
-      var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName);
+      var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName, user, password);
       connectionUrlProperty.set('value', connectionUrlValue);
       connectionUrlProperty.set('recommendedValue', connectionUrlValue);
     } catch(e) {
@@ -657,10 +675,12 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
       propertyAppendTo2.set('additionalView', null);
     }
     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'),
       additionalView1 = shouldAdditionalViewsBeSet ? App.CheckDBConnectionView.extend({databaseName:
currentDB}) : null,
       additionalView2 = shouldAdditionalViewsBeSet ? Ember.View.extend({
         template: Ember.Handlebars.compile('<div class="alert">{{{view.message}}}</div>'),
-        message: Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(currentDBType.toLowerCase(),
currentDBType.toLowerCase())
+        message: Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(dbType,
driver)
       }) : null;
     if (propertyAppendTo1) {
       Em.run.next(function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index bfe30b9..6d46dfe 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1281,79 +1281,6 @@ describe('App.WizardStep8Controller', function () {
     });
   });
 
-  describe('#loadHiveDbValue', function() {
-    beforeEach(function() {
-      installerStep8Controller.set('wizardController', Em.Object.create({
-        getDBProperty: Em.K
-      }));
-    });
-    Em.A([
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'New MySQL Database'}
-          ],
-          m: 'New MySQL Database',
-          e: 'MySQL (New Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'Existing MSSQL Server database with SQL authentication'},
-            {name: 'hive_existing_mssql_server_database', value: 'dbname'}
-          ],
-          m: 'Existing MSSQL Server database with SQL authentication',
-          e: 'dbname (Existing MSSQL Server database with SQL authentication)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'Existing MSSQL Server database with integrated
authentication'},
-            {name: 'hive_existing_mssql_server_2_database', value: 'dbname'}
-          ],
-          m: 'Existing MSSQL Server database with integrated authentication',
-          e: 'dbname (Existing MSSQL Server database with integrated authentication)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'New PostgreSQL Database'}
-          ],
-          m: 'New PostgreSQL Database',
-          e: 'Postgres (New Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'Existing MySQL Database'},
-            {name: 'hive_existing_mysql_database', value: 'dbname'}
-          ],
-          m: 'Existing MySQL Database',
-          e: 'dbname (Existing MySQL Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'Existing PostgreSQL Database'},
-            {name: 'hive_existing_postgresql_database', value: 'dbname'}
-          ],
-          m: 'Existing PostgreSQL Database',
-          e: 'dbname (Existing PostgreSQL Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'hive_database', value: 'Existing Oracle Database'},
-            {name: 'hive_existing_oracle_database', value: 'dbname'}
-          ],
-          m: 'Existing Oracle Database',
-          e: 'dbname (Existing Oracle Database)'
-        }
-      ]).forEach(function(test) {
-        it(test.m, function() {
-          sinon.stub(installerStep8Controller.get('wizardController'), 'getDBProperty', function()
{
-            return test.serviceConfigProperties;
-          });
-          var dbComponent = installerStep8Controller.loadHiveDbValue();
-          expect(dbComponent).to.equal(test.e);
-          installerStep8Controller.get('wizardController').getDBProperty.restore();
-        });
-      });
-  });
-
   describe('#loadHbaseMasterValue', function () {
     Em.A([
         {
@@ -1400,57 +1327,6 @@ describe('App.WizardStep8Controller', function () {
       });
   });
 
-  describe('#loadOozieDbValue', function() {
-    beforeEach(function() {
-      installerStep8Controller.set('wizardController', Em.Object.create({
-        getDBProperty: Em.K
-      }));
-    });
-    Em.A([
-        {
-          serviceConfigProperties: [
-            {name: 'oozie_database', value: 'New Derby Database'},
-            {name: 'oozie_derby_database', value: 'dbname'}
-          ],
-          m: 'New Derby Database',
-          e: 'dbname (New Derby Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'oozie_database', value: 'Existing MySQL Database'},
-            {name: 'oozie_existing_mysql_database', value: 'dbname'}
-          ],
-          m: 'Existing MySQL Database',
-          e: 'dbname (Existing MySQL Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'oozie_database', value: 'Existing PostgreSQL Database'},
-            {name: 'oozie_existing_postgresql_database', value: 'dbname'}
-          ],
-          m: 'Existing PostgreSQL Database',
-          e: 'dbname (Existing PostgreSQL Database)'
-        },
-        {
-          serviceConfigProperties: [
-            {name: 'oozie_database', value: 'Existing Oracle Database'},
-            {name: 'oozie_existing_oracle_database', value: 'dbname'}
-          ],
-          m: 'Existing Oracle Database',
-          e: 'dbname (Existing Oracle Database)'
-        }
-      ]).forEach(function(test) {
-        it(test.m, function() {
-          sinon.stub(installerStep8Controller.get('wizardController'), 'getDBProperty', function()
{
-            return test.serviceConfigProperties;
-          });
-          var dbComponent = installerStep8Controller.loadOozieDbValue();
-          expect(dbComponent).to.equal(test.e);
-          installerStep8Controller.get('wizardController').getDBProperty.restore();
-        });
-      });
-  });
-
   describe('#submit', function() {
     beforeEach(function() {
       sinon.stub(installerStep8Controller, 'submitProceed', Em.K);

http://git-wip-us.apache.org/repos/asf/ambari/blob/98727e22/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 82c05d4..6dd1185 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -85,6 +85,7 @@ describe('App.ServiceConfigRadioButtons', function () {
       cases = [
         {
           dbType: 'mysql',
+          driver: 'mysql-connector-java.jar',
           serviceConfig: {
             name: 'hive_database',
             value: 'New MySQL Database',
@@ -109,6 +110,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           dbType: 'postgres',
+          driver: 'postgresql.jar',
           serviceConfig: {
             name: 'hive_database',
             value: 'Existing PostgreSQL Database',
@@ -133,6 +135,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           dbType: 'derby',
+          driver: 'driver.jar',
           serviceConfig: {
             name: 'oozie_database',
             value: 'New Derby Database',
@@ -157,6 +160,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           dbType: 'oracle',
+          driver: 'ojdbc6.jar',
           serviceConfig: {
             name: 'oozie_database',
             value: 'Existing Oracle Database',
@@ -181,6 +185,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           dbType: 'mysql',
+          driver: 'mysql-connector-java.jar',
           serviceConfig: {
             name: 'DB_FLAVOR',
             value: 'MYSQL',
@@ -203,6 +208,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           dbType: 'mssql',
+          driver: 'sqljdbc4.jar',
           serviceConfig: {
             name: 'DB_FLAVOR',
             value: 'MSSQL',
@@ -255,7 +261,7 @@ describe('App.ServiceConfigRadioButtons', function () {
         expect(Em.isNone(additionalView1)).to.equal(item.isAdditionalView1Null);
         expect(Em.isNone(additionalView2)).to.equal(item.isAdditionalView2Null);
         if (!item.isAdditionalView2Null) {
-          expect(additionalView2.create().get('message')).to.equal(Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(item.dbType,
item.dbType));
+          expect(additionalView2.create().get('message')).to.equal(Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(item.dbType,
item.driver));
         }
       });
     });


Mime
View raw message