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);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
index aa8fb07..1414472 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
@@ -16,8 +16,6 @@
* limitations under the License.
*/
-/* globals ENV: true */
-
import Ember from 'ember';
function getTimeLineURL() {
@@ -25,21 +23,16 @@ function getTimeLineURL() {
}
function updateConfigs(application) {
+ var ENV = window.ENV;
var hostname = window.location.hostname;
- var rmhost = hostname +
- (window.location.port ? ':' + window.location.port: '');
-
+ var rmhost = hostname + (window.location.port ? ':' + window.location.port: '');
Ember.Logger.log("RM Address:" + rmhost);
- if(!ENV.hosts.rmWebAddress) {
- ENV = {
- hosts: {
- rmWebAddress: rmhost,
- },
- };
+ if(ENV && !ENV.hosts.rmWebAddress) {
+ ENV.hosts.rmWebAddress = rmhost;
}
- if(!ENV.hosts.timelineWebAddress) {
+ if(ENV && !ENV.hosts.timelineWebAddress) {
var timelinehost = "";
$.ajax({
type: 'GET',
@@ -50,26 +43,19 @@ function updateConfigs(application) {
success: function(data) {
timelinehost = data.property.value;
ENV.hosts.timelineWebAddress = timelinehost;
-
var address = timelinehost.split(":")[0];
var port = timelinehost.split(":")[1];
-
Ember.Logger.log("Timeline Address from RM:" + address + ":" + port);
if(address === "0.0.0.0" || address === "localhost") {
var updatedAddress = hostname + ":" + port;
-
/* Timeline v2 is not supporting CORS, so make as default*/
- ENV = {
- hosts: {
- rmWebAddress: rmhost,
- timelineWebAddress: updatedAddress,
- },
- };
+ ENV.hosts.timelineWebAddress = updatedAddress;
Ember.Logger.log("Timeline Updated Address:" + updatedAddress);
}
+
application.advanceReadiness();
- },
+ }
});
} else {
application.advanceReadiness();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
index 27c48f7..dba53b1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
@@ -77,7 +77,7 @@ export default DS.Model.extend({
hasUserUsages: function() {
return this.get("userUsagesDonutChartData").length > 0;
- }.property(),
+ }.property("userUsagesDonutChartData"),
numOfApplicationsDonutChartData: function() {
return [
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();
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 @@
+
{{content-for 'body-footer'}}
{{content-for 'test-body-footer'}}
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
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
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);
});
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;
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
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);
};
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);
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");
});
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");
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');
});
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);
-});
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);
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);
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);
-});
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
deleted file mode 100644
index 1f5ab99..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js
+++ /dev/null
@@ -1,30 +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 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);
-});
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);
+});
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}]);
+});
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");
+});
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');
});
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");
- });
-});
-
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..8a6f1cc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-test.js
@@ -0,0 +1,31 @@
+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');
+});
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");
});
});
-
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");
});
});
-
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");
- });
-});
-
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');
+});
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"), "");
});
});
-
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);
+});
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
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);
+});
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
index 917a159..0b9cbab 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
@@ -17,13 +17,45 @@
*/
import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
moduleFor('route:yarn-app-attempts', 'Unit | Route | yarn app attempts', {
- // 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) {
let route = this.subject();
assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.unloadAll);
+});
+
+test('Test getting yarn app attempts', function(assert) {
+ var response = {
+ "appAttempts" : {
+ "appAttempt" : [{
+ "nodeId" : "host.domain.com:8041",
+ "nodeHttpAddress" : "host.domain.com:8042",
+ "startTime" : 1326381444693,
+ "id" : 1,
+ "logsLink" : "http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001/user1",
+ "containerId" : "container_1326821518301_0005_01_000001"
+ }]
+ }
+ };
+ var appId = "application_1326821518301_0005";
+ var store = {
+ query: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ route.model({app_id: appId}).then(function(model) {
+ assert.ok(model);
+ assert.equal(model.appId, appId);
+ assert.deepEqual(model.attempts, response);
+ });
});
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
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
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);
+ });
});
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]);
+ });
});
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
index 5153435..5e96fae 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
@@ -17,13 +17,293 @@
*/
import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
moduleFor('route:yarn-queues', 'Unit | Route | yarn queues', {
- // 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) {
let route = this.subject();
assert.ok(route);
+ assert.ok(route.model);
+ assert.ok(route.afterModel);
+ assert.ok(route.unloadAll);
});
+
+test('Test getting yarn queues', function(assert) {
+ let response = {
+ "scheduler": {
+ "schedulerInfo": {
+ "capacity": 100,
+ "maxCapacity": 100,
+ "queueName": "root",
+ "queues": {
+ "queue": [
+ {
+ "absoluteCapacity": 10.5,
+ "absoluteMaxCapacity": 50,
+ "absoluteUsedCapacity": 0,
+ "capacity": 10.5,
+ "maxCapacity": 50,
+ "numApplications": 0,
+ "queueName": "a",
+ "queues": {
+ "queue": [
+ {
+ "absoluteCapacity": 3.15,
+ "absoluteMaxCapacity": 25,
+ "absoluteUsedCapacity": 0,
+ "capacity": 30.000002,
+ "maxCapacity": 50,
+ "numApplications": 0,
+ "queueName": "a1",
+ "queues": {
+ "queue": [
+ {
+ "absoluteCapacity": 2.6775,
+ "absoluteMaxCapacity": 25,
+ "absoluteUsedCapacity": 0,
+ "capacity": 85,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 1,
+ "maxApplications": 267,
+ "maxApplicationsPerUser": 267,
+ "maxCapacity": 100,
+ "numActiveApplications": 0,
+ "numApplications": 0,
+ "numContainers": 0,
+ "numPendingApplications": 0,
+ "queueName": "a1a",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 1,
+ "users": null
+ },
+ {
+ "absoluteCapacity": 0.47250003,
+ "absoluteMaxCapacity": 25,
+ "absoluteUsedCapacity": 0,
+ "capacity": 15.000001,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 1,
+ "maxApplications": 47,
+ "maxApplicationsPerUser": 47,
+ "maxCapacity": 100,
+ "numActiveApplications": 0,
+ "numApplications": 0,
+ "numContainers": 0,
+ "numPendingApplications": 0,
+ "queueName": "a1b",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 1,
+ "users": null
+ }
+ ]
+ },
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "usedCapacity": 0,
+ "usedResources": ""
+ },
+ {
+ "absoluteCapacity": 7.35,
+ "absoluteMaxCapacity": 50,
+ "absoluteUsedCapacity": 0,
+ "capacity": 70,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 100,
+ "maxApplications": 735,
+ "maxApplicationsPerUser": 73500,
+ "maxCapacity": 100,
+ "numActiveApplications": 0,
+ "numApplications": 0,
+ "numContainers": 0,
+ "numPendingApplications": 0,
+ "queueName": "a2",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 100,
+ "users": null
+ }
+ ]
+ },
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "usedCapacity": 0,
+ "usedResources": ""
+ },
+ {
+ "absoluteCapacity": 89.5,
+ "absoluteMaxCapacity": 100,
+ "absoluteUsedCapacity": 0,
+ "capacity": 89.5,
+ "maxCapacity": 100,
+ "numApplications": 2,
+ "queueName": "b",
+ "queues": {
+ "queue": [
+ {
+ "absoluteCapacity": 53.7,
+ "absoluteMaxCapacity": 100,
+ "absoluteUsedCapacity": 0,
+ "capacity": 60.000004,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 100,
+ "maxApplications": 5370,
+ "maxApplicationsPerUser": 537000,
+ "maxCapacity": 100,
+ "numActiveApplications": 1,
+ "numApplications": 2,
+ "numContainers": 0,
+ "numPendingApplications": 1,
+ "queueName": "b1",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 100,
+ "users": {
+ "user": [
+ {
+ "numActiveApplications": 0,
+ "numPendingApplications": 1,
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "username": "user2"
+ },
+ {
+ "numActiveApplications": 1,
+ "numPendingApplications": 0,
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "username": "user1"
+ }
+ ]
+ }
+ },
+ {
+ "absoluteCapacity": 35.3525,
+ "absoluteMaxCapacity": 100,
+ "absoluteUsedCapacity": 0,
+ "capacity": 39.5,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 100,
+ "maxApplications": 3535,
+ "maxApplicationsPerUser": 353500,
+ "maxCapacity": 100,
+ "numActiveApplications": 0,
+ "numApplications": 0,
+ "numContainers": 0,
+ "numPendingApplications": 0,
+ "queueName": "b2",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 100,
+ "users": null
+ },
+ {
+ "absoluteCapacity": 0.4475,
+ "absoluteMaxCapacity": 100,
+ "absoluteUsedCapacity": 0,
+ "capacity": 0.5,
+ "maxActiveApplications": 1,
+ "maxActiveApplicationsPerUser": 100,
+ "maxApplications": 44,
+ "maxApplicationsPerUser": 4400,
+ "maxCapacity": 100,
+ "numActiveApplications": 0,
+ "numApplications": 0,
+ "numContainers": 0,
+ "numPendingApplications": 0,
+ "queueName": "b3",
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "type": "capacitySchedulerLeafQueueInfo",
+ "usedCapacity": 0,
+ "usedResources": "",
+ "userLimit": 100,
+ "userLimitFactor": 100,
+ "users": null
+ }
+ ]
+ },
+ "resourcesUsed": {
+ "memory": 0,
+ "vCores": 0
+ },
+ "state": "RUNNING",
+ "usedCapacity": 0,
+ "usedResources": ""
+ }
+ ]
+ },
+ "type": "capacityScheduler",
+ "usedCapacity": 0
+ }
+ }
+ };
+ let store = {
+ query: function() {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ let route = this.subject();
+ route.set('store', store);
+ route.model({queue_name: 'a1'}).then(function(model) {
+ assert.ok(model);
+ assert.ok(model.queues);
+ assert.ok(model.selected);
+ assert.equal(model.selected, 'a1');
+ assert.deepEqual(model.queues, response);
+ });
+});
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-info-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-info-test.js
new file mode 100644
index 0000000..d440501
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-info-test.js
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:cluster-info', 'Unit | Serializer | cluster info', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+});
+
+test('Test normalizeArrayResponse', function(assert) {
+ var serializer = this.subject(),
+ modelClass = {
+ modelName: "cluster-info"
+ },
+ payload = {
+ "clusterInfo": {
+ "id":1324053971963,
+ "startedOn":1324053971963,
+ "state":"STARTED",
+ "resourceManagerVersion":"0.23.1-SNAPSHOT",
+ "resourceManagerBuildVersion":"0.23.1-SNAPSHOT from 1214049 by user1 source checksum 050cd664439d931c8743a6428fd6a693",
+ "resourceManagerVersionBuiltOn":"Tue Dec 13 22:12:48 CST 2011",
+ "hadoopVersion":"0.23.1-SNAPSHOT",
+ "hadoopBuildVersion":"0.23.1-SNAPSHOT from 1214049 by user1 source checksum 11458df3bb77342dca5f917198fad328",
+ "hadoopVersionBuiltOn":"Tue Dec 13 22:12:26 CST 2011"
+ }
+ };
+ var id = 1324053971963;
+ var normalized = serializer.normalizeArrayResponse({}, modelClass, payload, id, null);
+ assert.expect(12);
+ assert.ok(normalized.data);
+ assert.ok(normalized.data[0]);
+ assert.equal(normalized.data.length, 1);
+ assert.equal(normalized.data[0].id, id);
+ assert.equal(normalized.data[0].type, modelClass.modelName);
+ assert.equal(normalized.data[0].attributes.startedOn, payload.clusterInfo.startedOn);
+ assert.equal(normalized.data[0].attributes.state, payload.clusterInfo.state);
+ assert.equal(normalized.data[0].attributes.resourceManagerVersion,
+ payload.clusterInfo.resourceManagerVersion);
+ assert.equal(normalized.data[0].attributes.resourceManagerBuildVersion,
+ payload.clusterInfo.resourceManagerBuildVersion);
+ assert.equal(normalized.data[0].attributes.hadoopVersion,
+ payload.clusterInfo.hadoopVersion);
+ assert.equal(normalized.data[0].attributes.hadoopBuildVersion,
+ payload.clusterInfo.hadoopBuildVersion);
+ assert.equal(normalized.data[0].attributes.hadoopVersionBuiltOn,
+ payload.clusterInfo.hadoopVersionBuiltOn);
+});
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-metric-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-metric-test.js
new file mode 100644
index 0000000..53efa53
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/cluster-metric-test.js
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:cluster-metric', 'Unit | Serializer | cluster metric', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+});
+
+test('Test normalizeArrayResponse', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: 'cluster-metric'
+ },
+ payload = {
+ "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
+ }
+ };
+ let normalized = serializer.normalizeArrayResponse({}, modelClass, payload, 1, null);
+ assert.expect(20);
+ assert.ok(normalized.data);
+ assert.ok(normalized.data[0]);
+ assert.equal(normalized.data[0].id, 1);
+ assert.equal(normalized.data[0].type, modelClass.modelName);
+ assert.equal(normalized.data[0].attributes.appsSubmitted, payload.clusterMetrics.appsSubmitted);
+ assert.equal(normalized.data[0].attributes.appsCompleted, payload.clusterMetrics.appsCompleted);
+ assert.equal(normalized.data[0].attributes.appsPending, payload.clusterMetrics.appsPending);
+ assert.equal(normalized.data[0].attributes.appsRunning, payload.clusterMetrics.appsRunning);
+ assert.equal(normalized.data[0].attributes.appsFailed, payload.clusterMetrics.appsFailed);
+ assert.equal(normalized.data[0].attributes.appsKilled, payload.clusterMetrics.appsKilled);
+ assert.equal(normalized.data[0].attributes.reservedMB, payload.clusterMetrics.reservedMB);
+ assert.equal(normalized.data[0].attributes.availableMB, payload.clusterMetrics.availableMB);
+ assert.equal(normalized.data[0].attributes.allocatedMB, payload.clusterMetrics.allocatedMB);
+ assert.equal(normalized.data[0].attributes.totalMB, payload.clusterMetrics.totalMB);
+ assert.equal(normalized.data[0].attributes.reservedVirtualCores,
+ payload.clusterMetrics.reservedVirtualCores);
+ assert.equal(normalized.data[0].attributes.availableVirtualCores,
+ payload.clusterMetrics.availableVirtualCores);
+ assert.equal(normalized.data[0].attributes.allocatedVirtualCores,
+ payload.clusterMetrics.allocatedVirtualCores);
+ assert.equal(normalized.data[0].attributes.totalVirtualCores,
+ payload.clusterMetrics.totalVirtualCores);
+ assert.equal(normalized.data[0].attributes.activeNodes, payload.clusterMetrics.activeNodes);
+ assert.equal(normalized.data[0].attributes.totalNodes, payload.clusterMetrics.totalNodes);
+});
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-attempt-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-attempt-test.js
new file mode 100644
index 0000000..bc88374
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-attempt-test.js
@@ -0,0 +1,101 @@
+/**
+ * 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('serializer:yarn-app-attempt', 'Unit | Serializer | yarn app attempt', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+});
+
+test('Test normalizeSingleResponse', function(assert) {
+ let serializer = this.subject(),
+ payload = {
+ "appAttemptId": "appattempt_1479277364592_0001_000001",
+ "host": "N/A",
+ "rpcPort": "-1",
+ "trackingUrl": "http://ctr-e46-1478293962054-1774-01-000007.hwx.site:25005/proxy/application_1479277364592_0001/",
+ "originalTrackingUrl": "http://ctr-e46-1478293962054-1774-01-000004.hwx.site:19888/jobhistory/job/job_1479277364592_0001",
+ "diagnosticsInfo": "Attempt recovered after RM restart",
+ "appAttemptState": "FINISHED",
+ "amContainerId": "container_e01_1479277364592_0001_01_000001",
+ "startedTime": "1479280923398",
+ "finishedTime": "1479280966401"
+ },
+ modelClass = {
+ modelName: 'yarn-app-attempt'
+ };
+ var response = serializer.normalizeSingleResponse({}, modelClass, payload, payload.appAttemptId);
+ assert.ok(response);
+ assert.ok(response.data);
+ assert.equal(response.data.id, payload.appAttemptId);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.appAttemptId, payload.appAttemptId);
+ assert.equal(response.data.attributes.hosts, payload.host);
+ assert.equal(response.data.attributes.amContainerId, payload.amContainerId);
+ assert.equal(response.data.attributes.state, payload.appAttemptState);
+ assert.equal(response.data.attributes.startedTime, Converter.timeStampToDate(payload.startedTime));
+ assert.equal(response.data.attributes.finishedTime, Converter.timeStampToDate(payload.finishedTime));
+});
+
+test('Test normalizeArrayResponse', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: 'yarn-app-attempt'
+ },
+ payload = {
+ "appAttempts": {
+ "appAttempt": [
+ {
+ "id": 1,
+ "startTime": 1479280923398,
+ "finishedTime": 1479280966401,
+ "containerId": "container_e01_1479277364592_0001_01_000001",
+ "nodeHttpAddress": "ctr-e46-1478293962054-1774-01-000004.hwx.site:25008",
+ "nodeId": "ctr-e46-1478293962054-1774-01-000004.hwx.site:25006",
+ "logsLink": "http://ctr-e46-1478293962054-1774-01-000004.hwx.site:25008/node/containerlogs/container_e01_1479277364592_0001_01_000001/user1",
+ "blacklistedNodes": "",
+ "nodesBlacklistedBySystem": "",
+ "appAttemptId": "appattempt_1479277364592_0001_000001"
+ }
+ ]
+ }
+ };
+ let response = serializer.normalizeArrayResponse({}, modelClass, payload);
+ assert.ok(response);
+ assert.ok(response.data);
+ assert.ok(response.data[0]);
+ assert.equal(response.data[0].id, payload.appAttempts.appAttempt[0].appAttemptId);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].attributes.appAttemptId, payload.appAttempts.appAttempt[0].appAttemptId);
+ assert.equal(response.data[0].attributes.containerId, payload.appAttempts.appAttempt[0].containerId);
+ assert.equal(response.data[0].attributes.nodeHttpAddress, payload.appAttempts.appAttempt[0].nodeHttpAddress);
+ assert.equal(response.data[0].attributes.nodeId, payload.appAttempts.appAttempt[0].nodeId);
+ assert.equal(response.data[0].attributes.logsLink, payload.appAttempts.appAttempt[0].logsLink);
+ assert.equal(response.data[0].attributes.startTime,
+ Converter.timeStampToDate(payload.appAttempts.appAttempt[0].startTime));
+ assert.equal(response.data[0].attributes.finishedTime,
+ Converter.timeStampToDate(payload.appAttempts.appAttempt[0].finishedTime));
+});
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
index 4158612..b2b4c6d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
@@ -16,18 +16,62 @@
* limitations under the License.
*/
-import { moduleForModel, test } from 'ember-qunit';
+import { moduleFor, test } from 'ember-qunit';
-moduleForModel('yarn-app', 'Unit | Serializer | yarn app', {
- // Specify the other units that are required for this test.
- needs: ['serializer:yarn-app']
+moduleFor('serializer:yarn-app', 'Unit | Serializer | yarn app', {
});
-// Replace this with your real tests.
-test('it serializes records', function(assert) {
- var record = this.subject();
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
- var serializedRecord = record.serialize();
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
- assert.ok(serializedRecord);
+// Replace this with your real tests.
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-app"
+ },
+ payload = {
+ app : {
+ finishedTime : 1326824991300,
+ amContainerLogs : "localhost:8042/node/containerlogs/container_1326821518301_0005_01_000001",
+ trackingUI : "History",
+ state : "FINISHED",
+ user : "user1",
+ id : "application_1326821518301_0005",
+ clusterId : 1326821518301,
+ finalStatus : "SUCCEEDED",
+ amHostHttpAddress : "localhost:8042",
+ amRPCAddress : "localhost:4201",
+ progress : 100,
+ name : "Sleep job",
+ applicationType : "Yarn",
+ startedTime : 1326824544552,
+ elapsedTime : 446748,
+ diagnostics : "",
+ trackingUrl : "localhost:8088/proxy/application_1326821518301_0005/jobhistory/job/job_1326821518301_5_5",
+ queue : "a1",
+ memorySeconds : 151730,
+ vcoreSeconds : 103,
+ unmanagedApplication : "false",
+ applicationPriority : 0,
+ appNodeLabelExpression : "",
+ amNodeLabelExpression : ""
+ }
+ },
+ id = "application_1326821518301_0005";
+ var response = serializer.normalizeSingleResponse({}, modelClass, payload, id);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.appName, payload.app.name);
+ assert.equal(response.data.attributes.user, payload.app.user);
+ assert.equal(response.data.attributes.state, payload.app.state);
+ assert.equal(response.data.attributes.finalStatus, payload.app.finalStatus);
+ assert.equal(response.data.attributes.queue, payload.app.queue);
+ assert.equal(response.data.attributes.applicationType, payload.app.applicationType);
+ assert.equal(response.data.attributes.progress, payload.app.progress);
});
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-test.js
new file mode 100644
index 0000000..97c0962
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-test.js
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-container', 'Unit | Serializer | yarn container', {
+ unit: true
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+});
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
index 21a715c..8c8f3cd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
@@ -48,7 +48,7 @@ test('normalizeArrayResponse test', function(assert) {
};
assert.expect(15);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
assert.equal(response.data.length, 2);
assert.equal(response.data[0].attributes.containers, undefined);
@@ -70,14 +70,11 @@ test('normalizeArrayResponse no apps test', function(assert) {
modelName: "yarn-node-app"
},
payload = { apps: null };
- assert.expect(5);
+ assert.expect(2);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.appId, undefined);
+ assert.equal(response.data.length, 0);
});
test('normalizeSingleResponse test', function(assert) {
@@ -90,7 +87,7 @@ test('normalizeSingleResponse test', function(assert) {
};
assert.expect(7);
var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ serializer.normalizeSingleResponse({}, modelClass, payload);
assert.ok(response.data);
assert.equal(payload.app.id, response.data.id);
assert.equal(modelClass.modelName, response.data.type);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
index 1f08467..dbe94db 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
@@ -56,7 +56,7 @@ test('normalizeArrayResponse test', function(assert) {
};
assert.expect(14);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
assert.equal(response.data.length, 2);
assert.equal(response.data[0].id,
@@ -82,14 +82,11 @@ test('normalizeArrayResponse no containers test', function(assert) {
modelName: "yarn-node-container"
},
payload = { containers: null };
- assert.expect(5);
+ assert.expect(2);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.containerId, undefined);
+ assert.equal(response.data.length, 0);
});
test('normalizeSingleResponse test', function(assert) {
@@ -109,7 +106,7 @@ test('normalizeSingleResponse test', function(assert) {
};
assert.expect(11);
var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ serializer.normalizeSingleResponse({}, modelClass, payload);
assert.ok(response.data);
assert.equal(response.data.id, payload.container.id);
assert.equal(response.data.type, modelClass.modelName);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
index bc6397d..1fc8539 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
@@ -70,7 +70,7 @@ test('normalizeArrayResponse test', function(assert) {
};
assert.expect(12);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
assert.equal(response.data.length, 2);
assert.equal(response.data[0].id, "192.168.1.1:64318");
@@ -92,15 +92,11 @@ test('normalizeArrayResponse no nodes test', function(assert) {
modelName: "yarn-rm-node"
},
payload = { nodes: null };
- assert.expect(5);
+ assert.expect(2);
var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- console.log(response);
+ serializer.normalizeArrayResponse({}, modelClass, payload);
assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.nodeHostName, undefined);
+ assert.equal(response.data.length, 0);
});
test('normalizeSingleResponse test', function(assert) {
@@ -128,7 +124,7 @@ test('normalizeSingleResponse test', function(assert) {
assert.expect(13);
var id = "localhost:64318";
var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ serializer.normalizeSingleResponse({}, modelClass, payload, id);
assert.ok(response.data);
assert.equal(response.data.id, id);
assert.equal(response.data.type, modelClass.modelName);