You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2018/04/19 16:07:46 UTC
[2/2] hadoop git commit: YARN-5888. [UI2] Improve unit tests for new
YARN UI. Contributed by Akhil PB.
YARN-5888. [UI2] Improve unit tests for new YARN UI. Contributed by Akhil PB.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c6d7d3eb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c6d7d3eb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c6d7d3eb
Branch: refs/heads/trunk
Commit: c6d7d3eb059c7539db7d00586e181ec44da13557
Parents: 351e509
Author: Sunil G <su...@apache.org>
Authored: Thu Apr 19 21:37:35 2018 +0530
Committer: Sunil G <su...@apache.org>
Committed: Thu Apr 19 21:37:35 2018 +0530
----------------------------------------------------------------------
.../src/main/webapp/app/helpers/node-name.js | 46 ---
.../app/models/yarn-queue/capacity-queue.js | 2 +-
.../src/main/webapp/tests/helpers/resolver.js | 2 +-
.../src/main/webapp/tests/index.html | 1 +
.../components/breadcrumb-bar-test.js | 31 +-
.../unit/adapters/yarn-app-attempt-test.js | 59 ++++
.../webapp/tests/unit/adapters/yarn-app-test.js | 36 ++-
.../unit/adapters/yarn-container-log-test.js | 18 +-
.../tests/unit/adapters/yarn-container-test.js | 38 +++
.../tests/unit/adapters/yarn-node-app-test.js | 42 ++-
.../unit/adapters/yarn-node-container-test.js | 40 ++-
.../tests/unit/adapters/yarn-node-test.js | 15 +-
.../tests/unit/adapters/yarn-rm-node-test.js | 13 +-
.../tests/unit/controllers/yarn-app-test.js | 13 +-
.../webapp/tests/unit/helpers/node-name-test.js | 28 --
.../webapp/tests/unit/initializers/env-test.js | 5 +-
.../tests/unit/initializers/hosts-test.js | 5 +-
.../tests/unit/initializers/jquery-test.js | 41 ---
.../tests/unit/models/cluster-info-test.js | 37 +++
.../tests/unit/models/cluster-metric-test.js | 81 ++++++
.../tests/unit/models/yarn-app-attempt-test.js | 65 +++++
.../webapp/tests/unit/models/yarn-app-test.js | 61 +++-
.../unit/models/yarn-container-log-test.js | 18 --
.../tests/unit/models/yarn-container-test.js | 49 ++++
.../tests/unit/models/yarn-node-app-test.js | 14 +-
.../unit/models/yarn-node-container-test.js | 16 +-
.../webapp/tests/unit/models/yarn-node-test.js | 18 --
.../webapp/tests/unit/models/yarn-queue-test.js | 122 ++++++++
.../tests/unit/models/yarn-rm-node-test.js | 14 +-
.../webapp/tests/unit/models/yarn-user-test.js | 32 +++
.../tests/unit/routes/cluster-overview-test.js | 143 ++++++++++
.../tests/unit/routes/yarn-app-attempt-test.js | 30 ++
.../webapp/tests/unit/routes/yarn-app-test.js | 152 ++++++++++
.../webapp/tests/unit/routes/yarn-apps-test.js | 113 +++++++-
.../webapp/tests/unit/routes/yarn-node-test.js | 19 +-
.../webapp/tests/unit/routes/yarn-nodes-test.js | 13 +-
.../tests/unit/routes/yarn-queues-test.js | 286 ++++++++++++++++++-
.../tests/unit/serializers/cluster-info-test.js | 70 +++++
.../unit/serializers/cluster-metric-test.js | 90 ++++++
.../unit/serializers/yarn-app-attempt-test.js | 101 +++++++
.../tests/unit/serializers/yarn-app-test.js | 62 +++-
.../unit/serializers/yarn-container-test.js | 30 ++
.../unit/serializers/yarn-node-app-test.js | 13 +-
.../serializers/yarn-node-container-test.js | 13 +-
.../tests/unit/serializers/yarn-rm-node-test.js | 14 +-
45 files changed, 1795 insertions(+), 316 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
deleted file mode 100644
index 75bc017..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-
-export function nodeName(params/*, hash*/) {
- // Place a menu within a panel inside col-md-2 container.
- console.log('nodes-uid', params[0]);
- var nodeIdSplitAtPort = params[0];
- var portIndex = nodeIdSplitAtPort.indexOf(':');
- if (portIndex !== -1) {
- nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
- ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
- }
- var normalizedNodeId = '';
- var splitsAlongDots = nodeIdSplitAtPort.split('.');
- if (splitsAlongDots) {
- var len = splitsAlongDots.length;
- for (var i = 0; i < len; i++) {
- normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
- if (i !== len - 1) {
- normalizedNodeId = normalizedNodeId + '.​';
- }
- }
- } else {
- normalizedNodeId = nodeIdSplitAtPort;
- }
- return Ember.String.htmlSafe(normalizedNodeId);
-}
-
-export default Ember.Helper.helper(nodeName);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue/capacity-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue/capacity-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue/capacity-queue.js
index c123989..ebcccb9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue/capacity-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue/capacity-queue.js
@@ -94,7 +94,7 @@ export default DS.Model.extend({
hasUserUsages: function() {
return this.get("userUsagesDonutChartData").length > 0;
- }.property(),
+ }.property("userUsagesDonutChartData"),
numOfApplicationsDonutChartData: function() {
return [
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index f94998c..6e0f0ee 100644
--- 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
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import Resolver from 'ember/resolver';
+import Resolver from 'ember-resolver';
import config from '../../config/environment';
var resolver = Resolver.create();
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 9681e8b..36d4ed5 100644
--- 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
@@ -44,6 +44,7 @@
<script src="assets/yarn-ui.js"></script>
<script src="testem.js"></script>
<script src="assets/test-loader.js"></script>
+ <script src="assets/tests.js"></script>
{{content-for 'body-footer'}}
{{content-for 'test-body-footer'}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/integration/components/breadcrumb-bar-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/integration/components/breadcrumb-bar-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/integration/components/breadcrumb-bar-test.js
index ffc6515..871bdd4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/integration/components/breadcrumb-bar-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/integration/components/breadcrumb-bar-test.js
@@ -24,20 +24,27 @@ moduleForComponent('breadcrumb-bar', 'Integration | Component | breadcrumb bar',
});
test('it renders', function(assert) {
+ var breadcrumbs = [{
+ text: "Home",
+ routeName: "application"
+ }, {
+ text: "Test"
+ }];
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL +
+ this.set("breadcrumbs", breadcrumbs);
- this.render(hbs`{{breadcrumb-bar}}`);
+ this.render(hbs`{{breadcrumb-bar breadcrumbs=breadcrumbs}}`);
- assert.equal(this.$().text().trim(), '');
+ assert.equal(this.$('ol.breadcrumb li').length, 2);
+ assert.equal(this.$('button.refresh').text(), 'Refresh');
+});
- // Template block usage:" + EOL +
- this.render(hbs`
- {{#breadcrumb-bar}}
- template block text
- {{/breadcrumb-bar}}
- `);
+test('should trigger refresh action', function(assert) {
+ this.on('refresh', function() {
+ assert.ok("refresh action");
+ });
- assert.equal(this.$().text().trim(), 'template block text');
-});
+ this.render(hbs`{{breadcrumb-bar action="refresh"}}`);
+
+ this.$('button.refresh').click();
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-attempt-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-attempt-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-attempt-test.js
new file mode 100644
index 0000000..cf03f9d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-attempt-test.js
@@ -0,0 +1,59 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+
+moduleFor('adapter:yarn-app-attempt', 'Unit | Adapter | yarn app attempt', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ assert.ok(adapter);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.urlForFindRecord);
+ assert.equal(adapter.namespace, "ws/v1/cluster");
+});
+
+test("urlForQuery test", function(assert) {
+ let adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ var host = adapter.host;
+ assert.equal(adapter.urlForQuery({appId: "application_1472139065385_0007"}),
+ host + "/ws/v1/cluster/apps/application_1472139065385_0007/appattempts");
+});
+
+test("urlForFindRecord test", function(assert) {
+ let adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ var host = adapter.host;
+ var attemptId = "appattempt_1472139065385_0007_000001";
+ assert.equal(adapter.urlForFindRecord(attemptId),
+ host + "/ws/v1/cluster/apps/" +
+ Converter.attemptIdToAppId(attemptId) + "/appattempts/" + attemptId);
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 726345f..9218f00 100644
--- 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
@@ -19,12 +19,40 @@
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']
+ unit: true
});
// Replace this with your real tests.
-test('it exists', function(assert) {
- var adapter = this.subject();
+test('Basic creation test', function(assert) {
+ var adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
assert.ok(adapter);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.namespace, "ws/v1/cluster");
+});
+
+test("urlForQuery test", function(assert) {
+ var adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ var host = adapter.host;
+ assert.equal(adapter.urlForQuery({state: "RUNNING"}),
+ host + "/ws/v1/cluster/apps/?state=RUNNING");
+});
+
+test("urlForFindRecord test", function(assert) {
+ var adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ var host = adapter.host;
+ var appId= "application_1111111111_1111";
+ assert.equal(adapter.urlForFindRecord(appId),
+ host + "/ws/v1/cluster/apps/" + appId);
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index e6e7b43..7335db4 100644
--- 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
@@ -20,10 +20,14 @@ import { moduleFor, test } from 'ember-qunit';
import Constants from 'yarn-ui/constants';
moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', {
+ unit: true
});
test('Basic creation', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "ws/v1/node"
+ });
assert.ok(adapter);
assert.ok(adapter.urlForFindRecord);
@@ -36,7 +40,10 @@ test('Basic creation', function(assert) {
});
test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200/",
+ namespace: "ws/v1/node"
+ });
let host = adapter.host;
assert.equal(adapter.urlForFindRecord("localhost:8042" +
Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" +
@@ -52,8 +59,11 @@ test('ajaxOptions test', function(assert) {
});
test('findRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
+ let adapter = this.subject({
+ host: "localhost:4200/",
+ namespace: "ws/v1/node"
+ });
+ let testModel = { modelName: "testModel" },
testStore = {},
testSnapshot = {};
let host = adapter.host;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-test.js
new file mode 100644
index 0000000..cc92773
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-test.js
@@ -0,0 +1,38 @@
+/**
+ * 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-container', 'Unit | Adapter | yarn container', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let adapter = this.subject({
+ host: "localhost:8088",
+ namespace: "ws/v1/cluster"
+ });
+ assert.ok(adapter);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.ajax);
+ assert.equal(adapter.headers.Accept, "application/json");
+ assert.equal(adapter.namespace, "ws/v1/cluster");
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 3a25996..bc7ea9a 100644
--- 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
@@ -19,10 +19,14 @@
import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', {
+ unit: true
});
test('Basic creation', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
assert.expect(11);
assert.ok(adapter);
assert.ok(adapter.urlForQueryRecord);
@@ -34,35 +38,44 @@ test('Basic creation', function(assert) {
assert.ok(adapter.host);
assert.ok(adapter.namespace);
assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
+ assert.equal("{nodeAddress}/ws/v1/node", adapter.namespace);
});
test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
let host = adapter.host;
assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
+ 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 adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/apps",
+ 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" },
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
+ let 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(host + "/localhost:8042/ws/v1/node/apps", url);
assert.equal('GET', method);
assert.equal(null, hash.data);
};
@@ -71,8 +84,11 @@ test('query test', function(assert) {
});
test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
+ let testModel = { modelName: "testModel" },
testStore = {},
testQuery = {
nodeAddr: "localhost:8042",
@@ -82,9 +98,7 @@ test('queryRecord test', function(assert) {
assert.expect(3);
adapter.ajax = function (url, method, hash) {
- assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
- url);
+ assert.equal(host + "/localhost:8042/ws/v1/node/apps/application_1111111111_1111", url);
assert.equal('GET', method);
assert.equal(null, hash.data);
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 7d2bb2d..d61d868 100644
--- 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
@@ -19,10 +19,14 @@
import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', {
+ unit: true
});
test('Basic creation', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
assert.expect(11);
assert.ok(adapter);
assert.ok(adapter.urlForQueryRecord);
@@ -34,13 +38,16 @@ test('Basic creation', function(assert) {
assert.ok(adapter.host);
assert.ok(adapter.namespace);
assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
+ assert.equal("{nodeAddress}/ws/v1/node", adapter.namespace);
});
test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ assert.equal(host + "/localhost:8042/ws/v1/node/containers/" +
"container_e27_11111111111_0001_01_000001",
adapter.urlForQueryRecord(
{nodeHttpAddr: "localhost:8042",
@@ -48,22 +55,28 @@ test('urlForQueryRecord test', function(assert) {
});
test('urlForQuery test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers",
+ 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" },
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
+ let 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(host + "/localhost:8042/ws/v1/node/containers", url);
assert.equal('GET', method);
assert.equal(null, hash.data);
};
@@ -72,8 +85,11 @@ test('query test', function(assert) {
});
test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
+ let testModel = { modelName: "testModel" },
testStore = {},
testQuery = {
nodeHttpAddr: "localhost:8042",
@@ -83,7 +99,7 @@ test('queryRecord test', function(assert) {
assert.expect(3);
adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ 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);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 15aefef..2730efb 100644
--- 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
@@ -19,10 +19,14 @@
import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:yarn-node', 'Unit | Adapter | Node', {
+ unit: true
});
test('Basic creation', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
assert.ok(adapter);
assert.ok(adapter.urlForFindRecord);
@@ -31,12 +35,15 @@ test('Basic creation', function(assert) {
assert.ok(adapter.host);
assert.ok(adapter.namespace);
assert.equal(adapter.headers.Accept, "application/json");
- assert.equal(adapter.namespace, "ws/v1/node");
+ assert.equal(adapter.namespace, "{nodeAddress}/ws/v1/node");
});
test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "{nodeAddress}/ws/v1/node"
+ });
let host = adapter.host;
assert.equal(adapter.urlForFindRecord("localhost:8042"),
- host + "localhost:8042/ws/v1/node");
+ host + "/localhost:8042/ws/v1/node");
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index bf009d4..adf65c0 100644
--- 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
@@ -19,12 +19,14 @@
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']
+ unit: true
});
test('Basic creation', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "ws/v1/cluster"
+ });
assert.ok(adapter);
assert.ok(adapter.urlForFindRecord);
@@ -37,7 +39,10 @@ test('Basic creation', function(assert) {
});
test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
+ let adapter = this.subject({
+ host: "localhost:4200",
+ namespace: "ws/v1/cluster"
+ });
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/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
index 1cc95c5..5f944dd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
@@ -17,14 +17,19 @@
*/
import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
moduleFor('controller:yarn-app', 'Unit | Controller | yarn app', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
+ unit: true
});
-// Replace this with your real tests.
-test('it exists', function(assert) {
+test('Basic creation test', function(assert) {
let controller = this.subject();
assert.ok(controller);
+ assert.ok(controller.amHostHttpAddressFormatted);
+ var app = Ember.Object.create({
+ amHostHttpAddress: 'localhost:8042'
+ });
+ controller.set('model', Ember.Object.create({app: app}));
+ assert.equal(controller.get('amHostHttpAddressFormatted'), 'http://localhost:8042');
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
deleted file mode 100644
index 8ff5eb6..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { nodeName } from '../../../helpers/node-name';
-import { module, test } from 'qunit';
-
-module('Unit | Helper | node name');
-
-// Replace this with your real tests.
-test('it works', function(assert) {
- let result = nodeName(42);
- assert.ok(result);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
index d6dacfd..025df97 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
@@ -20,13 +20,12 @@ import Ember from 'ember';
import { initialize } from '../../../initializers/env';
import { module, test } from 'qunit';
-var registry, application;
+var application;
module('Unit | Initializer | env', {
beforeEach: function() {
Ember.run(function() {
application = Ember.Application.create();
- registry = application.registry;
application.deferReadiness();
});
}
@@ -34,7 +33,7 @@ module('Unit | Initializer | env', {
// Replace this with your real tests.
test('it works', function(assert) {
- initialize(registry, application);
+ initialize(application);
// you would normally confirm the results of the initializer here
assert.ok(true);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
index b9a6b27..7aa510c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
@@ -20,13 +20,12 @@ import Ember from 'ember';
import { initialize } from '../../../initializers/hosts';
import { module, test } from 'qunit';
-var registry, application;
+var application;
module('Unit | Initializer | hosts', {
beforeEach: function() {
Ember.run(function() {
application = Ember.Application.create();
- registry = application.registry;
application.deferReadiness();
});
}
@@ -34,7 +33,7 @@ module('Unit | Initializer | hosts', {
// Replace this with your real tests.
test('it works', function(assert) {
- initialize(registry, application);
+ initialize(application);
// you would normally confirm the results of the initializer here
assert.ok(true);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
deleted file mode 100644
index c7a9803..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-import { initialize } from '../../../initializers/jquery';
-import { module, test } from 'qunit';
-
-var registry, application;
-
-module('Unit | Initializer | jquery', {
- beforeEach: function() {
- Ember.run(function() {
- application = Ember.Application.create();
- registry = application.registry;
- application.deferReadiness();
- });
- }
-});
-
-// Replace this with your real tests.
-test('it works', function(assert) {
- initialize(registry, application);
-
- // you would normally confirm the results of the initializer here
- assert.ok(true);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-info-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-info-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-info-test.js
new file mode 100644
index 0000000..153ff33
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-info-test.js
@@ -0,0 +1,37 @@
+/**
+ * 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('cluster-info', 'Unit | Model | cluster info', {
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.startedOn);
+ assert.ok(model.state);
+ assert.ok(model.haState);
+ assert.ok(model.rmStateStoreName);
+ assert.ok(model.resourceManagerVersion);
+ assert.ok(model.resourceManagerBuildVersion);
+ assert.ok(model.hadoopVersion);
+ assert.ok(model.hadoopBuildVersion);
+ assert.ok(model.hadoopVersionBuiltOn);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-metric-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-metric-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-metric-test.js
new file mode 100644
index 0000000..58a6af4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/cluster-metric-test.js
@@ -0,0 +1,81 @@
+/**
+ * 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('cluster-metric', 'Unit | Model | cluster metric', {
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.appsSubmitted);
+ assert.ok(model.appsCompleted);
+ assert.ok(model.appsPending);
+ assert.ok(model.appsRunning);
+ assert.ok(model.appsFailed);
+ assert.ok(model.appsKilled);
+ assert.ok(model.reservedMB);
+ assert.ok(model.availableMB);
+ assert.ok(model.allocatedMB);
+ assert.ok(model.reservedVirtualCores);
+ assert.ok(model.availableVirtualCores);
+ assert.ok(model.allocatedVirtualCores);
+ assert.ok(model.containersAllocated);
+ assert.ok(model.containersReserved);
+ assert.ok(model.containersPending);
+ assert.ok(model.totalMB);
+ assert.ok(model.totalVirtualCores);
+ assert.ok(model.totalNodes);
+ assert.ok(model.lostNodes);
+ assert.ok(model.unhealthyNodes);
+ assert.ok(model.decommissionedNodes);
+ assert.ok(model.rebootedNodes);
+ assert.ok(model.activeNodes);
+});
+
+test('Testing fields', function(assert) {
+ let model = this.subject({
+ "appsCompleted": 0,
+ "appsPending": 0,
+ "appsRunning": 0,
+ "appsFailed": 0,
+ "appsKilled": 0,
+ "reservedMB": 0,
+ "availableMB": 32768,
+ "allocatedMB": 0,
+ "activeNodes": 4,
+ "unhealthyNodes": 0,
+ "decommissionedNodes": 0,
+ "reservedVirtualCores": 0,
+ "availableVirtualCores": 32,
+ "allocatedVirtualCores": 0
+ });
+
+ assert.deepEqual(model.get('getFinishedAppsDataForDonutChart'),
+ [{label: "Completed", value: 0}, {label: "Killed", value: 0}, {label: "Failed", value: 0}]);
+ assert.deepEqual(model.get('getRunningAppsDataForDonutChart'),
+ [{label: "Pending", value: 0}, {label: "Running", value: 0}]);
+ assert.deepEqual(model.get('getNodesDataForDonutChart'),
+ [{label: "Active", value: 4}, {label: "Unhealthy", value: 0}, {label: "Decomissioned", value: 0}]);
+ assert.deepEqual(model.get('getMemoryDataForDonutChart'),
+ [{label: "Allocated", value: 0}, {label: "Reserved", value: 0}, {label: "Available", value: 32768}]);
+ assert.deepEqual(model.get('getVCoreDataForDonutChart'),
+ [{label: "Allocated", value: 0}, {label: "Reserved", value: 0}, {label: "Available", value: 32}]);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-attempt-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-attempt-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-attempt-test.js
new file mode 100644
index 0000000..7217b16
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-attempt-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';
+import Converter from 'yarn-ui/utils/converter';
+
+moduleForModel('yarn-app-attempt', 'Unit | Model | yarn app attempt', {
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.startTime);
+ assert.ok(model.startedTime);
+ assert.ok(model.finishedTime);
+ assert.ok(model.containerId);
+ assert.ok(model.amContainerId);
+ assert.ok(model.nodeHttpAddress);
+ assert.ok(model.nodeId);
+ assert.ok(model.hosts);
+ assert.ok(model.logsLink);
+ assert.ok(model.state);
+ assert.ok(model.appAttemptId);
+});
+
+test('Testing fields', function(assert) {
+ let model = this.subject({
+ "id": "appattempt_1479277364592_0001_000001",
+ "startedTime": Converter.timeStampToDate("1479280913398"),
+ "finishedTime": Converter.timeStampToDate("1479280966401"),
+ "amContainerId": "container_e01_1479277364592_0001_01_000001",
+ "hosts": "N/A",
+ "state": "FINISHED",
+ "appAttemptId": "appattempt_1479277364592_0001_000001"
+ });
+
+ assert.equal(model.get('appId'), "application_1479277364592_0001");
+ assert.equal(model.get('startTs'), 1479280913000);
+ assert.equal(model.get('finishedTs'), 1479280966000);
+ assert.equal(model.get('shortAppAttemptId'), "appattempt_1479277364592_0001_000001");
+ assert.equal(model.get('appMasterContainerId'), "container_e01_1479277364592_0001_01_000001");
+ assert.equal(model.get('IsAmNodeUrl'), false);
+ assert.equal(model.get('amNodeId'), "N/A");
+ assert.equal(model.get('IsLinkAvailable'), false);
+ assert.equal(model.get('elapsedTime'), "53 Secs");
+ assert.equal(model.get('link'), "/yarn-app-attempt/appattempt_1479277364592_0001_000001");
+ assert.equal(model.get('linkname'), "yarn-app-attempt");
+ assert.equal(model.get('attemptState'), "FINISHED");
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 8b6df23..103a63b 100644
--- 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
@@ -19,12 +19,65 @@
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) {
+test('Basic creation test', function(assert) {
var model = this.subject();
- // var store = this.store();
- assert.ok(!!model);
+ assert.ok(model);
+ assert.ok(model.appName);
+ assert.ok(model.user);
+ assert.ok(model.queue);
+ assert.ok(model.state);
+ assert.ok(model.startTime);
+ assert.ok(model.elapsedTime);
+ assert.ok(model.finalStatus);
+ assert.ok(model.finishedTime);
+ assert.ok(model.progress);
+ assert.ok(model.diagnostics);
+ assert.ok(model.amContainerLogs);
+ assert.ok(model.amHostHttpAddress);
+ assert.ok(model.logAggregationStatus);
+ assert.ok(model.unmanagedApplication);
+ assert.ok(model.amNodeLabelExpression);
+ assert.ok(model.applicationTags);
+ assert.ok(model.applicationType);
+ assert.ok(model.priority);
+ assert.ok(model.allocatedMB);
+ assert.ok(model.allocatedVCores);
+ assert.ok(model.runningContainers);
+ assert.ok(model.memorySeconds);
+ assert.ok(model.vcoreSeconds);
+ assert.ok(model.preemptedResourceMB);
+ assert.ok(model.preemptedResourceVCores);
+ assert.ok(model.numNonAMContainerPreempted);
+ assert.ok(model.numAMContainerPreempted);
+ assert.ok(model.clusterUsagePercentage);
+ assert.ok(model.queueUsagePercentage);
+ assert.ok(model.currentAppAttemptId);
+});
+
+test('Testing fields', function(assert) {
+ let model = this.subject({
+ "finalStatus": "SUCCEEDED",
+ "startedTime": 1479280923314,
+ "finishedTime": 1479280966402,
+ "allocatedMB": 0,
+ "allocatedVCores": 0,
+ "preemptedResourceMB": 0,
+ "preemptedResourceVCores": 0,
+ "memorySeconds": 93406,
+ "vcoreSeconds": 49,
+ "progress": 100,
+ "runningContainers": 0
+ });
+
+ assert.equal(model.get('isFailed'), false);
+ assert.equal(model.get('validatedFinishedTs'), 1479280966402);
+ assert.equal(model.get('allocatedResource'), '0 MBs, 0 VCores');
+ assert.equal(model.get('preemptedResource'), '0 MBs, 0 VCores');
+ assert.equal(model.get('aggregatedResourceUsage'), '93406 MBs, 49 VCores (× Secs)');
+ assert.equal(model.get('progressStyle'), 'width: 100%');
+ assert.equal(model.get('runningContainersNumber'), 0);
+ assert.equal(model.get('finalStatusStyle'), 'label label-success');
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 93cdec6..dcdf378 100644
--- 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
@@ -17,33 +17,15 @@
*/
import { moduleForModel, test } from 'ember-qunit';
-import Ember from 'ember';
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/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-test.js
new file mode 100644
index 0000000..90182d5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-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 { moduleForModel, test } from 'ember-qunit';
+import Converter from 'yarn-ui/utils/converter';
+
+moduleForModel('yarn-container', 'Unit | Model | yarn container', {
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.allocatedMB);
+ assert.ok(model.allocatedVCores);
+ assert.ok(model.assignedNodeId);
+ assert.ok(model.priority);
+ assert.ok(model.startedTime);
+ assert.ok(model.finishedTime);
+ assert.ok(model.logUrl);
+ assert.ok(model.containerExitStatus);
+ assert.ok(model.containerState);
+ assert.ok(model.nodeHttpAddress);
+});
+
+test('Testing fields', function(assert) {
+ let model = this.subject({
+ startedTime: Converter.timeStampToDate(1481696493793),
+ finishedTime: Converter.timeStampToDate(1481696501857)
+ });
+ assert.equal(model.get('startTs'), 1481696493000);
+ assert.equal(model.get('finishedTs'), 1481696501000);
+ assert.equal(model.get('elapsedTime'), '8 Secs');
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 3b91ea7..57f6875 100644
--- 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
@@ -20,7 +20,6 @@ import { moduleForModel, test } from 'ember-qunit';
import Ember from 'ember';
moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
- // Specify the other units that are required for this test.
needs: []
});
@@ -39,20 +38,10 @@ test('Basic creation test', function(assert) {
test('test fields', function(assert) {
let model = this.subject();
- assert.expect(9);
+ assert.expect(5);
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");
@@ -63,4 +52,3 @@ test('test fields', function(assert) {
assert.equal(model.get("appStateStyle"), "label label-default");
});
});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 24ad4c4..7a664fe 100644
--- 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
@@ -45,22 +45,9 @@ test('test fields', function(assert) {
let model = this.subject();
Ember.run(function () {
- model.set("containerId", "container_e32_1456000363780_0002_01_000003");
+ model.set("id", "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");
@@ -76,4 +63,3 @@ test('test fields', function(assert) {
assert.equal(model.get("containerStateStyle"), "label label-danger");
});
});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 8d7c831..decfca6 100644
--- 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
@@ -17,7 +17,6 @@
*/
import { moduleForModel, test } from 'ember-qunit';
-import Ember from 'ember';
moduleForModel('yarn-node', 'Unit | Model | Node', {
// Specify the other units that are required for this test.
@@ -40,20 +39,3 @@ test('Basic creation test', function(assert) {
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/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-queue-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-queue-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-queue-test.js
new file mode 100644
index 0000000..590c57c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-queue-test.js
@@ -0,0 +1,122 @@
+/**
+ * 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';
+import Ember from 'ember';
+
+moduleForModel('yarn-queue', 'Unit | Model | yarn queue', {
+ needs: ['model:yarn-user']
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.name);
+ assert.ok(model.children);
+ assert.ok(model.parent);
+ assert.ok(model.capacity);
+ assert.ok(model.maxCapacity);
+ assert.ok(model.usedCapacity);
+ assert.ok(model.absCapacity);
+ assert.ok(model.absMaxCapacity);
+ assert.ok(model.absUsedCapacity);
+ assert.ok(model.state);
+ assert.ok(model.userLimit);
+ assert.ok(model.userLimitFactor);
+ assert.ok(model.preemptionDisabled);
+ assert.ok(model.numPendingApplications);
+ assert.ok(model.numActiveApplications);
+ assert.ok(model.users);
+});
+
+test('Test fields', function(assert) {
+ let model = this.subject();
+ Ember.run(function() {
+ model.set('name', 'default');
+ model.set('children', []);
+ model.set('parent', 'root');
+ model.set('capacity', 100);
+ model.set('maxCapacity', 100);
+ model.set('usedCapacity', 0);
+ model.set('absCapacity', 100);
+ model.set('absMaxCapacity', 100);
+ model.set('absUsedCapacity', 0);
+ model.set('state', 'RUNNING');
+ model.set('userLimit', 100);
+ model.set('userLimitFactor', 1.0);
+ model.set('preemptionDisabled', true);
+ model.set('numPendingApplications', 0);
+ model.set('numActiveApplications', 0);
+
+ assert.equal(model.get('isLeafQueue'), true);
+ assert.deepEqual(model.get('capacitiesBarChartData'),
+ [{label: "Absolute Capacity", value: 100},
+ {label: "Absolute Used", value: 0},
+ {label: "Absolute Max Capacity", value: 100}]);
+ assert.deepEqual(model.get('userUsagesDonutChartData'), []);
+ assert.equal(model.get('hasUserUsages'), false);
+ assert.deepEqual(model.get('numOfApplicationsDonutChartData'),
+ [{label: "Pending Apps", value: 0}, {label: "Active Apps", value: 0}]);
+
+ var user1 = model.store.createRecord('yarn-user', {
+ name: 'user1',
+ usedMemoryMB: 2048
+ });
+ model.set('users', [user1]);
+ assert.deepEqual(model.get('userUsagesDonutChartData'),
+ [{label: 'user1', value: 2048}]);
+ assert.equal(model.get('hasUserUsages'), true);
+
+ model.set('name', 'root');
+ let child = this.subject({
+ name: 'default'
+ });
+ model.set('children', [child]);
+ model.set('parent', '');
+ model.set('capacity', 100);
+ model.set('maxCapacity', 100);
+ model.set('usedCapacity', 0);
+ model.set('absCapacity', 100);
+ model.set('absMaxCapacity', 100);
+ model.set('absUsedCapacity', 0);
+ model.set('state', 'RUNNING');
+ model.set('numPendingApplications', 0);
+ model.set('numActiveApplications', 0);
+
+ assert.equal(model.get('isLeafQueue'), false);
+ assert.deepEqual(model.get('capacitiesBarChartData'),
+ [
+ {label: "Absolute Capacity", value: 100},
+ {label: "Absolute Used", value: 0},
+ {label: "Absolute Max Capacity", value: 100}
+ ]);
+ assert.deepEqual(model.get('numOfApplicationsDonutChartData'),
+ [
+ {label: "Pending Apps", value: 0},
+ {label: "Active Apps", value: 0}
+ ]);
+ }.bind(this));
+});
+
+test('Test relationship with yarn-user', function(assert) {
+ let YarnQueue = this.store().modelFor('yarn-queue');
+ let relationship = Ember.get(YarnQueue, 'relationshipsByName').get('users');
+ assert.expect(2);
+ assert.equal(relationship.key, 'users');
+ assert.equal(relationship.kind, 'hasMany');
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 2499ebc..9b18a36 100644
--- 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
@@ -20,7 +20,6 @@ import { moduleForModel, test } from 'ember-qunit';
import Ember from 'ember';
moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
- // Specify the other units that are required for this test.
needs: []
});
@@ -64,17 +63,7 @@ test('test fields', function(assert) {
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"),
@@ -93,4 +82,3 @@ test('test fields', function(assert) {
assert.equal(model.get("nodeLabelsAsString"), "");
});
});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-user-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-user-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-user-test.js
new file mode 100644
index 0000000..0afe3ef
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-user-test.js
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-user', 'Unit | Model | yarn user', {
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model.name);
+ assert.ok(model.queueName);
+ assert.ok(model.usedMemoryMB);
+ assert.ok(model.usedVCore);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/cluster-overview-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/cluster-overview-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/cluster-overview-test.js
new file mode 100644
index 0000000..f4c281f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/cluster-overview-test.js
@@ -0,0 +1,143 @@
+/**
+ * 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 Ember from 'ember';
+
+moduleFor('route:cluster-overview', 'Unit | Route | cluster overview', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.afterModel);
+ assert.ok(route.unloadAll);
+});
+
+test('Test getting cluster metrics data', function(assert) {
+ var response = {
+ clusterMetrics: {
+ appsSubmitted: 0,
+ appsCompleted: 0,
+ appsPending: 0,
+ appsRunning: 0,
+ appsFailed: 0,
+ appsKilled: 0,
+ reservedMB: 0,
+ availableMB: 17408,
+ allocatedMB: 0,
+ reservedVirtualCores: 0,
+ availableVirtualCores: 7,
+ allocatedVirtualCores: 1,
+ containersAllocated: 0,
+ containersReserved: 0,
+ containersPending: 0,
+ totalMB: 17408,
+ totalVirtualCores: 8,
+ totalNodes: 1,
+ lostNodes: 0,
+ unhealthyNodes: 0,
+ decommissionedNodes: 0,
+ rebootedNodes: 0,
+ activeNodes: 1
+ }
+ };
+ var store = {
+ findAll: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ },
+ query: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve({});
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(3);
+ route.model().then(function(model) {
+ assert.ok(model);
+ assert.ok(model.clusterMetrics);
+ assert.deepEqual(model.clusterMetrics, response);
+ });
+});
+
+test("Test getting yarn app data", function(assert) {
+ var response = {
+ "apps": {
+ "app": [{
+ "finishedTime" : 1326815598530,
+ "amContainerLogs" : "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001",
+ "trackingUI" : "History",
+ "state" : "FINISHED",
+ "user" : "user1",
+ "id" : "application_1326815542473_0001",
+ "clusterId" : 1326815542473,
+ "finalStatus" : "SUCCEEDED",
+ "amHostHttpAddress" : "host.domain.com:8042",
+ "amRPCAddress" : "host.domain.com:4201",
+ "progress" : 100,
+ "name" : "word count",
+ "startedTime" : 1326815573334,
+ "elapsedTime" : 25196,
+ "diagnostics" : "",
+ "trackingUrl" : "http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473",
+ "queue" : "default",
+ "allocatedMB" : 0,
+ "allocatedVCores" : 0,
+ "runningContainers" : 0,
+ "applicationType" : "MAPREDUCE",
+ "applicationTags" : "",
+ "memorySeconds" : 151730,
+ "vcoreSeconds" : 103,
+ "unmanagedApplication" : "false",
+ "applicationPriority" : 0,
+ "appNodeLabelExpression" : "",
+ "amnodeLabelExpression" : ""
+ }]
+ }
+ };
+ var store = {
+ findAll: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve({});
+ });
+ },
+ query: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ if (type === 'yarn-app') {
+ resolve(response);
+ } else {
+ resolve({});
+ }
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(3);
+ route.model().then(function(model) {
+ assert.ok(model);
+ assert.ok(model.apps);
+ assert.deepEqual(model.apps, response);
+ });
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempt-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempt-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempt-test.js
new file mode 100644
index 0000000..10af7ca
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempt-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('route:yarn-app-attempt', 'Unit | Route | yarn app attempt', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.unloadAll);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-test.js
new file mode 100644
index 0000000..5b7833e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-test.js
@@ -0,0 +1,152 @@
+/**
+ * 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 Ember from 'ember';
+
+moduleFor('route:yarn-app', 'Unit | Route | yarn app', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.unloadAll);
+});
+
+test('Test getting yarn application data', function(assert) {
+ var response = {
+ "app" : {
+ "finishedTime" : 1326824991300,
+ "amContainerLogs" : "http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001",
+ "trackingUI" : "History",
+ "state" : "FINISHED",
+ "user" : "user1",
+ "id" : "application_1326821518301_0005",
+ "clusterId" : 1326821518301,
+ "finalStatus" : "SUCCEEDED",
+ "amHostHttpAddress" : "host.domain.com:8042",
+ "amRPCAddress" : "host.domain.com:4201",
+ "progress" : 100,
+ "name" : "Sleep job",
+ "applicationType" : "Yarn",
+ "startedTime" : 1326824544552,
+ "elapsedTime" : 446748,
+ "diagnostics" : "",
+ "trackingUrl" : "http://host.domain.com:8088/proxy/application_1326821518301_0005/jobhistory/job/job_1326821518301_5_5",
+ "queue" : "a1",
+ "memorySeconds" : 151730,
+ "vcoreSeconds" : 103,
+ "unmanagedApplication" : "false",
+ "applicationPriority" : 0,
+ "appNodeLabelExpression" : "",
+ "amNodeLabelExpression" : ""
+ }
+ };
+ var store = {
+ find: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ },
+ findAll: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve({});
+ });
+ },
+ query: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve([]);
+ });
+ }
+ };
+ var appId = "application_1326821518301_0005";
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(3);
+ route.model({app_id: appId}).then(function(model) {
+ assert.ok(model);
+ assert.ok(model.app);
+ assert.deepEqual(model.app, response);
+ });
+});
+
+test('Test getting yarm rm nodes data', function(assert) {
+ var response = {
+ "nodes": {
+ "node": [{
+ "rack":"\/default-rack",
+ "state":"NEW",
+ "id":"h2:1235",
+ "nodeHostName":"h2",
+ "nodeHTTPAddress":"h2:2",
+ "healthStatus":"Healthy",
+ "lastHealthUpdate":1324056895432,
+ "healthReport":"Healthy",
+ "numContainers":0,
+ "usedMemoryMB":0,
+ "availMemoryMB":8192,
+ "usedVirtualCores":0,
+ "availableVirtualCores":8
+ },
+ {
+ "rack":"\/default-rack",
+ "state":"NEW",
+ "id":"h1:1234",
+ "nodeHostName":"h1",
+ "nodeHTTPAddress":"h1:2",
+ "healthStatus":"Healthy",
+ "lastHealthUpdate":1324056895092,
+ "healthReport":"Healthy",
+ "numContainers":0,
+ "usedMemoryMB":0,
+ "availMemoryMB":8192,
+ "usedVirtualCores":0,
+ "availableVirtualCores":8
+ }]
+ }
+ };
+ var store = {
+ find: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve({});
+ });
+ },
+ findAll: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ },
+ query: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve([]);
+ });
+ }
+ };
+ var appId = "application_1326821518301_0005";
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(4);
+ route.model({app_id: appId}).then(function(model) {
+ assert.ok(model);
+ assert.ok(model.nodes);
+ assert.deepEqual(model.nodes.nodes.node[0], response.nodes.node[0]);
+ assert.deepEqual(model.nodes.nodes.node[1], response.nodes.node[1]);
+ });
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/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
index 3a69c9f..5d65d65 100644
--- 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
@@ -17,13 +17,120 @@
*/
import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
moduleFor('route:yarn-apps', 'Unit | Route | yarn apps', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
+ unit: true
});
-test('it exists', function(assert) {
+test('Basic creation test', function(assert) {
var route = this.subject();
assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.unloadAll);
});
+
+test("Test getting yarn applications data", function(assert) {
+ var response = {
+ "apps": {
+ "app": [{
+ "finishedTime" : 1326815598530,
+ "amContainerLogs" : "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001",
+ "trackingUI" : "History",
+ "state" : "FINISHED",
+ "user" : "user1",
+ "id" : "application_1326815542473_0001",
+ "clusterId" : 1326815542473,
+ "finalStatus" : "SUCCEEDED",
+ "amHostHttpAddress" : "host.domain.com:8042",
+ "amRPCAddress" : "host.domain.com:4201",
+ "progress" : 100,
+ "name" : "word count",
+ "startedTime" : 1326815573334,
+ "elapsedTime" : 25196,
+ "diagnostics" : "",
+ "trackingUrl" : "http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473",
+ "queue" : "default",
+ "allocatedMB" : 0,
+ "allocatedVCores" : 0,
+ "runningContainers" : 0,
+ "applicationType" : "MAPREDUCE",
+ "applicationTags" : "",
+ "memorySeconds" : 151730,
+ "vcoreSeconds" : 103,
+ "unmanagedApplication" : "false",
+ "applicationPriority" : 0,
+ "appNodeLabelExpression" : "",
+ "amnodeLabelExpression" : ""
+ }]
+ }
+ };
+ var store = {
+ findAll: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ if (type === 'yarn-app') {
+ resolve(response);
+ } else {
+ resolve({});
+ }
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(3);
+ route.model().then(function(model) {
+ assert.ok(model);
+ assert.ok(model.apps);
+ assert.deepEqual(model.apps, response);
+ });
+});
+
+test('Test getting cluster metrics data', function(assert) {
+ var response = {
+ "clusterMetrics": {
+ "appsSubmitted": 0,
+ "appsCompleted": 0,
+ "appsPending": 0,
+ "appsRunning": 0,
+ "appsFailed": 0,
+ "appsKilled": 0,
+ "reservedMB": 0,
+ "availableMB": 17408,
+ "allocatedMB": 0,
+ "reservedVirtualCores": 0,
+ "availableVirtualCores": 7,
+ "allocatedVirtualCores": 1,
+ "containersAllocated": 0,
+ "containersReserved": 0,
+ "containersPending": 0,
+ "totalMB": 17408,
+ "totalVirtualCores": 8,
+ "totalNodes": 1,
+ 'lostNodes': 0,
+ "unhealthyNodes": 0,
+ "decommissionedNodes": 0,
+ 'rebootedNodes': 0,
+ "activeNodes": 1
+ }
+ };
+ var store = {
+ findAll: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ if (type === 'ClusterMetric') {
+ resolve(response);
+ } else {
+ resolve({});
+ }
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ assert.expect(3);
+ route.model().then(function(model) {
+ assert.ok(model);
+ assert.ok(model.clusterMetrics);
+ assert.deepEqual(model.clusterMetrics, response);
+ });
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
index d0b0553..cce08de 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
@@ -61,11 +61,11 @@ test('Test getting a node', function(assert) {
// Create store which returns appropriate responses.
var store = {
findRecord: function(type) {
- if (type === 'yarnNode') {
+ if (type === 'yarn-node') {
return new Ember.RSVP.Promise(function(resolve) {
resolve(nodeResponse);
});
- } else if (type === 'yarnRmNode') {
+ } else if (type === 'yarn-rm-node') {
return new Ember.RSVP.Promise(function(resolve) {
resolve(rmNodeResponse);
});
@@ -75,10 +75,13 @@ test('Test getting a node', function(assert) {
var route = this.subject();
assert.expect(4);
route.set('store', store);
- var model = route.model(
- {node_addr:"localhost:8042", node_id:"localhost:64318"})._result;
- assert.ok(model.node);
- assert.deepEqual(model.node, nodeResponse);
- assert.ok(model.rmNode);
- assert.deepEqual(model.rmNode, rmNodeResponse);
+ route.model({
+ node_addr:"localhost:8042",
+ node_id:"localhost:64318"
+ }).then(function(model) {
+ assert.ok(model.node);
+ assert.deepEqual(model.node, nodeResponse);
+ assert.ok(model.rmNode);
+ assert.deepEqual(model.rmNode, rmNodeResponse);
+ });
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c6d7d3eb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
index 8a1ce59..017ee9c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
@@ -65,10 +65,11 @@ test('Test getting nodes', function(assert) {
};
var route = this.subject();
route.set('store', store);
- var model = route.model()._result;
- assert.expect(4);
- assert.ok(model);
- assert.equal(model.length, 2);
- assert.deepEqual(response[0], model[0]);
- assert.deepEqual(response[1], model[1]);
+ route.model().then(function(model) {
+ assert.expect(4);
+ assert.ok(model.nodes);
+ assert.equal(model.nodes.length, 2);
+ assert.deepEqual(response[0], model.nodes[0]);
+ assert.deepEqual(response[1], model.nodes[1]);
+ });
});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org