@itentialopensource/adapter-gogetssl 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 +334 -61
- package/adapterBase.js +1007 -253
- 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 -401
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +424 -3
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653710772448.json +120 -0
- package/sampleProperties.json +90 -1
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +37 -116
- package/test/unit/adapterBaseTestUnit.js +30 -25
- package/test/unit/adapterTestUnit.js +349 -334
- package/utils/adapterInfo.js +206 -0
- package/utils/artifactize.js +0 -0
- package/utils/entitiesToDB.js +12 -57
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +3 -0
- package/utils/tbScript.js +35 -20
- package/utils/tbUtils.js +59 -35
- 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": true,
|
|
13
14
|
"protocol": "https",
|
|
14
15
|
"authentication": {
|
|
@@ -97,6 +98,94 @@
|
|
|
97
98
|
"key_file": "",
|
|
98
99
|
"cert_file": ""
|
|
99
100
|
}
|
|
101
|
+
},
|
|
102
|
+
"devicebroker": {
|
|
103
|
+
"getDevice": [
|
|
104
|
+
{
|
|
105
|
+
"path": "/get/devices/{id}",
|
|
106
|
+
"method": "GET",
|
|
107
|
+
"query": {},
|
|
108
|
+
"body": {},
|
|
109
|
+
"headers": {},
|
|
110
|
+
"handleFailure": "ignore",
|
|
111
|
+
"requestFields": {
|
|
112
|
+
"id": "name"
|
|
113
|
+
},
|
|
114
|
+
"responseDatakey": "",
|
|
115
|
+
"responseFields": {
|
|
116
|
+
"name": "host",
|
|
117
|
+
"ostype": "os",
|
|
118
|
+
"ostypePrefix": "system-",
|
|
119
|
+
"ipaddress": "attributes.ipaddr",
|
|
120
|
+
"port": "443"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"getDevicesFiltered": [
|
|
125
|
+
{
|
|
126
|
+
"path": "/get/devices",
|
|
127
|
+
"method": "GET",
|
|
128
|
+
"query": {},
|
|
129
|
+
"body": {},
|
|
130
|
+
"headers": {},
|
|
131
|
+
"handleFailure": "ignore",
|
|
132
|
+
"requestFields": {},
|
|
133
|
+
"responseDatakey": "",
|
|
134
|
+
"responseFields": {
|
|
135
|
+
"name": "host",
|
|
136
|
+
"ostype": "os",
|
|
137
|
+
"ostypePrefix": "system-",
|
|
138
|
+
"ipaddress": "attributes.ipaddr",
|
|
139
|
+
"port": "443"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"isAlive": [
|
|
144
|
+
{
|
|
145
|
+
"path": "/get/devices/{id}/status",
|
|
146
|
+
"method": "GET",
|
|
147
|
+
"query": {},
|
|
148
|
+
"body": {},
|
|
149
|
+
"headers": {},
|
|
150
|
+
"handleFailure": "ignore",
|
|
151
|
+
"requestFields": {
|
|
152
|
+
"id": "name"
|
|
153
|
+
},
|
|
154
|
+
"responseDatakey": "",
|
|
155
|
+
"responseFields": {
|
|
156
|
+
"status": "status",
|
|
157
|
+
"statusValue": "online"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"getConfig": [
|
|
162
|
+
{
|
|
163
|
+
"path": "/get/devices/{id}/configPart1",
|
|
164
|
+
"method": "GET",
|
|
165
|
+
"query": {},
|
|
166
|
+
"body": {},
|
|
167
|
+
"headers": {},
|
|
168
|
+
"handleFailure": "ignore",
|
|
169
|
+
"requestFields": {
|
|
170
|
+
"id": "name"
|
|
171
|
+
},
|
|
172
|
+
"responseDatakey": "",
|
|
173
|
+
"responseFields": {}
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"getCount": [
|
|
177
|
+
{
|
|
178
|
+
"path": "/get/devices",
|
|
179
|
+
"method": "GET",
|
|
180
|
+
"query": {},
|
|
181
|
+
"body": {},
|
|
182
|
+
"headers": {},
|
|
183
|
+
"handleFailure": "ignore",
|
|
184
|
+
"requestFields": {},
|
|
185
|
+
"responseDatakey": "",
|
|
186
|
+
"responseFields": {}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
100
189
|
}
|
|
101
190
|
},
|
|
102
191
|
"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');
|
|
@@ -13,25 +15,39 @@ const winston = require('winston');
|
|
|
13
15
|
const { expect } = require('chai');
|
|
14
16
|
const { use } = require('chai');
|
|
15
17
|
const td = require('testdouble');
|
|
18
|
+
const util = require('util');
|
|
16
19
|
|
|
17
20
|
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
|
};
|
|
@@ -510,7 +431,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
510
431
|
try {
|
|
511
432
|
if (stub) {
|
|
512
433
|
const displayE = 'Error 400 received on request';
|
|
513
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
434
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
514
435
|
} else {
|
|
515
436
|
runCommonAsserts(data, error);
|
|
516
437
|
}
|
|
@@ -674,7 +595,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
674
595
|
try {
|
|
675
596
|
if (stub) {
|
|
676
597
|
const displayE = 'Error 400 received on request';
|
|
677
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
598
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
678
599
|
} else {
|
|
679
600
|
runCommonAsserts(data, error);
|
|
680
601
|
}
|
|
@@ -907,7 +828,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
907
828
|
try {
|
|
908
829
|
if (stub) {
|
|
909
830
|
const displayE = 'Error 400 received on request';
|
|
910
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
831
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
911
832
|
} else {
|
|
912
833
|
runCommonAsserts(data, error);
|
|
913
834
|
}
|
|
@@ -981,7 +902,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
981
902
|
try {
|
|
982
903
|
if (stub) {
|
|
983
904
|
const displayE = 'Error 400 received on request';
|
|
984
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
905
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
985
906
|
} else {
|
|
986
907
|
runCommonAsserts(data, error);
|
|
987
908
|
}
|
|
@@ -1006,7 +927,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1006
927
|
try {
|
|
1007
928
|
if (stub) {
|
|
1008
929
|
const displayE = 'Error 400 received on request';
|
|
1009
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
930
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1010
931
|
} else {
|
|
1011
932
|
runCommonAsserts(data, error);
|
|
1012
933
|
}
|
|
@@ -1032,7 +953,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1032
953
|
try {
|
|
1033
954
|
if (stub) {
|
|
1034
955
|
const displayE = 'Error 400 received on request';
|
|
1035
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
956
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1036
957
|
} else {
|
|
1037
958
|
runCommonAsserts(data, error);
|
|
1038
959
|
}
|
|
@@ -1159,7 +1080,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1159
1080
|
try {
|
|
1160
1081
|
if (stub) {
|
|
1161
1082
|
const displayE = 'Error 400 received on request';
|
|
1162
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1083
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1163
1084
|
} else {
|
|
1164
1085
|
runCommonAsserts(data, error);
|
|
1165
1086
|
}
|
|
@@ -1274,7 +1195,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1274
1195
|
try {
|
|
1275
1196
|
if (stub) {
|
|
1276
1197
|
const displayE = 'Error 400 received on request';
|
|
1277
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1198
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1278
1199
|
} else {
|
|
1279
1200
|
runCommonAsserts(data, error);
|
|
1280
1201
|
}
|
|
@@ -1530,7 +1451,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1530
1451
|
try {
|
|
1531
1452
|
if (stub) {
|
|
1532
1453
|
const displayE = 'Error 400 received on request';
|
|
1533
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1454
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1534
1455
|
} else {
|
|
1535
1456
|
runCommonAsserts(data, error);
|
|
1536
1457
|
}
|
|
@@ -1556,7 +1477,7 @@ describe('[integration] GoGetSSL Adapter Test', () => {
|
|
|
1556
1477
|
try {
|
|
1557
1478
|
if (stub) {
|
|
1558
1479
|
const displayE = 'Error 400 received on request';
|
|
1559
|
-
runErrorAsserts(data, error, 'AD.500', 'Test-
|
|
1480
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-gogetssl-connectorRest-handleEndResponse', displayE);
|
|
1560
1481
|
} else {
|
|
1561
1482
|
runCommonAsserts(data, error);
|
|
1562
1483
|
}
|
|
@@ -317,8 +317,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
317
317
|
});
|
|
318
318
|
it('should return a list of functions', (done) => {
|
|
319
319
|
const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
|
|
320
|
-
'entityInList', '
|
|
321
|
-
'
|
|
320
|
+
'entityInList', 'getAllCapabilities', 'getAllFunctions', 'getConfig', 'getDevice', 'getDevicesFiltered', 'hasDevices', 'hasEntities',
|
|
321
|
+
'healthCheck', 'iapFindAdapterPath', 'iapGetAdapterQueue', 'iapGetAdapterWorkflowFunctions', 'iapGetDeviceCount', 'iapMakeBrokerCall',
|
|
322
|
+
'iapMoveAdapterEntitiesToDB', 'iapRunAdapterBasicGet', 'iapRunAdapterConnectivity', 'iapRunAdapterHealthcheck', 'iapSuspendAdapter',
|
|
323
|
+
'iapTroubleshootAdapter', 'iapUnsuspendAdapter', 'iapUpdateAdapterConfiguration', 'isAlive', 'refreshProperties', 'addListener',
|
|
322
324
|
'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
|
|
323
325
|
'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|
|
324
326
|
try {
|
|
@@ -337,10 +339,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
337
339
|
}).timeout(attemptTimeout);
|
|
338
340
|
});
|
|
339
341
|
|
|
340
|
-
describe('#
|
|
341
|
-
it('should have a
|
|
342
|
+
describe('#iapGetAdapterWorkflowFunctions', () => {
|
|
343
|
+
it('should have a iapGetAdapterWorkflowFunctions function', (done) => {
|
|
342
344
|
try {
|
|
343
|
-
assert.equal(true, typeof a.
|
|
345
|
+
assert.equal(true, typeof a.iapGetAdapterWorkflowFunctions === 'function');
|
|
344
346
|
done();
|
|
345
347
|
} catch (error) {
|
|
346
348
|
log.error(`Test Failure: ${error}`);
|
|
@@ -349,7 +351,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
349
351
|
});
|
|
350
352
|
it('should retrieve workflow functions', (done) => {
|
|
351
353
|
try {
|
|
352
|
-
const expectedFunctions = a.
|
|
354
|
+
const expectedFunctions = a.iapGetAdapterWorkflowFunctions([]);
|
|
353
355
|
try {
|
|
354
356
|
assert.equal(0, expectedFunctions.length);
|
|
355
357
|
done();
|
|
@@ -426,10 +428,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
426
428
|
}).timeout(attemptTimeout);
|
|
427
429
|
});
|
|
428
430
|
|
|
429
|
-
describe('#
|
|
430
|
-
it('should have a
|
|
431
|
+
describe('#iapGetAdapterQueue', () => {
|
|
432
|
+
it('should have a iapGetAdapterQueue function', (done) => {
|
|
431
433
|
try {
|
|
432
|
-
assert.equal(true, typeof a.
|
|
434
|
+
assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
|
|
433
435
|
done();
|
|
434
436
|
} catch (error) {
|
|
435
437
|
log.error(`Test Failure: ${error}`);
|
|
@@ -438,7 +440,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
438
440
|
});
|
|
439
441
|
it('should get information for all of the requests currently in the queue', (done) => {
|
|
440
442
|
try {
|
|
441
|
-
const expectedFunctions = a.
|
|
443
|
+
const expectedFunctions = a.iapGetAdapterQueue();
|
|
442
444
|
try {
|
|
443
445
|
assert.equal(0, expectedFunctions.length);
|
|
444
446
|
done();
|
|
@@ -817,12 +819,17 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
817
819
|
try {
|
|
818
820
|
assert.notEqual(0, expectedCapabilities.length);
|
|
819
821
|
assert.equal('.generic', expectedCapabilities[0].entity);
|
|
820
|
-
assert.equal(
|
|
822
|
+
assert.equal(10, expectedCapabilities[0].actions.length);
|
|
821
823
|
assert.equal('getGenerics', expectedCapabilities[0].actions[0]);
|
|
822
824
|
assert.equal('createGeneric', expectedCapabilities[0].actions[1]);
|
|
823
825
|
assert.equal('updateGeneric', expectedCapabilities[0].actions[2]);
|
|
824
826
|
assert.equal('patchGeneric', expectedCapabilities[0].actions[3]);
|
|
825
827
|
assert.equal('deleteGeneric', expectedCapabilities[0].actions[4]);
|
|
828
|
+
assert.equal('getGenericsNoBase', expectedCapabilities[0].actions[5]);
|
|
829
|
+
assert.equal('createGenericNoBase', expectedCapabilities[0].actions[6]);
|
|
830
|
+
assert.equal('updateGenericNoBase', expectedCapabilities[0].actions[7]);
|
|
831
|
+
assert.equal('patchGenericNoBase', expectedCapabilities[0].actions[8]);
|
|
832
|
+
assert.equal('deleteGenericNoBase', expectedCapabilities[0].actions[9]);
|
|
826
833
|
assert.equal('.system', expectedCapabilities[1].entity);
|
|
827
834
|
assert.equal(2, expectedCapabilities[1].actions.length);
|
|
828
835
|
assert.equal('getToken', expectedCapabilities[1].actions[0]);
|
|
@@ -843,12 +850,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
843
850
|
}).timeout(attemptTimeout);
|
|
844
851
|
});
|
|
845
852
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
describe('#updateAdapterConfiguration', () => {
|
|
849
|
-
it('should have a updateAdapterConfiguration function', (done) => {
|
|
853
|
+
describe('#iapUpdateAdapterConfiguration', () => {
|
|
854
|
+
it('should have a iapUpdateAdapterConfiguration function', (done) => {
|
|
850
855
|
try {
|
|
851
|
-
assert.equal(true, typeof a.
|
|
856
|
+
assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
|
|
852
857
|
done();
|
|
853
858
|
} catch (error) {
|
|
854
859
|
log.error(`Test Failure: ${error}`);
|
|
@@ -857,7 +862,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
857
862
|
});
|
|
858
863
|
it('should return no updated if no changes are provided', (done) => {
|
|
859
864
|
try {
|
|
860
|
-
a.
|
|
865
|
+
a.iapUpdateAdapterConfiguration(null, null, null, null, null, (data, error) => {
|
|
861
866
|
try {
|
|
862
867
|
assert.equal('No configuration updates to make', data.response);
|
|
863
868
|
done();
|
|
@@ -873,10 +878,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
873
878
|
}).timeout(attemptTimeout);
|
|
874
879
|
it('should throw an error if missing configuration file', (done) => {
|
|
875
880
|
try {
|
|
876
|
-
a.
|
|
881
|
+
a.iapUpdateAdapterConfiguration(null, { name: 'fakeChange' }, null, null, null, (data, error) => {
|
|
877
882
|
try {
|
|
878
883
|
const displayE = 'configFile is required';
|
|
879
|
-
runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-
|
|
884
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
|
|
880
885
|
done();
|
|
881
886
|
} catch (err) {
|
|
882
887
|
log.error(`Test Failure: ${err}`);
|
|
@@ -890,10 +895,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
890
895
|
}).timeout(attemptTimeout);
|
|
891
896
|
it('if not package.json, entity is required', (done) => {
|
|
892
897
|
try {
|
|
893
|
-
a.
|
|
898
|
+
a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, null, null, null, (data, error) => {
|
|
894
899
|
try {
|
|
895
900
|
const displayE = 'Unsupported Configuration Change or Missing Entity';
|
|
896
|
-
runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-
|
|
901
|
+
runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
|
|
897
902
|
done();
|
|
898
903
|
} catch (err) {
|
|
899
904
|
log.error(`Test Failure: ${err}`);
|
|
@@ -907,10 +912,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
907
912
|
}).timeout(attemptTimeout);
|
|
908
913
|
it('if not package.json, type is required', (done) => {
|
|
909
914
|
try {
|
|
910
|
-
a.
|
|
915
|
+
a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'entity', null, null, (data, error) => {
|
|
911
916
|
try {
|
|
912
917
|
const displayE = 'type is required';
|
|
913
|
-
runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-
|
|
918
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
|
|
914
919
|
done();
|
|
915
920
|
} catch (err) {
|
|
916
921
|
log.error(`Test Failure: ${err}`);
|
|
@@ -924,10 +929,10 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
924
929
|
}).timeout(attemptTimeout);
|
|
925
930
|
it('if not package.json, entity must be valid', (done) => {
|
|
926
931
|
try {
|
|
927
|
-
a.
|
|
932
|
+
a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'fakeEntity', 'fakeType', null, (data, error) => {
|
|
928
933
|
try {
|
|
929
934
|
const displayE = 'Incomplete Configuration Change: Invalid Entity - fakeEntity';
|
|
930
|
-
runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-
|
|
935
|
+
runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
|
|
931
936
|
done();
|
|
932
937
|
} catch (err) {
|
|
933
938
|
log.error(`Test Failure: ${err}`);
|