@itentialopensource/adapter-robustel 0.1.1 → 0.2.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 +169 -0
- package/CHANGELOG.md +9 -2
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +88 -74
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +221 -571
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +301 -464
- package/adapterBase.js +1006 -252
- package/entities/.generic/action.json +105 -0
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/package.json +5 -3
- package/pronghorn.json +642 -570
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +436 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653173664637.json +120 -0
- package/sampleProperties.json +97 -4
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +139 -269
- package/test/unit/adapterBaseTestUnit.js +30 -25
- package/test/unit/adapterTestUnit.js +90 -177
- package/utils/adapterInfo.js +206 -0
- package/utils/entitiesToDB.js +12 -57
- package/utils/pre-commit.sh +3 -0
- package/utils/tbScript.js +35 -20
- package/utils/tbUtils.js +49 -31
- package/utils/testRunner.js +16 -16
package/sampleProperties.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"version": "",
|
|
9
9
|
"cache_location": "none",
|
|
10
10
|
"encode_pathvars": true,
|
|
11
|
-
"
|
|
11
|
+
"encode_queryvars": true,
|
|
12
|
+
"save_metric": false,
|
|
12
13
|
"stub": false,
|
|
13
14
|
"protocol": "https",
|
|
14
15
|
"authentication": {
|
|
@@ -22,9 +23,13 @@
|
|
|
22
23
|
"auth_field": "header.headers.Authorization",
|
|
23
24
|
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
24
25
|
"auth_logging": false,
|
|
25
|
-
"client_id": "",
|
|
26
|
-
"client_secret": "",
|
|
27
|
-
"grant_type": ""
|
|
26
|
+
"client_id": "id",
|
|
27
|
+
"client_secret": "secret",
|
|
28
|
+
"grant_type": "",
|
|
29
|
+
"api_version": "1.0",
|
|
30
|
+
"signature_version": "1.0",
|
|
31
|
+
"unique_code": "unique_code"
|
|
32
|
+
|
|
28
33
|
},
|
|
29
34
|
"healthcheck": {
|
|
30
35
|
"type": "none",
|
|
@@ -97,6 +102,94 @@
|
|
|
97
102
|
"key_file": "",
|
|
98
103
|
"cert_file": ""
|
|
99
104
|
}
|
|
105
|
+
},
|
|
106
|
+
"devicebroker": {
|
|
107
|
+
"getDevice": [
|
|
108
|
+
{
|
|
109
|
+
"path": "/get/devices/{id}",
|
|
110
|
+
"method": "GET",
|
|
111
|
+
"query": {},
|
|
112
|
+
"body": {},
|
|
113
|
+
"headers": {},
|
|
114
|
+
"handleFailure": "ignore",
|
|
115
|
+
"requestFields": {
|
|
116
|
+
"id": "name"
|
|
117
|
+
},
|
|
118
|
+
"responseDatakey": "",
|
|
119
|
+
"responseFields": {
|
|
120
|
+
"name": "host",
|
|
121
|
+
"ostype": "os",
|
|
122
|
+
"ostypePrefix": "system-",
|
|
123
|
+
"ipaddress": "attributes.ipaddr",
|
|
124
|
+
"port": "443"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"getDevicesFiltered": [
|
|
129
|
+
{
|
|
130
|
+
"path": "/get/devices",
|
|
131
|
+
"method": "GET",
|
|
132
|
+
"query": {},
|
|
133
|
+
"body": {},
|
|
134
|
+
"headers": {},
|
|
135
|
+
"handleFailure": "ignore",
|
|
136
|
+
"requestFields": {},
|
|
137
|
+
"responseDatakey": "",
|
|
138
|
+
"responseFields": {
|
|
139
|
+
"name": "host",
|
|
140
|
+
"ostype": "os",
|
|
141
|
+
"ostypePrefix": "system-",
|
|
142
|
+
"ipaddress": "attributes.ipaddr",
|
|
143
|
+
"port": "443"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"isAlive": [
|
|
148
|
+
{
|
|
149
|
+
"path": "/get/devices/{id}/status",
|
|
150
|
+
"method": "GET",
|
|
151
|
+
"query": {},
|
|
152
|
+
"body": {},
|
|
153
|
+
"headers": {},
|
|
154
|
+
"handleFailure": "ignore",
|
|
155
|
+
"requestFields": {
|
|
156
|
+
"id": "name"
|
|
157
|
+
},
|
|
158
|
+
"responseDatakey": "",
|
|
159
|
+
"responseFields": {
|
|
160
|
+
"status": "status",
|
|
161
|
+
"statusValue": "online"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"getConfig": [
|
|
166
|
+
{
|
|
167
|
+
"path": "/get/devices/{id}/configPart1",
|
|
168
|
+
"method": "GET",
|
|
169
|
+
"query": {},
|
|
170
|
+
"body": {},
|
|
171
|
+
"headers": {},
|
|
172
|
+
"handleFailure": "ignore",
|
|
173
|
+
"requestFields": {
|
|
174
|
+
"id": "name"
|
|
175
|
+
},
|
|
176
|
+
"responseDatakey": "",
|
|
177
|
+
"responseFields": {}
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"getCount": [
|
|
181
|
+
{
|
|
182
|
+
"path": "/get/devices",
|
|
183
|
+
"method": "GET",
|
|
184
|
+
"query": {},
|
|
185
|
+
"body": {},
|
|
186
|
+
"headers": {},
|
|
187
|
+
"handleFailure": "ignore",
|
|
188
|
+
"requestFields": {},
|
|
189
|
+
"responseDatakey": "",
|
|
190
|
+
"responseFields": {}
|
|
191
|
+
}
|
|
192
|
+
]
|
|
100
193
|
}
|
|
101
194
|
},
|
|
102
195
|
"groups": [],
|
|
@@ -34,7 +34,7 @@ describe('[integration] Adapter BasicGET Test', () => {
|
|
|
34
34
|
context('Testing GET calls without query parameters', () => {
|
|
35
35
|
before(async () => {
|
|
36
36
|
const iapDir = path.join(__dirname, '../../../../../');
|
|
37
|
-
if (!utils.
|
|
37
|
+
if (!utils.areWeUnderIAPinstallationDirectory()) {
|
|
38
38
|
const sampleProperties = require('../../sampleProperties.json');
|
|
39
39
|
const adapter = { properties: sampleProperties };
|
|
40
40
|
a = basicGet.getAdapterInstance(adapter);
|
|
@@ -3,6 +3,8 @@
|
|
|
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');
|
|
@@ -14,27 +16,38 @@ const { expect } = require('chai');
|
|
|
14
16
|
const { use } = require('chai');
|
|
15
17
|
const td = require('testdouble');
|
|
16
18
|
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
|
};
|
|
@@ -428,202 +343,157 @@ describe('[integration] Robustel Adapter Test', () => {
|
|
|
428
343
|
-----------------------------------------------------------------------
|
|
429
344
|
-----------------------------------------------------------------------
|
|
430
345
|
*/
|
|
431
|
-
let skipCount = 0;
|
|
432
|
-
|
|
433
346
|
describe('#getDeviceTotal - errors', () => {
|
|
434
347
|
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);
|
|
348
|
+
try {
|
|
349
|
+
a.getDeviceTotal((data, error) => {
|
|
350
|
+
try {
|
|
351
|
+
if (stub) {
|
|
352
|
+
const displayE = 'Error 400 received on request';
|
|
353
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
354
|
+
} else {
|
|
355
|
+
runCommonAsserts(data, error);
|
|
450
356
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
357
|
+
saveMockData('Dashboard', 'getDeviceTotal', 'default', data);
|
|
358
|
+
done();
|
|
359
|
+
} catch (err) {
|
|
360
|
+
log.error(`Test Failure: ${err}`);
|
|
361
|
+
done(err);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
} catch (error) {
|
|
365
|
+
log.error(`Adapter Exception: ${error}`);
|
|
366
|
+
done(error);
|
|
367
|
+
}
|
|
461
368
|
}).timeout(attemptTimeout);
|
|
462
369
|
});
|
|
463
370
|
|
|
464
371
|
describe('#getNetworkTotal - errors', () => {
|
|
465
372
|
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);
|
|
373
|
+
try {
|
|
374
|
+
a.getNetworkTotal((data, error) => {
|
|
375
|
+
try {
|
|
376
|
+
if (stub) {
|
|
377
|
+
const displayE = 'Error 400 received on request';
|
|
378
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
379
|
+
} else {
|
|
380
|
+
runCommonAsserts(data, error);
|
|
481
381
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
382
|
+
saveMockData('Dashboard', 'getNetworkTotal', 'default', data);
|
|
383
|
+
done();
|
|
384
|
+
} catch (err) {
|
|
385
|
+
log.error(`Test Failure: ${err}`);
|
|
386
|
+
done(err);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
} catch (error) {
|
|
390
|
+
log.error(`Adapter Exception: ${error}`);
|
|
391
|
+
done(error);
|
|
392
|
+
}
|
|
492
393
|
}).timeout(attemptTimeout);
|
|
493
394
|
});
|
|
494
395
|
|
|
495
396
|
const deviceCommandId = 'fakedata';
|
|
496
397
|
describe('#getFirmwareUpdateResult - errors', () => {
|
|
497
398
|
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);
|
|
399
|
+
try {
|
|
400
|
+
a.getFirmwareUpdateResult(deviceCommandId, (data, error) => {
|
|
401
|
+
try {
|
|
402
|
+
if (stub) {
|
|
403
|
+
const displayE = 'Error 400 received on request';
|
|
404
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
405
|
+
} else {
|
|
406
|
+
runCommonAsserts(data, error);
|
|
513
407
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
408
|
+
saveMockData('Device', 'getFirmwareUpdateResult', 'default', data);
|
|
409
|
+
done();
|
|
410
|
+
} catch (err) {
|
|
411
|
+
log.error(`Test Failure: ${err}`);
|
|
412
|
+
done(err);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
} catch (error) {
|
|
416
|
+
log.error(`Adapter Exception: ${error}`);
|
|
417
|
+
done(error);
|
|
418
|
+
}
|
|
524
419
|
}).timeout(attemptTimeout);
|
|
525
420
|
});
|
|
526
421
|
|
|
527
422
|
const deviceSerialNumber = 'fakedata';
|
|
528
423
|
describe('#getDeviceDetails - errors', () => {
|
|
529
424
|
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);
|
|
425
|
+
try {
|
|
426
|
+
a.getDeviceDetails(deviceSerialNumber, (data, error) => {
|
|
427
|
+
try {
|
|
428
|
+
if (stub) {
|
|
429
|
+
const displayE = 'Error 400 received on request';
|
|
430
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
431
|
+
} else {
|
|
432
|
+
runCommonAsserts(data, error);
|
|
545
433
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
434
|
+
saveMockData('Device', 'getDeviceDetails', 'default', data);
|
|
435
|
+
done();
|
|
436
|
+
} catch (err) {
|
|
437
|
+
log.error(`Test Failure: ${err}`);
|
|
438
|
+
done(err);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
} catch (error) {
|
|
442
|
+
log.error(`Adapter Exception: ${error}`);
|
|
443
|
+
done(error);
|
|
444
|
+
}
|
|
556
445
|
}).timeout(attemptTimeout);
|
|
557
446
|
});
|
|
558
447
|
|
|
559
448
|
const deviceRunCommandOnDeviceBodyParam = {};
|
|
560
449
|
describe('#runCommandOnDevice - errors', () => {
|
|
561
450
|
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);
|
|
451
|
+
try {
|
|
452
|
+
a.runCommandOnDevice(deviceSerialNumber, deviceRunCommandOnDeviceBodyParam, (data, error) => {
|
|
453
|
+
try {
|
|
454
|
+
if (stub) {
|
|
455
|
+
const displayE = 'Error 400 received on request';
|
|
456
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-robustel-connectorRest-handleEndResponse', displayE);
|
|
457
|
+
} else {
|
|
458
|
+
runCommonAsserts(data, error);
|
|
577
459
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
460
|
+
saveMockData('Device', 'runCommandOnDevice', 'default', data);
|
|
461
|
+
done();
|
|
462
|
+
} catch (err) {
|
|
463
|
+
log.error(`Test Failure: ${err}`);
|
|
464
|
+
done(err);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
} catch (error) {
|
|
468
|
+
log.error(`Adapter Exception: ${error}`);
|
|
469
|
+
done(error);
|
|
470
|
+
}
|
|
588
471
|
}).timeout(attemptTimeout);
|
|
589
472
|
});
|
|
590
473
|
|
|
591
474
|
describe('#getDeviceFirmwareList - errors', () => {
|
|
592
475
|
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);
|
|
476
|
+
try {
|
|
477
|
+
a.getDeviceFirmwareList(deviceSerialNumber, (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);
|
|
608
484
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
485
|
+
saveMockData('Device', 'getDeviceFirmwareList', '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
|
+
}
|
|
619
496
|
}).timeout(attemptTimeout);
|
|
620
497
|
});
|
|
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
498
|
});
|
|
629
499
|
});
|