Repository: tez Updated Branches: refs/heads/master 0c7e1c5bb -> 8e9e5ae7f
http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-line-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-line-test.js b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-line-test.js index 0dd8ead..5e933db 100644 --- a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-line-test.js +++ b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-line-test.js @@ -20,9 +20,9 @@ import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import wait from 'ember-test-helpers/wait'; -import Ember from 'ember'; import Process from 'tez-ui/utils/process'; +import Processor from 'tez-ui/utils/processor'; moduleForComponent('em-swimlane-process-line', 'Integration | Component | em swimlane process line', { integration: true @@ -30,14 +30,15 @@ moduleForComponent('em-swimlane-process-line', 'Integration | Component | em swi test('Basic creation test', function(assert) { this.set("process", Process.create()); + this.set("processor", Processor.create()); - this.render(hbs`{{em-swimlane-process-line process=process}}`); + this.render(hbs`{{em-swimlane-process-line process=process processor=processor}}`); assert.equal(this.$().text().trim(), ''); // Template block usage:" + EOL + this.render(hbs` - {{#em-swimlane-process-line process=process}} + {{#em-swimlane-process-line process=process processor=processor}} template block text {{/em-swimlane-process-line}} `); @@ -46,18 +47,20 @@ test('Basic creation test', function(assert) { }); test('start-end event test', function(assert) { - var startEvent = Ember.Object.create({ - pos: 50 - }), - endEvent = Ember.Object.create({ - pos: 70 - }); + this.set("process", Process.create({ + startEvent: { + time: 5 + }, + endEvent: { + time: 7 + } + })); + this.set("processor", Processor.create({ + startTime: 0, + endTime: 10 + })); - this.set("process", Process.create()); - this.set("startEvent", startEvent); - this.set("endEvent", endEvent); - - this.render(hbs`{{em-swimlane-process-line process=process startEvent=startEvent endEvent=endEvent}}`); + this.render(hbs`{{em-swimlane-process-line processor=processor process=process}}`); return wait().then(() => { assert.equal(this.$(".process-line").eq(0).attr("style").trim(), "left: 50%; right: 30%;", "process-line"); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-visual-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-visual-test.js b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-visual-test.js index 4eb6b1b..393a13a 100644 --- a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-visual-test.js +++ b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-process-visual-test.js @@ -22,6 +22,7 @@ import hbs from 'htmlbars-inline-precompile'; import wait from 'ember-test-helpers/wait'; import Process from 'tez-ui/utils/process'; +import Processor from 'tez-ui/utils/processor'; moduleForComponent('em-swimlane-process-visual', 'Integration | Component | em swimlane process visual', { integration: true @@ -29,15 +30,16 @@ moduleForComponent('em-swimlane-process-visual', 'Integration | Component | em s test('Basic creation test', function(assert) { this.set("process", Process.create()); + this.set("processor", Processor.create()); - this.render(hbs`{{em-swimlane-process-visual process=process}}`); + this.render(hbs`{{em-swimlane-process-visual process=process processor=processor}}`); assert.ok(this.$(".base-line")); assert.ok(this.$(".event-window")); // Template block usage:" + EOL + this.render(hbs` - {{#em-swimlane-process-visual process=process}} + {{#em-swimlane-process-visual processor=processor process=process}} template block text {{/em-swimlane-process-visual}} `); @@ -54,8 +56,12 @@ test('Events test', function(assert) { time: 7 }] })); + this.set("processor", Processor.create({ + startTime: 0, + endTime: 10 + })); - this.render(hbs`{{em-swimlane-process-visual process=process startTime=0 timeWindow=10}}`); + this.render(hbs`{{em-swimlane-process-visual processor=processor process=process startTime=0 timeWindow=10}}`); return wait().then(() => { var events = this.$(".em-swimlane-event"); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-ruler-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-ruler-test.js b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-ruler-test.js new file mode 100644 index 0000000..b1d0439 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-ruler-test.js @@ -0,0 +1,70 @@ +/** + * 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +import wait from 'ember-test-helpers/wait'; + +import Processor from 'tez-ui/utils/processor'; + +moduleForComponent('em-swimlane-ruler', 'Integration | Component | em swimlane ruler', { + integration: true +}); + +test('Basic creation test', function(assert) { + + this.render(hbs`{{em-swimlane-ruler}}`); + assert.equal(this.$().text().trim(), 'Milliseconds'); + + // Template block usage:" + EOL + + this.render(hbs` + {{#em-swimlane-ruler}} + template block text + {{/em-swimlane-ruler}} + `); + assert.equal(this.$().text().trim(), 'Milliseconds'); +}); + +test('Mark test', function(assert) { + this.set("processor", Processor.create({ + startTime: 0, + endTime: 1000 * 20, + })); + + this.render(hbs`{{em-swimlane-ruler processor=processor zoom=100}}`); + + return wait().then(() => { + assert.equal(this.$(".unit-text").text().trim(), 'Seconds'); + assert.equal(this.$(".ruler-mark").length, 11); + }); +}); + +test('Mark zoom test', function(assert) { + this.set("processor", Processor.create({ + startTime: 0, + endTime: 1000 * 20, + })); + + this.render(hbs`{{em-swimlane-ruler processor=processor zoom=500}}`); + + return wait().then(() => { + assert.equal(this.$(".unit-text").text().trim(), 'Milliseconds'); + assert.equal(this.$(".ruler-mark").length, 55); + }); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-vertex-name-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-vertex-name-test.js b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-vertex-name-test.js new file mode 100644 index 0000000..44a4411 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/integration/components/em-swimlane-vertex-name-test.js @@ -0,0 +1,79 @@ +/** + * 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +import wait from 'ember-test-helpers/wait'; + +import Process from 'tez-ui/utils/process'; + +moduleForComponent('em-swimlane-vertex-name', 'Integration | Component | em swimlane vertex name', { + integration: true +}); + +test('Basic creation test', function(assert) { + + this.render(hbs`{{em-swimlane-vertex-name}}`); + assert.equal(this.$().text().trim(), 'Not Available!'); + + // Template block usage:" + EOL + + this.render(hbs` + {{#em-swimlane-vertex-name}} + template block text + {{/em-swimlane-vertex-name}} + `); + assert.equal(this.$().text().trim(), 'Not Available!'); +}); + +test('Name test', function(assert) { + this.set("process", Process.create({ + name: "TestName" + })); + + this.render(hbs`{{em-swimlane-vertex-name process=process}}`); + return wait().then(() => { + assert.equal(this.$(".name-text").text().trim(), 'TestName'); + }); +}); + +test('Progress test', function(assert) { + this.set("process", Process.create({ + vertex: { + progress: 0.5 + } + })); + + this.render(hbs`{{em-swimlane-vertex-name process=process}}`); + return wait().then(() => { + assert.equal(this.$().text().trim().substr(0, 3), '50%'); + }); +}); + +test('finalStatus test', function(assert) { + this.set("process", Process.create({ + vertex: { + finalStatus: "STAT" + } + })); + + this.render(hbs`{{em-swimlane-vertex-name process=process}}`); + return wait().then(() => { + assert.equal(this.$().text().trim(), 'STAT'); + }); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/integration/components/em-table-status-cell-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/em-table-status-cell-test.js b/tez-ui2/src/main/webapp/tests/integration/components/em-table-status-cell-test.js index c2c6a45..fd4d612 100644 --- a/tez-ui2/src/main/webapp/tests/integration/components/em-table-status-cell-test.js +++ b/tez-ui2/src/main/webapp/tests/integration/components/em-table-status-cell-test.js @@ -25,11 +25,7 @@ moduleForComponent('em-table-status-cell', 'Integration | Component | em table s test('Basic render test', function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + - this.render(hbs`{{em-table-status-cell}}`); - assert.equal(this.$().text().trim(), 'Not Available!'); // Template block usage:" + EOL + @@ -38,18 +34,11 @@ test('Basic render test', function(assert) { template block text {{/em-table-status-cell}} `); - assert.equal(this.$().text().trim(), 'Not Available!'); }); -test('Basic type test', function(assert) { - this.render(hbs`{{em-table-status-cell content="SUCCESS"}}`); - assert.equal(this.$().text().trim(), 'SUCCESS'); - assert.equal(this.$("span")[0].className, 'label label-success'); -}); - -test('Extended type test', function(assert) { +test('Basic test', function(assert) { this.render(hbs`{{em-table-status-cell content="inited"}}`); assert.equal(this.$().text().trim(), 'inited'); - assert.equal(this.$("span")[0].className, 'label label-primary'); + assert.equal(this.$("span")[0].className, 'status status-inited'); }); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js index 3013a23..7509dee 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js @@ -36,13 +36,16 @@ test('Basic creation test', function(assert) { }); assert.ok(controller); + assert.ok(controller.zoom); assert.ok(controller.breadcrumbs); assert.ok(controller.columns); assert.ok(controller.processes); - assert.ok(controller.eventBars); + + assert.ok(controller.actions.toggleFullscreen); + assert.ok(controller.actions.click); }); -test('Process test', function(assert) { +test('Processes test', function(assert) { var vertices = [Ember.Object.create({ name: "v1" http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/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 index 1a5bc66..d0e3582 100644 --- 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 @@ -26,5 +26,12 @@ moduleForModel('vertex-am', 'Unit | Model | vertex am', { test('Basic creation test', function(assert) { let model = this.subject(); // let store = this.store(); + assert.ok(!!model); + + assert.ok(model.initTime); + assert.ok(model.startTime); + assert.ok(model.endTime); + assert.ok(model.firstTaskStartTime); + assert.ok(model.lastTaskFinishTime); }); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/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 86cd472..e3195bd 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 @@ -35,6 +35,14 @@ test('Basic creation test', function(assert) { assert.ok(model.runningTasks); assert.ok(model.pendingTasks); + + assert.ok(model.initTime); + assert.ok(model.startTime); + assert.ok(model.endTime); + assert.ok(model.firstTaskStartTime); + assert.ok(model.lastTaskFinishTime); + + assert.ok(model.finalStatus); }); test('runningTasks test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/unit/utils/process-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/utils/process-test.js b/tez-ui2/src/main/webapp/tests/unit/utils/process-test.js index 6069d7b..5eb7a7d 100644 --- a/tez-ui2/src/main/webapp/tests/unit/utils/process-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/utils/process-test.js @@ -25,6 +25,15 @@ test('Basic creation test', function(assert) { let process = Process.create(); assert.ok(process); + + assert.ok(process.consolidateStartTime); + assert.ok(process.consolidateEndTime); + + assert.ok(process.init); + + assert.ok(process.getBarColor); + assert.ok(process.getConsolidateColor); + assert.ok(process.getColor); assert.ok(process.startEvent); assert.ok(process.endEvent); @@ -32,6 +41,14 @@ test('Basic creation test', function(assert) { assert.ok(process.getTooltipContents); }); +test('_id test', function(assert) { + let nextID = parseInt(Process.create().get("_id").split("-")[2]) + 1; + + let process = Process.create(); + assert.equal(process.get("_id"), "process-id-" + nextID); +}); + + test('getColor test', function(assert) { let process = Process.create(); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/unit/utils/processor-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/utils/processor-test.js b/tez-ui2/src/main/webapp/tests/unit/utils/processor-test.js new file mode 100644 index 0000000..b2909b3 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/utils/processor-test.js @@ -0,0 +1,68 @@ +/** + * 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 Processor from '../../../utils/processor'; +import { module, test } from 'qunit'; + +module('Unit | Utility | processor'); + +test('Basic creation test', function(assert) { + let processor = Processor.create(); + + assert.ok(processor); + + assert.ok(processor.timeWindow); + assert.ok(processor.createProcessColor); + assert.ok(processor.timeToPositionPercent); +}); + +test('timeWindow test', function(assert) { + let processor = Processor.create({ + startTime: 50, + endTime: 80 + }); + + assert.equal(processor.get("timeWindow"), 30); + + processor = Processor.create({ + startTime: 80, + endTime: 50 + }); + + assert.equal(processor.get("timeWindow"), 0); +}); + +test('timeWindow test', function(assert) { + let processor = Processor.create({ + processCount: 10 + }), + color = processor.createProcessColor(3); + + assert.equal(color.h, 108); + assert.equal(color.s, 70); + assert.equal(color.l, 40); +}); + +test('timeToPositionPercent test', function(assert) { + let processor = Processor.create({ + startTime: 0, + endTime: 10 + }); + + assert.equal(processor.timeToPositionPercent(5), 50); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/8e9e5ae7/tez-ui2/src/main/webapp/tests/unit/utils/vertex-process-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/utils/vertex-process-test.js b/tez-ui2/src/main/webapp/tests/unit/utils/vertex-process-test.js index 05ffc40..dfad264 100644 --- a/tez-ui2/src/main/webapp/tests/unit/utils/vertex-process-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/utils/vertex-process-test.js @@ -33,9 +33,15 @@ test('Basic creation test', function(assert) { assert.ok(process.blockingEventName); assert.ok(process.events); + assert.ok(process.eventBars); assert.ok(process.unblockTime); + assert.ok(process.eventsHash); assert.ok(process.getTooltipContents); + + assert.ok(process.consolidateStartTime); + assert.ok(process.consolidateEndTime); + assert.ok(process.getConsolidateColor); }); test('unblockTime test', function(assert) { @@ -74,29 +80,52 @@ test('events test', function(assert) { vertex: Ember.Object.create({ events: [{ eventtype: "testEvent1" + //No timestamp, will be removed },{ - eventtype: "testEvent2" + eventtype: "testEvent2", + timestamp: 10 }], - firstTaskStartTime: 10, - lastTaskFinishTime: 20 + initTime: 20, + startTime: 30, + firstTaskStartTime: 40, + lastTaskFinishTime: 50, + endTime: 60 }) }); - assert.equal(process.get("events.length"), 4); + assert.equal(process.get("events.length"), 6); + + assert.equal(process.get("events.0.name"), "testEvent2"); + assert.equal(process.get("events.1.name"), "VERTEX_INITIALIZED"); + assert.equal(process.get("events.2.name"), "VERTEX_STARTED"); + assert.equal(process.get("events.3.name"), "VERTEX_TASK_START"); + assert.equal(process.get("events.4.name"), "VERTEX_TASK_FINISH"); + assert.equal(process.get("events.5.name"), "VERTEX_FINISHED"); - assert.equal(process.get("events.0.name"), "testEvent1"); - assert.equal(process.get("events.1.name"), "testEvent2"); - assert.equal(process.get("events.2.time"), 10); - assert.equal(process.get("events.3.time"), 20); + assert.equal(process.get("events.0.time"), 10); + assert.equal(process.get("events.1.time"), 20); + assert.equal(process.get("events.2.time"), 30); + assert.equal(process.get("events.3.time"), 40); + assert.equal(process.get("events.4.time"), 50); + assert.equal(process.get("events.5.time"), 60); + // unblockTime < firstTaskStartTime, and we don't consider as a relevant event process.set("blockers", [VertexProcess.create({ - vertex: { + vertex: Ember.Object.create({ endTime: 30 - } + }) })]); + assert.equal(process.get("events.length"), 6); - assert.equal(process.get("events.length"), 5); - assert.equal(process.get("events.4.time"), 30); + process.set("blockers", [VertexProcess.create({ + vertex: Ember.Object.create({ + endTime: 55 + }) + })]); + + assert.equal(process.get("events.length"), 7); + assert.equal(process.get("events.6.name"), "DEPENDENT_VERTICES_COMPLETE"); + assert.equal(process.get("events.6.time"), 55); }); test('getTooltipContents-event test', function(assert) { @@ -104,32 +133,39 @@ test('getTooltipContents-event test', function(assert) { var eventTooltip = process.getTooltipContents("event", { events: [{ - text: "TestEventText1", name: "TestEventName1", time: 10 }, { - text: "TestEventText2", name: "TestEventName2", - time: 20 + time: 20, + info: { + inf1: "val1", + inf2: 30 + } }] }); assert.equal(eventTooltip.length, 2); - assert.equal(eventTooltip[0].title, "TestEventText1"); - assert.equal(eventTooltip[0].properties.length, 2); - assert.equal(eventTooltip[0].properties[0].name, "Type"); - assert.equal(eventTooltip[0].properties[0].value, "TestEventName1"); - assert.equal(eventTooltip[0].properties[1].name, "Time"); - assert.equal(eventTooltip[0].properties[1].value, 10); - - assert.equal(eventTooltip[1].title, "TestEventText2"); - assert.equal(eventTooltip[1].properties.length, 2); - assert.equal(eventTooltip[1].properties[0].name, "Type"); - assert.equal(eventTooltip[1].properties[0].value, "TestEventName2"); - assert.equal(eventTooltip[1].properties[1].name, "Time"); - assert.equal(eventTooltip[1].properties[1].value, 20); - + assert.equal(eventTooltip[0].title, "TestEventName1"); + assert.equal(eventTooltip[0].properties.length, 1); + assert.equal(eventTooltip[0].properties[0].name, "Time"); + assert.equal(eventTooltip[0].properties[0].value, 10); + assert.equal(eventTooltip[0].properties[0].type, "date"); + + assert.equal(eventTooltip[1].title, "TestEventName2"); + assert.equal(eventTooltip[1].properties.length, 3); + assert.equal(eventTooltip[1].properties[0].name, "Time"); + assert.equal(eventTooltip[1].properties[0].value, 20); + assert.equal(eventTooltip[1].properties[0].type, "date"); + + assert.equal(eventTooltip[1].properties[1].name, "inf1"); + assert.equal(eventTooltip[1].properties[1].value, "val1"); + assert.equal(eventTooltip[1].properties[1].type, undefined); + + assert.equal(eventTooltip[1].properties[2].name, "inf2"); + assert.equal(eventTooltip[1].properties[2].value, 30); + assert.equal(eventTooltip[1].properties[2].type, "number"); }); test('getTooltipContents-process test', function(assert) {
