You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by is...@apache.org on 2018/08/06 21:19:22 UTC

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-24396] Service theme call failing.

This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by this push:
     new 938d31f  [AMBARI-24396] Service theme call failing.
938d31f is described below

commit 938d31f091d1b86dc5edcd565dd1a2ea8a9e30ce
Author: Ishan Bhatt <is...@gmail.com>
AuthorDate: Tue Jul 31 12:56:23 2018 -0700

    [AMBARI-24396] Service theme call failing.
---
 ambari-web/app/controllers/main.js                 |  2 +-
 .../app/mixins/main/service/themes_mapping.js      |  4 ++-
 .../controllers/main/service/info/summary_test.js  |  5 +++-
 ambari-web/test/controllers/main_test.js           | 22 +++++++--------
 ambari-web/test/models/stack_service_test.js       | 32 ++++++++++++++--------
 ambari-web/test/views/installer_test.js            |  1 +
 6 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js
index 105fee0..1a5b2a0 100644
--- a/ambari-web/app/controllers/main.js
+++ b/ambari-web/app/controllers/main.js
@@ -61,7 +61,7 @@ App.MainController = Em.Controller.extend({
   dataLoading: function () {
     var self = this;
     var dfd = $.Deferred();
-    if (App.router.get('clusterController.isLoaded')) {
+    if (self.get('isClusterDataLoaded')) {
       dfd.resolve();
     } else {
       var interval = setInterval(function () {
diff --git a/ambari-web/app/mixins/main/service/themes_mapping.js b/ambari-web/app/mixins/main/service/themes_mapping.js
index 036ca7b..82ed9f5 100644
--- a/ambari-web/app/mixins/main/service/themes_mapping.js
+++ b/ambari-web/app/mixins/main/service/themes_mapping.js
@@ -33,6 +33,8 @@ App.ThemesMappingMixin = Em.Mixin.create({
    */
   loadConfigTheme: function(serviceName) {
     const dfd = $.Deferred();
+    let stackName = App.StackService.find().findProperty('serviceName', serviceName).get('stackName');
+    let stackVersion = App.StackService.find().findProperty('serviceName', serviceName).get('stackVersion');
     if (App.Tab.find().mapProperty('serviceName').contains(serviceName)) {
       dfd.resolve();
     } else {
@@ -41,7 +43,7 @@ App.ThemesMappingMixin = Em.Mixin.create({
         sender: this,
         data: {
           serviceName: serviceName,
-          stackVersionUrl: App.get('stackVersionURL')
+          stackVersionUrl: App.getStackVersionUrl(stackName, stackVersion) || App.get('stackVersionURL')
         },
         success: '_saveThemeToModel'
       }).complete(dfd.resolve);
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index e5cc32a..2fc85f3 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -113,17 +113,20 @@ describe('App.MainServiceInfoSummaryController', function () {
           configTypes: {}
         })
       ]);
+      this.mock = sinon.stub(App, 'get');
     });
 
     afterEach(function () {
       App.Service.find.restore();
       App.StackService.find.restore();
+      this.mock.restore();
     });
 
     cases.forEach(function (item) {
       it(item.title, function () {
         controller.set('isRangerPluginsArraySet', item.isRangerPluginsArraySet);
-        App.set('router.clusterController.isLoaded', item.isLoaded);
+        this.mock.withArgs('router.clusterController.isLoaded').returns(item.isLoaded);
+        controller.setRangerPlugins();
         expect(controller.get('isRangerPluginsArraySet')).to.equal(item.expectedIsRangerPluginsArraySet);
         expect(controller.get('rangerPlugins').filterProperty('isDisplayed').mapProperty('serviceName').sort()).to.eql(['HDFS', 'HIVE']);
       });
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index 723d306..3606bf5 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -58,27 +58,25 @@ describe('App.MainController', function () {
 
   describe('#dataLoading', function() {
 
-    beforeEach(function () {
-      this.stub = sinon.stub(App.router, 'get');
-    });
-
-    afterEach(function () {
-      this.stub.restore();
-    });
-
     it ('Should resolve promise', function() {
-      this.stub.returns(true);
+      mainController.reopen({
+        isClusterDataLoaded: true
+      });
       var deffer = mainController.dataLoading();
       deffer.then(function(val){
         expect(val).to.be.undefined;
       });
     });
     it ('Should resolve promise (2)', function(done) {
-      this.stub.returns(false);
+      mainController.reopen({
+        isClusterDataLoaded: false
+      });
       
       setTimeout(function() {
-        mainController.set('isClusterDataLoaded', true);
-      },150);
+        mainController.reopen({
+          isClusterDataLoaded: true
+        });
+      }, 150);
 
       var deffer = mainController.dataLoading();
       deffer.then(function(val){
diff --git a/ambari-web/test/models/stack_service_test.js b/ambari-web/test/models/stack_service_test.js
index 2d76a8b..a36a29a 100644
--- a/ambari-web/test/models/stack_service_test.js
+++ b/ambari-web/test/models/stack_service_test.js
@@ -97,12 +97,13 @@ describe('App.StackService', function () {
       ss.propertyDidChange('displayNameOnSelectServicePage');
       expect(ss.get('displayNameOnSelectServicePage')).to.equal('HDFS');
     });
-    it('Present coSelectedServices', function () {
-      ss.set('serviceName', 'YARN');
-      ss.set('displayName', 'YARN');
-      ss.propertyDidChange('displayNameOnSelectServicePage');
-      expect(ss.get('displayNameOnSelectServicePage')).to.equal('YARN + MapReduce2');
-    });
+    //TODO uncomment after App.StackService.coSelected will be uncommented
+    // it('Present coSelectedServices', function () {
+    //   ss.set('serviceName', 'YARN');
+    //   ss.set('displayName', 'YARN');
+    //   ss.propertyDidChange('displayNameOnSelectServicePage');
+    //   expect(ss.get('displayNameOnSelectServicePage')).to.equal('YARN + MapReduce2');
+    // });
   });
 
   describe('#isHiddenOnSelectServicePage', function () {
@@ -112,11 +113,11 @@ describe('App.StackService', function () {
         isInstallable: true,
         result: false
       },
-      {
-        serviceName: 'MAPREDUCE2',
-        isInstallable: true,
-        result: true
-      },
+      // {
+      //   serviceName: 'MAPREDUCE2',
+      //   isInstallable: true,
+      //   result: true
+      // },
       {
         serviceName: 'KERBEROS',
         isInstallable: false,
@@ -335,6 +336,13 @@ describe('App.StackService', function () {
         isDisabled: false
       }
     ];
+    
+    beforeEach(function() {
+      this.mock = sinon.stub(App, 'get');
+    });
+    afterEach(function() {
+      this.mock.restore();
+    });
 
     cases.forEach(function (testCase) {
 
@@ -346,7 +354,7 @@ describe('App.StackService', function () {
           isInstalled: testCase.isInstalled,
           isMandatory: testCase.isMandatory
         });
-        App.set('router.clusterInstallCompleted', testCase.clusterInstallCompleted);
+        this.mock.returns(testCase.clusterInstallCompleted);
         expect(ss.get('isDisabled')).to.equal(testCase.isDisabled);
       });
 
diff --git a/ambari-web/test/views/installer_test.js b/ambari-web/test/views/installer_test.js
index 80493e7..1fe8973 100644
--- a/ambari-web/test/views/installer_test.js
+++ b/ambari-web/test/views/installer_test.js
@@ -24,6 +24,7 @@ var view;
 var steps;
 
 describe('App.InstallerView', function () {
+  var properties = [];
 
   beforeEach(function () {
     view = App.InstallerView.create({