ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-9371 Add Host wizard: Kerberos client and Ganglia monitor validation error should not be shown. (ababiichuk)
Date Wed, 28 Jan 2015 13:32:48 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b11fe8810 -> c915d2c31


AMBARI-9371 Add Host wizard: Kerberos client and Ganglia monitor validation error should not
be shown. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: c915d2c31b282d7890f1e76d7b00e7892f3b7dc2
Parents: b11fe88
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Wed Jan 28 13:47:37 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Wed Jan 28 15:32:40 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step6_controller.js  |   9 +-
 .../test/controllers/wizard/step6_test.js       | 353 ++++++++++++++++++-
 2 files changed, 357 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c915d2c3/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 3aaf956..f4ef6c4 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -529,7 +529,10 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin,
{
     var hostNames = self.get('hosts').mapProperty('hostName');
     var slaveBlueprint = self.getCurrentBlueprint();
     var masterBlueprint = null;
-    var invisibleSlaves = App.StackServiceComponent.find().filterProperty("isSlave").filterProperty("isShownOnInstallerSlaveClientPage",
false).mapProperty("componentName");
+    var invisibleSlavesAndClients = App.StackServiceComponent.find().filter(function (component)
{
+      return component.get("isSlave") && component.get("isShownOnInstallerSlaveClientPage")
=== false ||
+        component.get("isClient") && component.get("isRequiredOnAllHosts");
+    }).mapProperty("componentName");
 
     if (this.get('isInstallerWizard') || this.get('isAddServiceWizard')) {
       masterBlueprint = self.getCurrentMastersBlueprint();
@@ -546,14 +549,14 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin,
{
         return selectedClientComponents.contains(c);
       });
 
-      var invisibleComponents = invisibleMasters.concat(invisibleSlaves).concat(alreadyInstalledClients);
+      var invisibleComponents = invisibleMasters.concat(invisibleSlavesAndClients).concat(alreadyInstalledClients);
 
       var invisibleBlueprint = blueprintUtils.filterByComponents(this.get('content.recommendations'),
invisibleComponents);
       masterBlueprint = blueprintUtils.mergeBlueprints(masterBlueprint, invisibleBlueprint);
     } else if (this.get('isAddHostWizard')) {
       masterBlueprint = self.getCurrentMasterSlaveBlueprint();
       hostNames = hostNames.concat(App.Host.find().mapProperty("hostName")).uniq();
-      slaveBlueprint = blueprintUtils.addComponentsToBlueprint(slaveBlueprint, invisibleSlaves);
+      slaveBlueprint = blueprintUtils.addComponentsToBlueprint(slaveBlueprint, invisibleSlavesAndClients);
     }
 
     var bluePrintsForValidation = blueprintUtils.mergeBlueprints(masterBlueprint, slaveBlueprint);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c915d2c3/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 1445481..712debc 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -47,11 +47,11 @@ describe('App.WizardStep6Controller', function () {
 
   beforeEach(function () {
     controller = App.WizardStep6Controller.create();
-    controller.set('content', {
+    controller.set('content', Em.Object.create({
       hosts: {},
       masterComponentHosts: {},
       services: services
-    });
+    }));
 
     var h = {}, m = [];
     Em.A(['host0', 'host1', 'host2', 'host3']).forEach(function (hostName) {
@@ -552,4 +552,353 @@ describe('App.WizardStep6Controller', function () {
     });
   });
 
+  describe('#callServerSideValidation', function () {
+
+    var cases = [
+        {
+          controllerName: 'installerController',
+          hosts: [
+            {
+              hostName: 'h0'
+            },
+            {
+              hostName: 'h1'
+            }
+          ],
+          expected: [
+            ['c0', 'c6'],
+            ['c1', 'c3', 'c8']
+          ]
+        },
+        {
+          controllerName: 'addServiceController',
+          hosts: [
+            {
+              hostName: 'h0'
+            },
+            {
+              hostName: 'h1'
+            }
+          ],
+          expected: [
+            ['c0', 'c6'],
+            ['c1', 'c3', 'c8']
+          ]
+        },
+        {
+          controllerName: 'addHostController',
+          hosts: [
+            {
+              hostName: 'h0'
+            }
+          ],
+          expected: [
+            ['c0', 'c2', 'c5', 'c6'],
+            ['c1', 'c2', 'c3', 'c5', 'c8']
+          ]
+        }
+      ],
+      expectedHostGroups = [
+        {
+          name: 'host-group-1',
+          fqdn: 'h0'
+        },
+        {
+          name: 'host-group-2',
+          fqdn: 'h1'
+        }
+      ];
+
+    beforeEach(function () {
+      controller.get('content').setProperties({
+        recommendations: {
+          blueprint: {
+            host_groups: [
+              {
+                components: [
+                  {
+                    name: 'c6'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                components: [
+                  {
+                    name: 'c8'
+                  }
+                ],
+                name: 'host-group-2'
+              }
+            ]
+          },
+          blueprint_cluster_binding: {
+            host_groups: [
+              {
+                hosts: [
+                  {
+                    fqdn: 'h0'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                hosts: [
+                  {
+                    fqdn: 'h1'
+                  }
+                ],
+                name: 'host-group-2'
+              }]
+          }
+        },
+        clients: [
+          {
+            component_name: 'c3'
+          }
+        ]
+      });
+      sinon.stub(App.StackService, 'find', function () {
+        return [
+          Em.Object.create({
+            serviceName: 's0',
+            isSelected: true
+          }),
+          Em.Object.create({
+            serviceName: 's1',
+            isInstalled: true,
+            isSelected: true
+          })
+        ];
+      });
+      sinon.stub(App.StackServiceComponent, 'find', function () {
+        return [
+          Em.Object.create({
+            componentName: 'c0',
+            isSlave: true
+          }),
+          Em.Object.create({
+            componentName: 'c1',
+            isSlave: true,
+            isShownOnInstallerSlaveClientPage: true
+          }),
+          Em.Object.create({
+            componentName: 'c2',
+            isSlave: true,
+            isShownOnInstallerSlaveClientPage: false
+          }),
+          Em.Object.create({
+            componentName: 'c3',
+            isClient: true
+          }),
+          Em.Object.create({
+            componentName: 'c4',
+            isClient: true,
+            isRequiredOnAllHosts: false
+          }),
+          Em.Object.create({
+            componentName: 'c5',
+            isClient: true,
+            isRequiredOnAllHosts: true
+          }),
+          Em.Object.create({
+            componentName: 'c6',
+            isMaster: true,
+            isShownOnInstallerAssignMasterPage: true
+          }),
+          Em.Object.create({
+            componentName: 'c7',
+            isMaster: true,
+            isShownOnInstallerAssignMasterPage: false
+          }),
+          Em.Object.create({
+            componentName: 'c8',
+            isMaster: true,
+            isShownOnAddServiceAssignMasterPage: true
+          }),
+          Em.Object.create({
+            componentName: 'c9',
+            isMaster: true,
+            isShownOnAddServiceAssignMasterPage: false
+          })
+        ];
+      });
+      sinon.stub(controller, 'getCurrentBlueprint', function () {
+        return {
+          blueprint: {
+            host_groups: [
+              {
+                components: [
+                  {
+                    name: 'c0'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                components: [
+                  {
+                    name: 'c1'
+                  },
+                  {
+                    name: 'c3'
+                  }
+                ],
+                name: 'host-group-2'
+              }
+            ]
+          },
+          blueprint_cluster_binding: {
+            host_groups: [
+              {
+                hosts: [
+                  {
+                    fqdn: 'h0'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                hosts: [
+                  {
+                    fqdn: 'h1'
+                  }
+                ],
+                name: 'host-group-2'
+              }]
+          }
+        };
+      });
+      sinon.stub(controller, 'getCurrentMastersBlueprint', function () {
+        return {
+          blueprint: {
+            host_groups: [
+              {
+                components: [
+                  {
+                    name: 'c6'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                components: [
+                  {
+                    name: 'c8'
+                  }
+                ],
+                name: 'host-group-2'
+              }
+            ]
+          },
+          blueprint_cluster_binding: {
+            host_groups: [
+              {
+                hosts: [
+                  {
+                    fqdn: 'h0'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                hosts: [
+                  {
+                    fqdn: 'h1'
+                  }
+                ],
+                name: 'host-group-2'
+              }]
+          }
+        };
+      });
+      sinon.stub(App, 'get').withArgs('components.clients').returns(['c3', 'c4']);
+      sinon.stub(controller, 'getCurrentMasterSlaveBlueprint', function () {
+        return {
+          blueprint: {
+            host_groups: [
+              {
+                components: [
+                  {
+                    name: 'c6'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                components: [
+                  {
+                    name: 'c8'
+                  }
+                ],
+                name: 'host-group-2'
+              }
+            ]
+          },
+          blueprint_cluster_binding: {
+            host_groups: [
+              {
+                hosts: [
+                  {
+                    fqdn: 'h0'
+                  }
+                ],
+                name: 'host-group-1'
+              },
+              {
+                hosts: [
+                  {
+                    fqdn: 'h1'
+                  }
+                ],
+                name: 'host-group-2'
+              }]
+          }
+        };
+      });
+      sinon.stub(App.Host, 'find', function () {
+        return [
+          {
+            hostName: 'h1'
+          }
+        ];
+      });
+      sinon.stub(App.ajax, 'send', function () {
+        return {
+          then: Em.K
+        };
+      });
+    });
+
+    afterEach(function () {
+      App.StackService.find.restore();
+      App.StackServiceComponent.find.restore();
+      controller.getCurrentBlueprint.restore();
+      controller.getCurrentMastersBlueprint.restore();
+      App.get.restore();
+      controller.getCurrentMasterSlaveBlueprint.restore();
+      App.Host.find.restore();
+      App.ajax.send.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.controllerName, function () {
+        controller.set('hosts', item.hosts);
+        controller.set('content.controllerName', item.controllerName);
+        controller.callServerSideValidation();
+        expect(controller.get('content.recommendationsHostGroups.blueprint.host_groups.length')).to.equal(expectedHostGroups.length);
+        expect(controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups.length')).to.equal(expectedHostGroups.length);
+        controller.get('content.recommendationsHostGroups.blueprint.host_groups').forEach(function
(group, index) {
+          expect(group.components.mapProperty('name').sort()).to.eql(item.expected[index]);
+        });
+        expectedHostGroups.forEach(function (group) {
+          var bpGroup = controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups').findProperty('name',
group.name);
+          expect(bpGroup.hosts).to.have.length(1);
+          expect(bpGroup.hosts[0].fqdn).to.equal(group.fqdn);
+        });
+      });
+    });
+
+  });
+
 });


Mime
View raw message