@itentialopensource/adapter-winston_syslog 1.0.1 → 1.1.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 (47) hide show
  1. package/BROKER.md +199 -0
  2. package/CALLS.md +162 -0
  3. package/CHANGELOG.md +8 -1
  4. package/CODE_OF_CONDUCT.md +43 -0
  5. package/CONTRIBUTING.md +13 -0
  6. package/ENHANCE.md +69 -0
  7. package/LICENSE +1 -1
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +89 -28
  10. package/SUMMARY.md +9 -0
  11. package/TROUBLESHOOT.md +47 -0
  12. package/adapter.js +566 -0
  13. package/adapterBase.js +549 -879
  14. package/changelogs/CHANGELOG.md +9 -0
  15. package/metadata.json +49 -0
  16. package/package.json +26 -25
  17. package/pronghorn.json +981 -0
  18. package/propertiesSchema.json +506 -51
  19. package/refs?service=git-upload-pack +0 -0
  20. package/report/adapterInfo.json +8 -8
  21. package/report/updateReport1691508888201.json +120 -0
  22. package/report/updateReport1692202203193.json +120 -0
  23. package/report/updateReport1692203305042.json +120 -0
  24. package/report/updateReport1694469210573.json +120 -0
  25. package/report/updateReport1698422912292.json +120 -0
  26. package/sampleProperties.json +210 -12
  27. package/test/integration/adapterTestBasicGet.js +83 -0
  28. package/test/integration/adapterTestConnectivity.js +142 -0
  29. package/test/integration/adapterTestIntegration.js +180 -15
  30. package/test/unit/adapterBaseTestUnit.js +388 -313
  31. package/test/unit/adapterTestUnit.js +465 -106
  32. package/utils/adapterInfo.js +1 -1
  33. package/utils/addAuth.js +1 -1
  34. package/utils/artifactize.js +1 -1
  35. package/utils/checkMigrate.js +1 -1
  36. package/utils/entitiesToDB.js +2 -2
  37. package/utils/findPath.js +1 -1
  38. package/utils/methodDocumentor.js +273 -0
  39. package/utils/modify.js +13 -15
  40. package/utils/packModificationScript.js +1 -1
  41. package/utils/pre-commit.sh +2 -0
  42. package/utils/taskMover.js +309 -0
  43. package/utils/tbScript.js +89 -34
  44. package/utils/tbUtils.js +41 -21
  45. package/utils/testRunner.js +1 -1
  46. package/utils/troubleshootingAdapter.js +9 -6
  47. package/workflows/README.md +0 -3
@@ -8,22 +8,21 @@
8
8
 
9
9
  // include required items for testing & logging
10
10
  const assert = require('assert');
11
- const fs = require('fs-extra');
12
- const mocha = require('mocha');
13
11
  const path = require('path');
14
12
  const util = require('util');
15
- const winston = require('winston');
16
13
  const execute = require('child_process').execSync;
14
+ const fs = require('fs-extra');
15
+ const mocha = require('mocha');
16
+ const winston = require('winston');
17
17
  const { expect } = require('chai');
18
18
  const { use } = require('chai');
19
19
  const td = require('testdouble');
20
+ const Ajv = require('ajv');
20
21
 
22
+ const ajv = new Ajv({ strictSchema: false, allErrors: true, allowUnionTypes: true });
21
23
  const anything = td.matchers.anything();
22
24
  let logLevel = 'none';
23
25
  const isRapidFail = false;
24
- const Ajv = require('ajv');
25
-
26
- const ajv = new Ajv({ allErrors: true, unknownFormats: 'ignore' });
27
26
 
28
27
  // read in the properties from the sampleProperties files
29
28
  let adaptdir = __dirname;
@@ -44,10 +43,9 @@ samProps.protocol = 'http';
44
43
  samProps.port = 80;
45
44
  samProps.ssl.enabled = false;
46
45
  samProps.ssl.accept_invalid_cert = false;
47
- samProps.request.attempt_timeout = 60000;
46
+ samProps.request.attempt_timeout = 1200000;
48
47
  const attemptTimeout = samProps.request.attempt_timeout;
49
48
  const { stub } = samProps;
50
- samProps.authentication.tenantId = '';
51
49
 
52
50
  // these are the adapter properties. You generally should not need to alter
53
51
  // any of these after they are initially set up
@@ -147,7 +145,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
147
145
 
148
146
  mocha.afterEach(function x() {
149
147
  state.passed = state.passed
150
- && (this.currentTest.state === 'passed');
148
+ && (this.currentTest.state === 'passed');
151
149
  });
152
150
  mocha.beforeEach(function x() {
153
151
  if (!state.passed) {
@@ -193,7 +191,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
193
191
  describe('#iapGetAdapterWorkflowFunctions', () => {
194
192
  it('should retrieve workflow functions', (done) => {
195
193
  try {
196
- wffunctions = a.iapGetAdapterWorkflowFunctions(['healthCheck']);
194
+ wffunctions = a.iapGetAdapterWorkflowFunctions([]);
197
195
 
198
196
  try {
199
197
  assert.notEqual(0, wffunctions.length);
@@ -267,7 +265,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
267
265
  assert.notEqual(undefined, packageDotJson.engineVersion);
268
266
  assert.notEqual(null, packageDotJson.engineVersion);
269
267
  assert.notEqual('', packageDotJson.engineVersion);
270
- assert.equal('udp', packageDotJson.adapterType);
268
+ assert.equal('http', packageDotJson.adapterType);
271
269
  done();
272
270
  } catch (error) {
273
271
  log.error(`Test Failure: ${error}`);
@@ -280,7 +278,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
280
278
  assert.notEqual(undefined, packageDotJson.scripts);
281
279
  assert.notEqual(null, packageDotJson.scripts);
282
280
  assert.notEqual('', packageDotJson.scripts);
283
- assert.equal('node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions', packageDotJson.scripts.preinstall);
281
+ assert.equal('node utils/setup.js', packageDotJson.scripts.preinstall);
284
282
  assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
285
283
  assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
286
284
  assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
@@ -317,17 +315,17 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
317
315
  assert.notEqual(undefined, packageDotJson.dependencies);
318
316
  assert.notEqual(null, packageDotJson.dependencies);
319
317
  assert.notEqual('', packageDotJson.dependencies);
320
- assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
321
- assert.equal('^0.21.0', packageDotJson.dependencies.axios);
322
- assert.equal('^2.20.0', packageDotJson.dependencies.commander);
323
- assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
324
- assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
318
+ assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
319
+ assert.equal('^1.6.3', packageDotJson.dependencies.axios);
320
+ assert.equal('^11.0.0', packageDotJson.dependencies.commander);
321
+ assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
322
+ assert.equal('^10.2.0', packageDotJson.dependencies.mocha);
325
323
  assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
326
- assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
327
324
  assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
325
+ assert.equal('^0.4.4', packageDotJson.dependencies.ping);
328
326
  assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
329
- assert.equal('^7.3.2', packageDotJson.dependencies.semver);
330
- assert.equal('^3.8.2', packageDotJson.dependencies.winston);
327
+ assert.equal('^7.5.3', packageDotJson.dependencies.semver);
328
+ assert.equal('^3.9.0', packageDotJson.dependencies.winston);
331
329
  done();
332
330
  } catch (error) {
333
331
  log.error(`Test Failure: ${error}`);
@@ -340,12 +338,12 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
340
338
  assert.notEqual(undefined, packageDotJson.devDependencies);
341
339
  assert.notEqual(null, packageDotJson.devDependencies);
342
340
  assert.notEqual('', packageDotJson.devDependencies);
343
- assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
344
- assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
345
- assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
346
- assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
347
- assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
348
- assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
341
+ assert.equal('^4.3.7', packageDotJson.devDependencies.chai);
342
+ assert.equal('^8.44.0', packageDotJson.devDependencies.eslint);
343
+ assert.equal('^15.0.0', packageDotJson.devDependencies['eslint-config-airbnb-base']);
344
+ assert.equal('^2.27.5', packageDotJson.devDependencies['eslint-plugin-import']);
345
+ assert.equal('^3.1.0', packageDotJson.devDependencies['eslint-plugin-json']);
346
+ assert.equal('^3.18.0', packageDotJson.devDependencies.testdouble);
349
347
  done();
350
348
  } catch (error) {
351
349
  log.error(`Test Failure: ${error}`);
@@ -380,6 +378,45 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
380
378
  done(error);
381
379
  }
382
380
  });
381
+ it('pronghorn.json should contain generic adapter methods', (done) => {
382
+ try {
383
+ const pronghornDotJson = require('../../pronghorn.json');
384
+ assert.notEqual(undefined, pronghornDotJson.methods);
385
+ assert.notEqual(null, pronghornDotJson.methods);
386
+ assert.notEqual('', pronghornDotJson.methods);
387
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
388
+ assert.notEqual(0, pronghornDotJson.methods.length);
389
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
390
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapSuspendAdapter'));
391
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
392
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
393
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
394
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
395
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
396
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
397
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
398
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapMoveAdapterEntitiesToDB'));
399
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapDeactivateTasks'));
400
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapActivateTasks'));
401
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapPopulateEntityCache'));
402
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRetrieveEntitiesCache'));
403
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevice'));
404
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevicesFiltered'));
405
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'isAlive'));
406
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getConfig'));
407
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetDeviceCount'));
408
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapExpandedGenericAdapterRequest'));
409
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
410
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
411
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterLint'));
412
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterTests'));
413
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterInventory'));
414
+ done();
415
+ } catch (error) {
416
+ log.error(`Test Failure: ${error}`);
417
+ done(error);
418
+ }
419
+ });
383
420
  it('pronghorn.json should only expose workflow functions', (done) => {
384
421
  try {
385
422
  const pronghornDotJson = require('../../pronghorn.json');
@@ -387,6 +424,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
387
424
  for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
388
425
  let found = false;
389
426
  let paramissue = false;
427
+
390
428
  for (let w = 0; w < wffunctions.length; w += 1) {
391
429
  if (pronghornDotJson.methods[m].name === wffunctions[w]) {
392
430
  found = true;
@@ -411,10 +449,10 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
411
449
 
412
450
  // if there are inputs defined but not on the method line
413
451
  if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
414
- && pronghornDotJson.methods[m].input.length > 0)) {
452
+ && pronghornDotJson.methods[m].input.length > 0)) {
415
453
  paramissue = true;
416
454
  } else if (wfparams.length > 0 && (!pronghornDotJson.methods[m].input
417
- || pronghornDotJson.methods[m].input.length === 0)) {
455
+ || pronghornDotJson.methods[m].input.length === 0)) {
418
456
  // if there are no inputs defined but there are on the method line
419
457
  paramissue = true;
420
458
  } else {
@@ -493,6 +531,39 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
493
531
  done(error);
494
532
  }
495
533
  });
534
+ it('pronghorn.json verify input/output schema objects', (done) => {
535
+ const verifySchema = (methodName, schema) => {
536
+ try {
537
+ ajv.compile(schema);
538
+ } catch (error) {
539
+ const errorMessage = `Invalid schema found in '${methodName}' method.
540
+ Schema => ${JSON.stringify(schema)}.
541
+ Details => ${error.message}`;
542
+ throw new Error(errorMessage);
543
+ }
544
+ };
545
+
546
+ try {
547
+ const pronghornDotJson = require('../../pronghorn.json');
548
+ const { methods } = pronghornDotJson;
549
+ for (let i = 0; i < methods.length; i += 1) {
550
+ for (let j = 0; j < methods[i].input.length; j += 1) {
551
+ const inputSchema = methods[i].input[j].schema;
552
+ if (inputSchema) {
553
+ verifySchema(methods[i].name, inputSchema);
554
+ }
555
+ }
556
+ const outputSchema = methods[i].output.schema;
557
+ if (outputSchema) {
558
+ verifySchema(methods[i].name, outputSchema);
559
+ }
560
+ }
561
+ done();
562
+ } catch (error) {
563
+ log.error(`Adapter Exception: ${error}`);
564
+ done(error);
565
+ }
566
+ }).timeout(attemptTimeout);
496
567
  });
497
568
 
498
569
  describe('propertiesSchema.json', () => {
@@ -528,6 +599,7 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
528
599
  assert.equal('string', propertiesDotJson.properties.host.type);
529
600
  assert.equal('integer', propertiesDotJson.properties.port.type);
530
601
  assert.equal('boolean', propertiesDotJson.properties.stub.type);
602
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
531
603
  assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
532
604
  assert.notEqual(null, propertiesDotJson.definitions.authentication);
533
605
  assert.notEqual('', propertiesDotJson.definitions.authentication);
@@ -561,7 +633,6 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
561
633
  assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
562
634
  assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
563
635
  assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
564
- assert.equal('string', propertiesDotJson.properties.protocol.type);
565
636
  assert.notEqual(undefined, propertiesDotJson.definitions);
566
637
  assert.notEqual(null, propertiesDotJson.definitions);
567
638
  assert.notEqual('', propertiesDotJson.definitions);
@@ -707,6 +778,123 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
707
778
  done(error);
708
779
  }
709
780
  });
781
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
782
+ try {
783
+ const sampleDotJson = require('../../sampleProperties.json');
784
+ assert.notEqual(-1, sampleDotJson.id.indexOf('winston_syslog'));
785
+ assert.equal('WinstonSyslog', sampleDotJson.type);
786
+ assert.notEqual(undefined, sampleDotJson.properties);
787
+ assert.notEqual(null, sampleDotJson.properties);
788
+ assert.notEqual('', sampleDotJson.properties);
789
+ assert.notEqual(undefined, sampleDotJson.properties.host);
790
+ assert.notEqual(undefined, sampleDotJson.properties.port);
791
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
792
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
793
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
794
+ assert.notEqual(null, sampleDotJson.properties.authentication);
795
+ assert.notEqual('', sampleDotJson.properties.authentication);
796
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
797
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
798
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
799
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
800
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
801
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
802
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
803
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
804
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
805
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
806
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
807
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
808
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
809
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
810
+ assert.notEqual(null, sampleDotJson.properties.ssl);
811
+ assert.notEqual('', sampleDotJson.properties.ssl);
812
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
813
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
814
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
815
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
816
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
817
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
818
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
819
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
820
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
821
+ assert.notEqual(undefined, sampleDotJson.properties.version);
822
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
823
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
824
+ assert.notEqual(undefined, sampleDotJson.properties.encode_queryvars);
825
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
826
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
827
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
828
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
829
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
830
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
831
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
832
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
833
+ assert.notEqual(null, sampleDotJson.properties.throttle);
834
+ assert.notEqual('', sampleDotJson.properties.throttle);
835
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
836
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
837
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
838
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
839
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
840
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
841
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
842
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
843
+ assert.notEqual(undefined, sampleDotJson.properties.request);
844
+ assert.notEqual(null, sampleDotJson.properties.request);
845
+ assert.notEqual('', sampleDotJson.properties.request);
846
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
847
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
848
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
849
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
850
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
851
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
852
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
853
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
854
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
855
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
856
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
857
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
858
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
859
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
860
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
861
+ assert.notEqual(null, sampleDotJson.properties.proxy);
862
+ assert.notEqual('', sampleDotJson.properties.proxy);
863
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
864
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
865
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
866
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
867
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
868
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
869
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
870
+ assert.notEqual(null, sampleDotJson.properties.mongo);
871
+ assert.notEqual('', sampleDotJson.properties.mongo);
872
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
873
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
874
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
875
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
876
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
877
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
878
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
879
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
880
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
881
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
882
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
883
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
884
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker);
885
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevice);
886
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevicesFiltered);
887
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.isAlive);
888
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getConfig);
889
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getCount);
890
+ assert.notEqual(undefined, sampleDotJson.properties.cache);
891
+ assert.notEqual(undefined, sampleDotJson.properties.cache.entities);
892
+ done();
893
+ } catch (error) {
894
+ log.error(`Test Failure: ${error}`);
895
+ done(error);
896
+ }
897
+ });
710
898
  });
711
899
 
712
900
  describe('#checkProperties', () => {
@@ -806,40 +994,6 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
806
994
  });
807
995
  });
808
996
 
809
- describe('#iapFindAdapterPath', () => {
810
- it('should have a iapFindAdapterPath function', (done) => {
811
- try {
812
- assert.equal(true, typeof a.iapFindAdapterPath === 'function');
813
- done();
814
- } catch (error) {
815
- log.error(`Test Failure: ${error}`);
816
- done(error);
817
- }
818
- });
819
- it('iapFindAdapterPath should find atleast one path that matches', (done) => {
820
- try {
821
- a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
822
- try {
823
- assert.equal(undefined, error);
824
- assert.notEqual(undefined, data);
825
- assert.notEqual(null, data);
826
- assert.equal(true, data.found);
827
- assert.notEqual(undefined, data.foundIn);
828
- assert.notEqual(null, data.foundIn);
829
- assert.notEqual(0, data.foundIn.length);
830
- done();
831
- } catch (err) {
832
- log.error(`Test Failure: ${err}`);
833
- done(err);
834
- }
835
- });
836
- } catch (error) {
837
- log.error(`Adapter Exception: ${error}`);
838
- done(error);
839
- }
840
- }).timeout(attemptTimeout);
841
- });
842
-
843
997
  describe('#iapSuspendAdapter', () => {
844
998
  it('should have a iapSuspendAdapter function', (done) => {
845
999
  try {
@@ -876,6 +1030,40 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
876
1030
  });
877
1031
  });
878
1032
 
1033
+ describe('#iapFindAdapterPath', () => {
1034
+ it('should have a iapFindAdapterPath function', (done) => {
1035
+ try {
1036
+ assert.equal(true, typeof a.iapFindAdapterPath === 'function');
1037
+ done();
1038
+ } catch (error) {
1039
+ log.error(`Test Failure: ${error}`);
1040
+ done(error);
1041
+ }
1042
+ });
1043
+ it('iapFindAdapterPath should find atleast one path that matches', (done) => {
1044
+ try {
1045
+ a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
1046
+ try {
1047
+ assert.equal(undefined, error);
1048
+ assert.notEqual(undefined, data);
1049
+ assert.notEqual(null, data);
1050
+ assert.equal(true, data.found);
1051
+ assert.notEqual(undefined, data.foundIn);
1052
+ assert.notEqual(null, data.foundIn);
1053
+ assert.notEqual(0, data.foundIn.length);
1054
+ done();
1055
+ } catch (err) {
1056
+ log.error(`Test Failure: ${err}`);
1057
+ done(err);
1058
+ }
1059
+ });
1060
+ } catch (error) {
1061
+ log.error(`Adapter Exception: ${error}`);
1062
+ done(error);
1063
+ }
1064
+ }).timeout(attemptTimeout);
1065
+ });
1066
+
879
1067
  describe('#iapTroubleshootAdapter', () => {
880
1068
  it('should have a iapTroubleshootAdapter function', (done) => {
881
1069
  try {
@@ -1021,49 +1209,53 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
1021
1209
  }).timeout(attemptTimeout);
1022
1210
  });
1023
1211
 
1024
- // describe('#iapHasAdapterEntity', () => {
1025
- // it('should have a iapHasAdapterEntity function', (done) => {
1026
- // try {
1027
- // assert.equal(true, typeof a.iapHasAdapterEntity === 'function');
1028
- // done();
1029
- // } catch (error) {
1030
- // log.error(`Test Failure: ${error}`);
1031
- // done(error);
1032
- // }
1033
- // });
1034
- // it('should find entity', (done) => {
1035
- // try {
1036
- // a.iapHasAdapterEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
1037
- // try {
1038
- // assert.equal(true, data[0]);
1039
- // done();
1040
- // } catch (err) {
1041
- // log.error(`Test Failure: ${err}`);
1042
- // done(err);
1043
- // }
1044
- // });
1045
- // } catch (error) {
1046
- // log.error(`Adapter Exception: ${error}`);
1047
- // done(error);
1048
- // }
1049
- // }).timeout(attemptTimeout);
1050
- // it('should not find entity', (done) => {
1051
- // try {
1052
- // a.iapHasAdapterEntity('template_entity', 'blah', (data) => {
1053
- // try {
1054
- // assert.equal(false, data[0]);
1055
- // done();
1056
- // } catch (err) {
1057
- // log.error(`Test Failure: ${err}`);
1058
- // done(err);
1059
- // }
1060
- // });
1061
- // } catch (error) {
1062
- // log.error(`Adapter Exception: ${error}`);
1063
- // done(error);
1064
- // }
1065
- // }).timeout(attemptTimeout);
1066
- // });
1212
+ describe('#iapDeactivateTasks', () => {
1213
+ it('should have a iapDeactivateTasks function', (done) => {
1214
+ try {
1215
+ assert.equal(true, typeof a.iapDeactivateTasks === 'function');
1216
+ done();
1217
+ } catch (error) {
1218
+ log.error(`Test Failure: ${error}`);
1219
+ done(error);
1220
+ }
1221
+ });
1222
+ });
1223
+
1224
+ describe('#iapActivateTasks', () => {
1225
+ it('should have a iapActivateTasks function', (done) => {
1226
+ try {
1227
+ assert.equal(true, typeof a.iapActivateTasks === 'function');
1228
+ done();
1229
+ } catch (error) {
1230
+ log.error(`Test Failure: ${error}`);
1231
+ done(error);
1232
+ }
1233
+ });
1234
+ });
1235
+
1236
+ describe('#iapPopulateEntityCache', () => {
1237
+ it('should have a iapPopulateEntityCache function', (done) => {
1238
+ try {
1239
+ assert.equal(true, typeof a.iapPopulateEntityCache === 'function');
1240
+ done();
1241
+ } catch (error) {
1242
+ log.error(`Test Failure: ${error}`);
1243
+ done(error);
1244
+ }
1245
+ });
1246
+ });
1247
+
1248
+ describe('#iapRetrieveEntitiesCache', () => {
1249
+ it('should have a iapRetrieveEntitiesCache function', (done) => {
1250
+ try {
1251
+ assert.equal(true, typeof a.iapRetrieveEntitiesCache === 'function');
1252
+ done();
1253
+ } catch (error) {
1254
+ log.error(`Test Failure: ${error}`);
1255
+ done(error);
1256
+ }
1257
+ });
1258
+ });
1067
1259
 
1068
1260
  describe('#hasEntities', () => {
1069
1261
  it('should have a hasEntities function', (done) => {
@@ -1137,6 +1329,173 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
1137
1329
  });
1138
1330
  });
1139
1331
 
1332
+ describe('#iapExpandedGenericAdapterRequest', () => {
1333
+ it('should have a iapExpandedGenericAdapterRequest function', (done) => {
1334
+ try {
1335
+ assert.equal(true, typeof a.iapExpandedGenericAdapterRequest === 'function');
1336
+ done();
1337
+ } catch (error) {
1338
+ log.error(`Test Failure: ${error}`);
1339
+ done(error);
1340
+ }
1341
+ });
1342
+ });
1343
+
1344
+ describe('#genericAdapterRequest', () => {
1345
+ it('should have a genericAdapterRequest function', (done) => {
1346
+ try {
1347
+ assert.equal(true, typeof a.genericAdapterRequest === 'function');
1348
+ done();
1349
+ } catch (error) {
1350
+ log.error(`Test Failure: ${error}`);
1351
+ done(error);
1352
+ }
1353
+ });
1354
+ });
1355
+
1356
+ describe('#genericAdapterRequestNoBasePath', () => {
1357
+ it('should have a genericAdapterRequestNoBasePath function', (done) => {
1358
+ try {
1359
+ assert.equal(true, typeof a.genericAdapterRequestNoBasePath === 'function');
1360
+ done();
1361
+ } catch (error) {
1362
+ log.error(`Test Failure: ${error}`);
1363
+ done(error);
1364
+ }
1365
+ });
1366
+ });
1367
+
1368
+ describe('#iapRunAdapterLint', () => {
1369
+ it('should have a iapRunAdapterLint function', (done) => {
1370
+ try {
1371
+ assert.equal(true, typeof a.iapRunAdapterLint === 'function');
1372
+ done();
1373
+ } catch (error) {
1374
+ log.error(`Test Failure: ${error}`);
1375
+ done(error);
1376
+ }
1377
+ });
1378
+ it('retrieve the lint results', (done) => {
1379
+ try {
1380
+ a.iapRunAdapterLint((data, error) => {
1381
+ try {
1382
+ assert.equal(undefined, error);
1383
+ assert.notEqual(undefined, data);
1384
+ assert.notEqual(null, data);
1385
+ assert.notEqual(undefined, data.status);
1386
+ assert.notEqual(null, data.status);
1387
+ assert.equal('SUCCESS', data.status);
1388
+ done();
1389
+ } catch (err) {
1390
+ log.error(`Test Failure: ${err}`);
1391
+ done(err);
1392
+ }
1393
+ });
1394
+ } catch (error) {
1395
+ log.error(`Adapter Exception: ${error}`);
1396
+ done(error);
1397
+ }
1398
+ }).timeout(attemptTimeout);
1399
+ });
1400
+
1401
+ describe('#iapRunAdapterTests', () => {
1402
+ it('should have a iapRunAdapterTests function', (done) => {
1403
+ try {
1404
+ assert.equal(true, typeof a.iapRunAdapterTests === 'function');
1405
+ done();
1406
+ } catch (error) {
1407
+ log.error(`Test Failure: ${error}`);
1408
+ done(error);
1409
+ }
1410
+ });
1411
+ });
1412
+
1413
+ describe('#iapGetAdapterInventory', () => {
1414
+ it('should have a iapGetAdapterInventory function', (done) => {
1415
+ try {
1416
+ assert.equal(true, typeof a.iapGetAdapterInventory === 'function');
1417
+ done();
1418
+ } catch (error) {
1419
+ log.error(`Test Failure: ${error}`);
1420
+ done(error);
1421
+ }
1422
+ });
1423
+ it('retrieve the inventory', (done) => {
1424
+ try {
1425
+ a.iapGetAdapterInventory((data, error) => {
1426
+ try {
1427
+ assert.equal(undefined, error);
1428
+ assert.notEqual(undefined, data);
1429
+ assert.notEqual(null, data);
1430
+ done();
1431
+ } catch (err) {
1432
+ log.error(`Test Failure: ${err}`);
1433
+ done(err);
1434
+ }
1435
+ });
1436
+ } catch (error) {
1437
+ log.error(`Adapter Exception: ${error}`);
1438
+ done(error);
1439
+ }
1440
+ }).timeout(attemptTimeout);
1441
+ });
1442
+ describe('metadata.json', () => {
1443
+ it('should have a metadata.json', (done) => {
1444
+ try {
1445
+ fs.exists('metadata.json', (val) => {
1446
+ assert.equal(true, val);
1447
+ done();
1448
+ });
1449
+ } catch (error) {
1450
+ log.error(`Test Failure: ${error}`);
1451
+ done(error);
1452
+ }
1453
+ });
1454
+ it('metadata.json is customized', (done) => {
1455
+ try {
1456
+ const metadataDotJson = require('../../metadata.json');
1457
+ assert.equal('adapter-winston_syslog', metadataDotJson.name);
1458
+ assert.notEqual(undefined, metadataDotJson.webName);
1459
+ assert.notEqual(null, metadataDotJson.webName);
1460
+ assert.notEqual('', metadataDotJson.webName);
1461
+ assert.equal('Adapter', metadataDotJson.type);
1462
+ done();
1463
+ } catch (error) {
1464
+ log.error(`Test Failure: ${error}`);
1465
+ done(error);
1466
+ }
1467
+ });
1468
+ it('metadata.json contains accurate documentation', (done) => {
1469
+ try {
1470
+ const metadataDotJson = require('../../metadata.json');
1471
+ assert.notEqual(undefined, metadataDotJson.documentation);
1472
+ assert.equal('https://www.npmjs.com/package/@itentialopensource/adapter-winston_syslog', metadataDotJson.documentation.npmLink);
1473
+ assert.equal('https://docs.itential.com/opensource/docs/troubleshooting-an-adapter', metadataDotJson.documentation.faqLink);
1474
+ assert.equal('https://gitlab.com/itentialopensource/adapters/contributing-guide', metadataDotJson.documentation.contributeLink);
1475
+ assert.equal('https://itential.atlassian.net/servicedesk/customer/portals', metadataDotJson.documentation.issueLink);
1476
+ done();
1477
+ } catch (error) {
1478
+ log.error(`Test Failure: ${error}`);
1479
+ done(error);
1480
+ }
1481
+ });
1482
+ it('metadata.json has related items', (done) => {
1483
+ try {
1484
+ const metadataDotJson = require('../../metadata.json');
1485
+ assert.notEqual(undefined, metadataDotJson.relatedItems);
1486
+ assert.notEqual(undefined, metadataDotJson.relatedItems.adapters);
1487
+ assert.notEqual(undefined, metadataDotJson.relatedItems.integrations);
1488
+ assert.notEqual(undefined, metadataDotJson.relatedItems.ecosystemApplications);
1489
+ assert.notEqual(undefined, metadataDotJson.relatedItems.workflowProjects);
1490
+ assert.notEqual(undefined, metadataDotJson.relatedItems.transformationProjects);
1491
+ assert.notEqual(undefined, metadataDotJson.relatedItems.exampleProjects);
1492
+ done();
1493
+ } catch (error) {
1494
+ log.error(`Test Failure: ${error}`);
1495
+ done(error);
1496
+ }
1497
+ });
1498
+ });
1140
1499
  /*
1141
1500
  -----------------------------------------------------------------------
1142
1501
  -----------------------------------------------------------------------