ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] ambari git commit: AMBARI-8306 remove code for UI recommendation/validation. (ababiichuk)
Date Thu, 13 Nov 2014 12:52:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk eaa54b33a -> ab48cfbf0


http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/utils/configs/defaults_providers/yarn_defaults_provider_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/defaults_providers/yarn_defaults_provider_test.js
b/ambari-web/test/utils/configs/defaults_providers/yarn_defaults_provider_test.js
deleted file mode 100644
index 3da8aae..0000000
--- a/ambari-web/test/utils/configs/defaults_providers/yarn_defaults_provider_test.js
+++ /dev/null
@@ -1,317 +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('utils/configs/defaults_providers/defaultsProvider');
-require('utils/configs/defaults_providers/yarn_defaults_provider');
-
-var yarnDefaultProvider;
-
-describe('YARNDefaultsProvider', function() {
-
-  beforeEach(function() {
-    yarnDefaultProvider = App.YARNDefaultsProvider.create();
-  });
-
-  afterEach(function() {
-    yarnDefaultProvider.set('clusterData', null);
-    yarnDefaultProvider.set('reservedRam', null);
-    yarnDefaultProvider.set('hBaseRam', null);
-    yarnDefaultProvider.set('containers', null);
-    yarnDefaultProvider.set('recommendedMinimumContainerSize', null);
-    yarnDefaultProvider.set('ramPerContainer', null);
-    yarnDefaultProvider.set('mapMemory', null);
-    yarnDefaultProvider.set('reduceMemory', null);
-    yarnDefaultProvider.set('amMemory', null);
-  });
-
-  describe('#clusterDataIsValid', function() {
-    var tests = Em.A([
-      {clusterData: {disk: 12,ram: 48,cpu: 12,hBaseInstalled: false},e: true},
-      {clusterData: {disk: null,ram: 48,cpu: 12,hBaseInstalled: false},e: false},
-      {clusterData: {disk: 12,ram: null,cpu: 12,hBaseInstalled: false},e: false},
-      {clusterData: {disk: 12,ram: 48,cpu: null,hBaseInstalled: false},e: false},
-      {clusterData: {disk: 12,ram: 48,cpu: 12,hBaseInstalled: null},e: false},
-      {clusterData: {disk: 12,ram: 48,cpu: 12},e: false},
-      {clusterData: {disk: 12,ram: 48,hBaseInstalled: true},e: false},
-      {clusterData: {disk: 12,cpu: 12,hBaseInstalled: true},e: false},
-      {clusterData: {ram: 48,cpu: 12,hBaseInstalled: false},e: false}
-    ]);
-    tests.forEach(function(test) {
-      it((test.e?'valid':'invalid') + ' clusterData', function() {
-        yarnDefaultProvider.set('clusterData', test.clusterData);
-        expect(yarnDefaultProvider.clusterDataIsValid()).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#reservedMemoryRecommendations', function() {
-    var tests = Em.A([
-      {ram: null, e: {os: 1, hbase: 1}},
-      {ram: 2, e: {os: 1, hbase: 1}},
-      {ram: 4, e: {os: 1, hbase: 1}},
-      {ram: 6, e: {os: 2, hbase: 1}},
-      {ram: 8, e: {os: 2, hbase: 1}},
-      {ram: 12, e: {os: 2, hbase: 2}},
-      {ram: 16, e: {os: 2, hbase: 2}},
-      {ram: 20, e: {os: 4, hbase: 4}},
-      {ram: 24, e: {os: 4, hbase: 4}},
-      {ram: 36, e: {os: 6, hbase: 8}},
-      {ram: 48, e: {os: 6, hbase: 8}},
-      {ram: 56, e: {os: 8, hbase: 8}},
-      {ram: 64, e: {os: 8, hbase: 8}},
-      {ram: 68, e: {os: 8, hbase: 8}},
-      {ram: 72, e: {os: 8, hbase: 8}},
-      {ram: 84, e: {os: 12, hbase: 16}},
-      {ram: 96, e: {os: 12, hbase: 16}},
-      {ram: 112, e: {os: 24, hbase: 24}},
-      {ram: 128, e: {os: 24, hbase: 24}},
-      {ram: 196, e: {os: 32, hbase: 32}},
-      {ram: 256, e: {os: 32, hbase: 32}},
-      {ram: 384, e: {os: 64, hbase: 64}},
-      {ram: 512, e: {os: 64, hbase: 64}},
-      {ram: 756, e: {os: 64, hbase: 64}}
-    ]);
-    tests.forEach(function(test) {
-      it('ram: ' + test.ram + ' GB', function() {
-        sinon.spy(yarnDefaultProvider, 'reservedMemoryRecommendations');
-        yarnDefaultProvider.set('clusterData', {
-          disk: 12,
-          ram: test.ram,
-          cpu: 12,
-          hBaseInstalled: false
-        });
-        expect(yarnDefaultProvider.get('reservedRam')).to.equal(test.e.os);
-        expect(yarnDefaultProvider.get('hBaseRam')).to.equal(test.e.hbase);
-        expect(yarnDefaultProvider.reservedMemoryRecommendations.calledOnce).to.equal(true);
-        yarnDefaultProvider.reservedMemoryRecommendations.restore();
-      });
-    });
-  });
-
-  describe('#recommendedMinimumContainerSize', function() {
-    it('No clusterData', function() {
-      yarnDefaultProvider.set('clusterData', null);
-      expect(yarnDefaultProvider.get('recommendedMinimumContainerSize')).to.equal(null);
-    });
-    it('No clusterData.ram', function() {
-      yarnDefaultProvider.set('clusterData', {});
-      expect(yarnDefaultProvider.get('recommendedMinimumContainerSize')).to.equal(null);
-    });
-
-    var tests = Em.A([
-      {ram: 3, e: 256},
-      {ram: 4, e: 256},
-      {ram: 6, e: 512},
-      {ram: 8, e: 512},
-      {ram: 12, e: 1024},
-      {ram: 24, e: 1024}
-    ]);
-
-    tests.forEach(function(test) {
-      it('ram: ' + test.ram + ' GB', function() {
-       yarnDefaultProvider.set('clusterData', {
-          disk: 12,
-          ram: test.ram,
-          cpu: 12,
-          hBaseInstalled: false
-        });
-        expect(yarnDefaultProvider.get('recommendedMinimumContainerSize')).to.equal(test.e);
-      });
-    });
-
-  });
-
-  describe('#containers', function() {
-    it('No clusterData', function() {
-      yarnDefaultProvider.set('clusterData', null);
-      expect(yarnDefaultProvider.get('containers')).to.equal(null);
-    });
-    it('Some clusterData metric is null', function() {
-      yarnDefaultProvider.set('clusterData', {disk: null, cpu: 1, ram: 1});
-      expect(yarnDefaultProvider.get('containers')).to.equal(null);
-      yarnDefaultProvider.set('clusterData', {disk: 1, cpu: null, ram: 1});
-      expect(yarnDefaultProvider.get('containers')).to.equal(null);
-      yarnDefaultProvider.set('clusterData', {disk:1, cpu: 1, ram: null});
-      expect(yarnDefaultProvider.get('containers')).to.equal(null);
-    });
-
-    var tests = Em.A([
-      {
-        clusterData: {
-          disk: 12,
-          ram: 48,
-          cpu: 12,
-          hBaseInstalled: false
-        },
-        e: 21
-      },
-      {
-        clusterData: {
-          disk: 6,
-          ram: 48,
-          cpu: 6,
-          hBaseInstalled: true
-        },
-        e: 11
-      }
-    ]);
-
-    tests.forEach(function(test) {
-      it((test.hBaseInstalled?'With':'Without') + ' hBase', function() {
-        yarnDefaultProvider.set('clusterData', test.clusterData);
-        expect(yarnDefaultProvider.get('containers')).to.equal(test.e);
-      });
-    });
-
-  });
-
-  describe('#ramPerContainer', function() {
-    it('No clusterData', function() {
-      yarnDefaultProvider.set('clusterData', null);
-      expect(yarnDefaultProvider.get('ramPerContainer')).to.equal(null);
-    });
-    var tests = Em.A([
-      {
-        clusterData: {
-          disk: 12,
-          ram: 48,
-          cpu: 12,
-          hBaseInstalled: false
-        },
-        e: 2048
-      },
-      {
-        clusterData: {
-          disk: 12,
-          ram: 16,
-          cpu: 12,
-          hBaseInstalled: true
-        },
-        e: 1024
-      }
-    ]);
-
-    tests.forEach(function(test) {
-      it((test.hBaseInstalled?'With':'Without') + ' hBase', function() {
-        yarnDefaultProvider.set('clusterData', test.clusterData);
-        expect(yarnDefaultProvider.get('ramPerContainer')).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#getDefaults', function() {
-    var tests = Em.A([
-      {
-        localDB: {},
-        m: 'Empty localDB',
-        e: null
-      },
-      {
-        localDB: {
-          "masterComponentHosts": []
-        },
-        m: 'localDB without hosts',
-        e: null
-      },
-      {
-        localDB: {
-          "hosts": {}
-        },
-        m: 'localDB without masterComponentHosts amd slaveComponentHosts',
-        e: null
-      },
-      {
-        localDB: {
-          "hosts": {
-            "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
-            "host2": {"name": "host2","cpu": 4,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
-          },
-          "masterComponentHosts": [],
-          "slaveComponentHosts": [
-            {
-              "componentName": "NODEMANAGER",
-              "hosts": [{"hostName": "host2"}]
-            }
-          ]
-        },
-        m: 'Without HBase',
-        e: {
-          'mapreduce.map.java.opts': '-Xmx2048m',
-          'mapreduce.map.memory.mb': 2560,
-          'mapreduce.reduce.java.opts': '-Xmx2048m',
-          'mapreduce.reduce.memory.mb': 2560,
-          'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
-          'yarn.app.mapreduce.am.resource.mb': 2560,
-          'yarn.nodemanager.resource.memory-mb': 20480,
-          'yarn.scheduler.maximum-allocation-mb': 20480,
-          'yarn.scheduler.minimum-allocation-mb': 2560,
-          'mapreduce.task.io.sort.mb': 1024
-        }
-      },
-      {
-        localDB: {
-          "hosts": {
-            "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
-            "host2": {"name": "host2","cpu": 4,"memory": "12582912.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
-          },
-          "masterComponentHosts": [
-            {"component": "HBASE_MASTER","hostName": "host1","serviceId": "HDFS"}
-          ],
-          "slaveComponentHosts": [
-            {
-              "componentName": "NODEMANAGER",
-              "hosts": [{"hostName": "host2"}]
-            }
-          ]
-        },
-        m: 'With HBase',
-        e: {
-          'mapreduce.map.java.opts': '-Xmx819m',
-          'mapreduce.map.memory.mb': 1024,
-          'mapreduce.reduce.java.opts': '-Xmx819m',
-          'mapreduce.reduce.memory.mb': 1024,
-          'yarn.app.mapreduce.am.command-opts': '-Xmx819m',
-          'yarn.app.mapreduce.am.resource.mb': 1024,
-          'yarn.nodemanager.resource.memory-mb': 8192,
-          'yarn.scheduler.maximum-allocation-mb': 8192,
-          'yarn.scheduler.minimum-allocation-mb': 1024,
-          'mapreduce.task.io.sort.mb': 410
-        }
-      }
-    ]);
-    tests.forEach(function(test) {
-      yarnDefaultProvider = App.YARNDefaultsProvider.create();
-      describe(test.m, function() {
-        yarnDefaultProvider.set('clusterData', null);
-        var configs = yarnDefaultProvider.getDefaults(test.localDB);
-
-        Em.keys(configs).forEach(function(config) {
-          it(config, function() {
-            if (test.e) {
-              expect(configs[config]).to.equal(test.e[config]);
-            }
-            else {
-              expect(configs[config] == 0 || configs[config] == null).to.equal(true);
-            }
-          });
-        });
-      });
-    });
-  });
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/utils/configs/validators/service_configs_validator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/validators/service_configs_validator_test.js b/ambari-web/test/utils/configs/validators/service_configs_validator_test.js
deleted file mode 100644
index 3da3ecb..0000000
--- a/ambari-web/test/utils/configs/validators/service_configs_validator_test.js
+++ /dev/null
@@ -1,307 +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('utils/configs/validators/service_configs_validator');
-
-describe('App.ServiceConfigsValidator', function() {
-
-  describe('#validateConfig', function() {
-    it('No config validator', function() {
-      var v = App.ServiceConfigsValidator.create({});
-      expect(v.validateConfig(Em.Object.create({name:'name'}))).to.equal(null);
-    });
-  });
-
-  describe('#validatorLessThenDefaultValue', function() {
-    var tests = Em.A([
-      {
-        recommendedDefaults: {
-          'property1': 100500
-        },
-        config: Em.Object.create({
-          value: 100000,
-          name: 'property1'
-        }),
-        m: 'Numeric value',
-        e: 'string'
-      },
-      {
-        recommendedDefaults: {
-          'property1': 'xx100500x'
-        },
-        config: Em.Object.create({
-          value: 'xx100000x',
-          name: 'property1'
-        }),
-        m: 'String value',
-        e: 'string'
-      },
-      {
-        recommendedDefaults: {
-          'property1': null
-        },
-        config: Em.Object.create({
-          value: 100000,
-          name: 'property1'
-        }),
-        m: 'No default value for property',
-        e: null
-      }
-    ]);
-    tests.forEach(function(test) {
-      it(test.m, function() {
-        var v = App.ServiceConfigsValidator.create({});
-        v.set('recommendedDefaults', test.recommendedDefaults);
-        var r = v.validatorLessThenDefaultValue(test.config);
-        if (test.e) {
-          expect(r).to.be.a(test.e);
-        }
-        else {
-          expect(r).to.equal(null)
-        }
-      });
-    });
-  });
-
-  describe('#_checkXmxValueFormat', function() {
-    var tests = Em.A([
-      {value: '',e: false},
-      {value: '-',e: false},
-      {value: '100',e: false},
-      {value: '-Xmx',e: false},
-      {value: '-XMX1',e: false},
-      {value: '-Xmxb',e: false},
-      {value: '-Xmxk',e: false},
-      {value: '-Xmxm',e: false},
-      {value: '-Xmxg',e: false},
-      {value: '-Xmxp',e: false},
-      {value: '-Xmxt',e: false},
-      {value: '-XmxB',e: false},
-      {value: '-XmxK',e: false},
-      {value: '-XmxM',e: false},
-      {value: '-XmxG',e: false},
-      {value: '-XmxP',e: false},
-      {value: '-XmxT',e: false},
-      {value: '-Xmx1',e: true},
-      {value: '-Xmx1b',e: true},
-      {value: '-Xmx1k',e: true},
-      {value: '-Xmx1m',e: true},
-      {value: '-Xmx1g',e: true},
-      {value: '-Xmx1t',e: true},
-      {value: '-Xmx1p',e: true},
-      {value: '-Xmx1B',e: true},
-      {value: '-Xmx1K',e: true},
-      {value: '-Xmx1M',e: true},
-      {value: '-Xmx1G',e: true},
-      {value: '-Xmx1T',e: true},
-      {value: '-Xmx1P',e: true},
-      {value: '-Xmx100',e: true},
-      {value: '-Xmx100b',e: true},
-      {value: '-Xmx100k',e: true},
-      {value: '-Xmx100m',e: true},
-      {value: '-Xmx100g',e: true},
-      {value: '-Xmx100t',e: true},
-      {value: '-Xmx100p',e: true},
-      {value: '-Xmx100B',e: true},
-      {value: '-Xmx100K',e: true},
-      {value: '-Xmx100M',e: true},
-      {value: '-Xmx100G',e: true},
-      {value: '-Xmx100T',e: true},
-      {value: '-Xmx100P',e: true},
-      {value: '-Xmx100Psome',e: false},
-      {value: '-Xmx100P-Xmx',e: false},
-      {value: '-Xmx100P -Xmx',e: false},
-      {value: '-Xmx100P -XMX',e: false},
-      {value: '-server -Xmx1024m -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: true},
-      {value: '-server -Xmx1024 -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: true},
-      {value: '-server -Xmx1024', e: true},
-      {value: '-Xmx1024 -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: true},
-      {value: '-server -Xmx1024m-Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server -Xmx1024-Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server-Xmx1024m -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server-Xmx1024 -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server-Xmx1024m-Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server-Xmx1024-Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-Xmx1024-Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC',
e: false},
-      {value: '-server-Xmx1024', e: false},
-      {value: '-server    -Xmx1024m   -Da=b',e: true},
-      {value: '-server -Xmx1024m -Da=b',e: true},
-      {value: '-server -XMx1024m -Da=b',e: false},
-      {value: '-server -Xmx1024M -Da=b',e: true},
-      {value: '-server -Xmx1 -Da=b',e: true},
-      {value: '-server -Xmx1100MBPS -Da=b',e: false},
-      {value: '-server -Xmx1100M -Xmx200 -Da=b',e: false},
-      {value: '-server --Xmx1100M -Da=b',e: false},
-      {value: '-Xmx1024m -server -Da=b',e: true},
-      {value: ' -server -Da=b -Xmx1024m',e: true}
-    ]);
-    tests.forEach(function(test) {
-      it(test.value, function() {
-        var v = App.ServiceConfigsValidator.create({});
-        expect(v._checkXmxValueFormat(test.value)).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#_getXmxSize', function() {
-    var tests = Em.A([
-      {value: '-Xmx1', e: '1'},
-      {value: '-Xmx1b', e: '1b'},
-      {value: '-Xmx1k', e: '1k'},
-      {value: '-Xmx1m', e: '1m'},
-      {value: '-Xmx1g', e: '1g'},
-      {value: '-Xmx1t', e: '1t'},
-      {value: '-Xmx1p', e: '1p'},
-      {value: '-Xmx1B', e: '1b'},
-      {value: '-Xmx1K', e: '1k'},
-      {value: '-Xmx1M', e: '1m'},
-      {value: '-Xmx1G', e: '1g'},
-      {value: '-Xmx1T', e: '1t'},
-      {value: '-Xmx1P', e: '1p'},
-      {value: '-Xmx100b', e: '100b'},
-      {value: '-Xmx100k', e: '100k'},
-      {value: '-Xmx100m', e: '100m'},
-      {value: '-Xmx100g', e: '100g'},
-      {value: '-Xmx100t', e: '100t'},
-      {value: '-Xmx100p', e: '100p'},
-      {value: '-Xmx100B', e: '100b'},
-      {value: '-Xmx100K', e: '100k'},
-      {value: '-Xmx100M', e: '100m'},
-      {value: '-Xmx100G', e: '100g'},
-      {value: '-Xmx100T', e: '100t'},
-      {value: '-Xmx100P', e: '100p'}
-    ]);
-    tests.forEach(function(test) {
-      it(test.value, function() {
-        var v = App.ServiceConfigsValidator.create({});
-        expect(v._getXmxSize(test.value)).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#_formatXmxSizeToBytes', function() {
-    var tests = Em.A([
-      {value: '1', e: 1},
-      {value: '1 ', e: 1},
-      {value: '100', e: 100},
-      {value: '100 ', e: 100},
-      {value: '100b', e: 100},
-      {value: '100B', e: 100},
-      {value: '100k', e: 100 * 1024},
-      {value: '100K', e: 100 * 1024},
-      {value: '100m', e: 100 * 1024 * 1024},
-      {value: '100M', e: 100 * 1024 * 1024},
-      {value: '100g', e: 100 * 1024 * 1024 * 1024},
-      {value: '100G', e: 100 * 1024 * 1024 * 1024},
-      {value: '100t', e: 100 * 1024 * 1024 * 1024 * 1024},
-      {value: '100T', e: 100 * 1024 * 1024 * 1024 * 1024},
-      {value: '100p', e: 100 * 1024 * 1024 * 1024 * 1024 * 1024},
-      {value: '100P', e: 100 * 1024 * 1024 * 1024 * 1024 * 1024}
-    ]);
-    tests.forEach(function(test) {
-      it(test.value, function() {
-        var v = App.ServiceConfigsValidator.create({});
-        expect(v._formatXmxSizeToBytes(test.value)).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#validateXmxValue', function() {
-    var tests = Em.A([
-      {
-        recommendedDefaults: {
-          'property1': '-Xmx1024m'
-        },
-        config: Em.Object.create({
-          value: '-Xmx2g',
-          name: 'property1'
-        }),
-        e: null
-      },
-      {
-        recommendedDefaults: {
-          'property1': '-Xmx12'
-        },
-        config: Em.Object.create({
-          value: '-Xmx24',
-          name: 'property1'
-        }),
-        e: null
-      },
-      {
-        recommendedDefaults: {
-          'property1': '-Xmx333k'
-        },
-        config: Em.Object.create({
-          value: '-Xmx134k',
-          name: 'property1'
-        }),
-        e: 'string'
-      },
-      {
-        recommendedDefaults: {
-          'property1': '-Xmx333k'
-        },
-        config: Em.Object.create({
-          value: '-Xmx534',
-          name: 'property1'
-        }),
-        e: 'string'
-      },
-      {
-        recommendedDefaults: {},
-        config: Em.Object.create({
-          defaultValue: '-Xmx123',
-          value: '-Xmx123',
-          name: 'name'
-        }),
-        e: null
-      },
-      {
-        recommendedDefaults: {},
-        config: Em.Object.create({
-          defaultValue: '-Xmx124',
-          value: '-Xmx123',
-          name: 'name'
-        }),
-        e: 'string'
-      }
-    ]);
-    tests.forEach(function(test) {
-      it(test.config.get('value'), function() {
-        var v = App.ServiceConfigsValidator.create({});
-        v.set('recommendedDefaults', test.recommendedDefaults);
-        var r = v.validateXmxValue(test.config);
-        if (test.e) {
-          expect(r).to.be.a(test.e);
-        }
-        else {
-          expect(r).to.equal(null)
-        }
-      });
-    });
-
-    it('Error should be thrown', function() {
-      var v = App.ServiceConfigsValidator.create({});
-      v.set('recommendedDefaults', {});
-      expect(function() {v.validateXmxValue(Em.Object.create({value:''}));}).to.throw(Error);
-    });
-
-  });
-
-});


Mime
View raw message