@itentialopensource/adapter-dna_center 0.5.4 → 0.5.7

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 (45) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +24 -0
  4. package/ENHANCE.md +69 -0
  5. package/PROPERTIES.md +247 -0
  6. package/README.md +151 -379
  7. package/SUMMARY.md +9 -0
  8. package/TROUBLESHOOT.md +46 -0
  9. package/adapter.js +2212 -85
  10. package/adapterBase.js +848 -50
  11. package/entities/.generic/action.json +214 -0
  12. package/entities/.generic/schema.json +28 -0
  13. package/entities/.system/action.json +1 -1
  14. package/entities/Sites/action.json +42 -0
  15. package/entities/Sites/schema.json +2 -0
  16. package/error.json +12 -0
  17. package/package.json +45 -23
  18. package/pronghorn.json +780 -0
  19. package/propertiesDecorators.json +14 -0
  20. package/propertiesSchema.json +451 -11
  21. package/refs?service=git-upload-pack +0 -0
  22. package/report/updateReport1594147160686.json +95 -0
  23. package/report/updateReport1614887797185.json +95 -0
  24. package/report/updateReport1651598418513.json +114 -0
  25. package/sampleProperties.json +20 -5
  26. package/test/integration/adapterTestBasicGet.js +85 -0
  27. package/test/integration/adapterTestConnectivity.js +93 -0
  28. package/test/integration/adapterTestIntegration.js +87 -11
  29. package/test/unit/adapterBaseTestUnit.js +947 -0
  30. package/test/unit/adapterTestUnit.js +794 -18
  31. package/utils/addAuth.js +94 -0
  32. package/utils/artifactize.js +9 -14
  33. package/utils/basicGet.js +50 -0
  34. package/utils/checkMigrate.js +63 -0
  35. package/utils/entitiesToDB.js +224 -0
  36. package/utils/findPath.js +74 -0
  37. package/utils/modify.js +154 -0
  38. package/utils/packModificationScript.js +1 -1
  39. package/utils/patches2bundledDeps.js +90 -0
  40. package/utils/pre-commit.sh +1 -1
  41. package/utils/removeHooks.js +20 -0
  42. package/utils/tbScript.js +169 -0
  43. package/utils/tbUtils.js +464 -0
  44. package/utils/troubleshootingAdapter.js +190 -0
  45. package/gl-code-quality-report.json +0 -1
@@ -23,7 +23,7 @@ const anything = td.matchers.anything();
23
23
  let logLevel = 'none';
24
24
  const stub = true;
25
25
  const isRapidFail = false;
26
- const attemptTimeout = 120000;
26
+ const attemptTimeout = 600000;
27
27
 
28
28
  // these variables can be changed to run in integrated mode so easier to set them here
29
29
  // always check these in with bogus data!!!
@@ -51,6 +51,7 @@ global.pronghornProps = {
51
51
  base_path: '',
52
52
  version: '',
53
53
  cache_location: '',
54
+ encode_pathvars: true,
54
55
  save_metric: false,
55
56
  protocol,
56
57
  stub,
@@ -63,11 +64,16 @@ global.pronghornProps = {
63
64
  token_cache: 'local',
64
65
  invalid_token_error: 401,
65
66
  auth_field: 'header.headers.Authorization',
66
- auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
67
+ auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
68
+ auth_logging: false,
69
+ client_id: '',
70
+ client_secret: '',
71
+ grant_type: ''
67
72
  },
68
73
  healthcheck: {
69
74
  type: 'startup',
70
- frequency: 60000
75
+ frequency: 60000,
76
+ query_object: {}
71
77
  },
72
78
  throttle: {
73
79
  throttle_enabled: false,
@@ -76,7 +82,13 @@ global.pronghornProps = {
76
82
  max_in_queue: 1000,
77
83
  concurrent_max: 1,
78
84
  expire_timeout: 0,
79
- avg_runtime: 200
85
+ avg_runtime: 200,
86
+ priorities: [
87
+ {
88
+ value: 0,
89
+ percent: 100
90
+ }
91
+ ]
80
92
  },
81
93
  request: {
82
94
  number_redirects: 0,
@@ -92,13 +104,16 @@ global.pronghornProps = {
92
104
  },
93
105
  healthcheck_on_timeout: false,
94
106
  return_raw: true,
95
- archiving: false
107
+ archiving: false,
108
+ return_request: false
96
109
  },
97
110
  proxy: {
98
111
  enabled: false,
99
112
  host: '',
100
113
  port: 1,
101
- protocol: 'http'
114
+ protocol: 'http',
115
+ username: '',
116
+ password: ''
102
117
  },
103
118
  ssl: {
104
119
  ecdhCurve: '',
@@ -161,7 +176,7 @@ process.argv.forEach((val) => {
161
176
  });
162
177
 
163
178
  // need to set global logging
164
- global.log = new (winston.Logger)({
179
+ global.log = winston.createLogger({
165
180
  level: logLevel,
166
181
  levels: myCustomLevels.levels,
167
182
  transports: [
@@ -185,9 +200,8 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
185
200
  assert.equal(displayStr, error.IAPerror.displayString);
186
201
  }
187
202
 
188
-
189
203
  // require the adapter that we are going to be using
190
- const DnaCenter = require('../../adapter.js');
204
+ const DnaCenter = require('../../adapter');
191
205
 
192
206
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
193
207
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -229,6 +243,8 @@ describe('[unit] Dna_center Adapter Test', () => {
229
243
  try {
230
244
  assert.notEqual(null, a);
231
245
  assert.notEqual(undefined, a);
246
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
247
+ assert.equal(checkId, a.id);
232
248
  assert.notEqual(null, a.allProps);
233
249
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
234
250
  assert.equal(check, a.healthcheckType);
@@ -255,10 +271,10 @@ describe('[unit] Dna_center Adapter Test', () => {
255
271
  });
256
272
 
257
273
  let wffunctions = [];
258
- describe('#getWorkflowFunctions', () => {
274
+ describe('#iapGetAdapterWorkflowFunctions', () => {
259
275
  it('should retrieve workflow functions', (done) => {
260
276
  try {
261
- wffunctions = a.getWorkflowFunctions();
277
+ wffunctions = a.iapGetAdapterWorkflowFunctions([]);
262
278
 
263
279
  try {
264
280
  assert.notEqual(0, wffunctions.length);
@@ -310,13 +326,103 @@ describe('[unit] Dna_center Adapter Test', () => {
310
326
  done(error);
311
327
  }
312
328
  });
313
- it('package.json should be customized', (done) => {
329
+ it('package.json standard fields should be customized', (done) => {
314
330
  try {
315
331
  const packageDotJson = require('../../package.json');
316
332
  assert.notEqual(-1, packageDotJson.name.indexOf('dna_center'));
317
333
  assert.notEqual(undefined, packageDotJson.version);
318
334
  assert.notEqual(null, packageDotJson.version);
319
335
  assert.notEqual('', packageDotJson.version);
336
+ assert.notEqual(undefined, packageDotJson.description);
337
+ assert.notEqual(null, packageDotJson.description);
338
+ assert.notEqual('', packageDotJson.description);
339
+ assert.equal('adapter.js', packageDotJson.main);
340
+ assert.notEqual(undefined, packageDotJson.wizardVersion);
341
+ assert.notEqual(null, packageDotJson.wizardVersion);
342
+ assert.notEqual('', packageDotJson.wizardVersion);
343
+ assert.notEqual(undefined, packageDotJson.engineVersion);
344
+ assert.notEqual(null, packageDotJson.engineVersion);
345
+ assert.notEqual('', packageDotJson.engineVersion);
346
+ assert.equal('http', packageDotJson.adapterType);
347
+ done();
348
+ } catch (error) {
349
+ log.error(`Test Failure: ${error}`);
350
+ done(error);
351
+ }
352
+ });
353
+ it('package.json proper scripts should be provided', (done) => {
354
+ try {
355
+ const packageDotJson = require('../../package.json');
356
+ assert.notEqual(undefined, packageDotJson.scripts);
357
+ assert.notEqual(null, packageDotJson.scripts);
358
+ assert.notEqual('', packageDotJson.scripts);
359
+ assert.equal('node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions', packageDotJson.scripts.preinstall);
360
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
361
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
362
+ assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
363
+ assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
364
+ assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
365
+ assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
366
+ assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
367
+ assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
368
+ assert.equal('npm run deploy', packageDotJson.scripts.build);
369
+ done();
370
+ } catch (error) {
371
+ log.error(`Test Failure: ${error}`);
372
+ done(error);
373
+ }
374
+ });
375
+ it('package.json proper directories should be provided', (done) => {
376
+ try {
377
+ const packageDotJson = require('../../package.json');
378
+ assert.notEqual(undefined, packageDotJson.repository);
379
+ assert.notEqual(null, packageDotJson.repository);
380
+ assert.notEqual('', packageDotJson.repository);
381
+ assert.equal('git', packageDotJson.repository.type);
382
+ assert.equal('git@gitlab.com:itentialopensource/adapters/', packageDotJson.repository.url.substring(0, 43));
383
+ assert.equal('https://gitlab.com/itentialopensource/adapters/', packageDotJson.homepage.substring(0, 47));
384
+ done();
385
+ } catch (error) {
386
+ log.error(`Test Failure: ${error}`);
387
+ done(error);
388
+ }
389
+ });
390
+ it('package.json proper dependencies should be provided', (done) => {
391
+ try {
392
+ const packageDotJson = require('../../package.json');
393
+ assert.notEqual(undefined, packageDotJson.dependencies);
394
+ assert.notEqual(null, packageDotJson.dependencies);
395
+ assert.notEqual('', packageDotJson.dependencies);
396
+ assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
397
+ assert.equal('^0.21.0', packageDotJson.dependencies.axios);
398
+ assert.equal('^2.20.0', packageDotJson.dependencies.commander);
399
+ assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
400
+ assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
401
+ assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
402
+ assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
403
+ assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
404
+ assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
405
+ assert.equal('^7.3.2', packageDotJson.dependencies.semver);
406
+ assert.equal('^3.3.3', packageDotJson.dependencies.winston);
407
+ done();
408
+ } catch (error) {
409
+ log.error(`Test Failure: ${error}`);
410
+ done(error);
411
+ }
412
+ });
413
+ it('package.json proper dev dependencies should be provided', (done) => {
414
+ try {
415
+ const packageDotJson = require('../../package.json');
416
+ assert.notEqual(undefined, packageDotJson.devDependencies);
417
+ assert.notEqual(null, packageDotJson.devDependencies);
418
+ assert.notEqual('', packageDotJson.devDependencies);
419
+ assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
420
+ assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
421
+ assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
422
+ assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
423
+ assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
424
+ assert.equal('^0.6.3', packageDotJson.devDependencies['package-json-validator']);
425
+ assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
320
426
  done();
321
427
  } catch (error) {
322
428
  log.error(`Test Failure: ${error}`);
@@ -341,8 +447,35 @@ describe('[unit] Dna_center Adapter Test', () => {
341
447
  try {
342
448
  const pronghornDotJson = require('../../pronghorn.json');
343
449
  assert.notEqual(-1, pronghornDotJson.id.indexOf('dna_center'));
450
+ assert.equal('Adapter', pronghornDotJson.type);
344
451
  assert.equal('DnaCenter', pronghornDotJson.export);
345
452
  assert.equal('Dna_center', pronghornDotJson.title);
453
+ assert.equal('adapter.js', pronghornDotJson.src);
454
+ done();
455
+ } catch (error) {
456
+ log.error(`Test Failure: ${error}`);
457
+ done(error);
458
+ }
459
+ });
460
+ it('pronghorn.json should contain generic adapter methods', (done) => {
461
+ try {
462
+ const pronghornDotJson = require('../../pronghorn.json');
463
+ assert.notEqual(undefined, pronghornDotJson.methods);
464
+ assert.notEqual(null, pronghornDotJson.methods);
465
+ assert.notEqual('', pronghornDotJson.methods);
466
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
467
+ assert.notEqual(0, pronghornDotJson.methods.length);
468
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
469
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
470
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
471
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
472
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
473
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
474
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapSuspendAdapter'));
475
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
476
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
477
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
478
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
346
479
  done();
347
480
  } catch (error) {
348
481
  log.error(`Test Failure: ${error}`);
@@ -364,7 +497,7 @@ describe('[unit] Dna_center Adapter Test', () => {
364
497
  let wfparams = [];
365
498
 
366
499
  if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
367
- const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.indexOf(')'));
500
+ const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
368
501
  wfparams = temp.split(',');
369
502
 
370
503
  for (let t = 0; t < wfparams.length; t += 1) {
@@ -481,6 +614,123 @@ describe('[unit] Dna_center Adapter Test', () => {
481
614
  try {
482
615
  const propertiesDotJson = require('../../propertiesSchema.json');
483
616
  assert.equal('adapter-dna_center', propertiesDotJson.$id);
617
+ assert.equal('object', propertiesDotJson.type);
618
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
619
+ done();
620
+ } catch (error) {
621
+ log.error(`Test Failure: ${error}`);
622
+ done(error);
623
+ }
624
+ });
625
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
626
+ try {
627
+ const propertiesDotJson = require('../../propertiesSchema.json');
628
+ assert.notEqual(undefined, propertiesDotJson.properties);
629
+ assert.notEqual(null, propertiesDotJson.properties);
630
+ assert.notEqual('', propertiesDotJson.properties);
631
+ assert.equal('string', propertiesDotJson.properties.host.type);
632
+ assert.equal('integer', propertiesDotJson.properties.port.type);
633
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
634
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
635
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
636
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
637
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
638
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
639
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
640
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
641
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
642
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
643
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
644
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
645
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
646
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
647
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
648
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
649
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
650
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
651
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
652
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
653
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
654
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
655
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
656
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
657
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
658
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
659
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
660
+ assert.equal('string', propertiesDotJson.properties.version.type);
661
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
662
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
663
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
664
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
665
+ assert.notEqual(undefined, propertiesDotJson.definitions);
666
+ assert.notEqual(null, propertiesDotJson.definitions);
667
+ assert.notEqual('', propertiesDotJson.definitions);
668
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
669
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
670
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
671
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
672
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
673
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
674
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
675
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
676
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
677
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
678
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
679
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
680
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
681
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
682
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
683
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
684
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
685
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
686
+ assert.notEqual(null, propertiesDotJson.definitions.request);
687
+ assert.notEqual('', propertiesDotJson.definitions.request);
688
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
689
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
690
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
691
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
692
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
693
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
694
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
695
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
696
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
697
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
698
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
699
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
700
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
701
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
702
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
703
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
704
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
705
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
706
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
707
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
708
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
709
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
710
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
711
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
712
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
713
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
714
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
715
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
716
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
717
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
718
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
719
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
720
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
721
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
722
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
723
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
724
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
725
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
726
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
727
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
728
+ assert.notEqual('', propertiesDotJson.definitions.devicebroker);
729
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
730
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
731
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
732
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
733
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
484
734
  done();
485
735
  } catch (error) {
486
736
  log.error(`Test Failure: ${error}`);
@@ -501,6 +751,50 @@ describe('[unit] Dna_center Adapter Test', () => {
501
751
  done(error);
502
752
  }
503
753
  });
754
+ it('error.json should have standard adapter errors', (done) => {
755
+ try {
756
+ const errorDotJson = require('../../error.json');
757
+ assert.notEqual(undefined, errorDotJson.errors);
758
+ assert.notEqual(null, errorDotJson.errors);
759
+ assert.notEqual('', errorDotJson.errors);
760
+ assert.equal(true, Array.isArray(errorDotJson.errors));
761
+ assert.notEqual(0, errorDotJson.errors.length);
762
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
763
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
764
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
765
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
766
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
767
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
768
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
769
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
770
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
771
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
772
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
773
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
774
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
775
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
776
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
777
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
778
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
779
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
780
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
781
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
782
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
783
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
784
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
785
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
786
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
787
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
788
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
789
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
790
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
791
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
792
+ done();
793
+ } catch (error) {
794
+ log.error(`Test Failure: ${error}`);
795
+ done(error);
796
+ }
797
+ });
504
798
  });
505
799
 
506
800
  describe('sampleProperties.json', () => {
@@ -515,6 +809,119 @@ describe('[unit] Dna_center Adapter Test', () => {
515
809
  done(error);
516
810
  }
517
811
  });
812
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
813
+ try {
814
+ const sampleDotJson = require('../../sampleProperties.json');
815
+ assert.notEqual(-1, sampleDotJson.id.indexOf('dna_center'));
816
+ assert.equal('DnaCenter', sampleDotJson.type);
817
+ assert.notEqual(undefined, sampleDotJson.properties);
818
+ assert.notEqual(null, sampleDotJson.properties);
819
+ assert.notEqual('', sampleDotJson.properties);
820
+ assert.notEqual(undefined, sampleDotJson.properties.host);
821
+ assert.notEqual(undefined, sampleDotJson.properties.port);
822
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
823
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
824
+ assert.notEqual(null, sampleDotJson.properties.authentication);
825
+ assert.notEqual('', sampleDotJson.properties.authentication);
826
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
827
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
828
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
829
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
830
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
831
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
832
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
833
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
834
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
835
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
836
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
837
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
838
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
839
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
840
+ assert.notEqual(null, sampleDotJson.properties.ssl);
841
+ assert.notEqual('', sampleDotJson.properties.ssl);
842
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
843
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
844
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
845
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
846
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
847
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
848
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
849
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
850
+
851
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
852
+ assert.notEqual(undefined, sampleDotJson.properties.version);
853
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
854
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
855
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
856
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
857
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
858
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
859
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
860
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
861
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
862
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
863
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
864
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
865
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
866
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
867
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
868
+ assert.notEqual(null, sampleDotJson.properties.throttle);
869
+ assert.notEqual('', sampleDotJson.properties.throttle);
870
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
871
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
872
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
873
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
874
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
875
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
876
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
877
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
878
+ assert.notEqual(undefined, sampleDotJson.properties.request);
879
+ assert.notEqual(null, sampleDotJson.properties.request);
880
+ assert.notEqual('', sampleDotJson.properties.request);
881
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
882
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
883
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
884
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
885
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
886
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
887
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
888
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
889
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
890
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
891
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
892
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
893
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
894
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
895
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
896
+ assert.notEqual(null, sampleDotJson.properties.proxy);
897
+ assert.notEqual('', sampleDotJson.properties.proxy);
898
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
899
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
900
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
901
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
902
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
903
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
904
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
905
+ assert.notEqual(null, sampleDotJson.properties.mongo);
906
+ assert.notEqual('', sampleDotJson.properties.mongo);
907
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
908
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
909
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
910
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
911
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
912
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
913
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
914
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
915
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
916
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
917
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
918
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
919
+ done();
920
+ } catch (error) {
921
+ log.error(`Test Failure: ${error}`);
922
+ done(error);
923
+ }
924
+ });
518
925
  });
519
926
 
520
927
  describe('#checkProperties', () => {
@@ -602,6 +1009,148 @@ describe('[unit] Dna_center Adapter Test', () => {
602
1009
  });
603
1010
  });
604
1011
 
1012
+ describe('#iapUpdateAdapterConfiguration', () => {
1013
+ it('should have a iapUpdateAdapterConfiguration function', (done) => {
1014
+ try {
1015
+ assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
1016
+ done();
1017
+ } catch (error) {
1018
+ log.error(`Test Failure: ${error}`);
1019
+ done(error);
1020
+ }
1021
+ });
1022
+ });
1023
+
1024
+ describe('#iapFindAdapterPath', () => {
1025
+ it('should have a iapFindAdapterPath function', (done) => {
1026
+ try {
1027
+ assert.equal(true, typeof a.iapFindAdapterPath === 'function');
1028
+ done();
1029
+ } catch (error) {
1030
+ log.error(`Test Failure: ${error}`);
1031
+ done(error);
1032
+ }
1033
+ });
1034
+ it('iapFindAdapterPath should find atleast one path that matches', (done) => {
1035
+ try {
1036
+ a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
1037
+ try {
1038
+ assert.equal(undefined, error);
1039
+ assert.notEqual(undefined, data);
1040
+ assert.notEqual(null, data);
1041
+ assert.equal(true, data.found);
1042
+ assert.notEqual(undefined, data.foundIn);
1043
+ assert.notEqual(null, data.foundIn);
1044
+ assert.notEqual(0, data.foundIn.length);
1045
+ done();
1046
+ } catch (err) {
1047
+ log.error(`Test Failure: ${err}`);
1048
+ done(err);
1049
+ }
1050
+ });
1051
+ } catch (error) {
1052
+ log.error(`Adapter Exception: ${error}`);
1053
+ done(error);
1054
+ }
1055
+ }).timeout(attemptTimeout);
1056
+ });
1057
+
1058
+ describe('#iapSuspendAdapter', () => {
1059
+ it('should have a iapSuspendAdapter function', (done) => {
1060
+ try {
1061
+ assert.equal(true, typeof a.iapSuspendAdapter === 'function');
1062
+ done();
1063
+ } catch (error) {
1064
+ log.error(`Test Failure: ${error}`);
1065
+ done(error);
1066
+ }
1067
+ });
1068
+ });
1069
+
1070
+ describe('#iapUnsuspendAdapter', () => {
1071
+ it('should have a iapUnsuspendAdapter function', (done) => {
1072
+ try {
1073
+ assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
1074
+ done();
1075
+ } catch (error) {
1076
+ log.error(`Test Failure: ${error}`);
1077
+ done(error);
1078
+ }
1079
+ });
1080
+ });
1081
+
1082
+ describe('#iapGetAdapterQueue', () => {
1083
+ it('should have a iapGetAdapterQueue function', (done) => {
1084
+ try {
1085
+ assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
1086
+ done();
1087
+ } catch (error) {
1088
+ log.error(`Test Failure: ${error}`);
1089
+ done(error);
1090
+ }
1091
+ });
1092
+ });
1093
+
1094
+ describe('#iapTroubleshootAdapter', () => {
1095
+ it('should have a iapTroubleshootAdapter function', (done) => {
1096
+ try {
1097
+ assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
1098
+ done();
1099
+ } catch (error) {
1100
+ log.error(`Test Failure: ${error}`);
1101
+ done(error);
1102
+ }
1103
+ });
1104
+ });
1105
+
1106
+ describe('#iapRunAdapterHealthcheck', () => {
1107
+ it('should have a iapRunAdapterHealthcheck function', (done) => {
1108
+ try {
1109
+ assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
1110
+ done();
1111
+ } catch (error) {
1112
+ log.error(`Test Failure: ${error}`);
1113
+ done(error);
1114
+ }
1115
+ });
1116
+ });
1117
+
1118
+ describe('#iapRunAdapterConnectivity', () => {
1119
+ it('should have a iapRunAdapterConnectivity function', (done) => {
1120
+ try {
1121
+ assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
1122
+ done();
1123
+ } catch (error) {
1124
+ log.error(`Test Failure: ${error}`);
1125
+ done(error);
1126
+ }
1127
+ });
1128
+ });
1129
+
1130
+ describe('#iapRunAdapterBasicGet', () => {
1131
+ it('should have a iapRunAdapterBasicGet function', (done) => {
1132
+ try {
1133
+ assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
1134
+ done();
1135
+ } catch (error) {
1136
+ log.error(`Test Failure: ${error}`);
1137
+ done(error);
1138
+ }
1139
+ });
1140
+ });
1141
+
1142
+ describe('#iapMoveAdapterEntitiesToDB', () => {
1143
+ it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
1144
+ try {
1145
+ assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
1146
+ done();
1147
+ } catch (error) {
1148
+ log.error(`Test Failure: ${error}`);
1149
+ done(error);
1150
+ }
1151
+ });
1152
+ });
1153
+
605
1154
  describe('#checkActionFiles', () => {
606
1155
  it('should have a checkActionFiles function', (done) => {
607
1156
  try {
@@ -687,10 +1236,10 @@ describe('[unit] Dna_center Adapter Test', () => {
687
1236
  }).timeout(attemptTimeout);
688
1237
  });
689
1238
 
690
- // describe('#hasEntity', () => {
691
- // it('should have a hasEntity function', (done) => {
1239
+ // describe('#iapHasAdapterEntity', () => {
1240
+ // it('should have a iapHasAdapterEntity function', (done) => {
692
1241
  // try {
693
- // assert.equal(true, typeof a.hasEntity === 'function');
1242
+ // assert.equal(true, typeof a.iapHasAdapterEntity === 'function');
694
1243
  // done();
695
1244
  // } catch (error) {
696
1245
  // log.error(`Test Failure: ${error}`);
@@ -699,7 +1248,7 @@ describe('[unit] Dna_center Adapter Test', () => {
699
1248
  // });
700
1249
  // it('should find entity', (done) => {
701
1250
  // try {
702
- // a.hasEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
1251
+ // a.iapHasAdapterEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
703
1252
  // try {
704
1253
  // assert.equal(true, data[0]);
705
1254
  // done();
@@ -715,7 +1264,7 @@ describe('[unit] Dna_center Adapter Test', () => {
715
1264
  // }).timeout(attemptTimeout);
716
1265
  // it('should not find entity', (done) => {
717
1266
  // try {
718
- // a.hasEntity('template_entity', 'blah', (data) => {
1267
+ // a.iapHasAdapterEntity('template_entity', 'blah', (data) => {
719
1268
  // try {
720
1269
  // assert.equal(false, data[0]);
721
1270
  // done();
@@ -731,6 +1280,90 @@ describe('[unit] Dna_center Adapter Test', () => {
731
1280
  // }).timeout(attemptTimeout);
732
1281
  // });
733
1282
 
1283
+ describe('#hasEntities', () => {
1284
+ it('should have a hasEntities function', (done) => {
1285
+ try {
1286
+ assert.equal(true, typeof a.hasEntities === 'function');
1287
+ done();
1288
+ } catch (error) {
1289
+ log.error(`Test Failure: ${error}`);
1290
+ done(error);
1291
+ }
1292
+ });
1293
+ });
1294
+
1295
+ describe('#hasDevices', () => {
1296
+ it('should have a hasDevices function', (done) => {
1297
+ try {
1298
+ assert.equal(true, typeof a.hasDevices === 'function');
1299
+ done();
1300
+ } catch (error) {
1301
+ log.error(`Test Failure: ${error}`);
1302
+ done(error);
1303
+ }
1304
+ });
1305
+ });
1306
+
1307
+ describe('#getDevice', () => {
1308
+ it('should have a getDevice function', (done) => {
1309
+ try {
1310
+ assert.equal(true, typeof a.getDevice === 'function');
1311
+ done();
1312
+ } catch (error) {
1313
+ log.error(`Test Failure: ${error}`);
1314
+ done(error);
1315
+ }
1316
+ });
1317
+ });
1318
+
1319
+ describe('#getDevicesFiltered', () => {
1320
+ it('should have a getDevicesFiltered function', (done) => {
1321
+ try {
1322
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1323
+ done();
1324
+ } catch (error) {
1325
+ log.error(`Test Failure: ${error}`);
1326
+ done(error);
1327
+ }
1328
+ });
1329
+ });
1330
+
1331
+ describe('#isAlive', () => {
1332
+ it('should have a isAlive function', (done) => {
1333
+ try {
1334
+ assert.equal(true, typeof a.isAlive === 'function');
1335
+ done();
1336
+ } catch (error) {
1337
+ log.error(`Test Failure: ${error}`);
1338
+ done(error);
1339
+ }
1340
+ });
1341
+ });
1342
+
1343
+ describe('#getConfig', () => {
1344
+ it('should have a getConfig function', (done) => {
1345
+ try {
1346
+ assert.equal(true, typeof a.getConfig === 'function');
1347
+ done();
1348
+ } catch (error) {
1349
+ log.error(`Test Failure: ${error}`);
1350
+ done(error);
1351
+ }
1352
+ });
1353
+ });
1354
+
1355
+ describe('#iapGetDeviceCount', () => {
1356
+ it('should have a iapGetDeviceCount function', (done) => {
1357
+ try {
1358
+ assert.equal(true, typeof a.iapGetDeviceCount === 'function');
1359
+ done();
1360
+ } catch (error) {
1361
+ log.error(`Test Failure: ${error}`);
1362
+ done(error);
1363
+ }
1364
+ });
1365
+ });
1366
+
734
1367
  /*
735
1368
  -----------------------------------------------------------------------
736
1369
  -----------------------------------------------------------------------
@@ -5408,6 +6041,149 @@ describe('[unit] Dna_center Adapter Test', () => {
5408
6041
  }).timeout(attemptTimeout);
5409
6042
  });
5410
6043
 
6044
+ describe('#postDnasystemapiv1sitesiteIddevice - errors', () => {
6045
+ it('should have a postDnasystemapiv1sitesiteIddevice function', (done) => {
6046
+ try {
6047
+ assert.equal(true, typeof a.postDnasystemapiv1sitesiteIddevice === 'function');
6048
+ done();
6049
+ } catch (error) {
6050
+ log.error(`Test Failure: ${error}`);
6051
+ done(error);
6052
+ }
6053
+ }).timeout(attemptTimeout);
6054
+ it('should error if - missing request', (done) => {
6055
+ try {
6056
+ a.postDnasystemapiv1sitesiteIddevice(null, null, null, null, null, (data, error) => {
6057
+ try {
6058
+ const displayE = 'request is required';
6059
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnasystemapiv1sitesiteIddevice', displayE);
6060
+ done();
6061
+ } catch (err) {
6062
+ log.error(`Test Failure: ${err}`);
6063
+ done(err);
6064
+ }
6065
+ });
6066
+ } catch (error) {
6067
+ log.error(`Adapter Exception: ${error}`);
6068
+ done(error);
6069
+ }
6070
+ }).timeout(attemptTimeout);
6071
+ it('should error if - missing Runsync', (done) => {
6072
+ try {
6073
+ a.postDnasystemapiv1sitesiteIddevice('fakeparam', null, null, null, null, (data, error) => {
6074
+ try {
6075
+ const displayE = 'Runsync is required';
6076
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnasystemapiv1sitesiteIddevice', displayE);
6077
+ done();
6078
+ } catch (err) {
6079
+ log.error(`Test Failure: ${err}`);
6080
+ done(err);
6081
+ }
6082
+ });
6083
+ } catch (error) {
6084
+ log.error(`Adapter Exception: ${error}`);
6085
+ done(error);
6086
+ }
6087
+ }).timeout(attemptTimeout);
6088
+ it('should error if - missing Persistbapioutput', (done) => {
6089
+ try {
6090
+ a.postDnasystemapiv1sitesiteIddevice('fakeparam', 'fakeparam', null, null, null, (data, error) => {
6091
+ try {
6092
+ const displayE = 'Persistbapioutput is required';
6093
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnasystemapiv1sitesiteIddevice', displayE);
6094
+ done();
6095
+ } catch (err) {
6096
+ log.error(`Test Failure: ${err}`);
6097
+ done(err);
6098
+ }
6099
+ });
6100
+ } catch (error) {
6101
+ log.error(`Adapter Exception: ${error}`);
6102
+ done(error);
6103
+ }
6104
+ }).timeout(attemptTimeout);
6105
+ it('should error if - missing siteId', (done) => {
6106
+ try {
6107
+ a.postDnasystemapiv1sitesiteIddevice('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
6108
+ try {
6109
+ const displayE = 'siteId is required';
6110
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnasystemapiv1sitesiteIddevice', displayE);
6111
+ done();
6112
+ } catch (err) {
6113
+ log.error(`Test Failure: ${err}`);
6114
+ done(err);
6115
+ }
6116
+ });
6117
+ } catch (error) {
6118
+ log.error(`Adapter Exception: ${error}`);
6119
+ done(error);
6120
+ }
6121
+ }).timeout(attemptTimeout);
6122
+ });
6123
+
6124
+ describe('#postDnaintentapiv1site - errors', () => {
6125
+ it('should have a postDnaintentapiv1site function', (done) => {
6126
+ try {
6127
+ assert.equal(true, typeof a.postDnaintentapiv1site === 'function');
6128
+ done();
6129
+ } catch (error) {
6130
+ log.error(`Test Failure: ${error}`);
6131
+ done(error);
6132
+ }
6133
+ }).timeout(attemptTimeout);
6134
+ it('should error if - missing request', (done) => {
6135
+ try {
6136
+ a.postDnaintentapiv1site(null, null, null, null, (data, error) => {
6137
+ try {
6138
+ const displayE = 'request is required';
6139
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnaintentapiv1site', displayE);
6140
+ done();
6141
+ } catch (err) {
6142
+ log.error(`Test Failure: ${err}`);
6143
+ done(err);
6144
+ }
6145
+ });
6146
+ } catch (error) {
6147
+ log.error(`Adapter Exception: ${error}`);
6148
+ done(error);
6149
+ }
6150
+ }).timeout(attemptTimeout);
6151
+ it('should error if - missing Runsync', (done) => {
6152
+ try {
6153
+ a.postDnaintentapiv1site('fakeparam', null, null, null, (data, error) => {
6154
+ try {
6155
+ const displayE = 'Runsync is required';
6156
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnaintentapiv1site', displayE);
6157
+ done();
6158
+ } catch (err) {
6159
+ log.error(`Test Failure: ${err}`);
6160
+ done(err);
6161
+ }
6162
+ });
6163
+ } catch (error) {
6164
+ log.error(`Adapter Exception: ${error}`);
6165
+ done(error);
6166
+ }
6167
+ }).timeout(attemptTimeout);
6168
+ it('should error if - missing Persistbapioutput', (done) => {
6169
+ try {
6170
+ a.postDnaintentapiv1site('fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
6171
+ try {
6172
+ const displayE = 'Persistbapioutput is required';
6173
+ runErrorAsserts(data, error, 'AD.300', 'Test-dna_center-adapter-postDnaintentapiv1site', displayE);
6174
+ done();
6175
+ } catch (err) {
6176
+ log.error(`Test Failure: ${err}`);
6177
+ done(err);
6178
+ }
6179
+ });
6180
+ } catch (error) {
6181
+ log.error(`Adapter Exception: ${error}`);
6182
+ done(error);
6183
+ }
6184
+ }).timeout(attemptTimeout);
6185
+ });
6186
+
5411
6187
  describe('#postDnasystemapiv1site - errors', () => {
5412
6188
  it('should have a postDnasystemapiv1site function', (done) => {
5413
6189
  try {