-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
64 lines (54 loc) · 2.2 KB
/
test.js
File metadata and controls
64 lines (54 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var assert = require('assert'),
colors = require('colors'),
domain = require('domain'),
eos = require('./');
function log(x) { console.log(String(x).bold.yellow); }
if (true) {
var jasmine = require("jasmine-node");
jasmine.executeSpecsInFolder({
specFolders: ["spec"],
showColors: true,
isVerbose: true
});
} else {
var connectionString = "Driver={ODBC Driver 11 for SQL Server};Server=.\\CONNECT;Trusted_Connection=Yes";
test();
// var d = domain.create();
//
// d.on("error", function (e) {
// console.log((((e && e.constructor && e.constructor.name) || "Error") + ":").red.bold, e);
// });
//
// d.run(test);
}
function test() {
var env = new eos.Environment(),
conn = env.newConnection();
conn.driverConnect(require("./spec/settings.json").connectionString, function () {
conn.disconnect(function () {
conn.free();
console.log("Active handles:".bold.yellow);
eos.activeHandles().forEach(function (handle) {
console.log(" *".bold.yellow, handle.constructor.name.bold.white);
});
console.log("Active operations:".bold.yellow);
eos.activeOperations().forEach(function (operation) {
console.log(" *".bold.yellow, handle.constructor.name.bold.white);
});
});
});
}
function debugOps() {
var ops = eos.bindings.activeOperations();
console.log("Active operations:".green.bold, ops.length);
console.log("------------------\n".green.bold);
for (var i = 0; i < ops.length; i++) {
console.log(ops[i].name.magenta.bold + "(refs: %s, begun: %s, completed: %s, sync: %s, result: %s):",
ops[i].refs.toString().yellow.bold,
(typeof ops[i].begun !== "undefined" ? ops[i].begun : "wot").toString().yellow.bold,
(typeof ops[i].completed !== "undefined" ? ops[i].completed : "wat").toString().yellow.bold,
(typeof ops[i].sync !== "undefined" ? ops[i].sync : "uwotm8").toString().yellow.bold,
(typeof ops[i].result !== "undefined" ? ops[i].result : "wut").toString().yellow.bold);
console.log(ops[i].stackTrace);
}
}