ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject git commit: AMBARI-7906. Slider apps: It is not possible to correct invalid allocation of resources without wizard close (alexantonenko)
Date Wed, 22 Oct 2014 18:08:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 14302687e -> 6ea772b29


 AMBARI-7906. Slider apps: It is not possible to correct invalid allocation of resources without
wizard close (alexantonenko)


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

Branch: refs/heads/branch-1.7.0
Commit: 6ea772b29c9c1d14e12ff87c0436795e26ca5e5d
Parents: 1430268
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Oct 22 19:08:33 2014 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Oct 22 21:04:58 2014 +0300

----------------------------------------------------------------------
 .../createAppWizard/step4_controller.js         |  2 +-
 .../createAppWizard/step4_controller_test.js    | 74 ++++++++++++++++++++
 2 files changed, 75 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6ea772b2/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
index d19801b..1089fe9 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
@@ -98,7 +98,7 @@ App.CreateAppWizardStep4Controller = Ember.ObjectController.extend(App.AjaxError
       });
     }
     return resources;
-  }.property('newApp.components.@each'),
+  }.property('newApp.components.@each.numInstances', 'newApp.components.@each.yarnMemory',
'newApp.components.@each.yarnCPU', 'newApp.components.@each.priority', 'newApp.components.@each.yarnLabelChecked',
'newApp.components.@each.yarnLabel'),
 
   /**
    * Load all required data for step

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ea772b2/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step4_controller_test.js
b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step4_controller_test.js
index 72162b5..627e726 100644
--- a/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step4_controller_test.js
+++ b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step4_controller_test.js
@@ -57,3 +57,77 @@ test('isSubmitDisabled', function () {
   equal(controller.get('isSubmitDisabled'), false, 'should be false after sendAppDataToServerCompleteCallback
call');
 
 });
+
+test('resourcesFormatted', function () {
+
+  var cases = [
+      {
+        propertyName: 'numInstances',
+        expectedPropertyName: 'instanceCount',
+        value: '1'
+      },
+      {
+        propertyName: 'yarnMemory',
+        expectedPropertyName: 'yarnMemory',
+        value: '256'
+      },
+      {
+        propertyName: 'yarnCPU',
+        expectedPropertyName: 'yarnCpuCores',
+        value: '2'
+      },
+      {
+        propertyName: 'priority',
+        expectedPropertyName: 'priority',
+        value: 2
+      }
+    ],
+    title = '{0} should be {1}',
+    label = 'label';
+
+  var controller = this.subject({
+    newApp: Em.Object.create({
+      components: [
+        Em.Object.create({
+          name: 'c',
+          numInstances: '0',
+          yarnMemory: '512',
+          yarnCPU: '1',
+          priority: 1
+        })
+      ]
+    })
+  });
+
+  cases.forEach(function (item) {
+
+    Em.run(function () {
+      controller.get('newApp.components')[0].set(item.propertyName, item.value);
+    });
+
+    equal(controller.get('resourcesFormatted.components')[0][item.expectedPropertyName],
item.value, title.format(item.expectedPropertyName, item.value));
+
+  });
+
+  Em.run(function () {
+    controller.get('newApp.components')[0].setProperties({
+      yarnLabelChecked: false,
+      yarnLabel: label
+    });
+  });
+
+  ok(!controller.get('resourcesFormatted.components')[0].yarnLabel, 'yarnLabel shouldn\'t
be set');
+
+  Em.run(function () {
+    controller.get('newApp.components')[0].set('yarnLabelChecked', true);
+  });
+
+  equal(controller.get('resourcesFormatted.components')[0].yarnLabel, label, title.format('yarnLabel',
'\'' + label + '\''));
+
+  Em.run(function () {
+    controller.get('newApp.components')[0].set('yarnLabel', ' ' + label + '\n');
+  });
+
+  equal(controller.get('resourcesFormatted.components')[0].yarnLabel, label, 'yarnLabel should
be trimmed');
+
+});
\ No newline at end of file


Mime
View raw message