incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1385362 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/ ambari-web/app/ ambari-web/app/controllers/ ambari-web/app/controllers/installer/ ambari-web/app/models/ ambari-web/app/views/common/ ambari-web/app/views/installer/ ambari...
Date Sun, 16 Sep 2012 20:07:55 GMT
Author: yusaku
Date: Sun Sep 16 20:07:54 2012
New Revision: 1385362

URL: http://svn.apache.org/viewvc?rev=1385362&view=rev
Log:
AMBARI-743. Add unit testing framework for Ambari Web. (yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/test-helpers.coffee
Removed:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/serviceConfig.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modalPopup.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/spec.coffee
Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js
    incubator/ambari/branches/AMBARI-666/ambari-web/package.json

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1385362&r1=1385361&r2=1385362&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sun Sep 16 20:07:54 2012
@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-743. Add unit testing framework for Ambari Web. (yusaku)
+
   AMBARI-742. Implement running a bootstrap api, keep a fifo queue and logic
   for getting a request. (mahadev)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js?rev=1385362&r1=1385361&r2=1385362&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js Sun Sep 16 20:07:54
2012
@@ -20,12 +20,12 @@
 // load all controllers here
 
 require('controllers/application');
-require('controllers/login');
+require('controllers/login_controller');
 require('controllers/installer');
 require('controllers/installer/step1');
 require('controllers/installer/step2');
 require('controllers/installer/step3');
-require('controllers/installer/step7');
+require('controllers/installer/step7_controller');
 require('controllers/main');
 require('controllers/main/service');
 require('controllers/main/service/item');

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
(added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
Sun Sep 16 20:07:54 2012
@@ -0,0 +1,323 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.InstallerStep7Controller = Em.ArrayController.extend({
+
+  name: 'installerStep7Controller',
+
+  content: [],
+
+  selectedService: null,
+
+  selectedSlaveHosts: null,
+
+  isSubmitDisabled: function() {
+    return !this.everyProperty('errorCount', 0);
+  }.property('@each.errorCount'),
+
+  init: function () {
+    var mockData = [
+      {
+        serviceName: 'HDFS',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'}),
+          App.ServiceConfigCategory.create({ name: 'NameNode'}),
+          App.ServiceConfigCategory.create({ name: 'SNameNode'}),
+          App.ServiceConfigCategory.create({ name: 'DataNode'}),
+          App.ServiceConfigCategory.create({ name: 'Advanced'})
+        ],
+        configs: [
+          {
+            name: 'dfs.prop1',
+            displayName: 'Prop1',
+            value: '',
+            defaultValue: '100',
+            description: 'This is Prop1',
+            displayType: 'digits',
+            unit: 'MB',
+            category: 'General'
+          },
+          {
+            name: 'dfs.prop2',
+            displayName: 'Prop2',
+            value: '',
+            defaultValue: '0',
+            description: 'This is Prop2 (Optional)',
+            displayType: 'number',
+            isRequired: false,
+            category: 'General'
+          },
+          {
+            name: 'dfs.adv.prop1',
+            displayName: 'Adv Prop1',
+            value: '',
+            defaultValue: '100',
+            description: 'This is Adv Prop1',
+            displayType: 'int',
+            isRequired: false,
+            category: 'Advanced'
+          },
+          {
+            name: 'dfs.adv.prop2',
+            displayName: 'Adv Prop2',
+            value: '',
+            displayType: 'string',
+            defaultValue: 'This is Adv Prop2',
+            isRequired: false,
+            category: 'Advanced'
+          },
+          {
+            name: 'hdfs-site.xml',
+            displayName: 'Custom HDFS Configs',
+            value: '',
+            defaultValue: '',
+            description: 'If you wish to set configuration parameters not exposed through
this page, you can specify them here.<br>The text you specify here will be injected
into hdfs-site.xml verbatim.',
+            displayType: 'custom',
+            isRequired: false,
+            category: 'Advanced'
+          },
+          {
+            name: 'ambari.namenode.host',
+            displayName: 'NameNode host',
+            value: 'host0001.com.com',
+            defaultValue: '',
+            description: 'The host that has been assigned to run NameNode',
+            displayType: 'masterHost',
+            category: 'NameNode'
+          },
+          {
+            name: 'dfs.namenode.dir',
+            displayName: 'NameNode directories',
+            value: '/grid/0/hadoop/namenode\r\n/grid/1/hadoop/namenode',
+            defaultValue: '',
+            displayType: 'directories',
+            category: 'NameNode'
+          },
+          {
+            name: 'dfs.namenode.prop1',
+            displayName: 'NameNode Prop1',
+            value: '',
+            defaultValue: 'default (nn)',
+            category: 'NameNode'
+          },
+          {
+            name: 'ambari.snamenode.host',
+            displayName: 'SNameNode host',
+            value: 'host0002.com.com',
+            defaultValue: '',
+            description: 'The host that has been assigned to run Secondary NameNode',
+            displayType: 'masterHost',
+            category: 'SNameNode'
+          },
+          {
+            name: 'fs.checkpoint.dir',
+            displayName: 'SNameNode directories',
+            value: '',
+            defaultValue: '',
+            displayType: 'directories',
+            category: 'SNameNode'
+          },
+          {
+            name: 'fs.checkpoint.prop1',
+            displayName: 'SNameNode Prop1',
+            value: '',
+            defaultValue: 'default (snn)',
+            category: 'SNameNode'
+          },
+          {
+            name: 'ambari.datanode.hosts',
+            displayName: 'DataNode hosts',
+            value: [ 'host0003.com.com', 'host0004.com.com', 'host0005.com.com' ],
+            defaultValue: '',
+            description: 'The hosts that have been assigned to run DataNodes',
+            displayType: 'slaveHosts',
+            category: 'DataNode'
+          },
+          {
+            name: 'dfs.data.dir',
+            displayName: 'DataNode directories',
+            value: '',
+            defaultValue: '',
+            displayType: 'directories',
+            category: 'DataNode'
+          },
+          {
+            name: 'dfs.data.prop1',
+            displayName: 'DataNode Prop1',
+            value: '',
+            defaultValue: 'default (dn)',
+            category: 'DataNode'
+          }
+        ]
+      },
+      {
+        serviceName: 'MapReduce',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'}),
+          App.ServiceConfigCategory.create({ name: 'JobTracker'}),
+          App.ServiceConfigCategory.create({ name: 'TaskTracker'}),
+          App.ServiceConfigCategory.create({ name: 'Advanced'})
+        ],
+        configs: [
+          {
+            name: 'mapred.prop1',
+            displayName: 'Prop1',
+            value: '1',
+            defaultValue: '0',
+            category: 'General'
+          },
+          {
+            name: 'jt.prop1',
+            displayName: 'JT Prop1',
+            value: '2',
+            defaultValue: '128',
+            category: 'JobTracker'
+          },
+          {
+            name: 'tt.prop1',
+            displayName: 'TT Prop1',
+            value: '3',
+            defaultValue: '256',
+            category: 'TaskTracker'
+          },
+          {
+            name: 'mapred.adv.prop1',
+            displayName: 'Adv Prop1',
+            value: '',
+            defaultValue: '1024',
+            category: 'Advanced'
+          }
+        ]
+      },
+      {
+        serviceName: 'HBase',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'}),
+          App.ServiceConfigCategory.create({ name: 'HBaseMaster'}),
+          App.ServiceConfigCategory.create({ name: 'RegionServer'}),
+          App.ServiceConfigCategory.create({ name: 'Advanced'})
+        ],
+        configs: []
+      },
+      {
+        serviceName: 'Hive/HCat',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'Hive Metastore'})
+        ],
+        configs: []
+      },
+      {
+        serviceName: 'ZooKeeper',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'})
+        ],
+        configs: []
+      },
+      {
+        serviceName: 'Nagios',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'})
+        ],
+        configs: [
+          {
+            name: 'nagios_web_login',
+            displayName: 'Nagios Admin username',
+            value: 'nagiosadmin',
+            description: 'Nagios Web UI Admin username'
+          },
+          {
+            name: 'nagios_web_password',
+            displayName: 'Nagios Admin password',
+            value: '',
+            description: 'Nagios Web UI Admin password'
+          },
+          {
+            name: 'nagios_contact',
+            displayName: 'Alert email address',
+            description: 'Email address to which alert notifications will be sent'
+          }
+        ]
+      },
+      {
+        serviceName: 'Oozie',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'})
+        ],
+        configs: []
+      },
+      {
+        serviceName: 'Misc',
+        configCategories: [
+          App.ServiceConfigCategory.create({ name: 'General'})
+        ],
+        configs: []
+      }
+
+    ];
+
+    var self = this;
+
+    mockData.forEach(function(_serviceConfig) {
+      var serviceConfig = App.ServiceConfig.create({
+        serviceName: _serviceConfig.serviceName,
+        configCategories: _serviceConfig.configCategories,
+        configs: []
+      });
+      _serviceConfig.configs.forEach(function(_serviceConfigProperty) {
+        var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+        serviceConfigProperty.serviceConfig = serviceConfig;
+        serviceConfig.configs.pushObject(serviceConfigProperty);
+        serviceConfigProperty.validate();
+      });
+
+      console.log('pushing ' + serviceConfig.serviceName);
+      self.content.pushObject(serviceConfig);
+    });
+
+    this.set('selectedService', this.objectAt(0));
+  },
+
+  submit: function() {
+    if (!this.get('isSubmitDisabled')) {
+      App.get('router').transitionTo('step8');
+    }
+  },
+
+  showSlaveHosts: function(event) {
+    this.set('selectedSlaveHosts', event.context);
+    App.ModalPopup.show({
+      header: 'Slave Hosts',
+      bodyClass: Ember.View.extend({
+        templateName: require('templates/installer/slaveHostsMatrix')
+      })
+    });
+  },
+
+  addSlaveComponentGroup: function(event) {
+    App.ModalPopup.show({
+      header: 'Add a ' + event.context + ' Group',
+      bodyClass: Ember.View.extend({
+        templateName: require('templates/installer/slaveHostsMatrix')
+      })
+    });
+  }
+
+});
+

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js Sun
Sep 16 20:07:54 2012
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.LoginController = Em.Object.extend({
+
+  name: 'loginController',
+  loginName: '',
+  password: '',
+  errorMessage: '',
+
+  submit: function (e) {
+    console.log('Login: ' + this.get('loginName') + ' Password: ' + this.get('password'));
+
+    this.set('errorMessage', '');
+
+    if (this.validateCredentials()) {
+      console.log('Logging in as: ' + this.get('loginName'));
+      App.get('router').login(this.get('loginName'));
+    } else {
+      console.log('Failed to login as: ' + this.get('loginName'));
+      this.set('errorMessage', Em.I18n.t('login.error'));
+    }
+
+  },
+
+  validateCredentials: function () {
+    //TODO: REST api that validates the login
+    return (this.get('loginName').trim() !== '' && this.get('loginName') === this.get('password'));
+  }
+
+});
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js?rev=1385362&r1=1385361&r2=1385362&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js Sun Sep 16 20:07:54 2012
@@ -20,6 +20,6 @@
 // load all models here
 
 require('models/cluster');
-require('models/serviceConfig');
 require('models/service');
+require('models/service_config');
 require('models/alert');
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js Sun Sep 16
20:07:54 2012
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.ConfigProperties = Ember.ArrayProxy.extend({
+  content: null
+  // content: require('data/config_properties').configProperties
+});
+
+
+App.ServiceConfig = Ember.Object.extend({
+  serviceName: '',
+  configCategories: [],
+  configs: null,
+
+  errorCount: function() {
+    return this.get('configs').filterProperty('isValid', false).get('length');
+  }.property('configs.@each.isValid')
+});
+
+App.ServiceConfigCategory = Ember.Object.extend({
+  name: null,
+
+  isForSlaveComponent: function () {
+    return this.get('name') === 'DataNode' || this.get('name') === 'TaskTracker' ||
+      this.get('name') === 'RegionServer';
+  }.property('name')
+});
+
+App.ServiceConfigProperty = Ember.Object.extend({
+
+  name: '',
+  displayName: '',
+  value: '',
+  defaultValue: '',
+  description: '',
+  displayType: 'string',  // string, digits, number, directories, custom
+  unit: '',
+  category: 'General',
+  isRequired: true,  // by default a config property is required
+  isEditable: true, // by default a config property is editable
+  errorMessage: '',
+  serviceConfig: null, // points to the parent App.ServiceConfig object
+
+  isValid: function() {
+    return this.get('errorMessage') === '';
+  }.property('errorMessage'),
+
+  viewClass: function() {
+    switch (this.get('displayType')) {
+      case 'directories':
+        return App.ServiceConfigTextArea;
+      case 'custom':
+        return App.ServiceConfigBigTextArea;
+      case 'masterHost':
+        return App.ServiceConfigMasterHostView;
+      case 'slaveHosts':
+        return App.ServiceConfigSlaveHostsView;
+      default:
+        return App.ServiceConfigTextField;
+    }
+  }.property('displayType'),
+
+  validate: function() {
+    var digitsRegex = /^\d+$/;
+    var numberRegex = /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/;
+
+    var value = this.get('value');
+
+    var isError = false;
+
+    if (this.get('isRequired')) {
+      if (typeof value === 'string' && value.trim().length === 0) {
+        this.set('errorMessage', 'This is required');
+        isError = true;
+        console.log('required');
+      }
+    }
+
+    if (!isError) {
+      switch (this.get('displayType')) {
+        case 'digits':
+          if (!digitsRegex.test(value)) {
+            this.set('errorMessage', 'Must contain digits only');
+            isError = true;
+          }
+          break;
+        case 'number':
+          if (!numberRegex.test(value)) {
+            this.set('errorMessage', 'Must be a valid number');
+            isError = true;
+          }
+          break;
+        case 'directories':
+          break;
+        case 'custom':
+          break;
+      }
+    }
+    if (!isError) {
+      this.set('errorMessage', '');
+      console.log('setting errorMessage to blank');
+    }
+  }.observes('value')
+
+});
+

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js?rev=1385362&r1=1385361&r2=1385362&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js Sun Sep 16 20:07:54 2012
@@ -21,7 +21,7 @@
 // load all views here
 
 require('views/application');
-require('views/common/modalPopup');
+require('views/common/modal_popup');
 require('views/login');
 require('views/main');
 require('views/main/menu');
@@ -39,7 +39,7 @@ require('views/installer/step3');
 require('views/installer/step4');
 require('views/installer/step5');
 require('views/installer/step6');
-require('views/installer/step7');
+require('views/installer/step7_view');
 require('views/installer/step8');
 require('views/installer/step9');
 require('views/installer/step10');

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js Sun Sep
16 20:07:54 2012
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.ModalPopup = Ember.View.extend({
+
+  template: Ember.Handlebars.compile([
+    '<div class="modal-backdrop"></div><div class="modal" id="modal" tabindex="-1"
role="dialog" aria-labelledby="modal-label" aria-hidden="true">',
+    '<div class="modal-header">',
+    '<a class="close" {{action onClose target="view"}}>x</a>',
+    '<h3 id="modal-label">{{view.header}}</h3>',
+    '</div>',
+    '<div class="modal-body">',
+    '{{#if bodyClass}}{{view bodyClass}}',
+    '{{else}}{{body}}{{/if}}',
+    '</div>',
+    '<div class="modal-footer">',
+    '{{#if view.secondary}}<a class="btn" {{action onSecondary target="view"}}>{{view.secondary}}</a>{{/if}}',
+    '{{#if view.primary}}<a class="btn btn-success" {{action onPrimary target="view"}}>{{view.primary}}</a>{{/if}}',
+    '</div>',
+    '</div>'
+  ].join('\n')),
+
+  header: '&nbsp;',
+  body: '&nbsp;',
+  // define bodyClass which extends Ember.View to use an arbitrary Handlebars template as
the body
+  primary: 'OK',
+  secondary: 'Cancel',
+
+  onPrimary: function() {
+  },
+
+  onSecondary: function() {
+    this.hide();
+  },
+
+  onClose: function() {
+    this.hide();
+  },
+
+  hide: function() {
+    this.destroy();
+  }
+
+});
+
+App.ModalPopup.reopenClass({
+
+  show: function(options) {
+    var popup = this.create(options);
+    popup.appendTo('#wrapper');
+  }
+
+})
+

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js Sun
Sep 16 20:07:54 2012
@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.InstallerStep7View = Em.View.extend({
+
+  templateName: require('templates/installer/step7')
+
+});
+
+App.ServiceConfigsByCategoryView = Ember.View.extend({
+  viewName: 'serviceConfigs',
+  content: null,
+
+  category: null,
+  serviceConfigs: null,  // General, Advanced, NameNode, SNameNode, DataNode, etc.
+
+  categoryConfigs: function() {
+    return this.get('serviceConfigs').filterProperty('category', this.get('category.name'))
+  }.property('serviceConfigs.@each').cacheable()
+});
+
+App.ServiceConfigTabs = Ember.View.extend({
+
+  selectService: function(event) {
+    this.set('controller.selectedService', event.context);
+  },
+
+  didInsertElement: function() {
+    this.$('a:first').tab('show');
+  }
+
+});
+
+App.ServiceConfigTextField = Ember.TextField.extend({
+
+  serviceConfig: null,
+  valueBinding: 'serviceConfig.value',
+  classNames: ['span6'],
+
+  disabled: function() {
+    return !this.get('serviceConfig.isEditable');
+  }.property('serviceConfig.isEditable'),
+
+  didInsertElement: function() {
+    this.$().popover({
+      title: this.get('serviceConfig.displayName') + '<br><small>' + this.get('serviceConfig.name')
+ '</small>',
+      content: this.get('serviceConfig.description'),
+      placement: 'left',
+      trigger: 'hover'
+    });
+  }
+
+});
+
+App.ServiceConfigTextArea = Ember.TextArea.extend({
+
+  serviceConfig: null,
+  valueBinding: 'serviceConfig.value',
+  rows: 4,
+  classNames: ['span6'],
+
+  didInsertElement: function() {
+    this.$().popover({
+      title: this.get('serviceConfig.displayName') + '<br><small>' + this.get('serviceConfig.name')
+ '</small>',
+      content: this.get('serviceConfig.description'),
+      placement: 'left',
+      trigger: 'hover'
+    });
+  }
+
+});
+
+App.ServiceConfigBigTextArea = App.ServiceConfigTextArea.extend({
+  rows: 10
+});
+
+App.ServiceConfigMasterHostView = Ember.View.extend({
+
+  serviceConfig: null,
+  classNames: ['master-host'],
+  valueBinding: 'serviceConfig.value',
+
+  template: Ember.Handlebars.compile('{{value}}'),
+
+  didInsertElement: function() {
+    this.$().popover({
+      title: this.get('serviceConfig.displayName'),
+      content: this.get('serviceConfig.description'),
+      placement: 'left',
+      trigger: 'hover'
+    });
+  }
+ });
+
+App.ServiceConfigSlaveHostsView = Ember.View.extend({
+
+  classNames: ['slave-hosts'],
+  valueBinding: 'serviceConfig.value',
+
+  templateName: require('templates/installer/slaveHosts'),
+
+  hasNoHosts: function() {
+    return this.get('value').length === 0;
+  }.property('value'),
+
+  hasOneHost: function() {
+    return this.get('value').length === 1;
+  }.property('value'),
+
+  hasMultipleHosts: function() {
+    return this.get('value').length > 1;
+  }.property('value'),
+
+  otherLength: function() {
+    return this.get('value').length - 1;
+  }.property('value'),
+
+  didInsertElement: function() {
+    this.$().popover({
+      title: this.get('serviceConfig.displayName'),
+      content: this.get('serviceConfig.description'),
+      placement: 'left',
+      trigger: 'hover'
+    });
+  }
+
+});
+
+App.AddSlaveComponentGroupButton = Ember.View.extend({
+
+  tagName: 'span',
+
+  slaveComponentName: null,
+
+  didInsertElement: function () {
+    this.$().popover({
+      title: 'Add a ' + this.get('slaveComponentName') + ' Group',
+      content: 'If you need different settings on certain ' + this.get('slaveComponentName')
+ 's, you can add a ' + this.get('slaveComponentName') + ' group.<br>' +
+        'All ' + this.get('slaveComponentName') + 's within the same group will have the
same set of settings.  You can create multiple groups.',
+      placement: 'left',
+      trigger: 'hover'
+    });
+  }
+
+});

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/package.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/package.json?rev=1385362&r1=1385361&r2=1385362&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/package.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/package.json Sun Sep 16 20:07:54 2012
@@ -24,7 +24,9 @@
   },
   "devDependencies": {
     "mocha": "0.14.0",
-    "expect.js": "0.1.2",
+    "chai": "1.2.0",
+    "sinon": "1.4.2",
+    "sinon-chai": "2.1.2",
     "express": "2.5.8"
   }
 }

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js Sun Sep 16
20:07:54 2012
@@ -0,0 +1 @@
+// TODO

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js Sun Sep 16
20:07:54 2012
@@ -0,0 +1 @@
+// TODO

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js Sun Sep 16
20:07:54 2012
@@ -0,0 +1 @@
+// TODO

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js Sun Sep 16
20:07:54 2012
@@ -0,0 +1 @@
+// TODO

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js Sun Sep 16 20:07:54
2012
@@ -0,0 +1,24 @@
+var App = require('app');
+require('controllers/login_controller');
+
+describe('App.LoginController', function () {
+
+  describe('#validateCredentials()', function () {
+    it('should return false if no username is present', function () {
+      var loginController = App.LoginController.create();
+      loginController.set('loginName', '');
+      expect(loginController.validateCredentials()).to.equal(false);
+    })
+    it('should return false if no password is present', function () {
+      var loginController = App.LoginController.create();
+      loginController.set('password', '');
+      expect(loginController.validateCredentials()).to.equal(false);
+    })
+    it('should return true if username and password are the same (dummy until actual integration)',
function () {
+      var loginController = App.LoginController.create();
+      loginController.set('loginName', 'abc');
+      loginController.set('password', 'abc');
+      expect(loginController.validateCredentials()).to.equal(true);
+    })
+  })
+})
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/test-helpers.coffee
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/test-helpers.coffee?rev=1385362&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/test-helpers.coffee (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/test-helpers.coffee Sun Sep 16 20:07:54
2012
@@ -0,0 +1,8 @@
+# This file will be automatically required when using `brunch test` command.
+chai = require 'chai'
+sinonChai = require 'sinon-chai'
+chai.use sinonChai
+
+module.exports =
+  expect: chai.expect
+  sinon: require 'sinon'



Mime
View raw message