ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin)
Date Thu, 16 Oct 2014 19:18:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ad9928969 -> 0a4408162


AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin)


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

Branch: refs/heads/trunk
Commit: 0a4408162d7511099aaa8725fa72322eb4b8edb8
Parents: ad99289
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Thu Oct 16 12:15:46 2014 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Thu Oct 16 12:17:04 2014 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.2/services/KNOX/metainfo.xml   |  2 +-
 ambari-web/app/assets/test/tests.js             |  1 +
 ambari-web/app/views/main/service/item.js       |  7 ++-
 ambari-web/test/app_test.js                     | 18 ++----
 ambari-web/test/views/main/service/item_test.js | 66 ++++++++++++++++++++
 5 files changed, 78 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml
index 571b73b..79d40e6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml
@@ -22,7 +22,7 @@
       <name>KNOX</name>
       <displayName>Knox</displayName>
       <comment>Provides a single point of authentication and access for Apache Hadoop
services in a cluster</comment>
-      <version>0.5.0</version>
+      <version>0.5.0.2.2.0.0</version>
       <components>
         <component>
           <name>KNOX_GATEWAY</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 6e54875..1dff1b2 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -165,6 +165,7 @@ var files = ['test/init_model_test',
   'test/views/main/host/details/host_component_view_test',
   'test/views/main/host/details/host_component_views/decommissionable_test',
   'test/views/main/charts/heatmap/heatmap_host_test',
+  'test/views/main/service/item_test',
   'test/views/main/service/info/config_test',
   'test/views/common/configs/services_config_test',
   'test/views/wizard/step3/hostLogPopupBody_view_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 171f5ad..e52b2d8 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -40,7 +40,8 @@ App.MainServiceItemView = Em.View.extend({
   mastersExcludedCommands: {
     'NAMENODE': ['DECOMMISSION', 'REBALANCEHDFS'],
     'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'],
-    'HBASE_MASTER': ['DECOMMISSION']
+    'HBASE_MASTER': ['DECOMMISSION'],
+    'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP']
   },
 
   actionMap: function() {
@@ -65,6 +66,7 @@ App.MainServiceItemView = Em.View.extend({
       },
       REFRESH_YARN_QUEUE: {
         action: 'refreshYarnQueues',
+        customCommand: 'REFRESHQUEUES',
         label: Em.I18n.t('services.service.actions.run.yarnRefreshQueues.menu'),
         cssClass: 'icon-refresh',
         disabled: false
@@ -104,18 +106,21 @@ App.MainServiceItemView = Em.View.extend({
       },
       STARTDEMOLDAP: {
         action: 'startLdapKnox',
+        customCommand: 'STARTDEMOLDAP',
         label: Em.I18n.t('services.service.actions.run.startLdapKnox.context'),
         cssClass: 'icon-play-sign',
         disabled: false
       },
       STOPDEMOLDAP: {
         action: 'stopLdapKnox',
+        customCommand: 'STOPDEMOLDAP',
         label: Em.I18n.t('services.service.actions.run.stopLdapKnox.context'),
         cssClass: 'icon-stop',
         disabled: false
       },
       REBALANCE_HDFS: {
         action: 'rebalanceHdfsNodes',
+        customCommand: 'REBALANCEHDFS',
         context: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'),
         label: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes'),
         cssClass: 'icon-refresh',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index fb35c86..80b71a5 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -30,6 +30,8 @@ describe('App', function () {
       loadTags: function () {
       }
     });
+    App.set('defaultStackVersion', "HDP-1.2.2");
+    App.set('currentStackVersion', "HDP-1.2.2");
 
     var testCases = [
       {
@@ -55,28 +57,16 @@ describe('App', function () {
         currentStackVersion: 'HDP-1.3.2',
         defaultStackVersion: 'HDP-1.3.1',
         result: '/stacks/HDP/versions/1.3.2'
-      },
-      {
-        title: 'if defaultStackVersion is "HDPLocal-1.3.1" then stackVersionURL should be
"/stacks/HDPLocal/versions/1.3.1"',
-        currentStackVersion: '',
-        defaultStackVersion: 'HDPLocal-1.3.1',
-        result: '/stacks/HDPLocal/versions/1.3.1'
-      },
-      {
-        title: 'if currentStackVersion is "HDPLocal-1.3.1" then stackVersionURL should be
"/stacks/HDPLocal/versions/1.3.1"',
-        currentStackVersion: 'HDPLocal-1.3.1',
-        defaultStackVersion: '',
-        result: '/stacks/HDPLocal/versions/1.3.1'
       }
     ];
 
     testCases.forEach(function (test) {
       it(test.title, function () {
-        App.set('currentStackVersion', test.currentStackVersion);
         App.set('defaultStackVersion', test.defaultStackVersion);
+        App.set('currentStackVersion', test.currentStackVersion);
         expect(App.get('stackVersionURL')).to.equal(test.result);
-        App.set('currentStackVersion', "HDP-1.2.2");
         App.set('defaultStackVersion', "HDP-1.2.2");
+        App.set('currentStackVersion', "HDP-1.2.2");
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
new file mode 100644
index 0000000..3acc57d
--- /dev/null
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('views/main/service/item');
+
+describe('App.MainServiceItemView', function() {
+
+  var view = App.MainServiceItemView.create({
+    controller: Em.Object.create({
+      content:{
+        hostComponents: []
+      }
+    })
+  });
+
+  describe('#mastersExcludedCommands', function() {
+
+    var nonCustomAction = ['RESTART_ALL', 'RUN_SMOKE_TEST', 'REFRESH_CONFIGS', 'ROLLING_RESTART',
'TOGGLE_PASSIVE', 'TOGGLE_NN_HA', 'TOGGLE_RM_HA', 'MOVE_COMPONENT', 'DOWNLOAD_CLIENT_CONFIGS','MASTER_CUSTOM_COMMAND'];
+
+    var keys = Object.keys(view.mastersExcludedCommands);
+    var mastersExcludedCommands = [];
+    for (var i = 0; i < keys.length; i++) {
+      mastersExcludedCommands[i] = view.mastersExcludedCommands[keys[i]];
+    }
+    console.log("value of masterExcluded: " + mastersExcludedCommands);
+    var allMastersExcludedCommands = mastersExcludedCommands.reduce(function(previous, current){
+      console.log(previous);
+      return previous.concat(current);
+    });
+    var actionMap = view.actionMap();
+
+    var customActionsArray = [];
+    for (var iter in actionMap) {
+      customActionsArray.push(actionMap[iter]);
+    }
+    var customActions = customActionsArray.mapProperty('customCommand').filter(function(action){
+      return !nonCustomAction.contains(action);
+    }).uniq();
+
+    // remove null and undefined from the list
+    customActions = customActions.filter(function(value) { return value != null; });
+
+    customActions.forEach(function(action){
+      it(action + ' should be present in App.MainServiceItemView mastersExcludedCommands
object', function() {
+        expect(allMastersExcludedCommands).to.contain(action);
+      });
+    });
+  });
+});
+


Mime
View raw message