tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/2] tez git commit: TEZ-3529. Tez UI: Add 'All Queries' table in the landing page along 'All DAGs' page (sree)
Date Wed, 18 Jan 2017 12:35:31 GMT
Repository: tez
Updated Branches:
  refs/heads/master 506c9bc3d -> 22e4fe19d


http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/controllers/home-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/home-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/home-test.js
new file mode 100644
index 0000000..7a09b33
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/controllers/home-test.js
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:home', 'Unit | Controller | home', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let controller = this.subject({
+    send: Ember.K,
+    initVisibleColumns: Ember.K
+  });
+
+  assert.ok(controller);
+  assert.equal(controller.get("breadcrumbs"), null);
+});
+
+test('tabs test', function(assert) {
+  let tabs = this.subject({
+    send: Ember.K,
+    initVisibleColumns: Ember.K
+  }).get("tabs");
+
+  assert.equal(tabs.length, 2);
+  assert.equal(tabs[0].text, "All DAGs");
+  assert.equal(tabs[1].text, "Hive Queries");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js
new file mode 100644
index 0000000..810c8c9
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:home/index', 'Unit | Controller | home/index', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  assert.expect(2 + 12);
+
+  let controller = this.subject({
+    initVisibleColumns: Ember.K,
+    beforeSort: {bind: Ember.K},
+    send: function (name, query) {
+      assert.equal(name, "setBreadcrumbs");
+      assert.ok(query);
+    }
+  });
+
+  assert.ok(controller);
+  assert.ok(controller.columns);
+  assert.ok(controller.columns.length, 13);
+  assert.ok(controller.getCounterColumns);
+
+  assert.ok(controller.pageNum);
+
+  assert.ok(controller.queryParams);
+  assert.ok(controller.headerComponentNames);
+  assert.equal(controller.headerComponentNames.length, 3);
+
+  assert.ok(controller._definition);
+  assert.ok(controller.definition);
+
+  assert.ok(controller.actions.search);
+  assert.ok(controller.actions.pageChanged);
+});
+
+test('definition test', function(assert) {
+  let controller = this.subject({
+        initVisibleColumns: Ember.K,
+        beforeSort: {bind: Ember.K},
+        send: Ember.K
+      }),
+      definition = controller.get("definition"),
+      testDAGName = "DAGName",
+      testDAGID = "DAGID",
+      testSubmitter = "Submitter",
+      testStatus = "Status",
+      testAppID = "AppID",
+      testCallerID = "CallerID",
+      testPageNum = 10,
+      testMoreAvailable = true,
+      testLoadingMore = true;
+
+  assert.equal(definition.get("dagName"), "");
+  assert.equal(definition.get("dagID"), "");
+  assert.equal(definition.get("submitter"), "");
+  assert.equal(definition.get("status"), "");
+  assert.equal(definition.get("appID"), "");
+  assert.equal(definition.get("callerID"), "");
+
+  assert.equal(definition.get("pageNum"), 1);
+
+  assert.equal(definition.get("moreAvailable"), false);
+  assert.equal(definition.get("loadingMore"), false);
+
+  Ember.run(function () {
+    controller.set("dagName", testDAGName);
+    assert.equal(controller.get("definition.dagName"), testDAGName);
+
+    controller.set("dagID", testDAGID);
+    assert.equal(controller.get("definition.dagID"), testDAGID);
+
+    controller.set("submitter", testSubmitter);
+    assert.equal(controller.get("definition.submitter"), testSubmitter);
+
+    controller.set("status", testStatus);
+    assert.equal(controller.get("definition.status"), testStatus);
+
+    controller.set("appID", testAppID);
+    assert.equal(controller.get("definition.appID"), testAppID);
+
+    controller.set("callerID", testCallerID);
+    assert.equal(controller.get("definition.callerID"), testCallerID);
+
+    controller.set("pageNum", testPageNum);
+    assert.equal(controller.get("definition.pageNum"), testPageNum);
+
+    controller.set("moreAvailable", testMoreAvailable);
+    assert.equal(controller.get("definition.moreAvailable"), testMoreAvailable);
+
+    controller.set("loadingMore", testLoadingMore);
+    assert.equal(controller.get("definition.loadingMore"), testLoadingMore);
+  });
+});
+
+test('breadcrumbs test', function(assert) {
+  let breadcrumbs = this.subject({
+    initVisibleColumns: Ember.K,
+    beforeSort: {bind: Ember.K},
+    send: Ember.K
+  }).get("breadcrumbs");
+
+  assert.equal(breadcrumbs.length, 1);
+  assert.equal(breadcrumbs[0].text, "All DAGs");
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/controllers/home/queries-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/home/queries-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/home/queries-test.js
new file mode 100644
index 0000000..3dbc161
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/controllers/home/queries-test.js
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:home/queries', 'Unit | Controller | home/queries', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let controller = this.subject({
+    send: Ember.K,
+    initVisibleColumns: Ember.K
+  });
+
+  assert.ok(controller);
+
+  assert.ok(controller.queryParams);
+
+  assert.ok(controller.breadcrumbs);
+  assert.ok(controller.headerComponentNames);
+  assert.ok(controller.headerComponentNames.length, 3);
+
+  assert.ok(controller.definition);
+  assert.ok(controller.columns);
+  assert.ok(controller.columns.length, 9);
+
+  assert.ok(controller.getCounterColumns);
+
+  assert.ok(controller.actions.search);
+  assert.ok(controller.actions.pageChanged);
+
+  assert.equal(controller.get("pageNum"), 1);
+});
+
+test('definition test', function(assert) {
+  let controller = this.subject({
+        initVisibleColumns: Ember.K,
+        beforeSort: {bind: Ember.K},
+        send: Ember.K
+      }),
+      definition = controller.get("definition"),
+
+      testQueryID = "QueryID",
+      testUser = "User",
+      testRequestUser = "RequestUser",
+      testPageNum = 10,
+      testMoreAvailable = true,
+      testLoadingMore = true;
+
+  assert.equal(definition.get("queryID"), "");
+  assert.equal(definition.get("user"), "");
+  assert.equal(definition.get("requestUser"), "");
+
+  assert.equal(definition.get("pageNum"), 1);
+
+  assert.equal(definition.get("moreAvailable"), false);
+  assert.equal(definition.get("loadingMore"), false);
+
+  Ember.run(function () {
+    controller.set("queryID", testQueryID);
+    assert.equal(controller.get("definition.queryID"), testQueryID);
+
+    controller.set("user", testUser);
+    assert.equal(controller.get("definition.user"), testUser);
+
+    controller.set("requestUser", testRequestUser);
+    assert.equal(controller.get("definition.requestUser"), testRequestUser);
+
+    controller.set("pageNum", testPageNum);
+    assert.equal(controller.get("definition.pageNum"), testPageNum);
+
+    controller.set("moreAvailable", testMoreAvailable);
+    assert.equal(controller.get("definition.moreAvailable"), testMoreAvailable);
+
+    controller.set("loadingMore", testLoadingMore);
+    assert.equal(controller.get("definition.loadingMore"), testLoadingMore);
+  });
+});
+
+test('breadcrumbs test', function(assert) {
+  let breadcrumbs = this.subject({
+    send: Ember.K,
+    initVisibleColumns: Ember.K
+  }).get("breadcrumbs");
+
+  assert.equal(breadcrumbs.length, 1);
+  assert.equal(breadcrumbs[0].text, "All Queries");
+});
+
+test('getCounterColumns test', function(assert) {
+  let getCounterColumns = this.subject({
+    send: Ember.K,
+    initVisibleColumns: Ember.K
+  }).get("getCounterColumns");
+
+  assert.equal(getCounterColumns().length, 0);
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js b/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js
index 5bc0116..a7677a7 100644
--- a/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js
@@ -43,34 +43,73 @@ test('Basic creation test', function(assert) {
 
 test('normalizeNeed test', function(assert) {
   let entity = this.subject(),
-      expectedProperties = ["name", "type", "idKey", "silent"];
+      expectedProperties = ["id", "name", "type", "idKey", "silent", "queryParams", "urlParams"],
+      testParentModel = Ember.Object.create({
+        appKey: "id_1"
+      }),
+      testQueryParams = { x: 1 },
+      testUrlParams = { y: 2 };
 
-  assert.deepEqual(entity.normalizeNeed("app", "appKey").getProperties(expectedProperties),
{
+  assert.deepEqual(entity.normalizeNeed("app", "appKey", testParentModel, testQueryParams,
testUrlParams).
+  getProperties(expectedProperties), {
+    id: "id_1",
     name: "app",
     type: "app",
     idKey: "appKey",
-    silent: false
+    silent: false,
+    queryParams: testQueryParams,
+    urlParams: testUrlParams
   }, "Test 1");
 
-  assert.deepEqual(entity.normalizeNeed( "app", { idKey: "appKey" }).getProperties(expectedProperties),
{
+  assert.deepEqual(entity.normalizeNeed( "app", {
+    idKey: "appKey",
+    queryParams: { x: 3 },
+    urlParams: { y: 4 }
+  }, testParentModel).
+  getProperties(expectedProperties), {
+    id: "id_1",
     name: "app",
     type: "app",
     idKey: "appKey",
-    silent: false
+    silent: false,
+    queryParams: { x: 3 },
+    urlParams: { y: 4 }
   }, "Test 2");
 
-  assert.deepEqual(entity.normalizeNeed( "app", { type: "application", idKey: "appKey" }).getProperties(expectedProperties),
{
+  assert.deepEqual(entity.normalizeNeed( "app", {
+    type: "application",
+    idKey: "appKey",
+    queryParams: { x: 3 },
+    urlParams: { y: 4 }
+  }, testParentModel, testQueryParams, testUrlParams).
+  getProperties(expectedProperties), {
+    id: "id_1",
     name: "app",
     type: "application",
     idKey: "appKey",
-    silent: false
+    silent: false,
+    queryParams: testQueryParams,
+    urlParams: testUrlParams
   }, "Test 3");
 
-  assert.deepEqual(entity.normalizeNeed( "app", { silent: true, idKey: "appKey" }).getProperties(expectedProperties),
{
+  assert.deepEqual(entity.normalizeNeed( "app", {
+    silent: true,
+    idKey: "appKey",
+    queryParams: function () {
+      return { x: 5 };
+    },
+    urlParams: function () {
+      return { y: 6 };
+    },
+  }, testParentModel).
+  getProperties(expectedProperties), {
+    id: "id_1",
     name: "app",
     type: "app",
     idKey: "appKey",
-    silent: true
+    silent: true,
+    queryParams: { x: 5 },
+    urlParams: { y: 6}
   }, "Test 4");
 });
 

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js b/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js
index 70a87ec..f081907 100644
--- a/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import Ember from 'ember';
 import { moduleForModel, test } from 'ember-qunit';
 
 moduleForModel('hive-query', 'Unit | Model | hive query', {
@@ -25,5 +26,32 @@ moduleForModel('hive-query', 'Unit | Model | hive query', {
 
 test('Basic creation test', function(assert) {
   let model = this.subject();
+
   assert.ok(model);
+
+  assert.ok(model.domain);
+
+  assert.ok(model.user);
+  assert.ok(model.requestUser);
+
+  assert.ok(model.version);
+
+  assert.ok(model.sessionID);
+  assert.ok(model.threadName);
+
+  assert.ok(model.queryText);
+
+  assert.ok(model.startTime);
+  assert.ok(model.endTime);
+  assert.ok(model.duration);
 });
+
+test('duration test', function(assert) {
+  let model = this.subject();
+
+  Ember.run(function () {
+    model.set("startTime", 100);
+    model.set("endTime", 200);
+    assert.equal(model.get("duration"), 100);
+  });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/routes/dags-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/routes/dags-test.js b/tez-ui/src/main/webapp/tests/unit/routes/dags-test.js
deleted file mode 100644
index 146cdd2..0000000
--- a/tez-ui/src/main/webapp/tests/unit/routes/dags-test.js
+++ /dev/null
@@ -1,175 +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 { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:dags', 'Unit | Route | dags', {
-  // Specify the other units that are required for this test.
-  // needs: ['controller:foo']
-});
-
-test('Basic creation test', function(assert) {
-  let route = this.subject();
-
-  assert.ok(route);
-  assert.ok(route.title);
-
-  assert.ok(route.queryParams);
-  assert.ok(route.loaderQueryParams);
-  assert.ok(route.setupController);
-  assert.ok(route.load);
-
-  assert.ok(route.filterRecords);
-
-  assert.ok(route.loadNewPage);
-
-  assert.ok(route.actions.setLoadTime);
-  assert.ok(route.actions.loadPage);
-  assert.ok(route.actions.reload);
-
-  assert.ok(route.actions.willTransition);
-});
-
-test('filterRecords test', function(assert) {
-  let route = this.subject(),
-      testRecords = [Ember.Object.create({
-        name: "test"
-      }), Ember.Object.create({
-
-      }),Ember.Object.create({
-        name: "notest"
-      })],
-      testQuery = {
-        dagName: "test"
-      };
-
-  let filteredRecords = route.filterRecords(testRecords, testQuery);
-
-  assert.equal(filteredRecords.length, 1);
-  assert.equal(filteredRecords[0].name, "test");
-});
-
-test('load test', function(assert) {
-  let route = this.subject({
-        filterRecords: function () {
-          return [];
-        },
-        controller: Ember.Object.create(),
-        loaderNamespace: undefined,
-        loader: {
-          query: function (type, query, options) {
-            assert.equal(type, "dag");
-            assert.equal(query.limit, 6);
-            assert.equal(options.reload, true);
-            return {
-              then: function (callback) {
-                callback(Ember.Object.create({
-                  length: 6,
-                  popObject: function () {
-                    assert.ok(true);
-                    return Ember.Object.create();
-                  }
-                }));
-              }
-            };
-          },
-          queryRecord: function (type, dagID, options) {
-            assert.equal(type, "dag");
-            assert.equal(options.reload, true);
-            if (dagID === querySuccess.dagID) {
-              return Ember.RSVP.resolve(Ember.Object.create());
-            } else {
-              return Ember.RSVP.reject(new Error("Failed in Reject"));
-            }
-          }
-        }
-      }),
-      query = {
-        limit: 5
-      },
-      querySuccess = {
-        dagID :'dag_123'
-      },
-      queryFailure = {
-        dagID :'dag_456'
-      };
-
-  assert.expect(8 + 2);
-
-  route.load(null, query);
-  route.load(null, querySuccess).then(function () {
-    assert.ok(true);
-  });
-  route.load(null, queryFailure).then(function (data) {
-    assert.equal(data.length,0);
-  });
-});
-
-test('loadNewPage test', function(assert) {
-  let currentQuery = {
-        val: {}
-      },
-      data = [],
-      fromId = "id1",
-      route = this.subject({
-        controller: Ember.Object.create(),
-        currentQuery: currentQuery,
-        fromId: fromId,
-        loadedValue: {
-          pushObjects: function (objs) {
-            assert.equal(data, objs);
-          }
-        },
-        load: function (value, query) {
-          assert.equal(query.val, currentQuery.val);
-          assert.equal(query.fromId, fromId);
-          return {
-            then: function (callback) {
-              callback(data);
-            }
-          };
-        }
-      });
-
-  assert.expect(1 + 2);
-
-  route.loadNewPage();
-});
-
-test('actions.willTransition test', function(assert) {
-  let testPageNum = 5,
-      controller = Ember.Object.create({
-        pageNum: testPageNum
-      }),
-      route = this.subject({
-        controller: controller,
-      });
-
-  route.set("loader", {
-    unloadAll: function () {
-      assert.ok(true);
-    }
-  });
-
-  assert.expect(2 + 1 + 1);
-
-  assert.equal(controller.get("pageNum"), testPageNum);
-  route.send("willTransition");
-  assert.equal(controller.get("pageNum"), 1); // PageNum must be reset
-});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/routes/home-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/routes/home-test.js b/tez-ui/src/main/webapp/tests/unit/routes/home-test.js
new file mode 100644
index 0000000..aa58510
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/routes/home-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 { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:home', 'Unit | Route | home', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let route = this.subject();
+
+  assert.ok(route);
+  assert.equal(route.get("title"), "Home");
+  assert.ok(route.get("actions.setLoadTime"));
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js b/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js
new file mode 100644
index 0000000..0399490
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:home/index', 'Unit | Route | home/index', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let route = this.subject();
+
+  assert.ok(route);
+  assert.ok(route.title);
+
+  assert.ok(route.queryParams);
+  assert.ok(route.loaderQueryParams);
+  assert.ok(route.setupController);
+
+  assert.equal(route.entityType, "dag");
+  assert.equal(route.loaderNamespace, "dags");
+
+  assert.ok(route.filterRecords);
+
+  assert.ok(route.actions.willTransition);
+});
+
+test('refresh test', function(assert) {
+  let route = this.subject();
+
+  assert.equal(route.get("queryParams.dagName.refreshModel"), true);
+  assert.equal(route.get("queryParams.dagID.refreshModel"), true);
+  assert.equal(route.get("queryParams.submitter.refreshModel"), true);
+  assert.equal(route.get("queryParams.status.refreshModel"), true);
+  assert.equal(route.get("queryParams.appID.refreshModel"), true);
+  assert.equal(route.get("queryParams.callerID.refreshModel"), true);
+  assert.equal(route.get("queryParams.rowCount.refreshModel"), true);
+});
+
+test('loaderQueryParams test', function(assert) {
+  let route = this.subject();
+  assert.equal(Object.keys(route.get("loaderQueryParams")).length, 7);
+});
+
+test('filterRecords test', function(assert) {
+  let route = this.subject(),
+      testRecords = [Ember.Object.create({
+        name: "test"
+      }), Ember.Object.create({
+        // No name
+      }),Ember.Object.create({
+        name: "notest"
+      })],
+      testQuery = {
+        dagName: "test"
+      };
+
+  let filteredRecords = route.filterRecords(testRecords, testQuery);
+
+  assert.equal(filteredRecords.length, 1);
+  assert.equal(filteredRecords[0], testRecords[0]);
+});
+
+test('load - query + filter test', function(assert) {
+  let testEntityID1 = "entity_1",
+      testEntityID2 = "entity_2",
+      testEntityID3 = "entity_3",
+      testSubmitter = "testSub",
+
+      query = {
+        limit: 5,
+        submitter: testSubmitter
+      },
+      resultRecords = Ember.A([
+        Ember.Object.create({
+          submitter: testSubmitter,
+          entityID: testEntityID1
+        }),
+        Ember.Object.create(),
+        Ember.Object.create(),
+        Ember.Object.create(),
+        Ember.Object.create({
+          submitter: testSubmitter,
+          entityID: testEntityID2,
+          status: "RUNNING"
+        }),
+        Ember.Object.create({
+          submitter: testSubmitter,
+          entityID: testEntityID3,
+        })
+      ]),
+
+      route = this.subject({
+        controller: Ember.Object.create()
+      });
+
+  route.loader = Ember.Object.create({
+    query: function (type, query, options) {
+      assert.equal(type, "dag");
+      assert.equal(query.limit, 6);
+      assert.equal(options.reload, true);
+      return Ember.RSVP.resolve(resultRecords);
+    },
+    loadNeed: function (record, field, options) {
+      assert.equal(record.get("entityID"), testEntityID2);
+      assert.equal(field, "am");
+      assert.equal(options.reload, true);
+      return Ember.RSVP.resolve();
+    }
+  });
+
+  assert.expect(3 + 3 + 2 + 3 + 2);
+
+  assert.notOk(route.get("controller.moreAvailable"), "moreAvailable shouldn't be set!");
+  assert.equal(route.get("fromId"), null, "fromId shouldn't be set");
+
+  return route.load(null, query).then(function (records) {
+    assert.equal(records.get("length"), 2, "Length should be 2!");
+    assert.equal(records.get("0.entityID"), testEntityID1);
+    assert.equal(records.get("1.entityID"), testEntityID2);
+
+    assert.equal(route.get("controller.moreAvailable"), true, "moreAvailable was not set");
+    assert.equal(route.get("fromId"), testEntityID3);
+  });
+});
+
+test('actions.willTransition test', function(assert) {
+  let route = this.subject({
+    controller: Ember.Object.create()
+  });
+
+  route.set("loader", {
+    unloadAll: function (type) {
+      if(type === "dag" || type === "ahs-app") {
+        assert.ok(true);
+      }
+      else {
+        throw(new Error("Invalid type!"));
+      }
+    }
+  });
+
+  assert.expect(2);
+  route.send("willTransition");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/routes/home/queries-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/routes/home/queries-test.js b/tez-ui/src/main/webapp/tests/unit/routes/home/queries-test.js
new file mode 100644
index 0000000..da3ad34
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/routes/home/queries-test.js
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:home/queries', 'Unit | Route | home/queries', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+  let route = this.subject();
+
+  assert.ok(route);
+  assert.ok(route.title);
+
+  assert.ok(route.queryParams);
+  assert.ok(route.loaderQueryParams);
+  assert.ok(route.setupController);
+
+  assert.equal(route.entityType, "hive-query");
+  assert.equal(route.loaderNamespace, "queries");
+
+  assert.ok(route.actions.willTransition);
+});
+
+test('refresh test', function(assert) {
+  let route = this.subject();
+
+  assert.equal(route.get("queryParams.queryID.refreshModel"), true);
+  assert.equal(route.get("queryParams.user.refreshModel"), true);
+  assert.equal(route.get("queryParams.requestUser.refreshModel"), true);
+  assert.equal(route.get("queryParams.rowCount.refreshModel"), true);
+});
+
+test('loaderQueryParams test', function(assert) {
+  let route = this.subject();
+  assert.equal(Object.keys(route.get("loaderQueryParams")).length, 4);
+});
+
+test('actions.willTransition test', function(assert) {
+  let route = this.subject({
+    controller: Ember.Object.create()
+  });
+
+  route.set("loader", {
+    unloadAll: function (type) {
+      if(type === "hive-query") {
+        assert.ok(true);
+      }
+      else {
+        throw(new Error("Invalid type!"));
+      }
+    }
+  });
+
+  assert.expect(1);
+  route.send("willTransition");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/routes/server-side-ops-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/routes/server-side-ops-test.js b/tez-ui/src/main/webapp/tests/unit/routes/server-side-ops-test.js
new file mode 100644
index 0000000..59e04f7
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/routes/server-side-ops-test.js
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:server-side-ops', 'Unit | Route | server side ops', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let route = this.subject();
+
+  assert.ok(route);
+  assert.ok(route.load);
+  assert.ok(route.loadNewPage);
+
+  assert.ok(route.actions.loadPage);
+  assert.ok(route.actions.reload);
+
+  assert.ok(route.actions.willTransition);
+});
+
+test('load - query/filter test', function(assert) {
+  let testEntityType = "EntityType",
+      testEntityID1 = "entity_1",
+      testEntityID2 = "entity_2",
+      testFromID = "entity_6",
+
+      query = {
+        limit: 5
+      },
+      resultRecords = Ember.A([
+        Ember.Object.create({
+          entityID: testEntityID1
+        }),
+        {}, {}, {}, {},
+        Ember.Object.create({
+          entityID: testFromID
+        })
+      ]),
+
+      route = this.subject({
+        entityType: testEntityType,
+        controller: Ember.Object.create(),
+        loader: {
+          query: function (type, query, options) {
+            assert.equal(type, testEntityType);
+            assert.equal(query.limit, 6);
+            assert.equal(options.reload, true);
+            return Ember.RSVP.resolve(resultRecords);
+          }
+        }
+      });
+
+  assert.expect(3 * 2 + 2 + 3 + 3);
+
+  assert.notOk(route.get("controller.moreAvailable"));
+  assert.equal(route.get("fromId"), null);
+
+  return route.load(null, query).then(function (records) {
+    assert.equal(records.get("0.entityID"), testEntityID1);
+
+    assert.equal(route.get("controller.moreAvailable"), true, "moreAvailable was not set");
+    assert.equal(route.get("fromId"), testFromID);
+  }).then(function () {
+    resultRecords = Ember.A([
+      Ember.Object.create({
+        entityID: testEntityID2
+      })
+    ]);
+    return route.load(null, query);
+  }).then(function (records) {
+    assert.equal(records.get("0.entityID"), testEntityID2);
+
+    assert.equal(route.get("controller.moreAvailable"), false);
+    assert.equal(route.get("fromId"), null);
+  });
+});
+
+test('load - id fetch test', function(assert) {
+  let testEntityType = "EntityType",
+      testRecord = Ember.Object.create(),
+      route = this.subject({
+        entityType: testEntityType,
+        controller: Ember.Object.create(),
+        loader: {
+          queryRecord: function (type, id, options) {
+            assert.equal(type, testEntityType);
+            assert.equal(options.reload, true);
+            if (id === querySuccess.id) {
+              return Ember.RSVP.resolve(testRecord);
+            } else {
+              return Ember.RSVP.reject(new Error("Failed in Reject"));
+            }
+          }
+        }
+      }),
+      querySuccess = {
+        id :'entity_123'
+      },
+      queryFailure = {
+        id :'entity_456'
+      };
+
+  assert.expect(2 * 2 + 3 + 1);
+
+  route.load(null, querySuccess).then(function (records) {
+    assert.ok(Array.isArray(records));
+    assert.equal(records.length, 1);
+    assert.equal(records[0], testRecord);
+  });
+  route.load(null, queryFailure).then(function (data) {
+    assert.equal(data.length,0);
+  });
+});
+
+test('loadNewPage test', function(assert) {
+  let currentQuery = {
+        val: {}
+      },
+      data = [],
+      fromId = "id1",
+      route = this.subject({
+        controller: Ember.Object.create(),
+        currentQuery: currentQuery,
+        fromId: fromId,
+        loadedValue: {
+          pushObjects: function (objs) {
+            assert.equal(data, objs);
+          }
+        },
+        load: function (value, query) {
+          assert.equal(query.val, currentQuery.val);
+          assert.equal(query.fromId, fromId);
+          return Ember.RSVP.resolve(data);
+        }
+      });
+
+  assert.expect(1 + 2);
+
+  route.loadNewPage();
+});
+
+test('actions.willTransition test', function(assert) {
+  let testPageNum = 5,
+      controller = Ember.Object.create({
+        pageNum: testPageNum
+      }),
+      route = this.subject({
+        controller: controller,
+      });
+
+  assert.expect(1 + 1);
+
+  assert.equal(controller.get("pageNum"), testPageNum);
+  route.send("willTransition");
+  assert.equal(controller.get("pageNum"), 1); // PageNum must be reset
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/22e4fe19/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js
index d4272d3..7771930 100644
--- a/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js
@@ -16,14 +16,82 @@
  * limitations under the License.
  */
 
-import { moduleForModel, test } from 'ember-qunit';
+import Ember from 'ember';
+import { moduleFor, test } from 'ember-qunit';
 
-moduleForModel('hive-query', 'Unit | Serializer | hive query', {
+moduleFor('serializer:hive-query', 'Unit | Serializer | hive query', {
   // Specify the other units that are required for this test.
-  needs: ['serializer:hive-query']
+  needs: ['model:hive-query']
 });
 
 test('Basic creation test', function(assert) {
   let serializer = this.subject();
-  assert.ok(serializer);
+  assert.equal(Object.keys(serializer.get("maps")).length, 6 + 19);
+  assert.ok(serializer.get("extractAttributes"));
+});
+
+test('getStatus test', function(assert) {
+  let serializer = this.subject(),
+      getStatus = serializer.get("maps.status");
+
+  assert.equal(getStatus({}), "RUNNING");
+  assert.equal(getStatus({
+    otherinfo: {
+      STATUS: true
+    }
+  }), "SUCCEEDED");
+  assert.equal(getStatus({
+    otherinfo: {
+      STATUS: false
+    }
+  }), "FAILED");
+});
+
+test('getEndTime test', function(assert) {
+  let serializer = this.subject(),
+      getEndTime = serializer.get("maps.endTime"),
+      endTime = 23;
+
+  assert.equal(getEndTime({}), undefined);
+
+  assert.equal(getEndTime({
+    otherinfo: {
+      endTime: endTime
+    }
+  }), endTime);
+
+  assert.equal(getEndTime({
+    events: [{
+      eventtype: 'X',
+    }, {
+      eventtype: 'QUERY_COMPLETED',
+      timestamp: endTime
+    }, {
+      eventtype: 'Y',
+    }]
+  }), endTime);
+});
+
+test('extractAttributes test', function(assert) {
+  let serializer = this.subject(),
+      testQuery = {
+        abc: 1,
+        xyz: 2
+      },
+      testHiveAddress = "1.2.3.4",
+      testData = {
+        otherinfo: {
+          QUERY: JSON.stringify(testQuery),
+          HIVE_ADDRESS: testHiveAddress
+        }
+      };
+
+  serializer.extractAttributes(Ember.Object.create({
+    eachAttribute: Ember.K
+  }), {
+    data: testData
+  });
+  assert.deepEqual(testData.otherinfo.QUERY, testQuery);
+
+  assert.equal(testHiveAddress, testData.otherinfo.CLIENT_IP_ADDRESS);
 });


Mime
View raw message