You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/11/18 12:46:29 UTC
ambari git commit: AMBARI-13940 Moving oozie fails at DB connection.
(atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 c6ce84756 -> ec7ac94c0
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/ec7ac94c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ec7ac94c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ec7ac94c
Branch: refs/heads/branch-2.1
Commit: ec7ac94c0ff7bedf5963bde13fab960de2de87a3
Parents: c6ce847
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Wed Nov 18 13:39:37 2015 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Wed Nov 18 13:39:37 2015 +0200
----------------------------------------------------------------------
.../main/service/reassign/step4_controller.js | 4 +-
ambari-web/app/views/common/controls_view.js | 11 ++---
.../service/reassign/step4_controller_test.js | 43 ++++++++++++++++++++
.../test/views/common/controls_view_test.js | 28 +++++++++++++
4 files changed, 79 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec7ac94c/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 f197d84..a33f0e7 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -1105,7 +1105,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'];
@@ -1117,7 +1117,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/ec7ac94c/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 81203bf..6d5a49d 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -1228,10 +1228,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');
},
@@ -1345,9 +1345,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/ec7ac94c/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 f0e845c..9c6ebca 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
@@ -1257,4 +1257,47 @@ 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/ec7ac94c/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 64c36e4..d27dc9d 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -735,6 +735,34 @@ 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 () {