You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/02/21 15:35:28 UTC

git commit: AMBARI-4779. Add services wizard throw JS exception. (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 2ccf7047b -> 0f9a5bf53


AMBARI-4779. Add services wizard throw JS exception. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 0f9a5bf535921e9559cef44fa42db14c2bc3b80f
Parents: 2ccf704
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Feb 21 16:23:40 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Feb 21 16:35:22 2014 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  6 +-
 ambari-web/test/installer/step7_test.js         | 95 +++++++++++++++++++-
 2 files changed, 98 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0f9a5bf5/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 18ce9db..d360cf9 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -75,7 +75,11 @@ App.WizardStep7Controller = Em.Controller.extend({
   }.property('content.services').cacheable(),
 
   installedServiceNames: function () {
-    return this.get('content.services').filterProperty('isInstalled').mapProperty('serviceName');
+    var serviceNames = this.get('content.services').filterProperty('isInstalled').mapProperty('serviceName');
+    if(this.get('content.controllerName') !== 'installerController') {
+      return serviceNames.without('SQOOP');
+    }
+    return serviceNames;
   }.property('content.services').cacheable(),
 
   masterComponentHosts: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0f9a5bf5/ambari-web/test/installer/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/installer/step7_test.js b/ambari-web/test/installer/step7_test.js
index 5be7d50..c1e4161 100644
--- a/ambari-web/test/installer/step7_test.js
+++ b/ambari-web/test/installer/step7_test.js
@@ -17,9 +17,100 @@
  */
 
 var App = require('app');
+var numberUtils = require('utils/number_utils');
 require('controllers/wizard/step7_controller');
 
-/*
+var installerStep7Controller;
+
 describe('App.InstallerStep7Controller', function () {
 
-})*/
+  describe('#installedServiceNames', function() {
+
+    var tests = Em.A([
+      {
+        content: Em.Object.create({
+          controllerName: 'installerController',
+          services: Em.A([
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'SQOOP'
+            }),
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HDFS'
+            })
+          ])
+        }),
+        e: ['SQOOP', 'HDFS'],
+        m: 'installerController with SQOOP'
+      },
+      {
+        content: Em.Object.create({
+          controllerName: 'installerController',
+          services: Em.A([
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HIVE'
+            }),
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HDFS'
+            })
+          ])
+        }),
+        e: ['HIVE', 'HDFS'],
+        m: 'installerController without SQOOP'
+      },
+      {
+        content: Em.Object.create({
+          controllerName: 'addServiceController',
+          services: Em.A([
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HIVE'
+            }),
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HDFS'
+            })
+          ])
+        }),
+        e: ['HIVE', 'HDFS'],
+        m: 'addServiceController without SQOOP'
+      },
+      {
+        content: Em.Object.create({
+          controllerName: 'addServiceController',
+          services: Em.A([
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'SQOOP'
+            }),
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HIVE'
+            }),
+            Em.Object.create({
+              isInstalled: true,
+              serviceName: 'HDFS'
+            })
+          ])
+        }),
+        e: ['HIVE', 'HDFS'],
+        m: 'addServiceController with SQOOP'
+      }
+    ]);
+
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        installerStep7Controller = App.WizardStep7Controller.create({
+          content: test.content
+        });
+        expect(installerStep7Controller.get('installedServiceNames')).to.include.members(test.e);
+        expect(test.e).to.include.members(installerStep7Controller.get('installedServiceNames'));
+      });
+    });
+
+  });
+
+});