@itentialopensource/adapter-robustel 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +205 -0
- package/CHANGELOG.md +17 -2
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +3 -148
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +235 -576
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +402 -573
- package/adapterBase.js +843 -419
- package/changelogs/changelog.md +16 -0
- package/entities/.generic/action.json +105 -0
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/metadata.json +47 -0
- package/package.json +24 -24
- package/pronghorn.json +559 -148
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +842 -6
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +204 -0
- package/report/adapter-openapi.yaml +163 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653173664637.json +120 -0
- package/report/updateReport1691507608338.json +120 -0
- package/report/updateReport1692202610637.json +120 -0
- package/report/updateReport1694462053440.json +120 -0
- package/report/updateReport1698421016757.json +120 -0
- package/sampleProperties.json +158 -5
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +269 -271
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +399 -260
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +1 -1
- package/utils/artifactize.js +1 -1
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +12 -57
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +13 -15
- package/utils/packModificationScript.js +1 -1
- package/utils/pre-commit.sh +5 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +123 -53
- package/utils/tbUtils.js +87 -49
- package/utils/testRunner.js +17 -17
- package/utils/troubleshootingAdapter.js +9 -6
- package/workflows/README.md +0 -3
|
@@ -3,38 +3,51 @@
|
|
|
3
3
|
// Set globals
|
|
4
4
|
/* global describe it log pronghornProps */
|
|
5
5
|
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint no-underscore-dangle: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
6
8
|
|
|
7
9
|
// include required items for testing & logging
|
|
8
10
|
const assert = require('assert');
|
|
9
11
|
const fs = require('fs');
|
|
10
|
-
const mocha = require('mocha');
|
|
11
12
|
const path = require('path');
|
|
13
|
+
const util = require('util');
|
|
14
|
+
const mocha = require('mocha');
|
|
12
15
|
const winston = require('winston');
|
|
13
16
|
const { expect } = require('chai');
|
|
14
17
|
const { use } = require('chai');
|
|
15
18
|
const td = require('testdouble');
|
|
16
|
-
const util = require('util');
|
|
17
|
-
const pronghorn = require('../../pronghorn.json');
|
|
18
19
|
|
|
19
|
-
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
20
20
|
const anything = td.matchers.anything();
|
|
21
21
|
|
|
22
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
23
23
|
let logLevel = 'none';
|
|
24
|
-
const stub = true;
|
|
25
24
|
const isRapidFail = false;
|
|
26
25
|
const isSaveMockData = false;
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
28
35
|
|
|
29
36
|
// these variables can be changed to run in integrated mode so easier to set them here
|
|
30
37
|
// always check these in with bogus data!!!
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
if (samProps.request.attempt_timeout < 30000) {
|
|
47
|
+
samProps.request.attempt_timeout = 30000;
|
|
48
|
+
}
|
|
49
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
50
|
+
const { stub } = samProps;
|
|
38
51
|
|
|
39
52
|
// these are the adapter properties. You generally should not need to alter
|
|
40
53
|
// any of these after they are initially set up
|
|
@@ -46,105 +59,7 @@ global.pronghornProps = {
|
|
|
46
59
|
adapters: [{
|
|
47
60
|
id: 'Test-robustel',
|
|
48
61
|
type: 'Robustel',
|
|
49
|
-
properties:
|
|
50
|
-
host,
|
|
51
|
-
port,
|
|
52
|
-
base_path: '/api/link',
|
|
53
|
-
version: '',
|
|
54
|
-
cache_location: 'none',
|
|
55
|
-
encode_pathvars: true,
|
|
56
|
-
save_metric: false,
|
|
57
|
-
stub,
|
|
58
|
-
protocol,
|
|
59
|
-
authentication: {
|
|
60
|
-
auth_method: 'no_authentication',
|
|
61
|
-
username,
|
|
62
|
-
password,
|
|
63
|
-
token: '',
|
|
64
|
-
invalid_token_error: 401,
|
|
65
|
-
token_timeout: -1,
|
|
66
|
-
token_cache: 'local',
|
|
67
|
-
auth_field: 'header.headers.Authorization',
|
|
68
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
69
|
-
auth_logging: false,
|
|
70
|
-
client_id: 'client_id',
|
|
71
|
-
client_secret: 'client_secret',
|
|
72
|
-
grant_type: '',
|
|
73
|
-
api_version: '1.0',
|
|
74
|
-
signature_version: '1.0',
|
|
75
|
-
unique_code: 'unique_code'
|
|
76
|
-
},
|
|
77
|
-
healthcheck: {
|
|
78
|
-
type: 'none',
|
|
79
|
-
frequency: 60000,
|
|
80
|
-
query_object: {}
|
|
81
|
-
},
|
|
82
|
-
throttle: {
|
|
83
|
-
throttle_enabled: false,
|
|
84
|
-
number_pronghorns: 1,
|
|
85
|
-
sync_async: 'sync',
|
|
86
|
-
max_in_queue: 1000,
|
|
87
|
-
concurrent_max: 1,
|
|
88
|
-
expire_timeout: 0,
|
|
89
|
-
avg_runtime: 200,
|
|
90
|
-
priorities: [
|
|
91
|
-
{
|
|
92
|
-
value: 0,
|
|
93
|
-
percent: 100
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
request: {
|
|
98
|
-
number_redirects: 0,
|
|
99
|
-
number_retries: 3,
|
|
100
|
-
limit_retry_error: [0],
|
|
101
|
-
failover_codes: [],
|
|
102
|
-
attempt_timeout: attemptTimeout,
|
|
103
|
-
global_request: {
|
|
104
|
-
payload: {},
|
|
105
|
-
uriOptions: {},
|
|
106
|
-
addlHeaders: {},
|
|
107
|
-
authData: {}
|
|
108
|
-
},
|
|
109
|
-
healthcheck_on_timeout: true,
|
|
110
|
-
return_raw: true,
|
|
111
|
-
archiving: false,
|
|
112
|
-
return_request: false
|
|
113
|
-
},
|
|
114
|
-
proxy: {
|
|
115
|
-
enabled: false,
|
|
116
|
-
host: '',
|
|
117
|
-
port: 1,
|
|
118
|
-
protocol: 'http',
|
|
119
|
-
username: '',
|
|
120
|
-
password: ''
|
|
121
|
-
},
|
|
122
|
-
ssl: {
|
|
123
|
-
ecdhCurve: '',
|
|
124
|
-
enabled: sslenable,
|
|
125
|
-
accept_invalid_cert: sslinvalid,
|
|
126
|
-
ca_file: '',
|
|
127
|
-
key_file: '',
|
|
128
|
-
cert_file: '',
|
|
129
|
-
secure_protocol: '',
|
|
130
|
-
ciphers: ''
|
|
131
|
-
},
|
|
132
|
-
mongo: {
|
|
133
|
-
host: '',
|
|
134
|
-
port: 0,
|
|
135
|
-
database: '',
|
|
136
|
-
username: '',
|
|
137
|
-
password: '',
|
|
138
|
-
replSet: '',
|
|
139
|
-
db_ssl: {
|
|
140
|
-
enabled: false,
|
|
141
|
-
accept_invalid_cert: false,
|
|
142
|
-
ca_file: '',
|
|
143
|
-
key_file: '',
|
|
144
|
-
cert_file: ''
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
62
|
+
properties: samProps
|
|
148
63
|
}]
|
|
149
64
|
}
|
|
150
65
|
};
|
|
@@ -420,6 +335,134 @@ describe('[integration] Robustel Adapter Test', () => {
|
|
|
420
335
|
}).timeout(attemptTimeout);
|
|
421
336
|
});
|
|
422
337
|
|
|
338
|
+
// broker tests
|
|
339
|
+
describe('#getDevicesFiltered - errors', () => {
|
|
340
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
341
|
+
try {
|
|
342
|
+
const opts = {
|
|
343
|
+
filter: {
|
|
344
|
+
name: 'deviceName'
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
a.getDevicesFiltered(opts, (data, error) => {
|
|
348
|
+
try {
|
|
349
|
+
if (stub) {
|
|
350
|
+
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
|
|
351
|
+
assert.equal(null, error);
|
|
352
|
+
assert.notEqual(undefined, data);
|
|
353
|
+
assert.notEqual(null, data);
|
|
354
|
+
assert.equal(0, data.total);
|
|
355
|
+
assert.equal(0, data.list.length);
|
|
356
|
+
} else {
|
|
357
|
+
const displayE = 'Error 400 received on request';
|
|
358
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
runCommonAsserts(data, error);
|
|
362
|
+
}
|
|
363
|
+
done();
|
|
364
|
+
} catch (err) {
|
|
365
|
+
log.error(`Test Failure: ${err}`);
|
|
366
|
+
done(err);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
} catch (error) {
|
|
370
|
+
log.error(`Adapter Exception: ${error}`);
|
|
371
|
+
done(error);
|
|
372
|
+
}
|
|
373
|
+
}).timeout(attemptTimeout);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
describe('#iapGetDeviceCount - errors', () => {
|
|
377
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
378
|
+
try {
|
|
379
|
+
const opts = {
|
|
380
|
+
filter: {
|
|
381
|
+
name: 'deviceName'
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
a.iapGetDeviceCount((data, error) => {
|
|
385
|
+
try {
|
|
386
|
+
if (stub) {
|
|
387
|
+
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
|
|
388
|
+
assert.equal(null, error);
|
|
389
|
+
assert.notEqual(undefined, data);
|
|
390
|
+
assert.notEqual(null, data);
|
|
391
|
+
assert.equal(0, data.count);
|
|
392
|
+
} else {
|
|
393
|
+
const displayE = 'Error 400 received on request';
|
|
394
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
395
|
+
}
|
|
396
|
+
} else {
|
|
397
|
+
runCommonAsserts(data, error);
|
|
398
|
+
}
|
|
399
|
+
done();
|
|
400
|
+
} catch (err) {
|
|
401
|
+
log.error(`Test Failure: ${err}`);
|
|
402
|
+
done(err);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
} catch (error) {
|
|
406
|
+
log.error(`Adapter Exception: ${error}`);
|
|
407
|
+
done(error);
|
|
408
|
+
}
|
|
409
|
+
}).timeout(attemptTimeout);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// exposed cache tests
|
|
413
|
+
describe('#iapPopulateEntityCache - errors', () => {
|
|
414
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
415
|
+
try {
|
|
416
|
+
a.iapPopulateEntityCache('Device', (data, error) => {
|
|
417
|
+
try {
|
|
418
|
+
if (stub) {
|
|
419
|
+
assert.equal(null, data);
|
|
420
|
+
assert.notEqual(undefined, error);
|
|
421
|
+
assert.notEqual(null, error);
|
|
422
|
+
done();
|
|
423
|
+
} else {
|
|
424
|
+
assert.equal(undefined, error);
|
|
425
|
+
assert.equal('success', data[0]);
|
|
426
|
+
done();
|
|
427
|
+
}
|
|
428
|
+
} catch (err) {
|
|
429
|
+
log.error(`Test Failure: ${err}`);
|
|
430
|
+
done(err);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
} catch (error) {
|
|
434
|
+
log.error(`Adapter Exception: ${error}`);
|
|
435
|
+
done(error);
|
|
436
|
+
}
|
|
437
|
+
}).timeout(attemptTimeout);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
describe('#iapRetrieveEntitiesCache - errors', () => {
|
|
441
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
442
|
+
try {
|
|
443
|
+
a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
|
|
444
|
+
try {
|
|
445
|
+
if (stub) {
|
|
446
|
+
assert.equal(null, data);
|
|
447
|
+
assert.notEqual(null, error);
|
|
448
|
+
assert.notEqual(undefined, error);
|
|
449
|
+
} else {
|
|
450
|
+
assert.equal(undefined, error);
|
|
451
|
+
assert.notEqual(null, data);
|
|
452
|
+
assert.notEqual(undefined, data);
|
|
453
|
+
}
|
|
454
|
+
done();
|
|
455
|
+
} catch (err) {
|
|
456
|
+
log.error(`Test Failure: ${err}`);
|
|
457
|
+
done(err);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
} catch (error) {
|
|
461
|
+
log.error(`Adapter Exception: ${error}`);
|
|
462
|
+
done(error);
|
|
463
|
+
}
|
|
464
|
+
}).timeout(attemptTimeout);
|
|
465
|
+
});
|
|
423
466
|
/*
|
|
424
467
|
-----------------------------------------------------------------------
|
|
425
468
|
-----------------------------------------------------------------------
|
|
@@ -428,202 +471,157 @@ describe('[integration] Robustel Adapter Test', () => {
|
|
|
428
471
|
-----------------------------------------------------------------------
|
|
429
472
|
-----------------------------------------------------------------------
|
|
430
473
|
*/
|
|
431
|
-
let skipCount = 0;
|
|
432
|
-
|
|
433
474
|
describe('#getDeviceTotal - errors', () => {
|
|
434
475
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
runCommonAsserts(data, error);
|
|
444
|
-
}
|
|
445
|
-
saveMockData('Dashboard', 'getDeviceTotal', 'default', data);
|
|
446
|
-
done();
|
|
447
|
-
} catch (err) {
|
|
448
|
-
log.error(`Test Failure: ${err}`);
|
|
449
|
-
done(err);
|
|
476
|
+
try {
|
|
477
|
+
a.getDeviceTotal((data, error) => {
|
|
478
|
+
try {
|
|
479
|
+
if (stub) {
|
|
480
|
+
const displayE = 'Error 400 received on request';
|
|
481
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
482
|
+
} else {
|
|
483
|
+
runCommonAsserts(data, error);
|
|
450
484
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
485
|
+
saveMockData('Dashboard', 'getDeviceTotal', 'default', data);
|
|
486
|
+
done();
|
|
487
|
+
} catch (err) {
|
|
488
|
+
log.error(`Test Failure: ${err}`);
|
|
489
|
+
done(err);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
} catch (error) {
|
|
493
|
+
log.error(`Adapter Exception: ${error}`);
|
|
494
|
+
done(error);
|
|
495
|
+
}
|
|
461
496
|
}).timeout(attemptTimeout);
|
|
462
497
|
});
|
|
463
498
|
|
|
464
499
|
describe('#getNetworkTotal - errors', () => {
|
|
465
500
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
runCommonAsserts(data, error);
|
|
475
|
-
}
|
|
476
|
-
saveMockData('Dashboard', 'getNetworkTotal', 'default', data);
|
|
477
|
-
done();
|
|
478
|
-
} catch (err) {
|
|
479
|
-
log.error(`Test Failure: ${err}`);
|
|
480
|
-
done(err);
|
|
501
|
+
try {
|
|
502
|
+
a.getNetworkTotal((data, error) => {
|
|
503
|
+
try {
|
|
504
|
+
if (stub) {
|
|
505
|
+
const displayE = 'Error 400 received on request';
|
|
506
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
507
|
+
} else {
|
|
508
|
+
runCommonAsserts(data, error);
|
|
481
509
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
510
|
+
saveMockData('Dashboard', 'getNetworkTotal', 'default', data);
|
|
511
|
+
done();
|
|
512
|
+
} catch (err) {
|
|
513
|
+
log.error(`Test Failure: ${err}`);
|
|
514
|
+
done(err);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
} catch (error) {
|
|
518
|
+
log.error(`Adapter Exception: ${error}`);
|
|
519
|
+
done(error);
|
|
520
|
+
}
|
|
492
521
|
}).timeout(attemptTimeout);
|
|
493
522
|
});
|
|
494
523
|
|
|
495
524
|
const deviceCommandId = 'fakedata';
|
|
496
525
|
describe('#getFirmwareUpdateResult - errors', () => {
|
|
497
526
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
runCommonAsserts(data, error);
|
|
507
|
-
}
|
|
508
|
-
saveMockData('Device', 'getFirmwareUpdateResult', 'default', data);
|
|
509
|
-
done();
|
|
510
|
-
} catch (err) {
|
|
511
|
-
log.error(`Test Failure: ${err}`);
|
|
512
|
-
done(err);
|
|
527
|
+
try {
|
|
528
|
+
a.getFirmwareUpdateResult(deviceCommandId, (data, error) => {
|
|
529
|
+
try {
|
|
530
|
+
if (stub) {
|
|
531
|
+
const displayE = 'Error 400 received on request';
|
|
532
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
533
|
+
} else {
|
|
534
|
+
runCommonAsserts(data, error);
|
|
513
535
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
536
|
+
saveMockData('Device', 'getFirmwareUpdateResult', 'default', data);
|
|
537
|
+
done();
|
|
538
|
+
} catch (err) {
|
|
539
|
+
log.error(`Test Failure: ${err}`);
|
|
540
|
+
done(err);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
} catch (error) {
|
|
544
|
+
log.error(`Adapter Exception: ${error}`);
|
|
545
|
+
done(error);
|
|
546
|
+
}
|
|
524
547
|
}).timeout(attemptTimeout);
|
|
525
548
|
});
|
|
526
549
|
|
|
527
550
|
const deviceSerialNumber = 'fakedata';
|
|
528
551
|
describe('#getDeviceDetails - errors', () => {
|
|
529
552
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
runCommonAsserts(data, error);
|
|
539
|
-
}
|
|
540
|
-
saveMockData('Device', 'getDeviceDetails', 'default', data);
|
|
541
|
-
done();
|
|
542
|
-
} catch (err) {
|
|
543
|
-
log.error(`Test Failure: ${err}`);
|
|
544
|
-
done(err);
|
|
553
|
+
try {
|
|
554
|
+
a.getDeviceDetails(deviceSerialNumber, (data, error) => {
|
|
555
|
+
try {
|
|
556
|
+
if (stub) {
|
|
557
|
+
const displayE = 'Error 400 received on request';
|
|
558
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
559
|
+
} else {
|
|
560
|
+
runCommonAsserts(data, error);
|
|
545
561
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
562
|
+
saveMockData('Device', 'getDeviceDetails', 'default', data);
|
|
563
|
+
done();
|
|
564
|
+
} catch (err) {
|
|
565
|
+
log.error(`Test Failure: ${err}`);
|
|
566
|
+
done(err);
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
} catch (error) {
|
|
570
|
+
log.error(`Adapter Exception: ${error}`);
|
|
571
|
+
done(error);
|
|
572
|
+
}
|
|
556
573
|
}).timeout(attemptTimeout);
|
|
557
574
|
});
|
|
558
575
|
|
|
559
576
|
const deviceRunCommandOnDeviceBodyParam = {};
|
|
560
577
|
describe('#runCommandOnDevice - errors', () => {
|
|
561
578
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
runCommonAsserts(data, error);
|
|
571
|
-
}
|
|
572
|
-
saveMockData('Device', 'runCommandOnDevice', 'default', data);
|
|
573
|
-
done();
|
|
574
|
-
} catch (err) {
|
|
575
|
-
log.error(`Test Failure: ${err}`);
|
|
576
|
-
done(err);
|
|
579
|
+
try {
|
|
580
|
+
a.runCommandOnDevice(deviceSerialNumber, deviceRunCommandOnDeviceBodyParam, (data, error) => {
|
|
581
|
+
try {
|
|
582
|
+
if (stub) {
|
|
583
|
+
const displayE = 'Error 400 received on request';
|
|
584
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
585
|
+
} else {
|
|
586
|
+
runCommonAsserts(data, error);
|
|
577
587
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
+
saveMockData('Device', 'runCommandOnDevice', 'default', data);
|
|
589
|
+
done();
|
|
590
|
+
} catch (err) {
|
|
591
|
+
log.error(`Test Failure: ${err}`);
|
|
592
|
+
done(err);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
} catch (error) {
|
|
596
|
+
log.error(`Adapter Exception: ${error}`);
|
|
597
|
+
done(error);
|
|
598
|
+
}
|
|
588
599
|
}).timeout(attemptTimeout);
|
|
589
600
|
});
|
|
590
601
|
|
|
591
602
|
describe('#getDeviceFirmwareList - errors', () => {
|
|
592
603
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
runCommonAsserts(data, error);
|
|
602
|
-
}
|
|
603
|
-
saveMockData('Device', 'getDeviceFirmwareList', 'default', data);
|
|
604
|
-
done();
|
|
605
|
-
} catch (err) {
|
|
606
|
-
log.error(`Test Failure: ${err}`);
|
|
607
|
-
done(err);
|
|
604
|
+
try {
|
|
605
|
+
a.getDeviceFirmwareList(deviceSerialNumber, (data, error) => {
|
|
606
|
+
try {
|
|
607
|
+
if (stub) {
|
|
608
|
+
const displayE = 'Error 400 received on request';
|
|
609
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
610
|
+
} else {
|
|
611
|
+
runCommonAsserts(data, error);
|
|
608
612
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
613
|
+
saveMockData('Device', 'getDeviceFirmwareList', 'default', data);
|
|
614
|
+
done();
|
|
615
|
+
} catch (err) {
|
|
616
|
+
log.error(`Test Failure: ${err}`);
|
|
617
|
+
done(err);
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
} catch (error) {
|
|
621
|
+
log.error(`Adapter Exception: ${error}`);
|
|
622
|
+
done(error);
|
|
623
|
+
}
|
|
619
624
|
}).timeout(attemptTimeout);
|
|
620
625
|
});
|
|
621
|
-
|
|
622
|
-
describe('#Skipped test count', () => {
|
|
623
|
-
it('count skipped tests', (done) => {
|
|
624
|
-
console.log(`skipped ${skipCount} tests because \x1b[33mtask: false\x1b[0m`);
|
|
625
|
-
done();
|
|
626
|
-
});
|
|
627
|
-
});
|
|
628
626
|
});
|
|
629
627
|
});
|