@itentialopensource/adapter-alkira 0.1.7 → 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/.eslintignore +0 -1
- package/.jshintrc +3 -0
- package/AUTH.md +8 -35
- package/CHANGELOG.md +8 -0
- package/CONTRIBUTING.md +1 -160
- package/ENHANCE.md +2 -2
- package/README.md +22 -17
- package/SYSTEMINFO.md +16 -3
- package/adapter.js +164 -334
- package/adapterBase.js +411 -913
- package/changelogs/changelog.md +56 -0
- package/metadata.json +101 -0
- package/package.json +22 -24
- package/pronghorn.json +586 -254
- package/propertiesSchema.json +380 -40
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +8 -8
- package/report/updateReport1691170238076.json +120 -0
- package/sampleProperties.json +82 -18
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +130 -2
- package/test/unit/adapterBaseTestUnit.js +388 -313
- package/test/unit/adapterTestUnit.js +300 -109
- package/utils/adapterInfo.js +1 -1
- package/utils/addAuth.js +1 -1
- package/utils/artifactize.js +1 -1
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +1 -0
- package/utils/findPath.js +1 -1
- package/utils/modify.js +13 -15
- package/utils/packModificationScript.js +1 -1
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +3 -10
- package/utils/tbUtils.js +2 -3
- package/utils/testRunner.js +1 -1
- package/utils/troubleshootingAdapter.js +1 -3
- package/workflows/README.md +0 -3
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
3
|
-
"configLines":
|
|
4
|
-
"scriptLines":
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
9
|
-
"wfTasks":
|
|
2
|
+
"version": "0.1.7",
|
|
3
|
+
"configLines": 46883,
|
|
4
|
+
"scriptLines": 1783,
|
|
5
|
+
"codeLines": 40298,
|
|
6
|
+
"testLines": 33103,
|
|
7
|
+
"testCases": 1764,
|
|
8
|
+
"totalCodeLines": 75184,
|
|
9
|
+
"wfTasks": 465
|
|
10
10
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 31
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 17
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 6
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 22
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^5.1.0"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 76
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "markdown",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 343
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
52
|
+
"value": 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
57
|
+
"value": 642
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
62
|
+
"value": 48
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
67
|
+
"value": 70
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the BROKER.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "unitTestJS",
|
|
76
|
+
"description": "Number of lines of code in unit tests",
|
|
77
|
+
"value": 19313
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "unitTestJS",
|
|
81
|
+
"description": "Number of unit tests",
|
|
82
|
+
"value": 1245
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "integrationTestJS",
|
|
86
|
+
"description": "Number of lines of code in integration tests",
|
|
87
|
+
"value": 12539
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "integrationTestJS",
|
|
91
|
+
"description": "Number of integration tests",
|
|
92
|
+
"value": 449
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "staticFile",
|
|
96
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
97
|
+
"value": 1350
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "staticFile",
|
|
101
|
+
"description": "Number of static files added",
|
|
102
|
+
"value": 38
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "Overall",
|
|
106
|
+
"description": "Total lines of Code",
|
|
107
|
+
"value": 33202
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "Overall",
|
|
111
|
+
"description": "Total Tests",
|
|
112
|
+
"value": 1694
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "Overall",
|
|
116
|
+
"description": "Total Files",
|
|
117
|
+
"value": 6
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"properties": {
|
|
5
5
|
"host": "localhost",
|
|
6
6
|
"port": 443,
|
|
7
|
+
"choosepath": "",
|
|
7
8
|
"base_path": "/api",
|
|
8
9
|
"version": "",
|
|
9
10
|
"cache_location": "none",
|
|
@@ -13,24 +14,43 @@
|
|
|
13
14
|
"stub": true,
|
|
14
15
|
"protocol": "https",
|
|
15
16
|
"authentication": {
|
|
16
|
-
"auth_method": "
|
|
17
|
+
"auth_method": "request_token",
|
|
17
18
|
"username": "username",
|
|
18
19
|
"password": "password",
|
|
19
20
|
"token": "token",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
21
|
+
"token_user_field": "username",
|
|
22
|
+
"token_password_field": "password",
|
|
23
|
+
"token_result_field": "token",
|
|
24
|
+
"token_URI_path": "",
|
|
22
25
|
"invalid_token_error": 401,
|
|
23
|
-
"
|
|
24
|
-
"
|
|
26
|
+
"token_timeout": 3600000,
|
|
27
|
+
"token_cache": "local",
|
|
28
|
+
"auth_field": "header.headers.Cookie",
|
|
29
|
+
"auth_field_format": "JSESSIONID={token};SESSION={tokenp2}",
|
|
25
30
|
"auth_logging": false,
|
|
26
31
|
"client_id": "",
|
|
27
32
|
"client_secret": "",
|
|
28
|
-
"grant_type": ""
|
|
33
|
+
"grant_type": "",
|
|
34
|
+
"sensitive": [],
|
|
35
|
+
"sso": {
|
|
36
|
+
"protocol": "",
|
|
37
|
+
"host": "",
|
|
38
|
+
"port": 0
|
|
39
|
+
},
|
|
40
|
+
"multiStepAuthCalls": [
|
|
41
|
+
{
|
|
42
|
+
"name": "",
|
|
43
|
+
"requestFields": {},
|
|
44
|
+
"responseFields": {},
|
|
45
|
+
"successfullResponseCode": 200
|
|
46
|
+
}
|
|
47
|
+
]
|
|
29
48
|
},
|
|
30
49
|
"healthcheck": {
|
|
31
50
|
"type": "none",
|
|
32
51
|
"frequency": 60000,
|
|
33
|
-
"query_object": {}
|
|
52
|
+
"query_object": {},
|
|
53
|
+
"addlHeaders": {}
|
|
34
54
|
},
|
|
35
55
|
"throttle": {
|
|
36
56
|
"throttle_enabled": false,
|
|
@@ -109,15 +129,15 @@
|
|
|
109
129
|
"headers": {},
|
|
110
130
|
"handleFailure": "ignore",
|
|
111
131
|
"requestFields": {
|
|
112
|
-
"tenantNetworkId": "
|
|
132
|
+
"tenantNetworkId": "networkId"
|
|
113
133
|
},
|
|
134
|
+
"responseDatakey": "",
|
|
114
135
|
"responseFields": {
|
|
115
136
|
"name": "name",
|
|
116
137
|
"ostype": "type",
|
|
117
138
|
"ostypePrefix": "connector-",
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"ipaddress": "id"
|
|
139
|
+
"ipaddress": "id",
|
|
140
|
+
"port": "tenantNetworkId"
|
|
121
141
|
}
|
|
122
142
|
}
|
|
123
143
|
],
|
|
@@ -132,13 +152,14 @@
|
|
|
132
152
|
"requestFields": {
|
|
133
153
|
"tenantNetworkId": "170"
|
|
134
154
|
},
|
|
155
|
+
"responseDatakey": "",
|
|
135
156
|
"responseFields": {
|
|
136
157
|
"name": "name",
|
|
137
158
|
"ostype": "type",
|
|
138
159
|
"ostypePrefix": "connector-",
|
|
139
|
-
"port": "tenantNetworkId",
|
|
140
|
-
"ip": "id",
|
|
141
160
|
"ipaddress": "id",
|
|
161
|
+
"port": "tenantNetworkId",
|
|
162
|
+
"networkId": "tenantNetworkId",
|
|
142
163
|
"connectorId": "id"
|
|
143
164
|
}
|
|
144
165
|
}
|
|
@@ -150,11 +171,12 @@
|
|
|
150
171
|
"query": {},
|
|
151
172
|
"body": {},
|
|
152
173
|
"headers": {},
|
|
174
|
+
"handleFailure": "ignore",
|
|
153
175
|
"requestFields": {
|
|
154
|
-
"tenantNetworkId": "
|
|
176
|
+
"tenantNetworkId": "networkId",
|
|
155
177
|
"connectorId": "connectorId"
|
|
156
178
|
},
|
|
157
|
-
"
|
|
179
|
+
"responseDatakey": "",
|
|
158
180
|
"responseFields": {
|
|
159
181
|
"status": "connectivityStatus",
|
|
160
182
|
"statusValue": "100"
|
|
@@ -168,11 +190,12 @@
|
|
|
168
190
|
"query": {},
|
|
169
191
|
"body": {},
|
|
170
192
|
"headers": {},
|
|
193
|
+
"handleFailure": "ignore",
|
|
171
194
|
"requestFields": {
|
|
172
|
-
"tenantNetworkId": "
|
|
195
|
+
"tenantNetworkId": "networkId",
|
|
173
196
|
"connectorId": "connectorId"
|
|
174
197
|
},
|
|
175
|
-
"
|
|
198
|
+
"responseDatakey": "",
|
|
176
199
|
"responseFields": {}
|
|
177
200
|
}
|
|
178
201
|
],
|
|
@@ -183,13 +206,54 @@
|
|
|
183
206
|
"query": {},
|
|
184
207
|
"body": {},
|
|
185
208
|
"headers": {},
|
|
209
|
+
"handleFailure": "ignore",
|
|
186
210
|
"requestFields": {
|
|
187
211
|
"tenantNetworkId": "170"
|
|
188
212
|
},
|
|
189
|
-
"
|
|
213
|
+
"responseDatakey": "",
|
|
190
214
|
"responseFields": {}
|
|
191
215
|
}
|
|
192
216
|
]
|
|
217
|
+
},
|
|
218
|
+
"cache": {
|
|
219
|
+
"enabled": false,
|
|
220
|
+
"entities": [
|
|
221
|
+
{
|
|
222
|
+
"entityType": "device",
|
|
223
|
+
"frequency": 3600,
|
|
224
|
+
"flushOnFail": false,
|
|
225
|
+
"limit": 1000,
|
|
226
|
+
"retryAttempts": 5,
|
|
227
|
+
"sort": true,
|
|
228
|
+
"populate": [
|
|
229
|
+
{
|
|
230
|
+
"path": "/tenantnetworks/{tenantNetworkId}/connectors",
|
|
231
|
+
"method": "GET",
|
|
232
|
+
"query": {},
|
|
233
|
+
"body": {},
|
|
234
|
+
"headers": {},
|
|
235
|
+
"handleFailure": "ignore",
|
|
236
|
+
"requestFields": {
|
|
237
|
+
"tenantNetworkId": "170"
|
|
238
|
+
},
|
|
239
|
+
"responseDatakey": "",
|
|
240
|
+
"responseFields": {
|
|
241
|
+
"name": "name",
|
|
242
|
+
"type": "type",
|
|
243
|
+
"id": "id",
|
|
244
|
+
"tenantNetworkId": "tenantNetworkId"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"cachedTasks": [
|
|
249
|
+
{
|
|
250
|
+
"name": "",
|
|
251
|
+
"filterField": "",
|
|
252
|
+
"filterLoc": ""
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
]
|
|
193
257
|
}
|
|
194
258
|
},
|
|
195
259
|
"groups": [],
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
/* eslint import/no-dynamic-require: warn */
|
|
8
8
|
/* eslint import/no-unresolved: warn */
|
|
9
9
|
|
|
10
|
-
const mocha = require('mocha');
|
|
11
10
|
const path = require('path');
|
|
12
11
|
const assert = require('assert');
|
|
12
|
+
const mocha = require('mocha');
|
|
13
13
|
const itParam = require('mocha-param');
|
|
14
14
|
|
|
15
15
|
const utils = require('../../utils/tbUtils');
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
/* global describe it context before after */
|
|
4
4
|
/* eslint no-unused-vars: warn */
|
|
5
5
|
|
|
6
|
-
const mocha = require('mocha');
|
|
7
6
|
const assert = require('assert');
|
|
8
|
-
const
|
|
7
|
+
const http = require('http');
|
|
8
|
+
const https = require('https');
|
|
9
|
+
const mocha = require('mocha');
|
|
10
|
+
const ping = require('ping');
|
|
11
|
+
const dnsLookup = require('dns-lookup-promise');
|
|
9
12
|
|
|
10
13
|
let host;
|
|
11
14
|
process.argv.forEach((val) => {
|
|
@@ -16,78 +19,124 @@ process.argv.forEach((val) => {
|
|
|
16
19
|
|
|
17
20
|
describe('[integration] Adapter Test', () => {
|
|
18
21
|
context(`Testing network connection on ${host}`, () => {
|
|
19
|
-
before(() => {
|
|
20
|
-
diagnostics.setTestURL(host);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
22
|
after((done) => {
|
|
24
23
|
done();
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
it('DNS resolve', (done) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
dnsLookup(host)
|
|
28
|
+
.then((addresses) => {
|
|
29
|
+
try {
|
|
30
|
+
assert.ok(addresses.length > 0);
|
|
31
|
+
done();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
done(error);
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
done(err);
|
|
38
|
+
});
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
it('Responds to ping', (done) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
ping.promise.probe(host)
|
|
43
|
+
.then((result) => {
|
|
44
|
+
try {
|
|
45
|
+
assert.ok(result.alive);
|
|
46
|
+
done();
|
|
47
|
+
} catch (error) {
|
|
48
|
+
done(error);
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
.catch((err) => {
|
|
52
|
+
done(err);
|
|
53
|
+
});
|
|
47
54
|
});
|
|
48
55
|
|
|
49
56
|
it('Support HTTP on port 80', (done) => {
|
|
50
|
-
|
|
57
|
+
const requestOptions = {
|
|
58
|
+
host,
|
|
59
|
+
port: 80,
|
|
60
|
+
method: 'HEAD'
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const req = http.request(requestOptions, (res) => {
|
|
51
64
|
try {
|
|
52
|
-
assert.
|
|
65
|
+
assert.ok(res.statusCode >= 200 && res.statusCode < 400);
|
|
53
66
|
done();
|
|
54
67
|
} catch (error) {
|
|
55
68
|
done(error);
|
|
56
69
|
}
|
|
57
70
|
});
|
|
71
|
+
|
|
72
|
+
req.on('error', (err) => {
|
|
73
|
+
done(err);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
req.end();
|
|
58
77
|
});
|
|
59
78
|
|
|
60
79
|
it('Support HTTPS on port 443', (done) => {
|
|
61
|
-
|
|
80
|
+
const requestOptions = {
|
|
81
|
+
host,
|
|
82
|
+
port: 443,
|
|
83
|
+
method: 'HEAD'
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const req = https.request(requestOptions, (res) => {
|
|
62
87
|
try {
|
|
63
|
-
assert.
|
|
88
|
+
assert.ok(res.statusCode >= 200 && res.statusCode < 400);
|
|
64
89
|
done();
|
|
65
90
|
} catch (error) {
|
|
66
91
|
done(error);
|
|
67
92
|
}
|
|
68
93
|
});
|
|
94
|
+
|
|
95
|
+
req.on('error', (err) => {
|
|
96
|
+
done(err);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
req.end();
|
|
69
100
|
});
|
|
70
101
|
|
|
71
102
|
it('Support IPv4', (done) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
103
|
+
const options = {
|
|
104
|
+
family: 4,
|
|
105
|
+
hints: dnsLookup.ADDRCONFIG
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
dnsLookup.lookup(host, options)
|
|
109
|
+
.then((address, family) => {
|
|
110
|
+
try {
|
|
111
|
+
assert.ok(address !== null && family === 4);
|
|
112
|
+
done();
|
|
113
|
+
} catch (error) {
|
|
114
|
+
done(error);
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
.catch((err) => {
|
|
118
|
+
done(err);
|
|
119
|
+
});
|
|
80
120
|
});
|
|
81
121
|
|
|
82
122
|
it('Support IPv6', (done) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
123
|
+
const options = {
|
|
124
|
+
family: 6,
|
|
125
|
+
hints: dnsLookup.ADDRCONFIG
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
dnsLookup.lookup(host, options)
|
|
129
|
+
.then((address, family) => {
|
|
130
|
+
try {
|
|
131
|
+
assert.ok(address !== null && family === 6);
|
|
132
|
+
done();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
done(error);
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
.catch((err) => {
|
|
138
|
+
done(err);
|
|
139
|
+
});
|
|
91
140
|
});
|
|
92
141
|
});
|
|
93
142
|
});
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
// include required items for testing & logging
|
|
10
10
|
const assert = require('assert');
|
|
11
11
|
const fs = require('fs');
|
|
12
|
-
const mocha = require('mocha');
|
|
13
12
|
const path = require('path');
|
|
13
|
+
const util = require('util');
|
|
14
|
+
const mocha = require('mocha');
|
|
14
15
|
const winston = require('winston');
|
|
15
16
|
const { expect } = require('chai');
|
|
16
17
|
const { use } = require('chai');
|
|
17
18
|
const td = require('testdouble');
|
|
18
|
-
const util = require('util');
|
|
19
19
|
|
|
20
20
|
const anything = td.matchers.anything();
|
|
21
21
|
|
|
@@ -335,6 +335,134 @@ describe('[integration] Alkira Adapter Test', () => {
|
|
|
335
335
|
}).timeout(attemptTimeout);
|
|
336
336
|
});
|
|
337
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-alkira-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-alkira-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
|
+
});
|
|
338
466
|
/*
|
|
339
467
|
-----------------------------------------------------------------------
|
|
340
468
|
-----------------------------------------------------------------------
|