dynatrace
Advanced tools
Comparing version 1.1.2-beta1 to 1.2.0-beta1
@@ -5,3 +5,3 @@ var SyntheticREST = require('./synthetic/rest/synthetic'); | ||
Synthetic: require('./synthetic/synthetic'), | ||
Synthetic: require('./synthetic/soap/synthetic'), | ||
@@ -8,0 +8,0 @@ synthetic: function(options) { |
@@ -9,7 +9,7 @@ var xml2js = require('xml2js'); | ||
client.authenticate = function(params, callback) { | ||
client.authenticate = function(params, options, callback) { | ||
params = params || { user: client.username, password: client.password }; | ||
var options = { | ||
var criteria = { | ||
resource: 'login', | ||
@@ -20,3 +20,3 @@ method: 'GET', | ||
return client.resourceRequest(options, callback).then(function(accessToken) { | ||
return client.resourceRequest(criteria, options, callback).then(function(accessToken) { | ||
client.accessToken = accessToken; | ||
@@ -28,5 +28,5 @@ }); | ||
list: function(params, callback) { | ||
list: function(params, options, callback) { | ||
var options = { | ||
var criteria = { | ||
resource: 'tests', | ||
@@ -37,3 +37,3 @@ method: 'GET', | ||
return client.resourceRequest(options, callback); | ||
return client.resourceRequest(criteria, options, callback); | ||
@@ -46,3 +46,3 @@ } | ||
list: function(params, callback) { | ||
list: function(params, options, callback) { | ||
@@ -61,3 +61,3 @@ params.monitorIds = params.monitorIds || []; | ||
var options = { | ||
var criteria = { | ||
resource: 'testresults', | ||
@@ -69,3 +69,3 @@ method: 'POST', | ||
return client.resourceRequest(options, callback); | ||
return client.resourceRequest(criteria, options, callback); | ||
@@ -78,5 +78,5 @@ } | ||
list: function(params, callback) { | ||
list: function(params, options, callback) { | ||
var options = { | ||
var criteria = { | ||
resource: 'sites', | ||
@@ -87,3 +87,3 @@ method: 'GET', | ||
return client.resourceRequest(options, callback); | ||
return client.resourceRequest(criteria, options, callback); | ||
@@ -90,0 +90,0 @@ } |
var util = require('util'); | ||
var RestClient = require('../rest_client'); | ||
var RestClient = require('./rest_client'); | ||
var loadResources = require('./api'); | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "dynatrace", | ||
"version": "1.1.2-beta1", | ||
"version": "1.2.0-beta1", | ||
"description": "Dynatrace API client library for Node.js", | ||
@@ -25,2 +25,3 @@ "main": "./lib/dynatrace.js", | ||
"async": "^0.9.0", | ||
"oboe": "^2.1.2", | ||
"q": "^1.4.1", | ||
@@ -27,0 +28,0 @@ "request": "~2.51.0", |
var assert = require('assert'); | ||
var dynatrace = require('../lib/dynatrace'); | ||
var xml2js = require('xml2js'); | ||
var oboe = require('oboe'); | ||
@@ -53,3 +54,3 @@ describe('Synthetic', function() { | ||
*/ | ||
/* | ||
describe('tests', function(done) { | ||
@@ -63,8 +64,6 @@ this.timeout(8000); | ||
synthetic.authenticate().then(function() { | ||
return synthetic.monitors.list({ status: 'active' }); | ||
}).then(function(result) { | ||
synthetic.authenticate() | ||
.then(synthetic.monitors.list({ status: 'active' })) | ||
.then(function(err, body, res) { | ||
console.log(body); | ||
assert.equal(typeof result, 'object'); | ||
@@ -74,3 +73,3 @@ | ||
}).fail(function(err) { | ||
}).catch(function(err) { | ||
@@ -144,12 +143,39 @@ throw err; | ||
*/ | ||
describe('monitors', function() { | ||
it('should return a list of alerts', function(done) { | ||
var synthetic = dynatrace.synthetic({ | ||
username: 'stefan.karytko', | ||
password: 'G@mezps1' | ||
}); | ||
synthetic.authenticate().then(function() { | ||
return synthetic.monitors.list({ status: 'all'}); | ||
}).then(function(result) { | ||
console.log(result); | ||
done(); | ||
}).catch(function(err) { | ||
throw err; | ||
}); | ||
}); | ||
}); | ||
describe('data', function() { | ||
it('should return results data object', function(done) { | ||
this.timeout(30000); | ||
this.timeout(300000); | ||
var tests = {}; | ||
var params = { | ||
monitorIds: [ '18530476' ], | ||
monitorIds: [ '23359852', '18530476' ], | ||
detailLevel: 'all', | ||
start: new Date().getTime() - (1000 * 60 * 5), | ||
end: new Date().getTime() | ||
end: new Date().getTime(), | ||
time: 'TEST_EXECUTION' | ||
}; | ||
@@ -162,14 +188,77 @@ | ||
synthetic.authenticate().then(function() { | ||
return synthetic.tests.list(params); | ||
}).then(function(result) { | ||
synthetic.authenticate() | ||
.then(function() { | ||
assert.equal(typeof result, 'object'); | ||
oboe(synthetic.tests.list(params, { promise: false })) | ||
.node('*.TestLevelData.*.testData', function(test) { | ||
test.steps = []; | ||
test.requests = []; | ||
test.hosts = []; | ||
test.connections = []; | ||
test.w3cs = []; | ||
tests[[test.mid, test.MBG_mid, test.sid, test.popid, test.ttime].join()] = test; | ||
return oboe.drop; | ||
}) | ||
.node('*.StepLevelData.*.stepData', function(step) { | ||
var test = tests[[step.mid, step.MBG_mid, step.sid, step.popid, step.ttime].join()] | ||
if (test) test.steps.push(step); | ||
return oboe.drop; | ||
}) | ||
.node('*.ObjectLevelData.*.objectData', function(req) { | ||
var test = tests[[req.mid, req.MBG_mid, req.sid, req.popid, req.ttime].join()] | ||
if (test) test.requests.push(req); | ||
return oboe.drop; | ||
}) | ||
.node('*.HostLevelData.*.hostData', function(host) { | ||
var test = tests[[host.mid, host.MBG_mid, host.sid, host.popid, host.ttime].join()] | ||
if (test) test.hosts.push(host); | ||
return oboe.drop; | ||
}) | ||
.node('*.ConnectionLevelData.*.connectionData', function(conn) { | ||
var test = tests[[conn.mid, conn.MBG_mid, conn.sid, conn.popid, conn.ttime].join()] | ||
if (test) test.connections.push(conn); | ||
return oboe.drop; | ||
}) | ||
.node('*.W3cLevelData.*.w3cData', function(w3c) { | ||
var test = tests[[w3c.mid, w3c.MBG_mid, w3c.sid, w3c.popid, w3c.ttime].join()] | ||
if (test) test.w3cs.push(w3c); | ||
return oboe.drop; | ||
}) | ||
.done(function() { | ||
tests = Object.keys(tests).map(function(key) { | ||
return tests[key]; | ||
}); | ||
done(); | ||
done(); | ||
}) | ||
.fail(function(err) { | ||
}).fail(function(err) { | ||
done(); | ||
}); | ||
}).catch(function(err) { | ||
throw err; | ||
@@ -176,0 +265,0 @@ |
112967
1420
7
+ Addedoboe@^2.1.2
+ Addedhttp-https@1.0.0(transitive)
+ Addedoboe@2.1.5(transitive)