ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-12503. Display a warning if Oozie is configured with Derby as the db store (alexantonenko)
Date Wed, 22 Jul 2015 16:00:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b0a28fece -> 497eed3b2


AMBARI-12503. Display a warning if Oozie is configured with Derby as the db store (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 497eed3b214b23501d7ffe825096b1e56accd8e8
Parents: b0a28fe
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Jul 22 18:51:51 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Jul 22 19:00:24 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 59 ++++++++++++++++----
 ambari-web/app/messages.js                      |  1 +
 .../test/controllers/wizard/step7_test.js       | 43 ++++++++++++++
 3 files changed, 93 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/497eed3b/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 2a03670..2bf6b73 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -1376,6 +1376,37 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
       }
     });
   },
+
+  showOozieDerbyWarningPopup: function(callback) {
+    var self = this;
+    if (this.get('selectedServiceNames').contains('OOZIE')) {
+      var databaseType = Em.getWithDefault(this.findConfigProperty('oozie_database', 'oozie-env.xml'),
'value', '');
+      if (databaseType == Em.I18n.t('installer.step7.oozie.database.new')) {
+        return App.ModalPopup.show({
+          header: Em.I18n.t('common.warning'),
+          body: Em.I18n.t('installer.step7.popup.oozie.derby.warning'),
+          onPrimary: function() {
+            this.hide();
+            if (callback) {
+              callback();
+            }
+          },
+          onSecondary: function() {
+            self.set('submitButtonClicked', false);
+            this.hide();
+          },
+          onClose: function() {
+            this.onSecondary();
+          }
+        });
+      }
+    }
+    if (callback) {
+      callback();
+    }
+    return false;
+  },
+
   /**
    * Proceed to the next step
    **/
@@ -1394,25 +1425,33 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     }
     var self = this;
     this.set('submitButtonClicked', true);
-    this.serverSideValidation().done(function () {
-      self.checkDatabaseConnectionTest().done(function () {
-        self.resolveHiveMysqlDatabase();
-        self.set('submitButtonClicked', false);
-      });
-    }).fail(function (value) {
+    this.serverSideValidation().done(function() {
+      self.serverSideValidationCallback();
+    })
+    .fail(function (value) {
       if ("invalid_configs" == value) {
         self.set('submitButtonClicked', false);
       } else {
         // Failed due to validation mechanism failure.
         // Should proceed with other checks
-        self.checkDatabaseConnectionTest().done(function () {
-          self.resolveHiveMysqlDatabase();
-          self.set('submitButtonClicked', false);
-        });
+        self.serverSideValidationCallback();
       }
     });
   },
 
+  /**
+   * @method serverSideValidationCallback
+   */
+  serverSideValidationCallback: function() {
+    var self = this;
+    this.showOozieDerbyWarningPopup(function() {
+      self.checkDatabaseConnectionTest().done(function () {
+        self.resolveHiveMysqlDatabase();
+        self.set('submitButtonClicked', false);
+      });
+    });
+  },
+
   toggleIssuesFilter: function () {
     this.get('filterColumns').findProperty('attributeName', 'hasIssues').toggleProperty('selected');
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/497eed3b/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 56ad695..095df3a2 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -783,6 +783,7 @@ Em.I18n.translations = {
   'installer.step7.popup.validation.request.failed.body': 'Config validation failed.',
   'installer.step7.popup.validation.warning.header': 'Configurations',
   'installer.step7.popup.validation.warning.body': 'Some service configurations are not configured
properly. We recommend you review and change the highlighted configuration values. Are you
sure you want to proceed without correcting configurations?',
+  'installer.step7.popup.oozie.derby.warning': 'Derby is not recommended for production use.
With Derby, Oozie Server HA and concurrent connection support will not be available.',
   'installer.step7.oozie.database.new': 'New Derby Database',
   'installer.step7.hive.database.new.mysql': 'New MySQL Database',
   'installer.step7.hive.database.new.postgres': 'New PostgreSQL Database',

http://git-wip-us.apache.org/repos/asf/ambari/blob/497eed3b/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index e3d55a8..598a7e4 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2096,4 +2096,47 @@ describe('App.InstallerStep7Controller', function () {
     });
 
   });
+
+  describe('#showOozieDerbyWarning', function() {
+    var controller;
+    beforeEach(function() {
+      controller = App.WizardStep7Controller.create({});
+      sinon.stub(App.ModalPopup, 'show', Em.K);
+    });
+    afterEach(function() {
+      App.ModalPopup.show.restore();
+    });
+
+    Em.A([
+      {
+        selectedServiceNames: ['HDFS', 'OOZIE'],
+        databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
+        e: true,
+        m: 'Oozie selected with derby database, warning popup should be shown'
+      },
+      {
+        selectedServiceNames: ['HDFS'],
+        databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
+        e: false,
+        m: 'Oozie not selected warning popup should be skipped'
+      },
+      {
+        selectedServiceNames: ['HDFS', 'OOZIE'],
+        databaseType: 'New Mysql Database',
+        e: false,
+        m: 'Oozie selected, mysql database used, warning popup should be sk'
+      }
+    ]).forEach(function(test) {
+      it(test.m, function() {
+        var callback = sinon.spy();
+        sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
+        controller.reopen({
+          selectedServiceNames: test.selectedServiceNames
+        });
+        controller.showOozieDerbyWarningPopup(callback);
+        controller.findConfigProperty.restore();
+        expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
+      });
+    });
+  });
 });


Mime
View raw message