@itentialopensource/adapter-meraki 0.7.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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!!!
@@ -65,7 +65,10 @@ global.pronghornProps = {
65
65
  invalid_token_error: 401,
66
66
  auth_field: 'header.headers.Authorization',
67
67
  auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
68
- auth_logging: false
68
+ auth_logging: false,
69
+ client_id: '',
70
+ client_secret: '',
71
+ grant_type: ''
69
72
  },
70
73
  healthcheck: {
71
74
  type: 'none',
@@ -198,7 +201,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
198
201
  }
199
202
 
200
203
  // require the adapter that we are going to be using
201
- const Meraki = require('../../adapter.js');
204
+ const Meraki = require('../../adapter');
202
205
 
203
206
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
204
207
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -240,6 +243,8 @@ describe('[unit] Meraki Adapter Test', () => {
240
243
  try {
241
244
  assert.notEqual(null, a);
242
245
  assert.notEqual(undefined, a);
246
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
247
+ assert.equal(checkId, a.id);
243
248
  assert.notEqual(null, a.allProps);
244
249
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
245
250
  assert.equal(check, a.healthcheckType);
@@ -266,10 +271,10 @@ describe('[unit] Meraki Adapter Test', () => {
266
271
  });
267
272
 
268
273
  let wffunctions = [];
269
- describe('#getWorkflowFunctions', () => {
274
+ describe('#iapGetAdapterWorkflowFunctions', () => {
270
275
  it('should retrieve workflow functions', (done) => {
271
276
  try {
272
- wffunctions = a.getWorkflowFunctions([]);
277
+ wffunctions = a.iapGetAdapterWorkflowFunctions([]);
273
278
 
274
279
  try {
275
280
  assert.notEqual(0, wffunctions.length);
@@ -321,13 +326,103 @@ describe('[unit] Meraki Adapter Test', () => {
321
326
  done(error);
322
327
  }
323
328
  });
324
- it('package.json should be customized', (done) => {
329
+ it('package.json standard fields should be customized', (done) => {
325
330
  try {
326
331
  const packageDotJson = require('../../package.json');
327
332
  assert.notEqual(-1, packageDotJson.name.indexOf('meraki'));
328
333
  assert.notEqual(undefined, packageDotJson.version);
329
334
  assert.notEqual(null, packageDotJson.version);
330
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);
331
426
  done();
332
427
  } catch (error) {
333
428
  log.error(`Test Failure: ${error}`);
@@ -352,8 +447,34 @@ describe('[unit] Meraki Adapter Test', () => {
352
447
  try {
353
448
  const pronghornDotJson = require('../../pronghorn.json');
354
449
  assert.notEqual(-1, pronghornDotJson.id.indexOf('meraki'));
450
+ assert.equal('Adapter', pronghornDotJson.type);
355
451
  assert.equal('Meraki', pronghornDotJson.export);
356
452
  assert.equal('Meraki', 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'));
357
478
  done();
358
479
  } catch (error) {
359
480
  log.error(`Test Failure: ${error}`);
@@ -492,6 +613,123 @@ describe('[unit] Meraki Adapter Test', () => {
492
613
  try {
493
614
  const propertiesDotJson = require('../../propertiesSchema.json');
494
615
  assert.equal('adapter-meraki', 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);
727
+ assert.notEqual('', propertiesDotJson.definitions.devicebroker);
728
+ assert.equal('object', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
729
+ assert.equal('object', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
730
+ assert.equal('object', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
731
+ assert.equal('object', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
732
+ assert.equal('object', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
495
733
  done();
496
734
  } catch (error) {
497
735
  log.error(`Test Failure: ${error}`);
@@ -512,6 +750,50 @@ describe('[unit] Meraki Adapter Test', () => {
512
750
  done(error);
513
751
  }
514
752
  });
753
+ it('error.json should have standard adapter errors', (done) => {
754
+ try {
755
+ const errorDotJson = require('../../error.json');
756
+ assert.notEqual(undefined, errorDotJson.errors);
757
+ assert.notEqual(null, errorDotJson.errors);
758
+ assert.notEqual('', errorDotJson.errors);
759
+ assert.equal(true, Array.isArray(errorDotJson.errors));
760
+ assert.notEqual(0, errorDotJson.errors.length);
761
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
762
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
763
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
764
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
765
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
766
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
767
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
768
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
769
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
770
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
771
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
772
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
773
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
774
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
775
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
776
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
777
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
778
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
779
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
780
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
781
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
782
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
783
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
784
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
785
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
786
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
787
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
788
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
789
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
790
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
791
+ done();
792
+ } catch (error) {
793
+ log.error(`Test Failure: ${error}`);
794
+ done(error);
795
+ }
796
+ });
515
797
  });
516
798
 
517
799
  describe('sampleProperties.json', () => {
@@ -526,6 +808,119 @@ describe('[unit] Meraki Adapter Test', () => {
526
808
  done(error);
527
809
  }
528
810
  });
811
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
812
+ try {
813
+ const sampleDotJson = require('../../sampleProperties.json');
814
+ assert.notEqual(-1, sampleDotJson.id.indexOf('meraki'));
815
+ assert.equal('Meraki', sampleDotJson.type);
816
+ assert.notEqual(undefined, sampleDotJson.properties);
817
+ assert.notEqual(null, sampleDotJson.properties);
818
+ assert.notEqual('', sampleDotJson.properties);
819
+ assert.notEqual(undefined, sampleDotJson.properties.host);
820
+ assert.notEqual(undefined, sampleDotJson.properties.port);
821
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
822
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
823
+ assert.notEqual(null, sampleDotJson.properties.authentication);
824
+ assert.notEqual('', sampleDotJson.properties.authentication);
825
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
826
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
827
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
828
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
829
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
830
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
831
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
832
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
833
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
834
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
835
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
836
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
837
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
838
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
839
+ assert.notEqual(null, sampleDotJson.properties.ssl);
840
+ assert.notEqual('', sampleDotJson.properties.ssl);
841
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
842
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
843
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
844
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
845
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
846
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
847
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
848
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
849
+
850
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
851
+ assert.notEqual(undefined, sampleDotJson.properties.version);
852
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
853
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
854
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
855
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
856
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
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.healthcheck);
861
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
862
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
863
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
864
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
865
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
866
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
867
+ assert.notEqual(null, sampleDotJson.properties.throttle);
868
+ assert.notEqual('', sampleDotJson.properties.throttle);
869
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
870
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
871
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
872
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
873
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
874
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
875
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
876
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
877
+ assert.notEqual(undefined, sampleDotJson.properties.request);
878
+ assert.notEqual(null, sampleDotJson.properties.request);
879
+ assert.notEqual('', sampleDotJson.properties.request);
880
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
881
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
882
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
883
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
884
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
885
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
886
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
887
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
888
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
889
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
890
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
891
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
892
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
893
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
894
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
895
+ assert.notEqual(null, sampleDotJson.properties.proxy);
896
+ assert.notEqual('', sampleDotJson.properties.proxy);
897
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
898
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
899
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
900
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
901
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
902
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
903
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
904
+ assert.notEqual(null, sampleDotJson.properties.mongo);
905
+ assert.notEqual('', sampleDotJson.properties.mongo);
906
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
907
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
908
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
909
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
910
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
911
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
912
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
913
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
914
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
915
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
916
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
917
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
918
+ done();
919
+ } catch (error) {
920
+ log.error(`Test Failure: ${error}`);
921
+ done(error);
922
+ }
923
+ });
529
924
  });
530
925
 
531
926
  describe('#checkProperties', () => {
@@ -613,6 +1008,148 @@ describe('[unit] Meraki Adapter Test', () => {
613
1008
  });
614
1009
  });
615
1010
 
1011
+ describe('#iapUpdateAdapterConfiguration', () => {
1012
+ it('should have a iapUpdateAdapterConfiguration function', (done) => {
1013
+ try {
1014
+ assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
1015
+ done();
1016
+ } catch (error) {
1017
+ log.error(`Test Failure: ${error}`);
1018
+ done(error);
1019
+ }
1020
+ });
1021
+ });
1022
+
1023
+ describe('#iapFindAdapterPath', () => {
1024
+ it('should have a iapFindAdapterPath function', (done) => {
1025
+ try {
1026
+ assert.equal(true, typeof a.iapFindAdapterPath === 'function');
1027
+ done();
1028
+ } catch (error) {
1029
+ log.error(`Test Failure: ${error}`);
1030
+ done(error);
1031
+ }
1032
+ });
1033
+ it('iapFindAdapterPath should find atleast one path that matches', (done) => {
1034
+ try {
1035
+ a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
1036
+ try {
1037
+ assert.equal(undefined, error);
1038
+ assert.notEqual(undefined, data);
1039
+ assert.notEqual(null, data);
1040
+ assert.equal(true, data.found);
1041
+ assert.notEqual(undefined, data.foundIn);
1042
+ assert.notEqual(null, data.foundIn);
1043
+ assert.notEqual(0, data.foundIn.length);
1044
+ done();
1045
+ } catch (err) {
1046
+ log.error(`Test Failure: ${err}`);
1047
+ done(err);
1048
+ }
1049
+ });
1050
+ } catch (error) {
1051
+ log.error(`Adapter Exception: ${error}`);
1052
+ done(error);
1053
+ }
1054
+ }).timeout(attemptTimeout);
1055
+ });
1056
+
1057
+ describe('#iapSuspendAdapter', () => {
1058
+ it('should have a iapSuspendAdapter function', (done) => {
1059
+ try {
1060
+ assert.equal(true, typeof a.iapSuspendAdapter === 'function');
1061
+ done();
1062
+ } catch (error) {
1063
+ log.error(`Test Failure: ${error}`);
1064
+ done(error);
1065
+ }
1066
+ });
1067
+ });
1068
+
1069
+ describe('#iapUnsuspendAdapter', () => {
1070
+ it('should have a iapUnsuspendAdapter function', (done) => {
1071
+ try {
1072
+ assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
1073
+ done();
1074
+ } catch (error) {
1075
+ log.error(`Test Failure: ${error}`);
1076
+ done(error);
1077
+ }
1078
+ });
1079
+ });
1080
+
1081
+ describe('#iapGetAdapterQueue', () => {
1082
+ it('should have a iapGetAdapterQueue function', (done) => {
1083
+ try {
1084
+ assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
1085
+ done();
1086
+ } catch (error) {
1087
+ log.error(`Test Failure: ${error}`);
1088
+ done(error);
1089
+ }
1090
+ });
1091
+ });
1092
+
1093
+ describe('#iapTroubleshootAdapter', () => {
1094
+ it('should have a iapTroubleshootAdapter function', (done) => {
1095
+ try {
1096
+ assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
1097
+ done();
1098
+ } catch (error) {
1099
+ log.error(`Test Failure: ${error}`);
1100
+ done(error);
1101
+ }
1102
+ });
1103
+ });
1104
+
1105
+ describe('#iapRunAdapterHealthcheck', () => {
1106
+ it('should have a iapRunAdapterHealthcheck function', (done) => {
1107
+ try {
1108
+ assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
1109
+ done();
1110
+ } catch (error) {
1111
+ log.error(`Test Failure: ${error}`);
1112
+ done(error);
1113
+ }
1114
+ });
1115
+ });
1116
+
1117
+ describe('#iapRunAdapterConnectivity', () => {
1118
+ it('should have a iapRunAdapterConnectivity function', (done) => {
1119
+ try {
1120
+ assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
1121
+ done();
1122
+ } catch (error) {
1123
+ log.error(`Test Failure: ${error}`);
1124
+ done(error);
1125
+ }
1126
+ });
1127
+ });
1128
+
1129
+ describe('#iapRunAdapterBasicGet', () => {
1130
+ it('should have a iapRunAdapterBasicGet function', (done) => {
1131
+ try {
1132
+ assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
1133
+ done();
1134
+ } catch (error) {
1135
+ log.error(`Test Failure: ${error}`);
1136
+ done(error);
1137
+ }
1138
+ });
1139
+ });
1140
+
1141
+ describe('#iapMoveAdapterEntitiesToDB', () => {
1142
+ it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
1143
+ try {
1144
+ assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
1145
+ done();
1146
+ } catch (error) {
1147
+ log.error(`Test Failure: ${error}`);
1148
+ done(error);
1149
+ }
1150
+ });
1151
+ });
1152
+
616
1153
  describe('#checkActionFiles', () => {
617
1154
  it('should have a checkActionFiles function', (done) => {
618
1155
  try {
@@ -698,10 +1235,10 @@ describe('[unit] Meraki Adapter Test', () => {
698
1235
  }).timeout(attemptTimeout);
699
1236
  });
700
1237
 
701
- // describe('#hasEntity', () => {
702
- // it('should have a hasEntity function', (done) => {
1238
+ // describe('#iapHasAdapterEntity', () => {
1239
+ // it('should have a iapHasAdapterEntity function', (done) => {
703
1240
  // try {
704
- // assert.equal(true, typeof a.hasEntity === 'function');
1241
+ // assert.equal(true, typeof a.iapHasAdapterEntity === 'function');
705
1242
  // done();
706
1243
  // } catch (error) {
707
1244
  // log.error(`Test Failure: ${error}`);
@@ -710,7 +1247,7 @@ describe('[unit] Meraki Adapter Test', () => {
710
1247
  // });
711
1248
  // it('should find entity', (done) => {
712
1249
  // try {
713
- // a.hasEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
1250
+ // a.iapHasAdapterEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
714
1251
  // try {
715
1252
  // assert.equal(true, data[0]);
716
1253
  // done();
@@ -726,7 +1263,7 @@ describe('[unit] Meraki Adapter Test', () => {
726
1263
  // }).timeout(attemptTimeout);
727
1264
  // it('should not find entity', (done) => {
728
1265
  // try {
729
- // a.hasEntity('template_entity', 'blah', (data) => {
1266
+ // a.iapHasAdapterEntity('template_entity', 'blah', (data) => {
730
1267
  // try {
731
1268
  // assert.equal(false, data[0]);
732
1269
  // done();
@@ -742,6 +1279,90 @@ describe('[unit] Meraki Adapter Test', () => {
742
1279
  // }).timeout(attemptTimeout);
743
1280
  // });
744
1281
 
1282
+ describe('#hasEntities', () => {
1283
+ it('should have a hasEntities function', (done) => {
1284
+ try {
1285
+ assert.equal(true, typeof a.hasEntities === 'function');
1286
+ done();
1287
+ } catch (error) {
1288
+ log.error(`Test Failure: ${error}`);
1289
+ done(error);
1290
+ }
1291
+ });
1292
+ });
1293
+
1294
+ describe('#hasDevices', () => {
1295
+ it('should have a hasDevices function', (done) => {
1296
+ try {
1297
+ assert.equal(true, typeof a.hasDevices === 'function');
1298
+ done();
1299
+ } catch (error) {
1300
+ log.error(`Test Failure: ${error}`);
1301
+ done(error);
1302
+ }
1303
+ });
1304
+ });
1305
+
1306
+ describe('#getDevice', () => {
1307
+ it('should have a getDevice function', (done) => {
1308
+ try {
1309
+ assert.equal(true, typeof a.getDevice === 'function');
1310
+ done();
1311
+ } catch (error) {
1312
+ log.error(`Test Failure: ${error}`);
1313
+ done(error);
1314
+ }
1315
+ });
1316
+ });
1317
+
1318
+ describe('#getDevicesFiltered', () => {
1319
+ it('should have a getDevicesFiltered function', (done) => {
1320
+ try {
1321
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1322
+ done();
1323
+ } catch (error) {
1324
+ log.error(`Test Failure: ${error}`);
1325
+ done(error);
1326
+ }
1327
+ });
1328
+ });
1329
+
1330
+ describe('#isAlive', () => {
1331
+ it('should have a isAlive function', (done) => {
1332
+ try {
1333
+ assert.equal(true, typeof a.isAlive === 'function');
1334
+ done();
1335
+ } catch (error) {
1336
+ log.error(`Test Failure: ${error}`);
1337
+ done(error);
1338
+ }
1339
+ });
1340
+ });
1341
+
1342
+ describe('#getConfig', () => {
1343
+ it('should have a getConfig function', (done) => {
1344
+ try {
1345
+ assert.equal(true, typeof a.getConfig === 'function');
1346
+ done();
1347
+ } catch (error) {
1348
+ log.error(`Test Failure: ${error}`);
1349
+ done(error);
1350
+ }
1351
+ });
1352
+ });
1353
+
1354
+ describe('#iapGetDeviceCount', () => {
1355
+ it('should have a iapGetDeviceCount function', (done) => {
1356
+ try {
1357
+ assert.equal(true, typeof a.iapGetDeviceCount === 'function');
1358
+ done();
1359
+ } catch (error) {
1360
+ log.error(`Test Failure: ${error}`);
1361
+ done(error);
1362
+ }
1363
+ });
1364
+ });
1365
+
745
1366
  /*
746
1367
  -----------------------------------------------------------------------
747
1368
  -----------------------------------------------------------------------