@itentialopensource/adapter-128technology 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +246 -65
  5. package/adapter.js +12003 -20
  6. package/adapterBase.js +529 -9
  7. package/entities/.generic/action.json +109 -0
  8. package/entities/.generic/schema.json +23 -0
  9. package/entities/.system/action.json +1 -0
  10. package/entities/Analytics/action.json +2 -0
  11. package/entities/Asset/action.json +1 -0
  12. package/entities/Authenticate/action.json +1 -0
  13. package/entities/Config/action.json +505 -0
  14. package/entities/Plugins/action.json +2 -0
  15. package/entities/Router/action.json +1 -0
  16. package/entities/Stats/action.json +1037 -0
  17. package/error.json +6 -0
  18. package/package.json +41 -19
  19. package/pronghorn.json +571 -1
  20. package/propertiesSchema.json +56 -4
  21. package/refs?service=git-upload-pack +0 -0
  22. package/report/updateReport1593633611696.json +95 -0
  23. package/report/updateReport1614264802205.json +95 -0
  24. package/report/updateReport1642429912446.json +95 -0
  25. package/sampleProperties.json +14 -5
  26. package/test/integration/adapterTestBasicGet.js +85 -0
  27. package/test/integration/adapterTestConnectivity.js +93 -0
  28. package/test/integration/adapterTestIntegration.js +21 -8
  29. package/test/unit/adapterBaseTestUnit.js +944 -0
  30. package/test/unit/adapterTestUnit.js +632 -12
  31. package/utils/addAuth.js +94 -0
  32. package/utils/artifactize.js +0 -1
  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/removeHooks.js +20 -0
  41. package/utils/tbScript.js +169 -0
  42. package/utils/tbUtils.js +451 -0
  43. package/utils/troubleshootingAdapter.js +190 -0
@@ -51,6 +51,7 @@ global.pronghornProps = {
51
51
  base_path: '/',
52
52
  version: 'v1',
53
53
  cache_location: 'none',
54
+ encode_pathvars: true,
54
55
  save_metric: false,
55
56
  stub,
56
57
  protocol,
@@ -63,11 +64,16 @@ global.pronghornProps = {
63
64
  token_timeout: -1,
64
65
  token_cache: 'local',
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,
@@ -98,13 +104,16 @@ global.pronghornProps = {
98
104
  },
99
105
  healthcheck_on_timeout: true,
100
106
  return_raw: true,
101
- archiving: false
107
+ archiving: false,
108
+ return_request: false
102
109
  },
103
110
  proxy: {
104
111
  enabled: false,
105
112
  host: '',
106
113
  port: 1,
107
- protocol: 'http'
114
+ protocol: 'http',
115
+ username: '',
116
+ password: ''
108
117
  },
109
118
  ssl: {
110
119
  ecdhCurve: '',
@@ -191,9 +200,8 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
191
200
  assert.equal(displayStr, error.IAPerror.displayString);
192
201
  }
193
202
 
194
-
195
203
  // require the adapter that we are going to be using
196
- const Technology128 = require('../../adapter.js');
204
+ const Technology = require('../../adapter');
197
205
 
198
206
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
199
207
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -208,8 +216,8 @@ if (fs.existsSync(dirPath)) {
208
216
 
209
217
  // begin the testing - these should be pretty well defined between the describe and the it!
210
218
  describe('[unit] 128technology Adapter Test', () => {
211
- describe('128technology Class Tests', () => {
212
- const a = new Technology128(
219
+ describe('Technology Class Tests', () => {
220
+ const a = new Technology(
213
221
  pronghornProps.adapterProps.adapters[0].id,
214
222
  pronghornProps.adapterProps.adapters[0].properties
215
223
  );
@@ -235,6 +243,8 @@ describe('[unit] 128technology Adapter Test', () => {
235
243
  try {
236
244
  assert.notEqual(null, a);
237
245
  assert.notEqual(undefined, a);
246
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
247
+ assert.equal(checkId, a.id);
238
248
  assert.notEqual(null, a.allProps);
239
249
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
240
250
  assert.equal(check, a.healthcheckType);
@@ -264,7 +274,7 @@ describe('[unit] 128technology Adapter Test', () => {
264
274
  describe('#getWorkflowFunctions', () => {
265
275
  it('should retrieve workflow functions', (done) => {
266
276
  try {
267
- wffunctions = a.getWorkflowFunctions();
277
+ wffunctions = a.getWorkflowFunctions([]);
268
278
 
269
279
  try {
270
280
  assert.notEqual(0, wffunctions.length);
@@ -316,13 +326,103 @@ describe('[unit] 128technology Adapter Test', () => {
316
326
  done(error);
317
327
  }
318
328
  });
319
- it('package.json should be customized', (done) => {
329
+ it('package.json standard fields should be customized', (done) => {
320
330
  try {
321
331
  const packageDotJson = require('../../package.json');
322
332
  assert.notEqual(-1, packageDotJson.name.indexOf('128technology'));
323
333
  assert.notEqual(undefined, packageDotJson.version);
324
334
  assert.notEqual(null, packageDotJson.version);
325
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);
326
426
  done();
327
427
  } catch (error) {
328
428
  log.error(`Test Failure: ${error}`);
@@ -347,8 +447,34 @@ describe('[unit] 128technology Adapter Test', () => {
347
447
  try {
348
448
  const pronghornDotJson = require('../../pronghorn.json');
349
449
  assert.notEqual(-1, pronghornDotJson.id.indexOf('128technology'));
350
- assert.equal('128technology', pronghornDotJson.export);
450
+ assert.equal('Adapter', pronghornDotJson.type);
451
+ assert.equal('Technology', pronghornDotJson.export);
351
452
  assert.equal('128technology', 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 === 'updateAdapterConfiguration'));
469
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'findPath'));
470
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'troubleshoot'));
471
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runHealthcheck'));
472
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runConnectivity'));
473
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runBasicGet'));
474
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'suspend'));
475
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'unsuspend'));
476
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getQueue'));
477
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
352
478
  done();
353
479
  } catch (error) {
354
480
  log.error(`Test Failure: ${error}`);
@@ -370,7 +496,7 @@ describe('[unit] 128technology Adapter Test', () => {
370
496
  let wfparams = [];
371
497
 
372
498
  if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
373
- const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.indexOf(')'));
499
+ const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
374
500
  wfparams = temp.split(',');
375
501
 
376
502
  for (let t = 0; t < wfparams.length; t += 1) {
@@ -487,6 +613,117 @@ describe('[unit] 128technology Adapter Test', () => {
487
613
  try {
488
614
  const propertiesDotJson = require('../../propertiesSchema.json');
489
615
  assert.equal('adapter-128technology', propertiesDotJson.$id);
616
+ assert.equal('object', propertiesDotJson.type);
617
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
618
+ done();
619
+ } catch (error) {
620
+ log.error(`Test Failure: ${error}`);
621
+ done(error);
622
+ }
623
+ });
624
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
625
+ try {
626
+ const propertiesDotJson = require('../../propertiesSchema.json');
627
+ assert.notEqual(undefined, propertiesDotJson.properties);
628
+ assert.notEqual(null, propertiesDotJson.properties);
629
+ assert.notEqual('', propertiesDotJson.properties);
630
+ assert.equal('string', propertiesDotJson.properties.host.type);
631
+ assert.equal('integer', propertiesDotJson.properties.port.type);
632
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
633
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
634
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
635
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
636
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
637
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
638
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
639
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
640
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
641
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
642
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
643
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
644
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
645
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
646
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
647
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
648
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
649
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
650
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
651
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
652
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
653
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
654
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
655
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
656
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
657
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
658
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
659
+ assert.equal('string', propertiesDotJson.properties.version.type);
660
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
661
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
662
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
663
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
664
+ assert.notEqual(undefined, propertiesDotJson.definitions);
665
+ assert.notEqual(null, propertiesDotJson.definitions);
666
+ assert.notEqual('', propertiesDotJson.definitions);
667
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
668
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
669
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
670
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
671
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
672
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
673
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
674
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
675
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
676
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
677
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
678
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
679
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
680
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
681
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
682
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
683
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
684
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
685
+ assert.notEqual(null, propertiesDotJson.definitions.request);
686
+ assert.notEqual('', propertiesDotJson.definitions.request);
687
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
688
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
689
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
690
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
691
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
692
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
693
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
694
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
695
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
696
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
697
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
698
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
699
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
700
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
701
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
702
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
703
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
704
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
705
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
706
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
707
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
708
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
709
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
710
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
711
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
712
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
713
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
714
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
715
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
716
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
717
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
718
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
719
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
720
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
721
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
722
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
723
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
724
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
725
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
726
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
490
727
  done();
491
728
  } catch (error) {
492
729
  log.error(`Test Failure: ${error}`);
@@ -507,6 +744,50 @@ describe('[unit] 128technology Adapter Test', () => {
507
744
  done(error);
508
745
  }
509
746
  });
747
+ it('error.json should have standard adapter errors', (done) => {
748
+ try {
749
+ const errorDotJson = require('../../error.json');
750
+ assert.notEqual(undefined, errorDotJson.errors);
751
+ assert.notEqual(null, errorDotJson.errors);
752
+ assert.notEqual('', errorDotJson.errors);
753
+ assert.equal(true, Array.isArray(errorDotJson.errors));
754
+ assert.notEqual(0, errorDotJson.errors.length);
755
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
756
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
757
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
758
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
759
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
760
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
761
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
762
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
763
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
764
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
765
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
766
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
767
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
768
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
769
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
770
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
771
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
772
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
773
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
774
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
775
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
776
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
777
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
778
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
779
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
780
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
781
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
782
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
783
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
784
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
785
+ done();
786
+ } catch (error) {
787
+ log.error(`Test Failure: ${error}`);
788
+ done(error);
789
+ }
790
+ });
510
791
  });
511
792
 
512
793
  describe('sampleProperties.json', () => {
@@ -521,6 +802,119 @@ describe('[unit] 128technology Adapter Test', () => {
521
802
  done(error);
522
803
  }
523
804
  });
805
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
806
+ try {
807
+ const sampleDotJson = require('../../sampleProperties.json');
808
+ assert.notEqual(-1, sampleDotJson.id.indexOf('128technology'));
809
+ assert.equal('Technology', sampleDotJson.type);
810
+ assert.notEqual(undefined, sampleDotJson.properties);
811
+ assert.notEqual(null, sampleDotJson.properties);
812
+ assert.notEqual('', sampleDotJson.properties);
813
+ assert.notEqual(undefined, sampleDotJson.properties.host);
814
+ assert.notEqual(undefined, sampleDotJson.properties.port);
815
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
816
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
817
+ assert.notEqual(null, sampleDotJson.properties.authentication);
818
+ assert.notEqual('', sampleDotJson.properties.authentication);
819
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
820
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
821
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
822
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
823
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
824
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
825
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
826
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
827
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
828
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
829
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
830
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
831
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
832
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
833
+ assert.notEqual(null, sampleDotJson.properties.ssl);
834
+ assert.notEqual('', sampleDotJson.properties.ssl);
835
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
836
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
837
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
838
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
839
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
840
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
841
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
842
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
843
+
844
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
845
+ assert.notEqual(undefined, sampleDotJson.properties.version);
846
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
847
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
848
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
849
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
850
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
851
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
852
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
853
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
854
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
855
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
856
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
857
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
858
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
859
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
860
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
861
+ assert.notEqual(null, sampleDotJson.properties.throttle);
862
+ assert.notEqual('', sampleDotJson.properties.throttle);
863
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
864
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
865
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
866
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
867
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
868
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
869
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
870
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
871
+ assert.notEqual(undefined, sampleDotJson.properties.request);
872
+ assert.notEqual(null, sampleDotJson.properties.request);
873
+ assert.notEqual('', sampleDotJson.properties.request);
874
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
875
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
876
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
877
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
878
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
879
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
880
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
881
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
882
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
883
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
884
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
885
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
886
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
887
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
888
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
889
+ assert.notEqual(null, sampleDotJson.properties.proxy);
890
+ assert.notEqual('', sampleDotJson.properties.proxy);
891
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
892
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
893
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
894
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
895
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
896
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
897
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
898
+ assert.notEqual(null, sampleDotJson.properties.mongo);
899
+ assert.notEqual('', sampleDotJson.properties.mongo);
900
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
901
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
902
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
903
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
904
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
905
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
906
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
907
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
908
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
909
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
910
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
911
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
912
+ done();
913
+ } catch (error) {
914
+ log.error(`Test Failure: ${error}`);
915
+ done(error);
916
+ }
917
+ });
524
918
  });
525
919
 
526
920
  describe('#checkProperties', () => {
@@ -608,6 +1002,148 @@ describe('[unit] 128technology Adapter Test', () => {
608
1002
  });
609
1003
  });
610
1004
 
1005
+ describe('#updateAdapterConfiguration', () => {
1006
+ it('should have a updateAdapterConfiguration function', (done) => {
1007
+ try {
1008
+ assert.equal(true, typeof a.updateAdapterConfiguration === 'function');
1009
+ done();
1010
+ } catch (error) {
1011
+ log.error(`Test Failure: ${error}`);
1012
+ done(error);
1013
+ }
1014
+ });
1015
+ });
1016
+
1017
+ describe('#findPath', () => {
1018
+ it('should have a findPath function', (done) => {
1019
+ try {
1020
+ assert.equal(true, typeof a.findPath === 'function');
1021
+ done();
1022
+ } catch (error) {
1023
+ log.error(`Test Failure: ${error}`);
1024
+ done(error);
1025
+ }
1026
+ });
1027
+ it('findPath should find atleast one path that matches', (done) => {
1028
+ try {
1029
+ a.findPath('{base_path}/{version}', (data, error) => {
1030
+ try {
1031
+ assert.equal(undefined, error);
1032
+ assert.notEqual(undefined, data);
1033
+ assert.notEqual(null, data);
1034
+ assert.equal(true, data.found);
1035
+ assert.notEqual(undefined, data.foundIn);
1036
+ assert.notEqual(null, data.foundIn);
1037
+ assert.notEqual(0, data.foundIn.length);
1038
+ done();
1039
+ } catch (err) {
1040
+ log.error(`Test Failure: ${err}`);
1041
+ done(err);
1042
+ }
1043
+ });
1044
+ } catch (error) {
1045
+ log.error(`Adapter Exception: ${error}`);
1046
+ done(error);
1047
+ }
1048
+ }).timeout(attemptTimeout);
1049
+ });
1050
+
1051
+ describe('#suspend', () => {
1052
+ it('should have a suspend function', (done) => {
1053
+ try {
1054
+ assert.equal(true, typeof a.suspend === 'function');
1055
+ done();
1056
+ } catch (error) {
1057
+ log.error(`Test Failure: ${error}`);
1058
+ done(error);
1059
+ }
1060
+ });
1061
+ });
1062
+
1063
+ describe('#unsuspend', () => {
1064
+ it('should have a unsuspend function', (done) => {
1065
+ try {
1066
+ assert.equal(true, typeof a.unsuspend === 'function');
1067
+ done();
1068
+ } catch (error) {
1069
+ log.error(`Test Failure: ${error}`);
1070
+ done(error);
1071
+ }
1072
+ });
1073
+ });
1074
+
1075
+ describe('#getQueue', () => {
1076
+ it('should have a getQueue function', (done) => {
1077
+ try {
1078
+ assert.equal(true, typeof a.getQueue === 'function');
1079
+ done();
1080
+ } catch (error) {
1081
+ log.error(`Test Failure: ${error}`);
1082
+ done(error);
1083
+ }
1084
+ });
1085
+ });
1086
+
1087
+ describe('#troubleshoot', () => {
1088
+ it('should have a troubleshoot function', (done) => {
1089
+ try {
1090
+ assert.equal(true, typeof a.troubleshoot === 'function');
1091
+ done();
1092
+ } catch (error) {
1093
+ log.error(`Test Failure: ${error}`);
1094
+ done(error);
1095
+ }
1096
+ });
1097
+ });
1098
+
1099
+ describe('#runHealthcheck', () => {
1100
+ it('should have a runHealthcheck function', (done) => {
1101
+ try {
1102
+ assert.equal(true, typeof a.runHealthcheck === 'function');
1103
+ done();
1104
+ } catch (error) {
1105
+ log.error(`Test Failure: ${error}`);
1106
+ done(error);
1107
+ }
1108
+ });
1109
+ });
1110
+
1111
+ describe('#runConnectivity', () => {
1112
+ it('should have a runConnectivity function', (done) => {
1113
+ try {
1114
+ assert.equal(true, typeof a.runConnectivity === 'function');
1115
+ done();
1116
+ } catch (error) {
1117
+ log.error(`Test Failure: ${error}`);
1118
+ done(error);
1119
+ }
1120
+ });
1121
+ });
1122
+
1123
+ describe('#runBasicGet', () => {
1124
+ it('should have a runBasicGet function', (done) => {
1125
+ try {
1126
+ assert.equal(true, typeof a.runBasicGet === 'function');
1127
+ done();
1128
+ } catch (error) {
1129
+ log.error(`Test Failure: ${error}`);
1130
+ done(error);
1131
+ }
1132
+ });
1133
+ });
1134
+
1135
+ describe('#moveEntitiesToDB', () => {
1136
+ it('should have a moveEntitiesToDB function', (done) => {
1137
+ try {
1138
+ assert.equal(true, typeof a.moveEntitiesToDB === 'function');
1139
+ done();
1140
+ } catch (error) {
1141
+ log.error(`Test Failure: ${error}`);
1142
+ done(error);
1143
+ }
1144
+ });
1145
+ });
1146
+
611
1147
  describe('#checkActionFiles', () => {
612
1148
  it('should have a checkActionFiles function', (done) => {
613
1149
  try {
@@ -737,6 +1273,90 @@ describe('[unit] 128technology Adapter Test', () => {
737
1273
  // }).timeout(attemptTimeout);
738
1274
  // });
739
1275
 
1276
+ describe('#hasEntities', () => {
1277
+ it('should have a hasEntities function', (done) => {
1278
+ try {
1279
+ assert.equal(true, typeof a.hasEntities === 'function');
1280
+ done();
1281
+ } catch (error) {
1282
+ log.error(`Test Failure: ${error}`);
1283
+ done(error);
1284
+ }
1285
+ });
1286
+ });
1287
+
1288
+ describe('#hasDevices', () => {
1289
+ it('should have a hasDevices function', (done) => {
1290
+ try {
1291
+ assert.equal(true, typeof a.hasDevices === 'function');
1292
+ done();
1293
+ } catch (error) {
1294
+ log.error(`Test Failure: ${error}`);
1295
+ done(error);
1296
+ }
1297
+ });
1298
+ });
1299
+
1300
+ describe('#getDevice', () => {
1301
+ it('should have a getDevice function', (done) => {
1302
+ try {
1303
+ assert.equal(true, typeof a.getDevice === 'function');
1304
+ done();
1305
+ } catch (error) {
1306
+ log.error(`Test Failure: ${error}`);
1307
+ done(error);
1308
+ }
1309
+ });
1310
+ });
1311
+
1312
+ describe('#getDevicesFiltered', () => {
1313
+ it('should have a getDevicesFiltered function', (done) => {
1314
+ try {
1315
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1316
+ done();
1317
+ } catch (error) {
1318
+ log.error(`Test Failure: ${error}`);
1319
+ done(error);
1320
+ }
1321
+ });
1322
+ });
1323
+
1324
+ describe('#isAlive', () => {
1325
+ it('should have a isAlive function', (done) => {
1326
+ try {
1327
+ assert.equal(true, typeof a.isAlive === 'function');
1328
+ done();
1329
+ } catch (error) {
1330
+ log.error(`Test Failure: ${error}`);
1331
+ done(error);
1332
+ }
1333
+ });
1334
+ });
1335
+
1336
+ describe('#getConfig', () => {
1337
+ it('should have a getConfig function', (done) => {
1338
+ try {
1339
+ assert.equal(true, typeof a.getConfig === 'function');
1340
+ done();
1341
+ } catch (error) {
1342
+ log.error(`Test Failure: ${error}`);
1343
+ done(error);
1344
+ }
1345
+ });
1346
+ });
1347
+
1348
+ describe('#getCount', () => {
1349
+ it('should have a getCount function', (done) => {
1350
+ try {
1351
+ assert.equal(true, typeof a.getCount === 'function');
1352
+ done();
1353
+ } catch (error) {
1354
+ log.error(`Test Failure: ${error}`);
1355
+ done(error);
1356
+ }
1357
+ });
1358
+ });
1359
+
740
1360
  /*
741
1361
  -----------------------------------------------------------------------
742
1362
  -----------------------------------------------------------------------