@itentialopensource/adapter-gogetssl 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 +476 -0
- package/CHANGELOG.md +3 -3
- 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 +367 -266
- 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 +49 -0
- package/package.json +24 -24
- package/pronghorn.json +680 -100
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +830 -9
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.yaml +20538 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653710772448.json +120 -0
- package/report/updateReport1691508724487.json +120 -0
- package/report/updateReport1692203182238.json +120 -0
- package/report/updateReport1694468184582.json +120 -0
- package/report/updateReport1698422557075.json +120 -0
- package/sampleProperties.json +153 -3
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +166 -117
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +659 -418
- 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/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +5 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +123 -53
- package/utils/tbUtils.js +92 -48
- package/utils/testRunner.js +17 -17
- package/utils/troubleshootingAdapter.js +9 -6
- package/workflows/README.md +0 -3
- /package/report/{gogetssl_apimatic_openapi3.json → adapter-openapi.json} +0 -0
|
@@ -3,12 +3,15 @@
|
|
|
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');
|
|
@@ -18,20 +21,33 @@ const anything = td.matchers.anything();
|
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
20
23
|
let logLevel = 'none';
|
|
21
|
-
const stub = true;
|
|
22
24
|
const isRapidFail = false;
|
|
23
25
|
const isSaveMockData = false;
|
|
24
|
-
|
|
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;
|
|
25
35
|
|
|
26
36
|
// these variables can be changed to run in integrated mode so easier to set them here
|
|
27
37
|
// always check these in with bogus data!!!
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
35
51
|
|
|
36
52
|
// these are the adapter properties. You generally should not need to alter
|
|
37
53
|
// any of these after they are initially set up
|
|
@@ -41,104 +57,9 @@ global.pronghornProps = {
|
|
|
41
57
|
},
|
|
42
58
|
adapterProps: {
|
|
43
59
|
adapters: [{
|
|
44
|
-
id: 'Test-
|
|
60
|
+
id: 'Test-gogetssl',
|
|
45
61
|
type: 'GoGetSSL',
|
|
46
|
-
properties:
|
|
47
|
-
host,
|
|
48
|
-
port,
|
|
49
|
-
base_path: '/',
|
|
50
|
-
version: '',
|
|
51
|
-
cache_location: 'none',
|
|
52
|
-
encode_pathvars: true,
|
|
53
|
-
save_metric: false,
|
|
54
|
-
stub,
|
|
55
|
-
protocol,
|
|
56
|
-
authentication: {
|
|
57
|
-
auth_method: 'no_authentication',
|
|
58
|
-
username,
|
|
59
|
-
password,
|
|
60
|
-
token: '',
|
|
61
|
-
invalid_token_error: 401,
|
|
62
|
-
token_timeout: -1,
|
|
63
|
-
token_cache: 'local',
|
|
64
|
-
auth_field: 'header.headers.Authorization',
|
|
65
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
66
|
-
auth_logging: false,
|
|
67
|
-
client_id: '',
|
|
68
|
-
client_secret: '',
|
|
69
|
-
grant_type: ''
|
|
70
|
-
},
|
|
71
|
-
healthcheck: {
|
|
72
|
-
type: 'none',
|
|
73
|
-
frequency: 60000,
|
|
74
|
-
query_object: {}
|
|
75
|
-
},
|
|
76
|
-
throttle: {
|
|
77
|
-
throttle_enabled: false,
|
|
78
|
-
number_pronghorns: 1,
|
|
79
|
-
sync_async: 'sync',
|
|
80
|
-
max_in_queue: 1000,
|
|
81
|
-
concurrent_max: 1,
|
|
82
|
-
expire_timeout: 0,
|
|
83
|
-
avg_runtime: 200,
|
|
84
|
-
priorities: [
|
|
85
|
-
{
|
|
86
|
-
value: 0,
|
|
87
|
-
percent: 100
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
request: {
|
|
92
|
-
number_redirects: 0,
|
|
93
|
-
number_retries: 3,
|
|
94
|
-
limit_retry_error: [0],
|
|
95
|
-
failover_codes: [],
|
|
96
|
-
attempt_timeout: attemptTimeout,
|
|
97
|
-
global_request: {
|
|
98
|
-
payload: {},
|
|
99
|
-
uriOptions: {},
|
|
100
|
-
addlHeaders: {},
|
|
101
|
-
authData: {}
|
|
102
|
-
},
|
|
103
|
-
healthcheck_on_timeout: true,
|
|
104
|
-
return_raw: true,
|
|
105
|
-
archiving: false,
|
|
106
|
-
return_request: false
|
|
107
|
-
},
|
|
108
|
-
proxy: {
|
|
109
|
-
enabled: false,
|
|
110
|
-
host: '',
|
|
111
|
-
port: 1,
|
|
112
|
-
protocol: 'http',
|
|
113
|
-
username: '',
|
|
114
|
-
password: ''
|
|
115
|
-
},
|
|
116
|
-
ssl: {
|
|
117
|
-
ecdhCurve: '',
|
|
118
|
-
enabled: sslenable,
|
|
119
|
-
accept_invalid_cert: sslinvalid,
|
|
120
|
-
ca_file: '',
|
|
121
|
-
key_file: '',
|
|
122
|
-
cert_file: '',
|
|
123
|
-
secure_protocol: '',
|
|
124
|
-
ciphers: ''
|
|
125
|
-
},
|
|
126
|
-
mongo: {
|
|
127
|
-
host: '',
|
|
128
|
-
port: 0,
|
|
129
|
-
database: '',
|
|
130
|
-
username: '',
|
|
131
|
-
password: '',
|
|
132
|
-
replSet: '',
|
|
133
|
-
db_ssl: {
|
|
134
|
-
enabled: false,
|
|
135
|
-
accept_invalid_cert: false,
|
|
136
|
-
ca_file: '',
|
|
137
|
-
key_file: '',
|
|
138
|
-
cert_file: ''
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
62
|
+
properties: samProps
|
|
142
63
|
}]
|
|
143
64
|
}
|
|
144
65
|
};
|
|
@@ -414,6 +335,134 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
414
335
|
}).timeout(attemptTimeout);
|
|
415
336
|
});
|
|
416
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-gogetssl-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-gogetssl-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
|
+
});
|
|
417
466
|
/*
|
|
418
467
|
-----------------------------------------------------------------------
|
|
419
468
|
-----------------------------------------------------------------------
|
|
@@ -510,7 +559,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
510
559
|
try {
|
|
511
560
|
if (stub) {
|
|
512
561
|
const displayE = 'Error 400 received on request';
|
|
513
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
562
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
514
563
|
} else {
|
|
515
564
|
runCommonAsserts(data, error);
|
|
516
565
|
}
|
|
@@ -674,7 +723,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
674
723
|
try {
|
|
675
724
|
if (stub) {
|
|
676
725
|
const displayE = 'Error 400 received on request';
|
|
677
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
726
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
678
727
|
} else {
|
|
679
728
|
runCommonAsserts(data, error);
|
|
680
729
|
}
|
|
@@ -907,7 +956,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
907
956
|
try {
|
|
908
957
|
if (stub) {
|
|
909
958
|
const displayE = 'Error 400 received on request';
|
|
910
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
959
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
911
960
|
} else {
|
|
912
961
|
runCommonAsserts(data, error);
|
|
913
962
|
}
|
|
@@ -981,7 +1030,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
981
1030
|
try {
|
|
982
1031
|
if (stub) {
|
|
983
1032
|
const displayE = 'Error 400 received on request';
|
|
984
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1033
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
985
1034
|
} else {
|
|
986
1035
|
runCommonAsserts(data, error);
|
|
987
1036
|
}
|
|
@@ -1006,7 +1055,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1006
1055
|
try {
|
|
1007
1056
|
if (stub) {
|
|
1008
1057
|
const displayE = 'Error 400 received on request';
|
|
1009
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1058
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1010
1059
|
} else {
|
|
1011
1060
|
runCommonAsserts(data, error);
|
|
1012
1061
|
}
|
|
@@ -1032,7 +1081,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1032
1081
|
try {
|
|
1033
1082
|
if (stub) {
|
|
1034
1083
|
const displayE = 'Error 400 received on request';
|
|
1035
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1084
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1036
1085
|
} else {
|
|
1037
1086
|
runCommonAsserts(data, error);
|
|
1038
1087
|
}
|
|
@@ -1159,7 +1208,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1159
1208
|
try {
|
|
1160
1209
|
if (stub) {
|
|
1161
1210
|
const displayE = 'Error 400 received on request';
|
|
1162
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1211
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1163
1212
|
} else {
|
|
1164
1213
|
runCommonAsserts(data, error);
|
|
1165
1214
|
}
|
|
@@ -1274,7 +1323,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1274
1323
|
try {
|
|
1275
1324
|
if (stub) {
|
|
1276
1325
|
const displayE = 'Error 400 received on request';
|
|
1277
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1326
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1278
1327
|
} else {
|
|
1279
1328
|
runCommonAsserts(data, error);
|
|
1280
1329
|
}
|
|
@@ -1530,7 +1579,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1530
1579
|
try {
|
|
1531
1580
|
if (stub) {
|
|
1532
1581
|
const displayE = 'Error 400 received on request';
|
|
1533
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1582
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1534
1583
|
} else {
|
|
1535
1584
|
runCommonAsserts(data, error);
|
|
1536
1585
|
}
|
|
@@ -1556,7 +1605,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1556
1605
|
try {
|
|
1557
1606
|
if (stub) {
|
|
1558
1607
|
const displayE = 'Error 400 received on request';
|
|
1559
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1608
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1560
1609
|
} else {
|
|
1561
1610
|
runCommonAsserts(data, error);
|
|
1562
1611
|
}
|