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