You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2016/10/12 15:07:57 UTC
[43/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
new file mode 100644
index 0000000..4e68da0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Constants from 'yarn-ui/constants';
+
+moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting container log', function(assert) {
+ var response = {
+ logs: "This is syslog",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+/**
+ * This can happen when an empty response is sent from server
+ */
+test('Test non HTTP error while getting container log', function(assert) {
+ var error = {};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+test('Test HTTP error while getting container log', function(assert) {
+ var error = {errors: [{status: 404, responseText: 'Not Found'}]};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(5);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.errors);
+ assert.equal(value.errors.length, 1);
+ assert.equal(value.errors[0].status, 404);
+ assert.equal(value.errors[0].responseText, 'Not Found');
+ });
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
new file mode 100644
index 0000000..8e5acf9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
@@ -0,0 +1,56 @@
+/**
+ * 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-node-app', 'Unit | Route | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific app on a node', function(assert) {
+ var response =
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ app_id:"application_1456251210105_0001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeApp);
+ assert.deepEqual(value.nodeApp, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
new file mode 100644
index 0000000..44d9995
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
@@ -0,0 +1,60 @@
+/**
+ * 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-node-apps', 'Unit | Route | NodeApps', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response = [
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"},
+ {id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.apps);
+ assert.equal(value.apps.length, 2);
+ assert.deepEqual(response[0], value.apps[0]);
+ assert.deepEqual(response[1], value.apps[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
new file mode 100644
index 0000000..f0b68fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
@@ -0,0 +1,61 @@
+/**
+ * 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-node-container', 'Unit | Route | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific container on a node', function(assert) {
+ var response =
+ {id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ container_id:"container_e32_1456000363780_0002_01_000001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeContainer);
+ assert.deepEqual(value.nodeContainer, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
new file mode 100644
index 0000000..8359713
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response =
+ [{id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]},
+ {id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.containers);
+ assert.equal(value.containers.length, 2);
+ assert.deepEqual(value.containers[0], response[0]);
+ assert.deepEqual(value.containers[1], response[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
new file mode 100644
index 0000000..4e82f1b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
@@ -0,0 +1,84 @@
+/**
+ * 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-node', 'Unit | Route | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting a node', function(assert) {
+ var nodeResponse =
+ {healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231};
+ var rmNodeResponse =
+ {rack: "/default-rack", state: "RUNNING", id: "localhost:64318",
+ nodeHostName: "localhost", nodeHTTPAddress: "localhost:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }};
+
+ // Create store which returns appropriate responses.
+ var store = {
+ findRecord: function(type) {
+ if (type == 'yarnNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(nodeResponse);
+ });
+ } else if (type == 'yarnRmNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(rmNodeResponse);
+ });
+ }
+ }
+ };
+ 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);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
new file mode 100644
index 0000000..baa5bd6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
@@ -0,0 +1,74 @@
+/**
+ * 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-nodes', 'Unit | Route | Nodes', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting nodes', function(assert) {
+ var response = [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }},
+ {rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }}];
+ var store = {
+ findAll: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ 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]);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..4158612
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-app', 'Unit | Serializer | yarn app', {
+ // Specify the other units that are required for this test.
+ needs: ['serializer:yarn-app']
+});
+
+// Replace this with your real tests.
+test('it serializes records', function(assert) {
+ var record = this.subject();
+
+ var serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
new file mode 100644
index 0000000..2349dc2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-container-log', 'Unit | Serializer | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-container-log"
+ },
+ payload = "This is syslog";
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!syslog";
+ assert.expect(6);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.logs, payload);
+ assert.equal(response.data.attributes.containerID,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data.attributes.logFileName, "syslog");
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..21a715c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
@@ -0,0 +1,102 @@
+/**
+ * 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-node-app', 'Unit | Serializer | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ apps: {
+ app: [{
+ id:"application_1456251210105_0001", state:"FINISHED", user:"root"
+ },{
+ id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]
+ }]
+ }
+ };
+ assert.expect(15);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].attributes.containers, undefined);
+ assert.equal(response.data[1].attributes.containers.length, 2);
+ assert.deepEqual(response.data[1].attributes.containers,
+ payload.apps.app[1].containerids);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].id, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.appId, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.state, payload.apps.app[i].state);
+ assert.equal(response.data[i].attributes.user, payload.apps.app[i].user);
+ }
+});
+
+test('normalizeArrayResponse no apps test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = { apps: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ 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);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ app: {id:"application_1456251210105_0001", state:"FINISHED", user:"root"}
+ };
+ assert.expect(7);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(payload.app.id, response.data.id);
+ assert.equal(modelClass.modelName, response.data.type);
+ assert.equal(payload.app.id, response.data.attributes.appId);
+ assert.equal(payload.app.state, response.data.attributes.state);
+ assert.equal(payload.app.user, response.data.attributes.user);
+ assert.equal(response.data.attributes.containers, undefined);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..1f08467
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
@@ -0,0 +1,128 @@
+/**
+ * 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-node-container', 'Unit | Serializer | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ containers: {
+ container: [{
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ },{
+ id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]
+ }]
+ }
+ };
+ assert.expect(14);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data[1].id,
+ "container_e32_1456000363780_0002_01_000003");
+ assert.equal(response.data[0].attributes.containerLogFiles.length, 3);
+ assert.equal(response.data[1].attributes.containerLogFiles.length, 4);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.deepEqual(response.data[i].attributes.containerLogFiles,
+ payload.containers.container[i].containerLogFiles);
+ assert.equal(response.data[i].attributes.state,
+ payload.containers.container[i].state);
+ assert.equal(response.data[i].attributes.user,
+ payload.containers.container[i].user);
+ }
+});
+
+test('normalizeArrayResponse no containers test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = { containers: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ 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);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ container: {
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ }
+ };
+ assert.expect(11);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, payload.container.id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.containerId, payload.container.id);
+ assert.equal(response.data.attributes.state, payload.container.state);
+ assert.equal(response.data.attributes.user, payload.container.user);
+ assert.equal(response.data.attributes.exitCode, payload.container.exitCode);
+ assert.equal(response.data.attributes.totalMemoryNeededMB,
+ payload.container.totalMemoryNeeded);
+ assert.equal(response.data.attributes.totalVCoresNeeded,
+ payload.container.totalVCoresNeeded);
+ assert.equal(response.data.attributes.containerLogFiles.length, 3);
+ assert.deepEqual(response.data.attributes.containerLogFiles,
+ payload.container.containerLogFiles);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
new file mode 100644
index 0000000..0e76ccb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
@@ -0,0 +1,69 @@
+/**
+ * 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-node', 'Unit | Serializer | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node"
+ },
+ payload = {
+ nodeInfo: {
+ healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231
+ }
+ };
+ assert.expect(6);
+ var id = "localhost:64318";
+ var response = serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.totalVmemAllocatedContainersMB,
+ payload.nodeInfo.totalVmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalPmemAllocatedContainersMB,
+ payload.nodeInfo.totalPmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalVCoresAllocatedContainers,
+ payload.nodeInfo.totalVCoresAllocatedContainers);
+ assert.equal(response.data.attributes.nmStartupTime,
+ Converter.timeStampToDate(payload.nodeInfo.nmStartupTime));
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..bc6397d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
@@ -0,0 +1,153 @@
+/**
+ * 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-rm-node', 'Unit | Serializer | RMNode', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ nodes: {
+ node: [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ },{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160, nodeLabels: ["y"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }]
+ }
+ };
+ assert.expect(12);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id, "192.168.1.1:64318");
+ assert.equal(response.data[1].id, "192.168.1.2:64318");
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].attributes.nodeHostName,
+ payload.nodes.node[i].nodeHostName);
+ assert.equal(response.data[i].attributes.nodeHTTPAddress,
+ payload.nodes.node[i].nodeHTTPAddress);
+ assert.deepEqual(response.data[i].attributes.nodeLabels,
+ payload.nodes.node[i].nodeLabels);
+ }
+});
+
+test('normalizeArrayResponse no nodes test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = { nodes: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ console.log(response);
+ 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);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ node: {
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }
+ };
+ assert.expect(13);
+ var id = "localhost:64318";
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.rack, payload.node.rack);
+ assert.equal(response.data.attributes.state, payload.node.state);
+ assert.equal(response.data.attributes.nodeHostName,
+ payload.node.nodeHostName);
+ assert.equal(response.data.attributes.nodeHTTPAddress,
+ payload.node.nodeHTTPAddress);
+ assert.equal(response.data.attributes.version, payload.node.version);
+ assert.equal(response.data.attributes.availMemoryMB,
+ payload.node.availMemoryMB);
+ assert.equal(response.data.attributes.usedMemoryMB,
+ payload.node.usedMemoryMB);
+ assert.equal(response.data.attributes.availableVirtualCores,
+ payload.node.availableVirtualCores);
+ assert.equal(response.data.attributes.usedVirtualCores,
+ payload.node.usedVirtualCores);
+ assert.deepEqual(response.data.attributes.nodeLabels,
+ payload.node.nodeLabels);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
new file mode 100644
index 0000000..481537d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import converter from '../../../utils/converter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | Converter');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ assert.ok(converter);
+ assert.ok(converter.splitForContainerLogs);
+});
+
+test('split for container logs', function(assert) {
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog";
+ var arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog!logs";
+ arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog!logs"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001";
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = null;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = undefined;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
new file mode 100644
index 0000000..8f17380
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Sorter from 'yarn-ui/utils/sorter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | Sorter');
+
+test('Basic creation test', function(assert) {
+ assert.ok(Sorter);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
deleted file mode 100644
index 0f35392..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "framework": "qunit",
- "test_page": "tests/index.html?hidepassed",
- "disable_watching": true,
- "launch_in_ci": [
- "PhantomJS"
- ],
- "launch_in_dev": [
- "PhantomJS",
- "Chrome"
- ]
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
deleted file mode 100644
index 6ec0b7c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "predef": [
- "document",
- "window",
- "location",
- "setTimeout",
- "$",
- "-Promise",
- "define",
- "console",
- "visit",
- "exists",
- "fillIn",
- "click",
- "keyEvent",
- "triggerEvent",
- "find",
- "findWithAssert",
- "wait",
- "DS",
- "andThen",
- "currentURL",
- "currentPath",
- "currentRouteName"
- ],
- "node": false,
- "browser": false,
- "boss": true,
- "curly": true,
- "debug": false,
- "devel": false,
- "eqeqeq": true,
- "evil": true,
- "forin": false,
- "immed": false,
- "laxbreak": false,
- "newcap": true,
- "noarg": true,
- "noempty": false,
- "nonew": false,
- "nomen": false,
- "onevar": false,
- "plusplus": false,
- "regexp": false,
- "undef": true,
- "sub": true,
- "strict": false,
- "white": false,
- "eqnull": true,
- "esnext": true,
- "unused": true
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
deleted file mode 100644
index 28f4ece..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Resolver from 'ember/resolver';
-import config from '../../config/environment';
-
-var resolver = Resolver.create();
-
-resolver.namespace = {
- modulePrefix: config.modulePrefix,
- podModulePrefix: config.podModulePrefix
-};
-
-export default resolver;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
deleted file mode 100644
index 0f7aab1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Ember from 'ember';
-import Application from '../../app';
-import config from '../../config/environment';
-
-export default function startApp(attrs) {
- var application;
-
- var attributes = Ember.merge({}, config.APP);
- attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
-
- Ember.run(function() {
- application = Application.create(attributes);
- application.setupForTesting();
- application.injectTestHelpers();
- });
-
- return application;
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
deleted file mode 100644
index 33f7045..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>YarnUi Tests</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
-
- {{content-for 'head'}}
- {{content-for 'test-head'}}
-
- <link rel="stylesheet" href="assets/vendor.css">
- <link rel="stylesheet" href="assets/yarn-ui.css">
- <link rel="stylesheet" href="assets/test-support.css">
-
- {{content-for 'head-footer'}}
- {{content-for 'test-head-footer'}}
- </head>
- <body>
-
- {{content-for 'body'}}
- {{content-for 'test-body'}}
- <script src="assets/vendor.js"></script>
- <script src="assets/test-support.js"></script>
- <script src="assets/yarn-ui.js"></script>
- <script src="testem.js"></script>
- <script src="assets/test-loader.js"></script>
-
- {{content-for 'body-footer'}}
- {{content-for 'test-body-footer'}}
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
deleted file mode 100644
index e6cfb70..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import resolver from './helpers/resolver';
-import {
- setResolver
-} from 'ember-qunit';
-
-setResolver(resolver);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
deleted file mode 100644
index 5683d5a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-app', 'Unit | Adapter | yarn app', {
- // Specify the other units that are required for this test.
- // needs: ['serializer:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var adapter = this.subject();
- assert.ok(adapter);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
deleted file mode 100644
index e6e7b43..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
+++ /dev/null
@@ -1,73 +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 { moduleFor, test } from 'ember-qunit';
-import Constants from 'yarn-ui/constants';
-
-moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "text/plain");
- assert.equal(adapter.namespace, "ws/v1/node");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042" +
- Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" +
- Constants.PARAM_SEPARATOR + "syslog"),
- host + "localhost:8042/ws/v1/node/containerlogs/" +
- "container_e27_11111111111_0001_01_000001/syslog");
-});
-
-test('ajaxOptions test', function(assert) {
- let adapter = this.subject();
- var hash = adapter.ajaxOptions('/containerlogs', 'type', {});
- assert.equal(hash.dataType, 'text');
-});
-
-test('findRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testSnapshot = {};
- let host = adapter.host;
- let testId = "localhost:8042" + Constants.PARAM_SEPARATOR +
- "container_e27_11111111111_0001_01_000001" + Constants.PARAM_SEPARATOR +
- "syslog";
- assert.expect(2);
-
- adapter.ajax = function (url, method) {
- assert.equal(url, host + "localhost:8042/ws/v1/node/containerlogs/" +
- "container_e27_11111111111_0001_01_000001/syslog");
- assert.equal(method, 'GET');
- };
-
- adapter.findRecord(testStore, testModel, testId, testSnapshot);
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
deleted file mode 100644
index 3a25996..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
+++ /dev/null
@@ -1,93 +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 { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
- assert.expect(11);
- assert.ok(adapter);
- assert.ok(adapter.urlForQueryRecord);
- assert.ok(adapter.queryRecord);
- assert.ok(adapter.urlForQuery);
- assert.ok(adapter.query);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
-});
-
-test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
- adapter.urlForQueryRecord(
- {nodeAddr: "localhost:8042", appId: "application_1111111111_1111"}));
-});
-
-test('urlForQuery test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/apps",
- adapter.urlForQuery({nodeAddr: "localhost:8042"}));
-});
-
-test('query test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {nodeAddr: "localhost:8042"};
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/apps", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.query(testStore, testModel, testQuery);
-});
-
-test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {
- nodeAddr: "localhost:8042",
- appId: "application_1111111111_1111"
- };
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
- url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.queryRecord(testStore, testModel, testQuery);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
deleted file mode 100644
index 7d2bb2d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
+++ /dev/null
@@ -1,93 +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 { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
- assert.expect(11);
- assert.ok(adapter);
- assert.ok(adapter.urlForQueryRecord);
- assert.ok(adapter.queryRecord);
- assert.ok(adapter.urlForQuery);
- assert.ok(adapter.query);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
-});
-
-test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
- "container_e27_11111111111_0001_01_000001",
- adapter.urlForQueryRecord(
- {nodeHttpAddr: "localhost:8042",
- containerId: "container_e27_11111111111_0001_01_000001"}));
-});
-
-test('urlForQuery test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers",
- adapter.urlForQuery({nodeHttpAddr: "localhost:8042"}));
-});
-
-test('query test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {nodeHttpAddr: "localhost:8042"};
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/containers", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.query(testStore, testModel, testQuery);
-});
-
-test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {
- nodeHttpAddr: "localhost:8042",
- containerId: "container_e27_11111111111_0001_01_000001"
- };
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
- "container_e27_11111111111_0001_01_000001", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.queryRecord(testStore, testModel, testQuery);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
deleted file mode 100644
index 15aefef..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
+++ /dev/null
@@ -1,42 +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 { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node', 'Unit | Adapter | Node', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "application/json");
- assert.equal(adapter.namespace, "ws/v1/node");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042"),
- host + "localhost:8042/ws/v1/node");
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
deleted file mode 100644
index bf009d4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
+++ /dev/null
@@ -1,44 +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 { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-rm-node', 'Unit | Adapter | RMNode', {
- // Specify the other units that are required for this test.
- // needs: ['serializer:foo']
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "application/json");
- assert.equal(adapter.namespace, "ws/v1/cluster");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042"),
- host + "/ws/v1/cluster/nodes/localhost:8042");
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
deleted file mode 100644
index d25f72d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:yarn-apps', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var controller = this.subject();
- assert.ok(controller);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
deleted file mode 100644
index 313dfdd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:yarn-queues', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var controller = this.subject();
- assert.ok(controller);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
deleted file mode 100644
index b4f3503..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import Ember from 'ember';
-import ChartsMixin from '../../../mixins/charts';
-import { module, test } from 'qunit';
-
-module('Unit | Mixin | charts');
-
-// Replace this with your real tests.
-test('it works', function(assert) {
- var ChartsObject = Ember.Object.extend(ChartsMixin);
- var subject = ChartsObject.create();
- assert.ok(subject);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
deleted file mode 100644
index e3261e2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-app', 'Unit | Model | yarn app', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('it exists', function(assert) {
- var model = this.subject();
- // var store = this.store();
- assert.ok(!!model);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
deleted file mode 100644
index 45808a5..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
+++ /dev/null
@@ -1,48 +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 { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.logs);
- assert.ok(model.containerID);
- assert.ok(model.logFileName);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("logs", "This is syslog");
- model.set("containerID", "container_e32_1456000363780_0002_01_000001");
- model.set("logFileName", "syslog");
- assert.equal(model.get("logs"), "This is syslog");
- assert.equal(model.get("containerID"), "container_e32_1456000363780_0002_01_000001");
- assert.equal(model.get("logFileName"), "syslog");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
deleted file mode 100644
index 7e2e62f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
+++ /dev/null
@@ -1,65 +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 { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.appId);
- assert.ok(model.state);
- assert.ok(model.user);
- assert.ok(model.containers);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- assert.expect(9);
- Ember.run(function () {
- model.set("appId", "application_1456251210105_0002");
- model.set("id", "application_1456251210105_0002");
- model.set("state", "RUNNING");
- model.set("user", "hadoop");
- model.set("containers", ["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]);
- assert.equal(model.get("appId"), "application_1456251210105_0002");
- assert.equal(model.get("state"), "RUNNING");
- assert.equal(model.get("user"), "hadoop");
- assert.deepEqual(model.get("containers"),
- ["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]);
- assert.equal(model.get("appStateStyle"), "label label-primary");
- assert.equal(model.get("isDummyApp"), false);
- model.set("id", "dummy");
- assert.equal(model.get("isDummyApp"), true);
- model.set("state", "FINISHED");
- assert.equal(model.get("appStateStyle"), "label label-success");
- model.set("state", "NEW");
- assert.equal(model.get("appStateStyle"), "label label-default");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
deleted file mode 100644
index 88bf233..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
+++ /dev/null
@@ -1,78 +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 { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.containerId);
- assert.ok(model.state);
- assert.ok(model.user);
- assert.ok(model.exitCode);
- assert.ok(model.totalMemoryNeeded);
- assert.ok(model.totalVCoresNeeded);
- assert.ok(model.containerLogFiles);
- assert.ok(model.isDummyContainer);
- assert.ok(model.containerStateStyle);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("containerId", "container_e32_1456000363780_0002_01_000003");
- model.set("state", "RUNNING");
- model.set("exitCode", "-1000");
- model.set("user", "hadoop");
- model.set("id", "container_e32_1456000363780_0002_01_000003");
- model.set("totalMemoryNeeded", 1024);
- model.set("totalVCoresNeeded", 1);
- model.set("containerLogFiles", ["syslog", "stderr", "stdout"]);
- assert.equal(model.get("containerId"), "container_e32_1456000363780_0002_01_000003");
- assert.equal(model.get("id"), "container_e32_1456000363780_0002_01_000003");
- assert.equal(model.get("totalMemoryNeeded"), 1024);
- assert.equal(model.get("totalVCoresNeeded"), 1);
- assert.equal(model.get("user"), "hadoop");
- assert.equal(model.get("exitCode"), "-1000");
- assert.equal(model.get("containerLogFiles").length, 3);
- assert.deepEqual(model.get("containerLogFiles"), ["syslog", "stderr", "stdout"]);
- assert.equal(model.get("isDummyContainer"), false);
- assert.equal(model.get("containerStateStyle"), "label label-primary");
- model.set("id", "dummy");
- assert.equal(model.get("isDummyContainer"), true);
- model.set("state", "EXITED_WITH_SUCCESS");
- assert.equal(model.get("containerStateStyle"), "label label-success");
- model.set("state", "EXITED_WITH_FAILURE");
- assert.equal(model.get("containerStateStyle"), "label label-danger");
- model.set("state", "DONE");
- model.set("exitCode", "0");
- assert.equal(model.get("containerStateStyle"), "label label-success");
- model.set("exitCode", "-105");
- assert.equal(model.get("containerStateStyle"), "label label-danger");
- });
-});
-
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org