ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/3] ambari git commit: AMBARI-9264 Stack and Versions: Integrate view/edit repositories with API. (ababiichuk)
Date Thu, 22 Jan 2015 14:57:38 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 5f4adaa6c -> 92b05b9ba


http://git-wip-us.apache.org/repos/asf/ambari/blob/11efa2f5/ambari-web/app/views/wizard/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js
deleted file mode 100644
index b0a26ab..0000000
--- a/ambari-web/app/views/wizard/controls_view.js
+++ /dev/null
@@ -1,1208 +0,0 @@
-/**
- * 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');
-
-/**
- * Abstract view for config fields.
- * Add popover support to control
- */
-App.ServiceConfigPopoverSupport = Ember.Mixin.create({
-
-  /**
-   * Config object. It will instance of App.ServiceConfigProperty
-   */
-  serviceConfig: null,
-  attributeBindings:['readOnly'],
-  isPopoverEnabled: true,
-
-  didInsertElement: function () {
-    $('body').tooltip({
-      selector: '[data-toggle=tooltip]',
-      placement: 'top'
-    });
-    // if description for this serviceConfig not exist, then no need to show popover
-    if (this.get('isPopoverEnabled') !== 'false' && this.get('serviceConfig.description')) {
-      App.popover(this.$(), {
-        title: Em.I18n.t('installer.controls.serviceConfigPopover.title').format(
-          this.get('serviceConfig.displayName'),
-          (this.get('serviceConfig.displayName') == this.get('serviceConfig.name')) ? '' : this.get('serviceConfig.name')
-        ),
-        content: this.get('serviceConfig.description'),
-        placement: 'right',
-        trigger: 'hover'
-      });
-    }
-  },
-
-  willDestroyElement: function() {
-    this.$().popover('destroy');
-  },
-
-  readOnly: function () {
-    return !this.get('serviceConfig.isEditable');
-  }.property('serviceConfig.isEditable')
-});
-
-/**
- * mixin set class that serve as unique element identificator,
- * id not used in order to avoid collision with ember ids
- */
-App.ServiceConfigCalculateId = Ember.Mixin.create({
-  idClass: Ember.computed(function () {
-    var label = Em.get(this, 'serviceConfig.name') ? Em.get(this, 'serviceConfig.name').toLowerCase().replace(/\./g, '-') : '',
-        fileName = Em.get(this, 'serviceConfig.filename') ? Em.get(this, 'serviceConfig.filename').toLowerCase().replace(/\./g, '-') : '',
-        group = Em.get(this, 'serviceConfig.group.name') || 'default';
-        isOrigin = Em.get(this, 'serviceConfig.compareConfigs.length') > 0 ? '-origin' : '';
-    return 'service-config-' + label + '-' + fileName + '-' + group + isOrigin;
-  }),
-  classNameBindings: 'idClass'
-});
-
-/**
- * Default input control
- * @type {*}
- */
-App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, {
-
-  valueBinding: 'serviceConfig.value',
-  classNameBindings: 'textFieldClassName',
-  placeholderBinding: 'serviceConfig.defaultValue',
-
-  keyPress: function (event) {
-    if (event.keyCode == 13) {
-      return false;
-    }
-  },
-  //Set editDone true for last edited config text field parameter
-  focusOut: function (event) {
-    this.get('serviceConfig').set("editDone", true);
-  },
-  //Set editDone false for all current category config text field parameter
-  focusIn: function (event) {
-    if (!this.get('serviceConfig.isOverridden') && !this.get('serviceConfig.isComparison')) {
-      this.get("parentView.categoryConfigsAll").setEach("editDone", false);
-    }
-  },
-
-  textFieldClassName: function () {
-    if (this.get('serviceConfig.unit')) {
-      return ['input-small'];
-    } else if (this.get('serviceConfig.displayType') === 'principal') {
-      return ['span12'];
-    } else {
-      return ['span9'];
-    }
-  }.property('serviceConfig.displayType', 'serviceConfig.unit')
-
-});
-
-/**
- * Customized input control with Units type specified
- * @type {Em.View}
- */
-App.ServiceConfigTextFieldWithUnit = Ember.View.extend(App.ServiceConfigPopoverSupport, {
-  valueBinding: 'serviceConfig.value',
-  classNames: ['input-append', 'with-unit'],
-  placeholderBinding: 'serviceConfig.defaultValue',
-
-  templateName: require('templates/wizard/controls_service_config_textfield_with_unit')
-});
-
-/**
- * Password control
- * @type {*}
- */
-App.ServiceConfigPasswordField = Ember.TextField.extend({
-
-  serviceConfig: null,
-  type: 'password',
-  attributeBindings:['readOnly'],
-  valueBinding: 'serviceConfig.value',
-  classNames: [ 'span4' ],
-  placeholder: Em.I18n.t('form.item.placeholders.typePassword'),
-
-  template: Ember.Handlebars.compile('{{view view.retypePasswordView}}'),
-
-  keyPress: function (event) {
-    if (event.keyCode == 13) {
-      return false;
-    }
-  },
-
-  retypePasswordView: Ember.TextField.extend({
-    placeholder: Em.I18n.t('form.passwordRetype'),
-    attributeBindings:['readOnly'],
-    type: 'password',
-    classNames: [ 'span4', 'retyped-password' ],
-    keyPress: function (event) {
-      if (event.keyCode == 13) {
-        return false;
-      }
-    },
-    valueBinding: 'parentView.serviceConfig.retypedPassword',
-    readOnly: function () {
-      return !this.get('parentView.serviceConfig.isEditable');
-    }.property('parentView.serviceConfig.isEditable')
-  }),
-
-  readOnly: function () {
-    return !this.get('serviceConfig.isEditable');
-  }.property('serviceConfig.isEditable')
-
-});
-
-/**
- * Textarea control
- * @type {*}
- */
-App.ServiceConfigTextArea = Ember.TextArea.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, {
-
-  valueBinding: 'serviceConfig.value',
-  rows: 4,
-  classNames: ['span9', 'directories']
-});
-
-/**
- * Textarea control for content type
- * @type {*}
- */
-App.ServiceConfigTextAreaContent = Ember.TextArea.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, {
-
-  valueBinding: 'serviceConfig.value',
-  rows: 20,
-  classNames: ['span10']
-});
-
-/**
- * Textarea control with bigger height
- * @type {*}
- */
-App.ServiceConfigBigTextArea = App.ServiceConfigTextArea.extend(App.ServiceConfigCalculateId, {
-  rows: 10
-});
-
-/**
- * Checkbox control
- * @type {*}
- */
-App.ServiceConfigCheckbox = Ember.Checkbox.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, {
-
-  checkedBinding: 'serviceConfig.value',
-
-  disabled: function () {
-    return !this.get('serviceConfig.isEditable');
-  }.property('serviceConfig.isEditable')
-});
-
-App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId, {
-  templateName: require('templates/wizard/controls_service_config_radio_buttons'),
-
-  didInsertElement: function () {
-    // on page render, automatically populate JDBC URLs only for default database settings
-    // so as to not lose the user's customizations on these fields
-    if (['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name'))) {
-      if (/^New\s\w+\sDatabase$/.test(this.get('serviceConfig.value'))) {
-        this.onOptionsChange();
-      } else {
-        this.handleDBConnectionProperty();
-      }
-    }
-  },
-
-  configs: function () {
-    if (this.get('controller.name') == 'mainServiceInfoConfigsController') return this.get('categoryConfigsAll');
-    return this.get('categoryConfigsAll').filterProperty('isObserved', true);
-  }.property('categoryConfigsAll'),
-
-  serviceConfig: null,
-  categoryConfigsAll: null,
-
-  onOptionsChange: function () {
-    // The following if condition will be satisfied only for installer wizard flow
-    if (this.get('configs').length) {
-      var connectionUrl = this.get('connectionUrl');
-      var dbClass = this.get('dbClass');
-      if (connectionUrl) {
-        if (this.get('serviceConfig.serviceName') === 'HIVE') {
-          var hiveDbType = this.get('parentView.serviceConfigs').findProperty('name', 'hive_database_type');
-          switch (this.get('serviceConfig.value')) {
-            case 'New MySQL Database':
-            case 'Existing MySQL Database':
-              connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName') + "?createDatabaseIfNotExist=true");
-              dbClass.set('value', "com.mysql.jdbc.Driver");
-              Em.set(hiveDbType, 'value', 'mysql');
-              break;
-            case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-              connectionUrl.set('value', "jdbc:postgresql://" + this.get('hostName') + ":5432/" + this.get('databaseName'));
-              dbClass.set('value', "org.postgresql.Driver");
-              Em.set(hiveDbType, 'value', 'postgres');
-              break;
-            case 'Existing Oracle Database':
-              connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
-              dbClass.set('value', "oracle.jdbc.driver.OracleDriver");
-              Em.set(hiveDbType, 'value', 'oracle');
-              break;
-            case 'Existing MSSQL Server database with SQL authentication':
-              connectionUrl.set('value', "jdbc:sqlserver://" + this.get('hostName') + ";databaseName=" + this.get('databaseName'));
-              dbClass.set('value', "com.microsoft.sqlserver.jdbc.SQLServerDriver");
-              Em.set(hiveDbType, 'value', 'mssql');
-              break;
-            case 'Existing MSSQL Server database with integrated authentication':
-              connectionUrl.set('value', "jdbc:sqlserver://" + this.get('hostName') + ";databaseName=" + this.get('databaseName') + ";integratedSecurity=true");
-              dbClass.set('value', "com.microsoft.sqlserver.jdbc.SQLServerDriver");
-              Em.set(hiveDbType, 'value', 'mssql');
-              break;
-          }
-          var isNotExistingMySQLServer = this.get('serviceConfig.value') !== 'Existing MSSQL Server database with integrated authentication';
-          this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionUserName').setProperties({
-            isVisible: isNotExistingMySQLServer,
-            isRequired: isNotExistingMySQLServer
-          });
-          this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionPassword').setProperties({
-            isVisible: isNotExistingMySQLServer,
-            isRequired: isNotExistingMySQLServer
-          });
-        } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
-          switch (this.get('serviceConfig.value')) {
-            case 'New Derby Database':
-              connectionUrl.set('value', "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true");
-              dbClass.set('value', "org.apache.derby.jdbc.EmbeddedDriver");
-              break;
-            case 'Existing MySQL Database':
-              connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName'));
-              dbClass.set('value', "com.mysql.jdbc.Driver");
-              break;
-            case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-              connectionUrl.set('value', "jdbc:postgresql://" + this.get('hostName') + ":5432/" + this.get('databaseName'));
-              dbClass.set('value', "org.postgresql.Driver");
-              break;
-            case 'Existing Oracle Database':
-              connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
-              dbClass.set('value', "oracle.jdbc.driver.OracleDriver");
-              break;
-            case 'Existing MSSQL Server database with SQL authentication':
-              connectionUrl.set('value', "jdbc:sqlserver://" + this.get('hostName') + ";databaseName=" + this.get('databaseName'));
-              dbClass.set('value', "com.microsoft.sqlserver.jdbc.SQLServerDriver");
-              break;
-            case 'Existing MSSQL Server database with integrated authentication':
-              connectionUrl.set('value', "jdbc:sqlserver://" + this.get('hostName') + ";databaseName=" + this.get('databaseName') + ";integratedSecurity=true");
-              dbClass.set('value', "com.microsoft.sqlserver.jdbc.SQLServerDriver");
-              break;
-          }
-          isNotExistingMySQLServer = this.get('serviceConfig.value') !== 'Existing MSSQL Server database with integrated authentication';
-          this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.username').setProperties({
-            isVisible: isNotExistingMySQLServer,
-            isRequired: isNotExistingMySQLServer
-          });
-          this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.password').setProperties({
-            isVisible: isNotExistingMySQLServer,
-            isRequired: isNotExistingMySQLServer
-          });
-        }
-        connectionUrl.set('defaultValue', connectionUrl.get('value'));
-      }
-    }
-  }.observes('databaseName', 'hostName'),
-
-  nameBinding: 'serviceConfig.radioName',
-
-  databaseNameProperty: function () {
-    switch (this.get('serviceConfig.serviceName')) {
-      case 'HIVE':
-        return this.get('categoryConfigsAll').findProperty('name', 'ambari.hive.db.schema.name');
-      case 'OOZIE':
-        return this.get('categoryConfigsAll').findProperty('name', 'oozie.db.schema.name');
-      default:
-        return null;
-    }
-  }.property('serviceConfig.serviceName'),
-
-  databaseName: function () {
-    return this.get('databaseNameProperty.value');
-  }.property('databaseNameProperty.value'),
-
-  hostNameProperty: function () {
-    var value = this.get('serviceConfig.value');
-    var returnValue;
-    var hostname;
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      switch (value) {
-        case 'New MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_ambari_host');
-          break;
-        case 'Existing MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host');
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_postgresql_host');
-          break;
-        case 'Existing Oracle Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host');
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mssql_server_host');
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mssql_server_2_host');
-          break;
-      }
-      if (hostname) {
-        returnValue = hostname;
-      } else {
-        returnValue = this.get('categoryConfigsAll').findProperty('name', 'hive_hostname');
-      }
-    } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
-      switch (value) {
-        case 'New Derby Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_ambari_host');
-          break;
-        case 'Existing MySQL Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host');
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_postgresql_host');
-          break;
-        case 'Existing Oracle Database':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host');
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mssql_server_host');
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mssql_server_2_host');
-          break;
-      }
-      if (hostname) {
-        returnValue = hostname;
-      } else {
-        returnValue = this.get('categoryConfigsAll').findProperty('name', 'oozie_hostname');
-      }
-    }
-    return returnValue;
-  }.property('serviceConfig.serviceName', 'serviceConfig.value'),
-
-  hostName: function () {
-    return this.get('hostNameProperty.value');
-  }.property('hostNameProperty.value'),
-
-  connectionUrl: function () {
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      return this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionURL');
-    } else {
-      return this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.url');
-    }
-  }.property('serviceConfig.serviceName'),
-
-  dbClass: function () {
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      return this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionDriverName');
-    } else {
-      return this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.driver');
-    }
-  }.property('serviceConfig.serviceName'),
-
-  /**
-   * `Observer` that add <code>additionalView</code> to <code>App.ServiceConfigProperty</code>
-   * that responsible for (if existing db selected)
-   * 1. checking database connection
-   * 2. showing jdbc driver setup warning msg.
-   *
-   * @method handleDBConnectionProperty
-   **/
-  handleDBConnectionProperty: function() {
-    var handledProperties = ['oozie_database', 'hive_database'];
-    var currentValue = this.get('serviceConfig.value');
-    var databases = /MySQL|PostgreSQL|Oracle|Derby|MSSQL/gi;
-    var currentDB = currentValue.match(databases)[0];
-    var databasesTypes = /MySQL|PostgreS|Oracle|Derby|MSSQL/gi;
-    var currentDBType = currentValue.match(databasesTypes)[0];
-    var existingDatabase = /existing/gi.test(currentValue);
-    // db connection check button show up if existed db selected
-    var propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('displayName', 'Database URL');
-    if (currentDB && existingDatabase) {
-      if (handledProperties.contains(this.get('serviceConfig.name'))) {
-        if (propertyAppendTo1) propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
-      }
-    } else {
-      propertyAppendTo1.set('additionalView', null);
-    }
-    // warning msg under database type radio buttons, to warn the user to setup jdbc driver if existed db selected
-    var propertyHive = this.get('categoryConfigsAll').findProperty('displayName', 'Hive Database');
-    var propertyOozie = this.get('categoryConfigsAll').findProperty('displayName', 'Oozie Database');
-    var propertyAppendTo2 = propertyHive ? propertyHive : propertyOozie;
-    if (currentDB && existingDatabase) {
-      if (handledProperties.contains(this.get('serviceConfig.name'))) {
-        if (propertyAppendTo2) {
-          propertyAppendTo2.set('additionalView', Ember.View.extend({
-            template: Ember.Handlebars.compile('<div class="alert">{{{view.message}}}</div>'),
-            message: Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(currentDBType.toLowerCase(), currentDBType.toLowerCase())
-          }));
-        }
-      }
-    } else {
-      propertyAppendTo2.set('additionalView', null);
-    }
-  }.observes('serviceConfig.value'),
-
-  optionsBinding: 'serviceConfig.options'
-});
-
-App.ServiceConfigRadioButton = Ember.Checkbox.extend({
-  tagName: 'input',
-  attributeBindings: ['type', 'name', 'value', 'checked', 'disabled'],
-  checked: false,
-  type: 'radio',
-  name: null,
-  value: null,
-
-  didInsertElement: function () {
-    console.debug('App.ServiceConfigRadioButton.didInsertElement');
-    if (this.get('parentView.serviceConfig.value') === this.get('value')) {
-      console.debug(this.get('name') + ":" + this.get('value') + ' is checked');
-      this.set('checked', true);
-    }
-  },
-
-  click: function () {
-    this.set('checked', true);
-    console.debug('App.ServiceConfigRadioButton.click');
-    this.onChecked();
-  },
-
-  onChecked: function () {
-    // Wrapping the call with Ember.run.next prevents a problem where setting isVisible on component
-    // causes JS error due to re-rendering.  For example, this occurs when switching the Config Group
-    // in Service Config page
-    Em.run.next(this, function() {
-      console.debug('App.ServiceConfigRadioButton.onChecked');
-      this.set('parentView.serviceConfig.value', this.get('value'));
-      var components = this.get('parentView.serviceConfig.options');
-      if (components) {
-        components.forEach(function (_component) {
-          if (_component.foreignKeys) {
-            _component.foreignKeys.forEach(function (_componentName) {
-              if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) {
-                var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName);
-                component.set('isVisible', _component.displayName === this.get('value'));
-              }
-            }, this);
-          }
-        }, this);
-      }
-    });
-  }.observes('checked'),
-
-  disabled: function () {
-    return !this.get('parentView.serviceConfig.isEditable') ||
-      !['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name')) && /^New\s\w+\sDatabase$/.test(this.get('value'));
-  }.property('parentView.serviceConfig.isEditable')
-});
-
-App.ServiceConfigComboBox = Ember.Select.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, {
-  contentBinding: 'serviceConfig.options',
-  selectionBinding: 'serviceConfig.value',
-  placeholderBinding: 'serviceConfig.defaultValue',
-  classNames: [ 'span3' ]
-});
-
-
-/**
- * Base component for host config with popover support
- */
-App.ServiceConfigHostPopoverSupport = Ember.Mixin.create({
-
-  /**
-   * Config object. It will instance of App.ServiceConfigProperty
-   */
-  serviceConfig: null,
-
-  didInsertElement: function () {
-    App.popover(this.$(), {
-      title: this.get('serviceConfig.displayName'),
-      content: this.get('serviceConfig.description'),
-      placement: 'right',
-      trigger: 'hover'
-    });
-  }
-});
-
-/**
- * Master host component.
- * Show hostname without ability to edit it
- * @type {*}
- */
-App.ServiceConfigMasterHostView = Ember.View.extend(App.ServiceConfigHostPopoverSupport, App.ServiceConfigCalculateId, {
-
-  classNames: ['master-host', 'span6'],
-  valueBinding: 'serviceConfig.value',
-
-  template: Ember.Handlebars.compile('{{value}}')
-
-});
-
-/**
- * text field property view that enables possibility
- * for check connectio
- * @type {*}
- */
-App.checkConnectionView = App.ServiceConfigTextField.extend({
-  didInsertElement: function() {
-    this._super();
-    var kdc = this.get('categoryConfigsAll').findProperty('name', 'kdc_type');
-    var propertyAppendTo = this.get('categoryConfigsAll').findProperty('name', 'admin_password');
-    if (propertyAppendTo) propertyAppendTo.set('additionalView', App.CheckDBConnectionView.extend({databaseName: kdc && kdc.get('value')}));
-  }
-});
-
-/**
- * Show value as plain label in italics
- * @type {*}
- */
-App.ServiceConfigLabelView = Ember.View.extend(App.ServiceConfigHostPopoverSupport, App.ServiceConfigCalculateId, {
-
-  classNames: ['master-host', 'span6'],
-  valueBinding: 'serviceConfig.value',
-
-  template: Ember.Handlebars.compile('<i>{{view.value}}</i>')
-});
-
-/**
- * Base component to display Multiple hosts
- * @type {*}
- */
-App.ServiceConfigMultipleHostsDisplay = Ember.Mixin.create(App.ServiceConfigHostPopoverSupport, App.ServiceConfigCalculateId, {
-
-  hasNoHosts: function () {
-    console.log('view', this.get('viewName')); //to know which View cause errors
-    console.log('controller', this.get('controller').name); //should be slaveComponentGroupsController
-    if (!this.get('value')) {
-      return true;
-    }
-    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 () {
-    var len = this.get('value').length;
-    if (len > 2) {
-      return Em.I18n.t('installer.controls.serviceConfigMultipleHosts.others').format(len - 1);
-    } else {
-      return Em.I18n.t('installer.controls.serviceConfigMultipleHosts.other');
-    }
-  }.property('value')
-
-});
-
-
-/**
- * Multiple master host component.
- * Show hostnames without ability to edit it
- * @type {*}
- */
-App.ServiceConfigMasterHostsView = Ember.View.extend(App.ServiceConfigMultipleHostsDisplay, App.ServiceConfigCalculateId, {
-
-  viewName: "serviceConfigMasterHostsView",
-  valueBinding: 'serviceConfig.value',
-
-  classNames: ['master-hosts', 'span6'],
-  templateName: require('templates/wizard/master_hosts'),
-
-  /**
-   * Onclick handler for link
-   */
-  showHosts: function () {
-    var serviceConfig = this.get('serviceConfig');
-    App.ModalPopup.show({
-      header: Em.I18n.t('installer.controls.serviceConfigMasterHosts.header').format(serviceConfig.category),
-      bodyClass: Ember.View.extend({
-        serviceConfig: serviceConfig,
-        templateName: require('templates/wizard/master_hosts_popup')
-      }),
-      secondary: null
-    });
-  }
-
-});
-
-/**
- * Show tabs list for slave hosts
- * @type {*}
- */
-App.SlaveComponentGroupsMenu = Em.CollectionView.extend(App.ServiceConfigCalculateId, {
-
-  content: function () {
-    return this.get('controller.componentGroups');
-  }.property('controller.componentGroups'),
-
-  tagName: 'ul',
-  classNames: ["nav", "nav-tabs"],
-
-  itemViewClass: Em.View.extend({
-    classNameBindings: ["active"],
-
-    active: function () {
-      return this.get('content.active');
-    }.property('content.active'),
-
-    errorCount: function () {
-      return this.get('content.properties').filterProperty('isValid', false).filterProperty('isVisible', true).get('length');
-    }.property('content.properties.@each.isValid', 'content.properties.@each.isVisible'),
-
-    templateName: require('templates/wizard/controls_slave_component_groups_menu')
-  })
-
-});
-
-/**
- * <code>Add group</code> button
- * @type {*}
- */
-App.AddSlaveComponentGroupButton = Ember.View.extend(App.ServiceConfigCalculateId, {
-
-  tagName: 'span',
-  slaveComponentName: null,
-
-  didInsertElement: function () {
-    App.popover(this.$(), {
-      title: Em.I18n.t('installer.controls.addSlaveComponentGroupButton.title').format(this.get('slaveComponentName')),
-      content: Em.I18n.t('installer.controls.addSlaveComponentGroupButton.content').format(this.get('slaveComponentName'), this.get('slaveComponentName'), this.get('slaveComponentName')),
-      placement: 'right',
-      trigger: 'hover'
-    });
-  }
-
-});
-
-/**
- * Multiple Slave Hosts component
- * @type {*}
- */
-App.ServiceConfigSlaveHostsView = Ember.View.extend(App.ServiceConfigMultipleHostsDisplay, App.ServiceConfigCalculateId, {
-
-  viewName: 'serviceConfigSlaveHostsView',
-
-  classNames: ['slave-hosts', 'span6'],
-
-  valueBinding: 'serviceConfig.value',
-
-  templateName: require('templates/wizard/slave_hosts'),
-
-  /**
-   * Onclick handler for link
-   */
-  showHosts: function () {
-    var serviceConfig = this.get('serviceConfig');
-    App.ModalPopup.show({
-      header: Em.I18n.t('installer.controls.serviceConfigMasterHosts.header').format(serviceConfig.category),
-      bodyClass: Ember.View.extend({
-        serviceConfig: serviceConfig,
-        templateName: require('templates/wizard/master_hosts_popup')
-      }),
-      secondary: null
-    });
-  }
-
-});
-
-/**
- * properties for present active slave group
- * @type {*}
- */
-App.SlaveGroupPropertiesView = Ember.View.extend(App.ServiceConfigCalculateId, {
-
-  viewName: 'serviceConfigSlaveHostsView',
-
-  group: function () {
-    return this.get('controller.activeGroup');
-  }.property('controller.activeGroup'),
-
-  groupConfigs: function () {
-    console.log("************************************************************************");
-    console.log("The value of group is: " + this.get('group'));
-    console.log("************************************************************************");
-    return this.get('group.properties');
-  }.property('group.properties.@each').cacheable(),
-
-  errorCount: function () {
-    return this.get('group.properties').filterProperty('isValid', false).filterProperty('isVisible', true).get('length');
-  }.property('configs.@each.isValid', 'configs.@each.isVisible')
-});
-
-/**
- * DropDown component for <code>select hosts for groups</code> popup
- * @type {*}
- */
-App.SlaveComponentDropDownGroupView = Ember.View.extend(App.ServiceConfigCalculateId, {
-
-  viewName: "slaveComponentDropDownGroupView",
-
-  /**
-   * On change handler for <code>select hosts for groups</code> popup
-   * @param event
-   */
-  changeGroup: function (event) {
-    var host = this.get('content');
-    var groupName = $('#' + this.get('elementId') + ' select').val();
-    this.get('controller').changeHostGroup(host, groupName);
-  },
-
-  optionTag: Ember.View.extend({
-
-    /**
-     * Whether current value(OptionTag value) equals to host value(assigned to SlaveComponentDropDownGroupView.content)
-     */
-    selected: function () {
-      return this.get('parentView.content.group') === this.get('content');
-    }.property('content')
-  })
-});
-
-/**
- * Show info about current group
- * @type {*}
- */
-App.SlaveComponentChangeGroupNameView = Ember.View.extend(App.ServiceConfigCalculateId, {
-
-  contentBinding: 'controller.activeGroup',
-  classNames: ['control-group'],
-  classNameBindings: 'error',
-  error: false,
-  setError: function () {
-    this.set('error', false);
-  }.observes('controller.activeGroup'),
-  errorMessage: function () {
-    return this.get('error') ? Em.I18n.t('installer.controls.slaveComponentChangeGroupName.error') : '';
-  }.property('error'),
-
-  /**
-   * Onclick handler for saving updated group name
-   * @param event
-   */
-  changeGroupName: function (event) {
-    var inputVal = $('#' + this.get('elementId') + ' input[type="text"]').val();
-    if (inputVal !== this.get('content.name')) {
-      var result = this.get('controller').changeSlaveGroupName(this.get('content'), inputVal);
-      this.set('error', result);
-    }
-  }
-});
-/**
- * View for testing connection to database.
- **/
-App.CheckDBConnectionView = Ember.View.extend({
-  templateName: require('templates/common/form/check_db_connection'),
-  /** @property {string} btnCaption - text for button **/
-  btnCaption: Em.I18n.t('services.service.config.database.btn.idle'),
-  /** @property {string} responseCaption - text for status link **/
-  responseCaption: null,
-  /** @property {boolean} isConnecting - is request to server activated **/
-  isConnecting: false,
-  /** @property {boolean} isValidationPassed - check validation for required fields **/
-  isValidationPassed: null,
-  /** @property {string} databaseName- name of current database **/
-  databaseName: null,
-  /** @property {boolean} isRequestResolved - check for finished request to server **/
-  isRequestResolved: false,
-  /** @property {boolean} isConnectionSuccess - check for successful connection to database **/
-  isConnectionSuccess: null,
-  /** @property {string} responseFromServer - message from server response **/
-  responseFromServer: null,
-  /** @property {Object} ambariRequiredProperties - properties that need for custom action request **/
-  ambariRequiredProperties: null,
-  /** @property {Number} currentRequestId - current custom action request id **/
-  currentRequestId: null,
-  /** @property {Number} currentTaskId - current custom action task id **/
-  currentTaskId: null,
-  /** @property {jQuery.Deferred} request - current $.ajax request **/
-  request: null,
-  /** @property {Number} pollInterval - timeout interval for ajax polling **/
-  pollInterval: 3000,
-  /** @property {string} hostNameProperty - host name property based on service and database names **/
-  hostNameProperty: function() {
-    if (!/wizard/i.test(this.get('controller.name')) && this.get('parentView.service.serviceName') === 'HIVE') {
-      return this.get('parentView.service.serviceName').toLowerCase() + '_hostname';
-    } else if (this.get('parentView.service.serviceName') === 'KERBEROS') {
-      return 'kdc_host';
-    }
-    return '{0}_existing_{1}_host'.format(this.get('parentView.service.serviceName').toLowerCase(), this.get('databaseName').toLowerCase());
-  }.property('databaseName'),
-  /** @property {boolean} isBtnDisabled - disable button on failed validation or active request **/
-  isBtnDisabled: function() {
-    return !this.get('isValidationPassed') || this.get('isConnecting');
-  }.property('isValidationPassed', 'isConnecting'),
-  /** @property {object} requiredProperties - properties that necessary for database connection **/
-  requiredProperties: function() {
-    var propertiesMap = {
-      OOZIE: ['oozie.db.schema.name','oozie.service.JPAService.jdbc.username','oozie.service.JPAService.jdbc.password','oozie.service.JPAService.jdbc.driver','oozie.service.JPAService.jdbc.url'],
-      HIVE: ['ambari.hive.db.schema.name','javax.jdo.option.ConnectionUserName','javax.jdo.option.ConnectionPassword','javax.jdo.option.ConnectionDriverName','javax.jdo.option.ConnectionURL'],
-      KERBEROS: ['kdc_host']
-    };
-    return propertiesMap[this.get('parentView.service.serviceName')];
-  }.property(),
-  /** @property {Object} propertiesPattern - check pattern according to type of connection properties **/
-  propertiesPattern: function() {
-    var patterns = {
-      db_connection_url: /jdbc\.url|connectionurl|kdc_host/ig
-    };
-    if (this.get('parentView.service.serviceName') != "KERBEROS") {
-      patterns.user_name = /(username|dblogin)$/ig;
-      patterns.user_passwd = /(dbpassword|password)$/ig;
-    }
-    return patterns;
-  }.property('parentView.service.serviceName'),
-  /** @property {String} masterHostName - host name location of Master Component related to Service **/
-  masterHostName: function() {
-    var serviceMasterMap = {
-      'OOZIE': 'oozieserver_host',
-      'HDFS': 'hadoop_host',
-      'HIVE': 'hive_ambari_host',
-      'KERBEROS': 'kdc_host'
-    };
-    return this.get('parentView.categoryConfigsAll').findProperty('name', serviceMasterMap[this.get('parentView.service.serviceName')]).get('value');
-  }.property('parentView.service.serviceName', 'parentView.categoryConfigsAll.@each.value'),
-  /** @property {Object} connectionProperties - service specific config values mapped for custom action request **/
-  connectionProperties: function() {
-    var propObj = {};
-    for (var key in this.get('propertiesPattern')) {
-      propObj[key] = this.getConnectionProperty(this.get('propertiesPattern')[key]);
-    }
-    return propObj;
-  }.property('parentView.categoryConfigsAll.@each.value'),
-  /**
-   * Properties that stores in local storage used for handling
-   * last success connection.
-   *
-   * @property {Object} preparedDBProperties
-   **/
-  preparedDBProperties: function() {
-    var propObj = {};
-    for (var key in this.get('propertiesPattern')) {
-      var propName = this.getConnectionProperty(this.get('propertiesPattern')[key], true);
-      propObj[propName] = this.get('parentView.categoryConfigsAll').findProperty('name', propName).get('value');
-    }
-    return propObj;
-  }.property(),
-  /** Check validation and load ambari properties **/
-  didInsertElement: function() {
-    var kdc = this.get('parentView.categoryConfigsAll').findProperty('name', 'kdc_type');
-    if (kdc) {
-      var name = kdc.get('value') == 'Existing MIT KDC' ? 'KDC' : 'AD';
-      App.popover(this.$(), {
-        title: Em.I18n.t('services.service.config.database.btn.idle'),
-        content: Em.I18n.t('installer.controls.checkConnection.popover').format(name),
-        placement: 'right',
-        trigger: 'hover'
-    });
-    }
-    this.handlePropertiesValidation();
-    this.getAmbariProperties();
-  },
-  /** On view destroy **/
-  willDestroyElement: function() {
-    this.set('isConnecting', false);
-    this._super();
-  },
-  /**
-   * Observer that take care about enabling/disabling button based on required properties validation.
-   *
-   * @method handlePropertiesValidation
-   **/
-  handlePropertiesValidation: function() {
-    this.restore();
-    var isValid = true;
-    var properties = [].concat(this.get('requiredProperties'));
-    properties.push(this.get('hostNameProperty'));
-    properties.forEach(function(propertyName) {
-      var property = this.get('parentView.categoryConfigsAll').findProperty('name', propertyName);
-      if(property && !property.get('isValid')) isValid = false;
-    }, this);
-    this.set('isValidationPassed', isValid);
-  }.observes('parentView.categoryConfigsAll.@each.isValid', 'parentView.categoryConfigsAll.@each.value', 'databaseName'),
-
-  getConnectionProperty: function(regexp, isGetName) {
-    var _this = this;
-    var propertyName = _this.get('requiredProperties').filter(function(item) {
-      return regexp.test(item);
-    })[0];
-    return (isGetName) ? propertyName : _this.get('parentView.categoryConfigsAll').findProperty('name', propertyName).get('value');
-  },
-  /**
-   * Set up ambari properties required for custom action request
-   *
-   * @method getAmbariProperties
-   **/
-  getAmbariProperties: function() {
-    var clusterController = App.router.get('clusterController');
-    var _this = this;
-    if (!App.isEmptyObject(App.db.get('tmp', 'ambariProperties')) && !this.get('ambariProperties')) {
-      this.set('ambariProperties', App.db.get('tmp', 'ambariProperties'));
-      return;
-    }
-    if (App.isEmptyObject(clusterController.get('ambariProperties'))) {
-      clusterController.loadAmbariProperties().done(function(data) {
-        _this.formatAmbariProperties(data.RootServiceComponents.properties);
-      });
-    } else {
-      this.formatAmbariProperties(clusterController.get('ambariProperties'));
-    }
-  },
-
-  formatAmbariProperties: function(properties) {
-    var defaults = {
-      threshold: "60",
-      ambari_server_host: location.hostname,
-      check_execute_list : "db_connection_check"
-    };
-    var properties = App.permit(properties, ['jdk.name','jdk_location','java.home']);
-    var renameKey = function(oldKey, newKey) {
-      if (properties[oldKey]) {
-        defaults[newKey] = properties[oldKey];
-        delete properties[oldKey];
-      }
-    };
-    renameKey('java.home', 'java_home');
-    renameKey('jdk.name', 'jdk_name');
-    $.extend(properties, defaults);
-    App.db.set('tmp', 'ambariProperties', properties);
-    this.set('ambariProperties', properties);
-  },
-  /**
-   * `Action` method for starting connect to current database.
-   *
-   * @method connectToDatabase
-   **/
-  connectToDatabase: function() {
-    if (this.get('isBtnDisabled')) return;
-    this.set('isRequestResolved', false);
-    App.db.set('tmp', this.get('parentView.service.serviceName') + '_connection', {});
-    this.setConnectingStatus(true);
-    if (App.get('testMode')) {
-      this.startPolling();
-    } else {
-      this.runCheckConnection();
-    }
-  },
-
-  /**
-   * runs check connections methods depending on service
-   * @return {void}
-   * @method runCheckConnection
-   */
-  runCheckConnection: function() {
-    if (this.get('parentView.service.serviceName') === 'KERBEROS') {
-      this.runKDCCheck();
-    } else {
-      this.createCustomAction();
-    }
-  },
-
-  /**
-   * send ajax request to perforn kdc host check
-   * @return {App.ajax}
-   * @method runKDCCheck
-   */
-  runKDCCheck: function() {
-    return App.ajax.send({
-      name: 'admin.kerberos_security.test_connection',
-      sender: this,
-      data: {
-        kdcHostname: this.get('masterHostName')
-      },
-      success: 'onRunKDCCheckSuccess',
-      error: 'onCreateActionError'
-    });
-  },
-
-  /**
-   *
-   * @param data
-   */
-  onRunKDCCheckSuccess: function(data) {
-    var statusCode = {
-      success: 'REACHABLE',
-      failed: 'UNREACHABLE'
-    };
-    if (data == statusCode['success']) {
-      this.setResponseStatus('success');
-    } else {
-      this.setResponseStatus('failed');
-    }
-    this.set('responseFromServer', data);
-  },
-
-  /**
-   * Run custom action for database connection.
-   *
-   * @method createCustomAction
-   **/
-  createCustomAction: function() {
-    var dbName = this.get('databaseName').toLowerCase() === 'postgresql' ? 'postgres' : this.get('databaseName').toLowerCase();
-    var params = $.extend(true, {}, { db_name: dbName }, this.get('connectionProperties'), this.get('ambariProperties'));
-    App.ajax.send({
-      name: 'custom_action.create',
-      sender: this,
-      data: {
-        requestInfo: {
-          parameters: params
-        },
-        filteredHosts: [this.get('masterHostName')]
-      },
-      success: 'onCreateActionSuccess',
-      error: 'onCreateActionError'
-    });
-  },
-  /**
-   * Run updater if task is created successfully.
-   *
-   * @method onConnectActionS
-   **/
-  onCreateActionSuccess: function(data) {
-    this.set('currentRequestId', data.Requests.id);
-    App.ajax.send({
-      name: 'custom_action.request',
-      sender: this,
-      data: {
-        requestId: this.get('currentRequestId')
-      },
-      success: 'setCurrentTaskId'
-    });
-  },
-
-  setCurrentTaskId: function(data) {
-    this.set('currentTaskId', data.items[0].Tasks.id);
-    this.startPolling();
-  },
-
-  startPolling: function() {
-    if (this.get('isConnecting'))
-      this.getTaskInfo();
-  },
-
-  getTaskInfo: function() {
-    var request = App.ajax.send({
-      name: 'custom_action.request',
-      sender: this,
-      data: {
-        requestId: this.get('currentRequestId'),
-        taskId: this.get('currentTaskId')
-      },
-      success: 'getTaskInfoSuccess'
-    });
-    this.set('request', request);
-  },
-
-  getTaskInfoSuccess: function(data) {
-    var task = data.Tasks;
-    this.set('responseFromServer', {
-      stderr: task.stderr,
-      stdout: task.stdout
-    });
-    if (task.status === 'COMPLETED') {
-      var structuredOut = task.structured_out.db_connection_check;
-      if (structuredOut.exit_code != 0) {
-        this.set('responseFromServer', {
-          stderr: task.stderr,
-          stdout: task.stdout,
-          structuredOut: structuredOut.message
-        });
-        this.setResponseStatus('failed');
-      } else {
-        App.db.set('tmp', this.get('parentView.service.serviceName') + '_connection', this.get('preparedDBProperties'));
-        this.setResponseStatus('success');
-      }
-    }
-    if (task.status === 'FAILED') {
-      this.setResponseStatus('failed');
-    }
-    if (/PENDING|QUEUED|IN_PROGRESS/.test(task.status)) {
-      Em.run.later(this, function() {
-        this.startPolling();
-      }, this.get('pollInterval'));
-    }
-  },
-
-  onCreateActionError: function(jqXhr, status, errorMessage) {
-    this.setResponseStatus('failed');
-    this.set('responseFromServer', errorMessage);
-  },
-
-  setResponseStatus: function(isSuccess) {
-    var isSuccess = isSuccess == 'success';
-    this.setConnectingStatus(false);
-    this.set('responseCaption', isSuccess ? Em.I18n.t('services.service.config.database.connection.success') : Em.I18n.t('services.service.config.database.connection.failed'));
-    this.set('isConnectionSuccess', isSuccess);
-    this.set('isRequestResolved', true);
-  },
-  /**
-   * Switch captions and statuses for active/non-active request.
-   *
-   * @method setConnectionStatus
-   * @param {Boolean} [active]
-   */
-  setConnectingStatus: function(active) {
-    if (active) {
-      this.set('responseCaption', Em.I18n.t('services.service.config.database.connection.inProgress'));
-    }
-    this.set('controller.testConnectionInProgress', !!active);
-    this.set('btnCaption', !!active ? Em.I18n.t('services.service.config.database.btn.connecting') : Em.I18n.t('services.service.config.database.btn.idle'));
-    this.set('isConnecting', !!active);
-  },
-  /**
-   * Set view to init status.
-   *
-   * @method restore
-   **/
-  restore: function() {
-    if (this.get('request')) {
-      this.get('request').abort();
-      this.set('request', null);
-    }
-    this.set('responseCaption', null);
-    this.set('responseFromServer', null);
-    this.setConnectingStatus(false);
-    this.set('isRequestResolved', false);
-  },
-  /**
-   * `Action` method for showing response from server in popup.
-   *
-   * @method showLogsPopup
-   **/
-  showLogsPopup: function() {
-    if (this.get('isConnectionSuccess')) return;
-    var _this = this;
-    var popup = App.showAlertPopup('Error: {0} connection'.format(this.get('databaseName')));
-    if (typeof this.get('responseFromServer') == 'object') {
-      popup.set('bodyClass', Em.View.extend({
-        templateName: require('templates/common/error_log_body'),
-        openedTask: _this.get('responseFromServer')
-      }));
-    } else {
-      popup.set('body', this.get('responseFromServer'));
-    }
-    return popup;
-  }
-});
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/11efa2f5/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 7aeae36..1ee587e 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -531,4 +531,54 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(item.get('status')).to.equal('PENDING');
     });
   });
+
+  describe("#prepareRepoForSaving()", function () {
+    it("prepare date for saving", function () {
+      var repo = Em.Object.create({
+        operatingSystems: [
+          Em.Object.create({
+            osType: "redhat6",
+            isDisabled: Ember.computed.not('isSelected'),
+            repositories: [Em.Object.create({
+                "baseUrl": "111121",
+                "repoId": "HDP-2.2",
+                "repoName": "HDP",
+                hasError: false
+            }),
+              Em.Object.create({
+                "baseUrl": "1",
+                "repoId": "HDP-UTILS-1.1.0.20",
+                "repoName": "HDP-UTILS",
+                hasError: false
+              })]
+           })
+        ]
+      });
+      var result = {
+        "operating_systems": [
+          {
+            "OperatingSystems": {
+              "os_type": "redhat6"
+            },
+            "repositories": [
+              {
+                "Repositories": {
+                  "base_url": "111121",
+                  "repo_id": "HDP-2.2",
+                  "repo_name": "HDP"
+                }
+              },
+              {
+                "Repositories": {
+                  "base_url": "1",
+                  "repo_id": "HDP-UTILS-1.1.0.20",
+                  "repo_name": "HDP-UTILS"
+                }
+              }
+            ]
+          }
+        ]}
+      expect(controller.prepareRepoForSaving(repo)).to.eql(result);
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/11efa2f5/ambari-web/test/views/common/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js
new file mode 100644
index 0000000..7828f83
--- /dev/null
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -0,0 +1,606 @@
+/**
+ * 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');
+require('views/common/controls_view');
+
+describe('App.ServiceConfigRadioButtons', function () {
+
+  describe('#didInsertElement', function () {
+
+    var view = App.ServiceConfigRadioButtons.create({
+        categoryConfigsAll: [],
+        controller: Em.Object.create({
+          wizardController: Em.Object.create({})
+        }),
+        serviceConfig: Em.Object.create({
+          value: null
+        })
+      }),
+      cases = [
+        {
+          wizardControllerName: 'addServiceController',
+          serviceConfigValue: 'New MySQL Database',
+          onOptionsChangeCalledTwice: true,
+          handleDBConnectionPropertyCalledTwice: false,
+          title: 'Add Service Wizard, New MySQL Database'
+        },
+        {
+          wizardControllerName: 'addServiceController',
+          serviceConfigValue: 'Existing MySQL Database',
+          onOptionsChangeCalledTwice: false,
+          handleDBConnectionPropertyCalledTwice: true,
+          title: 'Add Service Wizard, Existing MySQL Database'
+        },
+        {
+          wizardControllerName: 'installerController',
+          serviceConfigValue: 'New MySQL Database',
+          onOptionsChangeCalledTwice: true,
+          handleDBConnectionPropertyCalledTwice: false,
+          title: 'Install Wizard, New MySQL Database'
+        },
+        {
+          wizardControllerName: 'installerController',
+          serviceConfigValue: 'Existing MySQL Database',
+          onOptionsChangeCalledTwice: false,
+          handleDBConnectionPropertyCalledTwice: true,
+          title: 'Install Wizard, Existing MySQL Database'
+        },
+        {
+          wizardControllerName: null,
+          serviceConfigValue: null,
+          onOptionsChangeCalledTwice: false,
+          handleDBConnectionPropertyCalledTwice: false,
+          title: 'Service Configs Page'
+        }
+      ];
+
+    beforeEach(function () {
+      sinon.stub(view, 'onOptionsChange', Em.K);
+      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
+    });
+
+    afterEach(function () {
+      view.onOptionsChange.restore();
+      view.handleDBConnectionProperty.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        view.set('controller.wizardController.name', item.wizardControllerName);
+        view.set('serviceConfig.value', item.serviceConfigValue);
+        view.didInsertElement();
+        expect(view.onOptionsChange.calledTwice).to.equal(item.onOptionsChangeCalledTwice);
+        expect(view.handleDBConnectionProperty.calledTwice).to.equal(item.handleDBConnectionPropertyCalledTwice);
+      });
+    });
+
+  });
+
+  describe('#databaseNameProperty', function () {
+
+    var view = App.ServiceConfigRadioButtons.create({
+        serviceConfig: Em.Object.create(),
+        categoryConfigsAll: [
+          {
+            name: 'ambari.hive.db.schema.name',
+            value: 'db0'
+          },
+          {
+            name: 'oozie.db.schema.name',
+            value: 'db2'
+          }
+        ]
+      }),
+      cases = [
+        {
+          serviceName: 'HIVE',
+          value: 'db0'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'db2'
+        }
+      ];
+
+    cases.forEach(function (item) {
+      it(item.serviceName, function () {
+        view.set('serviceConfig.serviceName', item.serviceName);
+        expect(view.get('databaseNameProperty.value')).to.equal(item.value);
+        expect(view.get('databaseName')).to.equal(item.value);
+      });
+    });
+
+    it('default case', function () {
+      view.set('serviceConfig.serviceName', 'YARN');
+      expect(view.get('databaseNameProperty')).to.be.null;
+      expect(view.get('databaseName')).to.be.null;
+    });
+
+  });
+
+  describe('#hostNameProperty', function () {
+
+    var view = App.ServiceConfigRadioButtons.create({
+        serviceConfig: Em.Object.create(),
+        categoryConfigsAll: [
+          {
+            name: 'hive_ambari_host',
+            value: 'h0'
+          },
+          {
+            name: 'hive_existing_mysql_host',
+            value: 'h1'
+          },
+          {
+            name: 'hive_existing_postgresql_host',
+            value: 'h2'
+          },
+          {
+            name: 'hive_existing_oracle_host',
+            value: 'h3'
+          },
+          {
+            name: 'hive_existing_mssql_server_host',
+            value: 'h4'
+          },
+          {
+            name: 'hive_existing_mssql_server_2_host',
+            value: 'h5'
+          },
+          {
+            name: 'hive_hostname',
+            value: 'h6'
+          },
+          {
+            name: 'oozie_ambari_host',
+            value: 'h10'
+          },
+          {
+            name: 'oozie_existing_mysql_host',
+            value: 'h11'
+          },
+          {
+            name: 'oozie_existing_postgresql_host',
+            value: 'h12'
+          },
+          {
+            name: 'oozie_existing_oracle_host',
+            value: 'h13'
+          },
+          {
+            name: 'oozie_existing_mssql_server_host',
+            value: 'h14'
+          },
+          {
+            name: 'oozie_existing_mssql_server_2_host',
+            value: 'h15'
+          },
+          {
+            name: 'oozie_hostname',
+            value: 'h16'
+          }
+        ]
+      }),
+      cases = [
+        {
+          serviceName: 'HIVE',
+          value: 'New MySQL Database',
+          expected: 'h0'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'Existing MySQL Database',
+          expected: 'h1'
+        },
+        {
+          serviceName: 'HIVE',
+          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
+          expected: 'h2'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'Existing Oracle Database',
+          expected: 'h3'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'Existing MSSQL Server database with SQL authentication',
+          expected: 'h4'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'Existing MSSQL Server database with integrated authentication',
+          expected: 'h5'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'default case',
+          expected: 'h6'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'New Derby Database',
+          expected: 'h10'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'Existing MySQL Database',
+          expected: 'h11'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
+          expected: 'h12'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'Existing Oracle Database',
+          expected: 'h13'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'Existing MSSQL Server database with SQL authentication',
+          expected: 'h14'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'Existing MSSQL Server database with integrated authentication',
+          expected: 'h15'
+        },
+        {
+          serviceName: 'OOZIE',
+          value: 'default case',
+          expected: 'h16'
+        }
+      ];
+
+    before(function () {
+      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
+    });
+
+    after(function () {
+      view.handleDBConnectionProperty.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.serviceName + ', ' + item.value, function () {
+        view.get('serviceConfig').setProperties({
+          serviceName: item.serviceName,
+          value: item.value
+        });
+        expect(view.get('hostNameProperty.value')).to.equal(item.expected);
+        expect(view.get('hostName')).to.equal(item.expected);
+      });
+    });
+
+  });
+
+  describe('#onOptionsChange', function () {
+
+    var view = App.ServiceConfigRadioButtons.create({
+        hostName: null,
+        databaseName: null,
+        connectionUrl: Em.Object.create(),
+        dbClass: Em.Object.create(),
+        serviceConfig: Em.Object.create(),
+        categoryConfigsAll: [
+          Em.Object.create({
+            name: 'javax.jdo.option.ConnectionUserName'
+          }),
+          Em.Object.create({
+            name: 'javax.jdo.option.ConnectionPassword'
+          }),
+          Em.Object.create({
+            name: 'oozie.service.JPAService.jdbc.username'
+          }),
+          Em.Object.create({
+            name: 'oozie.service.JPAService.jdbc.password'
+          })
+        ],
+        parentView: Em.Object.create({
+          serviceConfigs: [
+            {
+              name: 'hive_database_type',
+              value: null
+            }
+          ]
+        }),
+        configs: [{}]
+      }),
+      cases = [
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: 'New MySQL Database',
+          databaseName: 'db0',
+          hostName: 'h0',
+          connectionUrlValue: 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true',
+          dbClassValue: 'com.mysql.jdbc.Driver',
+          isAuthVisibleAndRequired: true,
+          hiveDbTypeValue: 'mysql'
+        },
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
+          databaseName: 'db1',
+          hostName: 'h1',
+          connectionUrlValue: 'jdbc:postgresql://h1:5432/db1',
+          dbClassValue: 'org.postgresql.Driver',
+          isAuthVisibleAndRequired: true,
+          hiveDbTypeValue: 'postgres'
+        },
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: 'Existing MySQL Database',
+          databaseName: 'db2',
+          hostName: 'h2',
+          connectionUrlValue: 'jdbc:mysql://h2/db2?createDatabaseIfNotExist=true',
+          dbClassValue: 'com.mysql.jdbc.Driver',
+          isAuthVisibleAndRequired: true,
+          hiveDbTypeValue: 'mysql'
+        },
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
+          databaseName: 'db3',
+          hostName: 'h3',
+          connectionUrlValue: 'jdbc:sqlserver://h3;databaseName=db3',
+          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+          isAuthVisibleAndRequired: true,
+          hiveDbTypeValue: 'mssql'
+        },
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: 'Existing Oracle Database',
+          databaseName: 'db4',
+          hostName: 'h4',
+          connectionUrlValue: 'jdbc:oracle:thin:@//h4:1521/db4',
+          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
+          isAuthVisibleAndRequired: true,
+          hiveDbTypeValue: 'oracle'
+        },
+        {
+          serviceName: 'HIVE',
+          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
+          databaseName: 'db5',
+          hostName: 'h5',
+          connectionUrlValue: 'jdbc:sqlserver://h5;databaseName=db5;integratedSecurity=true',
+          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+          isAuthVisibleAndRequired: false,
+          hiveDbTypeValue: 'mssql'
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: 'New Derby Database',
+          databaseName: 'db6',
+          hostName: 'h6',
+          connectionUrlValue: 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
+          dbClassValue: 'org.apache.derby.jdbc.EmbeddedDriver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: 'Existing MySQL Database',
+          databaseName: 'db7',
+          hostName: 'h7',
+          connectionUrlValue: 'jdbc:mysql://h7/db7',
+          dbClassValue: 'com.mysql.jdbc.Driver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
+          databaseName: 'db8',
+          hostName: 'h8',
+          connectionUrlValue: 'jdbc:postgresql://h8:5432/db8',
+          dbClassValue: 'org.postgresql.Driver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
+          databaseName: 'db9',
+          hostName: 'h9',
+          connectionUrlValue: 'jdbc:sqlserver://h9;databaseName=db9',
+          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: 'Existing Oracle Database',
+          databaseName: 'db10',
+          hostName: 'h10',
+          connectionUrlValue: 'jdbc:oracle:thin:@//h10:1521/db10',
+          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'OOZIE',
+          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
+          databaseName: 'db11',
+          hostName: 'h11',
+          connectionUrlValue: 'jdbc:sqlserver://h11;databaseName=db11;integratedSecurity=true',
+          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+          isAuthVisibleAndRequired: false
+        }
+      ],
+      serviceAuthPropsMap = {
+        HIVE: ['javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword'],
+        OOZIE: ['oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password']
+      };
+
+    before(function () {
+      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
+    });
+
+    after(function () {
+      view.handleDBConnectionProperty.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.serviceName + ', ' + item.serviceConfigValue, function () {
+        view.get('serviceConfig').setProperties({
+          serviceName: item.serviceName,
+          value: item.serviceConfigValue
+        });
+        view.setProperties({
+          databaseName: item.databaseName,
+          hostName: item.hostName
+        });
+        expect(view.get('connectionUrl.value')).to.equal(item.connectionUrlValue);
+        expect(view.get('dbClass.value')).to.equal(item.dbClassValue);
+        serviceAuthPropsMap[item.serviceName].forEach(function (propName) {
+          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isVisible')).to.equal(item.isAuthVisibleAndRequired);
+          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isRequired')).to.equal(item.isAuthVisibleAndRequired);
+        });
+        if (item.serviceName == 'HIVE') {
+          expect(view.get('parentView.serviceConfigs').findProperty('name', 'hive_database_type').value).to.equal(item.hiveDbTypeValue);
+        }
+      });
+    });
+
+  });
+
+});
+
+describe('App.ServiceConfigRadioButton', function () {
+
+  describe('#disabled', function () {
+
+    var cases = [
+      {
+        wizardControllerName: 'addServiceController',
+        value: 'New MySQL Database',
+        title: 'Add Service Wizard, new database',
+        disabled: false
+      },
+      {
+        wizardControllerName: 'installerController',
+        value: 'New MySQL Database',
+        title: 'Install Wizard, new database',
+        disabled: false
+      },
+      {
+        wizardControllerName: 'addServiceController',
+        value: 'Existing MySQL Database',
+        title: 'Add Service Wizard, existing database',
+        disabled: false
+      },
+      {
+        wizardControllerName: 'installerController',
+        value: 'Existing MySQL Database',
+        title: 'Install Wizard, existing database',
+        disabled: false
+      },
+      {
+        wizardControllerName: null,
+        value: 'New MySQL Database',
+        title: 'No installer, new database',
+        disabled: true
+      },
+      {
+        wizardControllerName: null,
+        value: 'Existing MySQL Database',
+        title: 'No installer, existing database',
+        disabled: false
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        var view = App.ServiceConfigRadioButton.create({
+          parentView: Em.Object.create({
+            serviceConfig: Em.Object.create()
+          }),
+          controller: Em.Object.create({
+            wizardController: Em.Object.create({
+              name: null
+            })
+          })
+        });
+        view.set('value', item.value);
+        view.set('controller.wizardController.name', item.wizardControllerName);
+        view.set('parentView.serviceConfig.isEditable', true);
+        expect(view.get('disabled')).to.equal(item.disabled);
+      });
+    });
+
+    it('parent view is disabled', function () {
+      var view = App.ServiceConfigRadioButton.create({
+        parentView: Em.Object.create({
+          serviceConfig: Em.Object.create()
+        })
+      });
+      view.set('parentView.serviceConfig.isEditable', false);
+      expect(view.get('disabled')).to.be.true;
+    });
+
+  });
+
+});
+
+describe('App.CheckDBConnectionView', function () {
+
+  describe('#masterHostName', function () {
+
+    var cases = [
+        {
+          serviceName: 'OOZIE',
+          value: 'h0'
+        },
+        {
+          serviceName: 'KERBEROS',
+          value: 'h1'
+        },
+        {
+          serviceName: 'HIVE',
+          value: 'h2'
+        }
+      ],
+      categoryConfigsAll = [
+        Em.Object.create({
+          name: 'oozieserver_host',
+          value: 'h0'
+        }),
+        Em.Object.create({
+          name: 'kdc_host',
+          value: 'h1'
+        }),
+        Em.Object.create({
+          name: 'hive_ambari_host',
+          value: 'h2'
+        })
+      ];
+
+    cases.forEach(function (item) {
+      it(item.serviceName, function () {
+        var view = App.CheckDBConnectionView.create({
+          parentView: {
+            service: {
+              serviceName: item.serviceName
+            },
+            categoryConfigsAll: categoryConfigsAll
+          }
+        });
+        expect(view.get('masterHostName')).to.equal(item.value);
+      });
+    });
+
+  });
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/11efa2f5/ambari-web/test/views/wizard/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/controls_view_test.js b/ambari-web/test/views/wizard/controls_view_test.js
deleted file mode 100644
index a48c3c7..0000000
--- a/ambari-web/test/views/wizard/controls_view_test.js
+++ /dev/null
@@ -1,606 +0,0 @@
-/**
- * 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');
-require('views/wizard/controls_view');
-
-describe('App.ServiceConfigRadioButtons', function () {
-
-  describe('#didInsertElement', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        categoryConfigsAll: [],
-        controller: Em.Object.create({
-          wizardController: Em.Object.create({})
-        }),
-        serviceConfig: Em.Object.create({
-          value: null
-        })
-      }),
-      cases = [
-        {
-          wizardControllerName: 'addServiceController',
-          serviceConfigValue: 'New MySQL Database',
-          onOptionsChangeCalledTwice: true,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Add Service Wizard, New MySQL Database'
-        },
-        {
-          wizardControllerName: 'addServiceController',
-          serviceConfigValue: 'Existing MySQL Database',
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: true,
-          title: 'Add Service Wizard, Existing MySQL Database'
-        },
-        {
-          wizardControllerName: 'installerController',
-          serviceConfigValue: 'New MySQL Database',
-          onOptionsChangeCalledTwice: true,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Install Wizard, New MySQL Database'
-        },
-        {
-          wizardControllerName: 'installerController',
-          serviceConfigValue: 'Existing MySQL Database',
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: true,
-          title: 'Install Wizard, Existing MySQL Database'
-        },
-        {
-          wizardControllerName: null,
-          serviceConfigValue: null,
-          onOptionsChangeCalledTwice: false,
-          handleDBConnectionPropertyCalledTwice: false,
-          title: 'Service Configs Page'
-        }
-      ];
-
-    beforeEach(function () {
-      sinon.stub(view, 'onOptionsChange', Em.K);
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-    });
-
-    afterEach(function () {
-      view.onOptionsChange.restore();
-      view.handleDBConnectionProperty.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.title, function () {
-        view.set('controller.wizardController.name', item.wizardControllerName);
-        view.set('serviceConfig.value', item.serviceConfigValue);
-        view.didInsertElement();
-        expect(view.onOptionsChange.calledTwice).to.equal(item.onOptionsChangeCalledTwice);
-        expect(view.handleDBConnectionProperty.calledTwice).to.equal(item.handleDBConnectionPropertyCalledTwice);
-      });
-    });
-
-  });
-
-  describe('#databaseNameProperty', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          {
-            name: 'ambari.hive.db.schema.name',
-            value: 'db0'
-          },
-          {
-            name: 'oozie.db.schema.name',
-            value: 'db2'
-          }
-        ]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          value: 'db0'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'db2'
-        }
-      ];
-
-    cases.forEach(function (item) {
-      it(item.serviceName, function () {
-        view.set('serviceConfig.serviceName', item.serviceName);
-        expect(view.get('databaseNameProperty.value')).to.equal(item.value);
-        expect(view.get('databaseName')).to.equal(item.value);
-      });
-    });
-
-    it('default case', function () {
-      view.set('serviceConfig.serviceName', 'YARN');
-      expect(view.get('databaseNameProperty')).to.be.null;
-      expect(view.get('databaseName')).to.be.null;
-    });
-
-  });
-
-  describe('#hostNameProperty', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          {
-            name: 'hive_ambari_host',
-            value: 'h0'
-          },
-          {
-            name: 'hive_existing_mysql_host',
-            value: 'h1'
-          },
-          {
-            name: 'hive_existing_postgresql_host',
-            value: 'h2'
-          },
-          {
-            name: 'hive_existing_oracle_host',
-            value: 'h3'
-          },
-          {
-            name: 'hive_existing_mssql_server_host',
-            value: 'h4'
-          },
-          {
-            name: 'hive_existing_mssql_server_2_host',
-            value: 'h5'
-          },
-          {
-            name: 'hive_hostname',
-            value: 'h6'
-          },
-          {
-            name: 'oozie_ambari_host',
-            value: 'h10'
-          },
-          {
-            name: 'oozie_existing_mysql_host',
-            value: 'h11'
-          },
-          {
-            name: 'oozie_existing_postgresql_host',
-            value: 'h12'
-          },
-          {
-            name: 'oozie_existing_oracle_host',
-            value: 'h13'
-          },
-          {
-            name: 'oozie_existing_mssql_server_host',
-            value: 'h14'
-          },
-          {
-            name: 'oozie_existing_mssql_server_2_host',
-            value: 'h15'
-          },
-          {
-            name: 'oozie_hostname',
-            value: 'h16'
-          }
-        ]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          value: 'New MySQL Database',
-          expected: 'h0'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MySQL Database',
-          expected: 'h1'
-        },
-        {
-          serviceName: 'HIVE',
-          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          expected: 'h2'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing Oracle Database',
-          expected: 'h3'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MSSQL Server database with SQL authentication',
-          expected: 'h4'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'Existing MSSQL Server database with integrated authentication',
-          expected: 'h5'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'default case',
-          expected: 'h6'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'New Derby Database',
-          expected: 'h10'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MySQL Database',
-          expected: 'h11'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          expected: 'h12'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing Oracle Database',
-          expected: 'h13'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MSSQL Server database with SQL authentication',
-          expected: 'h14'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'Existing MSSQL Server database with integrated authentication',
-          expected: 'h15'
-        },
-        {
-          serviceName: 'OOZIE',
-          value: 'default case',
-          expected: 'h16'
-        }
-      ];
-
-    before(function () {
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-    });
-
-    after(function () {
-      view.handleDBConnectionProperty.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.serviceName + ', ' + item.value, function () {
-        view.get('serviceConfig').setProperties({
-          serviceName: item.serviceName,
-          value: item.value
-        });
-        expect(view.get('hostNameProperty.value')).to.equal(item.expected);
-        expect(view.get('hostName')).to.equal(item.expected);
-      });
-    });
-
-  });
-
-  describe('#onOptionsChange', function () {
-
-    var view = App.ServiceConfigRadioButtons.create({
-        hostName: null,
-        databaseName: null,
-        connectionUrl: Em.Object.create(),
-        dbClass: Em.Object.create(),
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          Em.Object.create({
-            name: 'javax.jdo.option.ConnectionUserName'
-          }),
-          Em.Object.create({
-            name: 'javax.jdo.option.ConnectionPassword'
-          }),
-          Em.Object.create({
-            name: 'oozie.service.JPAService.jdbc.username'
-          }),
-          Em.Object.create({
-            name: 'oozie.service.JPAService.jdbc.password'
-          })
-        ],
-        parentView: Em.Object.create({
-          serviceConfigs: [
-            {
-              name: 'hive_database_type',
-              value: null
-            }
-          ]
-        }),
-        configs: [{}]
-      }),
-      cases = [
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'New MySQL Database',
-          databaseName: 'db0',
-          hostName: 'h0',
-          connectionUrlValue: 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mysql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          databaseName: 'db1',
-          hostName: 'h1',
-          connectionUrlValue: 'jdbc:postgresql://h1:5432/db1',
-          dbClassValue: 'org.postgresql.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'postgres'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MySQL Database',
-          databaseName: 'db2',
-          hostName: 'h2',
-          connectionUrlValue: 'jdbc:mysql://h2/db2?createDatabaseIfNotExist=true',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mysql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
-          databaseName: 'db3',
-          hostName: 'h3',
-          connectionUrlValue: 'jdbc:sqlserver://h3;databaseName=db3',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'mssql'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing Oracle Database',
-          databaseName: 'db4',
-          hostName: 'h4',
-          connectionUrlValue: 'jdbc:oracle:thin:@//h4:1521/db4',
-          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
-          isAuthVisibleAndRequired: true,
-          hiveDbTypeValue: 'oracle'
-        },
-        {
-          serviceName: 'HIVE',
-          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
-          databaseName: 'db5',
-          hostName: 'h5',
-          connectionUrlValue: 'jdbc:sqlserver://h5;databaseName=db5;integratedSecurity=true',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: false,
-          hiveDbTypeValue: 'mssql'
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'New Derby Database',
-          databaseName: 'db6',
-          hostName: 'h6',
-          connectionUrlValue: 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
-          dbClassValue: 'org.apache.derby.jdbc.EmbeddedDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MySQL Database',
-          databaseName: 'db7',
-          hostName: 'h7',
-          connectionUrlValue: 'jdbc:mysql://h7/db7',
-          dbClassValue: 'com.mysql.jdbc.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: Em.I18n.t('services.service.config.hive.oozie.postgresql'),
-          databaseName: 'db8',
-          hostName: 'h8',
-          connectionUrlValue: 'jdbc:postgresql://h8:5432/db8',
-          dbClassValue: 'org.postgresql.Driver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MSSQL Server database with SQL authentication',
-          databaseName: 'db9',
-          hostName: 'h9',
-          connectionUrlValue: 'jdbc:sqlserver://h9;databaseName=db9',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing Oracle Database',
-          databaseName: 'db10',
-          hostName: 'h10',
-          connectionUrlValue: 'jdbc:oracle:thin:@//h10:1521/db10',
-          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
-          isAuthVisibleAndRequired: true
-        },
-        {
-          serviceName: 'OOZIE',
-          serviceConfigValue: 'Existing MSSQL Server database with integrated authentication',
-          databaseName: 'db11',
-          hostName: 'h11',
-          connectionUrlValue: 'jdbc:sqlserver://h11;databaseName=db11;integratedSecurity=true',
-          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
-          isAuthVisibleAndRequired: false
-        }
-      ],
-      serviceAuthPropsMap = {
-        HIVE: ['javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword'],
-        OOZIE: ['oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password']
-      };
-
-    before(function () {
-      sinon.stub(view, 'handleDBConnectionProperty', Em.K);
-    });
-
-    after(function () {
-      view.handleDBConnectionProperty.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.serviceName + ', ' + item.serviceConfigValue, function () {
-        view.get('serviceConfig').setProperties({
-          serviceName: item.serviceName,
-          value: item.serviceConfigValue
-        });
-        view.setProperties({
-          databaseName: item.databaseName,
-          hostName: item.hostName
-        });
-        expect(view.get('connectionUrl.value')).to.equal(item.connectionUrlValue);
-        expect(view.get('dbClass.value')).to.equal(item.dbClassValue);
-        serviceAuthPropsMap[item.serviceName].forEach(function (propName) {
-          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isVisible')).to.equal(item.isAuthVisibleAndRequired);
-          expect(view.get('categoryConfigsAll').findProperty('name', propName).get('isRequired')).to.equal(item.isAuthVisibleAndRequired);
-        });
-        if (item.serviceName == 'HIVE') {
-          expect(view.get('parentView.serviceConfigs').findProperty('name', 'hive_database_type').value).to.equal(item.hiveDbTypeValue);
-        }
-      });
-    });
-
-  });
-
-});
-
-describe('App.ServiceConfigRadioButton', function () {
-
-  describe('#disabled', function () {
-
-    var cases = [
-      {
-        wizardControllerName: 'addServiceController',
-        value: 'New MySQL Database',
-        title: 'Add Service Wizard, new database',
-        disabled: false
-      },
-      {
-        wizardControllerName: 'installerController',
-        value: 'New MySQL Database',
-        title: 'Install Wizard, new database',
-        disabled: false
-      },
-      {
-        wizardControllerName: 'addServiceController',
-        value: 'Existing MySQL Database',
-        title: 'Add Service Wizard, existing database',
-        disabled: false
-      },
-      {
-        wizardControllerName: 'installerController',
-        value: 'Existing MySQL Database',
-        title: 'Install Wizard, existing database',
-        disabled: false
-      },
-      {
-        wizardControllerName: null,
-        value: 'New MySQL Database',
-        title: 'No installer, new database',
-        disabled: true
-      },
-      {
-        wizardControllerName: null,
-        value: 'Existing MySQL Database',
-        title: 'No installer, existing database',
-        disabled: false
-      }
-    ];
-
-    cases.forEach(function (item) {
-      it(item.title, function () {
-        var view = App.ServiceConfigRadioButton.create({
-          parentView: Em.Object.create({
-            serviceConfig: Em.Object.create()
-          }),
-          controller: Em.Object.create({
-            wizardController: Em.Object.create({
-              name: null
-            })
-          })
-        });
-        view.set('value', item.value);
-        view.set('controller.wizardController.name', item.wizardControllerName);
-        view.set('parentView.serviceConfig.isEditable', true);
-        expect(view.get('disabled')).to.equal(item.disabled);
-      });
-    });
-
-    it('parent view is disabled', function () {
-      var view = App.ServiceConfigRadioButton.create({
-        parentView: Em.Object.create({
-          serviceConfig: Em.Object.create()
-        })
-      });
-      view.set('parentView.serviceConfig.isEditable', false);
-      expect(view.get('disabled')).to.be.true;
-    });
-
-  });
-
-});
-
-describe('App.CheckDBConnectionView', function () {
-
-  describe('#masterHostName', function () {
-
-    var cases = [
-        {
-          serviceName: 'OOZIE',
-          value: 'h0'
-        },
-        {
-          serviceName: 'KERBEROS',
-          value: 'h1'
-        },
-        {
-          serviceName: 'HIVE',
-          value: 'h2'
-        }
-      ],
-      categoryConfigsAll = [
-        Em.Object.create({
-          name: 'oozieserver_host',
-          value: 'h0'
-        }),
-        Em.Object.create({
-          name: 'kdc_host',
-          value: 'h1'
-        }),
-        Em.Object.create({
-          name: 'hive_ambari_host',
-          value: 'h2'
-        })
-      ];
-
-    cases.forEach(function (item) {
-      it(item.serviceName, function () {
-        var view = App.CheckDBConnectionView.create({
-          parentView: {
-            service: {
-              serviceName: item.serviceName
-            },
-            categoryConfigsAll: categoryConfigsAll
-          }
-        });
-        expect(view.get('masterHostName')).to.equal(item.value);
-      });
-    });
-
-  });
-
-});
\ No newline at end of file


Mime
View raw message