@itentialopensource/adapter-selector_ai 0.1.1

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.
Files changed (117) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +19 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +211 -0
  6. package/CALLS.md +405 -0
  7. package/CODE_OF_CONDUCT.md +43 -0
  8. package/CONTRIBUTING.md +13 -0
  9. package/ENHANCE.md +69 -0
  10. package/LICENSE +201 -0
  11. package/PROPERTIES.md +661 -0
  12. package/README.md +344 -0
  13. package/SUMMARY.md +9 -0
  14. package/SYSTEMINFO.md +14 -0
  15. package/TAB1.md +8 -0
  16. package/TAB2.md +314 -0
  17. package/TROUBLESHOOT.md +56 -0
  18. package/UTILITIES.md +473 -0
  19. package/adapter.js +4039 -0
  20. package/adapterBase.js +1488 -0
  21. package/entities/.generic/action.json +214 -0
  22. package/entities/.generic/schema.json +28 -0
  23. package/entities/.system/action.json +50 -0
  24. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  25. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  26. package/entities/.system/schema.json +19 -0
  27. package/entities/.system/schemaTokenReq.json +53 -0
  28. package/entities/.system/schemaTokenResp.json +53 -0
  29. package/entities/InventorySchemaCreation/action.json +24 -0
  30. package/entities/InventorySchemaCreation/schema.json +19 -0
  31. package/entities/InventorySchemaDelete/action.json +24 -0
  32. package/entities/InventorySchemaDelete/schema.json +19 -0
  33. package/entities/InventorySchemaDeleteType/action.json +24 -0
  34. package/entities/InventorySchemaDeleteType/schema.json +19 -0
  35. package/entities/InventorySchemaFileDownload/action.json +24 -0
  36. package/entities/InventorySchemaFileDownload/schema.json +19 -0
  37. package/entities/InventorySchemaFileUpload/action.json +24 -0
  38. package/entities/InventorySchemaFileUpload/schema.json +19 -0
  39. package/entities/InventorySchemaUpdate/action.json +24 -0
  40. package/entities/InventorySchemaUpdate/schema.json +19 -0
  41. package/entities/InventoryV2SchemaDeleteAll/action.json +24 -0
  42. package/entities/InventoryV2SchemaDeleteAll/schema.json +19 -0
  43. package/entities/InventoryV2SchemaDeleteType/action.json +24 -0
  44. package/entities/InventoryV2SchemaDeleteType/schema.json +19 -0
  45. package/entities/InventoryV2SchemaUpdate/action.json +24 -0
  46. package/entities/InventoryV2SchemaUpdate/schema.json +19 -0
  47. package/entities/InventoryV2SchemaUpload/action.json +24 -0
  48. package/entities/InventoryV2SchemaUpload/schema.json +19 -0
  49. package/entities/MetastoreInventoryBulkDataUpload/action.json +24 -0
  50. package/entities/MetastoreInventoryBulkDataUpload/schema.json +19 -0
  51. package/entities/MetastoreInventoryCSVDataUpload/action.json +24 -0
  52. package/entities/MetastoreInventoryCSVDataUpload/schema.json +19 -0
  53. package/entities/MetastoreInventoryCsvFileExport/action.json +25 -0
  54. package/entities/MetastoreInventoryCsvFileExport/schema.json +19 -0
  55. package/entities/MetastoreInventoryDataDelete/action.json +24 -0
  56. package/entities/MetastoreInventoryDataDelete/schema.json +19 -0
  57. package/entities/MetastoreInventoryDataDownload/action.json +46 -0
  58. package/entities/MetastoreInventoryDataDownload/schema.json +20 -0
  59. package/entities/MetastoreInventoryDataEdit/action.json +24 -0
  60. package/entities/MetastoreInventoryDataEdit/schema.json +19 -0
  61. package/entities/MetastoreInventoryDataUpload/action.json +24 -0
  62. package/entities/MetastoreInventoryDataUpload/schema.json +19 -0
  63. package/entities/MetastoreInventoryFilesExport/action.json +24 -0
  64. package/entities/MetastoreInventoryFilesExport/schema.json +19 -0
  65. package/entities/MetastoreInventoryFilesImport/action.json +24 -0
  66. package/entities/MetastoreInventoryFilesImport/schema.json +30 -0
  67. package/entities/MetastoreInventoryItems/action.json +25 -0
  68. package/entities/MetastoreInventoryItems/schema.json +19 -0
  69. package/entities/MetastoreInventoryNameDelete/action.json +24 -0
  70. package/entities/MetastoreInventoryNameDelete/schema.json +19 -0
  71. package/entities/MetastoreInventoryNameUpdate/action.json +24 -0
  72. package/entities/MetastoreInventoryNameUpdate/schema.json +19 -0
  73. package/entities/MetastoreInventoryNameUpload/action.json +24 -0
  74. package/entities/MetastoreInventoryNameUpload/schema.json +19 -0
  75. package/entities/MetastoreInventoryNamesDownload/action.json +25 -0
  76. package/entities/MetastoreInventoryNamesDownload/schema.json +19 -0
  77. package/entities/MetastoreInventorySchemaGet/action.json +25 -0
  78. package/entities/MetastoreInventorySchemaGet/schema.json +19 -0
  79. package/entities/MetastoreInventorySystem/action.json +130 -0
  80. package/entities/MetastoreInventorySystem/schema.json +24 -0
  81. package/entities/MetastoreV2InventorySchemaGet/action.json +25 -0
  82. package/entities/MetastoreV2InventorySchemaGet/schema.json +19 -0
  83. package/error.json +190 -0
  84. package/metadata.json +58 -0
  85. package/package.json +77 -0
  86. package/pronghorn.json +2508 -0
  87. package/propertiesDecorators.json +14 -0
  88. package/propertiesSchema.json +1635 -0
  89. package/report/adapterInfo.json +10 -0
  90. package/report/auto-adapter-openapi.json +1330 -0
  91. package/report/creationReport.json +765 -0
  92. package/report/metastore-inventory-manager.yaml-OpenApi3Json.json +2366 -0
  93. package/sampleProperties.json +260 -0
  94. package/test/integration/adapterTestBasicGet.js +117 -0
  95. package/test/integration/adapterTestConnectivity.js +117 -0
  96. package/test/integration/adapterTestIntegration.js +1295 -0
  97. package/test/unit/adapterBaseTestUnit.js +1626 -0
  98. package/test/unit/adapterTestUnit.js +2288 -0
  99. package/utils/adapterInfo.js +156 -0
  100. package/utils/argParser.js +44 -0
  101. package/utils/checkMigrate.js +102 -0
  102. package/utils/entitiesToDB.js +190 -0
  103. package/utils/findPath.js +74 -0
  104. package/utils/logger.js +26 -0
  105. package/utils/methodDocumentor.js +273 -0
  106. package/utils/modify.js +153 -0
  107. package/utils/mongoDbConnection.js +79 -0
  108. package/utils/mongoUtils.js +162 -0
  109. package/utils/pre-commit.sh +32 -0
  110. package/utils/removeHooks.js +20 -0
  111. package/utils/setup.js +33 -0
  112. package/utils/taskMover.js +308 -0
  113. package/utils/tbScript.js +103 -0
  114. package/utils/tbUtils.js +347 -0
  115. package/utils/testRunner.js +298 -0
  116. package/utils/troubleshootingAdapter.js +177 -0
  117. package/utils/updateAdapterConfig.js +158 -0
@@ -0,0 +1,2288 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ // Set globals
4
+ /* global describe it log pronghornProps */
5
+ /* eslint global-require: warn */
6
+ /* eslint no-unused-vars: warn */
7
+ /* eslint import/no-dynamic-require:warn */
8
+
9
+ // include required items for testing & logging
10
+ const assert = require('assert');
11
+ const path = require('path');
12
+ const util = require('util');
13
+ const execute = require('child_process').execSync;
14
+ const fs = require('fs-extra');
15
+ const mocha = require('mocha');
16
+ const winston = require('winston');
17
+ const { expect } = require('chai');
18
+ const { use } = require('chai');
19
+ const td = require('testdouble');
20
+ const Ajv = require('ajv');
21
+ const log = require('../../utils/logger');
22
+
23
+ const ajv = new Ajv({ strictSchema: false, allErrors: true, allowUnionTypes: true });
24
+ const anything = td.matchers.anything();
25
+ const isRapidFail = false;
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;
35
+
36
+ // these variables can be changed to run in integrated mode so easier to set them here
37
+ // always check these in with bogus data!!!
38
+ samProps.stub = true;
39
+
40
+ // uncomment if connecting
41
+ // samProps.host = 'replace.hostorip.here';
42
+ // samProps.authentication.username = 'username';
43
+ // samProps.authentication.password = 'password';
44
+ // samProps.authentication.token = 'password';
45
+ // samProps.protocol = 'http';
46
+ // samProps.port = 80;
47
+ // samProps.ssl.enabled = false;
48
+ // samProps.ssl.accept_invalid_cert = false;
49
+
50
+ samProps.request.attempt_timeout = 1200000;
51
+ const attemptTimeout = samProps.request.attempt_timeout;
52
+ const { stub } = samProps;
53
+
54
+ // these are the adapter properties. You generally should not need to alter
55
+ // any of these after they are initially set up
56
+ global.pronghornProps = {
57
+ pathProps: {
58
+ encrypted: false
59
+ },
60
+ adapterProps: {
61
+ adapters: [{
62
+ id: 'Test-selector_ai',
63
+ type: 'SelectorAi',
64
+ properties: samProps
65
+ }]
66
+ }
67
+ };
68
+
69
+ global.$HOME = `${__dirname}/../..`;
70
+
71
+ /**
72
+ * Runs the error asserts for the test
73
+ */
74
+ function runErrorAsserts(data, error, code, origin, displayStr) {
75
+ assert.equal(null, data);
76
+ assert.notEqual(undefined, error);
77
+ assert.notEqual(null, error);
78
+ assert.notEqual(undefined, error.IAPerror);
79
+ assert.notEqual(null, error.IAPerror);
80
+ assert.notEqual(undefined, error.IAPerror.displayString);
81
+ assert.notEqual(null, error.IAPerror.displayString);
82
+ assert.equal(code, error.icode);
83
+ assert.equal(origin, error.IAPerror.origin);
84
+ assert.equal(displayStr, error.IAPerror.displayString);
85
+ }
86
+
87
+ // require the adapter that we are going to be using
88
+ const SelectorAi = require('../../adapter');
89
+
90
+ // delete the .DS_Store directory in entities -- otherwise this will cause errors
91
+ const dirPath = path.join(__dirname, '../../entities/.DS_Store');
92
+ if (fs.existsSync(dirPath)) {
93
+ try {
94
+ fs.removeSync(dirPath);
95
+ console.log('.DS_Store deleted');
96
+ } catch (e) {
97
+ console.log('Error when deleting .DS_Store:', e);
98
+ }
99
+ }
100
+
101
+ // begin the testing - these should be pretty well defined between the describe and the it!
102
+ describe('[unit] Selector_ai Adapter Test', () => {
103
+ describe('SelectorAi Class Tests', () => {
104
+ const a = new SelectorAi(
105
+ pronghornProps.adapterProps.adapters[0].id,
106
+ pronghornProps.adapterProps.adapters[0].properties
107
+ );
108
+
109
+ if (isRapidFail) {
110
+ const state = {};
111
+ state.passed = true;
112
+
113
+ mocha.afterEach(function x() {
114
+ state.passed = state.passed
115
+ && (this.currentTest.state === 'passed');
116
+ });
117
+ mocha.beforeEach(function x() {
118
+ if (!state.passed) {
119
+ return this.currentTest.skip();
120
+ }
121
+ return true;
122
+ });
123
+ }
124
+
125
+ describe('#class instance created', () => {
126
+ it('should be a class with properties', (done) => {
127
+ try {
128
+ assert.notEqual(null, a);
129
+ assert.notEqual(undefined, a);
130
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
131
+ assert.equal(checkId, a.id);
132
+ assert.notEqual(null, a.allProps);
133
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
134
+ assert.equal(check, a.healthcheckType);
135
+ done();
136
+ } catch (error) {
137
+ log.error(`Test Failure: ${error}`);
138
+ done(error);
139
+ }
140
+ }).timeout(attemptTimeout);
141
+ });
142
+
143
+ describe('adapterBase.js', () => {
144
+ it('should have an adapterBase.js', (done) => {
145
+ try {
146
+ fs.exists('adapterBase.js', (val) => {
147
+ assert.equal(true, val);
148
+ done();
149
+ });
150
+ } catch (error) {
151
+ log.error(`Test Failure: ${error}`);
152
+ done(error);
153
+ }
154
+ });
155
+ });
156
+
157
+ let wffunctions = [];
158
+ describe('#iapGetAdapterWorkflowFunctions', () => {
159
+ it('should retrieve workflow functions', (done) => {
160
+ try {
161
+ wffunctions = a.iapGetAdapterWorkflowFunctions([]);
162
+
163
+ try {
164
+ assert.notEqual(0, wffunctions.length);
165
+ done();
166
+ } catch (err) {
167
+ log.error(`Test Failure: ${err}`);
168
+ done(err);
169
+ }
170
+ } catch (error) {
171
+ log.error(`Adapter Exception: ${error}`);
172
+ done(error);
173
+ }
174
+ }).timeout(attemptTimeout);
175
+ });
176
+
177
+ describe('package.json', () => {
178
+ it('should have a package.json', (done) => {
179
+ try {
180
+ fs.exists('package.json', (val) => {
181
+ assert.equal(true, val);
182
+ done();
183
+ });
184
+ } catch (error) {
185
+ log.error(`Test Failure: ${error}`);
186
+ done(error);
187
+ }
188
+ });
189
+ it('package.json should be validated', (done) => {
190
+ try {
191
+ const packageDotJson = require('../../package.json');
192
+ // Define the JSON schema for package.json
193
+ const packageJsonSchema = {
194
+ type: 'object',
195
+ properties: {
196
+ name: { type: 'string' },
197
+ version: { type: 'string' }
198
+ // May need to add more properties as needed
199
+ },
200
+ required: ['name', 'version']
201
+ };
202
+ const validate = ajv.compile(packageJsonSchema);
203
+ const isValid = validate(packageDotJson);
204
+
205
+ if (isValid === false) {
206
+ log.error('The package.json contains errors');
207
+ assert.equal(true, isValid);
208
+ } else {
209
+ assert.equal(true, isValid);
210
+ }
211
+
212
+ done();
213
+ } catch (error) {
214
+ log.error(`Test Failure: ${error}`);
215
+ done(error);
216
+ }
217
+ });
218
+ it('package.json standard fields should be customized', (done) => {
219
+ try {
220
+ const packageDotJson = require('../../package.json');
221
+ assert.notEqual(-1, packageDotJson.name.indexOf('selector_ai'));
222
+ assert.notEqual(undefined, packageDotJson.version);
223
+ assert.notEqual(null, packageDotJson.version);
224
+ assert.notEqual('', packageDotJson.version);
225
+ assert.notEqual(undefined, packageDotJson.description);
226
+ assert.notEqual(null, packageDotJson.description);
227
+ assert.notEqual('', packageDotJson.description);
228
+ assert.equal('adapter.js', packageDotJson.main);
229
+ assert.notEqual(undefined, packageDotJson.wizardVersion);
230
+ assert.notEqual(null, packageDotJson.wizardVersion);
231
+ assert.notEqual('', packageDotJson.wizardVersion);
232
+ assert.notEqual(undefined, packageDotJson.engineVersion);
233
+ assert.notEqual(null, packageDotJson.engineVersion);
234
+ assert.notEqual('', packageDotJson.engineVersion);
235
+ assert.equal('http', packageDotJson.adapterType);
236
+ done();
237
+ } catch (error) {
238
+ log.error(`Test Failure: ${error}`);
239
+ done(error);
240
+ }
241
+ });
242
+ it('package.json proper scripts should be provided', (done) => {
243
+ try {
244
+ const packageDotJson = require('../../package.json');
245
+ assert.notEqual(undefined, packageDotJson.scripts);
246
+ assert.notEqual(null, packageDotJson.scripts);
247
+ assert.notEqual('', packageDotJson.scripts);
248
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
249
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
250
+ assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
251
+ assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
252
+ assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
253
+ assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
254
+ done();
255
+ } catch (error) {
256
+ log.error(`Test Failure: ${error}`);
257
+ done(error);
258
+ }
259
+ });
260
+ it('package.json proper directories should be provided', (done) => {
261
+ try {
262
+ const packageDotJson = require('../../package.json');
263
+ assert.notEqual(undefined, packageDotJson.repository);
264
+ assert.notEqual(null, packageDotJson.repository);
265
+ assert.notEqual('', packageDotJson.repository);
266
+ done();
267
+ } catch (error) {
268
+ log.error(`Test Failure: ${error}`);
269
+ done(error);
270
+ }
271
+ });
272
+ it('package.json proper dependencies should be provided', (done) => {
273
+ try {
274
+ const packageDotJson = require('../../package.json');
275
+ assert.notEqual(undefined, packageDotJson.dependencies);
276
+ assert.notEqual(null, packageDotJson.dependencies);
277
+ assert.notEqual('', packageDotJson.dependencies);
278
+ assert.equal('8.17.1', packageDotJson.dependencies.ajv);
279
+ assert.equal('1.9.0', packageDotJson.dependencies.axios);
280
+ assert.equal('11.1.0', packageDotJson.dependencies.commander);
281
+ assert.equal('11.3.0', packageDotJson.dependencies['fs-extra']);
282
+ assert.equal('10.8.2', packageDotJson.dependencies.mocha);
283
+ assert.equal('2.0.1', packageDotJson.dependencies['mocha-param']);
284
+ assert.equal('0.4.4', packageDotJson.dependencies.ping);
285
+ assert.equal('1.4.10', packageDotJson.dependencies['readline-sync']);
286
+ assert.equal('7.7.2', packageDotJson.dependencies.semver);
287
+ assert.equal('3.17.0', packageDotJson.dependencies.winston);
288
+ done();
289
+ } catch (error) {
290
+ log.error(`Test Failure: ${error}`);
291
+ done(error);
292
+ }
293
+ });
294
+ it('package.json proper dev dependencies should be provided', (done) => {
295
+ try {
296
+ const packageDotJson = require('../../package.json');
297
+ assert.notEqual(undefined, packageDotJson.devDependencies);
298
+ assert.notEqual(null, packageDotJson.devDependencies);
299
+ assert.notEqual('', packageDotJson.devDependencies);
300
+ assert.equal('4.5.0', packageDotJson.devDependencies.chai);
301
+ assert.equal('8.57.0', packageDotJson.devDependencies.eslint);
302
+ assert.equal('15.0.0', packageDotJson.devDependencies['eslint-config-airbnb-base']);
303
+ assert.equal('2.31.0', packageDotJson.devDependencies['eslint-plugin-import']);
304
+ assert.equal('3.1.0', packageDotJson.devDependencies['eslint-plugin-json']);
305
+ assert.equal('3.18.0', packageDotJson.devDependencies.testdouble);
306
+ done();
307
+ } catch (error) {
308
+ log.error(`Test Failure: ${error}`);
309
+ done(error);
310
+ }
311
+ });
312
+ });
313
+
314
+ describe('pronghorn.json', () => {
315
+ it('should have a pronghorn.json', (done) => {
316
+ try {
317
+ fs.exists('pronghorn.json', (val) => {
318
+ assert.equal(true, val);
319
+ done();
320
+ });
321
+ } catch (error) {
322
+ log.error(`Test Failure: ${error}`);
323
+ done(error);
324
+ }
325
+ });
326
+ it('pronghorn.json should be customized', (done) => {
327
+ try {
328
+ const pronghornDotJson = require('../../pronghorn.json');
329
+ assert.notEqual(-1, pronghornDotJson.id.indexOf('selector_ai'));
330
+ assert.equal('Adapter', pronghornDotJson.type);
331
+ assert.equal('SelectorAi', pronghornDotJson.export);
332
+ assert.equal('Selector_ai', pronghornDotJson.title);
333
+ assert.equal('adapter.js', pronghornDotJson.src);
334
+ done();
335
+ } catch (error) {
336
+ log.error(`Test Failure: ${error}`);
337
+ done(error);
338
+ }
339
+ });
340
+ it('pronghorn.json should contain generic adapter methods', (done) => {
341
+ try {
342
+ const pronghornDotJson = require('../../pronghorn.json');
343
+ assert.notEqual(undefined, pronghornDotJson.methods);
344
+ assert.notEqual(null, pronghornDotJson.methods);
345
+ assert.notEqual('', pronghornDotJson.methods);
346
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
347
+ assert.notEqual(0, pronghornDotJson.methods.length);
348
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
349
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapSuspendAdapter'));
350
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
351
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
352
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
353
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
354
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
355
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
356
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
357
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapMoveAdapterEntitiesToDB'));
358
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapDeactivateTasks'));
359
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapActivateTasks'));
360
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapPopulateEntityCache'));
361
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRetrieveEntitiesCache'));
362
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevice'));
363
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevicesFiltered'));
364
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'isAlive'));
365
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getConfig'));
366
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetDeviceCount'));
367
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapExpandedGenericAdapterRequest'));
368
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
369
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
370
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterLint'));
371
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterTests'));
372
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterInventory'));
373
+ done();
374
+ } catch (error) {
375
+ log.error(`Test Failure: ${error}`);
376
+ done(error);
377
+ }
378
+ });
379
+ it('pronghorn.json should only expose workflow functions', (done) => {
380
+ try {
381
+ const pronghornDotJson = require('../../pronghorn.json');
382
+
383
+ for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
384
+ let found = false;
385
+ let paramissue = false;
386
+
387
+ for (let w = 0; w < wffunctions.length; w += 1) {
388
+ if (pronghornDotJson.methods[m].name === wffunctions[w]) {
389
+ found = true;
390
+ const methLine = execute(`grep " ${wffunctions[w]}(" adapter.js | grep "callback) {"`).toString();
391
+ let wfparams = [];
392
+
393
+ if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
394
+ const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
395
+ wfparams = temp.split(',');
396
+
397
+ for (let t = 0; t < wfparams.length; t += 1) {
398
+ // remove default value from the parameter name
399
+ wfparams[t] = wfparams[t].substring(0, wfparams[t].search(/=/) > 0 ? wfparams[t].search(/#|\?|=/) : wfparams[t].length);
400
+ // remove spaces
401
+ wfparams[t] = wfparams[t].trim();
402
+
403
+ if (wfparams[t] === 'callback') {
404
+ wfparams.splice(t, 1);
405
+ }
406
+ }
407
+ }
408
+
409
+ // if there are inputs defined but not on the method line
410
+ if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
411
+ && pronghornDotJson.methods[m].input.length > 0)) {
412
+ paramissue = true;
413
+ } else if (wfparams.length > 0 && (!pronghornDotJson.methods[m].input
414
+ || pronghornDotJson.methods[m].input.length === 0)) {
415
+ // if there are no inputs defined but there are on the method line
416
+ paramissue = true;
417
+ } else {
418
+ for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
419
+ let pfound = false;
420
+ for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
421
+ if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
422
+ pfound = true;
423
+ }
424
+ }
425
+
426
+ if (!pfound) {
427
+ paramissue = true;
428
+ }
429
+ }
430
+ for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
431
+ let pfound = false;
432
+ for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
433
+ if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
434
+ pfound = true;
435
+ }
436
+ }
437
+
438
+ if (!pfound) {
439
+ paramissue = true;
440
+ }
441
+ }
442
+ }
443
+
444
+ break;
445
+ }
446
+ }
447
+
448
+ if (!found) {
449
+ // this is the reason to go through both loops - log which ones are not found so
450
+ // they can be worked
451
+ log.error(`${pronghornDotJson.methods[m].name} not found in workflow functions`);
452
+ }
453
+ if (paramissue) {
454
+ // this is the reason to go through both loops - log which ones are not found so
455
+ // they can be worked
456
+ log.error(`${pronghornDotJson.methods[m].name} has a parameter mismatch`);
457
+ }
458
+ assert.equal(true, found);
459
+ assert.equal(false, paramissue);
460
+ }
461
+ done();
462
+ } catch (error) {
463
+ log.error(`Adapter Exception: ${error}`);
464
+ done(error);
465
+ }
466
+ }).timeout(attemptTimeout);
467
+ it('pronghorn.json should expose all workflow functions', (done) => {
468
+ try {
469
+ const pronghornDotJson = require('../../pronghorn.json');
470
+ for (let w = 0; w < wffunctions.length; w += 1) {
471
+ let found = false;
472
+
473
+ for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
474
+ if (pronghornDotJson.methods[m].name === wffunctions[w]) {
475
+ found = true;
476
+ break;
477
+ }
478
+ }
479
+
480
+ if (!found) {
481
+ // this is the reason to go through both loops - log which ones are not found so
482
+ // they can be worked
483
+ log.error(`${wffunctions[w]} not found in pronghorn.json`);
484
+ }
485
+ assert.equal(true, found);
486
+ }
487
+ done();
488
+ } catch (error) {
489
+ log.error(`Adapter Exception: ${error}`);
490
+ done(error);
491
+ }
492
+ });
493
+ it('pronghorn.json verify input/output schema objects', (done) => {
494
+ const verifySchema = (methodName, schema) => {
495
+ try {
496
+ ajv.compile(schema);
497
+ } catch (error) {
498
+ const errorMessage = `Invalid schema found in '${methodName}' method.
499
+ Schema => ${JSON.stringify(schema)}.
500
+ Details => ${error.message}`;
501
+ throw new Error(errorMessage);
502
+ }
503
+ };
504
+
505
+ try {
506
+ const pronghornDotJson = require('../../pronghorn.json');
507
+ const { methods } = pronghornDotJson;
508
+ for (let i = 0; i < methods.length; i += 1) {
509
+ for (let j = 0; j < methods[i].input.length; j += 1) {
510
+ const inputSchema = methods[i].input[j].schema;
511
+ if (inputSchema) {
512
+ verifySchema(methods[i].name, inputSchema);
513
+ }
514
+ }
515
+ const outputSchema = methods[i].output.schema;
516
+ if (outputSchema) {
517
+ verifySchema(methods[i].name, outputSchema);
518
+ }
519
+ }
520
+ done();
521
+ } catch (error) {
522
+ log.error(`Adapter Exception: ${error}`);
523
+ done(error);
524
+ }
525
+ }).timeout(attemptTimeout);
526
+ });
527
+
528
+ describe('propertiesSchema.json', () => {
529
+ it('should have a propertiesSchema.json', (done) => {
530
+ try {
531
+ fs.exists('propertiesSchema.json', (val) => {
532
+ assert.equal(true, val);
533
+ done();
534
+ });
535
+ } catch (error) {
536
+ log.error(`Test Failure: ${error}`);
537
+ done(error);
538
+ }
539
+ });
540
+ it('propertiesSchema.json should be customized', (done) => {
541
+ try {
542
+ const propertiesDotJson = require('../../propertiesSchema.json');
543
+ assert.equal('adapter-selector_ai', propertiesDotJson.$id);
544
+ assert.equal('object', propertiesDotJson.type);
545
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
546
+ done();
547
+ } catch (error) {
548
+ log.error(`Test Failure: ${error}`);
549
+ done(error);
550
+ }
551
+ });
552
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
553
+ try {
554
+ const propertiesDotJson = require('../../propertiesSchema.json');
555
+ assert.notEqual(undefined, propertiesDotJson.properties);
556
+ assert.notEqual(null, propertiesDotJson.properties);
557
+ assert.notEqual('', propertiesDotJson.properties);
558
+ assert.equal('string', propertiesDotJson.properties.host.type);
559
+ assert.equal('integer', propertiesDotJson.properties.port.type);
560
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
561
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
562
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
563
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
564
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
565
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
566
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
567
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
568
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
569
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
570
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
571
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
572
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
573
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
574
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
575
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
576
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
577
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
578
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
579
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
580
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
581
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
582
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
583
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
584
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
585
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
586
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
587
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
588
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
589
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
590
+ assert.equal('string', propertiesDotJson.properties.version.type);
591
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
592
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
593
+ assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
594
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
595
+ assert.notEqual(undefined, propertiesDotJson.definitions);
596
+ assert.notEqual(null, propertiesDotJson.definitions);
597
+ assert.notEqual('', propertiesDotJson.definitions);
598
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
599
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
600
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
601
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
602
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
603
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
604
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
605
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
606
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
607
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
608
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
609
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
610
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
611
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
612
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
613
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
614
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
615
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
616
+ assert.notEqual(null, propertiesDotJson.definitions.request);
617
+ assert.notEqual('', propertiesDotJson.definitions.request);
618
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
619
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
620
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
621
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
622
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
623
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
624
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
625
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
626
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
627
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
628
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
629
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
630
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
631
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
632
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
633
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
634
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
635
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
636
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
637
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
638
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
639
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
640
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
641
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
642
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
643
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
644
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
645
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
646
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
647
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
648
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
649
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
650
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
651
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
652
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
653
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
654
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
655
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
656
+ assert.notEqual('', propertiesDotJson.definitions.devicebroker);
657
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
658
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
659
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
660
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
661
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
662
+ done();
663
+ } catch (error) {
664
+ log.error(`Test Failure: ${error}`);
665
+ done(error);
666
+ }
667
+ });
668
+ });
669
+
670
+ describe('error.json', () => {
671
+ it('should have an error.json', (done) => {
672
+ try {
673
+ fs.exists('error.json', (val) => {
674
+ assert.equal(true, val);
675
+ done();
676
+ });
677
+ } catch (error) {
678
+ log.error(`Test Failure: ${error}`);
679
+ done(error);
680
+ }
681
+ });
682
+ it('error.json should have standard adapter errors', (done) => {
683
+ try {
684
+ const errorDotJson = require('../../error.json');
685
+ assert.notEqual(undefined, errorDotJson.errors);
686
+ assert.notEqual(null, errorDotJson.errors);
687
+ assert.notEqual('', errorDotJson.errors);
688
+ assert.equal(true, Array.isArray(errorDotJson.errors));
689
+ assert.notEqual(0, errorDotJson.errors.length);
690
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
691
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
692
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
693
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
694
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
695
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
696
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
697
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
698
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
699
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
700
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
701
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
702
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
703
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
704
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
705
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
706
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
707
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
708
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
709
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
710
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
711
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
712
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
713
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
714
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
715
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
716
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
717
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
718
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
719
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
720
+ done();
721
+ } catch (error) {
722
+ log.error(`Test Failure: ${error}`);
723
+ done(error);
724
+ }
725
+ });
726
+ });
727
+
728
+ describe('sampleProperties.json', () => {
729
+ it('should have a sampleProperties.json', (done) => {
730
+ try {
731
+ fs.exists('sampleProperties.json', (val) => {
732
+ assert.equal(true, val);
733
+ done();
734
+ });
735
+ } catch (error) {
736
+ log.error(`Test Failure: ${error}`);
737
+ done(error);
738
+ }
739
+ });
740
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
741
+ try {
742
+ const sampleDotJson = require('../../sampleProperties.json');
743
+ assert.notEqual(-1, sampleDotJson.id.indexOf('selector_ai'));
744
+ assert.equal('SelectorAi', sampleDotJson.type);
745
+ assert.notEqual(undefined, sampleDotJson.properties);
746
+ assert.notEqual(null, sampleDotJson.properties);
747
+ assert.notEqual('', sampleDotJson.properties);
748
+ assert.notEqual(undefined, sampleDotJson.properties.host);
749
+ assert.notEqual(undefined, sampleDotJson.properties.port);
750
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
751
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
752
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
753
+ assert.notEqual(null, sampleDotJson.properties.authentication);
754
+ assert.notEqual('', sampleDotJson.properties.authentication);
755
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
756
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
757
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
758
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
759
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
760
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
761
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
762
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
763
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
764
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
765
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
766
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
767
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
768
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
769
+ assert.notEqual(null, sampleDotJson.properties.ssl);
770
+ assert.notEqual('', sampleDotJson.properties.ssl);
771
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
772
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
773
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
774
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
775
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
776
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
777
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
778
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
779
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
780
+ assert.notEqual(undefined, sampleDotJson.properties.version);
781
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
782
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
783
+ assert.notEqual(undefined, sampleDotJson.properties.encode_queryvars);
784
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
785
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
786
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
787
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
788
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
789
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
790
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
791
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
792
+ assert.notEqual(null, sampleDotJson.properties.throttle);
793
+ assert.notEqual('', sampleDotJson.properties.throttle);
794
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
795
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
796
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
797
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
798
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
799
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
800
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
801
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
802
+ assert.notEqual(undefined, sampleDotJson.properties.request);
803
+ assert.notEqual(null, sampleDotJson.properties.request);
804
+ assert.notEqual('', sampleDotJson.properties.request);
805
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
806
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
807
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
808
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
809
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
810
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
811
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
812
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
813
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
814
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
815
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
816
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
817
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
818
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
819
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
820
+ assert.notEqual(null, sampleDotJson.properties.proxy);
821
+ assert.notEqual('', sampleDotJson.properties.proxy);
822
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
823
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
824
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
825
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
826
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
827
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
828
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
829
+ assert.notEqual(null, sampleDotJson.properties.mongo);
830
+ assert.notEqual('', sampleDotJson.properties.mongo);
831
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
832
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
833
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
834
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
835
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
836
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
837
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
838
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
839
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
840
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
841
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
842
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
843
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker);
844
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevice);
845
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevicesFiltered);
846
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.isAlive);
847
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getConfig);
848
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getCount);
849
+ assert.notEqual(undefined, sampleDotJson.properties.cache);
850
+ assert.notEqual(undefined, sampleDotJson.properties.cache.entities);
851
+ done();
852
+ } catch (error) {
853
+ log.error(`Test Failure: ${error}`);
854
+ done(error);
855
+ }
856
+ });
857
+ });
858
+
859
+ describe('#checkProperties', () => {
860
+ it('should have a checkProperties function', (done) => {
861
+ try {
862
+ assert.equal(true, typeof a.checkProperties === 'function');
863
+ done();
864
+ } catch (error) {
865
+ log.error(`Test Failure: ${error}`);
866
+ done(error);
867
+ }
868
+ });
869
+ it('the sample properties should be good - if failure change the log level', (done) => {
870
+ try {
871
+ const samplePropsJson = require('../../sampleProperties.json');
872
+ const clean = a.checkProperties(samplePropsJson.properties);
873
+
874
+ try {
875
+ assert.notEqual(0, Object.keys(clean));
876
+ assert.equal(undefined, clean.exception);
877
+ assert.notEqual(undefined, clean.host);
878
+ assert.notEqual(null, clean.host);
879
+ assert.notEqual('', clean.host);
880
+ done();
881
+ } catch (err) {
882
+ log.error(`Test Failure: ${err}`);
883
+ done(err);
884
+ }
885
+ } catch (error) {
886
+ log.error(`Adapter Exception: ${error}`);
887
+ done(error);
888
+ }
889
+ }).timeout(attemptTimeout);
890
+ });
891
+
892
+ describe('README.md', () => {
893
+ it('should have a README', (done) => {
894
+ try {
895
+ fs.exists('README.md', (val) => {
896
+ assert.equal(true, val);
897
+ done();
898
+ });
899
+ } catch (error) {
900
+ log.error(`Test Failure: ${error}`);
901
+ done(error);
902
+ }
903
+ });
904
+ it('README.md should be customized', (done) => {
905
+ try {
906
+ fs.readFile('README.md', 'utf8', (err, data) => {
907
+ assert.equal(-1, data.indexOf('[System]'));
908
+ assert.equal(-1, data.indexOf('[system]'));
909
+ assert.equal(-1, data.indexOf('[version]'));
910
+ assert.equal(-1, data.indexOf('[namespace]'));
911
+ done();
912
+ });
913
+ } catch (error) {
914
+ log.error(`Test Failure: ${error}`);
915
+ done(error);
916
+ }
917
+ });
918
+ });
919
+
920
+ describe('#connect', () => {
921
+ it('should have a connect function', (done) => {
922
+ try {
923
+ assert.equal(true, typeof a.connect === 'function');
924
+ done();
925
+ } catch (error) {
926
+ log.error(`Test Failure: ${error}`);
927
+ done(error);
928
+ }
929
+ });
930
+ });
931
+
932
+ describe('#healthCheck', () => {
933
+ it('should have a healthCheck function', (done) => {
934
+ try {
935
+ assert.equal(true, typeof a.healthCheck === 'function');
936
+ done();
937
+ } catch (error) {
938
+ log.error(`Test Failure: ${error}`);
939
+ done(error);
940
+ }
941
+ });
942
+ });
943
+
944
+ describe('#iapUpdateAdapterConfiguration', () => {
945
+ it('should have a iapUpdateAdapterConfiguration function', (done) => {
946
+ try {
947
+ assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
948
+ done();
949
+ } catch (error) {
950
+ log.error(`Test Failure: ${error}`);
951
+ done(error);
952
+ }
953
+ });
954
+ });
955
+
956
+ describe('#iapSuspendAdapter', () => {
957
+ it('should have a iapSuspendAdapter function', (done) => {
958
+ try {
959
+ assert.equal(true, typeof a.iapSuspendAdapter === 'function');
960
+ done();
961
+ } catch (error) {
962
+ log.error(`Test Failure: ${error}`);
963
+ done(error);
964
+ }
965
+ });
966
+ });
967
+
968
+ describe('#iapUnsuspendAdapter', () => {
969
+ it('should have a iapUnsuspendAdapter function', (done) => {
970
+ try {
971
+ assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
972
+ done();
973
+ } catch (error) {
974
+ log.error(`Test Failure: ${error}`);
975
+ done(error);
976
+ }
977
+ });
978
+ });
979
+
980
+ describe('#iapGetAdapterQueue', () => {
981
+ it('should have a iapGetAdapterQueue function', (done) => {
982
+ try {
983
+ assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
984
+ done();
985
+ } catch (error) {
986
+ log.error(`Test Failure: ${error}`);
987
+ done(error);
988
+ }
989
+ });
990
+ });
991
+
992
+ describe('#iapFindAdapterPath', () => {
993
+ it('should have a iapFindAdapterPath function', (done) => {
994
+ try {
995
+ assert.equal(true, typeof a.iapFindAdapterPath === 'function');
996
+ done();
997
+ } catch (error) {
998
+ log.error(`Test Failure: ${error}`);
999
+ done(error);
1000
+ }
1001
+ });
1002
+ it('iapFindAdapterPath should find atleast one path that matches', (done) => {
1003
+ try {
1004
+ a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
1005
+ try {
1006
+ assert.equal(undefined, error);
1007
+ assert.notEqual(undefined, data);
1008
+ assert.notEqual(null, data);
1009
+ assert.equal(true, data.found);
1010
+ assert.notEqual(undefined, data.foundIn);
1011
+ assert.notEqual(null, data.foundIn);
1012
+ assert.notEqual(0, data.foundIn.length);
1013
+ done();
1014
+ } catch (err) {
1015
+ log.error(`Test Failure: ${err}`);
1016
+ done(err);
1017
+ }
1018
+ });
1019
+ } catch (error) {
1020
+ log.error(`Adapter Exception: ${error}`);
1021
+ done(error);
1022
+ }
1023
+ }).timeout(attemptTimeout);
1024
+ });
1025
+
1026
+ describe('#iapTroubleshootAdapter', () => {
1027
+ it('should have a iapTroubleshootAdapter function', (done) => {
1028
+ try {
1029
+ assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
1030
+ done();
1031
+ } catch (error) {
1032
+ log.error(`Test Failure: ${error}`);
1033
+ done(error);
1034
+ }
1035
+ });
1036
+ });
1037
+
1038
+ describe('#iapRunAdapterHealthcheck', () => {
1039
+ it('should have a iapRunAdapterHealthcheck function', (done) => {
1040
+ try {
1041
+ assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
1042
+ done();
1043
+ } catch (error) {
1044
+ log.error(`Test Failure: ${error}`);
1045
+ done(error);
1046
+ }
1047
+ });
1048
+ });
1049
+
1050
+ describe('#iapRunAdapterConnectivity', () => {
1051
+ it('should have a iapRunAdapterConnectivity function', (done) => {
1052
+ try {
1053
+ assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
1054
+ done();
1055
+ } catch (error) {
1056
+ log.error(`Test Failure: ${error}`);
1057
+ done(error);
1058
+ }
1059
+ });
1060
+ });
1061
+
1062
+ describe('#iapRunAdapterBasicGet', () => {
1063
+ it('should have a iapRunAdapterBasicGet function', (done) => {
1064
+ try {
1065
+ assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
1066
+ done();
1067
+ } catch (error) {
1068
+ log.error(`Test Failure: ${error}`);
1069
+ done(error);
1070
+ }
1071
+ });
1072
+ });
1073
+
1074
+ describe('#iapMoveAdapterEntitiesToDB', () => {
1075
+ it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
1076
+ try {
1077
+ assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
1078
+ done();
1079
+ } catch (error) {
1080
+ log.error(`Test Failure: ${error}`);
1081
+ done(error);
1082
+ }
1083
+ });
1084
+ });
1085
+
1086
+ describe('#checkActionFiles', () => {
1087
+ it('should have a checkActionFiles function', (done) => {
1088
+ try {
1089
+ assert.equal(true, typeof a.checkActionFiles === 'function');
1090
+ done();
1091
+ } catch (error) {
1092
+ log.error(`Test Failure: ${error}`);
1093
+ done(error);
1094
+ }
1095
+ });
1096
+ it('the action files should be good - if failure change the log level as most issues are warnings', (done) => {
1097
+ try {
1098
+ const clean = a.checkActionFiles();
1099
+
1100
+ try {
1101
+ for (let c = 0; c < clean.length; c += 1) {
1102
+ log.error(clean[c]);
1103
+ }
1104
+ assert.equal(0, clean.length);
1105
+ done();
1106
+ } catch (err) {
1107
+ log.error(`Test Failure: ${err}`);
1108
+ done(err);
1109
+ }
1110
+ } catch (error) {
1111
+ log.error(`Adapter Exception: ${error}`);
1112
+ done(error);
1113
+ }
1114
+ }).timeout(attemptTimeout);
1115
+ });
1116
+
1117
+ describe('#encryptProperty', () => {
1118
+ it('should have a encryptProperty function', (done) => {
1119
+ try {
1120
+ assert.equal(true, typeof a.encryptProperty === 'function');
1121
+ done();
1122
+ } catch (error) {
1123
+ log.error(`Test Failure: ${error}`);
1124
+ done(error);
1125
+ }
1126
+ });
1127
+ it('should get base64 encoded property', (done) => {
1128
+ try {
1129
+ a.encryptProperty('testing', 'base64', (data, error) => {
1130
+ try {
1131
+ assert.equal(undefined, error);
1132
+ assert.notEqual(undefined, data);
1133
+ assert.notEqual(null, data);
1134
+ assert.notEqual(undefined, data.response);
1135
+ assert.notEqual(null, data.response);
1136
+ assert.equal(0, data.response.indexOf('{code}'));
1137
+ done();
1138
+ } catch (err) {
1139
+ log.error(`Test Failure: ${err}`);
1140
+ done(err);
1141
+ }
1142
+ });
1143
+ } catch (error) {
1144
+ log.error(`Adapter Exception: ${error}`);
1145
+ done(error);
1146
+ }
1147
+ }).timeout(attemptTimeout);
1148
+ it('should get encrypted property', (done) => {
1149
+ try {
1150
+ a.encryptProperty('testing', 'encrypt', (data, error) => {
1151
+ try {
1152
+ assert.equal(undefined, error);
1153
+ assert.notEqual(undefined, data);
1154
+ assert.notEqual(null, data);
1155
+ assert.notEqual(undefined, data.response);
1156
+ assert.notEqual(null, data.response);
1157
+ assert.equal(0, data.response.indexOf('{crypt}'));
1158
+ done();
1159
+ } catch (err) {
1160
+ log.error(`Test Failure: ${err}`);
1161
+ done(err);
1162
+ }
1163
+ });
1164
+ } catch (error) {
1165
+ log.error(`Adapter Exception: ${error}`);
1166
+ done(error);
1167
+ }
1168
+ }).timeout(attemptTimeout);
1169
+ });
1170
+
1171
+ describe('#iapDeactivateTasks', () => {
1172
+ it('should have a iapDeactivateTasks function', (done) => {
1173
+ try {
1174
+ assert.equal(true, typeof a.iapDeactivateTasks === 'function');
1175
+ done();
1176
+ } catch (error) {
1177
+ log.error(`Test Failure: ${error}`);
1178
+ done(error);
1179
+ }
1180
+ });
1181
+ });
1182
+
1183
+ describe('#iapActivateTasks', () => {
1184
+ it('should have a iapActivateTasks function', (done) => {
1185
+ try {
1186
+ assert.equal(true, typeof a.iapActivateTasks === 'function');
1187
+ done();
1188
+ } catch (error) {
1189
+ log.error(`Test Failure: ${error}`);
1190
+ done(error);
1191
+ }
1192
+ });
1193
+ });
1194
+
1195
+ describe('#iapPopulateEntityCache', () => {
1196
+ it('should have a iapPopulateEntityCache function', (done) => {
1197
+ try {
1198
+ assert.equal(true, typeof a.iapPopulateEntityCache === 'function');
1199
+ done();
1200
+ } catch (error) {
1201
+ log.error(`Test Failure: ${error}`);
1202
+ done(error);
1203
+ }
1204
+ });
1205
+ });
1206
+
1207
+ describe('#iapRetrieveEntitiesCache', () => {
1208
+ it('should have a iapRetrieveEntitiesCache function', (done) => {
1209
+ try {
1210
+ assert.equal(true, typeof a.iapRetrieveEntitiesCache === 'function');
1211
+ done();
1212
+ } catch (error) {
1213
+ log.error(`Test Failure: ${error}`);
1214
+ done(error);
1215
+ }
1216
+ });
1217
+ });
1218
+
1219
+ describe('#hasEntities', () => {
1220
+ it('should have a hasEntities function', (done) => {
1221
+ try {
1222
+ assert.equal(true, typeof a.hasEntities === 'function');
1223
+ done();
1224
+ } catch (error) {
1225
+ log.error(`Test Failure: ${error}`);
1226
+ done(error);
1227
+ }
1228
+ });
1229
+ });
1230
+
1231
+ describe('#getDevice', () => {
1232
+ it('should have a getDevice function', (done) => {
1233
+ try {
1234
+ assert.equal(true, typeof a.getDevice === 'function');
1235
+ done();
1236
+ } catch (error) {
1237
+ log.error(`Test Failure: ${error}`);
1238
+ done(error);
1239
+ }
1240
+ });
1241
+ });
1242
+
1243
+ describe('#getDevicesFiltered', () => {
1244
+ it('should have a getDevicesFiltered function', (done) => {
1245
+ try {
1246
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1247
+ done();
1248
+ } catch (error) {
1249
+ log.error(`Test Failure: ${error}`);
1250
+ done(error);
1251
+ }
1252
+ });
1253
+ });
1254
+
1255
+ describe('#isAlive', () => {
1256
+ it('should have a isAlive function', (done) => {
1257
+ try {
1258
+ assert.equal(true, typeof a.isAlive === 'function');
1259
+ done();
1260
+ } catch (error) {
1261
+ log.error(`Test Failure: ${error}`);
1262
+ done(error);
1263
+ }
1264
+ });
1265
+ });
1266
+
1267
+ describe('#getConfig', () => {
1268
+ it('should have a getConfig function', (done) => {
1269
+ try {
1270
+ assert.equal(true, typeof a.getConfig === 'function');
1271
+ done();
1272
+ } catch (error) {
1273
+ log.error(`Test Failure: ${error}`);
1274
+ done(error);
1275
+ }
1276
+ });
1277
+ });
1278
+
1279
+ describe('#iapGetDeviceCount', () => {
1280
+ it('should have a iapGetDeviceCount function', (done) => {
1281
+ try {
1282
+ assert.equal(true, typeof a.iapGetDeviceCount === 'function');
1283
+ done();
1284
+ } catch (error) {
1285
+ log.error(`Test Failure: ${error}`);
1286
+ done(error);
1287
+ }
1288
+ });
1289
+ });
1290
+
1291
+ describe('#iapExpandedGenericAdapterRequest', () => {
1292
+ it('should have a iapExpandedGenericAdapterRequest function', (done) => {
1293
+ try {
1294
+ assert.equal(true, typeof a.iapExpandedGenericAdapterRequest === 'function');
1295
+ done();
1296
+ } catch (error) {
1297
+ log.error(`Test Failure: ${error}`);
1298
+ done(error);
1299
+ }
1300
+ });
1301
+ });
1302
+
1303
+ describe('#genericAdapterRequest', () => {
1304
+ it('should have a genericAdapterRequest function', (done) => {
1305
+ try {
1306
+ assert.equal(true, typeof a.genericAdapterRequest === 'function');
1307
+ done();
1308
+ } catch (error) {
1309
+ log.error(`Test Failure: ${error}`);
1310
+ done(error);
1311
+ }
1312
+ });
1313
+ });
1314
+
1315
+ describe('#genericAdapterRequestNoBasePath', () => {
1316
+ it('should have a genericAdapterRequestNoBasePath function', (done) => {
1317
+ try {
1318
+ assert.equal(true, typeof a.genericAdapterRequestNoBasePath === 'function');
1319
+ done();
1320
+ } catch (error) {
1321
+ log.error(`Test Failure: ${error}`);
1322
+ done(error);
1323
+ }
1324
+ });
1325
+ });
1326
+
1327
+ describe('#iapRunAdapterLint', () => {
1328
+ it('should have a iapRunAdapterLint function', (done) => {
1329
+ try {
1330
+ assert.equal(true, typeof a.iapRunAdapterLint === 'function');
1331
+ done();
1332
+ } catch (error) {
1333
+ log.error(`Test Failure: ${error}`);
1334
+ done(error);
1335
+ }
1336
+ });
1337
+ it('retrieve the lint results', (done) => {
1338
+ try {
1339
+ a.iapRunAdapterLint((data, error) => {
1340
+ try {
1341
+ assert.equal(undefined, error);
1342
+ assert.notEqual(undefined, data);
1343
+ assert.notEqual(null, data);
1344
+ assert.notEqual(undefined, data.status);
1345
+ assert.notEqual(null, data.status);
1346
+ assert.equal('SUCCESS', data.status);
1347
+ done();
1348
+ } catch (err) {
1349
+ log.error(`Test Failure: ${err}`);
1350
+ done(err);
1351
+ }
1352
+ });
1353
+ } catch (error) {
1354
+ log.error(`Adapter Exception: ${error}`);
1355
+ done(error);
1356
+ }
1357
+ }).timeout(attemptTimeout);
1358
+ });
1359
+
1360
+ describe('#iapRunAdapterTests', () => {
1361
+ it('should have a iapRunAdapterTests function', (done) => {
1362
+ try {
1363
+ assert.equal(true, typeof a.iapRunAdapterTests === 'function');
1364
+ done();
1365
+ } catch (error) {
1366
+ log.error(`Test Failure: ${error}`);
1367
+ done(error);
1368
+ }
1369
+ });
1370
+ });
1371
+
1372
+ describe('#iapGetAdapterInventory', () => {
1373
+ it('should have a iapGetAdapterInventory function', (done) => {
1374
+ try {
1375
+ assert.equal(true, typeof a.iapGetAdapterInventory === 'function');
1376
+ done();
1377
+ } catch (error) {
1378
+ log.error(`Test Failure: ${error}`);
1379
+ done(error);
1380
+ }
1381
+ });
1382
+ it('retrieve the inventory', (done) => {
1383
+ try {
1384
+ a.iapGetAdapterInventory((data, error) => {
1385
+ try {
1386
+ assert.equal(undefined, error);
1387
+ assert.notEqual(undefined, data);
1388
+ assert.notEqual(null, data);
1389
+ done();
1390
+ } catch (err) {
1391
+ log.error(`Test Failure: ${err}`);
1392
+ done(err);
1393
+ }
1394
+ });
1395
+ } catch (error) {
1396
+ log.error(`Adapter Exception: ${error}`);
1397
+ done(error);
1398
+ }
1399
+ }).timeout(attemptTimeout);
1400
+ });
1401
+ describe('metadata.json', () => {
1402
+ it('should have a metadata.json', (done) => {
1403
+ try {
1404
+ fs.exists('metadata.json', (val) => {
1405
+ assert.equal(true, val);
1406
+ done();
1407
+ });
1408
+ } catch (error) {
1409
+ log.error(`Test Failure: ${error}`);
1410
+ done(error);
1411
+ }
1412
+ });
1413
+ it('metadata.json is customized', (done) => {
1414
+ try {
1415
+ const metadataDotJson = require('../../metadata.json');
1416
+ assert.equal('adapter-selector_ai', metadataDotJson.name);
1417
+ assert.notEqual(undefined, metadataDotJson.webName);
1418
+ assert.notEqual(null, metadataDotJson.webName);
1419
+ assert.notEqual('', metadataDotJson.webName);
1420
+ assert.equal('Adapter', metadataDotJson.type);
1421
+ done();
1422
+ } catch (error) {
1423
+ log.error(`Test Failure: ${error}`);
1424
+ done(error);
1425
+ }
1426
+ });
1427
+ it('metadata.json contains accurate documentation', (done) => {
1428
+ try {
1429
+ const metadataDotJson = require('../../metadata.json');
1430
+ assert.notEqual(undefined, metadataDotJson.documentation);
1431
+ assert.equal('https://www.npmjs.com/package/@itentialopensource/adapter-selector_ai', metadataDotJson.documentation.npmLink);
1432
+ assert.equal('https://docs.itential.com/opensource/docs/troubleshooting-an-adapter', metadataDotJson.documentation.faqLink);
1433
+ assert.equal('https://gitlab.com/itentialopensource/adapters/contributing-guide', metadataDotJson.documentation.contributeLink);
1434
+ assert.equal('https://itential.atlassian.net/servicedesk/customer/portals', metadataDotJson.documentation.issueLink);
1435
+ done();
1436
+ } catch (error) {
1437
+ log.error(`Test Failure: ${error}`);
1438
+ done(error);
1439
+ }
1440
+ });
1441
+ it('metadata.json has related items', (done) => {
1442
+ try {
1443
+ const metadataDotJson = require('../../metadata.json');
1444
+ assert.notEqual(undefined, metadataDotJson.relatedItems);
1445
+ assert.notEqual(undefined, metadataDotJson.relatedItems.adapters);
1446
+ assert.notEqual(undefined, metadataDotJson.relatedItems.integrations);
1447
+ assert.notEqual(undefined, metadataDotJson.relatedItems.ecosystemApplications);
1448
+ assert.notEqual(undefined, metadataDotJson.relatedItems.workflowProjects);
1449
+ assert.notEqual(undefined, metadataDotJson.relatedItems.transformationProjects);
1450
+ assert.notEqual(undefined, metadataDotJson.relatedItems.exampleProjects);
1451
+ done();
1452
+ } catch (error) {
1453
+ log.error(`Test Failure: ${error}`);
1454
+ done(error);
1455
+ }
1456
+ });
1457
+ });
1458
+ /*
1459
+ -----------------------------------------------------------------------
1460
+ -----------------------------------------------------------------------
1461
+ *** All code above this comment will be replaced during a migration ***
1462
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
1463
+ -----------------------------------------------------------------------
1464
+ -----------------------------------------------------------------------
1465
+ */
1466
+
1467
+ describe('#getAllInventoryV1InventoryGet - errors', () => {
1468
+ it('should have a getAllInventoryV1InventoryGet function', (done) => {
1469
+ try {
1470
+ assert.equal(true, typeof a.getAllInventoryV1InventoryGet === 'function');
1471
+ done();
1472
+ } catch (error) {
1473
+ log.error(`Test Failure: ${error}`);
1474
+ done(error);
1475
+ }
1476
+ }).timeout(attemptTimeout);
1477
+ });
1478
+
1479
+ describe('#inventoryCreationV1InventoryPost - errors', () => {
1480
+ it('should have a inventoryCreationV1InventoryPost function', (done) => {
1481
+ try {
1482
+ assert.equal(true, typeof a.inventoryCreationV1InventoryPost === 'function');
1483
+ done();
1484
+ } catch (error) {
1485
+ log.error(`Test Failure: ${error}`);
1486
+ done(error);
1487
+ }
1488
+ }).timeout(attemptTimeout);
1489
+ it('should error if - missing body', (done) => {
1490
+ try {
1491
+ a.inventoryCreationV1InventoryPost(null, null, (data, error) => {
1492
+ try {
1493
+ const displayE = 'body is required';
1494
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryCreationV1InventoryPost', displayE);
1495
+ done();
1496
+ } catch (err) {
1497
+ log.error(`Test Failure: ${err}`);
1498
+ done(err);
1499
+ }
1500
+ });
1501
+ } catch (error) {
1502
+ log.error(`Adapter Exception: ${error}`);
1503
+ done(error);
1504
+ }
1505
+ }).timeout(attemptTimeout);
1506
+ });
1507
+
1508
+ describe('#inventoryUpdateV1InventoryNamePut - errors', () => {
1509
+ it('should have a inventoryUpdateV1InventoryNamePut function', (done) => {
1510
+ try {
1511
+ assert.equal(true, typeof a.inventoryUpdateV1InventoryNamePut === 'function');
1512
+ done();
1513
+ } catch (error) {
1514
+ log.error(`Test Failure: ${error}`);
1515
+ done(error);
1516
+ }
1517
+ }).timeout(attemptTimeout);
1518
+ it('should error if - missing name', (done) => {
1519
+ try {
1520
+ a.inventoryUpdateV1InventoryNamePut(null, null, null, (data, error) => {
1521
+ try {
1522
+ const displayE = 'name is required';
1523
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryUpdateV1InventoryNamePut', displayE);
1524
+ done();
1525
+ } catch (err) {
1526
+ log.error(`Test Failure: ${err}`);
1527
+ done(err);
1528
+ }
1529
+ });
1530
+ } catch (error) {
1531
+ log.error(`Adapter Exception: ${error}`);
1532
+ done(error);
1533
+ }
1534
+ }).timeout(attemptTimeout);
1535
+ it('should error if - missing body', (done) => {
1536
+ try {
1537
+ a.inventoryUpdateV1InventoryNamePut('fakeparam', null, null, (data, error) => {
1538
+ try {
1539
+ const displayE = 'body is required';
1540
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryUpdateV1InventoryNamePut', displayE);
1541
+ done();
1542
+ } catch (err) {
1543
+ log.error(`Test Failure: ${err}`);
1544
+ done(err);
1545
+ }
1546
+ });
1547
+ } catch (error) {
1548
+ log.error(`Adapter Exception: ${error}`);
1549
+ done(error);
1550
+ }
1551
+ }).timeout(attemptTimeout);
1552
+ });
1553
+
1554
+ describe('#deletingSpecificInventoryV1InventoryNameDelete - errors', () => {
1555
+ it('should have a deletingSpecificInventoryV1InventoryNameDelete function', (done) => {
1556
+ try {
1557
+ assert.equal(true, typeof a.deletingSpecificInventoryV1InventoryNameDelete === 'function');
1558
+ done();
1559
+ } catch (error) {
1560
+ log.error(`Test Failure: ${error}`);
1561
+ done(error);
1562
+ }
1563
+ }).timeout(attemptTimeout);
1564
+ it('should error if - missing name', (done) => {
1565
+ try {
1566
+ a.deletingSpecificInventoryV1InventoryNameDelete(null, null, (data, error) => {
1567
+ try {
1568
+ const displayE = 'name is required';
1569
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-deletingSpecificInventoryV1InventoryNameDelete', displayE);
1570
+ done();
1571
+ } catch (err) {
1572
+ log.error(`Test Failure: ${err}`);
1573
+ done(err);
1574
+ }
1575
+ });
1576
+ } catch (error) {
1577
+ log.error(`Adapter Exception: ${error}`);
1578
+ done(error);
1579
+ }
1580
+ }).timeout(attemptTimeout);
1581
+ });
1582
+
1583
+ describe('#inventoryItemGetV1InventoryNameGet - errors', () => {
1584
+ it('should have a inventoryItemGetV1InventoryNameGet function', (done) => {
1585
+ try {
1586
+ assert.equal(true, typeof a.inventoryItemGetV1InventoryNameGet === 'function');
1587
+ done();
1588
+ } catch (error) {
1589
+ log.error(`Test Failure: ${error}`);
1590
+ done(error);
1591
+ }
1592
+ }).timeout(attemptTimeout);
1593
+ it('should error if - missing name', (done) => {
1594
+ try {
1595
+ a.inventoryItemGetV1InventoryNameGet(null, null, null, (data, error) => {
1596
+ try {
1597
+ const displayE = 'name is required';
1598
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemGetV1InventoryNameGet', displayE);
1599
+ done();
1600
+ } catch (err) {
1601
+ log.error(`Test Failure: ${err}`);
1602
+ done(err);
1603
+ }
1604
+ });
1605
+ } catch (error) {
1606
+ log.error(`Adapter Exception: ${error}`);
1607
+ done(error);
1608
+ }
1609
+ }).timeout(attemptTimeout);
1610
+ });
1611
+
1612
+ describe('#inventoryItemGetV1InventoryNameIdGet - errors', () => {
1613
+ it('should have a inventoryItemGetV1InventoryNameIdGet function', (done) => {
1614
+ try {
1615
+ assert.equal(true, typeof a.inventoryItemGetV1InventoryNameIdGet === 'function');
1616
+ done();
1617
+ } catch (error) {
1618
+ log.error(`Test Failure: ${error}`);
1619
+ done(error);
1620
+ }
1621
+ }).timeout(attemptTimeout);
1622
+ it('should error if - missing name', (done) => {
1623
+ try {
1624
+ a.inventoryItemGetV1InventoryNameIdGet(null, null, null, (data, error) => {
1625
+ try {
1626
+ const displayE = 'name is required';
1627
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemGetV1InventoryNameIdGet', displayE);
1628
+ done();
1629
+ } catch (err) {
1630
+ log.error(`Test Failure: ${err}`);
1631
+ done(err);
1632
+ }
1633
+ });
1634
+ } catch (error) {
1635
+ log.error(`Adapter Exception: ${error}`);
1636
+ done(error);
1637
+ }
1638
+ }).timeout(attemptTimeout);
1639
+ it('should error if - missing id', (done) => {
1640
+ try {
1641
+ a.inventoryItemGetV1InventoryNameIdGet('fakeparam', null, null, (data, error) => {
1642
+ try {
1643
+ const displayE = 'id is required';
1644
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemGetV1InventoryNameIdGet', displayE);
1645
+ done();
1646
+ } catch (err) {
1647
+ log.error(`Test Failure: ${err}`);
1648
+ done(err);
1649
+ }
1650
+ });
1651
+ } catch (error) {
1652
+ log.error(`Adapter Exception: ${error}`);
1653
+ done(error);
1654
+ }
1655
+ }).timeout(attemptTimeout);
1656
+ });
1657
+
1658
+ describe('#inventoryItemCreationV1InventoryNamePost - errors', () => {
1659
+ it('should have a inventoryItemCreationV1InventoryNamePost function', (done) => {
1660
+ try {
1661
+ assert.equal(true, typeof a.inventoryItemCreationV1InventoryNamePost === 'function');
1662
+ done();
1663
+ } catch (error) {
1664
+ log.error(`Test Failure: ${error}`);
1665
+ done(error);
1666
+ }
1667
+ }).timeout(attemptTimeout);
1668
+ it('should error if - missing name', (done) => {
1669
+ try {
1670
+ a.inventoryItemCreationV1InventoryNamePost(null, null, null, (data, error) => {
1671
+ try {
1672
+ const displayE = 'name is required';
1673
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryNamePost', displayE);
1674
+ done();
1675
+ } catch (err) {
1676
+ log.error(`Test Failure: ${err}`);
1677
+ done(err);
1678
+ }
1679
+ });
1680
+ } catch (error) {
1681
+ log.error(`Adapter Exception: ${error}`);
1682
+ done(error);
1683
+ }
1684
+ }).timeout(attemptTimeout);
1685
+ it('should error if - missing body', (done) => {
1686
+ try {
1687
+ a.inventoryItemCreationV1InventoryNamePost('fakeparam', null, null, (data, error) => {
1688
+ try {
1689
+ const displayE = 'body is required';
1690
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryNamePost', displayE);
1691
+ done();
1692
+ } catch (err) {
1693
+ log.error(`Test Failure: ${err}`);
1694
+ done(err);
1695
+ }
1696
+ });
1697
+ } catch (error) {
1698
+ log.error(`Adapter Exception: ${error}`);
1699
+ done(error);
1700
+ }
1701
+ }).timeout(attemptTimeout);
1702
+ });
1703
+
1704
+ describe('#inventoryItemCreationV1InventoryNameIdPut - errors', () => {
1705
+ it('should have a inventoryItemCreationV1InventoryNameIdPut function', (done) => {
1706
+ try {
1707
+ assert.equal(true, typeof a.inventoryItemCreationV1InventoryNameIdPut === 'function');
1708
+ done();
1709
+ } catch (error) {
1710
+ log.error(`Test Failure: ${error}`);
1711
+ done(error);
1712
+ }
1713
+ }).timeout(attemptTimeout);
1714
+ it('should error if - missing name', (done) => {
1715
+ try {
1716
+ a.inventoryItemCreationV1InventoryNameIdPut(null, null, null, null, (data, error) => {
1717
+ try {
1718
+ const displayE = 'name is required';
1719
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryNameIdPut', displayE);
1720
+ done();
1721
+ } catch (err) {
1722
+ log.error(`Test Failure: ${err}`);
1723
+ done(err);
1724
+ }
1725
+ });
1726
+ } catch (error) {
1727
+ log.error(`Adapter Exception: ${error}`);
1728
+ done(error);
1729
+ }
1730
+ }).timeout(attemptTimeout);
1731
+ it('should error if - missing id', (done) => {
1732
+ try {
1733
+ a.inventoryItemCreationV1InventoryNameIdPut('fakeparam', null, null, null, (data, error) => {
1734
+ try {
1735
+ const displayE = 'id is required';
1736
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryNameIdPut', displayE);
1737
+ done();
1738
+ } catch (err) {
1739
+ log.error(`Test Failure: ${err}`);
1740
+ done(err);
1741
+ }
1742
+ });
1743
+ } catch (error) {
1744
+ log.error(`Adapter Exception: ${error}`);
1745
+ done(error);
1746
+ }
1747
+ }).timeout(attemptTimeout);
1748
+ it('should error if - missing body', (done) => {
1749
+ try {
1750
+ a.inventoryItemCreationV1InventoryNameIdPut('fakeparam', 'fakeparam', null, null, (data, error) => {
1751
+ try {
1752
+ const displayE = 'body is required';
1753
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryNameIdPut', displayE);
1754
+ done();
1755
+ } catch (err) {
1756
+ log.error(`Test Failure: ${err}`);
1757
+ done(err);
1758
+ }
1759
+ });
1760
+ } catch (error) {
1761
+ log.error(`Adapter Exception: ${error}`);
1762
+ done(error);
1763
+ }
1764
+ }).timeout(attemptTimeout);
1765
+ });
1766
+
1767
+ describe('#inventoryItemDeletionV1InventoryNameIdDelete - errors', () => {
1768
+ it('should have a inventoryItemDeletionV1InventoryNameIdDelete function', (done) => {
1769
+ try {
1770
+ assert.equal(true, typeof a.inventoryItemDeletionV1InventoryNameIdDelete === 'function');
1771
+ done();
1772
+ } catch (error) {
1773
+ log.error(`Test Failure: ${error}`);
1774
+ done(error);
1775
+ }
1776
+ }).timeout(attemptTimeout);
1777
+ it('should error if - missing name', (done) => {
1778
+ try {
1779
+ a.inventoryItemDeletionV1InventoryNameIdDelete(null, null, null, (data, error) => {
1780
+ try {
1781
+ const displayE = 'name is required';
1782
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemDeletionV1InventoryNameIdDelete', displayE);
1783
+ done();
1784
+ } catch (err) {
1785
+ log.error(`Test Failure: ${err}`);
1786
+ done(err);
1787
+ }
1788
+ });
1789
+ } catch (error) {
1790
+ log.error(`Adapter Exception: ${error}`);
1791
+ done(error);
1792
+ }
1793
+ }).timeout(attemptTimeout);
1794
+ it('should error if - missing id', (done) => {
1795
+ try {
1796
+ a.inventoryItemDeletionV1InventoryNameIdDelete('fakeparam', null, null, (data, error) => {
1797
+ try {
1798
+ const displayE = 'id is required';
1799
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemDeletionV1InventoryNameIdDelete', displayE);
1800
+ done();
1801
+ } catch (err) {
1802
+ log.error(`Test Failure: ${err}`);
1803
+ done(err);
1804
+ }
1805
+ });
1806
+ } catch (error) {
1807
+ log.error(`Adapter Exception: ${error}`);
1808
+ done(error);
1809
+ }
1810
+ }).timeout(attemptTimeout);
1811
+ });
1812
+
1813
+ describe('#inventoryItemCreationV1InventoryBulkNamePost - errors', () => {
1814
+ it('should have a inventoryItemCreationV1InventoryBulkNamePost function', (done) => {
1815
+ try {
1816
+ assert.equal(true, typeof a.inventoryItemCreationV1InventoryBulkNamePost === 'function');
1817
+ done();
1818
+ } catch (error) {
1819
+ log.error(`Test Failure: ${error}`);
1820
+ done(error);
1821
+ }
1822
+ }).timeout(attemptTimeout);
1823
+ it('should error if - missing name', (done) => {
1824
+ try {
1825
+ a.inventoryItemCreationV1InventoryBulkNamePost(null, null, null, null, (data, error) => {
1826
+ try {
1827
+ const displayE = 'name is required';
1828
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryBulkNamePost', displayE);
1829
+ done();
1830
+ } catch (err) {
1831
+ log.error(`Test Failure: ${err}`);
1832
+ done(err);
1833
+ }
1834
+ });
1835
+ } catch (error) {
1836
+ log.error(`Adapter Exception: ${error}`);
1837
+ done(error);
1838
+ }
1839
+ }).timeout(attemptTimeout);
1840
+ it('should error if - missing body', (done) => {
1841
+ try {
1842
+ a.inventoryItemCreationV1InventoryBulkNamePost('fakeparam', 'fakeparam', null, null, (data, error) => {
1843
+ try {
1844
+ const displayE = 'body is required';
1845
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryBulkNamePost', displayE);
1846
+ done();
1847
+ } catch (err) {
1848
+ log.error(`Test Failure: ${err}`);
1849
+ done(err);
1850
+ }
1851
+ });
1852
+ } catch (error) {
1853
+ log.error(`Adapter Exception: ${error}`);
1854
+ done(error);
1855
+ }
1856
+ }).timeout(attemptTimeout);
1857
+ });
1858
+
1859
+ describe('#inventoryItemCreationV1InventoryCsvNamePost - errors', () => {
1860
+ it('should have a inventoryItemCreationV1InventoryCsvNamePost function', (done) => {
1861
+ try {
1862
+ assert.equal(true, typeof a.inventoryItemCreationV1InventoryCsvNamePost === 'function');
1863
+ done();
1864
+ } catch (error) {
1865
+ log.error(`Test Failure: ${error}`);
1866
+ done(error);
1867
+ }
1868
+ }).timeout(attemptTimeout);
1869
+ it('should error if - missing name', (done) => {
1870
+ try {
1871
+ a.inventoryItemCreationV1InventoryCsvNamePost(null, null, null, null, (data, error) => {
1872
+ try {
1873
+ const displayE = 'name is required';
1874
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryCsvNamePost', displayE);
1875
+ done();
1876
+ } catch (err) {
1877
+ log.error(`Test Failure: ${err}`);
1878
+ done(err);
1879
+ }
1880
+ });
1881
+ } catch (error) {
1882
+ log.error(`Adapter Exception: ${error}`);
1883
+ done(error);
1884
+ }
1885
+ }).timeout(attemptTimeout);
1886
+ it('should error if - missing file', (done) => {
1887
+ try {
1888
+ a.inventoryItemCreationV1InventoryCsvNamePost('fakeparam', 'fakeparam', null, null, (data, error) => {
1889
+ try {
1890
+ const displayE = 'file is required';
1891
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-inventoryItemCreationV1InventoryCsvNamePost', displayE);
1892
+ done();
1893
+ } catch (err) {
1894
+ log.error(`Test Failure: ${err}`);
1895
+ done(err);
1896
+ }
1897
+ });
1898
+ } catch (error) {
1899
+ log.error(`Adapter Exception: ${error}`);
1900
+ done(error);
1901
+ }
1902
+ }).timeout(attemptTimeout);
1903
+ });
1904
+
1905
+ describe('#inventoryItemGetV1InventoryItemsGet - errors', () => {
1906
+ it('should have a inventoryItemGetV1InventoryItemsGet function', (done) => {
1907
+ try {
1908
+ assert.equal(true, typeof a.inventoryItemGetV1InventoryItemsGet === 'function');
1909
+ done();
1910
+ } catch (error) {
1911
+ log.error(`Test Failure: ${error}`);
1912
+ done(error);
1913
+ }
1914
+ }).timeout(attemptTimeout);
1915
+ });
1916
+
1917
+ describe('#getAllInventoryV1InventorySchemaGet - errors', () => {
1918
+ it('should have a getAllInventoryV1InventorySchemaGet function', (done) => {
1919
+ try {
1920
+ assert.equal(true, typeof a.getAllInventoryV1InventorySchemaGet === 'function');
1921
+ done();
1922
+ } catch (error) {
1923
+ log.error(`Test Failure: ${error}`);
1924
+ done(error);
1925
+ }
1926
+ }).timeout(attemptTimeout);
1927
+ });
1928
+
1929
+ describe('#postInventoryV1InventorySchema - errors', () => {
1930
+ it('should have a postInventoryV1InventorySchema function', (done) => {
1931
+ try {
1932
+ assert.equal(true, typeof a.postInventoryV1InventorySchema === 'function');
1933
+ done();
1934
+ } catch (error) {
1935
+ log.error(`Test Failure: ${error}`);
1936
+ done(error);
1937
+ }
1938
+ }).timeout(attemptTimeout);
1939
+ });
1940
+
1941
+ describe('#putInventoryV1InventorySchema - errors', () => {
1942
+ it('should have a putInventoryV1InventorySchema function', (done) => {
1943
+ try {
1944
+ assert.equal(true, typeof a.putInventoryV1InventorySchema === 'function');
1945
+ done();
1946
+ } catch (error) {
1947
+ log.error(`Test Failure: ${error}`);
1948
+ done(error);
1949
+ }
1950
+ }).timeout(attemptTimeout);
1951
+ });
1952
+
1953
+ describe('#processinventoryschemadelete - errors', () => {
1954
+ it('should have a processinventoryschemadelete function', (done) => {
1955
+ try {
1956
+ assert.equal(true, typeof a.processinventoryschemadelete === 'function');
1957
+ done();
1958
+ } catch (error) {
1959
+ log.error(`Test Failure: ${error}`);
1960
+ done(error);
1961
+ }
1962
+ }).timeout(attemptTimeout);
1963
+ });
1964
+
1965
+ describe('#deleteProcessinventoryschemadelete - errors', () => {
1966
+ it('should have a deleteProcessinventoryschemadelete function', (done) => {
1967
+ try {
1968
+ assert.equal(true, typeof a.deleteProcessinventoryschemadelete === 'function');
1969
+ done();
1970
+ } catch (error) {
1971
+ log.error(`Test Failure: ${error}`);
1972
+ done(error);
1973
+ }
1974
+ }).timeout(attemptTimeout);
1975
+ it('should error if - missing type', (done) => {
1976
+ try {
1977
+ a.deleteProcessinventoryschemadelete(null, null, (data, error) => {
1978
+ try {
1979
+ const displayE = 'type is required';
1980
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-deleteProcessinventoryschemadelete', displayE);
1981
+ done();
1982
+ } catch (err) {
1983
+ log.error(`Test Failure: ${err}`);
1984
+ done(err);
1985
+ }
1986
+ });
1987
+ } catch (error) {
1988
+ log.error(`Adapter Exception: ${error}`);
1989
+ done(error);
1990
+ }
1991
+ }).timeout(attemptTimeout);
1992
+ });
1993
+
1994
+ describe('#getsAllInventoryschema - errors', () => {
1995
+ it('should have a getsAllInventoryschema function', (done) => {
1996
+ try {
1997
+ assert.equal(true, typeof a.getsAllInventoryschema === 'function');
1998
+ done();
1999
+ } catch (error) {
2000
+ log.error(`Test Failure: ${error}`);
2001
+ done(error);
2002
+ }
2003
+ }).timeout(attemptTimeout);
2004
+ });
2005
+
2006
+ describe('#processinventoryschemaJSONinput - errors', () => {
2007
+ it('should have a processinventoryschemaJSONinput function', (done) => {
2008
+ try {
2009
+ assert.equal(true, typeof a.processinventoryschemaJSONinput === 'function');
2010
+ done();
2011
+ } catch (error) {
2012
+ log.error(`Test Failure: ${error}`);
2013
+ done(error);
2014
+ }
2015
+ }).timeout(attemptTimeout);
2016
+ it('should error if - missing body', (done) => {
2017
+ try {
2018
+ a.processinventoryschemaJSONinput(null, null, (data, error) => {
2019
+ try {
2020
+ const displayE = 'body is required';
2021
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-processinventoryschemaJSONinput', displayE);
2022
+ done();
2023
+ } catch (err) {
2024
+ log.error(`Test Failure: ${err}`);
2025
+ done(err);
2026
+ }
2027
+ });
2028
+ } catch (error) {
2029
+ log.error(`Adapter Exception: ${error}`);
2030
+ done(error);
2031
+ }
2032
+ }).timeout(attemptTimeout);
2033
+ });
2034
+
2035
+ describe('#deleteProcessinventoryschemadelete1 - errors', () => {
2036
+ it('should have a deleteProcessinventoryschemadelete1 function', (done) => {
2037
+ try {
2038
+ assert.equal(true, typeof a.deleteProcessinventoryschemadelete1 === 'function');
2039
+ done();
2040
+ } catch (error) {
2041
+ log.error(`Test Failure: ${error}`);
2042
+ done(error);
2043
+ }
2044
+ }).timeout(attemptTimeout);
2045
+ });
2046
+
2047
+ describe('#putProcessinventoryschemaJSONinput - errors', () => {
2048
+ it('should have a putProcessinventoryschemaJSONinput function', (done) => {
2049
+ try {
2050
+ assert.equal(true, typeof a.putProcessinventoryschemaJSONinput === 'function');
2051
+ done();
2052
+ } catch (error) {
2053
+ log.error(`Test Failure: ${error}`);
2054
+ done(error);
2055
+ }
2056
+ }).timeout(attemptTimeout);
2057
+ it('should error if - missing type', (done) => {
2058
+ try {
2059
+ a.putProcessinventoryschemaJSONinput(null, null, null, (data, error) => {
2060
+ try {
2061
+ const displayE = 'type is required';
2062
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-putProcessinventoryschemaJSONinput', displayE);
2063
+ done();
2064
+ } catch (err) {
2065
+ log.error(`Test Failure: ${err}`);
2066
+ done(err);
2067
+ }
2068
+ });
2069
+ } catch (error) {
2070
+ log.error(`Adapter Exception: ${error}`);
2071
+ done(error);
2072
+ }
2073
+ }).timeout(attemptTimeout);
2074
+ it('should error if - missing body', (done) => {
2075
+ try {
2076
+ a.putProcessinventoryschemaJSONinput('fakeparam', null, null, (data, error) => {
2077
+ try {
2078
+ const displayE = 'body is required';
2079
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-putProcessinventoryschemaJSONinput', displayE);
2080
+ done();
2081
+ } catch (err) {
2082
+ log.error(`Test Failure: ${err}`);
2083
+ done(err);
2084
+ }
2085
+ });
2086
+ } catch (error) {
2087
+ log.error(`Adapter Exception: ${error}`);
2088
+ done(error);
2089
+ }
2090
+ }).timeout(attemptTimeout);
2091
+ });
2092
+
2093
+ describe('#deleteProcessinventoryschemadelete2 - errors', () => {
2094
+ it('should have a deleteProcessinventoryschemadelete2 function', (done) => {
2095
+ try {
2096
+ assert.equal(true, typeof a.deleteProcessinventoryschemadelete2 === 'function');
2097
+ done();
2098
+ } catch (error) {
2099
+ log.error(`Test Failure: ${error}`);
2100
+ done(error);
2101
+ }
2102
+ }).timeout(attemptTimeout);
2103
+ it('should error if - missing type', (done) => {
2104
+ try {
2105
+ a.deleteProcessinventoryschemadelete2(null, null, (data, error) => {
2106
+ try {
2107
+ const displayE = 'type is required';
2108
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-deleteProcessinventoryschemadelete2', displayE);
2109
+ done();
2110
+ } catch (err) {
2111
+ log.error(`Test Failure: ${err}`);
2112
+ done(err);
2113
+ }
2114
+ });
2115
+ } catch (error) {
2116
+ log.error(`Adapter Exception: ${error}`);
2117
+ done(error);
2118
+ }
2119
+ }).timeout(attemptTimeout);
2120
+ });
2121
+
2122
+ describe('#porcessuploadJSONfile - errors', () => {
2123
+ it('should have a porcessuploadJSONfile function', (done) => {
2124
+ try {
2125
+ assert.equal(true, typeof a.porcessuploadJSONfile === 'function');
2126
+ done();
2127
+ } catch (error) {
2128
+ log.error(`Test Failure: ${error}`);
2129
+ done(error);
2130
+ }
2131
+ }).timeout(attemptTimeout);
2132
+ });
2133
+
2134
+ describe('#downloadinventoryschemaJSONfile - errors', () => {
2135
+ it('should have a downloadinventoryschemaJSONfile function', (done) => {
2136
+ try {
2137
+ assert.equal(true, typeof a.downloadinventoryschemaJSONfile === 'function');
2138
+ done();
2139
+ } catch (error) {
2140
+ log.error(`Test Failure: ${error}`);
2141
+ done(error);
2142
+ }
2143
+ }).timeout(attemptTimeout);
2144
+ });
2145
+
2146
+ describe('#handleInventoryFilesPostInventoryFilesImportPost - errors', () => {
2147
+ it('should have a handleInventoryFilesPostInventoryFilesImportPost function', (done) => {
2148
+ try {
2149
+ assert.equal(true, typeof a.handleInventoryFilesPostInventoryFilesImportPost === 'function');
2150
+ done();
2151
+ } catch (error) {
2152
+ log.error(`Test Failure: ${error}`);
2153
+ done(error);
2154
+ }
2155
+ }).timeout(attemptTimeout);
2156
+ });
2157
+
2158
+ describe('#handleInventoryFilesGetInventoryFilesExportPost - errors', () => {
2159
+ it('should have a handleInventoryFilesGetInventoryFilesExportPost function', (done) => {
2160
+ try {
2161
+ assert.equal(true, typeof a.handleInventoryFilesGetInventoryFilesExportPost === 'function');
2162
+ done();
2163
+ } catch (error) {
2164
+ log.error(`Test Failure: ${error}`);
2165
+ done(error);
2166
+ }
2167
+ }).timeout(attemptTimeout);
2168
+ it('should error if - missing body', (done) => {
2169
+ try {
2170
+ a.handleInventoryFilesGetInventoryFilesExportPost('fakeparam', null, null, (data, error) => {
2171
+ try {
2172
+ const displayE = 'body is required';
2173
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-handleInventoryFilesGetInventoryFilesExportPost', displayE);
2174
+ done();
2175
+ } catch (err) {
2176
+ log.error(`Test Failure: ${err}`);
2177
+ done(err);
2178
+ }
2179
+ });
2180
+ } catch (error) {
2181
+ log.error(`Adapter Exception: ${error}`);
2182
+ done(error);
2183
+ }
2184
+ }).timeout(attemptTimeout);
2185
+ });
2186
+
2187
+ describe('#handleInventoryCsvFileGet - errors', () => {
2188
+ it('should have a handleInventoryCsvFileGet function', (done) => {
2189
+ try {
2190
+ assert.equal(true, typeof a.handleInventoryCsvFileGet === 'function');
2191
+ done();
2192
+ } catch (error) {
2193
+ log.error(`Test Failure: ${error}`);
2194
+ done(error);
2195
+ }
2196
+ }).timeout(attemptTimeout);
2197
+ it('should error if - missing name', (done) => {
2198
+ try {
2199
+ a.handleInventoryCsvFileGet(null, null, (data, error) => {
2200
+ try {
2201
+ const displayE = 'name is required';
2202
+ runErrorAsserts(data, error, 'AD.300', 'Test-selector_ai-adapter-handleInventoryCsvFileGet', displayE);
2203
+ done();
2204
+ } catch (err) {
2205
+ log.error(`Test Failure: ${err}`);
2206
+ done(err);
2207
+ }
2208
+ });
2209
+ } catch (error) {
2210
+ log.error(`Adapter Exception: ${error}`);
2211
+ done(error);
2212
+ }
2213
+ }).timeout(attemptTimeout);
2214
+ });
2215
+
2216
+ describe('#get - errors', () => {
2217
+ it('should have a get function', (done) => {
2218
+ try {
2219
+ assert.equal(true, typeof a.get === 'function');
2220
+ done();
2221
+ } catch (error) {
2222
+ log.error(`Test Failure: ${error}`);
2223
+ done(error);
2224
+ }
2225
+ }).timeout(attemptTimeout);
2226
+ });
2227
+
2228
+ describe('#getOpstats - errors', () => {
2229
+ it('should have a getOpstats function', (done) => {
2230
+ try {
2231
+ assert.equal(true, typeof a.getOpstats === 'function');
2232
+ done();
2233
+ } catch (error) {
2234
+ log.error(`Test Failure: ${error}`);
2235
+ done(error);
2236
+ }
2237
+ }).timeout(attemptTimeout);
2238
+ });
2239
+
2240
+ describe('#getVersion - errors', () => {
2241
+ it('should have a getVersion function', (done) => {
2242
+ try {
2243
+ assert.equal(true, typeof a.getVersion === 'function');
2244
+ done();
2245
+ } catch (error) {
2246
+ log.error(`Test Failure: ${error}`);
2247
+ done(error);
2248
+ }
2249
+ }).timeout(attemptTimeout);
2250
+ });
2251
+
2252
+ describe('#getAIConfig - errors', () => {
2253
+ it('should have a getAIConfig function', (done) => {
2254
+ try {
2255
+ assert.equal(true, typeof a.getAIConfig === 'function');
2256
+ done();
2257
+ } catch (error) {
2258
+ log.error(`Test Failure: ${error}`);
2259
+ done(error);
2260
+ }
2261
+ }).timeout(attemptTimeout);
2262
+ });
2263
+
2264
+ describe('#getHealth - errors', () => {
2265
+ it('should have a getHealth function', (done) => {
2266
+ try {
2267
+ assert.equal(true, typeof a.getHealth === 'function');
2268
+ done();
2269
+ } catch (error) {
2270
+ log.error(`Test Failure: ${error}`);
2271
+ done(error);
2272
+ }
2273
+ }).timeout(attemptTimeout);
2274
+ });
2275
+
2276
+ describe('#healthLogsGet - errors', () => {
2277
+ it('should have a healthLogsGet function', (done) => {
2278
+ try {
2279
+ assert.equal(true, typeof a.healthLogsGet === 'function');
2280
+ done();
2281
+ } catch (error) {
2282
+ log.error(`Test Failure: ${error}`);
2283
+ done(error);
2284
+ }
2285
+ }).timeout(attemptTimeout);
2286
+ });
2287
+ });
2288
+ });