ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [37/50] [abbrv] ambari git commit: AMBARI-13940 Moving oozie fails at DB connection. (atkach)
Date Wed, 18 Nov 2015 16:51:33 GMT
AMBARI-13940 Moving oozie fails at DB connection. (atkach)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 31c99869f341dec5c9b7821dcd5c5a9247f27ada
Parents: 15ffc01
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Wed Nov 18 13:54:16 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Wed Nov 18 13:54:16 2015 +0200

----------------------------------------------------------------------
 .../main/service/reassign/step4_controller.js   |  4 +-
 ambari-web/app/views/common/controls_view.js    | 11 ++---
 .../service/reassign/step4_controller_test.js   | 42 ++++++++++++++++++++
 .../test/views/common/controls_view_test.js     | 27 +++++++++++++
 4 files changed, 77 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/31c99869/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index 9258c95..1263500 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -1145,7 +1145,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   prepareDBCheckAction: function() {
     var params = this.get('preparedDBProperties');
 
-    ambariProperties = App.router.get('clusterController.ambariProperties');
+    var ambariProperties = App.router.get('clusterController.ambariProperties');
 
     params['db_name'] = this.get('dbType');
     params['jdk_location'] = ambariProperties['jdk_location'];
@@ -1157,7 +1157,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     params['check_execute_list'] = "db_connection_check";
 
     App.ajax.send({
-      name: 'custom_action.create',
+      name: 'cluster.custom_action.create',
       sender: this,
       data: {
         requestInfo: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/31c99869/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 09ad31f..93acafa 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -1128,10 +1128,10 @@ App.CheckDBConnectionView = Ember.View.extend({
     this.set('isValidationPassed', isValid);
   }.observes('parentView.categoryConfigsAll.@each.isValid', 'parentView.categoryConfigsAll.@each.value',
'databaseName'),
 
-   getConnectionProperty: function(regexp, isGetName) {
-   var _this = this;
-      var propertyName = _this.get('requiredProperties').filter(function(item) {
-    return regexp.test(item);
+  getConnectionProperty: function (regexp, isGetName) {
+    var _this = this;
+    var propertyName = _this.get('requiredProperties').filter(function (item) {
+      return regexp.test(item);
     })[0];
     return (isGetName) ? propertyName : _this.get('parentView.categoryConfigsAll').findProperty('name',
propertyName).get('value');
   },
@@ -1245,9 +1245,10 @@ App.CheckDBConnectionView = Ember.View.extend({
    * @method createCustomAction
    **/
   createCustomAction: function() {
+    var isServiceInstalled = App.Service.find(this.get('parentView.service.serviceName')).get('isLoaded');
     var params = $.extend(true, {}, { db_name: this.get('databaseName').toLowerCase() },
this.get('connectionProperties'), this.get('ambariProperties'));
     App.ajax.send({
-      name: 'custom_action.create',
+      name: (isServiceInstalled) ? 'cluster.custom_action.create' : 'custom_action.create',
       sender: this,
       data: {
         requestInfo: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/31c99869/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index 42bf3db..d2b8054 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -1512,4 +1512,46 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
 
   });
 
+  describe("#prepareDBCheckAction()", function() {
+    beforeEach(function () {
+      sinon.stub(App.router, 'get').returns({
+        'jdk_location': 'jdk_location',
+        'jdk.name': 'jdk.name',
+        'java.home': 'java.home'
+      });
+      sinon.stub(controller, 'getConnectionProperty').returns('prop1');
+    });
+    afterEach(function () {
+      App.router.get.restore();
+      controller.getConnectionProperty.restore();
+    });
+    it("", function () {
+      controller.set('content.reassignHosts', Em.Object.create({target: 'host1'}));
+      controller.reopen({
+        dbType: 'type1',
+        requiredProperties: [],
+        preparedDBProperties: {}
+      });
+      controller.prepareDBCheckAction();
+      expect(App.ajax.send.getCall(0).args[0].name).to.equal('cluster.custom_action.create');
+      expect(App.ajax.send.getCall(0).args[0].success).to.equal('onCreateActionSuccess');
+      expect(App.ajax.send.getCall(0).args[0].error).to.equal('onTaskError');
+      expect(App.ajax.send.getCall(0).args[0].data).to.eql({
+        requestInfo: {
+          "context": "Check host",
+          "action": "check_host",
+          "parameters": {
+            "db_name": "type1",
+            "jdk_location": "jdk_location",
+            "jdk_name": "jdk.name",
+            "java_home": "java.home",
+            "threshold": 60,
+            "ambari_server_host": "",
+            "check_execute_list": "db_connection_check"
+          }
+        },
+        filteredHosts: ['host1']
+      });
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/31c99869/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 6443cf5..2699320 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -736,6 +736,33 @@ describe('App.CheckDBConnectionView', function () {
 
   });
 
+  describe("#createCustomAction()", function() {
+    var view;
+    beforeEach(function () {
+      view = App.CheckDBConnectionView.create({
+        databaseName: 'MySQL',
+        getConnectionProperty: Em.K,
+        masterHostName: 'host1'
+      });
+      sinon.stub(App.ajax, 'send');
+      this.mock = sinon.stub(App.Service, 'find');
+    });
+    afterEach(function () {
+      App.ajax.send.restore();
+      this.mock.restore();
+    });
+
+    it("service not installed", function() {
+      this.mock.returns(Em.Object.create({isLoaded: false}));
+      view.createCustomAction();
+      expect(App.ajax.send.getCall(0).args[0].name).to.equal('custom_action.create');
+    });
+    it("service is installed", function() {
+      this.mock.returns(Em.Object.create({isLoaded: true}));
+      view.createCustomAction();
+      expect(App.ajax.send.getCall(0).args[0].name).to.equal('cluster.custom_action.create');
+    });
+  });
 });
 
 describe('App.BaseUrlTextField', function () {


Mime
View raw message