You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/12/07 15:00:29 UTC

[31/50] [abbrv] ambari git commit: AMBARI-19106. Kerberos wizard is broken if stacks doesn't contain Ranger (alexantonenko)

AMBARI-19106. Kerberos wizard is broken if stacks doesn't contain Ranger (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9b46fd2acd6a5d1bd8ce474315fb318f1cfe6a3a
Parents: 0f29751
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Dec 6 19:18:34 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Dec 6 19:18:34 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/views/common/controls_view.js    |  3 +-
 .../test/views/common/controls_view_test.js     | 74 +++++++++++++++++++-
 2 files changed, 75 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b46fd2a/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 dd475b6..bcb90d8 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -1048,11 +1048,12 @@ App.CheckDBConnectionView = Ember.View.extend({
   isBtnDisabled: Em.computed.or('!isValidationPassed', 'isConnecting'),
   /** @property {object} requiredProperties - properties that necessary for database connection **/
   requiredProperties: function() {
+    var ranger = App.StackService.find().findProperty('serviceName', 'RANGER');
     var propertiesMap = {
       OOZIE: ['oozie.db.schema.name', 'oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password', 'oozie.service.JPAService.jdbc.driver', 'oozie.service.JPAService.jdbc.url'],
       HIVE: ['ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword', 'javax.jdo.option.ConnectionDriverName', 'javax.jdo.option.ConnectionURL'],
       KERBEROS: ['kdc_hosts'],
-      RANGER: App.StackService.find('RANGER').compareCurrentVersion('0.5') > -1 ?
+      RANGER: ranger && App.StackService.find().findProperty('serviceName', 'RANGER').compareCurrentVersion('0.5') > -1 ?
           ['db_user', 'db_password', 'db_name', 'ranger.jpa.jdbc.url', 'ranger.jpa.jdbc.driver'] :
           ['db_user', 'db_password', 'db_name', 'ranger_jdbc_connection_url', 'ranger_jdbc_driver']
     };

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b46fd2a/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 c5c5338..3ff5253 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -651,7 +651,6 @@ describe('App.CheckDBConnectionView', function () {
         expect(view.get('masterHostName')).to.equal(item.value);
       });
     });
-
   });
 
   describe('#setResponseStatus', function () {
@@ -836,6 +835,79 @@ describe('App.CheckDBConnectionView', function () {
       expect(args[0]).exists;
     });
   });
+
+  describe('#requriedProperties', function() {
+    var cases;
+    beforeEach(function() {
+      this.stackServiceStub = sinon.stub(App.StackService, 'find');
+    });
+    afterEach(function() {
+      this.stackServiceStub.restore();
+    });
+
+    cases = [
+      {
+        stackServices: [
+          {name: 'OOZIE', version: '1.0.0'}
+        ],
+        parentViewServiceName: 'OOZIE',
+        e: ['oozie.db.schema.name', 'oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password', 'oozie.service.JPAService.jdbc.driver', 'oozie.service.JPAService.jdbc.url'],
+        m: 'should return Oozie specific properties'
+      },
+      {
+        stackServices: [
+          {name: 'HIVE', version: '1.0.0'}
+        ],
+        parentViewServiceName: 'HIVE',
+        e: ['ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword', 'javax.jdo.option.ConnectionDriverName', 'javax.jdo.option.ConnectionURL'],
+        m: 'should return Hive specific properties'
+      },
+      {
+        stackServices: [
+          {name: 'KERBEROS', version: '1.0.0'}
+        ],
+        parentViewServiceName: 'KERBEROS',
+        e: ['kdc_hosts'],
+        m: 'should return specific Kerberos specific properties'
+      },
+      {
+        stackServices: [
+          {name: 'RANGER', version: '0.4.9'}
+        ],
+        parentViewServiceName: 'RANGER',
+        e: ['db_user', 'db_password', 'db_name', 'ranger_jdbc_connection_url', 'ranger_jdbc_driver'],
+        m: 'should return specific properties for Ranger when its version < 0.5'
+      },
+      {
+        stackServices: [
+          {name: 'RANGER', version: '1.0.0'}
+        ],
+        parentViewServiceName: 'RANGER',
+        e: ['db_user', 'db_password', 'db_name', 'ranger.jpa.jdbc.url', 'ranger.jpa.jdbc.driver'],
+        m: 'should return specific properties for Ranger when its version > 0.5'
+      }
+    ];
+
+    cases.forEach(function(test) {
+      it(test.m, function() {
+        this.stackServiceStub.returns(test.stackServices.map(function(service) {
+          return Em.Object.create({
+            serviceName: service.name,
+            serviceVersion: service.version,
+            compareCurrentVersion: App.StackService.proto().compareCurrentVersion
+          });
+        }));
+        var view = App.CheckDBConnectionView.create({
+          parentView: {
+            service: {
+              serviceName: test.parentViewServiceName
+            }
+          }
+        });
+        expect(view.get('requiredProperties')).to.be.eql(test.e);
+      });
+    });
+  });
 });
 
 describe('App.BaseUrlTextField', function () {