tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [16/45] tez git commit: TEZ-2986. Tez UI 2: Implement All DAGs page (sree)
Date Wed, 24 Feb 2016 22:34:53 GMT
http://git-wip-us.apache.org/repos/asf/tez/blob/d34cbe07/tez-ui2/src/main/webapp/tests/unit/serializers/dag-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/dag-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/dag-test.js
new file mode 100644
index 0000000..7dd635c
--- /dev/null
+++ b/tez-ui2/src/main/webapp/tests/unit/serializers/dag-test.js
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:dag', 'Unit | Serializer | dag', {
+  // Specify the other units that are required for this test.
+  // needs: ['serializer:dag']
+});
+
+test('Basic creation test', function(assert) {
+  let serializer = this.subject();
+
+  assert.ok(serializer);
+  assert.ok(serializer.maps.atsStatus);
+  assert.ok(serializer.maps.startTime);
+  assert.ok(serializer.maps.endTime);
+  assert.ok(serializer.maps.containerLogs);
+});
+
+test('atsStatus test', function(assert) {
+  let serializer = this.subject(),
+      mapper = serializer.maps.atsStatus;
+
+  assert.equal(mapper({
+    events: [{eventtype: "SOME_EVENT"}]
+  }), undefined);
+
+  assert.equal(mapper({
+    events: [{eventtype: "DAG_STARTED"}]
+  }), "RUNNING");
+
+  assert.equal(mapper({
+    otherinfo: {status: "STATUS1"},
+    primaryfilters: {status: ["STATUS2"]},
+    events: [{eventtype: "DAG_STARTED"}]
+  }), "STATUS1");
+
+  assert.equal(mapper({
+    primaryfilters: {status: ["STATUS2"]},
+    events: [{eventtype: "DAG_STARTED"}]
+  }), "STATUS2");
+});
+
+test('startTime test', function(assert) {
+  let serializer = this.subject(),
+      mapper = serializer.maps.startTime,
+      testTimestamp = Date.now();
+
+  assert.equal(mapper({
+    events: [{eventtype: "SOME_EVENT"}]
+  }), undefined);
+
+  assert.equal(mapper({
+    events: [{eventtype: "DAG_STARTED", timestamp: testTimestamp}]
+  }), testTimestamp);
+
+  assert.equal(mapper({
+    otherinfo: {startTime: testTimestamp},
+    events: [{eventtype: "DAG_STARTED"}]
+  }), testTimestamp);
+});
+
+test('endTime test', function(assert) {
+  let serializer = this.subject(),
+      mapper = serializer.maps.endTime,
+      testTimestamp = Date.now();
+
+  assert.equal(mapper({
+    events: [{eventtype: "SOME_EVENT"}]
+  }), undefined);
+
+  assert.equal(mapper({
+    events: [{eventtype: "DAG_FINISHED", timestamp: testTimestamp}]
+  }), testTimestamp);
+
+  assert.equal(mapper({
+    otherinfo: {endTime: testTimestamp},
+    events: [{eventtype: "DAG_FINISHED"}]
+  }), testTimestamp);
+});
+
+test('containerLogs test', function(assert) {
+  let serializer = this.subject(),
+      mapper = serializer.maps.containerLogs;
+
+  assert.deepEqual(mapper({
+    otherinfo: {},
+  }), [], "No logs");
+
+  assert.deepEqual(mapper({
+    otherinfo: {inProgressLogsURL_1: "foo", inProgressLogsURL_2: "bar"},
+  }), [{text: "1", href: "http://foo"}, {text: "2", href: "http://bar"}], "2 logs");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/d34cbe07/tez-ui2/src/main/webapp/tests/unit/transforms/object-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/transforms/object-test.js b/tez-ui2/src/main/webapp/tests/unit/transforms/object-test.js
new file mode 100644
index 0000000..79b1bde
--- /dev/null
+++ b/tez-ui2/src/main/webapp/tests/unit/transforms/object-test.js
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('transform:object', 'Unit | Transform | object', {
+  // Specify the other units that are required for this test.
+  // needs: ['serializer:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+  let transform = this.subject();
+  assert.ok(transform);
+});


Mime
View raw message