http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js new file mode 100644 index 0000000..aaeab62 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js @@ -0,0 +1,48 @@ +/** + * 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', 'Unit | Serializer | attempt', { + // Specify the other units that are required for this test. + // needs: ['serializer:attempt'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.maps.logURL); +}); + +test('logURL test', function(assert) { + let serializer = this.subject({ + env: { + app: { + yarnProtocol: "ptcl" + } + } + }); + + assert.equal(serializer.maps.logURL.call(serializer, { + entity: "id_1", + otherinfo: { + inProgressLogsURL: "abc.com/test/link", + } + }), "ptcl://abc.com/test/link/syslog_id_1"); +});
http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/dag-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/dag-am-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/dag-am-test.js new file mode 100644 index 0000000..be68f98 --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js new file mode 100644 index 0000000..eb39508 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js @@ -0,0 +1,131 @@ +/** + * 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', 'Unit | Serializer | dag', { + // Specify the other units that are required for this test. + // needs: ['serializer:dag'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.maps.atsStatus); + assert.ok(serializer.maps.startTime); + assert.ok(serializer.maps.endTime); + assert.ok(serializer.maps.containerLogs); + assert.ok(serializer.maps.vertexIdNameMap); +}); + +test('atsStatus test', function(assert) { + let serializer = this.subject(), + mapper = serializer.maps.atsStatus; + + assert.equal(mapper({ + events: [{eventtype: "SOME_EVENT"}] + }), undefined); + + assert.equal(mapper({ + events: [{eventtype: "DAG_STARTED"}] + }), "RUNNING"); + + assert.equal(mapper({ + otherinfo: {status: "STATUS1"}, + primaryfilters: {status: ["STATUS2"]}, + events: [{eventtype: "DAG_STARTED"}] + }), "STATUS1"); + + assert.equal(mapper({ + primaryfilters: {status: ["STATUS2"]}, + events: [{eventtype: "DAG_STARTED"}] + }), "STATUS2"); +}); + +test('startTime test', function(assert) { + let serializer = this.subject(), + mapper = serializer.maps.startTime, + testTimestamp = Date.now(); + + assert.equal(mapper({ + events: [{eventtype: "SOME_EVENT"}] + }), undefined); + + assert.equal(mapper({ + events: [{eventtype: "DAG_STARTED", timestamp: testTimestamp}] + }), testTimestamp); + + assert.equal(mapper({ + otherinfo: {startTime: testTimestamp}, + events: [{eventtype: "DAG_STARTED"}] + }), testTimestamp); +}); + +test('endTime test', function(assert) { + let serializer = this.subject(), + mapper = serializer.maps.endTime, + testTimestamp = Date.now(); + + assert.equal(mapper({ + events: [{eventtype: "SOME_EVENT"}] + }), undefined); + + assert.equal(mapper({ + events: [{eventtype: "DAG_FINISHED", timestamp: testTimestamp}] + }), testTimestamp); + + assert.equal(mapper({ + otherinfo: {endTime: testTimestamp}, + events: [{eventtype: "DAG_FINISHED"}] + }), testTimestamp); +}); + +test('containerLogs test', function(assert) { + let serializer = this.subject(), + mapper = serializer.maps.containerLogs; + + assert.deepEqual(mapper({ + otherinfo: {}, + }), [], "No logs"); + + assert.deepEqual(mapper({ + otherinfo: {inProgressLogsURL_1: "foo", inProgressLogsURL_2: "bar"}, + }), [{text: "1", href: "http://foo"}, {text: "2", href: "http://bar"}], "2 logs"); +}); + +test('vertexIdNameMap test', function(assert) { + let serializer = this.subject(), + mapper = serializer.maps.vertexIdNameMap; + + let nameIdMap = { + otherinfo: { + vertexNameIdMapping: { + name1: "ID1", + name2: "ID2", + name3: "ID3", + } + } + }; + + assert.deepEqual(mapper(nameIdMap), { + ID1: "name1", + ID2: "name2", + ID3: "name3", + }); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/loader-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/loader-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/loader-test.js new file mode 100644 index 0000000..5add84a --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/loader-test.js @@ -0,0 +1,193 @@ +/** + * 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('serializer:loader', 'Unit | Serializer | loader', { + // Specify the other units that are required for this test. + // needs: ['serializer:loader'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer._isLoader); + + assert.ok(serializer.extractId); + assert.ok(serializer.extractAttributes); + assert.ok(serializer.extractRelationships); + + assert.ok(serializer.extractSinglePayload); + assert.ok(serializer.extractArrayPayload); + + assert.ok(serializer.normalizeSingleResponse); + assert.ok(serializer.normalizeArrayResponse); +}); + +test('extractId test', function(assert) { + let serializer = this.subject(), + modelClass = {}, + resourceHash = { + nameSpace: "ns", + data: { + id: 1, + entityID: 3 + } + }; + + assert.equal(serializer.extractId(modelClass, resourceHash), "ns:1", "With name-space"); + assert.equal(serializer.extractId(modelClass, { data: {id: 2} }), 2, "Without name-space"); + + serializer.primaryKey = "entityID"; + assert.equal(serializer.extractId(modelClass, resourceHash), "ns:3", "Different primary key"); +}); + +test('extractAttributes test', function(assert) { + let serializer = this.subject(), + modelClass = { + eachAttribute: function (callback) { + callback("id", {type: "string"}); + callback("appID", {type: "string"}); + callback("status", {type: "string"}); + } + }, + resourceHash = { + nameSpace: "ns", + data: { + id: 1, + appID: 2, + applicationID: 3, + info: { + status: "SUCCESS" + } + } + }; + + assert.deepEqual(serializer.extractAttributes(modelClass, resourceHash), { + id: 1, + appID: 2 + }); + + serializer.maps = { + id: "id", + appID: "applicationID", + status: "info.status" + }; + + assert.deepEqual(serializer.extractAttributes(modelClass, resourceHash), { + id: 1, + appID: 3, + status: "SUCCESS" + }); +}); + +test('extractRelationships test', function(assert) { + let serializer = this.subject(), + modelClass = { + eachAttribute: Ember.K, + eachRelationship: function (callback) { + callback("app", { + key: "app", + kind: "belongsTo", + options: {}, + parentType: "parent", + type: "app" + }); + }, + eachTransformedAttribute: Ember.K + }, + resourceHash = { + nameSpace: "ns", + data: { + id: 1, + app: "", + } + }; + + assert.deepEqual(serializer.extractRelationships(modelClass, resourceHash), { + app: { + data: { + id: null, + type:"app" + } + } + }); + +}); + +test('normalizeSingleResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + eachAttribute: function (callback) { + callback("id", {type: "string"}); + callback("appID", {type: "string"}); + callback("status", {type: "string"}); + }, + eachRelationship: Ember.K, + eachTransformedAttribute: Ember.K + }, + resourceHash = { + nameSpace: "ns", + data: { + id: 1, + appID: 2, + applicationID: 3, + info: { + status: "SUCCESS" + } + } + }; + + var response = serializer.normalizeSingleResponse({}, modelClass, resourceHash, null, null); + + assert.equal(response.data.id, "ns:1"); + assert.equal(response.data.attributes.id, 1); + assert.equal(response.data.attributes.appID, 2); +}); + +test('normalizeArrayResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + eachAttribute: function (callback) { + callback("id", {type: "string"}); + callback("appID", {type: "string"}); + callback("status", {type: "string"}); + }, + eachRelationship: Ember.K, + eachTransformedAttribute: Ember.K + }, + resourceHash = { + nameSpace: "ns", + data: [{ + id: 1, + appID: 2, + },{ + id: 2, + appID: 4, + }] + }; + + var response = serializer.normalizeArrayResponse({}, modelClass, resourceHash, null, null); + + assert.equal(response.data.length, 2); + assert.deepEqual(response.data[0].id, "ns:1"); + assert.deepEqual(response.data[1].id, "ns:2"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/rm-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/rm-test.js new file mode 100644 index 0000000..7175d1a --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/task-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/task-am-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/task-am-test.js new file mode 100644 index 0000000..cdd1b04 --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/task-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/task-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/task-test.js new file mode 100644 index 0000000..fc79ae9 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/task-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', 'Unit | Serializer | task', { + // Specify the other units that are required for this test. + // needs: ['serializer:task'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.maps); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/timeline-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/timeline-test.js new file mode 100644 index 0000000..3c267ad --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/timeline-test.js @@ -0,0 +1,41 @@ +/** + * 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:timeline', 'Unit | Serializer | timeline', { + // Specify the other units that are required for this test. + // needs: ['serializer:timeline'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.extractArrayPayload); + assert.ok(serializer.maps); +}); + +test('extractArrayPayload test', function(assert) { + let serializer = this.subject(), + testPayload = { + entities: [] + }; + + assert.equal(serializer.extractArrayPayload(testPayload), testPayload.entities); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/vertex-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/vertex-am-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/vertex-am-test.js new file mode 100644 index 0000000..254ca9f --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/serializers/vertex-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/vertex-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/vertex-test.js new file mode 100644 index 0000000..7dfb5da --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/serializers/vertex-test.js @@ -0,0 +1,49 @@ +/** + * 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', 'Unit | Serializer | vertex', { + // Specify the other units that are required for this test. + // needs: ['serializer:vertex'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.maps); + assert.ok(serializer.maps.processorClassName); +}); + +test('processorClassName test', function(assert) { + let serializer = this.subject(), + processorClassName = serializer.maps.processorClassName; + + assert.equal(processorClassName({}), ""); + assert.equal(processorClassName({ + otherinfo: { + processorClassName: "foo" + } + }), "foo"); + assert.equal(processorClassName({ + otherinfo: { + processorClassName: "a.b.foo" + } + }), "foo"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/services/env-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/services/env-test.js b/tez-ui/src/main/webapp/tests/unit/services/env-test.js new file mode 100644 index 0000000..ca17f85 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/services/env-test.js @@ -0,0 +1,80 @@ +/** + * 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'; + +import environment from '../../../config/environment'; + +moduleFor('service:env', 'Unit | Service | env', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +test('Basic creation test', function(assert) { + let service = this.subject(); + + assert.ok(service); + assert.ok(service.ENV); + assert.ok(service.collateConfigs); + assert.ok(service.app); + assert.ok(service.setComputedENVs); +}); + +test('collateConfigs test', function(assert) { + let service = this.subject(), + APP = environment.APP; + + APP.a = 11; + APP.b = 22; + window.ENV = { + a: 1 + }; + + service.collateConfigs(); + + APP = service.get("app"); + assert.equal(APP.a, 1, "Test window.ENV merge onto environment.APP"); + assert.equal(APP.b, 22); +}); + +test('app computed property test', function(assert) { + let service = this.subject(), + ENV = { + b: 2 + }; + + window.ENV = ENV; + environment.APP.a = 11; + service.collateConfigs(); + assert.equal(service.get("app.a"), environment.APP.a); + assert.equal(service.get("app.b"), ENV.b); +}); + +test('setComputedENVs test', function(assert) { + let service = this.subject(); + + assert.equal(service.ENV.isIE, false); +}); + +test('Validate config/default-app-conf.js', function(assert) { + let service = this.subject(); + + assert.equal(service.get("app.hosts.timeline"), "localhost:8188"); + assert.equal(service.get("app.namespaces.webService.timeline"), "ws/v1/timeline"); + assert.equal(service.get("app.paths.timeline.dag"), "TEZ_DAG_ID"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js b/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js new file mode 100644 index 0000000..026f21b --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js @@ -0,0 +1,77 @@ +/** + * 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:hosts', 'Unit | Service | hosts', { + // Specify the other units that are required for this test. + needs: ['service:env'] +}); + +test('Test creation', function(assert) { + let service = this.subject(); + assert.ok(service); +}); + +test('Test correctProtocol', function(assert) { + let service = this.subject(); + + //No correction + assert.equal(service.correctProtocol("http://localhost:8088"), "http://localhost:8088"); + + // Correction + assert.equal(service.correctProtocol("localhost:8088"), "http://localhost:8088"); + assert.equal(service.correctProtocol("https://localhost:8088"), "http://localhost:8088"); + assert.equal(service.correctProtocol("file://localhost:8088"), "http://localhost:8088"); + + assert.equal(service.correctProtocol("localhost:8088", "http:"), "http://localhost:8088"); + assert.equal(service.correctProtocol("https://localhost:8088", "http:"), "http://localhost:8088"); + assert.equal(service.correctProtocol("file://localhost:8088", "http:"), "http://localhost:8088"); + + assert.equal(service.correctProtocol("localhost:8088", "https:"), "https://localhost:8088"); + assert.equal(service.correctProtocol("https://localhost:8088", "https:"), "https://localhost:8088"); + assert.equal(service.correctProtocol("file://localhost:8088", "https:"), "https://localhost:8088"); +}); + +test('Test correctProtocol with protocol=file:', function(assert) { + let service = this.subject(); + + assert.equal(service.correctProtocol("file://localhost:8088", "file:"), "file://localhost:8088"); + assert.equal(service.correctProtocol("http://localhost:8088", "file:"), "http://localhost:8088"); + assert.equal(service.correctProtocol("https://localhost:8088", "file:"), "https://localhost:8088"); +}); + +test('Test host URLs', function(assert) { + let service = this.subject(); + + assert.equal(service.get("timeline"), "http://localhost:8188"); + assert.equal(service.get("rm"), "http://localhost:8088"); +}); + +test('Test host URLs with ENV set', function(assert) { + let service = this.subject(); + + window.ENV = { + hosts: { + timeline: "https://localhost:3333", + rm: "https://localhost:4444" + } + }; + assert.equal(service.get("timeline"), "http://localhost:3333"); + assert.equal(service.get("rm"), "http://localhost:4444"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/services/loader-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/services/loader-test.js b/tez-ui/src/main/webapp/tests/unit/services/loader-test.js new file mode 100644 index 0000000..fc63786 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/services/loader-test.js @@ -0,0 +1,311 @@ +/** + * 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('service:loader', 'Unit | Service | loader', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +test('Basic creation test', function(assert) { + let service = this.subject(); + + assert.ok(service.cache); + assert.ok(service.store); + assert.ok(service._setOptions); + + assert.ok(service.checkRequisite); + + assert.ok(service.lookup); + assert.ok(service.entityFor); + + assert.ok(service.getCacheKey); + + assert.ok(service.queryRecord); + assert.ok(service.query); + + assert.ok(service.unloadAll); +}); + +test('_setOptions test', function(assert) { + let service = this.subject(); + + assert.equal(service.get("nameSpace"), ''); + + service._setOptions({ + nameSpace: "ns" + }); + + assert.equal(service.get("nameSpace"), 'ns'); +}); + +test('checkRequisite test', function(assert) { + let service = this.subject(), + testType = "type"; + + assert.expect(3 + 3 + 2); + + // Not found + service.store = { + adapterFor: function (type) { + assert.equal(type, testType); + }, + serializerFor: function (type) { + assert.equal(type, testType); + } + }; + assert.throws(function () { + service.checkRequisite(testType); + }); + + // Not loader found + service.store = { + adapterFor: function (type) { + assert.equal(type, testType); + return {}; + }, + serializerFor: function (type) { + assert.equal(type, testType); + return {}; + } + }; + assert.throws(function () { + service.checkRequisite(testType); + }); + + service.store = { + adapterFor: function (type) { + assert.equal(type, testType); + return { _isLoader: true }; + }, + serializerFor: function (type) { + assert.equal(type, testType); + return { _isLoader: true }; + } + }; + + service.checkRequisite(testType); +}); + +test('lookup test', function(assert) { + let service = this.subject(); + + assert.expect(1); + + service.container.lookup = function (fullName) { + assert.equal(fullName, "typ:na-me"); + }; + + service.lookup("typ", "NaMe"); +}); + +test('entityFor test', function(assert) { + let service = this.subject(), + testName = "abc", + entity; + + assert.expect(3 + 4 + 3); + + // All lookups fail + service.lookup = function (type, name) { + if(name === testName) { + assert.equal(type, "entitie"); + } + if(name === "entity") { + assert.equal(type, "entitie"); + } + }; + assert.throws(function () { + service.entityFor(testName); + }, "All lookups fail"); + + // Default lookups succeeded + service.lookup = function (type, name) { + if(name === testName) { + assert.equal(type, "entitie"); + } + if(name === "entity") { + assert.equal(type, "entitie"); + return Ember.Object.create({ + actualName: "entity", + name: name + }); + } + }; + entity = service.entityFor(testName); + assert.equal(entity.actualName, "entity", "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 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.get("name"), testName, "Default lookups succeeded"); + assert.equal(entity.get("name"), testName, "Default lookups succeeded"); +}); + +test('getCacheKey test', function(assert) { + let service = this.subject(); + + assert.equal(service.getCacheKey("type"), "type"); + assert.equal(service.getCacheKey("type", {a:1}), 'type:{"a":1}'); + assert.equal(service.getCacheKey("type", null, 1), "type:1"); + assert.equal(service.getCacheKey("type", {a:1}, 1), 'type:1:{"a":1}'); +}); + +test('queryRecord test', function(assert) { + let service = this.subject(), + testNameSpace = "ns", + testOptions = {opt: 1}, + testQueryParams = {}, + testUrlParams = {}, + testType = "type", + testRecord = {}, + testID = 1, + cacheKey = service.getCacheKey(testType, testQueryParams, testID); + + assert.expect(1 + 5 + 3); + + service.nameSpace = testNameSpace; + service.checkRequisite = Ember.K; + service.entityFor = function (type) { + assert.equal(type, testType); + + return { + 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.cache = Ember.Object.create(); + assert.notOk(service.get("cache").get(cacheKey)); + service.queryRecord(testType, testID, testOptions, testQueryParams, testUrlParams).then(function (record) { + assert.equal(record, testRecord); + }); + assert.ok(service.get("cache").get(cacheKey)); +}); + +test('query test', function(assert) { + let service = this.subject(), + testNameSpace = "ns", + testOptions = {opt: 1}, + testQueryParams = {}, + testUrlParams = {}, + testType = "type", + testRecord = {}, + testRecords = [testRecord, testRecord], + cacheKey = service.getCacheKey(testType, testQueryParams); + + assert.expect(1 + 4 + 3); + + service.nameSpace = testNameSpace; + service.checkRequisite = Ember.K; + service.entityFor = function (type) { + assert.equal(type, testType); + + return { + 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 Ember.RSVP.resolve(testRecords); + } + }; + }; + + service.cache = Ember.Object.create(); + assert.notOk(service.get("cache").get(cacheKey)); + service.query(testType, testQueryParams, testOptions, testUrlParams).then(function (records) { + assert.equal(records, testRecords); + }); + assert.ok(service.get("cache").get(cacheKey)); +}); + +test('unloadAll test', function(assert) { + let testType1 = "a", + service = this.subject({ + nameSpace: "ns", + store: { + peekAll: function (type) { + assert.equal(type, testType1); + return [Ember.Object.create({ + id: "ns:id1", + entityID: "id1" + }), Ember.Object.create({ + id: "nsX:id1", + entityID: "id1" + })]; + }, + unloadRecord: function (record) { + assert.equal(record.get("entityID"), "id1"); + } + } + }); + + assert.expect(1 + 1); + + service.unloadAll(testType1, "id2"); +}); + +test('unloadAll skipID test', function(assert) { + let testType1 = "q", + service = this.subject({ + nameSpace: "ns", + store: { + peekAll: function (type) { + assert.equal(type, testType1); + return [Ember.Object.create({ + id: "ns:id1", + entityID: "id1" + }), Ember.Object.create({ + id: "ns:id2", + entityID: "id2" + })]; + }, + unloadRecord: function (record) { + assert.equal(record.get("entityID"), "id2"); + } + } + }); + + assert.expect(1 + 1); + + service.unloadAll(testType1, "id1"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/services/local-storage-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/services/local-storage-test.js b/tez-ui/src/main/webapp/tests/unit/services/local-storage-test.js new file mode 100644 index 0000000..6f9a1af --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/services/local-storage-test.js @@ -0,0 +1,42 @@ +/** + * 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:local-storage', 'Unit | Service | local storage', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +test('Test creation', function(assert) { + let service = this.subject(); + assert.ok(service); +}); + +test('getStoreKey test', function(assert) { + let service = this.subject(); + + assert.equal(service.getStoreKey("abc"), "tez-ui:abc"); +}); + +test('Set & get test', function(assert) { + let service = this.subject(); + + service.set("abc", "value"); + assert.equal(service.get("abc"), "value"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/services/pollster-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/services/pollster-test.js b/tez-ui/src/main/webapp/tests/unit/services/pollster-test.js new file mode 100644 index 0000000..7687a87 --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/transforms/object-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/transforms/object-test.js b/tez-ui/src/main/webapp/tests/unit/transforms/object-test.js new file mode 100644 index 0000000..79b1bde --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/transforms/object-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('transform:object', 'Unit | Transform | object', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + let transform = this.subject(); + assert.ok(transform); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/counter-column-definition-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/counter-column-definition-test.js b/tez-ui/src/main/webapp/tests/unit/utils/counter-column-definition-test.js new file mode 100644 index 0000000..9e0476f --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/counter-column-definition-test.js @@ -0,0 +1,124 @@ +/** + * 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 CounterColumnDefinition from '../../../utils/counter-column-definition'; +import { module, test } from 'qunit'; + +module('Unit | Utility | counter column definition'); + +test('Basic creation test', function(assert) { + let definition = CounterColumnDefinition.create(); + + assert.ok(definition); + + assert.ok(definition.getCellContent); + assert.ok(definition.getSearchValue); + assert.ok(definition.getSortValue); + + assert.ok(definition.id); + assert.ok(definition.groupDisplayName); + assert.ok(definition.headerTitle); + + assert.ok(CounterColumnDefinition.make); + + assert.equal(definition.observePath, true); + assert.equal(definition.contentPath, "counterGroupsHash"); +}); + +test('getCellContent, getSearchValue & getSortValue test', function(assert) { + let testGroupName = "t.gn", + testCounterName = "cn", + testCounterValue = "val", + testContent = {}, + testRow = { + counterGroupsHash: testContent + }; + + testContent[testGroupName] = {}; + testContent[testGroupName][testCounterName] = testCounterValue; + testContent[testGroupName]["anotherName"] = "anotherValue"; + + let definition = CounterColumnDefinition.create({ + counterGroupName: testGroupName, + counterName: testCounterName, + }); + + assert.equal(definition.getCellContent(testRow), testCounterValue); + assert.equal(definition.getSearchValue(testRow), testCounterValue); + assert.equal(definition.getSortValue(testRow), testCounterValue); +}); + +test('id test', function(assert) { + let testGroupName = "t.gn", + testCounterName = "cn"; + + let definition = CounterColumnDefinition.create({ + counterGroupName: testGroupName, + counterName: testCounterName, + }); + + assert.equal(definition.get("id"), `${testGroupName}/${testCounterName}`); +}); + +test('groupDisplayName test', function(assert) { + let definition = CounterColumnDefinition.create(); + + definition.set("counterGroupName", "foo"); + assert.equal(definition.get("groupDisplayName"), "foo"); + + definition.set("counterGroupName", "foo.bar"); + assert.equal(definition.get("groupDisplayName"), "bar"); + + definition.set("counterGroupName", "org.apache.tez.common.counters.DAGCounter"); + assert.equal(definition.get("groupDisplayName"), "DAG"); + + definition.set("counterGroupName", "org.apache.tez.common.counters.FileSystemCounter"); + assert.equal(definition.get("groupDisplayName"), "FileSystem"); + + definition.set("counterGroupName", "TaskCounter_ireduce1_INPUT_map"); + assert.equal(definition.get("groupDisplayName"), "Task - ireduce1 to Input-map"); + + definition.set("counterGroupName", "TaskCounter_ireduce1_OUTPUT_reduce"); + assert.equal(definition.get("groupDisplayName"), "Task - ireduce1 to Output-reduce"); +}); + +test('headerTitle test', function(assert) { + let testGroupName = "t.gn", + testCounterName = "cn"; + + let definition = CounterColumnDefinition.create({ + counterGroupName: testGroupName, + counterName: testCounterName, + }); + + assert.equal(definition.get("headerTitle"), "gn - cn"); +}); + +test('CounterColumnDefinition.make test', function(assert) { + var definitions = CounterColumnDefinition.make([{ + counterGroupName: "gn1", + counterName: "nm1", + }, { + counterGroupName: "gn2", + counterName: "nm2", + }]); + + assert.equal(definitions.length, 2); + assert.equal(definitions[0].get("headerTitle"), "gn1 - nm1"); + assert.equal(definitions[1].get("headerTitle"), "gn2 - nm2"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/download-dag-zip-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/download-dag-zip-test.js b/tez-ui/src/main/webapp/tests/unit/utils/download-dag-zip-test.js new file mode 100644 index 0000000..0fe8c5f --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/download-dag-zip-test.js @@ -0,0 +1,26 @@ +/** + * 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 downloadDagZip from '../../../utils/download-dag-zip'; +import { module, test } from 'qunit'; + +module('Unit | Utility | download dag zip'); + +test('Basic creation test', function(assert) { + assert.ok(downloadDagZip); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/misc-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/misc-test.js b/tez-ui/src/main/webapp/tests/unit/utils/misc-test.js new file mode 100644 index 0000000..7e282cd --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/misc-test.js @@ -0,0 +1,26 @@ +/** + * 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 isIOCounter from '../../../utils/misc'; +import { module, test } from 'qunit'; + +module('Unit | Utility | misc'); + +test('Basic creation test', function(assert) { + assert.ok(isIOCounter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/process-definition-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/process-definition-test.js b/tez-ui/src/main/webapp/tests/unit/utils/process-definition-test.js new file mode 100644 index 0000000..44e952e --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/process-definition-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 ProcessDefinition from '../../../utils/process-definition'; +import { module, test } from 'qunit'; + +module('Unit | Utility | process definition'); + +test('Basic creation test', function(assert) { + let definition = ProcessDefinition.create(); + + assert.ok(definition); + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/process-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/process-test.js b/tez-ui/src/main/webapp/tests/unit/utils/process-test.js new file mode 100644 index 0000000..5eb7a7d --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/process-test.js @@ -0,0 +1,165 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Process from '../../../utils/process'; +import { module, test } from 'qunit'; + +module('Unit | Utility | process'); + +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); + assert.ok(process.getAllBlockers); + 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(); + + assert.equal(process.getColor(), "#0"); + + process.set("color", { + h: 10, + s: 20, + l: 30 + }); + assert.equal(process.getColor(), "hsl( 10, 20%, 30% )"); + assert.equal(process.getColor(0.2), "hsl( 10, 20%, 40% )"); +}); + +test('startEvent test', function(assert) { + let process = Process.create(); + + assert.equal(process.get("startEvent"), undefined); + + process.set("events", [{ + time: 50, + }, { + time: 70, + }, { + time: 20, + }, { + time: 80, + }]); + assert.equal(process.get("startEvent").time, 20); + + process.set("events", [{ + time: 50, + }, { + time: 70, + }, { + time: 80, + }]); + assert.equal(process.get("startEvent").time, 50); +}); + +test('endEvent test', function(assert) { + let process = Process.create(); + + assert.equal(process.get("endEvent"), undefined); + + process.set("events", [{ + time: 50, + }, { + time: 70, + }, { + time: 20, + }, { + time: 80, + }]); + assert.equal(process.get("endEvent").time, 80); + + process.set("events", [{ + time: 50, + }, { + time: 70, + }, { + time: 20, + }]); + assert.equal(process.get("endEvent").time, 70); +}); + +test('getAllBlockers test', function(assert) { + var cyclicProcess = Process.create({ + name: "p3", + }); + cyclicProcess.blockers = [cyclicProcess]; + + var multiLevelCycle1 = Process.create({ + name: "p5", + }); + var multiLevelCycle2 = Process.create({ + name: "p6", + }); + multiLevelCycle1.blockers = [multiLevelCycle2]; + multiLevelCycle2.blockers = [multiLevelCycle1]; + + var process = Process.create({ + blockers: [Process.create({ + name: "p1" + }), Process.create({ + name: "p2", + blockers: [Process.create({ + name: "p21" + }), Process.create({ + name: "p22", + blockers: [Process.create({ + name: "p221" + })] + })] + }), cyclicProcess, Process.create({ + name: "p4" + }), multiLevelCycle1] + }); + + var all = process.getAllBlockers(); + + assert.equal(all.length, 9); + + assert.equal(all[0].get("name"), "p1"); + assert.equal(all[1].get("name"), "p2"); + assert.equal(all[2].get("name"), "p21"); + assert.equal(all[3].get("name"), "p22"); + assert.equal(all[4].get("name"), "p221"); + assert.equal(all[5].get("name"), "p3"); + assert.equal(all[6].get("name"), "p4"); + assert.equal(all[7].get("name"), "p5"); + assert.equal(all[8].get("name"), "p6"); + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/processor-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/processor-test.js b/tez-ui/src/main/webapp/tests/unit/utils/processor-test.js new file mode 100644 index 0000000..b2909b3 --- /dev/null +++ b/tez-ui/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/13132ec7/tez-ui/src/main/webapp/tests/unit/utils/vertex-process-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/utils/vertex-process-test.js b/tez-ui/src/main/webapp/tests/unit/utils/vertex-process-test.js new file mode 100644 index 0000000..3faa4fe --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/utils/vertex-process-test.js @@ -0,0 +1,265 @@ +/** + * 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 VertexProcess from '../../../utils/vertex-process'; +import { module, test } from 'qunit'; + +import Ember from 'ember'; + +module('Unit | Utility | vertex process'); + +test('Basic creation test', function(assert) { + let process = VertexProcess.create(); + + assert.ok(process); + + assert.ok(process.name); + assert.ok(process.completeTime); + assert.ok(process.blockingEventName); + + assert.ok(process.events); + assert.ok(process.eventBars); + assert.ok(process.unblockDetails); + + assert.ok(process.eventsHash); + assert.ok(process.getTooltipContents); + + assert.ok(process.consolidateStartTime); + assert.ok(process.consolidateEndTime); + assert.ok(process.getConsolidateColor); +}); + +test('unblockDetails test', function(assert) { + var process = VertexProcess.create(), + testEdge2 = {}, testEdge3 = {}, testEdge4 = {}; + assert.equal(process.get("unblockDetails"), undefined); + + process = VertexProcess.create({ + blockers: [VertexProcess.create({ + vertex: { + name: "v1", + endTime: 10 + } + }), VertexProcess.create({ + vertex: { + name: "v2", + endTime: 15 + } + }), VertexProcess.create({ + vertex: { + name: "v3", + endTime: 20 + } + })] + }); + process.get("edgeHash").setProperties({ + v2: testEdge2, + v3: testEdge3, + v4: testEdge4 + }); + + assert.equal(process.get("unblockDetails.edge"), testEdge3); + assert.equal(process.get("unblockDetails.time"), 20); + + process.blockers[2].set("vertex", Ember.Object.create({ + name: "v4", + endTime: 12 + })); + assert.equal(process.get("unblockDetails.edge"), testEdge2); + assert.equal(process.get("unblockDetails.time"), 15); + + process.blockers[2].vertex.set("endTime", 25); + assert.equal(process.get("unblockDetails.edge"), testEdge4); + assert.equal(process.get("unblockDetails.time"), 25); +}); + +test('events test', function(assert) { + var process = VertexProcess.create({ + vertex: Ember.Object.create({ + name: "v1", + events: [{ + eventtype: "testEvent1" + //No timestamp, will be removed + },{ + eventtype: "testEvent2", + timestamp: 10 + }], + initTime: 20, + startTime: 30, + firstTaskStartTime: 40, + lastTaskFinishTime: 50, + endTime: 60 + }) + }); + + 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"), "FIRST_TASK_STARTED"); + assert.equal(process.get("events.4.name"), "LAST_TASK_FINISHED"); + assert.equal(process.get("events.5.name"), "VERTEX_FINISHED"); + + 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: Ember.Object.create({ + name: "v2", + endTime: 30 + }) + })]); + assert.equal(process.get("events.length"), 6); + + process.set("blockers", [VertexProcess.create({ + vertex: Ember.Object.create({ + name: "v3", + 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) { + var process = VertexProcess.create(), + eventTooltip = process.getTooltipContents("event", { + events: [{ + name: "TestEventName1", + time: 10 + }, { + name: "TestEventName2", + time: 20, + info: { + inf1: "val1", + inf2: 30 + } + }, { + name: "TestEventName3", + time: 40, + edge: { + edgeId: "221296172", + inputVertexName: "Map 4", + outputVertexName: "Map 1", + dataMovementType: "BROADCAST", + dataSourceType: "PERSISTED", + schedulingType: "SEQUENTIAL", + edgeSourceClass: "org.apache.tez.runtime.library.output.UnorderedKVOutput", + edgeDestinationClass: "org.apache.tez.runtime.library.input.UnorderedKVInput" + } + }] + }); + + assert.equal(eventTooltip.length, 4); + + 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"); + + assert.equal(eventTooltip[2].title, "TestEventName3"); + assert.equal(eventTooltip[2].properties.length, 1); + assert.equal(eventTooltip[2].properties[0].name, "Time"); + assert.equal(eventTooltip[2].properties[0].value, 40); + assert.equal(eventTooltip[2].properties[0].type, "date"); + + assert.equal(eventTooltip[3].title, "Edge From Final Dependent Vertex"); + assert.equal(eventTooltip[3].properties.length, 7); + assert.equal(eventTooltip[3].properties[0].name, "Input Vertex"); + assert.equal(eventTooltip[3].properties[0].value, "Map 4"); + assert.equal(eventTooltip[3].properties[1].name, "Output Vertex"); + assert.equal(eventTooltip[3].properties[1].value, "Map 1"); + assert.equal(eventTooltip[3].properties[2].name, "Data Movement"); + assert.equal(eventTooltip[3].properties[2].value, "BROADCAST"); + assert.equal(eventTooltip[3].properties[3].name, "Data Source"); + assert.equal(eventTooltip[3].properties[3].value, "PERSISTED"); + assert.equal(eventTooltip[3].properties[4].name, "Scheduling"); + assert.equal(eventTooltip[3].properties[4].value, "SEQUENTIAL"); + assert.equal(eventTooltip[3].properties[5].name, "Source Class"); + assert.equal(eventTooltip[3].properties[5].value, "UnorderedKVOutput"); + assert.equal(eventTooltip[3].properties[6].name, "Destination Class"); + assert.equal(eventTooltip[3].properties[6].value, "UnorderedKVInput"); +}); + +test('getTooltipContents-process test', function(assert) { + var process = VertexProcess.create({ + name: "TestName", + vertex: Ember.Object.create({ + prop1: "val1", + prop2: "val2", + prop3: "val3" + }), + getVisibleProps: function () { + return [Ember.Object.create({ + id: "prop1", + headerTitle: "Prop 1", + contentPath: "prop1" + }), Ember.Object.create({ + id: "prop2", + headerTitle: "Prop 2", + contentPath: "prop2" + })]; + } + }); + + var processTooltip = process.getTooltipContents("event-bar")[0]; + assert.equal(processTooltip.title, "TestName"); + + assert.equal(processTooltip.properties.length, 2); + + assert.equal(processTooltip.properties[0].name, "Prop 1"); + assert.equal(processTooltip.properties[0].value, "val1"); + + assert.equal(processTooltip.properties[1].name, "Prop 2"); + assert.equal(processTooltip.properties[1].value, "val2"); + + processTooltip = process.getTooltipContents("process-line")[0]; + assert.equal(processTooltip.title, "TestName"); + + assert.equal(processTooltip.properties.length, 2); + + assert.equal(processTooltip.properties[0].name, "Prop 1"); + assert.equal(processTooltip.properties[0].value, "val1"); + + assert.equal(processTooltip.properties[1].name, "Prop 2"); + assert.equal(processTooltip.properties[1].value, "val2"); + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/tools/server/nodejs_conf.json ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/nodejs_conf.json b/tez-ui/tools/server/nodejs_conf.json deleted file mode 100644 index a84b569..0000000 --- a/tez-ui/tools/server/nodejs_conf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "UI_Dir" : "./public", - "port" : 8080 -} http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/tools/server/nodejs_webserver.js ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/nodejs_webserver.js b/tez-ui/tools/server/nodejs_webserver.js deleted file mode 100644 index 8cd1975..0000000 --- a/tez-ui/tools/server/nodejs_webserver.js +++ /dev/null @@ -1,32 +0,0 @@ -/**** - Licensed 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. See accompanying LICENSE file. -****/ - -var express = require('express') -var config = require('jsonconfig') -var app = express() -var path, port; -try { - config.load(['./nodejs_conf.json']) - path = config.UI_Dir || './public'; - port = config.port || 8080; -} catch(err) { - process.stdout.write("err: " + err); - path = './public'; - port = 8080; -} -app.use('/',express.static(path)) -app.listen(port); -process.stdout.write("TEZ-UI server started on port " + port + - "\n" + "Use CTRL+C to shutdown"); - http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/tools/server/package.json ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/package.json b/tez-ui/tools/server/package.json deleted file mode 100644 index 91cf0fb..0000000 --- a/tez-ui/tools/server/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "express_server", - "version": "0.0.1", - "dependencies": { - "express": "4.12.1", - "jsonconfig": "0.3.0" - } -} http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui2/README.md ---------------------------------------------------------------------- diff --git a/tez-ui2/README.md b/tez-ui2/README.md deleted file mode 100644 index f8985fe..0000000 --- a/tez-ui2/README.md +++ /dev/null @@ -1,89 +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. ---> - -# Tez-ui - -The Tez UI is an ember based web-app that provides visualization of Tez applications running on the Apache Hadoop YARN framework. - -For more information on Tez and the Tez UI - Check the [Tez homepage](http://tez.apache.org/ "Apache Tez Homepage"). - -## Configurations - -### In tez-site.xml - * `tez.runtime.convert.user-payload.to.history-text` : Should be enabled to get the configuration options in. If enabled, the config options are set as userpayload per input/output. - -### In yarn-site.xml - * `yarn.timeline-service.http-cross-origin.enabled` : Enable CORS in timeline. - * `yarn.resourcemanager.system-metrics-publisher.enabled` : Enable generic history service in timeline server - * `yarn.timeline-service.enabled` : Enabled the timeline server for logging details - * `yarn.timeline-service.webapp.address` : Value must be the IP:PORT on which timeline server is running - -### In configs.env - This environment configuration file can be found at `./src/main/webapp/config/configs.env` - - * `ENV.hosts.timeline` : Timeline Server Address. By default TEZ UI looks for timeline server at http://localhost:8188. - * `ENV.hosts.rm` : Resource Manager Address. By default RM REST APIs are expected to be at http://localhost:8088. - * `ENV.hosts.rmProxy` : This is options. Value configured as RM host will be taken as proxy address by default. Use this configuration when RM web proxy is configured at a different address than RM. - * `ENV.timeZone` : Time Zone in which dates are displayed in the UI. If not set, local time zone will be used. Refer http://momentjs.com/timezone/docs/ for valid entries. - -## Package & deploy - -### Get war package - * Tez UI is distributed as a war package. - * To build & package UI without running test cases, run `mvn clean package -DskipTests` in this directory. - * This would give you a war file in `./target`. - * UI build is part of tez build, refer BUILDING.txt for more info. - -### Using UI war -##### Remotely: - Use webfront tomcat manager to upload & deploy your war remotely. -##### Manually: - The war can be added to any tomcat instance. - 1. Remove any old deployments in `$TOMCAT_HOME/webapps` - 2. Copy the war to `$TOMCAT_HOME/webapps` - 3. Restart tomcat and the war will get deployed. The content of the war would be available in - `$TOMCAT_HOME/webapps/tez-ui-[version]` directory. - -## Development - -All the following commands must be run inside `src/main/webapp`. - -### Prerequisites - -You will need the following things properly installed on your computer. - -* Install [Node.js](http://nodejs.org/) (with NPM) -* Install [Bower](http://bower.io/) -* Install all dependencies by running `npm install` & `bower install` - -### Running UI - -* `npm start` -* Visit your app at [http://localhost:4200](http://localhost:4200). - -### Running Tests - -* `npm test` - -### Building - -* `npm run build` (production) -* Files would be stored in "dist/" - -### Adding new routes (pages), controllers, components etc. - -* Use ember-cli blueprint generator - [Ember CLI](http://ember-cli.com/extending/#generators-and-blueprints) http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui2/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/tez-ui2/findbugs-exclude.xml b/tez-ui2/findbugs-exclude.xml deleted file mode 100644 index 5b11308..0000000 --- a/tez-ui2/findbugs-exclude.xml +++ /dev/null @@ -1,16 +0,0 @@ -<!-- - Licensed 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. See accompanying LICENSE file. ---> -<FindBugsFilter> - -</FindBugsFilter> http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui2/pom.xml ---------------------------------------------------------------------- diff --git a/tez-ui2/pom.xml b/tez-ui2/pom.xml deleted file mode 100644 index 62c480c..0000000 --- a/tez-ui2/pom.xml +++ /dev/null @@ -1,229 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tez</groupId> - <artifactId>tez</artifactId> - <version>0.9.0-SNAPSHOT</version> - </parent> - <artifactId>tez-ui2</artifactId> - <packaging>war</packaging> - - <properties> - <webappDir>src/main/webapp</webappDir> - <node.executable>${basedir}/src/main/webapp/node/node</node.executable> - <nodeVersion>v0.12.2</nodeVersion> - <npmVersion>2.15.3</npmVersion> - <skipTests>false</skipTests> - </properties> - - <profiles> - <profile> - <id>cleanUICache</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <filesets> - <fileset> - <directory>${webappDir}/tmp</directory> - </fileset> - <fileset> - <directory>${webappDir}/node</directory> - </fileset> - <fileset> - <directory>${webappDir}/node_modules</directory> - </fileset> - <fileset> - <directory>${webappDir}/bower_components</directory> - </fileset> - </filesets> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <build> - <plugins> - - <!-- Apache RAT --> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes> - <exclude>src/main/webapp/node/**/*</exclude> - <exclude>src/main/webapp/node_modules/**/*</exclude> - <exclude>src/main/webapp/bower_components/**/*</exclude> - <exclude>src/main/webapp/.tmp/**/*</exclude> - <exclude>src/main/webapp/dist/**/*</exclude> - <exclude>src/main/webapp/tmp/**/*</exclude> - <exclude>src/main/webapp/.bowerrc</exclude> - <exclude>src/main/webapp/.editorconfig</exclude> - <exclude>src/main/webapp/.ember-cli</exclude> - <exclude>src/main/webapp/.gitignore</exclude> - <exclude>src/main/webapp/.jshintrc</exclude> - <exclude>src/main/webapp/tests/.jshintrc</exclude> - <exclude>src/main/webapp/blueprints/.jshintrc</exclude> - <exclude>src/main/webapp/.travis.yml</exclude> - <exclude>src/main/webapp/.watchmanconfig</exclude> - <exclude>src/main/webapp/bower.json</exclude> - <exclude>src/main/webapp/ember-cli-build.js</exclude> - <exclude>src/main/webapp/package.json</exclude> - <exclude>src/main/webapp/testem.json</exclude> - <exclude>src/main/webapp/public/assets/images/*</exclude> - <exclude>src/main/webapp/WEB-INF/wro.xml</exclude> - </excludes> - </configuration> - </plugin> - - <!-- Install Node & dependencies --> - <plugin> - <groupId>com.github.eirslett</groupId> - <artifactId>frontend-maven-plugin</artifactId> - <configuration> - <workingDirectory>${webappDir}</workingDirectory> - </configuration> - <executions> - <execution> - <phase>generate-resources</phase> - <id>install node and npm</id> - <goals> - <goal>install-node-and-npm</goal> - </goals> - <configuration> - <nodeVersion>${nodeVersion}</nodeVersion> - <npmVersion>${npmVersion}</npmVersion> - </configuration> - </execution> - <execution> - <phase>generate-resources</phase> - <id>npm install</id> - <goals> - <goal>npm</goal> - </goals> - </execution> - <execution> - <phase>generate-resources</phase> - <id>bower install</id> - <goals> - <goal>bower</goal> - </goals> - </execution> - </executions> - </plugin> - - <!-- Build & Test --> - <plugin> - <artifactId>exec-maven-plugin</artifactId> - <groupId>org.codehaus.mojo</groupId> - <executions> - <execution> - <id>ember build</id> - <phase>generate-resources</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <workingDirectory>${webappDir}</workingDirectory> - <executable>${node.executable}</executable> - <arguments> - <argument>node/npm/bin/npm-cli</argument> - <argument>run</argument> - <argument>build:mvn</argument> - </arguments> - </configuration> - </execution> - <execution> - <id>ember test</id> - <phase>test</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - <workingDirectory>${webappDir}</workingDirectory> - <executable>${node.executable}</executable> - <arguments> - <argument>node/npm/bin/npm-cli</argument> - <argument>run</argument> - <argument>test:mvn</argument> - </arguments> - </configuration> - </execution> - </executions> - </plugin> - - <!-- Asset minifier --> - <plugin> - <groupId>ro.isdc.wro4j</groupId> - <artifactId>wro4j-maven-plugin</artifactId> - <executions> - <execution> - <phase>prepare-package</phase> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - <configuration> - <minimize>true</minimize> - <targetGroups>tez-ui,vendor</targetGroups> - <destinationFolder>${basedir}/target/minified-resources/assets</destinationFolder> - <contextFolder>${webappDir}/dist/assets</contextFolder> - <wroFile>${basedir}/src/main/webapp/WEB-INF/wro.xml</wroFile> - </configuration> - </plugin> - - <!-- Package into war --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - </execution> - </executions> - <configuration> - <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml> - <warSourceDirectory>${webappDir}/dist</warSourceDirectory> - <webResources> - <resource> - <filtering>false</filtering> - <directory>${basedir}/src/main/resources/</directory> - </resource> - <resource> - <filtering>false</filtering> - <directory>${basedir}/target/minified-resources</directory> - </resource> - </webResources> - </configuration> - </plugin> - - </plugins> - </build> -</project>
