You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/09/01 14:32:53 UTC

ambari git commit: AMBARI-12957. FE: Do better handling for missed max or min jdk in stack definition. (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 f35431057 -> 4f574fbe2


AMBARI-12957. FE: Do better handling for missed max or min jdk in stack definition. (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 4f574fbe26cb3c75724d595bc45f1b751081938c
Parents: f354310
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Sep 1 15:26:17 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Sep 1 15:32:26 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js       | 11 ++--
 ambari-web/test/controllers/installer_test.js | 70 ++++++++++++++++++++++
 2 files changed, 76 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4f574fbe/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 82e13f4..ef2d569 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -741,8 +741,9 @@ App.InstallerController = App.WizardController.extend({
   validateJDKVersion: function (successCallback, failCallback) {
     var selectedStack = App.Stack.find().findProperty('isSelected', true),
         currentJDKVersion = App.router.get('clusterController.ambariProperties')['java.version'],
-        minJDKVersion = selectedStack.get('minJdkVersion'),
-        maxJDKVersion = selectedStack.get('maxJdkVersion'),
+        // use min as max, or max as min version, in case when some of them missed
+        minJDKVersion = selectedStack.get('minJdkVersion') || selectedStack.get('maxJdkVersion'),
+        maxJDKVersion = selectedStack.get('maxJdkVersion') || selectedStack.get('minJdkVersion'),
         t = Em.I18n.t,
         fCallback = failCallback || function() {},
         sCallback = successCallback || function() {};
@@ -754,9 +755,9 @@ App.InstallerController = App.WizardController.extend({
     }
 
     if (currentJDKVersion) {
-      if (stringUtils.compareVersions(currentJDKVersion, selectedStack.get('minJdkVersion')) < 0 ||
-          stringUtils.compareVersions(selectedStack.get('maxJdkVersion'), currentJDKVersion) < 0) {
-        // checks and process only major part for now
+      if (stringUtils.compareVersions(currentJDKVersion, minJDKVersion) < 0 ||
+          stringUtils.compareVersions(maxJDKVersion, currentJDKVersion) < 0) {
+        // checks and process only minor part for now
         var versionDistance = parseInt(maxJDKVersion.split('.')[1]) - parseInt(minJDKVersion.split('.')[1]);
         var versionsList = [minJDKVersion];
         for (var i = 1; i < (versionDistance + 1); i++) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4f574fbe/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 23c00a7..1f370d3 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -1018,6 +1018,76 @@ describe('App.InstallerController', function () {
       {
         isCustomJDK: false,
         ambariProperties: {
+          'java.version': '1.5'
+        },
+        successCallbackCalled: true,
+        popupCalled: false,
+        stacks: [Em.Object.create({
+          minJdkVersion: null,
+          maxJdkVersion: null,
+          isSelected: true
+        })],
+        m: 'JDK 1.5, stack supports max and min are null, procceed installation without warning'
+      },
+      {
+        isCustomJDK: false,
+        ambariProperties: {
+          'java.version': '1.5'
+        },
+        successCallbackCalled: true,
+        popupCalled: false,
+        stacks: [Em.Object.create({
+          minJdkVersion: '1.5',
+          maxJdkVersion: null,
+          isSelected: true
+        })],
+        m: 'JDK 1.5, stack supports max is missed and min is 1.5, procceed installation without warning'
+      },
+      {
+        isCustomJDK: false,
+        ambariProperties: {
+          'java.version': '1.6'
+        },
+        successCallbackCalled: false,
+        popupCalled: true,
+        stacks: [Em.Object.create({
+          minJdkVersion: '1.5',
+          maxJdkVersion: null,
+          isSelected: true
+        })],
+        m: 'JDK 1.6, stack supports max is missed and min is 1.5, popup should be displayed'
+      },
+      {
+        isCustomJDK: false,
+        ambariProperties: {
+          'java.version': '1.5'
+        },
+        successCallbackCalled: true,
+        popupCalled: false,
+        stacks: [Em.Object.create({
+          minJdkVersion: null,
+          maxJdkVersion: '1.5',
+          isSelected: true
+        })],
+        m: 'JDK 1.5, stack supports max 1.5 and min is missed, procceed installation without warning'
+      },
+      {
+        isCustomJDK: false,
+        ambariProperties: {
+          'java.version': '1.5'
+        },
+        successCallbackCalled: false,
+        popupCalled: true,
+        stacks: [Em.Object.create({
+          minJdkVersion: null,
+          maxJdkVersion: '1.8',
+          isSelected: true
+        })],
+        m: 'JDK 1.5, stack supports max 1.8 and min is missed, popup should be displayed'
+      },
+      {
+        isCustomJDK: false,
+        ambariProperties: {
           'java.version': '1.8'
         },
         successCallbackCalled: true,