Repository: tez Updated Branches: refs/heads/TEZ-2980 852247b3d -> 6f366403d
http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/counters-table-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/counters-table-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/counters-table-test.js new file mode 100644 index 0000000..e0e7b02 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/counters-table-test.js @@ -0,0 +1,91 @@ +/** + * 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. + */ + +import Ember from 'ember'; + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:counters-table', 'Unit | Controller | counters table', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K + }); + + assert.ok(controller); + assert.ok(controller.columns); + assert.ok(controller.counters); + assert.ok(controller._countersObserver); + +}); + +test('counters & _countersObserver test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K, + model: { + counterGroupsHash: { + "foo": { + "Foo Name 1": "Value 1", + "Foo Name 2": "Value 2", + "Foo Name 3": "Value 3" + }, + "bar": { + "Bar Name 1": "Value 1", + "Bar Name 2": "Value 2", + "Bar Name 3": "Value 3" + } + } + } + }); + + assert.equal(controller.countersCount, 0); + + controller._countersObserver(); + + assert.equal(controller.get("counters.0.groupName"), "foo"); + assert.equal(controller.get("counters.0.counterName"), "Foo Name 1"); + assert.equal(controller.get("counters.0.counterValue"), "Value 1"); + + assert.equal(controller.get("counters.1.groupName"), "foo"); + assert.equal(controller.get("counters.1.counterName"), "Foo Name 2"); + assert.equal(controller.get("counters.1.counterValue"), "Value 2"); + + assert.equal(controller.get("counters.2.groupName"), "foo"); + assert.equal(controller.get("counters.2.counterName"), "Foo Name 3"); + assert.equal(controller.get("counters.2.counterValue"), "Value 3"); + + + assert.equal(controller.get("counters.3.groupName"), "bar"); + assert.equal(controller.get("counters.3.counterName"), "Bar Name 1"); + assert.equal(controller.get("counters.3.counterValue"), "Value 1"); + + assert.equal(controller.get("counters.4.groupName"), "bar"); + assert.equal(controller.get("counters.4.counterName"), "Bar Name 2"); + assert.equal(controller.get("counters.4.counterValue"), "Value 2"); + + assert.equal(controller.get("counters.5.groupName"), "bar"); + assert.equal(controller.get("counters.5.counterName"), "Bar Name 3"); + assert.equal(controller.get("counters.5.counterValue"), "Value 3"); + + assert.equal(controller.countersCount, 6); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/dag/attempts-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/attempts-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/attempts-test.js index 3fa8ff7..f0aeeb9 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/attempts-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/attempts-test.js @@ -28,7 +28,10 @@ moduleFor('controller:dag/attempts', 'Unit | Controller | dag/attempts', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/dag/tasks-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/tasks-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/tasks-test.js index eace870..474c61a 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/tasks-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/tasks-test.js @@ -28,7 +28,10 @@ moduleFor('controller:dag/tasks', 'Unit | Controller | dag/tasks', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js index f54b1a8..d0b32f3 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js @@ -28,7 +28,10 @@ moduleFor('controller:dag/vertices', 'Unit | Controller | dag/vertices', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/multi-table-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/multi-table-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/multi-table-test.js new file mode 100644 index 0000000..d4ab10f --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/multi-table-test.js @@ -0,0 +1,40 @@ +/** + * 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. + */ + +import Ember from 'ember'; +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:multi-table', 'Unit | Controller | multi table', { + // Specify the other units that are required for this test. + // needs: ['service:local-storage'] +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K, + localStorage: Ember.Object.create(), + getCounterColumns: function () { + return []; + } + }); + + assert.ok(controller); + assert.ok(controller._visibleColumnsObserver); + assert.ok(controller.sendCountersChanged); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/parent-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/parent-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/parent-test.js new file mode 100644 index 0000000..2b0ff97 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/parent-test.js @@ -0,0 +1,36 @@ +/** + * 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. + */ + +import Ember from 'ember'; +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:parent', 'Unit | Controller | parent', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K + }); + + assert.ok(controller); + assert.ok(controller.polling); + assert.ok(controller.actions.autoRefreshChanged); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/table-page-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/table-page-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/table-page-test.js deleted file mode 100644 index 07941b9..0000000 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/table-page-test.js +++ /dev/null @@ -1,64 +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. - */ - -import Ember from 'ember'; - -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('controller:table-page', 'Unit | Controller | table page', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('Basic creation test', function(assert) { - let controller = this.subject({ - send: Ember.K, - initVisibleColumns: Ember.K - }); - - assert.ok(controller); - assert.ok(controller.queryParams); - - assert.equal(controller.rowCount, 10); - assert.equal(controller.searchText, ""); - assert.equal(controller.sortColumnId, ""); - assert.equal(controller.sortOrder, ""); - assert.equal(controller.pageNo, 1); - - assert.ok(controller.headerComponentNames); - assert.ok(controller.visibleColumnIDs); - assert.ok(controller.columnSelectorTitle); - assert.ok(controller.definition); - - assert.ok(controller.storageID); - assert.ok(controller.initVisibleColumns); - - assert.ok(controller.columns); - assert.ok(controller.allColumns); - assert.ok(controller.visibleColumns); - - assert.ok(controller.getCounterColumns); - - assert.ok(controller.actions.searchChanged); - assert.ok(controller.actions.sortChanged); - assert.ok(controller.actions.rowsChanged); - assert.ok(controller.actions.pageChanged); - - assert.ok(controller.actions.openColumnSelector); - assert.ok(controller.actions.columnsSelected); -}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/table-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/table-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/table-test.js new file mode 100644 index 0000000..360b6a9 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/table-test.js @@ -0,0 +1,64 @@ +/** + * 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. + */ + +import Ember from 'ember'; + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:table', 'Unit | Controller | table', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K + }); + + assert.ok(controller); + assert.ok(controller.queryParams); + + assert.equal(controller.rowCount, 10); + assert.equal(controller.searchText, ""); + assert.equal(controller.sortColumnId, ""); + assert.equal(controller.sortOrder, ""); + assert.equal(controller.pageNo, 1); + + assert.ok(controller.headerComponentNames); + assert.ok(controller.visibleColumnIDs); + assert.ok(controller.columnSelectorTitle); + assert.ok(controller.definition); + + assert.ok(controller.storageID); + assert.ok(controller.initVisibleColumns); + + assert.ok(controller.columns); + assert.ok(controller.allColumns); + assert.ok(controller.visibleColumns); + + assert.ok(controller.getCounterColumns); + + assert.ok(controller.actions.searchChanged); + assert.ok(controller.actions.sortChanged); + assert.ok(controller.actions.rowsChanged); + assert.ok(controller.actions.pageChanged); + + assert.ok(controller.actions.openColumnSelector); + assert.ok(controller.actions.columnsSelected); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/task/attempts-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/task/attempts-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/task/attempts-test.js index 43badfc..b2006de 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/task/attempts-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/task/attempts-test.js @@ -28,7 +28,10 @@ moduleFor('controller:task/attempts', 'Unit | Controller | task/attempts', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/attempts-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/attempts-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/attempts-test.js index de89864..eb68055 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/attempts-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/attempts-test.js @@ -28,7 +28,10 @@ moduleFor('controller:vertex/attempts', 'Unit | Controller | vertex/attempts', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/tasks-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/tasks-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/tasks-test.js index 23393ef..9aae299 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/tasks-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/vertex/tasks-test.js @@ -28,7 +28,10 @@ moduleFor('controller:vertex/tasks', 'Unit | Controller | vertex/tasks', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + } }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/entities/am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/am-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/am-test.js new file mode 100644 index 0000000..b48eea5 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/entities/am-test.js @@ -0,0 +1,33 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('entitie:am', 'Unit | Entity | am', { + // Specify the other units that are required for this test. + // needs: ['entitie:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.resetJoiner); + assert.ok(adapter.queryRecord); + assert.ok(adapter.queryJoinedRecords); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/entities/attempt-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/attempt-am-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/attempt-am-test.js new file mode 100644 index 0000000..2856ec5 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/entities/attempt-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('entitie:attempt-am', 'Unit | Entity | attempt am', { + // Specify the other units that are required for this test. + // needs: ['entitie:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.queryPropertyToJoin); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js index 2129fb3..fb0bd8a 100644 --- a/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js @@ -29,55 +29,26 @@ test('Basic creation test', function(assert) { let adapter = this.subject(); assert.ok(adapter); - assert.ok(adapter.loadRelations); - assert.ok(adapter.normalizeNeed); - assert.ok(adapter.loadNeeds); -}); - -test('loadRelations test', function(assert) { - let adapter = this.subject(), - testLoader = {}, - testModel = {}, - relationsPromise; - - assert.expect(2 + 1 + 2 + 2); - - // Test model without needs - adapter.loadNeeds = function (loader, model) { - assert.equal(loader, testLoader); - assert.equal(model, testModel); - - return null; - }; - relationsPromise = adapter.loadRelations(testLoader, testModel); - - assert.equal(relationsPromise, testModel, "Model without needs"); - - // Test model with needs - adapter.loadNeeds = function (loader, model) { - assert.equal(loader, testLoader); - assert.equal(model, testModel); - return Ember.RSVP.resolve(); - }; - relationsPromise = adapter.loadRelations(testLoader, testModel); + assert.ok(adapter.queryRecord); + assert.ok(adapter.query); - assert.notEqual(relationsPromise, testModel); - relationsPromise.then(function (model) { - assert.equal(model, testModel); - }); + assert.ok(adapter.normalizeNeed); + assert.ok(adapter._loadNeed); + assert.ok(adapter.loadNeed); + assert.ok(adapter._loadAllNeeds); + assert.ok(adapter.loadAllNeeds); }); test('normalizeNeed test', function(assert) { let adapter = this.subject(), - expectedProperties = ["name", "type", "idKey", "lazy", "silent"]; + expectedProperties = ["name", "type", "idKey", "silent"]; assert.deepEqual(adapter.normalizeNeed("app", "appKey").getProperties(expectedProperties), { name: "app", type: "app", idKey: "appKey", - lazy: false, silent: false }, "Test 1"); @@ -85,7 +56,6 @@ test('normalizeNeed test', function(assert) { name: "app", type: "app", idKey: "appKey", - lazy: false, silent: false }, "Test 2"); @@ -93,28 +63,18 @@ test('normalizeNeed test', function(assert) { name: "app", type: "application", idKey: "appKey", - lazy: false, silent: false }, "Test 3"); - assert.deepEqual(adapter.normalizeNeed( "app", { lazy: true, idKey: "appKey" }).getProperties(expectedProperties), { - name: "app", - type: "app", - idKey: "appKey", - lazy: true, - silent: false - }, "Test 4"); - assert.deepEqual(adapter.normalizeNeed( "app", { silent: true, idKey: "appKey" }).getProperties(expectedProperties), { name: "app", type: "app", idKey: "appKey", - lazy: false, silent: true - }, "Test 5"); + }, "Test 4"); }); -test('loadNeeds basic test', function(assert) { +test('loadAllNeeds basic test', function(assert) { let adapter = this.subject(), loader, testModel = Ember.Object.create({ @@ -128,7 +88,7 @@ test('loadNeeds basic test', function(assert) { assert.expect(1 + 2 + 1); - assert.equal(adapter.loadNeeds(loader, Ember.Object.create()), undefined, "Model without needs"); + assert.equal(adapter.loadAllNeeds(loader, Ember.Object.create()), undefined, "Model without needs"); loader = { queryRecord: function (type, id) { @@ -146,12 +106,12 @@ test('loadNeeds basic test', function(assert) { return Ember.RSVP.resolve(); } }; - adapter.loadNeeds(loader, testModel).then(function () { + adapter.loadAllNeeds(loader, testModel).then(function () { assert.ok(true); }); }); -test('loadNeeds silent=false test', function(assert) { +test('loadAllNeeds silent=false test', function(assert) { let adapter = this.subject(), loader, testModel = Ember.Object.create({ @@ -173,12 +133,12 @@ test('loadNeeds silent=false test', function(assert) { return Ember.RSVP.reject(testErr); } }; - adapter.loadNeeds(loader, testModel).catch(function (err) { + adapter.loadAllNeeds(loader, testModel).catch(function (err) { assert.equal(err, testErr); }); }); -test('loadNeeds silent=true test', function(assert) { +test('loadAllNeeds silent=true test', function(assert) { let adapter = this.subject(), loader, testModel = Ember.Object.create({ @@ -199,31 +159,8 @@ test('loadNeeds silent=true test', function(assert) { return Ember.RSVP.resolve(); } }; - adapter.loadNeeds(loader, testModel).then(function (val) { + adapter.loadAllNeeds(loader, testModel).then(function (val) { assert.ok(val); }); }); -test('loadNeeds lazy=true test', function(assert) { - let adapter = this.subject(), - loader, - testModel = Ember.Object.create({ - needs: { - app: { - idKey: "appID", - lazy: true - }, - }, - appID: 1, - }); - - assert.expect(1 + 1); - - loader = { - queryRecord: function (type, id) { - assert.equal(id, testModel.get("appID")); - return Ember.RSVP.resolve(); - } - }; - assert.equal(adapter.loadNeeds(loader, testModel), undefined, "Model without needs"); -}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/entities/task-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/task-am-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/task-am-test.js new file mode 100644 index 0000000..7caca54 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/entities/task-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('entitie:task-am', 'Unit | Entity | task am', { + // Specify the other units that are required for this test. + // needs: ['entitie:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.queryPropertyToJoin); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/entities/vertex-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/vertex-am-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/vertex-am-test.js new file mode 100644 index 0000000..19937f3 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/entities/vertex-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('entitie:vertex-am', 'Unit | Entity | vertex am', { + // Specify the other units that are required for this test. + // needs: ['entitie:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.queryPropertyToJoin); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/mixins/auto-counter-column-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/mixins/auto-counter-column-test.js b/tez-ui2/src/main/webapp/tests/unit/mixins/auto-counter-column-test.js index 191eb67..88e2e09 100644 --- a/tez-ui2/src/main/webapp/tests/unit/mixins/auto-counter-column-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/mixins/auto-counter-column-test.js @@ -39,26 +39,40 @@ test('getCounterColumns test', function(assert) { let AutoCounterColumnObject = TestParent.extend(AutoCounterColumnMixin); let subject = AutoCounterColumnObject.create({ model: [{ - counterGroups: [{ - counterGroupName: "gp1", - counters: [{counterName: "c11"}, {counterName: "c12"}] - }] + counterGroupsHash: { + gp1: { + c11: "v11", + c12: "v12" + } + } }, { - counterGroups: [{ - counterGroupName: "gp2", - counters: [{counterName: "c21"}, {counterName: "c22"}] - }] + counterGroupsHash: { + gp2: { + c21: "v21", + c22: "v22" + }, + gp3: { + c31: "v31", + c32: "v32" + } + } }] }); let columns = subject.getCounterColumns(); - assert.equal(columns.length, 4); + assert.equal(columns.length, 6); assert.equal(columns[0].counterGroupName, "gp1"); assert.equal(columns[0].counterName, "c11"); assert.equal(columns[1].counterGroupName, "gp1"); assert.equal(columns[1].counterName, "c12"); + assert.equal(columns[2].counterGroupName, "gp2"); assert.equal(columns[2].counterName, "c21"); assert.equal(columns[3].counterGroupName, "gp2"); assert.equal(columns[3].counterName, "c22"); + + assert.equal(columns[4].counterGroupName, "gp3"); + assert.equal(columns[4].counterName, "c31"); + assert.equal(columns[5].counterGroupName, "gp3"); + assert.equal(columns[5].counterName, "c32"); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/abstract-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/abstract-test.js b/tez-ui2/src/main/webapp/tests/unit/models/abstract-test.js index cec99a2..bd6f141 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/abstract-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/abstract-test.js @@ -34,6 +34,11 @@ test('Basic test for existence', function(assert) { assert.ok(model._notifyProperties); assert.ok(model.didLoad); + + assert.ok(model.entityID); + assert.ok(model.index); + assert.ok(model.status); + assert.ok(model.isComplete); }); test('_notifyProperties test - will fail if _notifyProperties implementation is changed in ember-data', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/ahs-app-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/ahs-app-test.js b/tez-ui2/src/main/webapp/tests/unit/models/ahs-app-test.js index 04b472a..5fd9c60 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/ahs-app-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/ahs-app-test.js @@ -25,5 +25,7 @@ moduleForModel('ahs-app', 'Unit | Model | ahs app', { test('Basic creation test', function(assert) { let model = this.subject(); + assert.ok(!!model); + assert.ok(!!model.duration); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/am-test.js b/tez-ui2/src/main/webapp/tests/unit/models/am-test.js new file mode 100644 index 0000000..75317bc --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('am', 'Unit | Model | am', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/am-timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/am-timeline-test.js b/tez-ui2/src/main/webapp/tests/unit/models/am-timeline-test.js new file mode 100644 index 0000000..3ed9efb --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/am-timeline-test.js @@ -0,0 +1,34 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('am-timeline', 'Unit | Model | am timeline', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + + assert.ok(!!model); + assert.ok(!!model.status); + assert.ok(!!model.progress); + assert.ok(!!model.counterGroupsHash); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/app-rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/app-rm-test.js b/tez-ui2/src/main/webapp/tests/unit/models/app-rm-test.js new file mode 100644 index 0000000..8a4a630 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/app-rm-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('app-rm', 'Unit | Model | app rm', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/attempt-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/attempt-am-test.js b/tez-ui2/src/main/webapp/tests/unit/models/attempt-am-test.js new file mode 100644 index 0000000..0e7f2d0 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/attempt-am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('attempt-am', 'Unit | Model | attempt am', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js b/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js index 7d0a78e..c470012 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js @@ -27,9 +27,22 @@ test('Basic creation test', function(assert) { let model = this.subject(); assert.ok(model); - assert.ok(model.index); + + assert.ok(model.needs.dag); + assert.ok(model.needs.am); + + assert.ok(model.taskID); assert.ok(model.taskIndex); + + assert.ok(model.vertexID); + assert.ok(model.vertexIndex); assert.ok(model.vertexName); + + assert.ok(model.dagID); + assert.ok(model.dag); + + assert.ok(model.containerID); + assert.ok(model.nodeID); }); test('index test', function(assert) { @@ -45,7 +58,7 @@ test('taskIndex test', function(assert) { taskID: "1_2_3", }); - assert.equal(model.get("taskIndex"), "2_3"); + assert.equal(model.get("taskIndex"), "3"); }); test('vertexName test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/dag-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/dag-am-test.js b/tez-ui2/src/main/webapp/tests/unit/models/dag-am-test.js new file mode 100644 index 0000000..58ac45a --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/dag-am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('dag-am', 'Unit | Model | dag am', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/dag-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/dag-test.js b/tez-ui2/src/main/webapp/tests/unit/models/dag-test.js index 9b04398..513af7d 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/dag-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/dag-test.js @@ -34,6 +34,7 @@ test('Basic creation test', function(assert) { }); assert.ok(!!model); + assert.ok(!!model.needs.am); assert.equal(model.get("queue"), testQueue); }); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/rm-test.js b/tez-ui2/src/main/webapp/tests/unit/models/rm-test.js new file mode 100644 index 0000000..39ea4b1 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/rm-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('rm', 'Unit | Model | rm', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/task-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/task-am-test.js b/tez-ui2/src/main/webapp/tests/unit/models/task-am-test.js new file mode 100644 index 0000000..fac3a5a --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/task-am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('task-am', 'Unit | Model | task am', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/task-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/task-test.js b/tez-ui2/src/main/webapp/tests/unit/models/task-test.js index 3d59df6..076b4eb 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/task-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/task-test.js @@ -27,9 +27,15 @@ test('Basic creation test', function(assert) { let model = this.subject(); assert.ok(model); - assert.ok(model.needs); - assert.ok(model.index); + assert.ok(model.needs.dag); + assert.ok(model.needs.am); + + assert.ok(model.vertexID); + assert.ok(model.vertexIndex); assert.ok(model.vertexName); + + assert.ok(model.dagID); + assert.ok(model.dag); }); test('index test', function(assert) { @@ -37,7 +43,7 @@ test('index test', function(assert) { entityID: "1_2_3", }); - assert.equal(model.get("index"), "2_3"); + assert.equal(model.get("index"), "3"); }); test('vertexName test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/timeline-test.js b/tez-ui2/src/main/webapp/tests/unit/models/timeline-test.js index fc52feb..c47054e 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/timeline-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/timeline-test.js @@ -43,8 +43,8 @@ test('Basic creation test', function(assert) { assert.ok(model.endTime); assert.ok(model.duration); - assert.ok(model.counterGroups); - assert.ok(model.counterHash); + assert.ok(model._counterGroups); + assert.ok(model.counterGroupsHash); }); test('appID test', function(assert) { @@ -92,7 +92,7 @@ test('duration test', function(assert) { }); }); -test('counterHash test', function(assert) { +test('counterGroupsHash test', function(assert) { let model = this.subject(), testCounterGroup = [{ counterGroupName: "group_1", @@ -115,10 +115,10 @@ test('counterHash test', function(assert) { }]; Ember.run(function () { - model.set("counterGroups", testCounterGroup); - assert.equal(model.get("counterHash.group_1.counter_1_1"), "value_1_1"); - assert.equal(model.get("counterHash.group_1.counter_1_2"), "value_1_2"); - assert.equal(model.get("counterHash.group_2.counter_2_1"), "value_2_1"); - assert.equal(model.get("counterHash.group_2.counter_2_2"), "value_2_2"); + model.set("_counterGroups", testCounterGroup); + assert.equal(model.get("counterGroupsHash.group_1.counter_1_1"), "value_1_1"); + assert.equal(model.get("counterGroupsHash.group_1.counter_1_2"), "value_1_2"); + assert.equal(model.get("counterGroupsHash.group_2.counter_2_1"), "value_2_1"); + assert.equal(model.get("counterGroupsHash.group_2.counter_2_2"), "value_2_2"); }); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/vertex-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/vertex-am-test.js b/tez-ui2/src/main/webapp/tests/unit/models/vertex-am-test.js new file mode 100644 index 0000000..1a5bc66 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/models/vertex-am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('vertex-am', 'Unit | Model | vertex am', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/models/vertex-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/vertex-test.js b/tez-ui2/src/main/webapp/tests/unit/models/vertex-test.js index bea4317..c0d2047 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/vertex-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/vertex-test.js @@ -16,6 +16,8 @@ * limitations under the License. */ +import Ember from 'ember'; + import { moduleForModel, test } from 'ember-qunit'; moduleForModel('vertex', 'Unit | Model | vertex', { @@ -27,6 +29,10 @@ test('Basic creation test', function(assert) { let model = this.subject(); assert.ok(model); + + assert.ok(model.needs.dag); + assert.ok(model.needs.am); + assert.ok(model.runningTasks); assert.ok(model.pendingTasks); }); @@ -34,15 +40,19 @@ test('Basic creation test', function(assert) { test('runningTasks test', function(assert) { let model = this.subject(); - assert.equal(model.get("runningTasks"), null); - model.set("status", "SUCCEEDED"); - assert.equal(model.get("runningTasks"), 0); + Ember.run(function () { + assert.equal(model.get("runningTasks"), null); + model.set("status", "SUCCEEDED"); + assert.equal(model.get("runningTasks"), 0); + }); }); test('pendingTasks test', function(assert) { let model = this.subject(); - assert.equal(model.get("pendingTasks"), null); - model.set("status", "SUCCEEDED"); - assert.equal(model.get("pendingTasks"), 0); + Ember.run(function () { + assert.equal(model.get("pendingTasks"), null); + model.set("status", "SUCCEEDED"); + assert.equal(model.get("pendingTasks"), 0); + }); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js new file mode 100644 index 0000000..a5383ab --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js @@ -0,0 +1,34 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:am-pollster', 'Unit | Route | am pollster', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let route = this.subject(); + + assert.ok(route); + assert.ok(route.onRecordPoll); + assert.ok(route.onPollFailure); + assert.ok(route.reload); + assert.ok(route.actions.countersToPollChanged); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/routes/multi-am-pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/multi-am-pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/multi-am-pollster-test.js new file mode 100644 index 0000000..eb3670b --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/routes/multi-am-pollster-test.js @@ -0,0 +1,32 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:multi-am-pollster', 'Unit | Route | multi am pollster', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let route = this.subject(); + + assert.ok(route); + assert.ok(route.canPoll); + assert.ok(route.actions.setPollingRecords); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/routes/pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/pollster-test.js new file mode 100644 index 0000000..79a5a99 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/routes/pollster-test.js @@ -0,0 +1,39 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:pollster', 'Unit | Route | pollster', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let route = this.subject(); + + assert.ok(route); + + assert.ok(route.onRecordPoll); + assert.ok(route.onPollSuccess); + assert.ok(route.onPollFailure); + + assert.ok(route.pollData); + assert.ok(route.canPoll); + assert.ok(route._canPollInit); + assert.ok(route._canPollObserver); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/routes/single-am-pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/single-am-pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/single-am-pollster-test.js new file mode 100644 index 0000000..69c9457 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/routes/single-am-pollster-test.js @@ -0,0 +1,32 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:single-am-pollster', 'Unit | Route | single am pollster', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let route = this.subject(); + + assert.ok(route); + assert.ok(route.canPoll); + assert.ok(route._loadedValueObserver); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/routes/vertex/tasks-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/vertex/tasks-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/vertex/tasks-test.js index 432b619..ee983d8 100644 --- a/tez-ui2/src/main/webapp/tests/unit/routes/vertex/tasks-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/routes/vertex/tasks-test.js @@ -16,6 +16,8 @@ * limitations under the License. */ +import Ember from 'ember'; + import { moduleFor, test } from 'ember-qunit'; moduleFor('route:vertex/tasks', 'Unit | Route | vertex/tasks', { @@ -24,7 +26,10 @@ moduleFor('route:vertex/tasks', 'Unit | Route | vertex/tasks', { }); test('Basic creation test', function(assert) { - let route = this.subject(); + let route = this.subject({ + initVisibleColumns: Ember.K, + getCounterColumns: Ember.K + }); assert.ok(route); assert.ok(route.title); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/am-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/am-test.js new file mode 100644 index 0000000..d9476ad --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:am', 'Unit | Serializer | am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/app-rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/app-rm-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/app-rm-test.js new file mode 100644 index 0000000..01051cf --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/app-rm-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:app-rm', 'Unit | Serializer | app rm', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-am-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-am-test.js new file mode 100644 index 0000000..6fd9e57 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:attempt-am', 'Unit | Serializer | attempt am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.payloadNamespace); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/dag-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/dag-am-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/dag-am-test.js new file mode 100644 index 0000000..be68f98 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/dag-am-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:dag-am', 'Unit | Serializer | dag am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/rm-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/rm-test.js new file mode 100644 index 0000000..7175d1a --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/rm-test.js @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:rm', 'Unit | Serializer | rm', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/task-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/task-am-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/task-am-test.js new file mode 100644 index 0000000..cdd1b04 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/task-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:task-am', 'Unit | Serializer | task am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.payloadNamespace); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/serializers/vertex-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/vertex-am-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/vertex-am-test.js new file mode 100644 index 0000000..254ca9f --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/vertex-am-test.js @@ -0,0 +1,31 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:vertex-am', 'Unit | Serializer | vertex am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.payloadNamespace); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js b/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js index 7000188..dbf8faa 100644 --- a/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js @@ -142,30 +142,32 @@ test('entityFor test', function(assert) { } if(name === "entity") { assert.equal(type, "entitie"); - return { - actualName: "entity" - }; + return Ember.Object.create({ + actualName: "entity", + name: name + }); } }; entity = service.entityFor(testName); assert.equal(entity.actualName, "entity", "Default lookups succeeded"); - assert.equal(entity.name, testName, "Default lookups succeeded"); + assert.equal(entity.get("name"), testName, "Default lookups succeeded"); // Primary lookups succeeded service.lookup = function (type, name) { if(name === testName) { assert.equal(type, "entitie"); - return { - actualName: name - }; + return Ember.Object.create({ + actualName: name, + name: name + }); } if(name === "entity") { assert.equal(type, "entitie"); // Shouldn't be called } }; entity = service.entityFor(testName); - assert.equal(entity.name, testName, "Default lookups succeeded"); - assert.equal(entity.name, testName, "Default lookups succeeded"); + assert.equal(entity.get("name"), testName, "Default lookups succeeded"); + assert.equal(entity.get("name"), testName, "Default lookups succeeded"); }); test('getCacheKey test', function(assert) { @@ -180,7 +182,7 @@ test('getCacheKey test', function(assert) { test('queryRecord test', function(assert) { let service = this.subject(), testNameSpace = "ns", - testOptions = {}, + testOptions = {opt: 1}, testQueryParams = {}, testUrlParams = {}, testType = "type", @@ -188,7 +190,7 @@ test('queryRecord test', function(assert) { testID = 1, cacheKey = service.getCacheKey(testType, testQueryParams, testID); - assert.expect(1 + 4 + 5 + 3); + assert.expect(1 + 5 + 3); service.nameSpace = testNameSpace; service.checkRequisite = Ember.K; @@ -196,26 +198,17 @@ test('queryRecord test', function(assert) { assert.equal(type, testType); return { - loadRelations: function (thisService, record, options, urlParams) { - assert.equal(thisService, service); - assert.equal(record, testRecord); - assert.equal(options, testOptions); - assert.equal(urlParams, testUrlParams); - - return record; + queryRecord: function (loader, id, options, query, urlParams) { + assert.equal(loader, service, "Loader"); + assert.equal(id, testID, "id"); + assert.equal(options.opt, testOptions.opt, "options"); + assert.equal(query, testQueryParams, "query"); + assert.equal(urlParams, testUrlParams, "urlParams"); + + return Ember.RSVP.resolve(testRecord); } }; }; - service.get("store").queryRecord = function (type, query) { - assert.equal(type, testType); - - assert.equal(query.id, testID); - assert.equal(query.nameSpace, testNameSpace); - assert.equal(query.params, testQueryParams); - assert.equal(query.urlParams, testUrlParams); - - return Ember.RSVP.resolve(testRecord); - }; service.cache = Ember.Object.create(); assert.notOk(service.get("cache").get(cacheKey)); @@ -228,7 +221,7 @@ test('queryRecord test', function(assert) { test('query test', function(assert) { let service = this.subject(), testNameSpace = "ns", - testOptions = {}, + testOptions = {opt: 1}, testQueryParams = {}, testUrlParams = {}, testType = "type", @@ -236,7 +229,7 @@ test('query test', function(assert) { testRecords = [testRecord, testRecord], cacheKey = service.getCacheKey(testType, testQueryParams); - assert.expect(1 + (4 + 4) + 4 + 3); + assert.expect(1 + 4 + 3); service.nameSpace = testNameSpace; service.checkRequisite = Ember.K; @@ -244,25 +237,16 @@ test('query test', function(assert) { assert.equal(type, testType); return { - loadRelations: function (thisService, record, options, urlParams) { - assert.equal(thisService, service); - assert.equal(record, testRecord); - assert.equal(options, testOptions); - assert.equal(urlParams, testUrlParams); + query: function (loader, query, options, urlParams) { + assert.equal(loader, service, "Loader"); + assert.equal(options.opt, testOptions.opt, "options"); + assert.equal(query, testQueryParams, "query"); + assert.equal(urlParams, testUrlParams, "urlParams"); - return record; + return Ember.RSVP.resolve(testRecords); } }; }; - service.get("store").query = function (type, query) { - assert.equal(type, testType); - - assert.equal(query.nameSpace, testNameSpace); - assert.equal(query.params, testQueryParams); - assert.equal(query.urlParams, testUrlParams); - - return Ember.RSVP.resolve(testRecords); - }; service.cache = Ember.Object.create(); assert.notOk(service.get("cache").get(cacheKey)); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/services/pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/services/pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/services/pollster-test.js new file mode 100644 index 0000000..7687a87 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/services/pollster-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('service:pollster', 'Unit | Service | pollster', { + // Specify the other units that are required for this test. + needs: ['service:localStorage'] +}); + +test('Basic creation test', function(assert) { + let service = this.subject(); + assert.ok(service); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/utils/counter-column-definition-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/utils/counter-column-definition-test.js b/tez-ui2/src/main/webapp/tests/unit/utils/counter-column-definition-test.js index 64df664..9e0476f 100644 --- a/tez-ui2/src/main/webapp/tests/unit/utils/counter-column-definition-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/utils/counter-column-definition-test.js @@ -37,7 +37,7 @@ test('Basic creation test', function(assert) { assert.ok(CounterColumnDefinition.make); assert.equal(definition.observePath, true); - assert.equal(definition.contentPath, "counterHash"); + assert.equal(definition.contentPath, "counterGroupsHash"); }); test('getCellContent, getSearchValue & getSortValue test', function(assert) { @@ -46,7 +46,7 @@ test('getCellContent, getSearchValue & getSortValue test', function(assert) { testCounterValue = "val", testContent = {}, testRow = { - counterHash: testContent + counterGroupsHash: testContent }; testContent[testGroupName] = {};