You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/08/15 20:20:18 UTC
[03/10] git commit: AMBARI-6874. Fix UI unit tests after jobs,
admin and recommendation changes.. (Denys Buzhor via akovalenko)
AMBARI-6874. Fix UI unit tests after jobs, admin and recommendation changes.. (Denys Buzhor via akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/884016f8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/884016f8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/884016f8
Branch: refs/heads/branch-alerts-dev
Commit: 884016f876beeddcba1ed1402f7f2669bcce3543
Parents: b2d4d8c
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Aug 15 16:59:48 2014 +0300
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Aug 15 14:19:59 2014 -0400
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 18 +-
ambari-web/app/utils/host_progress_popup.js | 1 +
.../test/controllers/main/admin/cluster_test.js | 87 -------
.../main/admin/misc_controller_test.js | 222 ------------------
.../controllers/main/admin/repositories_test.js | 87 +++++++
.../admin/serviceAccounts_controller_test.js | 222 ++++++++++++++++++
.../test/controllers/main/host/details_test.js | 8 +-
.../jobs/hive_job_details_controller_test.js | 68 ------
.../controllers/main/jobs_controller_test.js | 118 ----------
.../test/controllers/main/service/item_test.js | 6 +-
.../service/reassign/step2_controller_test.js | 4 +-
.../test/controllers/wizard/step6_test.js | 4 +-
ambari-web/test/models/job_test.js | 60 -----
ambari-web/test/models/jobs/job_test.js | 98 --------
ambari-web/test/models/jobs/tez_dag_test.js | 111 ---------
.../test/utils/host_progress_popup_test.js | 28 +--
.../test/views/main/admin/user/create_test.js | 183 ---------------
.../test/views/main/admin/user/edit_test.js | 224 ------------------
.../jobs/hive_job_details_tez_dag_view_test.js | 106 ---------
.../main/jobs/hive_job_details_tez_test.js | 229 -------------------
.../main/jobs/hive_job_details_view_test.js | 155 -------------
ambari-web/test/views/main/jobs_view_test.js | 102 ---------
22 files changed, 339 insertions(+), 1802 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/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 9c7d111..48db27e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -43,8 +43,8 @@ var files = ['test/init_model_test',
'test/controllers/global/update_controller_test',
'test/controllers/global/configuration_controller_test',
'test/controllers/main/app_contoller_test',
- 'test/controllers/main/admin/cluster_test',
- 'test/controllers/main/admin/misc_controller_test',
+ 'test/controllers/main/admin/repositories_test',
+ 'test/controllers/main/admin/serviceAccounts_controller_test',
'test/controllers/main/admin/highAvailability_controller_test',
'test/controllers/main/admin/security_test',
'test/controllers/main/admin/security/disable_test',
@@ -76,8 +76,6 @@ var files = ['test/init_model_test',
'test/controllers/main/host_test',
'test/controllers/main/service/item_test',
'test/controllers/main/service/info/config_test',
- 'test/controllers/main/jobs_controller_test',
- 'test/controllers/main/jobs/hive_job_details_controller_test',
'test/controllers/main/service_test',
'test/controllers/main/admin_test',
'test/controllers/main/alerts_controller_test',
@@ -98,8 +96,6 @@ var files = ['test/init_model_test',
'test/login_test',
'test/mappers/server_data_mapper_test',
'test/mappers/hosts_mapper_test',
- 'test/mappers/jobs_mapper_test',
- 'test/mappers/runs_mapper_test',
'test/mappers/service_mapper_test',
'test/mappers/status_mapper_test',
'test/mappers/users_mapper_test',
@@ -134,8 +130,6 @@ var files = ['test/init_model_test',
'test/views/common/table_view_test',
'test/views/common/quick_link_view_test',
'test/views/common/rolling_restart_view_test',
- 'test/views/main/admin/user/create_test',
- 'test/views/main/admin/user/edit_test',
'test/views/main/dashboard_test',
'test/views/main/dashboard/widget_test',
'test/views/main/dashboard/widgets_test',
@@ -159,9 +153,6 @@ var files = ['test/init_model_test',
'test/views/main/host/summary_test',
'test/views/main/host/details/host_component_view_test',
'test/views/main/host/details/host_component_views/decommissionable_test',
- 'test/views/main/jobs_view_test',
- 'test/views/main/jobs/hive_job_details_tez_dag_view_test',
- 'test/views/main/jobs/hive_job_details_view_test',
'test/views/main/charts/heatmap/heatmap_host_test',
'test/views/main/service/info/config_test',
'test/views/main/mirroring/edit_dataset_view_test',
@@ -183,8 +174,6 @@ var files = ['test/init_model_test',
'test/views/experimental_test',
'test/views/installer_test',
'test/views/login_test',
- 'test/models/jobs/job_test',
- 'test/models/jobs/tez_dag_test',
'test/models/service/flume_test',
'test/models/service/hdfs_test',
'test/models/service/yarn_test',
@@ -198,7 +187,6 @@ var files = ['test/init_model_test',
'test/models/host_test',
'test/models/host_component_test',
'test/models/hosts_test',
- 'test/models/job_test',
'test/models/run_test',
'test/models/service_config_test',
'test/models/stack_service_component_test',
@@ -215,4 +203,4 @@ describe('Ambari Web Unit tests', function() {
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 36e9c30..754bfe5 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -338,6 +338,7 @@ App.HostPopup = Em.Object.create({
'COMPLETED': ['SUCCESS', 'icon-ok', 'progress-success', false]
};
var pendingStatus = ['PENDING', 'icon-cog', 'progress-info', true];
+ debugger;
this.set("servicesInfo", null);
this.get("inputData").forEach(function (service) {
var status = statuses[service.status] || pendingStatus;
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/admin/cluster_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/cluster_test.js b/ambari-web/test/controllers/main/admin/cluster_test.js
deleted file mode 100644
index 26fa0ff..0000000
--- a/ambari-web/test/controllers/main/admin/cluster_test.js
+++ /dev/null
@@ -1,87 +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('controllers/main/admin/cluster');
-
-
-describe('App.MainAdminClusterController', function () {
-
- var data = {
- "items": [
- {
- "Versions": {
- "stack_version": "1.3.1",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.3.0",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.2.2",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.2.0",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "2.0.5",
- "min_upgrade_version": "2.0.0"
- }
- },
- {
- "Versions": {
- "stack_version": "2.0.5",
- "min_upgrade_version": "2.0.5"
- }
- }
- ]
- };
-
- //todo should be verified
- describe('#updateUpgradeVersionSuccessCallback()', function () {
- it('upgrade version of stack should be "HDP-1.2.2"', function () {
- App.set('currentStackVersion', 'HDP-1.2.2');
- var controller = App.MainAdminClusterController.create({
- parseServicesInfo: Em.K
- });
- controller.updateUpgradeVersionSuccessCallback.call(controller, data);
- expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
- });
- it('if min upgrade version less then current then upgrade version equal current', function () {
- App.set('currentStackVersion', 'HDP-1.2.2');
- data.items[0].Versions.min_upgrade_version = "1.2.3";
- var controller = App.MainAdminClusterController.create({
- parseServicesInfo: Em.K
- });
- controller.updateUpgradeVersionSuccessCallback.call(controller, data);
- expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
- })
- })
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/admin/misc_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/misc_controller_test.js b/ambari-web/test/controllers/main/admin/misc_controller_test.js
deleted file mode 100644
index ee6e718..0000000
--- a/ambari-web/test/controllers/main/admin/misc_controller_test.js
+++ /dev/null
@@ -1,222 +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('controllers/main/admin/misc_controller');
-
-
-describe('App.MainAdminMiscController', function () {
-
- var controller = App.MainAdminMiscController.create();
-
- describe('#setContentProperty()', function () {
- var testCases = [
- {
- title: 'key is null',
- content: {
- key: null,
- configName: 'cc',
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'configName is null',
- content: {
- key: 'key',
- configName: null,
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'misc configs array doesn\'t contain such a config',
- content: {
- key: 'key',
- configName: 'config1',
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'content doesn\'t contain such a key',
- content: {
- key: 'key',
- configName: 'config1',
- miscConfigs: [
- Em.Object.create({
- name: 'test_key'
- })
- ]
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'content property match config',
- content: {
- key: 'testKey',
- configName: 'test_key',
- miscConfigs: [
- Em.Object.create({
- name: 'test_key',
- value: 'testValue'
- })
- ]
- },
- result: {
- output: true,
- configValue: 'testValue'
- }
- }
- ];
- controller.set('content', Em.Object.create({testKey: 'test'}));
- testCases.forEach(function (test) {
- it(test.title, function () {
- var content = controller.get('content');
- expect(controller.setContentProperty(test.content.key, test.content.configName, test.content.miscConfigs)).to.equal(test.result.output);
- expect(content.get('testKey')).to.equal(test.result.configValue);
- });
- });
- });
-
- describe('#sortByOrder()', function () {
- var testCases = [
- {
- title: 'sortOrder is null',
- content: {
- sortOrder: null,
- arrayToSort: [
- {
- name: 'one',
- displayName: 'one'
- }
- ]
- },
- result: ['one']
- },
- {
- title: 'sortOrder is empty',
- content: {
- sortOrder: [],
- arrayToSort: [
- {
- name: 'one',
- displayName: 'one'
- }
- ]
- },
- result: ['one']
- },
- {
- title: 'sortOrder items don\'t match items of array',
- content: {
- sortOrder: ['one'],
- arrayToSort: [
- {name: 'two'}
- ]
- },
- result: []
- },
- {
- title: 'sort items in reverse order',
- content: {
- sortOrder: ['two', 'one'],
- arrayToSort: [
- Em.Object.create({
- name: 'one',
- displayName: 'one'
- }),
- Em.Object.create({
- name: 'two',
- displayName: 'two'
- })
- ]
- },
- result: ['two', 'one']
- },
- {
- title: 'sort items in correct order',
- content: {
- sortOrder: ['one', 'two'],
- arrayToSort: [
- Em.Object.create({
- name: 'one',
- displayName: 'one'
- }),
- Em.Object.create({
- name: 'two',
- displayName: 'two'
- })
- ]
- },
- result: ['one', 'two']
- }
- ];
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.sortByOrder(test.content.sortOrder, test.content.arrayToSort).mapProperty('displayName')).to.eql(test.result);
- });
- });
- });
-
- describe('#setProxyUserGroupLabel()', function () {
-
- it('proxyuser_group config is absent', function () {
- var misc_configs = [];
- controller.setProxyUserGroupLabel(misc_configs);
- expect(misc_configs.findProperty('name', 'proxyuser_group')).to.be.undefined;
- });
- it('proxyuser_group config defined and isHadoop21Stack is true', function () {
- var misc_configs = [Em.Object.create({
- name: 'proxyuser_group',
- displayName: 'test'
- })];
- sinon.stub(App, 'get', function(){
- return true;
- });
- controller.setProxyUserGroupLabel(misc_configs);
- expect(misc_configs.findProperty('name', 'proxyuser_group').get('displayName')).to.equal('test');
- App.get.restore();
- });
- it('proxyuser_group config defined and isHadoop21Stack is false', function () {
- var misc_configs = [Em.Object.create({
- name: 'proxyuser_group',
- displayName: 'test'
- })];
- sinon.stub(App, 'get', function(){
- return false;
- });
- controller.setProxyUserGroupLabel(misc_configs);
- expect(misc_configs.findProperty('name', 'proxyuser_group').get('displayName')).to.equal('Proxy group for Hive, WebHCat and Oozie');
- App.get.restore();
- });
- })
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/admin/repositories_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/repositories_test.js b/ambari-web/test/controllers/main/admin/repositories_test.js
new file mode 100644
index 0000000..53234d1
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/repositories_test.js
@@ -0,0 +1,87 @@
+/**
+ * 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('controllers/main/admin/repositories');
+
+
+describe('App.MainAdminRepositoriesController', function() {
+
+ var data = {
+ "items": [
+ {
+ "Versions": {
+ "stack_version": "1.3.1",
+ "min_upgrade_version": "1.2.0"
+ }
+ },
+ {
+ "Versions": {
+ "stack_version": "1.3.0",
+ "min_upgrade_version": "1.2.0"
+ }
+ },
+ {
+ "Versions": {
+ "stack_version": "1.2.2",
+ "min_upgrade_version": "1.2.0"
+ }
+ },
+ {
+ "Versions": {
+ "stack_version": "1.2.0",
+ "min_upgrade_version": "1.2.0"
+ }
+ },
+ {
+ "Versions": {
+ "stack_version": "2.0.5",
+ "min_upgrade_version": "2.0.0"
+ }
+ },
+ {
+ "Versions": {
+ "stack_version": "2.0.5",
+ "min_upgrade_version": "2.0.5"
+ }
+ }
+ ]
+ };
+
+ //todo should be verified
+ describe('#updateUpgradeVersionSuccessCallback()', function () {
+ it('upgrade version of stack should be "HDP-1.2.2"', function () {
+ App.set('currentStackVersion', 'HDP-1.2.2');
+ var controller = App.MainAdminRepositoriesController.create({
+ parseServicesInfo: Em.K
+ });
+ controller.updateUpgradeVersionSuccessCallback.call(controller, data);
+ expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
+ });
+ it('if min upgrade version less then current then upgrade version equal current', function () {
+ App.set('currentStackVersion', 'HDP-1.2.2');
+ data.items[0].Versions.min_upgrade_version = "1.2.3";
+ var controller = App.MainAdminRepositoriesController.create({
+ parseServicesInfo: Em.K
+ });
+ controller.updateUpgradeVersionSuccessCallback.call(controller, data);
+ expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
+ })
+ })
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js b/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
new file mode 100644
index 0000000..6e82731
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
@@ -0,0 +1,222 @@
+/**
+ * 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('controllers/main/admin/serviceAccounts_controller');
+
+
+describe('App.MainAdminServiceAccountsController', function () {
+
+ var controller = App.MainAdminServiceAccountsController.create();
+
+ describe('#setContentProperty()', function () {
+ var testCases = [
+ {
+ title: 'key is null',
+ content: {
+ key: null,
+ configName: 'cc',
+ miscConfigs: []
+ },
+ result: {
+ output: false,
+ configValue: 'test'
+ }
+ },
+ {
+ title: 'configName is null',
+ content: {
+ key: 'key',
+ configName: null,
+ miscConfigs: []
+ },
+ result: {
+ output: false,
+ configValue: 'test'
+ }
+ },
+ {
+ title: 'misc configs array doesn\'t contain such a config',
+ content: {
+ key: 'key',
+ configName: 'config1',
+ miscConfigs: []
+ },
+ result: {
+ output: false,
+ configValue: 'test'
+ }
+ },
+ {
+ title: 'content doesn\'t contain such a key',
+ content: {
+ key: 'key',
+ configName: 'config1',
+ miscConfigs: [
+ Em.Object.create({
+ name: 'test_key'
+ })
+ ]
+ },
+ result: {
+ output: false,
+ configValue: 'test'
+ }
+ },
+ {
+ title: 'content property match config',
+ content: {
+ key: 'testKey',
+ configName: 'test_key',
+ miscConfigs: [
+ Em.Object.create({
+ name: 'test_key',
+ value: 'testValue'
+ })
+ ]
+ },
+ result: {
+ output: true,
+ configValue: 'testValue'
+ }
+ }
+ ];
+ controller.set('content', Em.Object.create({testKey: 'test'}));
+ testCases.forEach(function (test) {
+ it(test.title, function () {
+ var content = controller.get('content');
+ expect(controller.setContentProperty(test.content.key, test.content.configName, test.content.miscConfigs)).to.equal(test.result.output);
+ expect(content.get('testKey')).to.equal(test.result.configValue);
+ });
+ });
+ });
+
+ describe('#sortByOrder()', function () {
+ var testCases = [
+ {
+ title: 'sortOrder is null',
+ content: {
+ sortOrder: null,
+ arrayToSort: [
+ {
+ name: 'one',
+ displayName: 'one'
+ }
+ ]
+ },
+ result: ['one']
+ },
+ {
+ title: 'sortOrder is empty',
+ content: {
+ sortOrder: [],
+ arrayToSort: [
+ {
+ name: 'one',
+ displayName: 'one'
+ }
+ ]
+ },
+ result: ['one']
+ },
+ {
+ title: 'sortOrder items don\'t match items of array',
+ content: {
+ sortOrder: ['one'],
+ arrayToSort: [
+ {name: 'two'}
+ ]
+ },
+ result: []
+ },
+ {
+ title: 'sort items in reverse order',
+ content: {
+ sortOrder: ['two', 'one'],
+ arrayToSort: [
+ Em.Object.create({
+ name: 'one',
+ displayName: 'one'
+ }),
+ Em.Object.create({
+ name: 'two',
+ displayName: 'two'
+ })
+ ]
+ },
+ result: ['two', 'one']
+ },
+ {
+ title: 'sort items in correct order',
+ content: {
+ sortOrder: ['one', 'two'],
+ arrayToSort: [
+ Em.Object.create({
+ name: 'one',
+ displayName: 'one'
+ }),
+ Em.Object.create({
+ name: 'two',
+ displayName: 'two'
+ })
+ ]
+ },
+ result: ['one', 'two']
+ }
+ ];
+ testCases.forEach(function (test) {
+ it(test.title, function () {
+ expect(controller.sortByOrder(test.content.sortOrder, test.content.arrayToSort).mapProperty('displayName')).to.eql(test.result);
+ });
+ });
+ });
+
+ describe('#setProxyUserGroupLabel()', function () {
+
+ it('proxyuser_group config is absent', function () {
+ var misc_configs = [];
+ controller.setProxyUserGroupLabel(misc_configs);
+ expect(misc_configs.findProperty('name', 'proxyuser_group')).to.be.undefined;
+ });
+ it('proxyuser_group config defined and isHadoop21Stack is true', function () {
+ var misc_configs = [Em.Object.create({
+ name: 'proxyuser_group',
+ displayName: 'test'
+ })];
+ sinon.stub(App, 'get', function(){
+ return true;
+ });
+ controller.setProxyUserGroupLabel(misc_configs);
+ expect(misc_configs.findProperty('name', 'proxyuser_group').get('displayName')).to.equal('test');
+ App.get.restore();
+ });
+ it('proxyuser_group config defined and isHadoop21Stack is false', function () {
+ var misc_configs = [Em.Object.create({
+ name: 'proxyuser_group',
+ displayName: 'test'
+ })];
+ sinon.stub(App, 'get', function(){
+ return false;
+ });
+ controller.setProxyUserGroupLabel(misc_configs);
+ expect(misc_configs.findProperty('name', 'proxyuser_group').get('displayName')).to.equal('Proxy group for Hive, WebHCat and Oozie');
+ App.get.restore();
+ });
+ })
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 769b052..bd5ad09 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -1358,7 +1358,11 @@ describe('App.MainHostDetailsController', function () {
describe('#downloadClientConfigs()', function () {
beforeEach(function () {
- sinon.spy($, 'fileDownload');
+ sinon.stub($, 'fileDownload', function() {
+ return {
+ fail: function() { return false; }
+ }
+ });
});
afterEach(function () {
$.fileDownload.restore();
@@ -1374,4 +1378,4 @@ describe('App.MainHostDetailsController', function () {
});
});
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/jobs/hive_job_details_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/jobs/hive_job_details_controller_test.js b/ambari-web/test/controllers/main/jobs/hive_job_details_controller_test.js
deleted file mode 100644
index 7fd4ac1..0000000
--- a/ambari-web/test/controllers/main/jobs/hive_job_details_controller_test.js
+++ /dev/null
@@ -1,68 +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 jobsUtils = require('utils/jobs');
-require('models/service/yarn');
-require('mappers/jobs/hive_job_mapper');
-require('utils/ajax/ajax');
-require('utils/http_client');
-require('models/jobs/tez_dag');
-require('controllers/main/jobs/hive_job_details_controller');
-
-describe('App.MainHiveJobDetailsController', function () {
- var yarnService = {
- id: 'YARN',
- ahsWebPort: 8188
- };
- App.store.load(App.YARNService, yarnService);
- var job = {
- id: 'hrt_qa_20140311131919_1d932567-71c2-4341-9b50-6df1f58a9114',
- queryText: 'show tables',
- name: 'hrt_qa_20140311131919_1d932567-71c2-4341-9b50-6df1f58a9114',
- user: ['hrt_qa'],
- hasTezDag: true,
- failed: false,
- startTime: 1394569191001,
- jobType: 'hive',
- tezDag: {
- id: 'hrt_qa_20140311131919_1d932567-71c2-4341-9b50-6df1f58a9114:1',
- instanceId: 'dag_1394502141829_0425_1',
- name: 'hrt_qa_20140311131919_1d932567-71c2-4341-9b50-6df1f58a9114:1',
- yarnApplicationId: 'application_1395263571423_0014',
- stage: 'Stage-1'
- }
- };
- var mainHiveJobDetailsController = App.MainHiveJobDetailsController.create({
- job: Ember.Object.create(job),
- content: {
- id: 'id'
- }
- });
- mainHiveJobDetailsController.set('job', mainHiveJobDetailsController.get('content'));
- describe('#loaded', function () {
- it('content loading from model', function () {
- jobsUtils.refreshHiveJobDetails = function (hiveJob, successCallback, errorCallback) {
- successCallback();
- };
- mainHiveJobDetailsController.loadJobDetails();
- expect(mainHiveJobDetailsController.get('loaded')).to.equal(true);
- expect(mainHiveJobDetailsController.get('content.id')).to.equal(mainHiveJobDetailsController.get('job.id'));
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/jobs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/jobs_controller_test.js b/ambari-web/test/controllers/main/jobs_controller_test.js
deleted file mode 100644
index 4404a5e..0000000
--- a/ambari-web/test/controllers/main/jobs_controller_test.js
+++ /dev/null
@@ -1,118 +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('mappers/jobs/hive_jobs_mapper');
-require('models/service/yarn');
-require('models/jobs/job');
-require('models/jobs/hive_job');
-require('controllers/main/jobs_controller');
-
-describe('App.MainJobsController', function () {
- var mainJobsController = App.MainJobsController.create();
- var filterObject = mainJobsController.get('filterObject');
- describe('#totalOfJobs', function () {
- it('should be equal to content.length', function () {
- mainJobsController.set('content', [
- Ember.Object.create({
- id: 'id0',
- queryText: 'show tables',
- name: 'id0',
- user: ['user1'],
- hasTezDag: true,
- failed: false,
- startTime: 1393443850756,
- endTime: 1393443875265,
- tezDagId: 'id0:1'
- })
- ]);
- expect(mainJobsController.get('totalOfJobs')).to.equal(1);
- });
- });
- describe('#sortingDone', function () {
- it('should be true after automatically ran sorting', function () {
- expect(mainJobsController.get('sortingDone')).to.equal(true);
- });
- });
- describe('#sortProperty', function () {
- it('should change according to sortingColumn.name', function () {
- mainJobsController.set('sortingColumn').set('name', 'id');
- expect(mainJobsController.get('sortProperty')).to.equal('id');
- });
- });
- describe('#sortAscending', function () {
- it('sorting should be ascending as default', function () {
- mainJobsController.set('sortingColumn').set('status', '');
- expect(mainJobsController.get('sortAscending')).to.equal(true);
- });
- });
- describe('#filterObject.isIdFilterApplied', function () {
- it('should be true if id field is not empty', function () {
- filterObject.set('id', 'some_id');
- expect(filterObject.get('isIdFilterApplied')).to.equal(true);
- });
- });
- describe('#filterObject.isAnyFilterApplied', function () {
- it('should be true if id field is not empty', function () {
- filterObject.createJobsFiltersLink();
- expect(filterObject.get('isAnyFilterApplied')).to.equal(true);
- });
- });
- describe('#sortedContent', function () {
- it('sorting by different properties', function () {
- mainJobsController.get('content').push(Ember.Object.create({
- id: 'id1',
- queryText: 'show tables',
- name: 'id1',
- user: ['user0'],
- failed: false,
- startTime: 1393443850757,
- endTime: 1393443875264,
- tezDagId: null
- }));
- mainJobsController.contentAndSortUpdater();
- expect(mainJobsController.get('sortedContent')[0].get('user')).to.eql(['user1']);
- mainJobsController.toggleProperty('sortAscending');
- mainJobsController.contentAndSortUpdater();
- expect(mainJobsController.get('sortedContent')[0].get('user')).to.eql(['user0']);
- mainJobsController.set('sortProperty', 'user');
- mainJobsController.contentAndSortUpdater();
- expect(mainJobsController.get('sortedContent')[0].get('id')).to.equal('id0');
- mainJobsController.get('content').push(Ember.Object.create({
- id: 'id2',
- queryText: 'show tables',
- name: 'id2',
- user: ['user2'],
- failed: false,
- startTime: 1393443850758,
- endTime: 1393443875263,
- tezDagId: null
- }));
- mainJobsController.contentAndSortUpdater();
- mainJobsController.set('sortProperty', 'startTime');
- expect(mainJobsController.get('sortedContent')[0].get('id')).to.equal('id2');
- mainJobsController.set('sortProperty', 'endTime');
- mainJobsController.contentAndSortUpdater();
- expect(mainJobsController.get('sortedContent')[0].get('id')).to.equal('id0');
- mainJobsController.set('sortProperty', 'duration');
- mainJobsController.toggleProperty('sortAscending');
- mainJobsController.contentAndSortUpdater();
- expect(mainJobsController.get('sortedContent')[0].get('user')).to.eql(['user1']);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index f9ee143..4f94eda 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -609,7 +609,11 @@ describe('App.MainServiceItemController', function () {
});
beforeEach(function () {
- sinon.spy($, 'fileDownload');
+ sinon.stub($, 'fileDownload', function() {
+ return {
+ fail: function() { return false; }
+ }
+ });
});
afterEach(function () {
$.fileDownload.restore();
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
index 6962dda..94eba0d 100644
--- a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
@@ -38,16 +38,18 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
beforeEach(function () {
sinon.stub(App.router, 'send', Em.K);
+ sinon.stub(controller, 'clearStep', Em.K);
sinon.stub(controller, 'loadComponents', Em.K);
sinon.stub(controller, 'loadStepCallback', Em.K);
sinon.stub(controller, 'rebalanceSingleComponentHosts', Em.K);
});
afterEach(function () {
- controller.rebalanceSingleComponentHosts.restore();
App.router.send.restore();
+ controller.clearStep.restore();
controller.loadStepCallback.restore();
controller.loadComponents.restore();
+ controller.rebalanceSingleComponentHosts.restore();
});
it('SECONDARY_NAMENODE is absent, reassign component is NAMENODE', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 6466315..abe91a6 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -436,7 +436,7 @@ describe('App.WizardStep6Controller', function () {
return test.r
});
controller.set('content.controllerName', test.controllerName);
- expect(controller.validate()).to.equal(test.e);
+ expect(controller.callClientSideValidation()).to.equal(test.e);
controller[test.method].restore();
});
});
@@ -545,4 +545,4 @@ describe('App.WizardStep6Controller', function () {
});
});
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/models/job_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/job_test.js b/ambari-web/test/models/job_test.js
deleted file mode 100644
index d49cfe9..0000000
--- a/ambari-web/test/models/job_test.js
+++ /dev/null
@@ -1,60 +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 modelSetup = require('test/init_model_test');
-require('models/job');
-
-var job,
- jobData = {
- id: 'job'
- };
-
-describe('App.Job', function () {
-
- beforeEach(function () {
- job = App.Job.createRecord(jobData);
- });
-
- afterEach(function () {
- modelSetup.deleteRecord(job);
- });
-
- describe('#duration', function () {
- it('should convert elapsedTime into time format', function () {
- job.set('elapsedTime', 1000);
- expect(job.get('duration')).to.equal('1.00 secs');
- });
- });
-
- describe('#inputFormatted', function () {
- it('should convert input into bandwidth format', function () {
- job.set('input', 1024);
- expect(job.get('inputFormatted')).to.equal('1.0KB');
- });
- });
-
- describe('#outputFormatted', function () {
- it('should convert output into bandwidth format', function () {
- job.set('output', 1024);
- expect(job.get('outputFormatted')).to.equal('1.0KB');
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/models/jobs/job_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/jobs/job_test.js b/ambari-web/test/models/jobs/job_test.js
deleted file mode 100644
index 1ca21d8..0000000
--- a/ambari-web/test/models/jobs/job_test.js
+++ /dev/null
@@ -1,98 +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 modelSetup = require('test/init_model_test');
-require('models/jobs/job');
-
-var job,
- jobData = {
- id: 'job'
- },
- timeCases = [
- {
- toSet: 'startTime',
- toExpect: 'startTimeDisplay'
- },
- {
- toSet: 'endTime',
- toExpect: 'endTimeDisplay'
- }
- ],
- timeDataCorrect = {
- startTime: 1000,
- endTime: 2000
- },
- timeDataRunning = {
- startTime: App.dateTime() - 1000,
- endTime: undefined
- },
- timeDataIncorrect = {
- startTime: App.dateTime() - 1000,
- endTime: 1
- };
-
-describe('App.AbstractJob', function () {
-
- beforeEach(function () {
- job = App.AbstractJob.createRecord(jobData);
- });
-
- afterEach(function () {
- modelSetup.deleteRecord(job);
- });
-
- timeCases.forEach(function (item) {
- var toSet = item.toSet,
- toExpect = item.toExpect;
- describe('#' + toExpect, function () {
- it('should be empty', function () {
- job.set(toSet, 0);
- expect(job.get(toExpect)).to.be.empty;
- });
- it('should return formatted time', function () {
- job.set(toSet, 1000000);
- expect(job.get(toExpect)).to.equal('Thu, Jan 01, 1970 00:16');
- });
- });
- });
-
- describe('#duration', function () {
- it('should calculate the difference between endTime and startTime', function () {
- job.setProperties(timeDataCorrect);
- expect(job.get('duration')).to.equal(1000);
- });
- it('should calculate the difference between current time and startTime if the job is running', function () {
- job.setProperties(timeDataRunning);
- expect(job.get('duration')).to.be.at.least(1000);
- });
- it('should calculate the difference between current time and startTime if endTime is incorrect', function () {
- job.setProperties(timeDataIncorrect);
- expect(job.get('duration')).to.be.at.least(1000);
- });
- });
-
- describe('#durationDisplay', function () {
- it('should return formatted string', function () {
- job.setProperties(timeDataCorrect);
- expect(job.get('durationDisplay')).to.equal('1.00 secs');
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/models/jobs/tez_dag_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/jobs/tez_dag_test.js b/ambari-web/test/models/jobs/tez_dag_test.js
deleted file mode 100644
index 17e6c7e..0000000
--- a/ambari-web/test/models/jobs/tez_dag_test.js
+++ /dev/null
@@ -1,111 +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 modelSetup = require('test/init_model_test');
-require('models/jobs/tez_dag');
-
-var vertex,
- vertexData = {
- id: 'vertex'
- },
- timeData = {
- startTime: 1000,
- endTime: 2000
- },
- tasksCases = [
- {
- count: 5,
- number: 5,
- title: 'should return tasks count'
- },
- {
- count: null,
- number: 0,
- title: 'should return 0'
- }
- ],
- dataSizeCases = [
- {
- file: 'fileReadBytes',
- hdfs: 'hdfsReadBytes',
- total: 'totalReadBytes',
- totalDisplay: 'totalReadBytesDisplay'
- },
- {
- file: 'fileWriteBytes',
- hdfs: 'hdfsWriteBytes',
- total: 'totalWriteBytes',
- totalDisplay: 'totalWriteBytesDisplay'
- }
- ],
- setDataSize = function (vertex, fileProp, fileVal, hdfsProp, hdfsVal) {
- vertex.set(fileProp, fileVal);
- vertex.set(hdfsProp, hdfsVal);
- };
-
-describe('App.TezDagVertex', function () {
-
- beforeEach(function () {
- vertex = App.TezDagVertex.createRecord(vertexData);
- });
-
- afterEach(function () {
- modelSetup.deleteRecord(vertex);
- });
-
- describe('#duration', function () {
- it('should calculate the difference between endTime and startTime', function () {
- vertex.setProperties(timeData);
- expect(vertex.get('duration')).to.equal(1000);
- });
- });
-
- tasksCases.forEach(function(item) {
- describe('#tasksNumber', function () {
- it(item.title, function () {
- vertex.set('tasksCount', item.count);
- expect(vertex.get('tasksNumber')).to.equal(item.number);
- });
- });
- });
-
- dataSizeCases.forEach(function (item) {
- describe('#' + item.total, function () {
- it('should sum ' + item.file + ' and ' + item.hdfs, function () {
- setDataSize(vertex, item.file, 1024, item.hdfs, 2048);
- expect(vertex.get(item.total)).to.equal(3072);
- });
- });
- describe('#' + item.totalDisplay, function () {
- it('should return formatted ' + item.total, function () {
- setDataSize(vertex, item.file, 1024, item.hdfs, 2048);
- expect(vertex.get(item.totalDisplay)).to.equal('3 KB');
- });
- });
- });
-
- describe('#durationDisplay', function () {
- it('should return formatted string', function () {
- vertex.setProperties(timeData);
- expect(vertex.get('durationDisplay')).to.equal('1.00 secs');
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/utils/host_progress_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/host_progress_popup_test.js b/ambari-web/test/utils/host_progress_popup_test.js
index b8bc177..1198099 100644
--- a/ambari-web/test/utils/host_progress_popup_test.js
+++ b/ambari-web/test/utils/host_progress_popup_test.js
@@ -335,37 +335,32 @@ describe('App.HostPopup', function () {
});
describe('#abortRequest', function () {
+ var popup;
beforeEach(function () {
sinon.stub(App.ajax, 'send', Em.K);
sinon.spy(App, 'showConfirmationPopup');
- App.HostPopup.createPopup();
});
afterEach(function () {
- App.HostPopup.get('isPopup').hide();
App.ajax.send.restore();
App.showConfirmationPopup.restore();
});
it('should show confirmation popup', function () {
- App.HostPopup.get('isPopup.bodyClass').create().abortRequest({
- context: Em.Object.create({
- name: 'name'
- })
- });
+ App.HostPopup.abortRequest(Em.Object.create({
+ name: 'name'
+ }));
expect(App.showConfirmationPopup.calledOnce).to.be.true;
});
});
describe('#abortRequestSuccessCallback', function () {
beforeEach(function () {
- App.HostPopup.createPopup();
sinon.spy(App.ModalPopup, 'show');
});
afterEach(function () {
- App.HostPopup.get('isPopup').hide();
App.ModalPopup.show.restore();
});
it('should open popup', function () {
- App.HostPopup.get('isPopup.bodyClass').create().abortRequestSuccessCallback(null, null, {
+ App.HostPopup.abortRequestSuccessCallback(null, null, {
requestName: 'name'
});
expect(App.ModalPopup.show.calledOnce).to.be.true;
@@ -373,18 +368,17 @@ describe('App.HostPopup', function () {
});
describe('#abortRequestErrorCallback', function () {
- var popup = App.HostPopup.createPopup();
+ var popup = App.HostPopup;
beforeEach(function () {
sinon.stub(App.ajax, 'get', function(k) {
if (k === 'modalPopup') return null;
return Em.get(App, k);
});
sinon.spy(App.ModalPopup, 'show');
- sinon.stub(popup, 'get', function(k) {
- if (k === 'abortedRequests') return [0];
- return Em.get(popup, k);
- });
- popup.get('bodyClass').create().abortRequestErrorCallback({
+ popup.set('controller', Em.Object.create({
+ abortedRequests: [0]
+ }));
+ popup.abortRequestErrorCallback({
responseText: {
message: 'message'
},
@@ -396,9 +390,7 @@ describe('App.HostPopup', function () {
});
});
afterEach(function () {
- App.HostPopup.get('isPopup').hide();
App.ModalPopup.show.restore();
- popup.get.restore();
App.ajax.get.restore();
});
it('should open popup', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/views/main/admin/user/create_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/user/create_test.js b/ambari-web/test/views/main/admin/user/create_test.js
deleted file mode 100644
index bd5b88c..0000000
--- a/ambari-web/test/views/main/admin/user/create_test.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-var App = require('app');
-require('views/main/admin/user/create');
-
-describe('App.MainAdminUserCreateView', function () {
-
- var view = App.MainAdminUserCreateView.create({
- userForm: Em.Object.create({
- isValid: function () {
- return this.get('mockIsValid');
- },
- getField: function () {
- return Em.Object.create();
- },
- isWarn: Em.K,
- propertyDidChange: Em.K,
- mockIsValid: false
- })
- });
-
- describe('#create()', function () {
-
- it('form is invalid', function () {
- view.set('userForm.mockIsValid', false);
- expect(view.create()).to.be.false;
- });
- it('form is valid', function () {
- view.set('userForm.mockIsValid', true);
- sinon.stub(App.ajax, 'send', Em.K);
-
- expect(view.create()).to.be.true;
- expect(App.ajax.send.calledOnce).to.be.true;
-
- App.ajax.send.restore();
- });
- });
-
- describe('#createUserSuccessCallback()', function () {
-
- it('', function () {
- var mock = {
- persistKey: function () {
- return 'persists';
- },
- postUserPref: Em.K
- };
- var params = {
- form: {
- getField: function () {
- return Em.Object.create({
- value: 'user_name_value'
- })
- },
- save: Em.K
- }
- };
- sinon.stub(App.ModalPopup, 'show', Em.K);
- sinon.stub(App.router, 'get', function () {
- return mock;
- });
- sinon.spy(mock, 'persistKey');
- sinon.spy(mock, 'postUserPref');
- sinon.spy(params.form, 'save');
- sinon.stub(App.router, 'transitionTo', Em.K);
-
- view.createUserSuccessCallback({}, {}, params);
- expect(App.ModalPopup.show.calledOnce).to.be.true;
- expect(mock.persistKey.calledWith('user_name_value')).to.be.true;
- expect(mock.postUserPref.calledWith('persists', true)).to.be.true;
- expect(params.form.save.calledOnce).to.be.true;
- expect(App.router.transitionTo.calledWith('allUsers')).to.be.true;
-
- App.ModalPopup.show.restore();
- App.router.get.restore();
- App.router.transitionTo.restore();
- });
- });
-
- describe('#createUserErrorCallback()', function () {
-
- it('', function () {
- sinon.stub(App.ModalPopup, 'show', Em.K);
-
- view.createUserErrorCallback();
- expect(App.ModalPopup.show.calledOnce).to.be.true;
-
- App.ModalPopup.show.restore();
- });
- });
-
- describe('#keyPress()', function () {
-
- beforeEach(function () {
- sinon.stub(view, 'create', Em.K);
- });
- afterEach(function () {
- view.create.restore();
- });
-
- it('not "Enter" button pressed', function () {
- expect(view.keyPress({keyCode: 99})).to.be.true;
- expect(view.create.called).to.be.false;
- });
- it('"Enter" button pressed', function () {
- expect(view.keyPress({keyCode: 13})).to.be.false;
- expect(view.create.calledOnce).to.be.true;
- });
- });
-
- describe('#passwordValidation()', function () {
- var mock = Em.Object.create();
-
- beforeEach(function () {
- sinon.stub(view.get('userForm'), 'getField', function () {
- return mock;
- });
- sinon.stub(view.get('userForm'), 'isValid', Em.K);
- sinon.stub(view.get('userForm'), 'isWarn', Em.K);
- });
- afterEach(function () {
- view.get('userForm').getField.restore();
- view.get('userForm').isValid.restore();
- view.get('userForm').isWarn.restore();
- });
-
- it('passwordValue is null, isPasswordDirty = false', function () {
- mock.set('value', null);
- view.set('isPasswordDirty', false);
-
- view.passwordValidation();
- expect(view.get('isPasswordDirty')).to.be.false;
- expect(view.get('userForm').isValid.called).to.be.false;
- expect(view.get('userForm').isWarn.called).to.be.false;
- });
- it('passwordValue is correct, isPasswordDirty = true', function () {
- mock.set('value', 'pass');
- view.set('isPasswordDirty', true);
-
- view.passwordValidation();
- expect(view.get('isPasswordDirty')).to.be.true;
- expect(view.get('userForm').isValid.calledOnce).to.be.true;
- expect(view.get('userForm').isWarn.calledOnce).to.be.true;
- });
- it('passwordValue is correct, isPasswordDirty = false', function () {
- mock.set('value', 'pass');
- view.set('isPasswordDirty', false);
-
- view.passwordValidation();
- expect(view.get('isPasswordDirty')).to.be.true;
- expect(view.get('userForm').isValid.calledOnce).to.be.true;
- expect(view.get('userForm').isWarn.calledOnce).to.be.true;
- });
- });
-
- describe('#didInsertElement()', function () {
- it('propertyDidChange function should be called', function () {
- sinon.spy(view.get('userForm'), 'propertyDidChange');
-
- view.didInsertElement();
- expect(view.get('userForm').propertyDidChange.calledWith('object')).to.be.true;
-
- view.get('userForm').propertyDidChange.restore();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/views/main/admin/user/edit_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/user/edit_test.js b/ambari-web/test/views/main/admin/user/edit_test.js
deleted file mode 100644
index 21cdb2b..0000000
--- a/ambari-web/test/views/main/admin/user/edit_test.js
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-var App = require('app');
-require('views/main/admin/user/edit');
-
-describe('App.MainAdminUserEditView', function () {
-
- var view = App.MainAdminUserEditView.create({
- userForm: Em.Object.create({
- getField: function (property) {
- return this.get(property) || Em.Object.create();
- },
- isValid: Em.K,
- isWarn: Em.K,
- propertyDidChange: Em.K
- })
- });
-
- describe('#edit()', function () {
-
- beforeEach(function () {
- sinon.stub(App.ajax, 'send', Em.K);
- });
- afterEach(function () {
- view.get('userForm').isValid.restore();
- App.ajax.send.restore();
- });
-
- it('form is invalid', function () {
- sinon.stub(view.get('userForm'), 'isValid', function () {
- return false;
- });
-
- expect(view.edit()).to.be.false;
- expect(App.ajax.send.called).to.be.false;
- });
- it('form is valid', function () {
- sinon.stub(view.get('userForm'), 'isValid', function () {
- return true;
- });
- sinon.stub(view, 'setPassword', Em.K);
-
-
- expect(view.edit()).to.be.true;
- expect(App.ajax.send.calledOnce).to.be.true;
- expect(view.setPassword.calledOnce).to.be.true;
-
- view.setPassword.restore();
- });
- });
-
- describe('#setPassword()', function () {
- var form = Em.Object.create({
- getField: function (property) {
- return this.get(property);
- },
- new_password: Em.Object.create({
- value: 'pass'
- }),
- old_password: Em.Object.create({
- value: 'pass'
- })
- });
-
- it('new_password value is empty', function () {
- var Users = {};
- form.set('new_password.value', "");
-
- expect(view.setPassword(Users, form)).to.be.false;
- expect(Users.password).to.be.undefined;
- expect(Users.old_password).to.be.undefined;
- });
- it('old_password value is empty', function () {
- var Users = {};
- form.set('old_password.value', "");
-
- expect(view.setPassword(Users, form)).to.be.false;
- expect(Users.password).to.be.undefined;
- expect(Users.old_password).to.be.undefined;
- });
- it('old_password and new_password values are correct', function () {
- var Users = {};
- form.set('old_password.value', "old_pass");
- form.set('new_password.value', "pass");
-
- expect(view.setPassword(Users, form)).to.be.true;
- expect(Users.password).to.equal('pass');
- expect(Users.old_password).to.equal('old_pass');
- });
- });
-
- describe('#editUserSuccessCallback()', function () {
- it('', function () {
- var params = {
- form: {
- save: Em.K
- }
- };
- sinon.spy(params.form, 'save');
- sinon.stub(App.router, 'transitionTo', Em.K);
-
- view.editUserSuccessCallback({}, {}, params);
- expect(params.form.save.calledOnce).to.be.true;
- expect(App.router.transitionTo.calledWith('allUsers')).to.be.true;
-
- App.router.transitionTo.restore();
- });
- });
-
- describe('#editUserErrorCallback()', function () {
- it('show popup', function () {
- sinon.stub(App.ModalPopup, 'show', Em.K);
- sinon.stub(view, 'parseErrorMessage', Em.K);
-
- view.editUserErrorCallback({});
- expect(App.ModalPopup.show.calledOnce).to.be.true;
-
- App.ModalPopup.show.restore();
- view.parseErrorMessage.restore();
- });
- });
-
- describe('#parseErrorMessage()', function () {
- it('":" is not present in response', function () {
- var request = {
- responseText: JSON.stringify({
- message: 'content'
- })
- };
-
- expect(view.parseErrorMessage(request)).to.equal('content');
- });
- it('one ":" is present in response', function () {
- var request = {
- responseText: JSON.stringify({
- message: 'content : b'
- })
- };
-
- expect(view.parseErrorMessage(request)).to.equal(' b');
- });
- it('several ":" are present in response', function () {
- var request = {
- responseText: JSON.stringify({
- message: 'content : b: a'
- })
- };
-
- expect(view.parseErrorMessage(request)).to.equal(' a');
- });
- });
-
- describe('#keyPress()', function () {
-
- beforeEach(function () {
- sinon.stub(view, 'edit', Em.K);
- });
- afterEach(function () {
- view.edit.restore();
- });
-
- it('not "Enter" button pressed', function () {
- expect(view.keyPress({keyCode: 99})).to.be.true;
- expect(view.edit.called).to.be.false;
- });
- it('"Enter" button pressed', function () {
- expect(view.keyPress({keyCode: 13})).to.be.false;
- expect(view.edit.calledOnce).to.be.true;
- });
- });
-
- describe('#didInsertElement()', function () {
-
- beforeEach(function () {
- sinon.stub(view.get('userForm'), 'propertyDidChange', Em.K);
- });
- afterEach(function () {
- view.get('userForm').propertyDidChange.restore();
- });
- view.set('userForm.old_password', Em.Object.create());
- view.set('userForm.new_password', Em.Object.create());
- view.set('userForm.new_passwordRetype', Em.Object.create());
-
- it('isLdap value is true', function () {
- view.set('userForm.isLdap', Em.Object.create({
- value: true
- }));
-
- view.didInsertElement();
- expect(view.get('userForm').propertyDidChange.calledWith('object')).to.be.true;
- expect(view.get('userForm.old_password.disabled')).to.be.true;
- expect(view.get('userForm.new_password.disabled')).to.be.true;
- expect(view.get('userForm.new_passwordRetype.disabled')).to.be.true;
- });
- it('isLdap value is false', function () {
- view.set('userForm.isLdap', Em.Object.create({
- value: false
- }));
-
- view.didInsertElement();
- expect(view.get('userForm').propertyDidChange.calledWith('object')).to.be.true;
- expect(view.get('userForm.old_password.disabled')).to.be.false;
- expect(view.get('userForm.new_password.disabled')).to.be.false;
- expect(view.get('userForm.new_passwordRetype.disabled')).to.be.false;
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/views/main/jobs/hive_job_details_tez_dag_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/jobs/hive_job_details_tez_dag_view_test.js b/ambari-web/test/views/main/jobs/hive_job_details_tez_dag_view_test.js
deleted file mode 100644
index cc40a07..0000000
--- a/ambari-web/test/views/main/jobs/hive_job_details_tez_dag_view_test.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-require('views/main/jobs/hive_job_details_tez_dag_view');
-
-describe('App.MainHiveJobDetailsTezDagView', function() {
- var tezDagView = App.MainHiveJobDetailsTezDagView.create();
-
- describe('#getNodeCalculatedDimensions()', function() {
- var tests = Em.A([
- {
- i: {
- node: {
- operations: [],
- duration: 100
- },
- minDuration: 1
- },
- e: {
- width : 180,
- height : 40,
- drawWidth : 180,
- drawHeight : 40,
- scale : 1
- },
- m: 'Node(ops=0,duration=100) minDuration=1'
- },
- {
- i: {
- node: {
- operations: [1,2,3,4,5],
- duration: 4
- },
- minDuration: 1
- },
- e: {
- width : 180,
- height : 80,
- drawWidth : 180,
- drawHeight : 40+40,
- scale : 1
- },
- m: 'Node(ops=5,duration=4) minDuration=1'
- },
- {
- i: {
- node: {
- operations: [1],
- duration: 1
- },
- minDuration: 1
- },
- e: {
- width : 180,
- height : 60,
- drawWidth : 180,
- drawHeight : 60,
- scale : 1
- },
- m: 'Node(ops=1,duration=1) minDuration=1'
- },
- { // Error case
- i: {
- node: {
- operations: [1],
- duration: 1
- },
- minDuration: 3
- },
- e: {
- width : 180,
- height : 60,
- drawWidth : 180,
- drawHeight : 60,
- scale : 1
- },
- m: 'Node(ops=1,duration=1) minDuration=3'
- }
- ]);
- tests.forEach(function(test) {
- it(test.m, function() {
- var nodeDim = tezDagView.getNodeCalculatedDimensions(test.i.node, test.i.minDuration);
- Em.keys(test.e).forEach(function(key) {
- expect(nodeDim[key]).to.equal(test.e[key]);
- });
- });
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/884016f8/ambari-web/test/views/main/jobs/hive_job_details_tez_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/jobs/hive_job_details_tez_test.js b/ambari-web/test/views/main/jobs/hive_job_details_tez_test.js
deleted file mode 100644
index 8e502ef..0000000
--- a/ambari-web/test/views/main/jobs/hive_job_details_tez_test.js
+++ /dev/null
@@ -1,229 +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');
-module.exports = {
- _createVertex : function(row, col, state, type, numOps, inEdges, outEdges, vertexJsons) {
- var v = {
- id : 'v_' + row + '_' + col,
- instance_id : 'vi_' + row + '_' + col,
- name : 'Vertex ' + row + ', ' + col,
- state : state,
- type : type,
- operations : [],
- outgoing_edges : outEdges,
- incoming_edges : inEdges
- };
- for ( var c = 0; c < numOps; c++) {
- v.operations.push("Op " + c);
- }
- vertexJsons.push(v);
- return v;
- },
-
- _createEdge : function(id, type, from, to, edgeJsons) {
- var e = {
- id : id,
- instance_id : 'i_' + id,
- from_vertex_id : from.id,
- to_vertex_id : to.id,
- edge_type : type
- }
- edgeJsons.push(e);
- return e;
- },
-
- /**
- * Creates a Tez DAG for test purposes with 6 nodes in row 1, 1 node in row 2
- * and 5 nodes in row 3.
- *
- * Usage: <code>
- * var testDag = jobUtils.createTezDag_6x1x5();
- * vertices = testDag.get('vertices');
- * edges = testDag.get('edges');
- * </code>
- */
- createTezDag_6x1x5 : function() {
- var vertices = [];
- var dagJson = {
- id : 'dag1',
- instance_id : 'dag1',
- name : 'Test DAG 1',
- stage : 'My stage',
- vertices : [],
- edges : []
- };
- var vertexJsons = [];
- var edgeJsons = [];
- // Row 1
- var v1 = this._createVertex(1, 1, "FAILED", App.TezDagVertexType.MAP, 30, [], [ 'e1' ], vertexJsons);
- var v2 = this._createVertex(1, 2, "RUNNING", App.TezDagVertexType.REDUCE, 2, [], [ 'e2' ], vertexJsons);
- var v3 = this._createVertex(1, 3, "FAILED", App.TezDagVertexType.MAP, 5, [], [ 'e3' ], vertexJsons);
- var v4 = this._createVertex(1, 4, "FAILED", App.TezDagVertexType.REDUCE, 10, [], [ 'e4' ], vertexJsons);
- var v5 = this._createVertex(1, 5, "FAILED", App.TezDagVertexType.MAP, 15, [], [ 'e5' ], vertexJsons);
- var v6 = this._createVertex(1, 6, "FAILED", App.TezDagVertexType.REDUCE, 20, [], [ 'e6' ], vertexJsons);
- // Row 2
- var v7 = this._createVertex(2, 1, "SUCCEEDED", App.TezDagVertexType.UNION, 30, [ 'e1', 'e2', 'e3', 'e4', 'e5', 'e6' ], [ 'e7', 'e8', 'e9', 'e10', 'e11' ], vertexJsons);
- // Row 3
- var v8 = this._createVertex(3, 1, "FAILED", App.TezDagVertexType.REDUCE, 30, [ 'e7' ], [], vertexJsons);
- var v9 = this._createVertex(3, 2, "RUNNING", App.TezDagVertexType.MAP, 2, [ 'e8' ], [], vertexJsons);
- var v10 = this._createVertex(3, 3, "FAILED", App.TezDagVertexType.REDUCE, 5, [ 'e9' ], [], vertexJsons);
- var v11 = this._createVertex(3, 4, "FAILED", App.TezDagVertexType.MAP, 10, [ 'e10' ], [], vertexJsons);
- var v12 = this._createVertex(3, 5, "FAILED", App.TezDagVertexType.REDUCE, 15, [ 'e11' ], [], vertexJsons);
- // Edges 1-2
- this._createEdge('e1', 'BROADCAST', v1, v7, edgeJsons);
- this._createEdge('e2', 'BROADCAST', v2, v7, edgeJsons);
- this._createEdge('e3', 'BROADCAST', v3, v7, edgeJsons);
- this._createEdge('e4', 'SCATTER_GATHER', v4, v7, edgeJsons);
- this._createEdge('e5', 'SCATTER_GATHER', v5, v7, edgeJsons);
- this._createEdge('e6', 'SCATTER_GATHER', v6, v7, edgeJsons);
- // Edges 2-3
- this._createEdge('e7', 'SCATTER_GATHER', v7, v8, edgeJsons);
- this._createEdge('e8', 'SCATTER_GATHER', v7, v9, edgeJsons);
- this._createEdge('e9', 'SCATTER_GATHER', v7, v10, edgeJsons);
- this._createEdge('e10', 'BROADCAST', v7, v11, edgeJsons);
- this._createEdge('e11', 'BROADCAST', v7, v12, edgeJsons);
- vertexJsons.forEach(function(v) {
- dagJson.vertices.push(v.id);
- })
- edgeJsons.forEach(function(e) {
- dagJson.edges.push(e.id);
- })
- App.store.load(App.TezDag, dagJson);
- App.store.loadMany(App.TezDagVertex, vertexJsons);
- App.store.loadMany(App.TezDagEdge, edgeJsons);
- return App.TezDag.find('dag1');
- },
-
- /**
- * Creates a Tez DAG for test purposes with 6 nodes in row 1, 1 node in row 2
- * and 5 nodes in row 3.
- *
- * Usage: <code>
- * var testDag = jobUtils.createTezDag_7x1_1x1();
- * vertices = testDag.get('vertices');
- * edges = testDag.get('edges');
- * </code>
- */
- createTezDag_7x1_1x1 : function() {
- var vertices = [];
- var dagJson = {
- id : 'dag1',
- instance_id : 'dag1',
- name : 'Test DAG 1',
- stage : 'My stage',
- vertices : [],
- edges : []
- };
- var vertexJsons = [];
- var edgeJsons = [];
- // Row 1
- var v1 = this._createVertex(1, 1, "FAILED", App.TezDagVertexType.REDUCE, 30, [], [ 'e1' ], vertexJsons);
- var v4 = this._createVertex(1, 4, "FAILED", App.TezDagVertexType.MAP, 10, [], [ 'e4' ], vertexJsons);
- var v6 = this._createVertex(1, 6, "FAILED", App.TezDagVertexType.REDUCE, 20, [], [ 'e6' ], vertexJsons);
- var v2 = this._createVertex(1, 2, "RUNNING", App.TezDagVertexType.MAP, 2, [], [ 'e2' ], vertexJsons);
- var v3 = this._createVertex(1, 3, "FAILED", App.TezDagVertexType.REDUCE, 5, [], [ 'e3' ], vertexJsons);
- var v5 = this._createVertex(1, 5, "FAILED", App.TezDagVertexType.MAP, 15, [], [ 'e5' ], vertexJsons);
- var v7 = this._createVertex(1, 7, "FAILED", App.TezDagVertexType.REDUCE, 4, [], [ 'e7' ], vertexJsons);
- // Row 2
- var v8 = this._createVertex(2, 1, "SUCCEEDED", App.TezDagVertexType.MAP, 30, [ 'e1', 'e2', 'e3', 'e4' ], [ 'e8' ], vertexJsons);
- var v9 = this._createVertex(2, 2, "FAILED", App.TezDagVertexType.REDUCE, 30, [ 'e5', 'e6', 'e7' ], ['e9'], vertexJsons);
- // Row 3
- var v10 = this._createVertex(3, 1, "RUNNING", App.TezDagVertexType.UNION, 2, [ 'e8', 'e9' ], [], vertexJsons);
- // Edges 1-2
- this._createEdge('e1', 'BROADCAST', v1, v8, edgeJsons);
- this._createEdge('e2', 'BROADCAST', v2, v8, edgeJsons);
- this._createEdge('e3', 'BROADCAST', v3, v8, edgeJsons);
- this._createEdge('e4', 'SCATTER_GATHER', v4, v8, edgeJsons);
- this._createEdge('e5', 'SCATTER_GATHER', v5, v9, edgeJsons);
- this._createEdge('e6', 'SCATTER_GATHER', v6, v9, edgeJsons);
- this._createEdge('e7', 'SCATTER_GATHER', v7, v9, edgeJsons);
- // Edges 2-3
- this._createEdge('e8', 'SCATTER_GATHER', v8, v10, edgeJsons);
- this._createEdge('e9', 'SCATTER_GATHER', v9, v10, edgeJsons);
- vertexJsons.forEach(function(v) {
- dagJson.vertices.push(v.id);
- })
- edgeJsons.forEach(function(e) {
- dagJson.edges.push(e.id);
- })
- App.store.load(App.TezDag, dagJson);
- App.store.loadMany(App.TezDagVertex, vertexJsons);
- App.store.loadMany(App.TezDagEdge, edgeJsons);
- return App.TezDag.find('dag1');
- },
-
- /**
- * Creates a Tez DAG for test purposes. Each row in the graph is fully
- * connected to the next row. The number of nodes in each row is passed as
- * input.
- *
- * Usage:
- * <code>
- * var testDag = jobUtils._test_createTezDag_fullyConnected([10,3,8]);
- * vertices = testDag.get('vertices');
- * edges = testDag.get('edges');
- * </code>
- */
- createTezDag_fullyConnected : function(rowCounts) {
- var vertices = [];
- var dagJson = {
- id : 'dag1',
- instance_id : 'dag1',
- name : 'Test DAG 1',
- stage : 'My stage',
- vertices : [],
- edges : []
- };
- var vertexJsons = [];
- var edgeJsons = [];
- var matrix = new Array(rowCounts.length);
- for ( var r = 0; r < rowCounts.length; r++) {
- matrix[r] = new Array(rowCounts[r]);
- for ( var c = 0; c < rowCounts[r]; c++) {
- var outs = [];
- var ins = [];
- if (r < rowCounts.length - 1) {
- for ( var c2 = 0; c2 < rowCounts[r + 1]; c2++) {
- outs.push('e_' + r + c + '_' + (r + 1) + c2);
- }
- }
- if (r > 0) {
- for ( var c2 = 0; c2 < rowCounts[r - 1]; c2++) {
- ins.push('e_' + (r - 1) + c2 + '_' + r + c);
- }
- }
- matrix[r][c] = this._createVertex(r, c, "RUNNING", true, (r + 1) * (c + 1), ins, outs, vertexJsons);
- if (r > 0) {
- for ( var c2 = 0; c2 < rowCounts[r - 1]; c2++) {
- this._createEdge('e_' + (r - 1) + c2 + '_' + r + c, 'BROADCAST', matrix[r - 1][c2], matrix[r][c], edgeJsons);
- }
- }
- }
- }
- vertexJsons.forEach(function(v) {
- dagJson.vertices.push(v.id);
- })
- edgeJsons.forEach(function(e) {
- dagJson.edges.push(e.id);
- })
- App.store.load(App.TezDag, dagJson);
- App.store.loadMany(App.TezDagVertex, vertexJsons);
- App.store.loadMany(App.TezDagEdge, edgeJsons);
- return App.TezDag.find('dag1');
- }
-}