Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8E461200B8B for ; Tue, 4 Oct 2016 17:19:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8CB5B160AE8; Tue, 4 Oct 2016 15:19:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8C614160AC5 for ; Tue, 4 Oct 2016 17:19:47 +0200 (CEST) Received: (qmail 92885 invoked by uid 500); 4 Oct 2016 15:19:34 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 91722 invoked by uid 99); 4 Oct 2016 15:19:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2016 15:19:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 25011E0BAB; Tue, 4 Oct 2016 15:19:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sunilg@apache.org To: common-commits@hadoop.apache.org Date: Tue, 04 Oct 2016 15:20:00 -0000 Message-Id: In-Reply-To: <7aa768277f3d45a69b008279a5859def@git.apache.org> References: <7aa768277f3d45a69b008279a5859def@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [29/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup code base, integrate web UI related build to mvn, and fix licenses. (wangda) archived-at: Tue, 04 Oct 2016 15:19:49 -0000 http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs new file mode 100644 index 0000000..ca80ccd --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs @@ -0,0 +1,58 @@ +{{!-- + 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. +--}} + +
+
+ {{node-menu path="yarnNodeContainers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}} +
+ + + + + + + + + + + {{#if model.containers}} + {{#each model.containers as |container|}} + {{#if container.isDummyContainer}} + + {{else}} + + + + + + + {{/if}} + {{/each}} + {{/if}} + +
Container IDContainer StateUserLogs
No containers found on this node
{{container.containerId}}{{container.state}}{{container.user}} + {{log-files-comma nodeId=model.nodeInfo.id + nodeAddr=model.nodeInfo.addr + containerId=container.containerId + logFiles=container.containerLogFiles}} +
+ {{simple-table table-id="node-containers-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}} +
+
+
+{{outlet}} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs new file mode 100644 index 0000000..a036076 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs @@ -0,0 +1,94 @@ +{{!-- + 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. +--}} + +
+
+ {{node-menu path="yarnNode" nodeId=model.rmNode.id nodeAddr=model.node.id}} +
+
+
Node Information
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Vmem allocated for Containers{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB
Vmem enforcement enabled{{model.node.vmemCheckEnabled}}
Total Pmem allocated for Containers{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB
Pmem enforcement enabled{{model.node.pmemCheckEnabled}}
Total VCores allocated for Containers{{model.node.totalVCoresAllocatedContainers}}
Node Healthy Status{{model.node.nodeHealthy}}
Last Node Health Report Time{{model.node.lastNodeUpdateTime}}
Node Health Report{{model.node.healthReport}}
Node Manager Start Time{{model.node.nmStartupTime}}
Node Manager Version{{model.node.nodeManagerBuildVersion}}
Hadoop Version{{model.node.hadoopBuildVersion}}
+
+
+ {{donut-chart data=model.rmNode.getMemoryDataForDonutChart + title="Resource - Memory (in MB)" + showLabels=true + parentId="mem-donut-chart" + ratio=0.55 + maxHeight=350}} +
+ +
+ {{donut-chart data=model.rmNode.getVCoreDataForDonutChart + title="Resource - VCores" + showLabels=true + parentId="vcore-donut-chart" + ratio=0.55 + maxHeight=350}} +
+
+
+
+{{outlet}} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs new file mode 100644 index 0000000..bf2a098 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs @@ -0,0 +1,65 @@ +{{!-- + 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. +--}} + + + + + + + + + + + + + + + + + + + + + {{#if model}} + {{#each model as |node|}} + {{#if node.isDummyNode}} + + {{else}} + + + + + + {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}} + + + + + + + + + + {{/if}} + {{/each}} + {{/if}} + +
Node LabelsRackNode StateNode AddressNode HTTP AddressLast Health UpdateHealth-ReportContainersMem UsedMem AvailVCores UsedVCores AvailVersion
No nodes found on this cluster
{{node.nodeLabelsAsString}}{{node.rack}}{{node.state}}{{node.id}}{{node.lastHealthUpdate}}{{node.healthReport}}{{node.numContainers}}{{divide num=node.usedMemoryMB den=1024}} GB{{divide num=node.availMemoryMB den=1024}} GB{{node.usedVirtualCores}}{{node.availableVirtualCores}}{{node.version}}
+ +{{simple-table table-id="nodes-table" bFilter=true}} +{{outlet}} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs new file mode 100644 index 0000000..51a4fb4 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs @@ -0,0 +1,66 @@ +{{! + * 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. +}} + +
+ {{queue-navigator model=model.queues selected=model.selected}} +
+ +
+
+ {{queue-configuration-table queue=model.selectedQueue}} +
+ +
+ {{bar-chart data=model.selectedQueue.capacitiesBarChartData + title="Queue Capacities" + parentId="capacity-bar-chart" + textWidth=150 + ratio=0.5 + maxHeight=350}} +
+ +{{#if model.selectedQueue.hasUserUsages}} +
+ {{donut-chart data=model.selectedQueue.userUsagesDonutChartData + title="User Usages" + showLabels=true + parentId="userusage-donut-chart" + maxHeight=350}} +
+{{/if}} + +
+ {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData + title="Running Apps" + showLabels=true + parentId="numapplications-donut-chart" + ratio=0.5 + maxHeight=350}} +
+
+ +
+ +
+
+ {{app-table table-id="apps-table" arr=model.apps}} + {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}} +
+
+ +{{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js new file mode 100644 index 0000000..fd8f491 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js @@ -0,0 +1,109 @@ +/** + * 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 Constants from 'yarn-ui/constants'; + +export default { + containerIdToAttemptId: function(containerId) { + if (containerId) { + var arr = containerId.split('_'); + var attemptId = ["appattempt", arr[1], + arr[2], this.padding(arr[3], 6)]; + return attemptId.join('_'); + } + }, + attemptIdToAppId: function(attemptId) { + if (attemptId) { + var arr = attemptId.split('_'); + var appId = ["application", arr[1], + arr[2]].join('_'); + return appId; + } + }, + padding: function(str, toLen=2) { + str = str.toString(); + if (str.length >= toLen) { + return str; + } + return '0'.repeat(toLen - str.length) + str; + }, + resourceToString: function(mem, cpu) { + mem = Math.max(0, mem); + cpu = Math.max(0, cpu); + return mem + " MBs, " + cpu + " VCores"; + }, + msToElapsedTime: function(timeInMs) { + var sec_num = timeInMs / 1000; // don't forget the second param + var hours = Math.floor(sec_num / 3600); + var minutes = Math.floor((sec_num - (hours * 3600)) / 60); + var seconds = sec_num - (hours * 3600) - (minutes * 60); + + var timeStrArr = []; + + if (hours > 0) { + timeStrArr.push(hours + ' Hrs'); + } + if (minutes > 0) { + timeStrArr.push(minutes + ' Mins'); + } + if (seconds > 0) { + timeStrArr.push(Math.round(seconds) + " Secs"); + } + return timeStrArr.join(' : '); + }, + elapsedTimeToMs: function(elapsedTime) { + elapsedTime = elapsedTime.toLowerCase(); + var arr = elapsedTime.split(' : '); + var total = 0; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('hr') > 0) { + total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 3600; + } else if (arr[i].indexOf('min') > 0) { + total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 60; + } else if (arr[i].indexOf('sec') > 0) { + total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))); + } + } + return total * 1000; + }, + timeStampToDate: function(timeStamp) { + var dateTimeString = moment(parseInt(timeStamp)).format("YYYY/MM/DD HH:mm:ss"); + return dateTimeString; + }, + dateToTimeStamp: function(date) { + if (date) { + var ts = moment(date, "YYYY/MM/DD HH:mm:ss").valueOf(); + return ts; + } + }, + splitForContainerLogs: function(id) { + if (id) { + var splits = id.split(Constants.PARAM_SEPARATOR); + var splitLen = splits.length; + if (splitLen < 3) { + return null; + } + var fileName = splits[2]; + var index; + for (index = 3; index < splitLen; index++) { + fileName = fileName + Constants.PARAM_SEPARATOR + splits[index]; + } + return [splits[0], splits[1], fileName]; + } + }, +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js new file mode 100644 index 0000000..febef6f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js @@ -0,0 +1,73 @@ +/** + * 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 Converter from 'yarn-ui/utils/converter'; +import Ember from 'ember'; + +export default { + _initElapsedTimeSorter: function() { + Ember.$.extend(Ember.$.fn.dataTableExt.oSort, { + "elapsed-time-pre": function (a) { + return Converter.padding(Converter.elapsedTimeToMs(a), 20); + }, + }); + }, + + _initNaturalSorter: function() { + Ember.$.extend(Ember.$.fn.dataTableExt.oSort, { + "natural-asc": function (a, b) { + return naturalSort(a,b); + }, + "natural-desc": function (a, b) { + return naturalSort(a,b) * -1; + }, + }); + }, + + initDataTableSorter: function() { + this._initElapsedTimeSorter(); + this._initNaturalSorter(); + }, +}; + +/** + * Natural sort implementation. + * Typically used to sort application Ids'. + */ +function naturalSort(a, b) { + var diff = a.length - b.length; + if (diff != 0) { + var splitA = a.split("_"); + var splitB = b.split("_"); + if (splitA.length != splitB.length) { + return a.localeCompare(b); + } + for (var i = 1; i < splitA.length; i++) { + var splitdiff = splitA[i].length - splitB[i].length; + if (splitdiff != 0) { + return splitdiff; + } + var splitCompare = splitA[i].localeCompare(splitB[i]); + if (splitCompare != 0) { + return splitCompare; + } + } + return diff; + } + return a.localeCompare(b); +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json new file mode 100644 index 0000000..de66650 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json @@ -0,0 +1,22 @@ +{ + "name": "yarn-ui", + "dependencies": { + "ember": "2.0.1", + "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4", + "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", + "ember-data": "2.0.0", + "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6", + "ember-qunit": "0.4.9", + "ember-qunit-notifications": "0.0.7", + "ember-resolver": "~0.1.18", + "jquery": "1.11.3", + "loader.js": "ember-cli/loader.js#3.2.1", + "qunit": "~1.18.0", + "bootstrap": "~3.3.2", + "d3": "~3.5.6", + "datatables": "~1.10.8", + "spin.js": "~2.3.2", + "momentjs": "~2.10.6", + "select2": "4.0.0" + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js new file mode 100644 index 0000000..9a14068 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js @@ -0,0 +1,65 @@ +/** + * 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. + */ + +/* jshint node: true */ + +module.exports = function(environment) { + var ENV = { + modulePrefix: 'yarn-ui', + environment: environment, + baseURL: '/', + locationType: 'auto', + EmberENV: { + FEATURES: { + // Here you can enable experimental features on an ember canary build + // e.g. 'with-controller': true + } + }, + + APP: { + // Here you can pass flags/options to your application instance + // when it is created + } + }; + + if (environment === 'development') { + // ENV.APP.LOG_RESOLVER = true; + // ENV.APP.LOG_ACTIVE_GENERATION = true; + // ENV.APP.LOG_TRANSITIONS = true; + // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; + // ENV.APP.LOG_VIEW_LOOKUPS = true; + } + + if (environment === 'test') { + // Testem prefers this... + ENV.baseURL = '/'; + ENV.locationType = 'none'; + + // keep test console output quieter + ENV.APP.LOG_ACTIVE_GENERATION = false; + ENV.APP.LOG_VIEW_LOOKUPS = false; + + ENV.APP.rootElement = '#ember-testing'; + } + + if (environment === 'production') { + + } + + return ENV; +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js new file mode 100644 index 0000000..cf5ad83 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js @@ -0,0 +1,47 @@ +/** + * 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. + */ + +/* global require, module */ +var EmberApp = require('ember-cli/lib/broccoli/ember-app'); + +module.exports = function(defaults) { + var app = new EmberApp(defaults, { + // Add options here + }); + + app.import("bower_components/datatables/media/css/jquery.dataTables.min.css"); + app.import("bower_components/datatables/media/js/jquery.dataTables.min.js"); + app.import("bower_components/momentjs/min/moment.min.js"); + app.import("bower_components/select2/dist/css/select2.min.css"); + app.import("bower_components/select2/dist/js/select2.min.js"); + + // Use `app.import` to add additional libraries to the generated + // output files. + // + // If you need to use different assets in different + // environments, specify an object as the first parameter. That + // object's keys should be the environment name and the values + // should be the asset to use in that environment. + // + // If the library that you are including contains AMD or ES6 + // modules that you would like to import into your application + // please specify an object with the list of modules as keys + // along with the exports of each module as its value. + + return app.toTree(); +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json new file mode 100644 index 0000000..875bb90 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs" + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json new file mode 100644 index 0000000..b52ac1d --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json @@ -0,0 +1,44 @@ +{ + "name": "yarn-ui", + "version": "0.0.1", + "description": "New UI framework of Apache Hadoop YARN", + "private": true, + "directories": { + "doc": "doc", + "test": "tests" + }, + "scripts": { + "build": "ember build", + "start": "ember server", + "test": "ember test" + }, + "repository": "", + "engines": { + "node": ">= 0.10.0" + }, + "author": "", + "license": "Apache", + "devDependencies": { + "broccoli-asset-rev": "^2.1.2", + "ember-bootstrap": "0.2.0", + "ember-cli": "1.13.8", + "ember-cli-app-version": "0.5.0", + "ember-cli-babel": "^5.1.3", + "ember-cli-content-security-policy": "0.4.0", + "ember-cli-dependency-checker": "^1.0.1", + "ember-cli-htmlbars": "0.7.9", + "ember-cli-htmlbars-inline-precompile": "^0.2.0", + "ember-cli-ic-ajax": "0.2.1", + "ember-cli-inject-live-reload": "^1.3.1", + "ember-cli-qunit": "^1.0.0", + "ember-cli-release": "0.2.3", + "ember-cli-sri": "^1.0.3", + "ember-cli-uglify": "^1.2.0", + "ember-d3": "0.1.0", + "ember-data": "1.13.8", + "ember-disable-proxy-controllers": "^1.0.0", + "ember-export-application-global": "^1.0.3", + "ember-spin-spinner": "0.2.3", + "select2": "4.0.0" + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd new file mode 100644 index 0000000..53b2e06 Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico new file mode 100644 index 0000000..6eeaa2a Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png new file mode 100644 index 0000000..e1ba61a Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png new file mode 100644 index 0000000..fb11dfe Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png new file mode 100644 index 0000000..af5bc7c Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png new file mode 100644 index 0000000..0e156de Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png new file mode 100644 index 0000000..c9fdd8a Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png differ http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml new file mode 100644 index 0000000..43a2ea6 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json new file mode 100644 index 0000000..0f35392 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json @@ -0,0 +1,12 @@ +{ + "framework": "qunit", + "test_page": "tests/index.html?hidepassed", + "disable_watching": true, + "launch_in_ci": [ + "PhantomJS" + ], + "launch_in_dev": [ + "PhantomJS", + "Chrome" + ] +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js new file mode 100644 index 0000000..f94998c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.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 Resolver from 'ember/resolver'; +import config from '../../config/environment'; + +var resolver = Resolver.create(); + +resolver.namespace = { + modulePrefix: config.modulePrefix, + podModulePrefix: config.podModulePrefix +}; + +export default resolver; http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js new file mode 100644 index 0000000..a7d05be --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; +import Application from '../../app'; +import config from '../../config/environment'; + +export default function startApp(attrs) { + var application; + + var attributes = Ember.merge({}, config.APP); + attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; + + Ember.run(function() { + application = Application.create(attributes); + application.setupForTesting(); + application.injectTestHelpers(); + }); + + return application; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html new file mode 100644 index 0000000..9681e8b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html @@ -0,0 +1,51 @@ + + + + + + + + YarnUi Tests + + + + {{content-for 'head'}} + {{content-for 'test-head'}} + + + + + + {{content-for 'head-footer'}} + {{content-for 'test-head-footer'}} + + + + {{content-for 'body'}} + {{content-for 'test-body'}} + + + + + + + {{content-for 'body-footer'}} + {{content-for 'test-body-footer'}} + + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js new file mode 100644 index 0000000..96975ee --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js @@ -0,0 +1,24 @@ +/** + * 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 resolver from './helpers/resolver'; +import { + setResolver +} from 'ember-qunit'; + +setResolver(resolver); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js new file mode 100644 index 0000000..726345f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-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('adapter:yarn-app', 'Unit | Adapter | yarn app', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + var adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js new file mode 100644 index 0000000..e6e7b43 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js @@ -0,0 +1,73 @@ +/** + * 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 Constants from 'yarn-ui/constants'; + +moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', { +}); + +test('Basic creation', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.urlForFindRecord); + assert.ok(adapter.ajax); + assert.ok(adapter.headers); + assert.ok(adapter.host); + assert.ok(adapter.namespace); + assert.equal(adapter.headers.Accept, "text/plain"); + assert.equal(adapter.namespace, "ws/v1/node"); +}); + +test('urlForFindRecord test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(adapter.urlForFindRecord("localhost:8042" + + Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" + + Constants.PARAM_SEPARATOR + "syslog"), + host + "localhost:8042/ws/v1/node/containerlogs/" + + "container_e27_11111111111_0001_01_000001/syslog"); +}); + +test('ajaxOptions test', function(assert) { + let adapter = this.subject(); + var hash = adapter.ajaxOptions('/containerlogs', 'type', {}); + assert.equal(hash.dataType, 'text'); +}); + +test('findRecord test', function(assert) { + let adapter = this.subject(), + testModel = { modelName: "testModel" }, + testStore = {}, + testSnapshot = {}; + let host = adapter.host; + let testId = "localhost:8042" + Constants.PARAM_SEPARATOR + + "container_e27_11111111111_0001_01_000001" + Constants.PARAM_SEPARATOR + + "syslog"; + assert.expect(2); + + adapter.ajax = function (url, method) { + assert.equal(url, host + "localhost:8042/ws/v1/node/containerlogs/" + + "container_e27_11111111111_0001_01_000001/syslog"); + assert.equal(method, 'GET'); + }; + + adapter.findRecord(testStore, testModel, testId, testSnapshot); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js new file mode 100644 index 0000000..3a25996 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js @@ -0,0 +1,93 @@ +/** + * 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('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', { +}); + +test('Basic creation', function(assert) { + let adapter = this.subject(); + assert.expect(11); + assert.ok(adapter); + assert.ok(adapter.urlForQueryRecord); + assert.ok(adapter.queryRecord); + assert.ok(adapter.urlForQuery); + assert.ok(adapter.query); + assert.ok(adapter.ajax); + assert.ok(adapter.headers); + assert.ok(adapter.host); + assert.ok(adapter.namespace); + assert.equal("application/json", adapter.headers.Accept); + assert.equal("ws/v1/node", adapter.namespace); +}); + +test('urlForQueryRecord test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal( + host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111", + adapter.urlForQueryRecord( + {nodeAddr: "localhost:8042", appId: "application_1111111111_1111"})); +}); + +test('urlForQuery test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(host + "localhost:8042/ws/v1/node/apps", + adapter.urlForQuery({nodeAddr: "localhost:8042"})); +}); + +test('query test', function(assert) { + let adapter = this.subject(), + testModel = { modelName: "testModel" }, + testStore = {}, + testQuery = {nodeAddr: "localhost:8042"}; + let host = adapter.host; + assert.expect(3); + + adapter.ajax = function (url, method, hash) { + assert.equal(host + "localhost:8042/ws/v1/node/apps", url); + assert.equal('GET', method); + assert.equal(null, hash.data); + }; + + adapter.query(testStore, testModel, testQuery); +}); + +test('queryRecord test', function(assert) { + let adapter = this.subject(), + testModel = { modelName: "testModel" }, + testStore = {}, + testQuery = { + nodeAddr: "localhost:8042", + appId: "application_1111111111_1111" + }; + let host = adapter.host; + assert.expect(3); + + adapter.ajax = function (url, method, hash) { + assert.equal( + host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111", + url); + assert.equal('GET', method); + assert.equal(null, hash.data); + }; + + adapter.queryRecord(testStore, testModel, testQuery); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js new file mode 100644 index 0000000..7d2bb2d --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js @@ -0,0 +1,93 @@ +/** + * 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('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', { +}); + +test('Basic creation', function(assert) { + let adapter = this.subject(); + assert.expect(11); + assert.ok(adapter); + assert.ok(adapter.urlForQueryRecord); + assert.ok(adapter.queryRecord); + assert.ok(adapter.urlForQuery); + assert.ok(adapter.query); + assert.ok(adapter.ajax); + assert.ok(adapter.headers); + assert.ok(adapter.host); + assert.ok(adapter.namespace); + assert.equal("application/json", adapter.headers.Accept); + assert.equal("ws/v1/node", adapter.namespace); +}); + +test('urlForQueryRecord test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(host + "localhost:8042/ws/v1/node/containers/" + + "container_e27_11111111111_0001_01_000001", + adapter.urlForQueryRecord( + {nodeHttpAddr: "localhost:8042", + containerId: "container_e27_11111111111_0001_01_000001"})); +}); + +test('urlForQuery test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(host + "localhost:8042/ws/v1/node/containers", + adapter.urlForQuery({nodeHttpAddr: "localhost:8042"})); +}); + +test('query test', function(assert) { + let adapter = this.subject(), + testModel = { modelName: "testModel" }, + testStore = {}, + testQuery = {nodeHttpAddr: "localhost:8042"}; + let host = adapter.host; + assert.expect(3); + + adapter.ajax = function (url, method, hash) { + assert.equal(host + "localhost:8042/ws/v1/node/containers", url); + assert.equal('GET', method); + assert.equal(null, hash.data); + }; + + adapter.query(testStore, testModel, testQuery); +}); + +test('queryRecord test', function(assert) { + let adapter = this.subject(), + testModel = { modelName: "testModel" }, + testStore = {}, + testQuery = { + nodeHttpAddr: "localhost:8042", + containerId: "container_e27_11111111111_0001_01_000001" + }; + let host = adapter.host; + assert.expect(3); + + adapter.ajax = function (url, method, hash) { + assert.equal(host + "localhost:8042/ws/v1/node/containers/" + + "container_e27_11111111111_0001_01_000001", url); + assert.equal('GET', method); + assert.equal(null, hash.data); + }; + + adapter.queryRecord(testStore, testModel, testQuery); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js new file mode 100644 index 0000000..15aefef --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-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('adapter:yarn-node', 'Unit | Adapter | Node', { +}); + +test('Basic creation', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.urlForFindRecord); + assert.ok(adapter.ajax); + assert.ok(adapter.headers); + assert.ok(adapter.host); + assert.ok(adapter.namespace); + assert.equal(adapter.headers.Accept, "application/json"); + assert.equal(adapter.namespace, "ws/v1/node"); +}); + +test('urlForFindRecord test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(adapter.urlForFindRecord("localhost:8042"), + host + "localhost:8042/ws/v1/node"); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js new file mode 100644 index 0000000..bf009d4 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js @@ -0,0 +1,44 @@ +/** + * 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('adapter:yarn-rm-node', 'Unit | Adapter | RMNode', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.ok(adapter.urlForFindRecord); + assert.ok(adapter.ajax); + assert.ok(adapter.headers); + assert.ok(adapter.host); + assert.ok(adapter.namespace); + assert.equal(adapter.headers.Accept, "application/json"); + assert.equal(adapter.namespace, "ws/v1/cluster"); +}); + +test('urlForFindRecord test', function(assert) { + let adapter = this.subject(); + let host = adapter.host; + assert.equal(adapter.urlForFindRecord("localhost:8042"), + host + "/ws/v1/cluster/nodes/localhost:8042"); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js new file mode 100644 index 0000000..baa67cc --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-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('controller:yarn-apps', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + var controller = this.subject(); + assert.ok(controller); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js new file mode 100644 index 0000000..39cf493 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-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('controller:yarn-queues', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + var controller = this.subject(); + assert.ok(controller); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js new file mode 100644 index 0000000..1f5ab99 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-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 Ember from 'ember'; +import ChartsMixin from '../../../mixins/charts'; +import { module, test } from 'qunit'; + +module('Unit | Mixin | charts'); + +// Replace this with your real tests. +test('it works', function(assert) { + var ChartsObject = Ember.Object.extend(ChartsMixin); + var subject = ChartsObject.create(); + assert.ok(subject); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js new file mode 100644 index 0000000..8b6df23 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-app', 'Unit | Model | yarn app', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('it exists', function(assert) { + var model = this.subject(); + // var store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js new file mode 100644 index 0000000..45808a5 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-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 { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + assert.ok(model); + assert.ok(model._notifyProperties); + assert.ok(model.didLoad); + assert.ok(model.logs); + assert.ok(model.containerID); + assert.ok(model.logFileName); +}); + +test('test fields', function(assert) { + let model = this.subject(); + + Ember.run(function () { + model.set("logs", "This is syslog"); + model.set("containerID", "container_e32_1456000363780_0002_01_000001"); + model.set("logFileName", "syslog"); + assert.equal(model.get("logs"), "This is syslog"); + assert.equal(model.get("containerID"), "container_e32_1456000363780_0002_01_000001"); + assert.equal(model.get("logFileName"), "syslog"); + }); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js new file mode 100644 index 0000000..7e2e62f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + assert.ok(model); + assert.ok(model._notifyProperties); + assert.ok(model.didLoad); + assert.ok(model.appId); + assert.ok(model.state); + assert.ok(model.user); + assert.ok(model.containers); +}); + +test('test fields', function(assert) { + let model = this.subject(); + + assert.expect(9); + Ember.run(function () { + model.set("appId", "application_1456251210105_0002"); + model.set("id", "application_1456251210105_0002"); + model.set("state", "RUNNING"); + model.set("user", "hadoop"); + model.set("containers", ["container_e38_1456251210105_0002_01_000001", + "container_e38_1456251210105_0002_01_000002"]); + assert.equal(model.get("appId"), "application_1456251210105_0002"); + assert.equal(model.get("state"), "RUNNING"); + assert.equal(model.get("user"), "hadoop"); + assert.deepEqual(model.get("containers"), + ["container_e38_1456251210105_0002_01_000001", + "container_e38_1456251210105_0002_01_000002"]); + assert.equal(model.get("appStateStyle"), "label label-primary"); + assert.equal(model.get("isDummyApp"), false); + model.set("id", "dummy"); + assert.equal(model.get("isDummyApp"), true); + model.set("state", "FINISHED"); + assert.equal(model.get("appStateStyle"), "label label-success"); + model.set("state", "NEW"); + assert.equal(model.get("appStateStyle"), "label label-default"); + }); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js new file mode 100644 index 0000000..88bf233 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + assert.ok(model); + assert.ok(model._notifyProperties); + assert.ok(model.didLoad); + assert.ok(model.containerId); + assert.ok(model.state); + assert.ok(model.user); + assert.ok(model.exitCode); + assert.ok(model.totalMemoryNeeded); + assert.ok(model.totalVCoresNeeded); + assert.ok(model.containerLogFiles); + assert.ok(model.isDummyContainer); + assert.ok(model.containerStateStyle); +}); + +test('test fields', function(assert) { + let model = this.subject(); + + Ember.run(function () { + model.set("containerId", "container_e32_1456000363780_0002_01_000003"); + model.set("state", "RUNNING"); + model.set("exitCode", "-1000"); + model.set("user", "hadoop"); + model.set("id", "container_e32_1456000363780_0002_01_000003"); + model.set("totalMemoryNeeded", 1024); + model.set("totalVCoresNeeded", 1); + model.set("containerLogFiles", ["syslog", "stderr", "stdout"]); + assert.equal(model.get("containerId"), "container_e32_1456000363780_0002_01_000003"); + assert.equal(model.get("id"), "container_e32_1456000363780_0002_01_000003"); + assert.equal(model.get("totalMemoryNeeded"), 1024); + assert.equal(model.get("totalVCoresNeeded"), 1); + assert.equal(model.get("user"), "hadoop"); + assert.equal(model.get("exitCode"), "-1000"); + assert.equal(model.get("containerLogFiles").length, 3); + assert.deepEqual(model.get("containerLogFiles"), ["syslog", "stderr", "stdout"]); + assert.equal(model.get("isDummyContainer"), false); + assert.equal(model.get("containerStateStyle"), "label label-primary"); + model.set("id", "dummy"); + assert.equal(model.get("isDummyContainer"), true); + model.set("state", "EXITED_WITH_SUCCESS"); + assert.equal(model.get("containerStateStyle"), "label label-success"); + model.set("state", "EXITED_WITH_FAILURE"); + assert.equal(model.get("containerStateStyle"), "label label-danger"); + model.set("state", "DONE"); + model.set("exitCode", "0"); + assert.equal(model.get("containerStateStyle"), "label label-success"); + model.set("exitCode", "-105"); + assert.equal(model.get("containerStateStyle"), "label label-danger"); + }); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js new file mode 100644 index 0000000..5877589 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-node', 'Unit | Model | Node', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + assert.ok(model); + assert.ok(model._notifyProperties); + assert.ok(model.didLoad); + assert.ok(model.totalVmemAllocatedContainersMB); + assert.ok(model.vmemCheckEnabled); + assert.ok(model.pmemCheckEnabled); + assert.ok(model.nodeHealthy); + assert.ok(model.lastNodeUpdateTime); + assert.ok(model.healthReport); + assert.ok(model.nmStartupTime); + assert.ok(model.nodeManagerBuildVersion); + assert.ok(model.hadoopBuildVersion); +}); + +test('test fields', function(assert) { + let model = this.subject(); + + assert.expect(4); + Ember.run(function () { + model.set("totalVmemAllocatedContainersMB", 4096); + model.set("totalPmemAllocatedContainersMB", 2048); + model.set("totalVCoresAllocatedContainers", 4); + model.set("hadoopBuildVersion", "3.0.0-SNAPSHOT"); + assert.equal(model.get("totalVmemAllocatedContainersMB"), 4096); + assert.equal(model.get("totalPmemAllocatedContainersMB"), 2048); + assert.equal(model.get("totalVCoresAllocatedContainers"), 4); + assert.equal(model.get("hadoopBuildVersion"), "3.0.0-SNAPSHOT"); + }); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js new file mode 100644 index 0000000..4fd2517 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js @@ -0,0 +1,95 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('Basic creation test', function(assert) { + let model = this.subject(); + + assert.ok(model); + assert.ok(model._notifyProperties); + assert.ok(model.didLoad); + assert.ok(model.rack); + assert.ok(model.state); + assert.ok(model.nodeHostName); + assert.ok(model.nodeHTTPAddress); + assert.ok(model.lastHealthUpdate); + assert.ok(model.healthReport); + assert.ok(model.numContainers); + assert.ok(model.usedMemoryMB); + assert.ok(model.availMemoryMB); + assert.ok(model.usedVirtualCores); + assert.ok(model.availableVirtualCores); + assert.ok(model.version); + assert.ok(model.nodeLabels); + assert.ok(model.nodeLabelsAsString); + assert.ok(model.nodeStateStyle); + assert.ok(model.isDummyNode); + assert.ok(model.getMemoryDataForDonutChart); + assert.ok(model.getVCoreDataForDonutChart); +}); + +test('test fields', function(assert) { + let model = this.subject(); + + Ember.run(function () { + model.set("rack", "/default-rack"); + model.set("state", "RUNNING"); + model.set("nodeHostName", "localhost"); + model.set("id", "localhost:64318"); + model.set("nodeHTTPAddress", "localhost:8042"); + model.set("usedMemoryMB", 1024); + model.set("availMemoryMB", 7168); + model.set("usedVirtualCores", 1); + model.set("availableVirtualCores", 7); + model.set("nodeLabels", ["x"]); + assert.equal(model.get("rack"), "/default-rack"); + assert.equal(model.get("state"), "RUNNING"); + assert.equal(model.get("nodeHostName"), "localhost"); + assert.equal(model.get("id"), "localhost:64318"); + assert.equal(model.get("nodeHTTPAddress"), "localhost:8042"); + assert.equal(model.get("usedMemoryMB"), 1024); + assert.equal(model.get("availMemoryMB"), 7168); + assert.equal(model.get("usedVirtualCores"), 1); + assert.equal(model.get("availableVirtualCores"), 7); + assert.equal(model.get("isDummyNode"), false); + assert.deepEqual(model.get("nodeLabels"), ["x"]); + assert.equal(model.get("nodeLabelsAsString"), "x"); + assert.deepEqual(model.get("nodeStateStyle"), "label label-success"); + assert.deepEqual(model.get("getMemoryDataForDonutChart"), + [{label: "Used", value: 1024}, {label: "Available", value: 7168}]); + assert.deepEqual(model.get("getVCoreDataForDonutChart"), + [{label: "Used", value: 1}, {label: "Available", value: 7}]); + model.set("state", "SHUTDOWN"); + assert.deepEqual(model.get("nodeStateStyle"), "label label-danger"); + model.set("state", "REBOOTED"); + assert.deepEqual(model.get("nodeStateStyle"), "label label-warning"); + model.set("state", "NEW"); + assert.deepEqual(model.get("nodeStateStyle"), "label label-default"); + model.set("nodeLabels", ["x","y"]); + assert.equal(model.get("nodeLabelsAsString"), "x"); + model.set("nodeLabels", undefined); + assert.equal(model.get("nodeLabelsAsString"), ""); + }); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/6804e642/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js new file mode 100644 index 0000000..3a69c9f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-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('route:yarn-apps', 'Unit | Route | yarn apps', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org