You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/04/29 14:10:20 UTC

[1/4] ambari git commit: AMBARI-10826 Move App.ServiceConfigProperty object to separate file. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 798f1072d -> 2514cda00


http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/test/models/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_config_test.js b/ambari-web/test/models/service_config_test.js
deleted file mode 100644
index f381ab8..0000000
--- a/ambari-web/test/models/service_config_test.js
+++ /dev/null
@@ -1,1418 +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('models/service_config');
-
-var serviceConfig,
-  serviceConfigCategory,
-  group,
-  serviceConfigProperty,
-  serviceConfigPropertyInit,
-  configsData = [
-    Ember.Object.create({
-      category: 'c0',
-      overrides: [
-        {
-          error: true,
-          errorMessage: 'error'
-        },
-        {
-          error: true
-        },
-        {}
-      ]
-    }),
-    Ember.Object.create({
-      category: 'c1',
-      isValid: false,
-      isVisible: true
-    }),
-    Ember.Object.create({
-      category: 'c0',
-      isValid: true,
-      isVisible: true
-    }),
-    Ember.Object.create({
-      category: 'c1',
-      isValid: false,
-      isVisible: false
-    })
-  ],
-  configCategoriesData = [
-    Em.Object.create({
-      name: 'c0',
-      slaveErrorCount: 1
-    }),
-    Em.Object.create({
-      name: 'c1',
-      slaveErrorCount: 2
-    })
-  ],
-  nameCases = [
-    {
-      name: 'DataNode',
-      primary: 'DATANODE'
-    },
-    {
-      name: 'TaskTracker',
-      primary: 'TASKTRACKER'
-    },
-    {
-      name: 'RegionServer',
-      primary: 'HBASE_REGIONSERVER'
-    },
-    {
-      name: 'name',
-      primary: null
-    }
-  ],
-  components = [
-    {
-      name: 'NameNode',
-      master: true
-    },
-    {
-      name: 'SNameNode',
-      master: true
-    },
-    {
-      name: 'JobTracker',
-      master: true
-    },
-    {
-      name: 'HBase Master',
-      master: true
-    },
-    {
-      name: 'Oozie Master',
-      master: true
-    },
-    {
-      name: 'Hive Metastore',
-      master: true
-    },
-    {
-      name: 'WebHCat Server',
-      master: true
-    },
-    {
-      name: 'ZooKeeper Server',
-      master: true
-    },
-    {
-      name: 'Ganglia',
-      master: true
-    },
-    {
-      name: 'DataNode',
-      slave: true
-    },
-    {
-      name: 'TaskTracker',
-      slave: true
-    },
-    {
-      name: 'RegionServer',
-      slave: true
-    }
-  ],
-  masters = components.filterProperty('master'),
-  slaves = components.filterProperty('slave'),
-  groupsData = {
-    groups: [
-      Em.Object.create({
-        errorCount: 1
-      }),
-      Em.Object.create({
-        errorCount: 2
-      })
-    ]
-  },
-  groupNoErrorsData = [].concat(configsData.slice(2)),
-  groupErrorsData = [configsData[1]],
-  overridableFalseData = [
-    {
-      isOverridable: false
-    },
-    {
-      isEditable: false,
-      overrides: configsData[0].overrides
-    },
-    {
-      displayType: 'masterHost'
-    }
-  ],
-  overridableTrueData = [
-    {
-      isOverridable: true,
-      isEditable: true
-    },    {
-      isOverridable: true,
-      overrides: []
-    },
-    {
-      isOverridable: true
-    }
-  ],
-  overriddenFalseData = [
-    {
-      overrides: null,
-      isOriginalSCP: true
-    },
-    {
-      overrides: [],
-      isOriginalSCP: true
-    }
-  ],
-  overriddenTrueData = [
-    {
-      overrides: configsData[0].overrides
-    },
-    {
-      isOriginalSCP: false
-    }
-  ],
-  removableFalseData = [
-    {
-      isEditable: false
-    },
-    {
-      hasOverrides: true
-    },
-    {
-      isUserProperty: false,
-      isOriginalSCP: true
-    }
-  ],
-  removableTrueData = [
-    {
-      isEditable: true,
-      hasOverrides: false,
-      isUserProperty: true
-    },
-    {
-      isEditable: true,
-      hasOverrides: false,
-      isOriginalSCP: false
-    }
-  ],
-  initPropertyData = [
-    {
-      initial: {
-        displayType: 'password',
-        value: 'value'
-      },
-      result: {
-        retypedPassword: 'value'
-      }
-    },
-    {
-      initial: {
-        id: 'puppet var',
-        value: '',
-        defaultValue: 'default'
-      },
-      result: {
-        value: 'default'
-      }
-    }
-  ],
-  notDefaultFalseData = [
-    {
-      isEditable: false
-    },
-    {
-      defaultValue: null
-    },
-    {
-      value: 'value',
-      defaultValue: 'value'
-    }
-  ],
-  notDefaultTrueData = {
-    isEditable: true,
-    value: 'value',
-    defaultValue: 'default'
-  },
-  types = ['masterHost', 'slaveHosts', 'masterHosts', 'slaveHost', 'radio button'],
-  classCases = [
-    {
-      initial: {
-        displayType: 'checkbox'
-      },
-      viewClass: App.ServiceConfigCheckbox
-    },
-    {
-      initial: {
-        displayType: 'checkbox',
-        dependentConfigPattern: 'somPattern'
-      },
-      viewClass: App.ServiceConfigCheckboxWithDependencies
-    },
-    {
-      initial: {
-        displayType: 'password'
-      },
-      viewClass: App.ServiceConfigPasswordField
-    },
-    {
-      initial: {
-        displayType: 'combobox'
-      },
-      viewClass: App.ServiceConfigComboBox
-    },
-    {
-      initial: {
-        displayType: 'radio button'
-      },
-      viewClass: App.ServiceConfigRadioButtons
-    },
-    {
-      initial: {
-        displayType: 'directories'
-      },
-      viewClass: App.ServiceConfigTextArea
-    },
-    {
-      initial: {
-        displayType: 'content'
-      },
-      viewClass: App.ServiceConfigTextAreaContent
-
-    },
-    {
-      initial: {
-        displayType: 'multiLine'
-      },
-      viewClass: App.ServiceConfigTextArea
-    },
-    {
-      initial: {
-        displayType: 'custom'
-      },
-      viewClass: App.ServiceConfigBigTextArea
-    },
-    {
-      initial: {
-        displayType: 'masterHost'
-      },
-      viewClass: App.ServiceConfigMasterHostView
-    },
-    {
-      initial: {
-        displayType: 'masterHosts'
-      },
-      viewClass: App.ServiceConfigMasterHostsView
-    },
-    {
-      initial: {
-        displayType: 'slaveHosts'
-      },
-      viewClass: App.ServiceConfigSlaveHostsView
-    },
-    {
-      initial: {
-        unit: true,
-        displayType: 'type'
-      },
-      viewClass: App.ServiceConfigTextFieldWithUnit
-    },
-    {
-      initial: {
-        unit: false,
-        displayType: 'type'
-      },
-      viewClass: App.ServiceConfigTextField
-    },
-    {
-      initial: {
-        unit: false,
-        displayType: 'supportTextConnection'
-      },
-      viewClass: App.checkConnectionView
-    }
-  ];
-
-
-describe('App.ServiceConfig', function () {
-
-  beforeEach(function () {
-    serviceConfig = App.ServiceConfig.create();
-  });
-
-  describe('#errorCount', function () {
-    it('should be 0', function () {
-      serviceConfig.setProperties({
-        configs: [],
-        configCategories: []
-      });
-      expect(serviceConfig.get('errorCount')).to.equal(0);
-    });
-    it('should sum counts of all errors', function () {
-      serviceConfig.setProperties({
-        configs: configsData,
-        configCategories: configCategoriesData
-      });
-      expect(serviceConfig.get('errorCount')).to.equal(6);
-      expect(serviceConfig.get('configCategories').findProperty('name', 'c0').get('nonSlaveErrorCount')).to.equal(2);
-      expect(serviceConfig.get('configCategories').findProperty('name', 'c1').get('nonSlaveErrorCount')).to.equal(1);
-    });
-  });
-
-});
-
-describe('App.ServiceConfigCategory', function () {
-
-  beforeEach(function () {
-    serviceConfigCategory = App.ServiceConfigCategory.create();
-  });
-
-  describe('#primaryName', function () {
-    nameCases.forEach(function (item) {
-      it('should return ' + item.primary, function () {
-        serviceConfigCategory.set('name', item.name);
-        expect(serviceConfigCategory.get('primaryName')).to.equal(item.primary);
-      })
-    });
-  });
-
-  describe('#isForMasterComponent', function () {
-    masters.forEach(function (item) {
-      it('should be true for ' + item.name, function () {
-        serviceConfigCategory.set('name', item.name);
-        expect(serviceConfigCategory.get('isForMasterComponent')).to.be.true;
-      });
-    });
-    it('should be false', function () {
-      serviceConfigCategory.set('name', 'name');
-      expect(serviceConfigCategory.get('isForMasterComponent')).to.be.false;
-    });
-  });
-
-  describe('#isForSlaveComponent', function () {
-    slaves.forEach(function (item) {
-      it('should be true for ' + item.name, function () {
-        serviceConfigCategory.set('name', item.name);
-        expect(serviceConfigCategory.get('isForSlaveComponent')).to.be.true;
-      });
-    });
-    it('should be false', function () {
-      serviceConfigCategory.set('name', 'name');
-      expect(serviceConfigCategory.get('isForSlaveComponent')).to.be.false;
-    });
-  });
-
-  describe('#slaveErrorCount', function () {
-    it('should be 0', function () {
-      serviceConfigCategory.set('slaveConfigs', []);
-      expect(serviceConfigCategory.get('slaveErrorCount')).to.equal(0);
-    });
-    it('should sum all errorCount values', function () {
-      serviceConfigCategory.set('slaveConfigs', groupsData);
-      expect(serviceConfigCategory.get('slaveErrorCount')).to.equal(3);
-    });
-  });
-
-  describe('#errorCount', function () {
-    it('should sum all errors for category', function () {
-      serviceConfigCategory.reopen({
-        slaveErrorCount: 1
-      });
-      expect(serviceConfigCategory.get('errorCount')).to.equal(1);
-      serviceConfigCategory.set('nonSlaveErrorCount', 2);
-      expect(serviceConfigCategory.get('errorCount')).to.equal(3);
-      serviceConfigCategory.set('slaveErrorCount', 0);
-      expect(serviceConfigCategory.get('errorCount')).to.equal(2);
-    });
-  });
-
-  describe('#isAdvanced', function () {
-    it('should be true', function () {
-      serviceConfigCategory.set('name', 'Advanced');
-      expect(serviceConfigCategory.get('isAdvanced')).to.be.true;
-    });
-    it('should be false', function () {
-      serviceConfigCategory.set('name', 'name');
-      expect(serviceConfigCategory.get('isAdvanced')).to.be.false;
-    });
-  });
-
-});
-
-describe('App.Group', function () {
-
-  beforeEach(function () {
-    group = App.Group.create();
-  });
-
-  describe('#errorCount', function () {
-    it('should be 0', function () {
-      group.set('properties', groupNoErrorsData);
-      expect(group.get('errorCount')).to.equal(0);
-    });
-    it('should be 1', function () {
-      group.set('properties', groupErrorsData);
-      expect(group.get('errorCount')).to.equal(1);
-    });
-  });
-
-});
-
-describe('App.ServiceConfigProperty', function () {
-
-  beforeEach(function () {
-    serviceConfigProperty = App.ServiceConfigProperty.create();
-  });
-
-  describe('#overrideErrorTrigger', function () {
-    it('should be an increment', function () {
-      serviceConfigProperty.set('overrides', configsData[0].overrides);
-      expect(serviceConfigProperty.get('overrideErrorTrigger')).to.equal(1);
-      serviceConfigProperty.set('overrides', []);
-      expect(serviceConfigProperty.get('overrideErrorTrigger')).to.equal(2);
-    });
-  });
-
-  describe('#isPropertyOverridable', function () {
-    overridableFalseData.forEach(function (item) {
-      it('should be false', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isPropertyOverridable')).to.be.false;
-      });
-    });
-    overridableTrueData.forEach(function (item) {
-      it('should be true', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isPropertyOverridable')).to.be.true;
-      });
-    });
-  });
-
-  describe('#isOverridden', function () {
-    overriddenFalseData.forEach(function (item) {
-      it('should be false', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isOverridden')).to.be.false;
-      });
-    });
-    overriddenTrueData.forEach(function (item) {
-      it('should be true', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isOverridden')).to.be.true;
-      });
-    });
-  });
-
-  describe('#isRemovable', function () {
-    removableFalseData.forEach(function (item) {
-      it('should be false', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isRemovable')).to.be.false;
-      });
-    });
-    removableTrueData.forEach(function (item) {
-      it('should be true', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isRemovable')).to.be.true;
-      });
-    });
-  });
-
-  describe('#init', function () {
-    initPropertyData.forEach(function (item) {
-      it('should set initial data', function () {
-        serviceConfigPropertyInit = App.ServiceConfigProperty.create(item.initial);
-        Em.keys(item.result).forEach(function (prop) {
-          expect(serviceConfigPropertyInit.get(prop)).to.equal(item.result[prop]);
-        });
-      });
-    });
-  });
-
-  describe('#isNotDefaultValue', function () {
-    notDefaultFalseData.forEach(function (item) {
-      it('should be false', function () {
-        Em.keys(item).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item[prop]);
-        });
-        expect(serviceConfigProperty.get('isNotDefaultValue')).to.be.false;
-      });
-    });
-    it('should be true', function () {
-      Em.keys(notDefaultTrueData).forEach(function (prop) {
-        serviceConfigProperty.set(prop, notDefaultTrueData[prop]);
-      });
-      expect(serviceConfigProperty.get('isNotDefaultValue')).to.be.true;
-    });
-  });
-
-  describe('#cantBeUndone', function () {
-    types.forEach(function (item) {
-      it('should be true', function () {
-        serviceConfigProperty.set('displayType', item);
-        expect(serviceConfigProperty.get('cantBeUndone')).to.be.true;
-      });
-    });
-    it('should be false', function () {
-      serviceConfigProperty.set('displayType', 'type');
-      expect(serviceConfigProperty.get('cantBeUndone')).to.be.false;
-    });
-  });
-
-  describe('#setDefaultValue', function () {
-    it('should change the default value', function () {
-      serviceConfigProperty.set('defaultValue', 'value0');
-      serviceConfigProperty.setDefaultValue(/\d/, '1');
-      expect(serviceConfigProperty.get('defaultValue')).to.equal('value1');
-    });
-  });
-
-  describe('#isValid', function () {
-    it('should be true', function () {
-      serviceConfigProperty.set('errorMessage', '');
-      expect(serviceConfigProperty.get('isValid')).to.be.true;
-    });
-    it('should be false', function () {
-      serviceConfigProperty.set('errorMessage', 'message');
-      expect(serviceConfigProperty.get('isValid')).to.be.false;
-    });
-  });
-
-  describe('#viewClass', function () {
-    classCases.forEach(function (item) {
-      it ('should be ' + item.viewClass, function () {
-        Em.keys(item.initial).forEach(function (prop) {
-          serviceConfigProperty.set(prop, item.initial[prop]);
-        });
-        expect(serviceConfigProperty.get('viewClass')).to.eql(item.viewClass);
-      });
-    });
-  });
-
-  describe('#validate', function () {
-    it('not required', function () {
-      serviceConfigProperty.setProperties({
-        isRequired: false,
-        value: ''
-      });
-      expect(serviceConfigProperty.get('errorMessage')).to.be.empty;
-      expect(serviceConfigProperty.get('error')).to.be.false;
-    });
-    it('should validate', function () {
-      serviceConfigProperty.setProperties({
-        isRequired: true,
-        value: 'value'
-      });
-      expect(serviceConfigProperty.get('errorMessage')).to.be.empty;
-      expect(serviceConfigProperty.get('error')).to.be.false;
-    });
-    it('should fail', function () {
-      serviceConfigProperty.setProperties({
-        isRequired: true,
-        value: 'value'
-      });
-      serviceConfigProperty.set('value', '');
-      expect(serviceConfigProperty.get('errorMessage')).to.equal('This is required');
-      expect(serviceConfigProperty.get('error')).to.be.true;
-    });
-  });
-
-  describe('#initialValue', function () {
-
-    var cases = {
-      'kafka.ganglia.metrics.host': [
-        {
-          message: 'kafka.ganglia.metrics.host property should have the value of ganglia hostname when ganglia is selected',
-          localDB: {
-            masterComponentHosts: [
-              {
-                component: 'GANGLIA_SERVER',
-                hostName: 'c6401'
-              }
-            ]
-          },
-          expected: 'c6401'
-        },
-        {
-          message: 'kafka.ganglia.metrics.host property should have the value "localhost" when ganglia is not selected',
-          localDB: {
-            masterComponentHosts: [
-              {
-                component: 'NAMENODE',
-                hostName: 'c6401'
-              }
-            ]
-          },
-          expected: 'localhost'
-        }
-      ],
-      'hive_database': [
-        {
-          alwaysEnableManagedMySQLForHive: true,
-          currentStateName: '',
-          isManagedMySQLForHiveEnabled: false,
-          receivedValue: 'New MySQL Database',
-          value: 'New MySQL Database',
-          options: [
-            {
-              displayName: 'New MySQL Database'
-            }
-          ],
-          hidden: false
-        },
-        {
-          alwaysEnableManagedMySQLForHive: false,
-          currentStateName: 'configs',
-          isManagedMySQLForHiveEnabled: false,
-          receivedValue: 'New MySQL Database',
-          value: 'New MySQL Database',
-          options: [
-            {
-              displayName: 'New MySQL Database'
-            }
-          ],
-          hidden: false
-        },
-        {
-          alwaysEnableManagedMySQLForHive: false,
-          currentStateName: '',
-          isManagedMySQLForHiveEnabled: true,
-          receivedValue: 'New MySQL Database',
-          value: 'New MySQL Database',
-          options: [
-            {
-              displayName: 'New MySQL Database'
-            }
-          ],
-          hidden: false
-        },
-        {
-          alwaysEnableManagedMySQLForHive: false,
-          currentStateName: '',
-          isManagedMySQLForHiveEnabled: false,
-          receivedValue: 'New MySQL Database',
-          value: 'Existing MySQL Database',
-          options: [
-            {
-              displayName: 'New MySQL Database'
-            }
-          ],
-          hidden: true
-        },
-        {
-          alwaysEnableManagedMySQLForHive: false,
-          currentStateName: '',
-          isManagedMySQLForHiveEnabled: false,
-          receivedValue: 'New PostgreSQL Database',
-          value: 'New PostgreSQL Database',
-          options: [
-            {
-              displayName: 'New MySQL Database'
-            }
-          ],
-          hidden: true
-        }
-      ],
-      'hbase.zookeeper.quorum': [
-        {
-          filename: 'hbase-site.xml',
-          value: 'host0,host1',
-          defaultValue: 'host0,host1',
-          title: 'should set ZooKeeper Server hostnames'
-        },
-        {
-          filename: 'ams-hbase-site.xml',
-          value: 'localhost',
-          defaultValue: '',
-          title: 'should ignore ZooKeeper Server hostnames'
-        }
-      ],
-      'hbase.tmp.dir': [
-        {
-          filename: 'hbase-site.xml',
-          isUnionAllMountPointsCalled: true,
-          title: 'unionAllMountPoints should be called'
-        },
-        {
-          filename: 'ams-hbase-site.xml',
-          isUnionAllMountPointsCalled: false,
-          title: 'unionAllMountPoints shouldn\'t be called'
-        }
-      ],
-      'hivemetastore_host': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h0'
-            },
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h1'
-            }
-          ]
-        },
-        value: ['h0', 'h1'],
-        title: 'array that contains names of hosts with Hive Metastore'
-      },
-      'hive_master_hosts': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'HIVE_SERVER',
-              hostName: 'h0'
-            },
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h0'
-            },
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h1'
-            },
-            {
-              component: 'WEBHCAT_SERVER',
-              hostName: 'h2'
-            }
-          ]
-        },
-        value: 'h0,h1',
-        title: 'comma separated list of hosts with Hive Server and Metastore'
-      },
-      'hive.metastore.uris': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h0'
-            },
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h1'
-            }
-          ]
-        },
-        dependencies: {
-          'hive.metastore.uris': 'thrift://localhost:9083'
-        },
-        defaultValue: 'thrift://localhost:9083',
-        value: 'thrift://h0:9083,thrift://h1:9083',
-        title: 'comma separated list of Metastore hosts with thrift prefix and port'
-      },
-      'templeton.hive.properties': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h0'
-            },
-            {
-              component: 'HIVE_METASTORE',
-              hostName: 'h1'
-            }
-          ]
-        },
-        dependencies: {
-          'hive.metastore.uris': 'thrift://localhost:9083'
-        },
-        defaultValue: 'hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false',
-        value: 'hive.metastore.local=false,hive.metastore.uris=thrift://h0:9083\\,thrift://h1:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true',
-        title: 'should add relevant hive.metastore.uris value'
-      },
-      'yarn.resourcemanager.zk-address': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'ZOOKEEPER_SERVER',
-              hostName: 'h0'
-            },
-            {
-              component: 'ZOOKEEPER_SERVER',
-              hostName: 'h1'
-            }
-          ]
-        },
-        dependencies: {
-          clientPort: '2182'
-        },
-        defaultValue: 'localhost:2181',
-        value: 'h0:2182',
-        title: 'should add ZK host and port dynamically'
-      },
-      'oozieserver_host': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'OOZIE_SERVER',
-              hostName: 'h0'
-            },
-            {
-              component: 'OOZIE_SERVER',
-              hostName: 'h1'
-            }
-          ]
-        },
-        value: ['h0', 'h1'],
-        title: 'array that contains names of hosts with Oozie Server'
-      },
-      'knox_gateway_host': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'KNOX_GATEWAY',
-              hostName: 'h0'
-            },
-            {
-              component: 'KNOX_GATEWAY',
-              hostName: 'h1'
-            }
-          ]
-        },
-        value: ['h0', 'h1'],
-        title: 'array that contains names of hosts with Knox Gateway'
-      }
-    };
-
-    cases['kafka.ganglia.metrics.host'].forEach(function(item){
-      it(item.message, function () {
-        serviceConfigProperty.setProperties({
-          name: 'kafka.ganglia.metrics.host',
-          value: 'localhost'
-        });
-        serviceConfigProperty.initialValue(item.localDB);
-        expect(serviceConfigProperty.get('value')).to.equal(item.expected);
-      });
-    });
-
-    cases['hive_database'].forEach(function (item) {
-      var title = 'hive_database value should be set to {0}';
-      it(title.format(item.value), function () {
-        sinon.stub(App, 'get')
-          .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
-          .withArgs('router.currentState.name').returns(item.currentStateName)
-          .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
-        serviceConfigProperty.setProperties({
-          name: 'hive_database',
-          value: item.receivedValue,
-          options: item.options
-        });
-        serviceConfigProperty.initialValue({});
-        expect(serviceConfigProperty.get('value')).to.equal(item.value);
-        expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
-        App.get.restore();
-      });
-    });
-
-    cases['hbase.zookeeper.quorum'].forEach(function (item) {
-      it(item.title, function () {
-        serviceConfigProperty.setProperties({
-          name: 'hbase.zookeeper.quorum',
-          value: 'localhost',
-          'filename': item.filename
-        });
-        serviceConfigProperty.initialValue({
-          masterComponentHosts: {
-            filterProperty: function () {
-              return {
-                mapProperty: function () {
-                  return ['host0', 'host1'];
-                }
-              };
-            }
-          }
-        });
-        expect(serviceConfigProperty.get('value')).to.equal(item.value);
-        expect(serviceConfigProperty.get('defaultValue')).to.equal(item.defaultValue);
-      });
-    });
-
-    cases['hbase.tmp.dir'].forEach(function (item) {
-      var isOnlyFirstOneNeeded = true,
-        localDB = {
-          p: 'v'
-        };
-      it(item.title, function () {
-        sinon.stub(serviceConfigProperty, 'unionAllMountPoints', Em.K);
-        serviceConfigProperty.setProperties({
-          name: 'hbase.tmp.dir',
-          filename: item.filename
-        });
-        serviceConfigProperty.initialValue(localDB);
-        expect(serviceConfigProperty.unionAllMountPoints.calledWith(isOnlyFirstOneNeeded, localDB)).to.equal(item.isUnionAllMountPointsCalled);
-        serviceConfigProperty.unionAllMountPoints.restore();
-      });
-    });
-
-    it(cases['hivemetastore_host'].title, function () {
-      serviceConfigProperty.set('name', 'hivemetastore_host');
-      serviceConfigProperty.initialValue(cases['hivemetastore_host'].localDB);
-      expect(serviceConfigProperty.get('value')).to.eql(cases['hivemetastore_host'].value);
-    });
-
-    it(cases['hive_master_hosts'].title, function () {
-      serviceConfigProperty.set('name', 'hive_master_hosts');
-      serviceConfigProperty.initialValue(cases['hive_master_hosts'].localDB);
-      expect(serviceConfigProperty.get('value')).to.equal(cases['hive_master_hosts'].value);
-    });
-
-    it(cases['hive.metastore.uris'].title, function () {
-      serviceConfigProperty.setProperties({
-        name: 'hive.metastore.uris',
-        defaultValue: cases['hive.metastore.uris'].defaultValue
-      });
-      serviceConfigProperty.initialValue(cases['hive.metastore.uris'].localDB, cases['hive.metastore.uris'].dependencies);
-      expect(serviceConfigProperty.get('value')).to.equal(cases['hive.metastore.uris'].value);
-      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['hive.metastore.uris'].value);
-    });
-
-    it(cases['templeton.hive.properties'].title, function () {
-      serviceConfigProperty.setProperties({
-        name: 'templeton.hive.properties',
-        defaultValue: cases['templeton.hive.properties'].defaultValue,
-        value: cases['templeton.hive.properties'].defaultValue
-      });
-      serviceConfigProperty.initialValue(cases['templeton.hive.properties'].localDB, cases['templeton.hive.properties'].dependencies);
-      expect(serviceConfigProperty.get('value')).to.equal(cases['templeton.hive.properties'].value);
-      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['templeton.hive.properties'].value);
-    });
-
-    it(cases['yarn.resourcemanager.zk-address'].title, function () {
-      serviceConfigProperty.setProperties({
-        name: 'yarn.resourcemanager.zk-address',
-        defaultValue: cases['yarn.resourcemanager.zk-address'].defaultValue
-      });
-      serviceConfigProperty.initialValue(cases['yarn.resourcemanager.zk-address'].localDB, cases['yarn.resourcemanager.zk-address'].dependencies);
-      expect(serviceConfigProperty.get('value')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
-      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
-    });
-
-    it(cases['oozieserver_host'].title, function () {
-      serviceConfigProperty.set('name', 'oozieserver_host');
-      serviceConfigProperty.initialValue(cases['oozieserver_host'].localDB);
-      expect(serviceConfigProperty.get('value')).to.eql(cases['oozieserver_host'].value);
-    });
-
-    it(cases['knox_gateway_host'].title, function () {
-      serviceConfigProperty.set('name', 'knox_gateway_host');
-      serviceConfigProperty.initialValue(cases['knox_gateway_host'].localDB);
-      expect(serviceConfigProperty.get('value')).to.eql(cases['knox_gateway_host'].value);
-    });
-
-  });
-
-  describe('#getHiveMetastoreUris', function () {
-
-    var cases = [
-      {
-        hosts: [
-          {
-            hostName: 'h0',
-            component: 'HIVE_SERVER'
-          },
-          {
-            hostName: 'h1',
-            component: 'HIVE_METASTORE'
-          },
-          {
-            hostName: 'h2',
-            component: 'HIVE_METASTORE'
-          }
-        ],
-        defaultValue: 'thrift://localhost:9083',
-        expected: 'thrift://h1:9083,thrift://h2:9083',
-        title: 'typical case'
-      },
-      {
-        hosts: [
-          {
-            hostName: 'h0',
-            component: 'HIVE_SERVER'
-          }
-        ],
-        defaultValue: 'thrift://localhost:9083',
-        expected: '',
-        title: 'no Metastore hosts in DB'
-      },
-      {
-        hosts: [
-          {
-            hostName: 'h0',
-            component: 'HIVE_SERVER'
-          },
-          {
-            hostName: 'h1',
-            component: 'HIVE_METASTORE'
-          },
-          {
-            hostName: 'h2',
-            component: 'HIVE_METASTORE'
-          }
-        ],
-        defaultValue: '',
-        expected: '',
-        title: 'default value without port'
-      },
-      {
-        hosts: [
-          {
-            hostName: 'h0',
-            component: 'HIVE_SERVER'
-          },
-          {
-            hostName: 'h1',
-            component: 'HIVE_METASTORE'
-          },
-          {
-            hostName: 'h2',
-            component: 'HIVE_METASTORE'
-          }
-        ],
-        expected: '',
-        title: 'no default value specified'
-      }
-    ];
-
-    cases.forEach(function (item) {
-      it(item.title, function () {
-        expect(serviceConfigProperty.getHiveMetastoreUris(item.hosts, item.defaultValue)).to.equal(item.expected);
-      });
-    });
-
-  });
-
-  describe('#unionAllMountPoints', function () {
-
-    var localDB = {
-        masterComponentHosts: [
-          {
-            component: 'NAMENODE',
-            hostName: 'h0'
-          },
-          {
-            component: 'SECONDARY_NAMENODE',
-            hostName: 'h4'
-          },
-          {
-            component: 'APP_TIMELINE_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'ZOOKEEPER_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'ZOOKEEPER_SERVER',
-            hostName: 'h1'
-          },
-          {
-            component: 'OOZIE_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'OOZIE_SERVER',
-            hostName: 'h1'
-          },
-          {
-            component: 'NIMBUS',
-            hostName: 'h2'
-          },
-          {
-            component: 'FALCON_SERVER',
-            hostName: 'h3'
-          },
-          {
-            component: 'KAFKA_BROKER',
-            hostName: 'h0'
-          },
-          {
-            component: 'KAFKA_BROKER',
-            hostName: 'h1'
-          }
-        ],
-        slaveComponentHosts: [
-          {
-            componentName: 'DATANODE',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'TASKTRACKER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'NODEMANAGER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              },
-              {
-                hostName: 'h4'
-              }
-            ]
-          },
-          {
-            componentName: 'HBASE_REGIONSERVER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'SUPERVISOR',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          }
-        ],
-        hosts: {
-          h0: {
-            disk_info: [
-              {
-                mountpoint: '/'
-              },
-              {
-                mountpoint: '/home'
-              },
-              {
-                mountpoint: '/boot'
-              },
-              {
-                mountpoint: '/boot/efi'
-              },
-              {
-                mountpoint: '/mnt'
-              },
-              {
-                mountpoint: '/mnt/efi'
-              },
-              {
-                mountpoint: '/media/disk0',
-                available: '100000000'
-              },
-              {
-                mountpoint: '/mount0',
-                available: '100000000'
-              }
-            ]
-          },
-          h4: {
-            disk_info: [
-              {
-                mountpoint: 'c:',
-                available: '100000000'
-              }
-            ]
-          }
-        }
-      },
-      cases = [
-        {
-          name: 'dfs.namenode.name.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n'
-        },
-        {
-          name: 'dfs.name.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n'
-        },
-        {
-          name: 'fs.checkpoint.dir',
-          isOnlyFirstOneNeeded: true,
-          value: 'file:///c:/default\n'
-        },
-        {
-          name: 'dfs.namenode.checkpoint.dir',
-          isOnlyFirstOneNeeded: true,
-          value: 'file:///c:/default\n'
-        },
-        {
-          name: 'dfs.data.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'dfs.datanode.data.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'mapred.local.dir',
-          isOnlyFirstOneNeeded: false,
-          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'yarn.nodemanager.log-dirs',
-          isOnlyFirstOneNeeded: false,
-          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
-        },
-        {
-          name: 'yarn.nodemanager.local-dirs',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
-        },
-        {
-          name: 'yarn.timeline-service.leveldb-timeline-store.path',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'dataDir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'oozie_data_dir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'hbase.tmp.dir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'storm.local.dir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: '*.falcon.graph.storage.directory',
-          isOnlyFirstOneNeeded: true,
-          value: '/default'
-        },
-        {
-          name: '*.falcon.graph.serialize.path',
-          isOnlyFirstOneNeeded: true,
-          value: '/default'
-        },
-        {
-          name: 'log.dirs',
-          isOnlyFirstOneNeeded: false,
-          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        }
-      ];
-
-    beforeEach(function () {
-      sinon.stub(App.Host, 'find').returns([
-        Em.Object.create({
-          id: 'h1',
-          diskInfo: [
-            {
-              mountpoint: '/media/disk1',
-              type: 'devtmpfs'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'tmpfs'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'vboxsf'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'CDFS'
-            },
-            {
-              mountpoint: '/media/disk1',
-              available: '0'
-            },
-            {
-              mountpoint: '/media/disk1',
-              available: '100000000'
-            },
-            {
-              mountpoint: '/mount1',
-              available: '100000000'
-            }
-          ]
-        }),
-        Em.Object.create({
-          id: 'h2',
-          diskInfo: [
-            {
-              mountpoint: '/'
-            }
-          ]
-        }),
-        Em.Object.create({
-          id: 'h3',
-          diskInfo: []
-        })
-      ]);
-    });
-
-    afterEach(function () {
-      App.Host.find.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.name, function () {
-        serviceConfigProperty.setProperties({
-          name: item.name,
-          defaultDirectory: '/default'
-        });
-        serviceConfigProperty.unionAllMountPoints(item.isOnlyFirstOneNeeded, localDB);
-        expect(serviceConfigProperty.get('value')).to.equal(item.value);
-        expect(serviceConfigProperty.get('defaultValue')).to.equal(item.value);
-      });
-    });
-
-  });
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/test/utils/configs/config_property_helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/config_property_helper_test.js b/ambari-web/test/utils/configs/config_property_helper_test.js
new file mode 100644
index 0000000..54b6eb8
--- /dev/null
+++ b/ambari-web/test/utils/configs/config_property_helper_test.js
@@ -0,0 +1,865 @@
+/**
+ * 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');
+var configPropertyHelper = require('utils/configs/config_property_helper');
+
+require('models/configs/objects/service_config_property');
+
+var serviceConfig,
+  group,
+  serviceConfigProperty,
+
+  components = [
+    {
+      name: 'NameNode',
+      master: true
+    },
+    {
+      name: 'SNameNode',
+      master: true
+    },
+    {
+      name: 'JobTracker',
+      master: true
+    },
+    {
+      name: 'HBase Master',
+      master: true
+    },
+    {
+      name: 'Oozie Master',
+      master: true
+    },
+    {
+      name: 'Hive Metastore',
+      master: true
+    },
+    {
+      name: 'WebHCat Server',
+      master: true
+    },
+    {
+      name: 'ZooKeeper Server',
+      master: true
+    },
+    {
+      name: 'Ganglia',
+      master: true
+    },
+    {
+      name: 'DataNode',
+      slave: true
+    },
+    {
+      name: 'TaskTracker',
+      slave: true
+    },
+    {
+      name: 'RegionServer',
+      slave: true
+    }
+  ],
+  masters = components.filterProperty('master'),
+  slaves = components.filterProperty('slave');
+
+
+describe('configPropertyHelper', function () {
+
+  beforeEach(function () {
+    serviceConfigProperty = App.ServiceConfigProperty.create();
+  });
+
+  describe('#setDefaultValue', function () {
+    it('should change the default value', function () {
+      serviceConfigProperty.set('defaultValue', 'value0');
+      configPropertyHelper.setDefaultValue(serviceConfigProperty, /\d/, '1');
+      expect(serviceConfigProperty.get('defaultValue')).to.equal('value1');
+    });
+  });
+
+
+  describe('#initialValue', function () {
+
+    var cases = {
+      'kafka.ganglia.metrics.host': [
+        {
+          message: 'kafka.ganglia.metrics.host property should have the value of ganglia hostname when ganglia is selected',
+          localDB: {
+            masterComponentHosts: [
+              {
+                component: 'GANGLIA_SERVER',
+                hostName: 'c6401'
+              }
+            ]
+          },
+          expected: 'c6401'
+        },
+        {
+          message: 'kafka.ganglia.metrics.host property should have the value "localhost" when ganglia is not selected',
+          localDB: {
+            masterComponentHosts: [
+              {
+                component: 'NAMENODE',
+                hostName: 'c6401'
+              }
+            ]
+          },
+          expected: 'localhost'
+        }
+      ],
+      'hive_database': [
+        {
+          alwaysEnableManagedMySQLForHive: true,
+          currentStateName: '',
+          isManagedMySQLForHiveEnabled: false,
+          receivedValue: 'New MySQL Database',
+          value: 'New MySQL Database',
+          options: [
+            {
+              displayName: 'New MySQL Database'
+            }
+          ],
+          hidden: false
+        },
+        {
+          alwaysEnableManagedMySQLForHive: false,
+          currentStateName: 'configs',
+          isManagedMySQLForHiveEnabled: false,
+          receivedValue: 'New MySQL Database',
+          value: 'New MySQL Database',
+          options: [
+            {
+              displayName: 'New MySQL Database'
+            }
+          ],
+          hidden: false
+        },
+        {
+          alwaysEnableManagedMySQLForHive: false,
+          currentStateName: '',
+          isManagedMySQLForHiveEnabled: true,
+          receivedValue: 'New MySQL Database',
+          value: 'New MySQL Database',
+          options: [
+            {
+              displayName: 'New MySQL Database'
+            }
+          ],
+          hidden: false
+        },
+        {
+          alwaysEnableManagedMySQLForHive: false,
+          currentStateName: '',
+          isManagedMySQLForHiveEnabled: false,
+          receivedValue: 'New MySQL Database',
+          value: 'Existing MySQL Database',
+          options: [
+            {
+              displayName: 'New MySQL Database'
+            }
+          ],
+          hidden: true
+        },
+        {
+          alwaysEnableManagedMySQLForHive: false,
+          currentStateName: '',
+          isManagedMySQLForHiveEnabled: false,
+          receivedValue: 'New PostgreSQL Database',
+          value: 'New PostgreSQL Database',
+          options: [
+            {
+              displayName: 'New MySQL Database'
+            }
+          ],
+          hidden: true
+        }
+      ],
+      'hbase.zookeeper.quorum': [
+        {
+          filename: 'hbase-site.xml',
+          value: 'host0,host1',
+          defaultValue: 'host0,host1',
+          title: 'should set ZooKeeper Server hostnames'
+        },
+        {
+          filename: 'ams-hbase-site.xml',
+          value: 'localhost',
+          defaultValue: '',
+          title: 'should ignore ZooKeeper Server hostnames'
+        }
+      ],
+      'hbase.tmp.dir': [
+        {
+          filename: 'hbase-site.xml',
+          isUnionAllMountPointsCalled: true,
+          title: 'unionAllMountPoints should be called'
+        },
+        {
+          filename: 'ams-hbase-site.xml',
+          isUnionAllMountPointsCalled: false,
+          title: 'unionAllMountPoints shouldn\'t be called'
+        }
+      ],
+      'hivemetastore_host': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h0'
+            },
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h1'
+            }
+          ]
+        },
+        value: ['h0', 'h1'],
+        title: 'array that contains names of hosts with Hive Metastore'
+      },
+      'hive_master_hosts': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'HIVE_SERVER',
+              hostName: 'h0'
+            },
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h0'
+            },
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h1'
+            },
+            {
+              component: 'WEBHCAT_SERVER',
+              hostName: 'h2'
+            }
+          ]
+        },
+        value: 'h0,h1',
+        title: 'comma separated list of hosts with Hive Server and Metastore'
+      },
+      'hive.metastore.uris': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h0'
+            },
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h1'
+            }
+          ]
+        },
+        dependencies: {
+          'hive.metastore.uris': 'thrift://localhost:9083'
+        },
+        defaultValue: 'thrift://localhost:9083',
+        value: 'thrift://h0:9083,thrift://h1:9083',
+        title: 'comma separated list of Metastore hosts with thrift prefix and port'
+      },
+      'templeton.hive.properties': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h0'
+            },
+            {
+              component: 'HIVE_METASTORE',
+              hostName: 'h1'
+            }
+          ]
+        },
+        dependencies: {
+          'hive.metastore.uris': 'thrift://localhost:9083'
+        },
+        defaultValue: 'hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false',
+        value: 'hive.metastore.local=false,hive.metastore.uris=thrift://h0:9083\\,thrift://h1:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true',
+        title: 'should add relevant hive.metastore.uris value'
+      },
+      'yarn.resourcemanager.zk-address': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'ZOOKEEPER_SERVER',
+              hostName: 'h0'
+            },
+            {
+              component: 'ZOOKEEPER_SERVER',
+              hostName: 'h1'
+            }
+          ]
+        },
+        dependencies: {
+          clientPort: '2182'
+        },
+        defaultValue: 'localhost:2181',
+        value: 'h0:2182',
+        title: 'should add ZK host and port dynamically'
+      },
+      'oozieserver_host': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'OOZIE_SERVER',
+              hostName: 'h0'
+            },
+            {
+              component: 'OOZIE_SERVER',
+              hostName: 'h1'
+            }
+          ]
+        },
+        value: ['h0', 'h1'],
+        title: 'array that contains names of hosts with Oozie Server'
+      },
+      'knox_gateway_host': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'KNOX_GATEWAY',
+              hostName: 'h0'
+            },
+            {
+              component: 'KNOX_GATEWAY',
+              hostName: 'h1'
+            }
+          ]
+        },
+        value: ['h0', 'h1'],
+        title: 'array that contains names of hosts with Knox Gateway'
+      }
+    };
+
+    cases['kafka.ganglia.metrics.host'].forEach(function (item) {
+      it(item.message, function () {
+        serviceConfigProperty.setProperties({
+          name: 'kafka.ganglia.metrics.host',
+          value: 'localhost'
+        });
+        configPropertyHelper.initialValue(serviceConfigProperty, item.localDB);
+        expect(serviceConfigProperty.get('value')).to.equal(item.expected);
+      });
+    });
+
+    cases['hive_database'].forEach(function (item) {
+      var title = 'hive_database value should be set to {0}';
+      it(title.format(item.value), function () {
+        sinon.stub(App, 'get')
+          .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
+          .withArgs('router.currentState.name').returns(item.currentStateName)
+          .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
+        serviceConfigProperty.setProperties({
+          name: 'hive_database',
+          value: item.receivedValue,
+          options: item.options
+        });
+        configPropertyHelper.initialValue(serviceConfigProperty, {});
+        expect(serviceConfigProperty.get('value')).to.equal(item.value);
+        expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
+        App.get.restore();
+      });
+    });
+
+    cases['hbase.zookeeper.quorum'].forEach(function (item) {
+      it(item.title, function () {
+        serviceConfigProperty.setProperties({
+          name: 'hbase.zookeeper.quorum',
+          value: 'localhost',
+          'filename': item.filename
+        });
+        configPropertyHelper.initialValue(serviceConfigProperty, {
+          masterComponentHosts: {
+            filterProperty: function () {
+              return {
+                mapProperty: function () {
+                  return ['host0', 'host1'];
+                }
+              };
+            }
+          }
+        });
+        expect(serviceConfigProperty.get('value')).to.equal(item.value);
+        expect(serviceConfigProperty.get('defaultValue')).to.equal(item.defaultValue);
+      });
+    });
+
+    cases['hbase.tmp.dir'].forEach(function (item) {
+      var isOnlyFirstOneNeeded = true,
+        localDB = {
+          p: 'v'
+        };
+      it(item.title, function () {
+        sinon.stub(configPropertyHelper, 'unionAllMountPoints', Em.K);
+        serviceConfigProperty.setProperties({
+          name: 'hbase.tmp.dir',
+          filename: item.filename
+        });
+        configPropertyHelper.initialValue(serviceConfigProperty, localDB);
+        expect(configPropertyHelper.unionAllMountPoints.calledWith(serviceConfigProperty, isOnlyFirstOneNeeded, localDB)).to.equal(item.isUnionAllMountPointsCalled);
+        configPropertyHelper.unionAllMountPoints.restore();
+      });
+    });
+
+    it(cases['hivemetastore_host'].title, function () {
+      serviceConfigProperty.set('name', 'hivemetastore_host');
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['hivemetastore_host'].localDB);
+      expect(serviceConfigProperty.get('value')).to.eql(cases['hivemetastore_host'].value);
+    });
+
+    it(cases['hive_master_hosts'].title, function () {
+      serviceConfigProperty.set('name', 'hive_master_hosts');
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['hive_master_hosts'].localDB);
+      expect(serviceConfigProperty.get('value')).to.equal(cases['hive_master_hosts'].value);
+    });
+
+    it(cases['hive.metastore.uris'].title, function () {
+      serviceConfigProperty.setProperties({
+        name: 'hive.metastore.uris',
+        defaultValue: cases['hive.metastore.uris'].defaultValue
+      });
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['hive.metastore.uris'].localDB, cases['hive.metastore.uris'].dependencies);
+      expect(serviceConfigProperty.get('value')).to.equal(cases['hive.metastore.uris'].value);
+      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['hive.metastore.uris'].value);
+    });
+
+    it(cases['templeton.hive.properties'].title, function () {
+      serviceConfigProperty.setProperties({
+        name: 'templeton.hive.properties',
+        defaultValue: cases['templeton.hive.properties'].defaultValue,
+        value: cases['templeton.hive.properties'].defaultValue
+      });
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['templeton.hive.properties'].localDB, cases['templeton.hive.properties'].dependencies);
+      expect(serviceConfigProperty.get('value')).to.equal(cases['templeton.hive.properties'].value);
+      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['templeton.hive.properties'].value);
+    });
+
+    it(cases['yarn.resourcemanager.zk-address'].title, function () {
+      serviceConfigProperty.setProperties({
+        name: 'yarn.resourcemanager.zk-address',
+        defaultValue: cases['yarn.resourcemanager.zk-address'].defaultValue
+      });
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['yarn.resourcemanager.zk-address'].localDB, cases['yarn.resourcemanager.zk-address'].dependencies);
+      expect(serviceConfigProperty.get('value')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
+      expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
+    });
+
+    it(cases['oozieserver_host'].title, function () {
+      serviceConfigProperty.set('name', 'oozieserver_host');
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['oozieserver_host'].localDB);
+      expect(serviceConfigProperty.get('value')).to.eql(cases['oozieserver_host'].value);
+    });
+
+    it(cases['knox_gateway_host'].title, function () {
+      serviceConfigProperty.set('name', 'knox_gateway_host');
+      configPropertyHelper.initialValue(serviceConfigProperty, cases['knox_gateway_host'].localDB);
+      expect(serviceConfigProperty.get('value')).to.eql(cases['knox_gateway_host'].value);
+    });
+
+  });
+
+  describe('#getHiveMetastoreUris', function () {
+
+    var cases = [
+      {
+        hosts: [
+          {
+            hostName: 'h0',
+            component: 'HIVE_SERVER'
+          },
+          {
+            hostName: 'h1',
+            component: 'HIVE_METASTORE'
+          },
+          {
+            hostName: 'h2',
+            component: 'HIVE_METASTORE'
+          }
+        ],
+        defaultValue: 'thrift://localhost:9083',
+        expected: 'thrift://h1:9083,thrift://h2:9083',
+        title: 'typical case'
+      },
+      {
+        hosts: [
+          {
+            hostName: 'h0',
+            component: 'HIVE_SERVER'
+          }
+        ],
+        defaultValue: 'thrift://localhost:9083',
+        expected: '',
+        title: 'no Metastore hosts in DB'
+      },
+      {
+        hosts: [
+          {
+            hostName: 'h0',
+            component: 'HIVE_SERVER'
+          },
+          {
+            hostName: 'h1',
+            component: 'HIVE_METASTORE'
+          },
+          {
+            hostName: 'h2',
+            component: 'HIVE_METASTORE'
+          }
+        ],
+        defaultValue: '',
+        expected: '',
+        title: 'default value without port'
+      },
+      {
+        hosts: [
+          {
+            hostName: 'h0',
+            component: 'HIVE_SERVER'
+          },
+          {
+            hostName: 'h1',
+            component: 'HIVE_METASTORE'
+          },
+          {
+            hostName: 'h2',
+            component: 'HIVE_METASTORE'
+          }
+        ],
+        expected: '',
+        title: 'no default value specified'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(configPropertyHelper.getHiveMetastoreUris(item.hosts, item.defaultValue)).to.equal(item.expected);
+      });
+    });
+
+  });
+
+  describe('#unionAllMountPoints', function () {
+
+    var localDB = {
+        masterComponentHosts: [
+          {
+            component: 'NAMENODE',
+            hostName: 'h0'
+          },
+          {
+            component: 'SECONDARY_NAMENODE',
+            hostName: 'h4'
+          },
+          {
+            component: 'APP_TIMELINE_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'ZOOKEEPER_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'ZOOKEEPER_SERVER',
+            hostName: 'h1'
+          },
+          {
+            component: 'OOZIE_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'OOZIE_SERVER',
+            hostName: 'h1'
+          },
+          {
+            component: 'NIMBUS',
+            hostName: 'h2'
+          },
+          {
+            component: 'FALCON_SERVER',
+            hostName: 'h3'
+          },
+          {
+            component: 'KAFKA_BROKER',
+            hostName: 'h0'
+          },
+          {
+            component: 'KAFKA_BROKER',
+            hostName: 'h1'
+          }
+        ],
+        slaveComponentHosts: [
+          {
+            componentName: 'DATANODE',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'TASKTRACKER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'NODEMANAGER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              },
+              {
+                hostName: 'h4'
+              }
+            ]
+          },
+          {
+            componentName: 'HBASE_REGIONSERVER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'SUPERVISOR',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          }
+        ],
+        hosts: {
+          h0: {
+            disk_info: [
+              {
+                mountpoint: '/'
+              },
+              {
+                mountpoint: '/home'
+              },
+              {
+                mountpoint: '/boot'
+              },
+              {
+                mountpoint: '/boot/efi'
+              },
+              {
+                mountpoint: '/mnt'
+              },
+              {
+                mountpoint: '/mnt/efi'
+              },
+              {
+                mountpoint: '/media/disk0',
+                available: '100000000'
+              },
+              {
+                mountpoint: '/mount0',
+                available: '100000000'
+              }
+            ]
+          },
+          h4: {
+            disk_info: [
+              {
+                mountpoint: 'c:',
+                available: '100000000'
+              }
+            ]
+          }
+        }
+      },
+      cases = [
+        {
+          name: 'dfs.namenode.name.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n'
+        },
+        {
+          name: 'dfs.name.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n'
+        },
+        {
+          name: 'fs.checkpoint.dir',
+          isOnlyFirstOneNeeded: true,
+          value: 'file:///c:/default\n'
+        },
+        {
+          name: 'dfs.namenode.checkpoint.dir',
+          isOnlyFirstOneNeeded: true,
+          value: 'file:///c:/default\n'
+        },
+        {
+          name: 'dfs.data.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'dfs.datanode.data.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'mapred.local.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'yarn.nodemanager.log-dirs',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
+        },
+        {
+          name: 'yarn.nodemanager.local-dirs',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
+        },
+        {
+          name: 'yarn.timeline-service.leveldb-timeline-store.path',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'dataDir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'oozie_data_dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'hbase.tmp.dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'storm.local.dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: '*.falcon.graph.storage.directory',
+          isOnlyFirstOneNeeded: true,
+          value: '/default'
+        },
+        {
+          name: '*.falcon.graph.serialize.path',
+          isOnlyFirstOneNeeded: true,
+          value: '/default'
+        },
+        {
+          name: 'log.dirs',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        }
+      ];
+
+    beforeEach(function () {
+      sinon.stub(App.Host, 'find').returns([
+        Em.Object.create({
+          id: 'h1',
+          diskInfo: [
+            {
+              mountpoint: '/media/disk1',
+              type: 'devtmpfs'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'tmpfs'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'vboxsf'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'CDFS'
+            },
+            {
+              mountpoint: '/media/disk1',
+              available: '0'
+            },
+            {
+              mountpoint: '/media/disk1',
+              available: '100000000'
+            },
+            {
+              mountpoint: '/mount1',
+              available: '100000000'
+            }
+          ]
+        }),
+        Em.Object.create({
+          id: 'h2',
+          diskInfo: [
+            {
+              mountpoint: '/'
+            }
+          ]
+        }),
+        Em.Object.create({
+          id: 'h3',
+          diskInfo: []
+        })
+      ]);
+    });
+
+    afterEach(function () {
+      App.Host.find.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.name, function () {
+        serviceConfigProperty.setProperties({
+          name: item.name,
+          defaultDirectory: '/default'
+        });
+        configPropertyHelper.unionAllMountPoints(serviceConfigProperty, item.isOnlyFirstOneNeeded, localDB);
+        expect(serviceConfigProperty.get('value')).to.equal(item.value);
+        expect(serviceConfigProperty.get('defaultValue')).to.equal(item.value);
+      });
+    });
+
+  });
+});
\ No newline at end of file


[2/4] ambari git commit: AMBARI-10826 Move App.ServiceConfigProperty object to separate file. (ababiichuk)

Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/utils/configs/config_property_helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_property_helper.js b/ambari-web/app/utils/configs/config_property_helper.js
new file mode 100644
index 0000000..76b294f
--- /dev/null
+++ b/ambari-web/app/utils/configs/config_property_helper.js
@@ -0,0 +1,554 @@
+/**
+ * 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');
+
+module.exports = {
+
+  initialValue: function (configProperty, localDB, dependencies) {
+    var masterComponentHostsInDB = localDB.masterComponentHosts;
+    var slaveComponentHostsInDB = localDB.slaveComponentHosts;
+    var isOnlyFirstOneNeeded = true;
+    var hostWithPort = "([\\w|\\.]*)(?=:)";
+    var hostWithPrefix = ":\/\/" + hostWithPort;
+    switch (configProperty.get('name')) {
+      case 'namenode_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName'));
+        break;
+      case 'dfs.namenode.rpc-address':
+      case 'dfs.http.address':
+      case 'dfs.namenode.http-address':
+      case 'dfs.https.address':
+      case 'dfs.namenode.https-address':
+        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
+        this.setDefaultValue(configProperty, hostWithPort,nnHost);
+        break;
+      case 'fs.default.name':
+      case 'fs.defaultFS':
+      case 'hbase.rootdir':
+      case 'instance.volumes':
+        var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
+        this.setDefaultValue(configProperty, hostWithPrefix,'://' + nnHost);
+        break;
+      case 'snamenode_host':
+        // Secondary NameNode does not exist when NameNode HA is enabled
+        var snn = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
+        if (snn) {
+          configProperty.set('value', snn.hostName);
+        }
+        break;
+      case 'dfs.secondary.http.address':
+      case 'dfs.namenode.secondary.http-address':
+        var snnHost = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
+        if (snnHost) {
+          this.setDefaultValue(configProperty, hostWithPort,snnHost.hostName);
+        }
+        break;
+      case 'datanode_hosts':
+        configProperty.set('value', slaveComponentHostsInDB.findProperty('componentName', 'DATANODE').hosts.mapProperty('hostName'));
+        break;
+      case 'nfsgateway_hosts':
+        var gwyHost = slaveComponentHostsInDB.findProperty('componentName', 'NFS_GATEWAY');
+        if(gwyHost) {
+          configProperty.set('value', gwyHost.hosts.mapProperty('hostName'));
+        }
+        break;
+      case 'hs_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName'));
+        break;
+      case 'yarn.log.server.url':
+        var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
+        this.setDefaultValue(configProperty, hostWithPrefix,'://' + hsHost);
+        break;
+      case 'mapreduce.jobhistory.webapp.address':
+      case 'mapreduce.jobhistory.address':
+        var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
+        this.setDefaultValue(configProperty, hostWithPort,hsHost);
+        break;
+      case 'rm_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName);
+        break;
+      case 'ats_host':
+        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
+        if (atsHost)
+          configProperty.set('value', atsHost.hostName);
+        else
+          configProperty.set('value', 'false');
+        break;
+      case 'yarn.resourcemanager.hostname':
+        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
+        configProperty.set('defaultValue',rmHost);
+        configProperty.set('value',configProperty.get('defaultValue'));
+        break;
+      case 'yarn.resourcemanager.resource-tracker.address':
+      case 'yarn.resourcemanager.webapp.https.address':
+      case 'yarn.resourcemanager.webapp.address':
+      case 'yarn.resourcemanager.scheduler.address':
+      case 'yarn.resourcemanager.address':
+      case 'yarn.resourcemanager.admin.address':
+        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
+        this.setDefaultValue(configProperty, hostWithPort,rmHost);
+        break;
+      case 'yarn.timeline-service.webapp.address':
+      case 'yarn.timeline-service.webapp.https.address':
+      case 'yarn.timeline-service.address':
+        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
+        if (atsHost && atsHost.hostName) {
+          this.setDefaultValue(configProperty, hostWithPort,atsHost.hostName);
+        }
+        break;
+      case 'nm_hosts':
+        configProperty.set('value', slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER').hosts.mapProperty('hostName'));
+        break;
+      case 'jobtracker_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName);
+        break;
+      case 'mapred.job.tracker':
+      case 'mapred.job.tracker.http.address':
+        var jtHost = masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName;
+        this.setDefaultValue(configProperty, hostWithPort,jtHost);
+        break;
+      case 'mapreduce.history.server.http.address':
+        var jtHost = masterComponentHostsInDB.findProperty('component', 'HISTORYSERVER').hostName;
+        this.setDefaultValue(configProperty, hostWithPort,jtHost);
+        break;
+      case 'tasktracker_hosts':
+        configProperty.set('value', slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER').hosts.mapProperty('hostName'));
+        break;
+      case 'hbasemaster_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'HBASE_MASTER').mapProperty('hostName'));
+        break;
+      case 'regionserver_hosts':
+        configProperty.set('value', slaveComponentHostsInDB.findProperty('componentName', 'HBASE_REGIONSERVER').hosts.mapProperty('hostName'));
+        break;
+      case 'hivemetastore_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'));
+        break;
+      case 'hive_ambari_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
+        break;
+      case 'hive_master_hosts':
+        var hostNames = masterComponentHostsInDB.filter(function (masterComponent) {
+          return ['HIVE_METASTORE', 'HIVE_SERVER'].contains(masterComponent.component);
+        });
+        configProperty.set('value', hostNames.mapProperty('hostName').uniq().join(','));
+        break;
+      case 'hive_database':
+        var newMySQLDBOption = configProperty.get('options').findProperty('displayName', 'New MySQL Database');
+        if (newMySQLDBOption) {
+          var isNewMySQLDBOptionHidden = !App.get('supports.alwaysEnableManagedMySQLForHive') && App.get('router.currentState.name') != 'configs' &&
+            !App.get('isManagedMySQLForHiveEnabled');
+          if (isNewMySQLDBOptionHidden && configProperty.get('value') == 'New MySQL Database') {
+            configProperty.set('value', 'Existing MySQL Database');
+          }
+          Em.set(newMySQLDBOption, 'hidden', isNewMySQLDBOptionHidden);
+        }
+        break;
+      case 'oozieserver_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER').mapProperty('hostName'));
+        break;
+      case 'oozie.base.url':
+        var oozieHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
+        this.setDefaultValue(configProperty, hostWithPrefix,'://' + oozieHost);
+        break;
+      case 'webhcatserver_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'WEBHCAT_SERVER').hostName);
+        break;
+      case 'oozie_ambari_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName);
+        break;
+      case 'hadoop_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName'));
+        break;
+      case 'hive_existing_mysql_host':
+      case 'hive_existing_postgresql_host':
+      case 'hive_existing_oracle_host':
+      case 'hive_existing_mssql_server_host':
+      case 'hive_existing_mssql_server_2_host':
+        var hiveServerHost = masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName;
+        configProperty.set('value', hiveServerHost).set('defaultValue', hiveServerHost);
+        break;
+      case 'hive.metastore.uris':
+        var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']);
+        if (hiveMSUris) {
+          this.setDefaultValue(configProperty, "(.*)", hiveMSUris);
+        }
+        break;
+      case 'oozie_existing_mysql_host':
+      case 'oozie_existing_postgresql_host':
+      case 'oozie_existing_oracle_host':
+      case 'oozie_existing_mssql_server_host':
+      case 'oozie_existing_mssql_server_2_host':
+        var oozieServerHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
+        configProperty.set('value', oozieServerHost).set('defaultValue', oozieServerHost);
+        break;
+      case 'storm.zookeeper.servers':
+      case 'zookeeperserver_hosts':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName'));
+        break;
+      case 'nimbus.host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'NIMBUS').hostName);
+        break;
+      case 'falconserver_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'FALCON_SERVER').hostName);
+        break;
+      case 'drpcserver_host':
+        var drpcHost = masterComponentHostsInDB.findProperty('component', 'DRPC_SERVER');
+        if (drpcHost) {
+          configProperty.set('value', drpcHost.hostName);
+        }
+        break;
+      case 'stormuiserver_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'STORM_UI_SERVER').hostName);
+        break;
+      case 'storm_rest_api_host':
+        var stormRresApiHost = masterComponentHostsInDB.findProperty('component', 'STORM_REST_API');
+        if(stormRresApiHost) {
+          configProperty.set('value', stormRresApiHost.hostName);
+        }
+        break;
+      case 'supervisor_hosts':
+        configProperty.set('value', slaveComponentHostsInDB.findProperty('componentName', 'SUPERVISOR').hosts.mapProperty('hostName'));
+        break;
+      case 'knox_gateway_host':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'KNOX_GATEWAY').mapProperty('hostName'));
+        break;
+      case 'kafka_broker_hosts':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER').mapProperty('hostName'));
+        break;
+      case 'kafka.ganglia.metrics.host':
+        var gangliaHost =  masterComponentHostsInDB.findProperty('component', 'GANGLIA_SERVER');
+        if (gangliaHost) {
+          configProperty.set('value', gangliaHost.hostName);
+        }
+        break;
+      case 'hbase.zookeeper.quorum':
+        if (configProperty.get('filename') == 'hbase-site.xml') {
+          var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
+          this.setDefaultValue(configProperty, "(\\w*)", zkHosts);
+        }
+        break;
+      case 'yarn.resourcemanager.zk-address':
+        var value = masterComponentHostsInDB.findProperty('component', 'ZOOKEEPER_SERVER').hostName + ':' + dependencies.clientPort;
+        configProperty.setProperties({
+          value: value,
+          defaultValue: value
+        });
+        break;
+      case 'zookeeper.connect':
+      case 'hive.zookeeper.quorum':
+      case 'templeton.zookeeper.hosts':
+      case 'hadoop.registry.zk.quorum':
+      case 'hive.cluster.delegation.token.store.zookeeper.connectString':
+      case 'instance.zookeeper.host': // for accumulo
+        var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
+        var zkHostPort = zkHosts;
+        var regex = "\\w*:(\\d+)";   //regex to fetch the port
+        var portValue = configProperty.get('defaultValue').match(new RegExp(regex));
+        if (!portValue) return;
+        if (portValue[1]) {
+          for ( var i = 0; i < zkHosts.length; i++ ) {
+            zkHostPort[i] = zkHosts[i] + ":" + portValue[1];
+          }
+        }
+        this.setDefaultValue(configProperty, "(.*)", zkHostPort);
+        break;
+      case 'templeton.hive.properties':
+        var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']).replace(',', '\\,');
+        if (/\/\/localhost:/g.test(configProperty.get('value'))) {
+          configProperty.set('defaultValue', configProperty.get('value') + ',hive.metastore.execute.setugi=true');
+        }
+        this.setDefaultValue(configProperty, "(hive\\.metastore\\.uris=)([^\\,]+)", "$1" + hiveMSUris);
+        break;
+      case 'dfs.name.dir':
+      case 'dfs.namenode.name.dir':
+      case 'dfs.data.dir':
+      case 'dfs.datanode.data.dir':
+      case 'yarn.nodemanager.local-dirs':
+      case 'yarn.nodemanager.log-dirs':
+      case 'mapred.local.dir':
+      case 'log.dirs':  // for Kafka Broker
+        this.unionAllMountPoints(configProperty, !isOnlyFirstOneNeeded, localDB);
+        break;
+      case 'hbase.tmp.dir':
+        if (configProperty.get('filename') == 'hbase-site.xml') {
+          this.unionAllMountPoints(configProperty, isOnlyFirstOneNeeded, localDB);
+        }
+        break;
+      case 'fs.checkpoint.dir':
+      case 'dfs.namenode.checkpoint.dir':
+      case 'yarn.timeline-service.leveldb-timeline-store.path':
+      case 'dataDir':
+      case 'oozie_data_dir':
+      case 'storm.local.dir':
+      case '*.falcon.graph.storage.directory':
+      case '*.falcon.graph.serialize.path':
+        this.unionAllMountPoints(configProperty, isOnlyFirstOneNeeded, localDB);
+        break;
+      case '*.broker.url':
+        var falconServerHost = masterComponentHostsInDB.findProperty('component', 'FALCON_SERVER').hostName;
+        this.setDefaultValue(configProperty, 'localhost', falconServerHost);
+        break;
+      case 'RANGER_HOST':
+        var rangerAdminHost = masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN');
+        if(rangerAdminHost) {
+          configProperty.set('value', rangerAdminHost.hostName);
+        } else {
+          configProperty.set('isVisible', 'false');
+          configProperty.set('isRequired', 'false');
+        }
+        break;
+    }
+  },
+
+  /**
+   * Get hive.metastore.uris initial value
+   * @param hosts
+   * @param defaultValue
+   * @returns {string}
+   */
+  getHiveMetastoreUris: function (hosts, defaultValue) {
+    var hiveMSHosts = hosts.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'),
+      hiveMSUris = hiveMSHosts,
+      regex = "\\w*:(\\d+)",
+      portValue = defaultValue && defaultValue.match(new RegExp(regex));
+
+    if (!portValue) return '';
+    if (portValue[1]) {
+      for (var i = 0; i < hiveMSHosts.length; i++) {
+        hiveMSUris[i] = "thrift://" + hiveMSHosts[i] + ":" + portValue[1];
+      }
+    }
+    return hiveMSUris.join(',');
+  },
+
+  /**
+   * @param regex : String
+   * @param replaceWith : String
+   * @param configProperty
+   */
+  setDefaultValue: function(configProperty, regex, replaceWith) {
+    var defaultValue = configProperty.get('defaultValue');
+    var re = new RegExp(regex);
+    defaultValue = defaultValue.replace(re,replaceWith);
+    configProperty.set('defaultValue',defaultValue);
+    configProperty.set('value',configProperty.get('defaultValue'));
+  },
+
+  unionAllMountPoints: function (configProperty, isOnlyFirstOneNeeded, localDB) {
+    var hostname = '';
+    var mountPointsPerHost = [];
+    var mountPointAsRoot;
+    var masterComponentHostsInDB = localDB.masterComponentHosts;
+    var slaveComponentHostsInDB = localDB.slaveComponentHosts;
+    var hostsInfo = localDB.hosts; // which we are setting in installerController in step3.
+    //all hosts should be in local storage without using App.Host model
+    App.Host.find().forEach(function(item){
+      if(!hostsInfo[item.get('id')]){
+        hostsInfo[item.get('id')] = {
+          name: item.get('id'),
+          cpu: item.get('cpu'),
+          memory: item.get('memory'),
+          disk_info: item.get('diskInfo'),
+          bootStatus: "REGISTERED",
+          isInstalled: true
+        };
+      }
+    });
+    var temp = '';
+    var setOfHostNames = [];
+    var components = [];
+    switch (configProperty.get('name')) {
+      case 'dfs.namenode.name.dir':
+      case 'dfs.name.dir':
+        components = masterComponentHostsInDB.filterProperty('component', 'NAMENODE');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'fs.checkpoint.dir':
+      case 'dfs.namenode.checkpoint.dir':
+        components = masterComponentHostsInDB.filterProperty('component', 'SECONDARY_NAMENODE');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'dfs.data.dir':
+      case 'dfs.datanode.data.dir':
+        temp = slaveComponentHostsInDB.findProperty('componentName', 'DATANODE');
+        temp.hosts.forEach(function (host) {
+          setOfHostNames.push(host.hostName);
+        }, this);
+        break;
+      case 'mapred.local.dir':
+        temp = slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER') || slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER');
+        temp.hosts.forEach(function (host) {
+          setOfHostNames.push(host.hostName);
+        }, this);
+        break;
+      case 'yarn.nodemanager.log-dirs':
+      case 'yarn.nodemanager.local-dirs':
+        temp = slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER');
+        temp.hosts.forEach(function (host) {
+          setOfHostNames.push(host.hostName);
+        }, this);
+        break;
+      case 'yarn.timeline-service.leveldb-timeline-store.path':
+        components = masterComponentHostsInDB.filterProperty('component', 'APP_TIMELINE_SERVER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'dataDir':
+        components = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'oozie_data_dir':
+        components = masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'hbase.tmp.dir':
+        temp = slaveComponentHostsInDB.findProperty('componentName', 'HBASE_REGIONSERVER');
+        temp.hosts.forEach(function (host) {
+          setOfHostNames.push(host.hostName);
+        }, this);
+        break;
+      case 'storm.local.dir':
+        temp = slaveComponentHostsInDB.findProperty('componentName', 'SUPERVISOR');
+        temp.hosts.forEach(function (host) {
+          setOfHostNames.push(host.hostName);
+        }, this);
+        components = masterComponentHostsInDB.filterProperty('component', 'NIMBUS');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case '*.falcon.graph.storage.directory':
+      case '*.falcon.graph.serialize.path':
+        components = masterComponentHostsInDB.filterProperty('component', 'FALCON_SERVER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+      case 'log.dirs':
+        components = masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
+    }
+
+    // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.
+    if (setOfHostNames.length === 0) {
+      return;
+    }
+
+    var allMountPoints = [];
+    for (var i = 0; i < setOfHostNames.length; i++) {
+      hostname = setOfHostNames[i];
+
+      mountPointsPerHost = hostsInfo[hostname].disk_info;
+
+      mountPointAsRoot = mountPointsPerHost.findProperty('mountpoint', '/');
+
+      // If Server does not send any host details information then atleast one mountpoint should be presumed as root
+      // This happens in a single container Linux Docker environment.
+      if (!mountPointAsRoot) {
+        mountPointAsRoot = {mountpoint: '/'};
+      }
+
+      mountPointsPerHost = mountPointsPerHost.filter(function (mPoint) {
+        return !(['/', '/home'].contains(mPoint.mountpoint)
+          || ['/etc/resolv.conf', '/etc/hostname', '/etc/hosts'].contains(mPoint.mountpoint) // docker specific mount points
+          || mPoint.mountpoint && (mPoint.mountpoint.startsWith('/boot') || mPoint.mountpoint.startsWith('/mnt'))
+          || ['devtmpfs', 'tmpfs', 'vboxsf', 'CDFS'].contains(mPoint.type)
+          || mPoint.available == 0);
+      });
+
+      mountPointsPerHost.forEach(function (mPoint) {
+        if( !allMountPoints.findProperty("mountpoint", mPoint.mountpoint)) {
+          allMountPoints.push(mPoint);
+        }
+      }, this);
+    }
+    if (allMountPoints.length == 0) {
+      allMountPoints.push(mountPointAsRoot);
+    }
+    configProperty.set('value', '');
+    var winRegex = /^([a-z]):\\?$/;
+    if (!isOnlyFirstOneNeeded) {
+      allMountPoints.forEach(function (eachDrive) {
+        var mPoint = configProperty.get('value');
+        if (!mPoint) {
+          mPoint = "";
+        }
+        if (eachDrive.mountpoint === "/") {
+          mPoint += configProperty.get('defaultDirectory') + "\n";
+        } else if(winRegex.test(eachDrive.mountpoint.toLowerCase())) {
+          switch (configProperty.get('name')) {
+            case 'dfs.name.dir':
+            case 'dfs.namenode.name.dir':
+            case 'dfs.data.dir':
+            case 'dfs.datanode.data.dir':
+              var winDriveUrl = eachDrive.mountpoint.toLowerCase().replace(winRegex, "file:///$1:");
+              mPoint += winDriveUrl + configProperty.get('defaultDirectory') + "\n";
+              break;
+            default:
+              var winDrive = eachDrive.mountpoint.toLowerCase().replace(winRegex, "$1:");
+              var winDir = configProperty.get('defaultDirectory').replace(/\//g, "\\");
+              mPoint += winDrive + winDir + "\n";
+          }
+        } else {
+          mPoint += eachDrive.mountpoint + configProperty.get('defaultDirectory') + "\n";
+        }
+        configProperty.set('value', mPoint);
+        configProperty.set('defaultValue', mPoint);
+      }, this);
+    } else {
+      var mPoint = allMountPoints[0].mountpoint;
+      if (mPoint === "/") {
+        mPoint = configProperty.get('defaultDirectory');
+      } else if(winRegex.test(mPoint.toLowerCase())) {
+        switch (configProperty.get('name')) {
+          case 'fs.checkpoint.dir':
+          case 'dfs.namenode.checkpoint.dir':
+            var winDriveUrl = mPoint.toLowerCase().replace(winRegex, "file:///$1:");
+            mPoint = winDriveUrl + configProperty.get('defaultDirectory') + "\n";
+            break;
+          case 'zk_data_dir':
+            var winDrive = mPoint.toLowerCase().replace(winRegex, "$1:");
+            var winDir = configProperty.get('defaultDirectory').replace(/\//g, "\\\\");
+            mPoint = winDrive + winDir + "\n";
+            break;
+          default:
+            var winDrive = mPoint.toLowerCase().replace(winRegex, "$1:");
+            var winDir = configProperty.get('defaultDirectory').replace(/\//g, "\\");
+            mPoint = winDrive + winDir + "\n";
+        }
+      } else {
+        mPoint = mPoint + configProperty.get('defaultDirectory');
+      }
+      configProperty.set('value', mPoint);
+      configProperty.set('defaultValue', mPoint);
+    }
+  }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/test/models/configs/objects/service_config_category_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_category_test.js b/ambari-web/test/models/configs/objects/service_config_category_test.js
new file mode 100644
index 0000000..449c874
--- /dev/null
+++ b/ambari-web/test/models/configs/objects/service_config_category_test.js
@@ -0,0 +1,184 @@
+
+/**
+ * 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');
+var configPropertyHelper = require('utils/configs/config_property_helper');
+
+require('models/configs/objects/service_config_category');
+require('models/configs/objects/service_config_property');
+
+var serviceConfigCategory,
+  nameCases = [
+    {
+      name: 'DataNode',
+      primary: 'DATANODE'
+    },
+    {
+      name: 'TaskTracker',
+      primary: 'TASKTRACKER'
+    },
+    {
+      name: 'RegionServer',
+      primary: 'HBASE_REGIONSERVER'
+    },
+    {
+      name: 'name',
+      primary: null
+    }
+  ],
+  components = [
+    {
+      name: 'NameNode',
+      master: true
+    },
+    {
+      name: 'SNameNode',
+      master: true
+    },
+    {
+      name: 'JobTracker',
+      master: true
+    },
+    {
+      name: 'HBase Master',
+      master: true
+    },
+    {
+      name: 'Oozie Master',
+      master: true
+    },
+    {
+      name: 'Hive Metastore',
+      master: true
+    },
+    {
+      name: 'WebHCat Server',
+      master: true
+    },
+    {
+      name: 'ZooKeeper Server',
+      master: true
+    },
+    {
+      name: 'Ganglia',
+      master: true
+    },
+    {
+      name: 'DataNode',
+      slave: true
+    },
+    {
+      name: 'TaskTracker',
+      slave: true
+    },
+    {
+      name: 'RegionServer',
+      slave: true
+    }
+  ],
+  masters = components.filterProperty('master'),
+  slaves = components.filterProperty('slave'),
+  groupsData = {
+    groups: [
+      Em.Object.create({
+        errorCount: 1
+      }),
+      Em.Object.create({
+        errorCount: 2
+      })
+    ]
+  };
+
+describe('App.ServiceConfigCategory', function () {
+
+  beforeEach(function () {
+    serviceConfigCategory = App.ServiceConfigCategory.create();
+  });
+
+  describe('#primaryName', function () {
+    nameCases.forEach(function (item) {
+      it('should return ' + item.primary, function () {
+        serviceConfigCategory.set('name', item.name);
+        expect(serviceConfigCategory.get('primaryName')).to.equal(item.primary);
+      })
+    });
+  });
+
+  describe('#isForMasterComponent', function () {
+    masters.forEach(function (item) {
+      it('should be true for ' + item.name, function () {
+        serviceConfigCategory.set('name', item.name);
+        expect(serviceConfigCategory.get('isForMasterComponent')).to.be.true;
+      });
+    });
+    it('should be false', function () {
+      serviceConfigCategory.set('name', 'name');
+      expect(serviceConfigCategory.get('isForMasterComponent')).to.be.false;
+    });
+  });
+
+  describe('#isForSlaveComponent', function () {
+    slaves.forEach(function (item) {
+      it('should be true for ' + item.name, function () {
+        serviceConfigCategory.set('name', item.name);
+        expect(serviceConfigCategory.get('isForSlaveComponent')).to.be.true;
+      });
+    });
+    it('should be false', function () {
+      serviceConfigCategory.set('name', 'name');
+      expect(serviceConfigCategory.get('isForSlaveComponent')).to.be.false;
+    });
+  });
+
+  describe('#slaveErrorCount', function () {
+    it('should be 0', function () {
+      serviceConfigCategory.set('slaveConfigs', []);
+      expect(serviceConfigCategory.get('slaveErrorCount')).to.equal(0);
+    });
+    it('should sum all errorCount values', function () {
+      serviceConfigCategory.set('slaveConfigs', groupsData);
+      expect(serviceConfigCategory.get('slaveErrorCount')).to.equal(3);
+    });
+  });
+
+  describe('#errorCount', function () {
+    it('should sum all errors for category', function () {
+      serviceConfigCategory.reopen({
+        slaveErrorCount: 1
+      });
+      expect(serviceConfigCategory.get('errorCount')).to.equal(1);
+      serviceConfigCategory.set('nonSlaveErrorCount', 2);
+      expect(serviceConfigCategory.get('errorCount')).to.equal(3);
+      serviceConfigCategory.set('slaveErrorCount', 0);
+      expect(serviceConfigCategory.get('errorCount')).to.equal(2);
+    });
+  });
+
+  describe('#isAdvanced', function () {
+    it('should be true', function () {
+      serviceConfigCategory.set('name', 'Advanced');
+      expect(serviceConfigCategory.get('isAdvanced')).to.be.true;
+    });
+    it('should be false', function () {
+      serviceConfigCategory.set('name', 'name');
+      expect(serviceConfigCategory.get('isAdvanced')).to.be.false;
+    });
+  });
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js
new file mode 100644
index 0000000..9235d6e
--- /dev/null
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -0,0 +1,474 @@
+/**
+ * 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');
+var configPropertyHelper = require('utils/configs/config_property_helper');
+
+require('models/configs/objects/service_config_category');
+require('models/configs/objects/service_config_property');
+
+var serviceConfigProperty,
+  serviceConfigPropertyInit,
+  configsData = [
+    Ember.Object.create({
+      category: 'c0',
+      overrides: [
+        {
+          error: true,
+          errorMessage: 'error'
+        },
+        {
+          error: true
+        },
+        {}
+      ]
+    }),
+    Ember.Object.create({
+      category: 'c1',
+      isValid: false,
+      isVisible: true
+    }),
+    Ember.Object.create({
+      category: 'c0',
+      isValid: true,
+      isVisible: true
+    }),
+    Ember.Object.create({
+      category: 'c1',
+      isValid: false,
+      isVisible: false
+    })
+  ],
+
+  components = [
+    {
+      name: 'NameNode',
+      master: true
+    },
+    {
+      name: 'SNameNode',
+      master: true
+    },
+    {
+      name: 'JobTracker',
+      master: true
+    },
+    {
+      name: 'HBase Master',
+      master: true
+    },
+    {
+      name: 'Oozie Master',
+      master: true
+    },
+    {
+      name: 'Hive Metastore',
+      master: true
+    },
+    {
+      name: 'WebHCat Server',
+      master: true
+    },
+    {
+      name: 'ZooKeeper Server',
+      master: true
+    },
+    {
+      name: 'Ganglia',
+      master: true
+    },
+    {
+      name: 'DataNode',
+      slave: true
+    },
+    {
+      name: 'TaskTracker',
+      slave: true
+    },
+    {
+      name: 'RegionServer',
+      slave: true
+    }
+  ],
+  overridableFalseData = [
+    {
+      isOverridable: false
+    },
+    {
+      isEditable: false,
+      overrides: configsData[0].overrides
+    },
+    {
+      displayType: 'masterHost'
+    }
+  ],
+  overridableTrueData = [
+    {
+      isOverridable: true,
+      isEditable: true
+    },    {
+      isOverridable: true,
+      overrides: []
+    },
+    {
+      isOverridable: true
+    }
+  ],
+  overriddenFalseData = [
+    {
+      overrides: null,
+      isOriginalSCP: true
+    },
+    {
+      overrides: [],
+      isOriginalSCP: true
+    }
+  ],
+  overriddenTrueData = [
+    {
+      overrides: configsData[0].overrides
+    },
+    {
+      isOriginalSCP: false
+    }
+  ],
+  removableFalseData = [
+    {
+      isEditable: false
+    },
+    {
+      hasOverrides: true
+    },
+    {
+      isUserProperty: false,
+      isOriginalSCP: true
+    }
+  ],
+  removableTrueData = [
+    {
+      isEditable: true,
+      hasOverrides: false,
+      isUserProperty: true
+    },
+    {
+      isEditable: true,
+      hasOverrides: false,
+      isOriginalSCP: false
+    }
+  ],
+  initPropertyData = [
+    {
+      initial: {
+        displayType: 'password',
+        value: 'value'
+      },
+      result: {
+        retypedPassword: 'value'
+      }
+    },
+    {
+      initial: {
+        id: 'puppet var',
+        value: '',
+        defaultValue: 'default'
+      },
+      result: {
+        value: 'default'
+      }
+    }
+  ],
+  notDefaultFalseData = [
+    {
+      isEditable: false
+    },
+    {
+      defaultValue: null
+    },
+    {
+      value: 'value',
+      defaultValue: 'value'
+    }
+  ],
+  notDefaultTrueData = {
+    isEditable: true,
+    value: 'value',
+    defaultValue: 'default'
+  },
+  types = ['masterHost', 'slaveHosts', 'masterHosts', 'slaveHost', 'radio button'],
+  classCases = [
+    {
+      initial: {
+        displayType: 'checkbox'
+      },
+      viewClass: App.ServiceConfigCheckbox
+    },
+    {
+      initial: {
+        displayType: 'checkbox',
+        dependentConfigPattern: 'somPattern'
+      },
+      viewClass: App.ServiceConfigCheckboxWithDependencies
+    },
+    {
+      initial: {
+        displayType: 'password'
+      },
+      viewClass: App.ServiceConfigPasswordField
+    },
+    {
+      initial: {
+        displayType: 'combobox'
+      },
+      viewClass: App.ServiceConfigComboBox
+    },
+    {
+      initial: {
+        displayType: 'radio button'
+      },
+      viewClass: App.ServiceConfigRadioButtons
+    },
+    {
+      initial: {
+        displayType: 'directories'
+      },
+      viewClass: App.ServiceConfigTextArea
+    },
+    {
+      initial: {
+        displayType: 'content'
+      },
+      viewClass: App.ServiceConfigTextAreaContent
+
+    },
+    {
+      initial: {
+        displayType: 'multiLine'
+      },
+      viewClass: App.ServiceConfigTextArea
+    },
+    {
+      initial: {
+        displayType: 'custom'
+      },
+      viewClass: App.ServiceConfigBigTextArea
+    },
+    {
+      initial: {
+        displayType: 'masterHost'
+      },
+      viewClass: App.ServiceConfigMasterHostView
+    },
+    {
+      initial: {
+        displayType: 'masterHosts'
+      },
+      viewClass: App.ServiceConfigMasterHostsView
+    },
+    {
+      initial: {
+        displayType: 'slaveHosts'
+      },
+      viewClass: App.ServiceConfigSlaveHostsView
+    },
+    {
+      initial: {
+        unit: true,
+        displayType: 'type'
+      },
+      viewClass: App.ServiceConfigTextFieldWithUnit
+    },
+    {
+      initial: {
+        unit: false,
+        displayType: 'type'
+      },
+      viewClass: App.ServiceConfigTextField
+    },
+    {
+      initial: {
+        unit: false,
+        displayType: 'supportTextConnection'
+      },
+      viewClass: App.checkConnectionView
+    }
+  ];
+
+describe('App.ServiceConfigProperty', function () {
+
+  beforeEach(function () {
+    serviceConfigProperty = App.ServiceConfigProperty.create();
+  });
+
+  describe('#overrideErrorTrigger', function () {
+    it('should be an increment', function () {
+      serviceConfigProperty.set('overrides', configsData[0].overrides);
+      expect(serviceConfigProperty.get('overrideErrorTrigger')).to.equal(1);
+      serviceConfigProperty.set('overrides', []);
+      expect(serviceConfigProperty.get('overrideErrorTrigger')).to.equal(2);
+    });
+  });
+
+  describe('#isPropertyOverridable', function () {
+    overridableFalseData.forEach(function (item) {
+      it('should be false', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isPropertyOverridable')).to.be.false;
+      });
+    });
+    overridableTrueData.forEach(function (item) {
+      it('should be true', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isPropertyOverridable')).to.be.true;
+      });
+    });
+  });
+
+  describe('#isOverridden', function () {
+    overriddenFalseData.forEach(function (item) {
+      it('should be false', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isOverridden')).to.be.false;
+      });
+    });
+    overriddenTrueData.forEach(function (item) {
+      it('should be true', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isOverridden')).to.be.true;
+      });
+    });
+  });
+
+  describe('#isRemovable', function () {
+    removableFalseData.forEach(function (item) {
+      it('should be false', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isRemovable')).to.be.false;
+      });
+    });
+    removableTrueData.forEach(function (item) {
+      it('should be true', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isRemovable')).to.be.true;
+      });
+    });
+  });
+
+  describe('#init', function () {
+    initPropertyData.forEach(function (item) {
+      it('should set initial data', function () {
+        serviceConfigPropertyInit = App.ServiceConfigProperty.create(item.initial);
+        Em.keys(item.result).forEach(function (prop) {
+          expect(serviceConfigPropertyInit.get(prop)).to.equal(item.result[prop]);
+        });
+      });
+    });
+  });
+
+  describe('#isNotDefaultValue', function () {
+    notDefaultFalseData.forEach(function (item) {
+      it('should be false', function () {
+        Em.keys(item).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item[prop]);
+        });
+        expect(serviceConfigProperty.get('isNotDefaultValue')).to.be.false;
+      });
+    });
+    it('should be true', function () {
+      Em.keys(notDefaultTrueData).forEach(function (prop) {
+        serviceConfigProperty.set(prop, notDefaultTrueData[prop]);
+      });
+      expect(serviceConfigProperty.get('isNotDefaultValue')).to.be.true;
+    });
+  });
+
+  describe('#cantBeUndone', function () {
+    types.forEach(function (item) {
+      it('should be true', function () {
+        serviceConfigProperty.set('displayType', item);
+        expect(serviceConfigProperty.get('cantBeUndone')).to.be.true;
+      });
+    });
+    it('should be false', function () {
+      serviceConfigProperty.set('displayType', 'type');
+      expect(serviceConfigProperty.get('cantBeUndone')).to.be.false;
+    });
+  });
+
+  describe('#isValid', function () {
+    it('should be true', function () {
+      serviceConfigProperty.set('errorMessage', '');
+      expect(serviceConfigProperty.get('isValid')).to.be.true;
+    });
+    it('should be false', function () {
+      serviceConfigProperty.set('errorMessage', 'message');
+      expect(serviceConfigProperty.get('isValid')).to.be.false;
+    });
+  });
+
+  describe('#viewClass', function () {
+    classCases.forEach(function (item) {
+      it ('should be ' + item.viewClass, function () {
+        Em.keys(item.initial).forEach(function (prop) {
+          serviceConfigProperty.set(prop, item.initial[prop]);
+        });
+        expect(serviceConfigProperty.get('viewClass')).to.eql(item.viewClass);
+      });
+    });
+  });
+
+  describe('#validate', function () {
+    it('not required', function () {
+      serviceConfigProperty.setProperties({
+        isRequired: false,
+        value: ''
+      });
+      expect(serviceConfigProperty.get('errorMessage')).to.be.empty;
+      expect(serviceConfigProperty.get('error')).to.be.false;
+    });
+    it('should validate', function () {
+      serviceConfigProperty.setProperties({
+        isRequired: true,
+        value: 'value'
+      });
+      expect(serviceConfigProperty.get('errorMessage')).to.be.empty;
+      expect(serviceConfigProperty.get('error')).to.be.false;
+    });
+    it('should fail', function () {
+      serviceConfigProperty.setProperties({
+        isRequired: true,
+        value: 'value'
+      });
+      serviceConfigProperty.set('value', '');
+      expect(serviceConfigProperty.get('errorMessage')).to.equal('This is required');
+      expect(serviceConfigProperty.get('error')).to.be.true;
+    });
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/test/models/configs/objects/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_test.js b/ambari-web/test/models/configs/objects/service_config_test.js
new file mode 100644
index 0000000..cfa015c
--- /dev/null
+++ b/ambari-web/test/models/configs/objects/service_config_test.js
@@ -0,0 +1,165 @@
+/**
+ * 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');
+var configPropertyHelper = require('utils/configs/config_property_helper');
+
+require('models/configs/objects/service_config');
+
+var serviceConfig,
+  group,
+  configsData = [
+    Ember.Object.create({
+      category: 'c0',
+      overrides: [
+        {
+          error: true,
+          errorMessage: 'error'
+        },
+        {
+          error: true
+        },
+        {}
+      ]
+    }),
+    Ember.Object.create({
+      category: 'c1',
+      isValid: false,
+      isVisible: true
+    }),
+    Ember.Object.create({
+      category: 'c0',
+      isValid: true,
+      isVisible: true
+    }),
+    Ember.Object.create({
+      category: 'c1',
+      isValid: false,
+      isVisible: false
+    })
+  ],
+  configCategoriesData = [
+    Em.Object.create({
+      name: 'c0',
+      slaveErrorCount: 1
+    }),
+    Em.Object.create({
+      name: 'c1',
+      slaveErrorCount: 2
+    })
+  ],
+  components = [
+    {
+      name: 'NameNode',
+      master: true
+    },
+    {
+      name: 'SNameNode',
+      master: true
+    },
+    {
+      name: 'JobTracker',
+      master: true
+    },
+    {
+      name: 'HBase Master',
+      master: true
+    },
+    {
+      name: 'Oozie Master',
+      master: true
+    },
+    {
+      name: 'Hive Metastore',
+      master: true
+    },
+    {
+      name: 'WebHCat Server',
+      master: true
+    },
+    {
+      name: 'ZooKeeper Server',
+      master: true
+    },
+    {
+      name: 'Ganglia',
+      master: true
+    },
+    {
+      name: 'DataNode',
+      slave: true
+    },
+    {
+      name: 'TaskTracker',
+      slave: true
+    },
+    {
+      name: 'RegionServer',
+      slave: true
+    }
+  ],
+  masters = components.filterProperty('master'),
+  slaves = components.filterProperty('slave'),
+  groupNoErrorsData = [].concat(configsData.slice(2)),
+  groupErrorsData = [configsData[1]];
+
+describe('App.ServiceConfig', function () {
+
+  beforeEach(function () {
+    serviceConfig = App.ServiceConfig.create();
+  });
+
+  describe('#errorCount', function () {
+    it('should be 0', function () {
+      serviceConfig.setProperties({
+        configs: [],
+        configCategories: []
+      });
+      expect(serviceConfig.get('errorCount')).to.equal(0);
+    });
+    it('should sum counts of all errors', function () {
+      serviceConfig.setProperties({
+        configs: configsData,
+        configCategories: configCategoriesData
+      });
+      expect(serviceConfig.get('errorCount')).to.equal(6);
+      expect(serviceConfig.get('configCategories').findProperty('name', 'c0').get('nonSlaveErrorCount')).to.equal(2);
+      expect(serviceConfig.get('configCategories').findProperty('name', 'c1').get('nonSlaveErrorCount')).to.equal(1);
+    });
+  });
+
+});
+
+describe('App.Group', function () {
+
+  beforeEach(function () {
+    group = App.Group.create();
+  });
+
+  describe('#errorCount', function () {
+    it('should be 0', function () {
+      group.set('properties', groupNoErrorsData);
+      expect(group.get('errorCount')).to.equal(0);
+    });
+    it('should be 1', function () {
+      group.set('properties', groupErrorsData);
+      expect(group.get('errorCount')).to.equal(1);
+    });
+  });
+
+});


[3/4] ambari git commit: AMBARI-10826 Move App.ServiceConfigProperty object to separate file. (ababiichuk)

Posted by ab...@apache.org.
AMBARI-10826 Move App.ServiceConfigProperty object to separate file. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 11a09c57836e8adb4f69c66231131d68fa37cd7e
Parents: 798f107
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Apr 29 14:08:40 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Apr 29 14:58:52 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |    5 +-
 .../wizard/slave_component_groups_controller.js |    5 +-
 ambari-web/app/data/HDP2/secure_configs.js      |    4 +-
 ambari-web/app/data/service_configs.js          |    2 +-
 ambari-web/app/models.js                        |    4 +-
 .../models/configs/objects/service_config.js    |   96 ++
 .../configs/objects/service_config_category.js  |   89 ++
 .../configs/objects/service_config_property.js  |  376 +++++
 ambari-web/app/models/service_config.js         | 1119 --------------
 ambari-web/app/models/stack_service.js          |    2 +-
 ambari-web/app/utils/config.js                  |    3 +-
 .../app/utils/configs/config_property_helper.js |  554 +++++++
 .../objects/service_config_category_test.js     |  184 +++
 .../objects/service_config_property_test.js     |  474 ++++++
 .../configs/objects/service_config_test.js      |  165 ++
 ambari-web/test/models/service_config_test.js   | 1418 ------------------
 .../configs/config_property_helper_test.js      |  865 +++++++++++
 17 files changed, 2820 insertions(+), 2545 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 055f447..d1d454d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -161,6 +161,7 @@ var files = ['test/init_model_test',
   'test/utils/object_utils_test',
   'test/utils/ui_effects_test',
   'test/utils/updater_test',
+  'test/utils/configs/config_property_helper_test',
   'test/views/common/chart/linear_time_test',
   'test/views/common/configs/widgets/combo_config_widget_view_test',
   'test/views/common/configs/widgets/config_widget_view_test',
@@ -271,7 +272,6 @@ var files = ['test/init_model_test',
   'test/models/host_component_test',
   'test/models/hosts_test',
   'test/models/repository_test',
-  'test/models/service_config_test',
   'test/models/stack_service_component_test',
   'test/models/service_test',
   'test/models/stack_service_test',
@@ -282,6 +282,9 @@ var files = ['test/init_model_test',
   'test/models/configs/section_test',
   'test/models/configs/service_config_version_test',
   'test/models/configs/config_property_test',
+  'test/models/configs/objects/service_config_test',
+  'test/models/configs/objects/service_config_category_test',
+  'test/models/configs/objects/service_config_property_test',
   'test/routes/views_test',
   //contains test with fake timers that affect Date
   'test/utils/lazy_loading_test'

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/slave_component_groups_controller.js b/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
index d113eb9..584fdf2 100644
--- a/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
+++ b/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 var App = require('app');
+var configPropertyHelper = require('utils/configs/config_property_helper');
 /**
  * Used to manage slave component config. User could create different settings for separate group
  * @type {*}
@@ -101,10 +102,10 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
 
       switch(serviceConfigProperty.name){
         case 'dfs_data_dir' :
-          serviceConfigProperty.initialValue();
+          configPropertyHelper.initialValue(serviceConfigProperty);
           break;
         case 'mapred_local_dir' :
-          serviceConfigProperty.initialValue();
+          configPropertyHelper.initialValue(serviceConfigProperty);
           break;
       }
       configs.pushObject(serviceConfigProperty);

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/data/HDP2/secure_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/secure_configs.js b/ambari-web/app/data/HDP2/secure_configs.js
index d89c033..bac785f 100644
--- a/ambari-web/app/data/HDP2/secure_configs.js
+++ b/ambari-web/app/data/HDP2/secure_configs.js
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 var App = require('app');
-require('models/service_config');
+require('models/configs/objects/service_config');
+require('models/configs/objects/service_config_category');
+require('models/configs/objects/service_config_property');
 require('models/service');
 
 App.SecureConfigProperties = Ember.ArrayProxy.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/data/service_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/service_configs.js b/ambari-web/app/data/service_configs.js
index 7e7abcb..ba710f0 100644
--- a/ambari-web/app/data/service_configs.js
+++ b/ambari-web/app/data/service_configs.js
@@ -17,7 +17,7 @@
  */
 
 var App = require('app');
-require('models/service_config');
+require('models/configs/objects/service_config_category');
 
 /**
  * This

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js
index f4e881e..67e7375 100644
--- a/ambari-web/app/models.js
+++ b/ambari-web/app/models.js
@@ -35,7 +35,6 @@ require('models/stack_service');
 require('models/stack_service_component');
 require('models/quick_links');
 require('models/service');
-require('models/service_config');
 require('models/service_audit');
 require('models/service/hdfs');
 require('models/service/yarn');
@@ -68,6 +67,9 @@ require('models/configs/config_property');
 require('models/configs/tab');
 require('models/configs/section');
 require('models/configs/sub_section');
+require('models/configs/objects/service_config');
+require('models/configs/objects/service_config_category');
+require('models/configs/objects/service_config_property');
 require('models/widget');
 require('models/widget_property');
 require('models/widget_layout');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models/configs/objects/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config.js b/ambari-web/app/models/configs/objects/service_config.js
new file mode 100644
index 0000000..b83b781
--- /dev/null
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -0,0 +1,96 @@
+/**
+ * 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.ServiceConfig = Ember.Object.extend({
+  serviceName: '',
+  configCategories: [],
+  configs: null,
+  restartRequired: false,
+  restartRequiredMessage: '',
+  restartRequiredHostsAndComponents: {},
+  configGroups: [],
+  initConfigsLength: 0, // configs length after initialization in order to watch changes
+  errorCount: function () {
+    var overrideErrors = 0,
+      masterErrors = 0,
+      slaveErrors = 0,
+      configs = this.get('configs'),
+      configCategories = this.get('configCategories');
+    configCategories.forEach(function (_category) {
+      slaveErrors += _category.get('slaveErrorCount');
+      _category.set('nonSlaveErrorCount', 0);
+    });
+    configs.forEach(function (item) {
+      var category = configCategories.findProperty('name', item.get('category'));
+      if (category && !item.get('isValid') && item.get('isVisible') && !item.get('widget')) {
+        category.incrementProperty('nonSlaveErrorCount');
+        masterErrors++;
+      }
+      if (item.get('overrides')) {
+        item.get('overrides').forEach(function (e) {
+          if (e.error) {
+            if (category) {
+              category.incrementProperty('nonSlaveErrorCount');
+            }
+            overrideErrors++;
+          }
+        });
+      }
+    });
+    return masterErrors + slaveErrors + overrideErrors;
+  }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
+
+  isPropertiesChanged: function() {
+    var requiredByAgent = this.get('configs').filterProperty('isRequiredByAgent');
+    return requiredByAgent.someProperty('isNotSaved') ||
+           requiredByAgent.someProperty('isNotDefaultValue') ||
+           requiredByAgent.someProperty('isOverrideChanged') ||
+           this.get('configs.length') !== this.get('initConfigsLength') ||
+           (this.get('configs.length') === this.get('initConfigsLength') && this.get('configs').someProperty('defaultValue', null));
+  }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged', 'configs.length', 'configs.@each.isNotSaved')
+});
+
+App.SlaveConfigs = Ember.Object.extend({
+  componentName: null,
+  displayName: null,
+  hosts: null,
+  groups: null
+});
+
+App.Group = Ember.Object.extend({
+  name: null,
+  hostNames: null,
+  properties: null,
+  errorCount: function () {
+    if (this.get('properties')) {
+      return this.get('properties').filterProperty('isValid', false).filterProperty('isVisible', true).get('length');
+    }
+  }.property('properties.@each.isValid', 'properties.@each.isVisible')
+});
+
+App.ConfigSiteTag = Ember.Object.extend({
+  site: DS.attr('string'),
+  tag: DS.attr('string'),
+  /**
+   * Object map of hostname->override-tag for overrides.
+   * <b>Creators should set new object here.<b>
+   */
+  hostOverrides: null
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models/configs/objects/service_config_category.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_category.js b/ambari-web/app/models/configs/objects/service_config_category.js
new file mode 100644
index 0000000..d54241e
--- /dev/null
+++ b/ambari-web/app/models/configs/objects/service_config_category.js
@@ -0,0 +1,89 @@
+/**
+ * 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.ServiceConfigCategory = Ember.Object.extend({
+  name: null,
+  /**
+   *  We cant have spaces in the name as this is being used as HTML element id while rendering. Hence we introduced 'displayName' where we can have spaces like 'Secondary Name Node' etc.
+   */
+  displayName: null,
+  slaveConfigs: null,
+  /**
+   * check whether to show custom view in category instead of default
+   */
+  isCustomView: false,
+  customView: null,
+  /**
+   * Each category might have a site-name associated (hdfs-site, core-site, etc.)
+   * and this will be used when determining which category a particular property
+   * ends up in, based on its site.
+   */
+  siteFileName: null,
+  /**
+   * Can this category add new properties. Used for custom configurations.
+   */
+  canAddProperty: false,
+  nonSlaveErrorCount: 0,
+  primaryName: function () {
+    switch (this.get('name')) {
+      case 'DataNode':
+        return 'DATANODE';
+        break;
+      case 'TaskTracker':
+        return 'TASKTRACKER';
+        break;
+      case 'RegionServer':
+        return 'HBASE_REGIONSERVER';
+    }
+    return null;
+  }.property('name'),
+
+
+  isForMasterComponent: function () {
+    var masterServices = [ 'NameNode', 'SNameNode', 'JobTracker', 'HBase Master', 'Oozie Master',
+      'Hive Metastore', 'WebHCat Server', 'ZooKeeper Server', 'Ganglia' ];
+
+    return (masterServices.contains(this.get('name')));
+  }.property('name'),
+
+  isForSlaveComponent: function () {
+    var slaveComponents = ['DataNode', 'TaskTracker', 'RegionServer'];
+    return (slaveComponents.contains(this.get('name')));
+  }.property('name'),
+
+  slaveErrorCount: function () {
+    var length = 0;
+    if (this.get('slaveConfigs.groups')) {
+      this.get('slaveConfigs.groups').forEach(function (_group) {
+        length += _group.get('errorCount');
+      }, this);
+    }
+    return length;
+  }.property('slaveConfigs.groups.@each.errorCount'),
+
+  errorCount: function () {
+    return this.get('slaveErrorCount') + this.get('nonSlaveErrorCount');
+  }.property('slaveErrorCount', 'nonSlaveErrorCount'),
+
+  isAdvanced : function(){
+    var name = this.get('name');
+    return name.indexOf("Advanced") !== -1 ;
+  }.property('name')
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
new file mode 100644
index 0000000..554e094
--- /dev/null
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -0,0 +1,376 @@
+/**
+ * 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');
+var validator = require('utils/validator');
+
+App.ServiceConfigProperty = Em.Object.extend({
+
+  id: '', //either 'puppet var' or 'site property'
+  name: '',
+  displayName: '',
+  value: '',
+  retypedPassword: '',
+  defaultValue: '',
+  defaultDirectory: '',
+  description: '',
+  displayType: 'string', // string, digits, number, directories, custom
+  unit: '',
+  category: 'General',
+  isRequired: true, // by default a config property is required
+  isReconfigurable: true, // by default a config property is reconfigurable
+  isEditable: true, // by default a config property is editable
+  isNotEditable: Ember.computed.not('isEditable'),
+  isFinal: false,
+  hideFinalIcon: function () {
+    return (!this.get('isFinal'))&& this.get('isNotEditable');
+  }.property('isFinal', 'isNotEditable'),
+  defaultIsFinal: false,
+  supportsFinal: false,
+  isVisible: true,
+  isMock: false, // mock config created created only to displaying
+  isRequiredByAgent: true, // Setting it to true implies property will be stored in configuration
+  isSecureConfig: false,
+  errorMessage: '',
+  warnMessage: '',
+  serviceConfig: null, // points to the parent App.ServiceConfig object
+  filename: '',
+  isOriginalSCP : true, // if true, then this is original SCP instance and its value is not overridden value.
+  parentSCP: null, // This is the main SCP which is overridden by this. Set only when isOriginalSCP is false.
+  selectedHostOptions : null, // contain array of hosts configured with overridden value
+  overrides : null,
+  overrideValues: [],
+  group: null, // Contain group related to this property. Set only when isOriginalSCP is false.
+  isUserProperty: null, // This property was added by user. Hence they get removal actions etc.
+  isOverridable: true,
+  compareConfigs: [],
+  isComparison: false,
+  hasCompareDiffs: false,
+  showLabel: true,
+  error: false,
+  warn: false,
+  overrideErrorTrigger: 0, //Trigger for overrridable property error
+  isRestartRequired: false,
+  restartRequiredMessage: 'Restart required',
+  index: null, //sequence number in category
+  editDone: false, //Text field: on focusOut: true, on focusIn: false
+  isNotSaved: false, // user property was added but not saved
+  hasInitialValue: false, //if true then property value is defined and saved to server
+  isHiddenByFilter: false, //if true then hide this property (filtered out)
+  rowStyleClass: null, // CSS-Class to be applied on the row showing this config
+
+  /**
+   * value that is returned from server as recommended
+   * @type {String}
+   */
+  recommendedValue: '',
+
+  /**
+   * Usage example see on <code>App.ServiceConfigRadioButtons.handleDBConnectionProperty()</code>
+   *
+   * @property {Ember.View} additionalView - custom view related to property
+   **/
+  additionalView: null,
+
+  /**
+   * On Overridable property error message, change overrideErrorTrigger value to recount number of errors service have
+   */
+  observeErrors: function () {
+    this.set("overrideErrorTrigger", this.get("overrideErrorTrigger") + 1);
+  }.observes("overrides.@each.errorMessage"),
+  /**
+   * No override capabilities for fields which are not edtiable
+   * and fields which represent master hosts.
+   */
+  isPropertyOverridable: function () {
+    var overrideable = this.get('isOverridable');
+    var editable = this.get('isEditable');
+    var overrides = this.get('overrides');
+    var dt = this.get('displayType');
+    return overrideable && (editable || !overrides || !overrides.length) && ("masterHost" != dt);
+  }.property('isEditable', 'displayType', 'isOverridable', 'overrides.length'),
+
+  isOverridden: function() {
+    var overrides = this.get('overrides');
+    return (overrides != null && overrides.get('length')>0) || !this.get('isOriginalSCP');
+  }.property('overrides', 'overrides.length', 'isOriginalSCP'),
+
+  isOverrideChanged: function () {
+    if (Em.isNone(this.get('overrides')) && this.get('overrideValues.length') === 0) return false;
+    return JSON.stringify(this.get('overrides').mapProperty('isFinal')) !== JSON.stringify(this.get('overrideIsFinalValues'))
+      || JSON.stringify(this.get('overrides').mapProperty('value')) !== JSON.stringify(this.get('overrideValues'));
+  }.property('isOverridden', 'overrides.@each.isNotDefaultValue'),
+
+  isRemovable: function() {
+    var isOriginalSCP = this.get('isOriginalSCP');
+    var isUserProperty = this.get('isUserProperty');
+    var isEditable = this.get('isEditable');
+    var hasOverrides = this.get('overrides.length') > 0;
+    // Removable when this is a user property, or it is not an original property and it is editable
+    return isEditable && !hasOverrides && (isUserProperty || !isOriginalSCP);
+  }.property('isUserProperty', 'isOriginalSCP', 'overrides.length'),
+
+  init: function () {
+    if(this.get("displayType")=="password"){
+      this.set('retypedPassword', this.get('value'));
+    }
+    if ((this.get('id') === 'puppet var') && this.get('value') == '') {
+      this.set('value', this.get('defaultValue'));
+    }
+    // TODO: remove mock data
+  },
+
+  /**
+   * Indicates when value is not the default value.
+   * Returns false when there is no default value.
+   */
+  isNotDefaultValue: function () {
+    var value = this.get('value');
+    var defaultValue = this.get('defaultValue');
+    var supportsFinal = this.get('supportsFinal');
+    var isFinal = this.get('isFinal');
+    var defaultIsFinal = this.get('defaultIsFinal');
+    // ignore precision difference for configs with type of `float` which value may ends with 0
+    // e.g. between 0.4 and 0.40
+    if (this.get('stackConfigProperty') && this.get('stackConfigProperty.valueAttributes.type') == 'float') {
+      defaultValue = '' + parseFloat(defaultValue);
+      value = '' + parseFloat(value);
+    }
+    return (defaultValue != null && value !== defaultValue) || (supportsFinal && isFinal !== defaultIsFinal);
+  }.property('value', 'defaultValue', 'isEditable', 'isFinal', 'defaultIsFinal'),
+
+  /**
+   * Don't show "Undo" for hosts on Installer Step7
+   */
+  cantBeUndone: function() {
+    return ["masterHost", "slaveHosts", "masterHosts", "slaveHost", "radio button"].contains(this.get('displayType'));
+  }.property('displayType'),
+
+  isValid: function () {
+    return this.get('errorMessage') === '';
+  }.property('errorMessage'),
+
+  viewClass: function () {
+    switch (this.get('displayType')) {
+      case 'checkbox':
+        if (this.get('dependentConfigPattern')) {
+          return App.ServiceConfigCheckboxWithDependencies;
+        } else {
+          return App.ServiceConfigCheckbox;
+        }
+      case 'password':
+        return App.ServiceConfigPasswordField;
+      case 'combobox':
+        return App.ServiceConfigComboBox;
+      case 'radio button':
+        return App.ServiceConfigRadioButtons;
+        break;
+      case 'directories':
+      case 'datanodedirs':
+        return App.ServiceConfigTextArea;
+        break;
+      case 'content':
+        return App.ServiceConfigTextAreaContent;
+        break;
+      case 'multiLine':
+        return App.ServiceConfigTextArea;
+        break;
+      case 'custom':
+        return App.ServiceConfigBigTextArea;
+      case 'masterHost':
+        return App.ServiceConfigMasterHostView;
+      case 'label':
+        return App.ServiceConfigLabelView;
+      case 'masterHosts':
+        return App.ServiceConfigMasterHostsView;
+      case 'slaveHosts':
+        return App.ServiceConfigSlaveHostsView;
+      case 'supportTextConnection':
+        return App.checkConnectionView;
+      default:
+        if (this.get('unit')) {
+          return App.ServiceConfigTextFieldWithUnit;
+        } else {
+          return App.ServiceConfigTextField;
+        }
+    }
+  }.property('displayType'),
+
+  validate: function () {
+    var value = this.get('value');
+    var supportsFinal = this.get('supportsFinal');
+    var isFinal = this.get('isFinal');
+    var valueRange = this.get('valueRange');
+    var values = [];//value split by "," to check UNIX users, groups list
+
+    var isError = false;
+    var isWarn = false;
+
+    if (typeof value === 'string' && value.length === 0) {
+      if (this.get('isRequired')) {
+        this.set('errorMessage', 'This is required');
+        isError = true;
+      } else {
+        return;
+      }
+    }
+
+    if (!isError) {
+      switch (this.get('displayType')) {
+        case 'int':
+          if (!validator.isValidInt(value)) {
+            this.set('errorMessage', 'Must contain digits only');
+            isError = true;
+          } else {
+            if(valueRange){
+              if(value < valueRange[0] || value > valueRange[1]){
+                this.set('errorMessage', 'Must match the range');
+                isError = true;
+              }
+            }
+          }
+          break;
+        case 'float':
+          if (!validator.isValidFloat(value)) {
+            this.set('errorMessage', 'Must be a valid number');
+            isError = true;
+          }
+          break;
+        case 'UNIXList':
+          if(value != '*'){
+            values = value.split(',');
+            for(var i = 0, l = values.length; i < l; i++){
+              if(!validator.isValidUNIXUser(values[i])){
+                if(this.get('type') == 'USERS'){
+                  this.set('errorMessage', 'Must be a valid list of user names');
+                } else {
+                  this.set('errorMessage', 'Must be a valid list of group names');
+                }
+                isError = true;
+              }
+            }
+          }
+          break;
+        case 'checkbox':
+          break;
+        case 'datanodedirs':
+          if (!validator.isValidDataNodeDir(value)) {
+            this.set('errorMessage', 'dir format is wrong, can be "[{storage type}]/{dir name}"');
+            isError = true;
+          }
+          else {
+            if (!validator.isAllowedDir(value)) {
+              this.set('errorMessage', 'Cannot start with "home(s)"');
+              isError = true;
+            }
+          }
+          break;
+        case 'directories':
+        case 'directory':
+          if (!validator.isValidDir(value)) {
+            this.set('errorMessage', 'Must be a slash or drive at the start');
+            isError = true;
+          }
+          else {
+            if (!validator.isAllowedDir(value)) {
+              this.set('errorMessage', 'Can\'t start with "home(s)"');
+              isError = true;
+            }
+          }
+          break;
+        case 'custom':
+          break;
+        case 'email':
+          if (!validator.isValidEmail(value)) {
+            this.set('errorMessage', 'Must be a valid email address');
+            isError = true;
+          }
+          break;
+        case 'host':
+          var hiveOozieHostNames = ['hive_hostname','hive_existing_mysql_host','hive_existing_oracle_host','hive_ambari_host',
+            'oozie_hostname','oozie_existing_mysql_host','oozie_existing_oracle_host','oozie_ambari_host'];
+          if(hiveOozieHostNames.contains(this.get('name'))) {
+            if (validator.hasSpaces(value)) {
+              this.set('errorMessage', Em.I18n.t('host.spacesValidation'));
+              isError = true;
+            }
+          } else {
+            if (validator.isNotTrimmed(value)) {
+              this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
+              isError = true;
+            }
+          }
+          break;
+        case 'advanced':
+          if(this.get('name')=='javax.jdo.option.ConnectionURL' || this.get('name')=='oozie.service.JPAService.jdbc.url') {
+            if (validator.isNotTrimmed(value)) {
+              this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
+              isError = true;
+            }
+          }
+          break;
+        case 'password':
+          // retypedPassword is set by the retypePasswordView child view of App.ServiceConfigPasswordField
+          if (value !== this.get('retypedPassword')) {
+            this.set('errorMessage', 'Passwords do not match');
+            isError = true;
+          }
+      }
+    }
+
+    if (!isError) {
+      // Check if this value is already in any of the overrides
+      var self = this;
+      var isOriginalSCP = this.get('isOriginalSCP');
+      var parentSCP = this.get('parentSCP');
+      if (!isOriginalSCP) {
+        if (!Em.isNone(parentSCP)) {
+          if (value === parentSCP.get('value') && supportsFinal && isFinal === parentSCP.get('isFinal')) {
+            this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
+            isError = true;
+          } else {
+            var overrides = parentSCP.get('overrides');
+            if (overrides) {
+              overrides.forEach(function (override) {
+                if (self != override && value === override.get('value')  && supportsFinal && isFinal === parentSCP.get('isFinal')) {
+                  self.set('errorMessage', Em.I18n.t('config.override.valueEqualToAnotherOverrideConfig'));
+                  isError = true;
+                }
+              });
+            }
+          }
+        }
+      }
+    }
+
+    if (!isWarn || isError) { // Errors get priority
+      this.set('warnMessage', '');
+      this.set('warn', false);
+    } else {
+      this.set('warn', true);
+    }
+
+    if (!isError) {
+      this.set('errorMessage', '');
+      this.set('error', false);
+    } else {
+      this.set('error', true);
+    }
+  }.observes('value', 'isFinal', 'retypedPassword')
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
deleted file mode 100644
index 6d5007e..0000000
--- a/ambari-web/app/models/service_config.js
+++ /dev/null
@@ -1,1119 +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');
-var validator = require('utils/validator');
-
-App.ServiceConfig = Ember.Object.extend({
-  serviceName: '',
-  configCategories: [],
-  configs: null,
-  restartRequired: false,
-  restartRequiredMessage: '',
-  restartRequiredHostsAndComponents: {},
-  configGroups: [],
-  initConfigsLength: 0, // configs length after initialization in order to watch changes
-  errorCount: function () {
-    var overrideErrors = 0,
-      masterErrors = 0,
-      slaveErrors = 0,
-      configs = this.get('configs'),
-      configCategories = this.get('configCategories');
-    configCategories.forEach(function (_category) {
-      slaveErrors += _category.get('slaveErrorCount');
-      _category.set('nonSlaveErrorCount', 0);
-    });
-    configs.forEach(function (item) {
-      var category = configCategories.findProperty('name', item.get('category'));
-      if (category && !item.get('isValid') && item.get('isVisible') && !item.get('widget')) {
-        category.incrementProperty('nonSlaveErrorCount');
-        masterErrors++;
-      }
-      if (item.get('overrides')) {
-        item.get('overrides').forEach(function (e) {
-          if (e.error) {
-            if (category) {
-              category.incrementProperty('nonSlaveErrorCount');
-            }
-            overrideErrors++;
-          }
-        });
-      }
-    });
-    return masterErrors + slaveErrors + overrideErrors;
-  }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
-
-  isPropertiesChanged: function() {
-    var requiredByAgent = this.get('configs').filterProperty('isRequiredByAgent');
-    return requiredByAgent.someProperty('isNotSaved') ||
-           requiredByAgent.someProperty('isNotDefaultValue') ||
-           requiredByAgent.someProperty('isOverrideChanged') ||
-           this.get('configs.length') !== this.get('initConfigsLength') ||
-           (this.get('configs.length') === this.get('initConfigsLength') && this.get('configs').someProperty('defaultValue', null));
-  }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged', 'configs.length', 'configs.@each.isNotSaved')
-});
-
-App.ServiceConfigCategory = Ember.Object.extend({
-  name: null,
-  /**
-   *  We cant have spaces in the name as this is being used as HTML element id while rendering. Hence we introduced 'displayName' where we can have spaces like 'Secondary Name Node' etc.
-   */
-  displayName: null,
-  slaveConfigs: null,
-  /**
-   * check whether to show custom view in category instead of default
-   */
-  isCustomView: false,
-  customView: null,
-  /**
-   * Each category might have a site-name associated (hdfs-site, core-site, etc.)
-   * and this will be used when determining which category a particular property
-   * ends up in, based on its site.
-   */
-  siteFileName: null,
-  /**
-   * Can this category add new properties. Used for custom configurations.
-   */
-  canAddProperty: false,
-  nonSlaveErrorCount: 0,
-  primaryName: function () {
-    switch (this.get('name')) {
-      case 'DataNode':
-        return 'DATANODE';
-        break;
-      case 'TaskTracker':
-        return 'TASKTRACKER';
-        break;
-      case 'RegionServer':
-        return 'HBASE_REGIONSERVER';
-    }
-    return null;
-  }.property('name'),
-
-
-  isForMasterComponent: function () {
-    var masterServices = [ 'NameNode', 'SNameNode', 'JobTracker', 'HBase Master', 'Oozie Master',
-      'Hive Metastore', 'WebHCat Server', 'ZooKeeper Server', 'Ganglia' ];
-
-    return (masterServices.contains(this.get('name')));
-  }.property('name'),
-
-  isForSlaveComponent: function () {
-    var slaveComponents = ['DataNode', 'TaskTracker', 'RegionServer'];
-    return (slaveComponents.contains(this.get('name')));
-  }.property('name'),
-
-  slaveErrorCount: function () {
-    var length = 0;
-    if (this.get('slaveConfigs.groups')) {
-      this.get('slaveConfigs.groups').forEach(function (_group) {
-        length += _group.get('errorCount');
-      }, this);
-    }
-    return length;
-  }.property('slaveConfigs.groups.@each.errorCount'),
-
-  errorCount: function () {
-    return this.get('slaveErrorCount') + this.get('nonSlaveErrorCount');
-  }.property('slaveErrorCount', 'nonSlaveErrorCount'),
-
-  isAdvanced : function(){
-    var name = this.get('name');
-    return name.indexOf("Advanced") !== -1 ;
-  }.property('name')
-});
-
-
-App.SlaveConfigs = Ember.Object.extend({
-  componentName: null,
-  displayName: null,
-  hosts: null,
-  groups: null
-});
-
-App.Group = Ember.Object.extend({
-  name: null,
-  hostNames: null,
-  properties: null,
-  errorCount: function () {
-    if (this.get('properties')) {
-      return this.get('properties').filterProperty('isValid', false).filterProperty('isVisible', true).get('length');
-    }
-  }.property('properties.@each.isValid', 'properties.@each.isVisible')
-});
-
-
-App.ServiceConfigProperty = Em.Object.extend({
-
-  id: '', //either 'puppet var' or 'site property'
-  name: '',
-  displayName: '',
-  value: '',
-  retypedPassword: '',
-  defaultValue: '',
-  defaultDirectory: '',
-  description: '',
-  displayType: 'string', // string, digits, number, directories, custom
-  unit: '',
-  category: 'General',
-  isRequired: true, // by default a config property is required
-  isReconfigurable: true, // by default a config property is reconfigurable
-  isEditable: true, // by default a config property is editable
-  isNotEditable: Ember.computed.not('isEditable'),
-  isFinal: false,
-  hideFinalIcon: function () {
-    return (!this.get('isFinal'))&& this.get('isNotEditable');
-  }.property('isFinal', 'isNotEditable'),
-  defaultIsFinal: false,
-  supportsFinal: false,
-  isVisible: true,
-  isMock: false, // mock config created created only to displaying
-  isRequiredByAgent: true, // Setting it to true implies property will be stored in configuration
-  isSecureConfig: false,
-  errorMessage: '',
-  warnMessage: '',
-  serviceConfig: null, // points to the parent App.ServiceConfig object
-  filename: '',
-  isOriginalSCP : true, // if true, then this is original SCP instance and its value is not overridden value.
-  parentSCP: null, // This is the main SCP which is overridden by this. Set only when isOriginalSCP is false.
-  selectedHostOptions : null, // contain array of hosts configured with overridden value
-  overrides : null,
-  overrideValues: [],
-  group: null, // Contain group related to this property. Set only when isOriginalSCP is false.
-  isUserProperty: null, // This property was added by user. Hence they get removal actions etc.
-  isOverridable: true,
-  compareConfigs: [],
-  isComparison: false,
-  hasCompareDiffs: false,
-  showLabel: true,
-  error: false,
-  warn: false,
-  overrideErrorTrigger: 0, //Trigger for overrridable property error
-  isRestartRequired: false,
-  restartRequiredMessage: 'Restart required',
-  index: null, //sequence number in category
-  editDone: false, //Text field: on focusOut: true, on focusIn: false
-  isNotSaved: false, // user property was added but not saved
-  hasInitialValue: false, //if true then property value is defined and saved to server
-  isHiddenByFilter: false, //if true then hide this property (filtered out)
-  rowStyleClass: null, // CSS-Class to be applied on the row showing this config
-
-  /**
-   * value that is returned from server as recommended
-   * @type {String}
-   */
-  recommendedValue: '',
-
-  /**
-   * Usage example see on <code>App.ServiceConfigRadioButtons.handleDBConnectionProperty()</code>
-   *
-   * @property {Ember.View} additionalView - custom view related to property
-   **/
-  additionalView: null,
-
-  /**
-   * On Overridable property error message, change overrideErrorTrigger value to recount number of errors service have
-   */
-  observeErrors: function () {
-    this.set("overrideErrorTrigger", this.get("overrideErrorTrigger") + 1);
-  }.observes("overrides.@each.errorMessage"),
-  /**
-   * No override capabilities for fields which are not edtiable
-   * and fields which represent master hosts.
-   */
-  isPropertyOverridable: function () {
-    var overrideable = this.get('isOverridable');
-    var editable = this.get('isEditable');
-    var overrides = this.get('overrides');
-    var dt = this.get('displayType');
-    return overrideable && (editable || !overrides || !overrides.length) && ("masterHost" != dt);
-  }.property('isEditable', 'displayType', 'isOverridable', 'overrides.length'),
-  isOverridden: function() {
-    var overrides = this.get('overrides');
-    return (overrides != null && overrides.get('length')>0) || !this.get('isOriginalSCP');
-  }.property('overrides', 'overrides.length', 'isOriginalSCP'),
-  isOverrideChanged: function () {
-    if (Em.isNone(this.get('overrides')) && this.get('overrideValues.length') === 0) return false;
-    return JSON.stringify(this.get('overrides').mapProperty('isFinal')) !== JSON.stringify(this.get('overrideIsFinalValues'))
-      || JSON.stringify(this.get('overrides').mapProperty('value')) !== JSON.stringify(this.get('overrideValues'));
-  }.property('isOverridden', 'overrides.@each.isNotDefaultValue'),
-  isRemovable: function() {
-    var isOriginalSCP = this.get('isOriginalSCP');
-    var isUserProperty = this.get('isUserProperty');
-    var isEditable = this.get('isEditable');
-    var hasOverrides = this.get('overrides.length') > 0;
-    // Removable when this is a user property, or it is not an original property and it is editable
-    return isEditable && !hasOverrides && (isUserProperty || !isOriginalSCP);
-  }.property('isUserProperty', 'isOriginalSCP', 'overrides.length'),
-  init: function () {
-    if(this.get("displayType")=="password"){
-      this.set('retypedPassword', this.get('value'));
-    }
-    if ((this.get('id') === 'puppet var') && this.get('value') == '') {
-      this.set('value', this.get('defaultValue'));
-    }
-    // TODO: remove mock data
-  },
-
-  /**
-   * Indicates when value is not the default value.
-   * Returns false when there is no default value.
-   */
-  isNotDefaultValue: function () {
-    var value = this.get('value');
-    var defaultValue = this.get('defaultValue');
-    var supportsFinal = this.get('supportsFinal');
-    var isFinal = this.get('isFinal');
-    var defaultIsFinal = this.get('defaultIsFinal');
-    // ignore precision difference for configs with type of `float` which value may ends with 0
-    // e.g. between 0.4 and 0.40
-    if (this.get('stackConfigProperty') && this.get('stackConfigProperty.valueAttributes.type') == 'float') {
-      defaultValue = '' + parseFloat(defaultValue);
-      value = '' + parseFloat(value);
-    }
-    return (defaultValue != null && value !== defaultValue) || (supportsFinal && isFinal !== defaultIsFinal);
-  }.property('value', 'defaultValue', 'isEditable', 'isFinal', 'defaultIsFinal'),
-
-  /**
-   * Don't show "Undo" for hosts on Installer Step7
-   */
-  cantBeUndone: function() {
-    var types = ["masterHost", "slaveHosts", "masterHosts", "slaveHost","radio button"];
-    var displayType = this.get('displayType');
-    var result = false;
-    types.forEach(function(type) {
-      if (type === displayType) {
-        result = true;
-      }
-    });
-    return result;
-  }.property('displayType'),
-
-  initialValue: function (localDB, dependencies) {
-    var masterComponentHostsInDB = localDB.masterComponentHosts;
-    //console.log("value in initialvalue: " + JSON.stringify(masterComponentHostsInDB));
-    var hostsInfo = localDB.hosts; // which we are setting in installerController in step3.
-    var slaveComponentHostsInDB = localDB.slaveComponentHosts;
-    var isOnlyFirstOneNeeded = true;
-    var hostWithPort = "([\\w|\\.]*)(?=:)";
-    var hostWithPrefix = ":\/\/" + hostWithPort;
-    switch (this.get('name')) {
-      case 'namenode_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName'));
-        break;
-      case 'dfs.namenode.rpc-address':
-        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue(hostWithPort,nnHost);
-        break;
-      case 'dfs.http.address':
-        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue(hostWithPort,nnHost);
-        break;
-      case 'dfs.namenode.http-address':
-        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue(hostWithPort,nnHost);
-        break;
-      case 'dfs.https.address':
-        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue(hostWithPort,nnHost);
-        break;
-      case 'dfs.namenode.https-address':
-        var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue(hostWithPort,nnHost);
-        break;
-      case 'fs.default.name':
-        var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
-        break;
-      case 'fs.defaultFS':
-        var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
-        break;
-      case 'hbase.rootdir':
-        var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
-        break;
-      case 'instance.volumes':
-        var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
-        break;
-      case 'snamenode_host':
-        // Secondary NameNode does not exist when NameNode HA is enabled
-        var snn = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
-        if (snn) {
-          this.set('value', snn.hostName);
-        }
-        break;
-      case 'dfs.secondary.http.address':
-        var snnHost = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
-        if (snnHost) {
-          this.setDefaultValue(hostWithPort,snnHost.hostName);
-        }
-        break;
-      case 'dfs.namenode.secondary.http-address':
-        var snnHost = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
-        if (snnHost) {
-          this.setDefaultValue(hostWithPort,snnHost.hostName);
-        }
-        break;
-      case 'datanode_hosts':
-        this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'DATANODE').hosts.mapProperty('hostName'));
-        break;
-      case 'nfsgateway_hosts':
-        var gwyHost = slaveComponentHostsInDB.findProperty('componentName', 'NFS_GATEWAY');
-        if(gwyHost) {
-          this.set('value', gwyHost.hosts.mapProperty('hostName'));
-        }
-        break;
-      case 'hs_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName'));
-        break;
-      case 'yarn.log.server.url':
-        var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue(hostWithPrefix,'://' + hsHost);
-        break;
-      case 'mapreduce.jobhistory.webapp.address':
-        var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue(hostWithPort,hsHost);
-        break;
-      case 'mapreduce.jobhistory.address':
-        var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue(hostWithPort,hsHost);
-        break;
-      case 'rm_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName);
-        break;
-      case 'ats_host':
-        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
-        if (atsHost)
-          this.set('value', atsHost.hostName);
-        else
-          this.set('value', 'false');
-        break;
-      case 'yarn.resourcemanager.hostname':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.set('defaultValue',rmHost);
-        this.set('value',this.get('defaultValue'));
-        break;
-      case 'yarn.resourcemanager.resource-tracker.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.resourcemanager.webapp.https.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.resourcemanager.webapp.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.resourcemanager.scheduler.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.resourcemanager.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.resourcemanager.admin.address':
-        var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue(hostWithPort,rmHost);
-        break;
-      case 'yarn.timeline-service.webapp.address':
-        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
-        if (atsHost && atsHost.hostName) {
-          this.setDefaultValue(hostWithPort,atsHost.hostName);
-        }
-        break;
-      case 'yarn.timeline-service.webapp.https.address':
-        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
-        if (atsHost && atsHost.hostName) {
-          this.setDefaultValue(hostWithPort,atsHost.hostName);
-        }
-        break;
-      case 'yarn.timeline-service.address':
-        var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
-        if (atsHost && atsHost.hostName) {
-          this.setDefaultValue(hostWithPort,atsHost.hostName);
-        }
-        break;
-      case 'nm_hosts':
-        this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER').hosts.mapProperty('hostName'));
-        break;
-      case 'jobtracker_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName);
-        break;
-      case 'mapred.job.tracker':
-        var jtHost = masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName;
-        this.setDefaultValue(hostWithPort,jtHost);
-        break;
-      case 'mapred.job.tracker.http.address':
-        var jtHost = masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName;
-        this.setDefaultValue(hostWithPort,jtHost);
-        break;
-      case 'mapreduce.history.server.http.address':
-        var jtHost = masterComponentHostsInDB.findProperty('component', 'HISTORYSERVER').hostName;
-        this.setDefaultValue(hostWithPort,jtHost);
-        break;
-      case 'tasktracker_hosts':
-        this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER').hosts.mapProperty('hostName'));
-        break;
-      case 'hbasemaster_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'HBASE_MASTER').mapProperty('hostName'));
-        break;
-      case 'regionserver_hosts':
-        this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'HBASE_REGIONSERVER').hosts.mapProperty('hostName'));
-        break;
-      case 'hivemetastore_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'));
-        break;
-      case 'hive_ambari_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
-        break;
-      case 'hive_master_hosts':
-        var hostNames = masterComponentHostsInDB.filter(function (masterComponent) {
-          return ['HIVE_METASTORE', 'HIVE_SERVER'].contains(masterComponent.component);
-        });
-        this.set('value', hostNames.mapProperty('hostName').uniq().join(','));
-        break;
-      case 'hive_database':
-        var newMySQLDBOption = this.get('options').findProperty('displayName', 'New MySQL Database');
-        if (newMySQLDBOption) {
-          var isNewMySQLDBOptionHidden = !App.get('supports.alwaysEnableManagedMySQLForHive') && App.get('router.currentState.name') != 'configs' &&
-            !App.get('isManagedMySQLForHiveEnabled');
-          if (isNewMySQLDBOptionHidden && this.get('value') == 'New MySQL Database') {
-            this.set('value', 'Existing MySQL Database');
-          }
-          Em.set(newMySQLDBOption, 'hidden', isNewMySQLDBOptionHidden);
-        }
-        break;
-      case 'oozieserver_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER').mapProperty('hostName'));
-        break;
-      case 'oozie.base.url':
-        var oozieHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
-        this.setDefaultValue(hostWithPrefix,'://' + oozieHost);
-        break;
-      case 'webhcatserver_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'WEBHCAT_SERVER').hostName);
-        break;
-      case 'oozie_ambari_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName);
-        break;
-      case 'hadoop_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName'));
-        break;
-      case 'hive_existing_mysql_host':
-      case 'hive_existing_postgresql_host':
-      case 'hive_existing_oracle_host':
-      case 'hive_existing_mssql_server_host':
-      case 'hive_existing_mssql_server_2_host':
-        var hiveServerHost = masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName;
-        this.set('value', hiveServerHost).set('defaultValue', hiveServerHost);
-        break;
-      case 'hive.metastore.uris':
-        var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']);
-        if (hiveMSUris) {
-          this.setDefaultValue("(.*)", hiveMSUris);
-        }
-        break;
-      case 'oozie_existing_mysql_host':
-      case 'oozie_existing_postgresql_host':
-      case 'oozie_existing_oracle_host':
-      case 'oozie_existing_mssql_server_host':
-      case 'oozie_existing_mssql_server_2_host':
-        var oozieServerHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
-        this.set('value', oozieServerHost).set('defaultValue', oozieServerHost);
-        break;
-      case 'storm.zookeeper.servers':
-      case 'zookeeperserver_hosts':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName'));
-        break;
-      case 'nimbus.host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'NIMBUS').hostName);
-        break;
-      case 'falconserver_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'FALCON_SERVER').hostName);
-        break;
-      case 'drpcserver_host':
-        var drpcHost = masterComponentHostsInDB.findProperty('component', 'DRPC_SERVER');
-        if (drpcHost) {
-          this.set('value', drpcHost.hostName);
-        }
-        break;
-      case 'stormuiserver_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'STORM_UI_SERVER').hostName);
-        break;
-      case 'storm_rest_api_host':
-        var stormRresApiHost = masterComponentHostsInDB.findProperty('component', 'STORM_REST_API');
-        if(stormRresApiHost) {
-          this.set('value', stormRresApiHost.hostName);
-        }
-        break;
-      case 'supervisor_hosts':
-        this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'SUPERVISOR').hosts.mapProperty('hostName'));
-        break;
-      case 'knox_gateway_host':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'KNOX_GATEWAY').mapProperty('hostName'));
-        break;
-      case 'kafka_broker_hosts':
-        this.set('value', masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER').mapProperty('hostName'));
-        break;
-      case 'kafka.ganglia.metrics.host':
-        var gangliaHost =  masterComponentHostsInDB.findProperty('component', 'GANGLIA_SERVER');
-        if (gangliaHost) {
-          this.set('value', gangliaHost.hostName);
-        }
-        break;
-      case 'hbase.zookeeper.quorum':
-        if (this.get('filename') == 'hbase-site.xml') {
-          var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
-          this.setDefaultValue("(\\w*)", zkHosts);
-        }
-        break;
-      case 'yarn.resourcemanager.zk-address':
-        var value = masterComponentHostsInDB.findProperty('component', 'ZOOKEEPER_SERVER').hostName + ':' + dependencies.clientPort;
-        this.setProperties({
-          value: value,
-          defaultValue: value
-        });
-        break;
-      case 'zookeeper.connect':
-      case 'hive.zookeeper.quorum':
-      case 'templeton.zookeeper.hosts':
-      case 'hadoop.registry.zk.quorum':
-      case 'hive.cluster.delegation.token.store.zookeeper.connectString':
-      case 'instance.zookeeper.host': // for accumulo
-        var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
-        var zkHostPort = zkHosts;
-        var regex = "\\w*:(\\d+)";   //regex to fetch the port
-        var portValue = this.get('defaultValue').match(new RegExp(regex));
-        if (!portValue) return;
-        if (portValue[1]) {
-          for ( var i = 0; i < zkHosts.length; i++ ) {
-            zkHostPort[i] = zkHosts[i] + ":" + portValue[1];
-          }
-        }
-        this.setDefaultValue("(.*)", zkHostPort);
-        break;
-      case 'templeton.hive.properties':
-        var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']).replace(',', '\\,');
-        if (/\/\/localhost:/g.test(this.get('value'))) {
-          this.set('defaultValue', this.get('value') + ',hive.metastore.execute.setugi=true');
-        }
-        this.setDefaultValue("(hive\\.metastore\\.uris=)([^\\,]+)", "$1" + hiveMSUris);
-        break;
-      case 'dfs.name.dir':
-      case 'dfs.namenode.name.dir':
-      case 'dfs.data.dir':
-      case 'dfs.datanode.data.dir':
-      case 'yarn.nodemanager.local-dirs':
-      case 'yarn.nodemanager.log-dirs':
-      case 'mapred.local.dir':
-      case 'log.dirs':  // for Kafka Broker
-        this.unionAllMountPoints(!isOnlyFirstOneNeeded, localDB);
-        break;
-      case 'hbase.tmp.dir':
-        if (this.get('filename') == 'hbase-site.xml') {
-          this.unionAllMountPoints(isOnlyFirstOneNeeded, localDB);
-        }
-        break;
-      case 'fs.checkpoint.dir':
-      case 'dfs.namenode.checkpoint.dir':
-      case 'yarn.timeline-service.leveldb-timeline-store.path':
-      case 'dataDir':
-      case 'oozie_data_dir':
-      case 'storm.local.dir':
-      case '*.falcon.graph.storage.directory':
-      case '*.falcon.graph.serialize.path':
-        this.unionAllMountPoints(isOnlyFirstOneNeeded, localDB);
-        break;
-      case '*.broker.url':
-        var falconServerHost = masterComponentHostsInDB.findProperty('component', 'FALCON_SERVER').hostName;
-        this.setDefaultValue('localhost', falconServerHost);
-        break;
-      case 'RANGER_HOST':
-        var rangerAdminHost = masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN');
-        if(rangerAdminHost) {
-          this.set('value', rangerAdminHost.hostName);
-        } else {
-          this.set('isVisible', 'false');
-          this.set('isRequired', 'false');
-        }
-        break;
-    }
-  },
-
-  /**
-   * Get hive.metastore.uris initial value
-   * @param hosts
-   * @param defaultValue
-   * @returns {string}
-   */
-  getHiveMetastoreUris: function (hosts, defaultValue) {
-    var hiveMSHosts = hosts.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'),
-      hiveMSUris = hiveMSHosts,
-      regex = "\\w*:(\\d+)",
-      portValue = defaultValue && defaultValue.match(new RegExp(regex));
-
-    if (!portValue) return '';
-    if (portValue[1]) {
-      for (var i = 0; i < hiveMSHosts.length; i++) {
-        hiveMSUris[i] = "thrift://" + hiveMSHosts[i] + ":" + portValue[1];
-      }
-    }
-    return hiveMSUris.join(',');
-  },
-
-  /**
-   * @param regex : String
-   * @param replaceWith : String
-   */
-  setDefaultValue: function(regex,replaceWith) {
-    var defaultValue = this.get('defaultValue');
-    var re = new RegExp(regex);
-    defaultValue = defaultValue.replace(re,replaceWith);
-    this.set('defaultValue',defaultValue);
-    this.set('value',this.get('defaultValue'));
-  },
-
-  unionAllMountPoints: function (isOnlyFirstOneNeeded, localDB) {
-    var hostname = '';
-    var mountPointsPerHost = [];
-    var mountPointAsRoot;
-    var masterComponentHostsInDB = localDB.masterComponentHosts;
-    var slaveComponentHostsInDB = localDB.slaveComponentHosts;
-    var hostsInfo = localDB.hosts; // which we are setting in installerController in step3.
-    //all hosts should be in local storage without using App.Host model
-    App.Host.find().forEach(function(item){
-      if(!hostsInfo[item.get('id')]){
-        hostsInfo[item.get('id')] = {
-          name: item.get('id'),
-          cpu: item.get('cpu'),
-          memory: item.get('memory'),
-          disk_info: item.get('diskInfo'),
-          bootStatus: "REGISTERED",
-          isInstalled: true
-        };
-      }
-    });
-    var temp = '';
-    var setOfHostNames = [];
-    var components = [];
-    switch (this.get('name')) {
-      case 'dfs.namenode.name.dir':
-      case 'dfs.name.dir':
-        components = masterComponentHostsInDB.filterProperty('component', 'NAMENODE');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'fs.checkpoint.dir':
-      case 'dfs.namenode.checkpoint.dir':
-        components = masterComponentHostsInDB.filterProperty('component', 'SECONDARY_NAMENODE');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'dfs.data.dir':
-      case 'dfs.datanode.data.dir':
-        temp = slaveComponentHostsInDB.findProperty('componentName', 'DATANODE');
-        temp.hosts.forEach(function (host) {
-          setOfHostNames.push(host.hostName);
-        }, this);
-        break;
-      case 'mapred.local.dir':
-        temp = slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER') || slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER');
-        temp.hosts.forEach(function (host) {
-          setOfHostNames.push(host.hostName);
-        }, this);
-        break;
-      case 'yarn.nodemanager.log-dirs':
-      case 'yarn.nodemanager.local-dirs':
-        temp = slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER');
-        temp.hosts.forEach(function (host) {
-          setOfHostNames.push(host.hostName);
-        }, this);
-        break;
-      case 'yarn.timeline-service.leveldb-timeline-store.path':
-        components = masterComponentHostsInDB.filterProperty('component', 'APP_TIMELINE_SERVER');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'dataDir':
-        components = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'oozie_data_dir':
-        components = masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'hbase.tmp.dir':
-        temp = slaveComponentHostsInDB.findProperty('componentName', 'HBASE_REGIONSERVER');
-        temp.hosts.forEach(function (host) {
-          setOfHostNames.push(host.hostName);
-        }, this);
-        break;
-      case 'storm.local.dir':
-        temp = slaveComponentHostsInDB.findProperty('componentName', 'SUPERVISOR');
-        temp.hosts.forEach(function (host) {
-          setOfHostNames.push(host.hostName);
-        }, this);
-        components = masterComponentHostsInDB.filterProperty('component', 'NIMBUS');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case '*.falcon.graph.storage.directory':
-      case '*.falcon.graph.serialize.path':
-        components = masterComponentHostsInDB.filterProperty('component', 'FALCON_SERVER');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-      case 'log.dirs':
-        components = masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER');
-        components.forEach(function (component) {
-          setOfHostNames.push(component.hostName);
-        }, this);
-        break;
-    }
-
-    // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.
-    if (setOfHostNames.length === 0) {
-      return;
-    }
-
-    var allMountPoints = [];
-    for (var i = 0; i < setOfHostNames.length; i++) {
-      hostname = setOfHostNames[i];
-
-      mountPointsPerHost = hostsInfo[hostname].disk_info;
-
-      mountPointAsRoot = mountPointsPerHost.findProperty('mountpoint', '/');
-
-      // If Server does not send any host details information then atleast one mountpoint should be presumed as root
-      // This happens in a single container Linux Docker environment.
-      if (!mountPointAsRoot) {
-        mountPointAsRoot = {mountpoint: '/'};
-      }
-
-      mountPointsPerHost = mountPointsPerHost.filter(function (mPoint) {
-        return !(['/', '/home'].contains(mPoint.mountpoint)
-        || ['/etc/resolv.conf', '/etc/hostname', '/etc/hosts'].contains(mPoint.mountpoint) // docker specific mount points
-        || mPoint.mountpoint && (mPoint.mountpoint.startsWith('/boot') || mPoint.mountpoint.startsWith('/mnt'))
-        || ['devtmpfs', 'tmpfs', 'vboxsf', 'CDFS'].contains(mPoint.type)
-        || mPoint.available == 0);
-      });
-
-      mountPointsPerHost.forEach(function (mPoint) {
-        if( !allMountPoints.findProperty("mountpoint", mPoint.mountpoint)) {
-          allMountPoints.push(mPoint);
-        }
-      }, this);
-    }
-    if (allMountPoints.length == 0) {
-      allMountPoints.push(mountPointAsRoot);
-    }
-    this.set('value', '');
-    var winRegex = /^([a-z]):\\?$/;
-    if (!isOnlyFirstOneNeeded) {
-      allMountPoints.forEach(function (eachDrive) {
-        var mPoint = this.get('value');
-        if (!mPoint) {
-          mPoint = "";
-        }
-        if (eachDrive.mountpoint === "/") {
-          mPoint += this.get('defaultDirectory') + "\n";
-        } else if(winRegex.test(eachDrive.mountpoint.toLowerCase())) {
-          switch (this.get('name')) {
-            case 'dfs.name.dir':
-            case 'dfs.namenode.name.dir':
-            case 'dfs.data.dir':
-            case 'dfs.datanode.data.dir':
-              var winDriveUrl = eachDrive.mountpoint.toLowerCase().replace(winRegex, "file:///$1:");
-              mPoint += winDriveUrl + this.get('defaultDirectory') + "\n";
-              break;
-            default:
-              var winDrive = eachDrive.mountpoint.toLowerCase().replace(winRegex, "$1:");
-              var winDir = this.get('defaultDirectory').replace(/\//g, "\\");
-              mPoint += winDrive + winDir + "\n";
-          }
-        } else {
-          mPoint += eachDrive.mountpoint + this.get('defaultDirectory') + "\n";
-        }
-        this.set('value', mPoint);
-        this.set('defaultValue', mPoint);
-      }, this);
-    } else {
-      var mPoint = allMountPoints[0].mountpoint;
-      if (mPoint === "/") {
-        mPoint = this.get('defaultDirectory');
-      } else if(winRegex.test(mPoint.toLowerCase())) {
-        switch (this.get('name')) {
-          case 'fs.checkpoint.dir':
-          case 'dfs.namenode.checkpoint.dir':
-            var winDriveUrl = mPoint.toLowerCase().replace(winRegex, "file:///$1:");
-            mPoint = winDriveUrl + this.get('defaultDirectory') + "\n";
-            break;
-          case 'zk_data_dir':
-            var winDrive = mPoint.toLowerCase().replace(winRegex, "$1:");
-            var winDir = this.get('defaultDirectory').replace(/\//g, "\\\\");
-            mPoint = winDrive + winDir + "\n";
-            break;
-          default:
-            var winDrive = mPoint.toLowerCase().replace(winRegex, "$1:");
-            var winDir = this.get('defaultDirectory').replace(/\//g, "\\");
-            mPoint = winDrive + winDir + "\n";
-        }
-      } else {
-        mPoint = mPoint + this.get('defaultDirectory');
-      }
-      this.set('value', mPoint);
-      this.set('defaultValue', mPoint);
-    }
-  },
-
-  isValid: function () {
-    return this.get('errorMessage') === '';
-  }.property('errorMessage'),
-
-  viewClass: function () {
-    switch (this.get('displayType')) {
-      case 'checkbox':
-        if (this.get('dependentConfigPattern')) {
-          return App.ServiceConfigCheckboxWithDependencies;
-        } else {
-          return App.ServiceConfigCheckbox;
-        }
-      case 'password':
-        return App.ServiceConfigPasswordField;
-      case 'combobox':
-        return App.ServiceConfigComboBox;
-      case 'radio button':
-        return App.ServiceConfigRadioButtons;
-        break;
-      case 'directories':
-      case 'datanodedirs':
-        return App.ServiceConfigTextArea;
-        break;
-      case 'content':
-        return App.ServiceConfigTextAreaContent;
-        break;
-      case 'multiLine':
-        return App.ServiceConfigTextArea;
-        break;
-      case 'custom':
-        return App.ServiceConfigBigTextArea;
-      case 'masterHost':
-        return App.ServiceConfigMasterHostView;
-      case 'label':
-        return App.ServiceConfigLabelView;
-      case 'masterHosts':
-        return App.ServiceConfigMasterHostsView;
-      case 'slaveHosts':
-        return App.ServiceConfigSlaveHostsView;
-      case 'supportTextConnection':
-        return App.checkConnectionView;
-      default:
-        if (this.get('unit')) {
-          return App.ServiceConfigTextFieldWithUnit;
-        } else {
-          return App.ServiceConfigTextField;
-        }
-    }
-  }.property('displayType'),
-
-  validate: function () {
-    var value = this.get('value');
-    var supportsFinal = this.get('supportsFinal');
-    var isFinal = this.get('isFinal');
-    var valueRange = this.get('valueRange');
-    var values = [];//value split by "," to check UNIX users, groups list
-
-    var isError = false;
-    var isWarn = false;
-
-    if (typeof value === 'string' && value.length === 0) {
-      if (this.get('isRequired')) {
-        this.set('errorMessage', 'This is required');
-        isError = true;
-      } else {
-        return;
-      }
-    }
-
-    if (!isError) {
-      switch (this.get('displayType')) {
-        case 'int':
-          if (!validator.isValidInt(value)) {
-            this.set('errorMessage', 'Must contain digits only');
-            isError = true;
-          } else {
-            if(valueRange){
-              if(value < valueRange[0] || value > valueRange[1]){
-                this.set('errorMessage', 'Must match the range');
-                isError = true;
-              }
-            }
-          }
-          break;
-        case 'float':
-          if (!validator.isValidFloat(value)) {
-            this.set('errorMessage', 'Must be a valid number');
-            isError = true;
-          }
-          break;
-        case 'UNIXList':
-          if(value != '*'){
-            values = value.split(',');
-            for(var i = 0, l = values.length; i < l; i++){
-              if(!validator.isValidUNIXUser(values[i])){
-                if(this.get('type') == 'USERS'){
-                  this.set('errorMessage', 'Must be a valid list of user names');
-                } else {
-                  this.set('errorMessage', 'Must be a valid list of group names');
-                }
-                isError = true;
-              }
-            }
-          }
-          break;
-        case 'checkbox':
-          break;
-        case 'datanodedirs':
-          if (!validator.isValidDataNodeDir(value)) {
-            this.set('errorMessage', 'dir format is wrong, can be "[{storage type}]/{dir name}"');
-            isError = true;
-          }
-          else {
-            if (!validator.isAllowedDir(value)) {
-              this.set('errorMessage', 'Cannot start with "home(s)"');
-              isError = true;
-            }
-          }
-          break;
-        case 'directories':
-        case 'directory':
-          if (!validator.isValidDir(value)) {
-            this.set('errorMessage', 'Must be a slash or drive at the start');
-            isError = true;
-          }
-          else {
-            if (!validator.isAllowedDir(value)) {
-              this.set('errorMessage', 'Can\'t start with "home(s)"');
-              isError = true;
-            }
-          }
-          break;
-        case 'custom':
-          break;
-        case 'email':
-          if (!validator.isValidEmail(value)) {
-            this.set('errorMessage', 'Must be a valid email address');
-            isError = true;
-          }
-          break;
-        case 'host':
-          var hiveOozieHostNames = ['hive_hostname','hive_existing_mysql_host','hive_existing_oracle_host','hive_ambari_host',
-          'oozie_hostname','oozie_existing_mysql_host','oozie_existing_oracle_host','oozie_ambari_host'];
-          if(hiveOozieHostNames.contains(this.get('name'))) {
-            if (validator.hasSpaces(value)) {
-              this.set('errorMessage', Em.I18n.t('host.spacesValidation'));
-              isError = true;
-            }
-          } else {
-            if (validator.isNotTrimmed(value)) {
-              this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
-              isError = true;
-            }
-          }
-          break;
-        case 'advanced':
-          if(this.get('name')=='javax.jdo.option.ConnectionURL' || this.get('name')=='oozie.service.JPAService.jdbc.url') {
-            if (validator.isNotTrimmed(value)) {
-              this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
-              isError = true;
-            }
-          }
-          break;
-        case 'password':
-          // retypedPassword is set by the retypePasswordView child view of App.ServiceConfigPasswordField
-          if (value !== this.get('retypedPassword')) {
-            this.set('errorMessage', 'Passwords do not match');
-            isError = true;
-          }
-      }
-    }
-
-    if (!isError) {
-      // Check if this value is already in any of the overrides
-      var self = this;
-      var isOriginalSCP = this.get('isOriginalSCP');
-      var parentSCP = this.get('parentSCP');
-      if (!isOriginalSCP) {
-        if (!Em.isNone(parentSCP)) {
-          if (value === parentSCP.get('value') && supportsFinal && isFinal === parentSCP.get('isFinal')) {
-            this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
-            isError = true;
-          } else {
-            var overrides = parentSCP.get('overrides');
-            if (overrides) {
-              overrides.forEach(function (override) {
-                if (self != override && value === override.get('value')  && supportsFinal && isFinal === parentSCP.get('isFinal')) {
-                  self.set('errorMessage', Em.I18n.t('config.override.valueEqualToAnotherOverrideConfig'));
-                  isError = true;
-                }
-              });
-            }
-          }
-        }
-      }
-    }
-
-    if (!isWarn || isError) { // Errors get priority
-        this.set('warnMessage', '');
-        this.set('warn', false);
-    } else {
-        this.set('warn', true);
-    }
-
-    if (!isError) {
-        this.set('errorMessage', '');
-        this.set('error', false);
-      } else {
-        this.set('error', true);
-      }
-  }.observes('value', 'isFinal', 'retypedPassword')
-
-});
-
-App.ConfigSiteTag = Ember.Object.extend({
-  site: DS.attr('string'),
-  tag: DS.attr('string'),
-  /**
-   * Object map of hostname->override-tag for overrides.
-   * <b>Creators should set new object here.<b>
-   */
-  hostOverrides: null
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index e35f021..1a940e8 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 require('utils/helper');
-require('models/service_config');
+require('models/configs/objects/service_config_category');
 
 /**
  * This model loads all services supported by the stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/11a09c57/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 1169de1..b4a1d82 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 var stringUtils = require('utils/string_utils');
+var configPropertyHelper = require('utils/configs/config_property_helper');
 
 App.config = Em.Object.create({
 
@@ -704,7 +705,7 @@ App.config = Em.Object.create({
             'hive.metastore.uris': hiveMetastoreUrisConfig && hiveMetastoreUrisConfig.defaultValue,
             'clientPort': clientPortConfig && clientPortConfig.defaultValue
           };
-          serviceConfigProperty.initialValue(localDB, dependencies);
+          configPropertyHelper.initialValue(serviceConfigProperty, localDB, dependencies);
         }
         if (storedConfigs && storedConfigs.filterProperty('name', _config.name).length && !!_config.filename) {
           var storedConfig = storedConfigs.filterProperty('name', _config.name).findProperty('filename', _config.filename);


[4/4] ambari git commit: AMBARI-10827 JS error with toggling widget view. (ababiichuk)

Posted by ab...@apache.org.
AMBARI-10827 JS error with toggling widget view. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 2514cda00537319837be819a38f748a0f194f2a7
Parents: 11a09c5
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Apr 29 14:59:11 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Apr 29 14:59:11 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/styles/application.less          |  1 +
 .../configs/widgets/combo_config_widget_view.js |  2 +-
 .../configs/widgets/config_widget_view.js       |  2 +-
 .../configs/widgets/list_config_widget_view.js  |  2 +-
 .../widgets/slider_config_widget_view.js        | 30 ++++++-----
 .../widgets/time_interval_spinner_view.js       | 28 +++++-----
 .../widgets/combo_config_widget_view_test.js    | 25 +++++++++
 .../configs/widgets/config_widget_view_test.js  | 12 +++++
 .../widgets/slider_config_widget_view_test.js   | 55 +++++++++++++++++++-
 .../widgets/time_interval_spinner_view_test.js  | 47 +++++++++++++++++
 10 files changed, 176 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 271771d..8cd22c4 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5630,6 +5630,7 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
       table-layout: fixed; // for width to be equally distributed
       margin: 0 -20px;
       .config-section {
+        overflow: hidden;
         height: 100%;
         padding: 18px;
         border: 1px solid #aaa;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
index b3655e1..3686224 100644
--- a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
@@ -131,7 +131,7 @@ App.ComboConfigWidgetView = App.ConfigWidgetView.extend({
   },
 
   isValueCompatibleWithWidget: function() {
-    return this.get('content.valuesList').someProperty('configValue', this.get('config.value'));
+    return this._super() && this.get('content.valuesList').someProperty('configValue', this.get('config.value'));
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 37d2c9c..6b7dda4 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -282,7 +282,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    * @returns {boolean}
    */
   isValueCompatibleWithWidget: function() {
-    return true
+    return this.get('config.isValid');
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
index 3a5112c..aa154cf 100644
--- a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
@@ -261,7 +261,7 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
   },
 
   isValueCompatibleWithWidget: function() {
-    return this.get('options').someProperty('value', this.get('config.value'));
+    return this._super() && this.get('options').someProperty('value', this.get('config.value'));
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index 394ad6a..5634319 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -446,19 +446,25 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
   }.observes('parentView.content.isActive', 'parentView.parentView.tab.isActive'),
 
   isValueCompatibleWithWidget: function() {
-    var configValue = this.get('parseFunction')(this.get('config.value'));
-    if (this.get('config.stackConfigProperty.valueAttributes.minimum')) {
-      var min = this.get('parseFunction')(this.get('config.stackConfigProperty.valueAttributes.minimum'));
-      if (configValue < min) return false;
-    }
-    if (this.get('config.stackConfigProperty.valueAttributes.maximum')) {
-      var max = this.get('parseFunction')(this.get('config.stackConfigProperty.valueAttributes.maximum'));
-      if (configValue > max) return false;
-    }
-    if (this.get('config.stackConfigProperty.valueAttributes.step')) {
-      if (configValue % this.get('config.stackConfigProperty.valueAttributes.increment_step') != 0) return false;
+    if (this._super()) {
+      if (!this.get('validateFunction')(this.get('config.value'))) {
+        return false;
+      }
+      var configValue = this.get('parseFunction')(this.get('config.value'));
+      if (this.get('config.stackConfigProperty.valueAttributes.minimum')) {
+        var min = this.get('parseFunction')(this.get('config.stackConfigProperty.valueAttributes.minimum'));
+        if (configValue < min) return false;
+      }
+      if (this.get('config.stackConfigProperty.valueAttributes.maximum')) {
+        var max = this.get('parseFunction')(this.get('config.stackConfigProperty.valueAttributes.maximum'));
+        if (configValue > max) return false;
+      }
+      if (this.get('config.stackConfigProperty.valueAttributes.increment_step')) {
+        if (configValue % this.get('parseFunction')(this.get('config.stackConfigProperty.valueAttributes.increment_step')) != 0) return false;
+      }
+      return true;
     }
-    return true
+    return false;
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
index 40a88dc..fb5879d 100644
--- a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
+++ b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
@@ -237,18 +237,22 @@ App.TimeIntervalSpinnerView = App.ConfigWidgetView.extend({
   },
 
   isValueCompatibleWithWidget: function() {
-    var configValue = parseInt(this.get('config.value'));
-    if (this.get('config.stackConfigProperty.valueAttributes.minimum')) {
-      var min = parseInt(this.get('config.stackConfigProperty.valueAttributes.minimum'));
-      if (configValue < min) return false;
-    }
-    if (this.get('config.stackConfigProperty.valueAttributes.maximum')) {
-      var max = parseInt(this.get('config.stackConfigProperty.valueAttributes.maximum'));
-      if (configValue > max) return false;
-    }
-    if (this.get('config.stackConfigProperty.valueAttributes.step')) {
-      if (configValue % this.get('config.stackConfigProperty.valueAttributes.increment_step') != 0) return false;
+    if (this._super()) {
+      var configValue = parseInt(this.get('config.value'));
+      if (isNaN(configValue)) return false;
+      if (this.get('config.stackConfigProperty.valueAttributes.minimum')) {
+        var min = parseInt(this.get('config.stackConfigProperty.valueAttributes.minimum'));
+        if (configValue < min) return false;
+      }
+      if (this.get('config.stackConfigProperty.valueAttributes.maximum')) {
+        var max = parseInt(this.get('config.stackConfigProperty.valueAttributes.maximum'));
+        if (configValue > max) return false;
+      }
+      if (this.get('config.stackConfigProperty.valueAttributes.increment_step')) {
+        if (configValue % this.get('config.stackConfigProperty.valueAttributes.increment_step') != 0) return false;
+      }
+      return true;
     }
-    return true
+    return false;
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
index 7e8a768..4f66c57 100644
--- a/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
@@ -148,4 +148,29 @@ describe('App.ComboConfigWidgetView', function() {
       });
     });
   });
+
+  describe('#isValueCompatibleWithWidget()', function() {
+    beforeEach(function() {
+      this.view.set('content', {});
+      this.view.set('config', {});
+    });
+    it('pass validation', function() {
+      this.view.set('config.isValid', true);
+      this.view.set('config.value', 'v1');
+      this.view.set('content.valuesList', [{configValue: 'v1'}, {configValue: 'v2'}]);
+      expect(this.view.isValueCompatibleWithWidget()).to.be.true;
+    });
+
+    it('fail validation by isValid', function() {
+      this.view.set('config.isValid', false);
+      expect(this.view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it('fail validation value that missing from list', function() {
+      this.view.set('config.isValid', true);
+      this.view.set('config.value', 'v3');
+      this.view.set('content.valuesList', [{configValue: 'v1'}, {configValue: 'v2'}]);
+      expect(this.view.isValueCompatibleWithWidget()).to.be.false;
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
index 2165fac..ea4f72f 100644
--- a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
@@ -218,4 +218,16 @@ describe('App.ConfigWidgetView', function () {
     });
 
   });
+
+  describe('#isValueCompatibleWithWidget()', function() {
+    it('pass validation', function() {
+      view.set('config.isValid', true);
+      expect(view.isValueCompatibleWithWidget()).to.be.true;
+    });
+
+    it('fail validation', function() {
+      view.set('config.isValid', false);
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index 40874bc..d96743a 100644
--- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -17,7 +17,7 @@
  */
 
 var App = require('app');
-
+var validator = require('utils/validator');
 var viewInt, viewFloat, viewPercent;
 
 describe('App.SliderConfigWidgetView', function () {
@@ -370,4 +370,57 @@ describe('App.SliderConfigWidgetView', function () {
     });
   });
 
+  describe('#isValueCompatibleWithWidget', function() {
+    var stackConfigProperty = null;
+
+    beforeEach(function() {
+      viewInt.set('config', {});
+      stackConfigProperty = App.StackConfigProperty.createRecord({name: 'p1', valueAttributes: {minimum: 1, maximum: 10, increment_step: 4, type: 'int'}});
+      viewInt.set('config.stackConfigProperty', stackConfigProperty);
+      viewInt.set('config.isValid', true);
+    });
+
+    it ('fail by config validation', function() {
+      viewInt.set('config.isValid', false);
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail by view validation', function() {
+      viewInt.set('config.value', 'a');
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail by view validation int', function() {
+      viewInt.set('config.value', '2.2');
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail by view validation float', function() {
+      viewFloat.set('config.value', '2.2.2');
+      viewFloat.set('validateFunction', validator.isValidFloat);
+      expect(viewFloat.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: to large', function() {
+      viewInt.set('config.value', 12);
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: to small', function() {
+      viewInt.set('config.value', 0);
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: wrong step', function() {
+      viewInt.set('config.stackConfigProperty', stackConfigProperty);
+      viewInt.set('config.value', '3');
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('ok', function() {
+      viewInt.set('config.value', 4);
+      expect(viewInt.isValueCompatibleWithWidget()).to.be.true;
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2514cda0/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
index dc3c6dd..fd80f3f 100644
--- a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
@@ -244,4 +244,51 @@ describe('App.TimeIntervalSpinnerView', function () {
 
   });
 
+  describe('#isValueCompatibleWithWidget', function() {
+    var stackConfigProperty = null;
+
+    beforeEach(function() {
+      view.set('config', {});
+      stackConfigProperty = App.StackConfigProperty.createRecord({name: 'p1', valueAttributes: {minimum: 1, maximum: 10, increment_step: 4, type: 'int'}});
+      view.set('config.stackConfigProperty', stackConfigProperty);
+      view.set('config.isValid', true);
+    });
+
+    it ('fail by config validation', function() {
+      view.set('config.isValid', false);
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail by view validation', function() {
+      view.set('config.value', 'a');
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail by view validation int', function() {
+      view.set('config.value', '2.2');
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: to large', function() {
+      view.set('config.value', 12);
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: to small', function() {
+      view.set('config.value', 0);
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('fail: wrong step', function() {
+      view.set('config.stackConfigProperty', stackConfigProperty);
+      view.set('config.value', '3');
+      expect(view.isValueCompatibleWithWidget()).to.be.false;
+    });
+
+    it ('ok', function() {
+      view.set('config.value', 4);
+      expect(view.isValueCompatibleWithWidget()).to.be.true;
+    });
+  });
+
 });
\ No newline at end of file