@itentialopensource/adapter-netbrain 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +169 -0
  4. package/CHANGELOG.md +63 -27
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +88 -74
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +225 -502
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +434 -76
  14. package/adapterBase.js +1021 -245
  15. package/entities/.generic/action.json +110 -5
  16. package/entities/.generic/schema.json +6 -1
  17. package/error.json +12 -0
  18. package/package.json +18 -11
  19. package/pronghorn.json +646 -382
  20. package/propertiesDecorators.json +14 -0
  21. package/propertiesSchema.json +438 -2
  22. package/refs?service=git-upload-pack +0 -0
  23. package/report/adapterInfo.json +10 -0
  24. package/report/updateReport1653178689558.json +120 -0
  25. package/sampleProperties.json +94 -2
  26. package/test/integration/adapterTestBasicGet.js +1 -1
  27. package/test/integration/adapterTestIntegration.js +28 -104
  28. package/test/unit/adapterBaseTestUnit.js +34 -26
  29. package/test/unit/adapterTestUnit.js +641 -114
  30. package/utils/adapterInfo.js +206 -0
  31. package/utils/addAuth.js +94 -0
  32. package/utils/basicGet.js +1 -14
  33. package/utils/entitiesToDB.js +179 -0
  34. package/utils/modify.js +1 -1
  35. package/utils/patches2bundledDeps.js +90 -0
  36. package/utils/pre-commit.sh +3 -0
  37. package/utils/removeHooks.js +20 -0
  38. package/utils/tbScript.js +43 -22
  39. package/utils/tbUtils.js +126 -29
  40. package/utils/testRunner.js +16 -16
  41. package/utils/troubleshootingAdapter.js +2 -26
@@ -4,6 +4,7 @@
4
4
  /* global describe it log pronghornProps */
5
5
  /* eslint global-require: warn */
6
6
  /* eslint no-unused-vars: warn */
7
+ /* eslint import/no-dynamic-require:warn */
7
8
 
8
9
  // include required items for testing & logging
9
10
  const assert = require('assert');
@@ -18,22 +19,32 @@ const { use } = require('chai');
18
19
  const td = require('testdouble');
19
20
 
20
21
  const anything = td.matchers.anything();
21
-
22
- // stub and attemptTimeout are used throughout the code so set them here
23
22
  let logLevel = 'none';
24
- const stub = true;
25
23
  const isRapidFail = false;
26
- const attemptTimeout = 120000;
24
+
25
+ // read in the properties from the sampleProperties files
26
+ let adaptdir = __dirname;
27
+ if (adaptdir.endsWith('/test/integration')) {
28
+ adaptdir = adaptdir.substring(0, adaptdir.length - 17);
29
+ } else if (adaptdir.endsWith('/test/unit')) {
30
+ adaptdir = adaptdir.substring(0, adaptdir.length - 10);
31
+ }
32
+ const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
27
33
 
28
34
  // these variables can be changed to run in integrated mode so easier to set them here
29
35
  // always check these in with bogus data!!!
30
- const host = 'replace.hostorip.here';
31
- const username = 'username';
32
- const password = 'password';
33
- const protocol = 'http';
34
- const port = 80;
35
- const sslenable = false;
36
- const sslinvalid = false;
36
+ samProps.stub = true;
37
+ samProps.host = 'replace.hostorip.here';
38
+ samProps.authentication.username = 'username';
39
+ samProps.authentication.password = 'password';
40
+ samProps.protocol = 'http';
41
+ samProps.port = 80;
42
+ samProps.ssl.enabled = false;
43
+ samProps.ssl.accept_invalid_cert = false;
44
+ samProps.request.attempt_timeout = 60000;
45
+ const attemptTimeout = samProps.request.attempt_timeout;
46
+ const { stub } = samProps;
47
+ samProps.authentication.tenantId = '';
37
48
 
38
49
  // these are the adapter properties. You generally should not need to alter
39
50
  // any of these after they are initially set up
@@ -45,101 +56,7 @@ global.pronghornProps = {
45
56
  adapters: [{
46
57
  id: 'Test-netbrain',
47
58
  type: 'Netbrain',
48
- properties: {
49
- host,
50
- port,
51
- base_path: '/ServicesAPI/API',
52
- version: '',
53
- cache_location: 'none',
54
- encode_pathvars: true,
55
- save_metric: false,
56
- stub,
57
- protocol,
58
- authentication: {
59
- auth_method: 'request_token',
60
- username,
61
- password,
62
- token: '',
63
- invalid_token_error: 401,
64
- token_timeout: 1800000,
65
- token_cache: 'local',
66
- auth_field: 'header.headers.token',
67
- auth_field_format: '{token}',
68
- auth_logging: false,
69
- tenantId: '',
70
- domainId: ''
71
- },
72
- healthcheck: {
73
- type: 'intermittent',
74
- frequency: 600000,
75
- query_object: {}
76
- },
77
- throttle: {
78
- throttle_enabled: false,
79
- number_pronghorns: 1,
80
- sync_async: 'sync',
81
- max_in_queue: 1000,
82
- concurrent_max: 1,
83
- expire_timeout: 0,
84
- avg_runtime: 200,
85
- priorities: [
86
- {
87
- value: 0,
88
- percent: 100
89
- }
90
- ]
91
- },
92
- request: {
93
- number_redirects: 0,
94
- number_retries: 3,
95
- limit_retry_error: [0],
96
- failover_codes: [],
97
- attempt_timeout: attemptTimeout,
98
- global_request: {
99
- payload: {},
100
- uriOptions: {},
101
- addlHeaders: {},
102
- authData: {}
103
- },
104
- healthcheck_on_timeout: true,
105
- return_raw: true,
106
- archiving: false,
107
- return_request: false
108
- },
109
- proxy: {
110
- enabled: false,
111
- host: '',
112
- port: 1,
113
- protocol: 'http',
114
- username: '',
115
- password: ''
116
- },
117
- ssl: {
118
- ecdhCurve: '',
119
- enabled: sslenable,
120
- accept_invalid_cert: sslinvalid,
121
- ca_file: '',
122
- key_file: '',
123
- cert_file: '',
124
- secure_protocol: '',
125
- ciphers: ''
126
- },
127
- mongo: {
128
- host: '',
129
- port: 0,
130
- database: '',
131
- username: '',
132
- password: '',
133
- replSet: '',
134
- db_ssl: {
135
- enabled: false,
136
- accept_invalid_cert: false,
137
- ca_file: '',
138
- key_file: '',
139
- cert_file: ''
140
- }
141
- }
142
- }
59
+ properties: samProps
143
60
  }]
144
61
  }
145
62
  };
@@ -242,6 +159,8 @@ describe('[unit] Netbrain Adapter Test', () => {
242
159
  try {
243
160
  assert.notEqual(null, a);
244
161
  assert.notEqual(undefined, a);
162
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
163
+ assert.equal(checkId, a.id);
245
164
  assert.notEqual(null, a.allProps);
246
165
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
247
166
  assert.equal(check, a.healthcheckType);
@@ -268,10 +187,10 @@ describe('[unit] Netbrain Adapter Test', () => {
268
187
  });
269
188
 
270
189
  let wffunctions = [];
271
- describe('#getWorkflowFunctions', () => {
190
+ describe('#iapGetAdapterWorkflowFunctions', () => {
272
191
  it('should retrieve workflow functions', (done) => {
273
192
  try {
274
- wffunctions = a.getWorkflowFunctions([]);
193
+ wffunctions = a.iapGetAdapterWorkflowFunctions([]);
275
194
 
276
195
  try {
277
196
  assert.notEqual(0, wffunctions.length);
@@ -323,13 +242,103 @@ describe('[unit] Netbrain Adapter Test', () => {
323
242
  done(error);
324
243
  }
325
244
  });
326
- it('package.json should be customized', (done) => {
245
+ it('package.json standard fields should be customized', (done) => {
327
246
  try {
328
247
  const packageDotJson = require('../../package.json');
329
248
  assert.notEqual(-1, packageDotJson.name.indexOf('netbrain'));
330
249
  assert.notEqual(undefined, packageDotJson.version);
331
250
  assert.notEqual(null, packageDotJson.version);
332
251
  assert.notEqual('', packageDotJson.version);
252
+ assert.notEqual(undefined, packageDotJson.description);
253
+ assert.notEqual(null, packageDotJson.description);
254
+ assert.notEqual('', packageDotJson.description);
255
+ assert.equal('adapter.js', packageDotJson.main);
256
+ assert.notEqual(undefined, packageDotJson.wizardVersion);
257
+ assert.notEqual(null, packageDotJson.wizardVersion);
258
+ assert.notEqual('', packageDotJson.wizardVersion);
259
+ assert.notEqual(undefined, packageDotJson.engineVersion);
260
+ assert.notEqual(null, packageDotJson.engineVersion);
261
+ assert.notEqual('', packageDotJson.engineVersion);
262
+ assert.equal('http', packageDotJson.adapterType);
263
+ done();
264
+ } catch (error) {
265
+ log.error(`Test Failure: ${error}`);
266
+ done(error);
267
+ }
268
+ });
269
+ it('package.json proper scripts should be provided', (done) => {
270
+ try {
271
+ const packageDotJson = require('../../package.json');
272
+ assert.notEqual(undefined, packageDotJson.scripts);
273
+ assert.notEqual(null, packageDotJson.scripts);
274
+ assert.notEqual('', packageDotJson.scripts);
275
+ assert.equal('node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions', packageDotJson.scripts.preinstall);
276
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
277
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
278
+ assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
279
+ assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
280
+ assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
281
+ assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
282
+ assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
283
+ assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
284
+ assert.equal('npm run deploy', packageDotJson.scripts.build);
285
+ done();
286
+ } catch (error) {
287
+ log.error(`Test Failure: ${error}`);
288
+ done(error);
289
+ }
290
+ });
291
+ it('package.json proper directories should be provided', (done) => {
292
+ try {
293
+ const packageDotJson = require('../../package.json');
294
+ assert.notEqual(undefined, packageDotJson.repository);
295
+ assert.notEqual(null, packageDotJson.repository);
296
+ assert.notEqual('', packageDotJson.repository);
297
+ assert.equal('git', packageDotJson.repository.type);
298
+ assert.equal('git@gitlab.com:itentialopensource/adapters/', packageDotJson.repository.url.substring(0, 43));
299
+ assert.equal('https://gitlab.com/itentialopensource/adapters/', packageDotJson.homepage.substring(0, 47));
300
+ done();
301
+ } catch (error) {
302
+ log.error(`Test Failure: ${error}`);
303
+ done(error);
304
+ }
305
+ });
306
+ it('package.json proper dependencies should be provided', (done) => {
307
+ try {
308
+ const packageDotJson = require('../../package.json');
309
+ assert.notEqual(undefined, packageDotJson.dependencies);
310
+ assert.notEqual(null, packageDotJson.dependencies);
311
+ assert.notEqual('', packageDotJson.dependencies);
312
+ assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
313
+ assert.equal('^0.21.0', packageDotJson.dependencies.axios);
314
+ assert.equal('^2.20.0', packageDotJson.dependencies.commander);
315
+ assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
316
+ assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
317
+ assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
318
+ assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
319
+ assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
320
+ assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
321
+ assert.equal('^7.3.2', packageDotJson.dependencies.semver);
322
+ assert.equal('^3.3.3', packageDotJson.dependencies.winston);
323
+ done();
324
+ } catch (error) {
325
+ log.error(`Test Failure: ${error}`);
326
+ done(error);
327
+ }
328
+ });
329
+ it('package.json proper dev dependencies should be provided', (done) => {
330
+ try {
331
+ const packageDotJson = require('../../package.json');
332
+ assert.notEqual(undefined, packageDotJson.devDependencies);
333
+ assert.notEqual(null, packageDotJson.devDependencies);
334
+ assert.notEqual('', packageDotJson.devDependencies);
335
+ assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
336
+ assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
337
+ assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
338
+ assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
339
+ assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
340
+ assert.equal('^0.6.3', packageDotJson.devDependencies['package-json-validator']);
341
+ assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
333
342
  done();
334
343
  } catch (error) {
335
344
  log.error(`Test Failure: ${error}`);
@@ -354,8 +363,35 @@ describe('[unit] Netbrain Adapter Test', () => {
354
363
  try {
355
364
  const pronghornDotJson = require('../../pronghorn.json');
356
365
  assert.notEqual(-1, pronghornDotJson.id.indexOf('netbrain'));
366
+ assert.equal('Adapter', pronghornDotJson.type);
357
367
  assert.equal('Netbrain', pronghornDotJson.export);
358
368
  assert.equal('Netbrain', pronghornDotJson.title);
369
+ assert.equal('adapter.js', pronghornDotJson.src);
370
+ done();
371
+ } catch (error) {
372
+ log.error(`Test Failure: ${error}`);
373
+ done(error);
374
+ }
375
+ });
376
+ it('pronghorn.json should contain generic adapter methods', (done) => {
377
+ try {
378
+ const pronghornDotJson = require('../../pronghorn.json');
379
+ assert.notEqual(undefined, pronghornDotJson.methods);
380
+ assert.notEqual(null, pronghornDotJson.methods);
381
+ assert.notEqual('', pronghornDotJson.methods);
382
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
383
+ assert.notEqual(0, pronghornDotJson.methods.length);
384
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
385
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
386
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
387
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
388
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
389
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
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 === 'genericAdapterRequest'));
394
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
359
395
  done();
360
396
  } catch (error) {
361
397
  log.error(`Test Failure: ${error}`);
@@ -494,6 +530,124 @@ describe('[unit] Netbrain Adapter Test', () => {
494
530
  try {
495
531
  const propertiesDotJson = require('../../propertiesSchema.json');
496
532
  assert.equal('adapter-netbrain', propertiesDotJson.$id);
533
+ assert.equal('object', propertiesDotJson.type);
534
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
535
+ done();
536
+ } catch (error) {
537
+ log.error(`Test Failure: ${error}`);
538
+ done(error);
539
+ }
540
+ });
541
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
542
+ try {
543
+ const propertiesDotJson = require('../../propertiesSchema.json');
544
+ assert.notEqual(undefined, propertiesDotJson.properties);
545
+ assert.notEqual(null, propertiesDotJson.properties);
546
+ assert.notEqual('', propertiesDotJson.properties);
547
+ assert.equal('string', propertiesDotJson.properties.host.type);
548
+ assert.equal('integer', propertiesDotJson.properties.port.type);
549
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
550
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
551
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
552
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
553
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
554
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
555
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
556
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
557
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
558
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
559
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
560
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
561
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
562
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
563
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
564
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
565
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
566
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
567
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
568
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
569
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
570
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
571
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
572
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
573
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
574
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
575
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
576
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
577
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
578
+ assert.equal('string', propertiesDotJson.properties.version.type);
579
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
580
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
581
+ assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
582
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
583
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
584
+ assert.notEqual(undefined, propertiesDotJson.definitions);
585
+ assert.notEqual(null, propertiesDotJson.definitions);
586
+ assert.notEqual('', propertiesDotJson.definitions);
587
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
588
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
589
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
590
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
591
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
592
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
593
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
594
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
595
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
596
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
597
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
598
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
599
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
600
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
601
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
602
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
603
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
604
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
605
+ assert.notEqual(null, propertiesDotJson.definitions.request);
606
+ assert.notEqual('', propertiesDotJson.definitions.request);
607
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
608
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
609
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
610
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
611
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
612
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
613
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
614
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
615
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
616
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
617
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
618
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
619
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
620
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
621
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
622
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
623
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
624
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
625
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
626
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
627
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
628
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
629
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
630
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
631
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
632
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
633
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
634
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
635
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
636
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
637
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
638
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
639
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
640
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
641
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
642
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
643
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
644
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
645
+ assert.notEqual('', propertiesDotJson.definitions.devicebroker);
646
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
647
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
648
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
649
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
650
+ assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
497
651
  done();
498
652
  } catch (error) {
499
653
  log.error(`Test Failure: ${error}`);
@@ -514,6 +668,50 @@ describe('[unit] Netbrain Adapter Test', () => {
514
668
  done(error);
515
669
  }
516
670
  });
671
+ it('error.json should have standard adapter errors', (done) => {
672
+ try {
673
+ const errorDotJson = require('../../error.json');
674
+ assert.notEqual(undefined, errorDotJson.errors);
675
+ assert.notEqual(null, errorDotJson.errors);
676
+ assert.notEqual('', errorDotJson.errors);
677
+ assert.equal(true, Array.isArray(errorDotJson.errors));
678
+ assert.notEqual(0, errorDotJson.errors.length);
679
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
680
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
681
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
682
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
683
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
684
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
685
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
686
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
687
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
688
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
689
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
690
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
691
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
692
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
693
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
694
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
695
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
696
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
697
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
698
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
699
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
700
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
701
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
702
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
703
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
704
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
705
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
706
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
707
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
708
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
709
+ done();
710
+ } catch (error) {
711
+ log.error(`Test Failure: ${error}`);
712
+ done(error);
713
+ }
714
+ });
517
715
  });
518
716
 
519
717
  describe('sampleProperties.json', () => {
@@ -528,6 +726,121 @@ describe('[unit] Netbrain Adapter Test', () => {
528
726
  done(error);
529
727
  }
530
728
  });
729
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
730
+ try {
731
+ const sampleDotJson = require('../../sampleProperties.json');
732
+ assert.notEqual(-1, sampleDotJson.id.indexOf('netbrain'));
733
+ assert.equal('Netbrain', sampleDotJson.type);
734
+ assert.notEqual(undefined, sampleDotJson.properties);
735
+ assert.notEqual(null, sampleDotJson.properties);
736
+ assert.notEqual('', sampleDotJson.properties);
737
+ assert.notEqual(undefined, sampleDotJson.properties.host);
738
+ assert.notEqual(undefined, sampleDotJson.properties.port);
739
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
740
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
741
+ assert.notEqual(null, sampleDotJson.properties.authentication);
742
+ assert.notEqual('', sampleDotJson.properties.authentication);
743
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
744
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
745
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
746
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
747
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
748
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
749
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
750
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
751
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
752
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
753
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
754
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
755
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
756
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
757
+ assert.notEqual(null, sampleDotJson.properties.ssl);
758
+ assert.notEqual('', sampleDotJson.properties.ssl);
759
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
760
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
761
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
762
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
763
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
764
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
765
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
766
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
767
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
768
+ assert.notEqual(undefined, sampleDotJson.properties.version);
769
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
770
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
771
+ assert.notEqual(undefined, sampleDotJson.properties.encode_queryvars);
772
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
773
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
774
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
775
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
776
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
777
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
778
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
779
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
780
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
781
+ assert.notEqual(null, sampleDotJson.properties.throttle);
782
+ assert.notEqual('', sampleDotJson.properties.throttle);
783
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
784
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
785
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
786
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
787
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
788
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
789
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
790
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
791
+ assert.notEqual(undefined, sampleDotJson.properties.request);
792
+ assert.notEqual(null, sampleDotJson.properties.request);
793
+ assert.notEqual('', sampleDotJson.properties.request);
794
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
795
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
796
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
797
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
798
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
799
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
800
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
801
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
802
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
803
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
804
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
805
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
806
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
807
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
808
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
809
+ assert.notEqual(null, sampleDotJson.properties.proxy);
810
+ assert.notEqual('', sampleDotJson.properties.proxy);
811
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
812
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
813
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
814
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
815
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
816
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
817
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
818
+ assert.notEqual(null, sampleDotJson.properties.mongo);
819
+ assert.notEqual('', sampleDotJson.properties.mongo);
820
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
821
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
822
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
823
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
824
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
825
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
826
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
827
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
828
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
829
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
830
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
831
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
832
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker);
833
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevice);
834
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevicesFiltered);
835
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.isAlive);
836
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getConfig);
837
+ assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getCount);
838
+ done();
839
+ } catch (error) {
840
+ log.error(`Test Failure: ${error}`);
841
+ done(error);
842
+ }
843
+ });
531
844
  });
532
845
 
533
846
  describe('#checkProperties', () => {
@@ -615,6 +928,148 @@ describe('[unit] Netbrain Adapter Test', () => {
615
928
  });
616
929
  });
617
930
 
931
+ describe('#iapUpdateAdapterConfiguration', () => {
932
+ it('should have a iapUpdateAdapterConfiguration function', (done) => {
933
+ try {
934
+ assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
935
+ done();
936
+ } catch (error) {
937
+ log.error(`Test Failure: ${error}`);
938
+ done(error);
939
+ }
940
+ });
941
+ });
942
+
943
+ describe('#iapFindAdapterPath', () => {
944
+ it('should have a iapFindAdapterPath function', (done) => {
945
+ try {
946
+ assert.equal(true, typeof a.iapFindAdapterPath === 'function');
947
+ done();
948
+ } catch (error) {
949
+ log.error(`Test Failure: ${error}`);
950
+ done(error);
951
+ }
952
+ });
953
+ it('iapFindAdapterPath should find atleast one path that matches', (done) => {
954
+ try {
955
+ a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
956
+ try {
957
+ assert.equal(undefined, error);
958
+ assert.notEqual(undefined, data);
959
+ assert.notEqual(null, data);
960
+ assert.equal(true, data.found);
961
+ assert.notEqual(undefined, data.foundIn);
962
+ assert.notEqual(null, data.foundIn);
963
+ assert.notEqual(0, data.foundIn.length);
964
+ done();
965
+ } catch (err) {
966
+ log.error(`Test Failure: ${err}`);
967
+ done(err);
968
+ }
969
+ });
970
+ } catch (error) {
971
+ log.error(`Adapter Exception: ${error}`);
972
+ done(error);
973
+ }
974
+ }).timeout(attemptTimeout);
975
+ });
976
+
977
+ describe('#iapSuspendAdapter', () => {
978
+ it('should have a iapSuspendAdapter function', (done) => {
979
+ try {
980
+ assert.equal(true, typeof a.iapSuspendAdapter === 'function');
981
+ done();
982
+ } catch (error) {
983
+ log.error(`Test Failure: ${error}`);
984
+ done(error);
985
+ }
986
+ });
987
+ });
988
+
989
+ describe('#iapUnsuspendAdapter', () => {
990
+ it('should have a iapUnsuspendAdapter function', (done) => {
991
+ try {
992
+ assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
993
+ done();
994
+ } catch (error) {
995
+ log.error(`Test Failure: ${error}`);
996
+ done(error);
997
+ }
998
+ });
999
+ });
1000
+
1001
+ describe('#iapGetAdapterQueue', () => {
1002
+ it('should have a iapGetAdapterQueue function', (done) => {
1003
+ try {
1004
+ assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
1005
+ done();
1006
+ } catch (error) {
1007
+ log.error(`Test Failure: ${error}`);
1008
+ done(error);
1009
+ }
1010
+ });
1011
+ });
1012
+
1013
+ describe('#iapTroubleshootAdapter', () => {
1014
+ it('should have a iapTroubleshootAdapter function', (done) => {
1015
+ try {
1016
+ assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
1017
+ done();
1018
+ } catch (error) {
1019
+ log.error(`Test Failure: ${error}`);
1020
+ done(error);
1021
+ }
1022
+ });
1023
+ });
1024
+
1025
+ describe('#iapRunAdapterHealthcheck', () => {
1026
+ it('should have a iapRunAdapterHealthcheck function', (done) => {
1027
+ try {
1028
+ assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
1029
+ done();
1030
+ } catch (error) {
1031
+ log.error(`Test Failure: ${error}`);
1032
+ done(error);
1033
+ }
1034
+ });
1035
+ });
1036
+
1037
+ describe('#iapRunAdapterConnectivity', () => {
1038
+ it('should have a iapRunAdapterConnectivity function', (done) => {
1039
+ try {
1040
+ assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
1041
+ done();
1042
+ } catch (error) {
1043
+ log.error(`Test Failure: ${error}`);
1044
+ done(error);
1045
+ }
1046
+ });
1047
+ });
1048
+
1049
+ describe('#iapRunAdapterBasicGet', () => {
1050
+ it('should have a iapRunAdapterBasicGet function', (done) => {
1051
+ try {
1052
+ assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
1053
+ done();
1054
+ } catch (error) {
1055
+ log.error(`Test Failure: ${error}`);
1056
+ done(error);
1057
+ }
1058
+ });
1059
+ });
1060
+
1061
+ describe('#iapMoveAdapterEntitiesToDB', () => {
1062
+ it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
1063
+ try {
1064
+ assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
1065
+ done();
1066
+ } catch (error) {
1067
+ log.error(`Test Failure: ${error}`);
1068
+ done(error);
1069
+ }
1070
+ });
1071
+ });
1072
+
618
1073
  describe('#checkActionFiles', () => {
619
1074
  it('should have a checkActionFiles function', (done) => {
620
1075
  try {
@@ -700,10 +1155,10 @@ describe('[unit] Netbrain Adapter Test', () => {
700
1155
  }).timeout(attemptTimeout);
701
1156
  });
702
1157
 
703
- // describe('#hasEntity', () => {
704
- // it('should have a hasEntity function', (done) => {
1158
+ // describe('#iapHasAdapterEntity', () => {
1159
+ // it('should have a iapHasAdapterEntity function', (done) => {
705
1160
  // try {
706
- // assert.equal(true, typeof a.hasEntity === 'function');
1161
+ // assert.equal(true, typeof a.iapHasAdapterEntity === 'function');
707
1162
  // done();
708
1163
  // } catch (error) {
709
1164
  // log.error(`Test Failure: ${error}`);
@@ -712,7 +1167,7 @@ describe('[unit] Netbrain Adapter Test', () => {
712
1167
  // });
713
1168
  // it('should find entity', (done) => {
714
1169
  // try {
715
- // a.hasEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
1170
+ // a.iapHasAdapterEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
716
1171
  // try {
717
1172
  // assert.equal(true, data[0]);
718
1173
  // done();
@@ -728,7 +1183,7 @@ describe('[unit] Netbrain Adapter Test', () => {
728
1183
  // }).timeout(attemptTimeout);
729
1184
  // it('should not find entity', (done) => {
730
1185
  // try {
731
- // a.hasEntity('template_entity', 'blah', (data) => {
1186
+ // a.iapHasAdapterEntity('template_entity', 'blah', (data) => {
732
1187
  // try {
733
1188
  // assert.equal(false, data[0]);
734
1189
  // done();
@@ -744,6 +1199,78 @@ describe('[unit] Netbrain Adapter Test', () => {
744
1199
  // }).timeout(attemptTimeout);
745
1200
  // });
746
1201
 
1202
+ describe('#hasEntities', () => {
1203
+ it('should have a hasEntities function', (done) => {
1204
+ try {
1205
+ assert.equal(true, typeof a.hasEntities === 'function');
1206
+ done();
1207
+ } catch (error) {
1208
+ log.error(`Test Failure: ${error}`);
1209
+ done(error);
1210
+ }
1211
+ });
1212
+ });
1213
+
1214
+ describe('#getDevice', () => {
1215
+ it('should have a getDevice function', (done) => {
1216
+ try {
1217
+ assert.equal(true, typeof a.getDevice === 'function');
1218
+ done();
1219
+ } catch (error) {
1220
+ log.error(`Test Failure: ${error}`);
1221
+ done(error);
1222
+ }
1223
+ });
1224
+ });
1225
+
1226
+ describe('#getDevicesFiltered', () => {
1227
+ it('should have a getDevicesFiltered function', (done) => {
1228
+ try {
1229
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1230
+ done();
1231
+ } catch (error) {
1232
+ log.error(`Test Failure: ${error}`);
1233
+ done(error);
1234
+ }
1235
+ });
1236
+ });
1237
+
1238
+ describe('#isAlive', () => {
1239
+ it('should have a isAlive function', (done) => {
1240
+ try {
1241
+ assert.equal(true, typeof a.isAlive === 'function');
1242
+ done();
1243
+ } catch (error) {
1244
+ log.error(`Test Failure: ${error}`);
1245
+ done(error);
1246
+ }
1247
+ });
1248
+ });
1249
+
1250
+ describe('#getConfig', () => {
1251
+ it('should have a getConfig function', (done) => {
1252
+ try {
1253
+ assert.equal(true, typeof a.getConfig === 'function');
1254
+ done();
1255
+ } catch (error) {
1256
+ log.error(`Test Failure: ${error}`);
1257
+ done(error);
1258
+ }
1259
+ });
1260
+ });
1261
+
1262
+ describe('#iapGetDeviceCount', () => {
1263
+ it('should have a iapGetDeviceCount function', (done) => {
1264
+ try {
1265
+ assert.equal(true, typeof a.iapGetDeviceCount === 'function');
1266
+ done();
1267
+ } catch (error) {
1268
+ log.error(`Test Failure: ${error}`);
1269
+ done(error);
1270
+ }
1271
+ });
1272
+ });
1273
+
747
1274
  /*
748
1275
  -----------------------------------------------------------------------
749
1276
  -----------------------------------------------------------------------