@itentialopensource/adapter-aws_cloudformation 0.1.3 → 0.2.2

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 (87) hide show
  1. package/.eslintignore +1 -0
  2. package/AUTH.md +53 -0
  3. package/BROKER.md +199 -0
  4. package/CALLS.md +620 -0
  5. package/CHANGELOG.md +3 -18
  6. package/CODE_OF_CONDUCT.md +12 -17
  7. package/CONTRIBUTING.md +3 -148
  8. package/ENHANCE.md +69 -0
  9. package/PROPERTIES.md +641 -0
  10. package/README.md +240 -423
  11. package/SUMMARY.md +9 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +4788 -1315
  14. package/adapterBase.js +979 -278
  15. package/changelogs/CHANGELOG.md +48 -0
  16. package/entities/.generic/action.json +214 -0
  17. package/entities/.generic/schema.json +28 -0
  18. package/entities/.system/action.json +1 -1
  19. package/entities/Account/action.json +42 -0
  20. package/entities/Account/mockdatafiles/describePublisher-default.xml +6 -0
  21. package/entities/Account/mockdatafiles/registerPublisher-default.xml +6 -0
  22. package/entities/Account/schema.json +3 -1
  23. package/entities/ChangeSet/action.json +21 -0
  24. package/entities/ChangeSet/mockdatafiles/describeChangeSetHooks-default.xml +6 -0
  25. package/entities/ChangeSet/schema.json +2 -1
  26. package/entities/Organization/action.json +67 -0
  27. package/entities/Organization/mockdatafiles/activateOrganizationsAccess-default.xml +6 -0
  28. package/entities/Organization/mockdatafiles/deactivateOrganizationsAccess-default.xml +6 -0
  29. package/entities/Organization/mockdatafiles/describeOrganizationsAccess-default.xml +8 -0
  30. package/entities/Organization/schema.json +21 -0
  31. package/entities/Resource/action.json +21 -0
  32. package/entities/Resource/mockdatafiles/recordHandlerProgress-default.xml +6 -0
  33. package/entities/Resource/schema.json +2 -1
  34. package/entities/Stack/action.json +42 -0
  35. package/entities/Stack/mockdatafiles/importStacksToStackSet-default.xml +6 -0
  36. package/entities/Stack/mockdatafiles/rollbackStack-default.xml +6 -0
  37. package/entities/Stack/schema.json +3 -1
  38. package/entities/Type/action.json +126 -0
  39. package/entities/Type/mockdatafiles/activateType-default.xml +6 -0
  40. package/entities/Type/mockdatafiles/batchDescribeTypeConfigurations-default.xml +6 -0
  41. package/entities/Type/mockdatafiles/deactivateType-default.xml +6 -0
  42. package/entities/Type/mockdatafiles/publishType-default.xml +6 -0
  43. package/entities/Type/mockdatafiles/setTypeConfiguration-default.xml +6 -0
  44. package/entities/Type/mockdatafiles/testType-default.xml +6 -0
  45. package/entities/Type/schema.json +7 -1
  46. package/error.json +12 -0
  47. package/metadata.json +44 -0
  48. package/package.json +41 -20
  49. package/pronghorn.json +8996 -1335
  50. package/propertiesDecorators.json +14 -0
  51. package/propertiesSchema.json +877 -9
  52. package/refs?service=git-upload-pack +0 -0
  53. package/report/adapter-openapi.json +25034 -0
  54. package/report/adapter-openapi.yaml +22498 -0
  55. package/report/adapterInfo.json +10 -0
  56. package/report/updateReport1614638977739.json +95 -0
  57. package/report/updateReport1691507502657.json +120 -0
  58. package/report/updateReport1692202523445.json +120 -0
  59. package/report/updateReport1694461395239.json +120 -0
  60. package/report/updateReport1698420779793.json +120 -0
  61. package/sampleProperties.json +166 -9
  62. package/storage/metrics.json +1141 -0
  63. package/test/integration/adapterTestBasicGet.js +83 -0
  64. package/test/integration/adapterTestConnectivity.js +142 -0
  65. package/test/integration/adapterTestIntegration.js +541 -103
  66. package/test/unit/adapterBaseTestUnit.js +1024 -0
  67. package/test/unit/adapterTestUnit.js +1273 -218
  68. package/utils/adapterInfo.js +206 -0
  69. package/utils/addAuth.js +94 -0
  70. package/utils/artifactize.js +1 -1
  71. package/utils/basicGet.js +50 -0
  72. package/utils/checkMigrate.js +63 -0
  73. package/utils/entitiesToDB.js +179 -0
  74. package/utils/findPath.js +74 -0
  75. package/utils/methodDocumentor.js +273 -0
  76. package/utils/modify.js +152 -0
  77. package/utils/packModificationScript.js +2 -2
  78. package/utils/patches2bundledDeps.js +90 -0
  79. package/utils/pre-commit.sh +5 -0
  80. package/utils/removeHooks.js +20 -0
  81. package/utils/taskMover.js +309 -0
  82. package/utils/tbScript.js +239 -0
  83. package/utils/tbUtils.js +489 -0
  84. package/utils/testRunner.js +17 -17
  85. package/utils/troubleshootingAdapter.js +193 -0
  86. package/img/adapter.jpg +0 -0
  87. package/workflows/README.md +0 -3
@@ -3,12 +3,15 @@
3
3
  // Set globals
4
4
  /* global describe it log pronghornProps */
5
5
  /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
6
8
 
7
9
  // include required items for testing & logging
8
10
  const assert = require('assert');
9
11
  const fs = require('fs');
10
- const mocha = require('mocha');
11
12
  const path = require('path');
13
+ const util = require('util');
14
+ const mocha = require('mocha');
12
15
  const winston = require('winston');
13
16
  const { expect } = require('chai');
14
17
  const { use } = require('chai');
@@ -18,20 +21,33 @@ const anything = td.matchers.anything();
18
21
 
19
22
  // stub and attemptTimeout are used throughout the code so set them here
20
23
  let logLevel = 'none';
21
- const stub = true;
22
24
  const isRapidFail = false;
23
25
  const isSaveMockData = false;
24
- const attemptTimeout = 5000;
26
+
27
+ // read in the properties from the sampleProperties files
28
+ let adaptdir = __dirname;
29
+ if (adaptdir.endsWith('/test/integration')) {
30
+ adaptdir = adaptdir.substring(0, adaptdir.length - 17);
31
+ } else if (adaptdir.endsWith('/test/unit')) {
32
+ adaptdir = adaptdir.substring(0, adaptdir.length - 10);
33
+ }
34
+ const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
25
35
 
26
36
  // these variables can be changed to run in integrated mode so easier to set them here
27
37
  // always check these in with bogus data!!!
28
- const host = 'replace.hostorip.here';
29
- const username = 'username';
30
- const password = 'password';
31
- const protocol = 'http';
32
- const port = 80;
33
- const sslenable = false;
34
- const sslinvalid = false;
38
+ samProps.stub = true;
39
+ samProps.host = 'replace.hostorip.here';
40
+ samProps.authentication.username = 'username';
41
+ samProps.authentication.password = 'password';
42
+ samProps.protocol = 'http';
43
+ samProps.port = 80;
44
+ samProps.ssl.enabled = false;
45
+ samProps.ssl.accept_invalid_cert = false;
46
+ if (samProps.request.attempt_timeout < 30000) {
47
+ samProps.request.attempt_timeout = 30000;
48
+ }
49
+ const attemptTimeout = samProps.request.attempt_timeout;
50
+ const { stub } = samProps;
35
51
 
36
52
  // these are the adapter properties. You generally should not need to alter
37
53
  // any of these after they are initially set up
@@ -41,99 +57,9 @@ global.pronghornProps = {
41
57
  },
42
58
  adapterProps: {
43
59
  adapters: [{
44
- id: 'Test-awscloudFormation',
60
+ id: 'Test-aws_cloudformation',
45
61
  type: 'AwsCloudFormation',
46
- properties: {
47
- host,
48
- region: 'us-east-1',
49
- port,
50
- base_path: '/api',
51
- version: 'v2016-11-15',
52
- cache_location: 'none',
53
- encode_pathvars: true,
54
- save_metric: false,
55
- stub,
56
- protocol,
57
- authentication: {
58
- auth_method: 'no_authentication',
59
- username,
60
- password,
61
- access_key: 'access',
62
- secret_key: 'secret',
63
- token: '',
64
- invalid_token_error: 401,
65
- token_timeout: -1,
66
- token_cache: 'local',
67
- auth_field: 'header.headers.Authorization',
68
- auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
69
- },
70
- healthcheck: {
71
- type: 'none',
72
- frequency: 60000
73
- },
74
- throttle: {
75
- throttle_enabled: false,
76
- number_pronghorns: 1,
77
- sync_async: 'sync',
78
- max_in_queue: 1000,
79
- concurrent_max: 1,
80
- expire_timeout: 0,
81
- avg_runtime: 200,
82
- priorities: [
83
- {
84
- value: 0,
85
- percent: 100
86
- }
87
- ]
88
- },
89
- request: {
90
- number_redirects: 0,
91
- number_retries: 3,
92
- limit_retry_error: 0,
93
- failover_codes: [],
94
- attempt_timeout: attemptTimeout,
95
- global_request: {
96
- payload: {},
97
- uriOptions: {},
98
- addlHeaders: {},
99
- authData: {}
100
- },
101
- healthcheck_on_timeout: true,
102
- return_raw: true,
103
- archiving: false
104
- },
105
- proxy: {
106
- enabled: false,
107
- host: '',
108
- port: 1,
109
- protocol: 'http'
110
- },
111
- ssl: {
112
- ecdhCurve: '',
113
- enabled: sslenable,
114
- accept_invalid_cert: sslinvalid,
115
- ca_file: '',
116
- key_file: '',
117
- cert_file: '',
118
- secure_protocol: '',
119
- ciphers: ''
120
- },
121
- mongo: {
122
- host: '',
123
- port: 0,
124
- database: '',
125
- username: '',
126
- password: '',
127
- replSet: '',
128
- db_ssl: {
129
- enabled: sslenable,
130
- accept_invalid_cert: false,
131
- ca_file: '',
132
- key_file: '',
133
- cert_file: ''
134
- }
135
- }
136
- }
62
+ properties: samProps
137
63
  }]
138
64
  }
139
65
  };
@@ -308,7 +234,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
308
234
  }
309
235
 
310
236
  // require the adapter that we are going to be using
311
- const AwsCloudFormation = require('../../adapter.js');
237
+ const AwsCloudFormation = require('../../adapter');
312
238
 
313
239
  // begin the testing - these should be pretty well defined between the describe and the it!
314
240
  describe('[integration] AwsCloudFormation Adapter Test', () => {
@@ -339,6 +265,8 @@ describe('[integration] AwsCloudFormation Adapter Test', () => {
339
265
  try {
340
266
  assert.notEqual(null, a);
341
267
  assert.notEqual(undefined, a);
268
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
269
+ assert.equal(checkId, a.id);
342
270
  assert.notEqual(null, a.allProps);
343
271
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
344
272
  assert.equal(check, a.healthcheckType);
@@ -407,6 +335,134 @@ describe('[integration] AwsCloudFormation Adapter Test', () => {
407
335
  }).timeout(attemptTimeout);
408
336
  });
409
337
 
338
+ // broker tests
339
+ describe('#getDevicesFiltered - errors', () => {
340
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
341
+ try {
342
+ const opts = {
343
+ filter: {
344
+ name: 'deviceName'
345
+ }
346
+ };
347
+ a.getDevicesFiltered(opts, (data, error) => {
348
+ try {
349
+ if (stub) {
350
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
351
+ assert.equal(null, error);
352
+ assert.notEqual(undefined, data);
353
+ assert.notEqual(null, data);
354
+ assert.equal(0, data.total);
355
+ assert.equal(0, data.list.length);
356
+ } else {
357
+ const displayE = 'Error 400 received on request';
358
+ runErrorAsserts(data, error, 'AD.500', 'Test-aws_cloudformation-connectorRest-handleEndResponse', displayE);
359
+ }
360
+ } else {
361
+ runCommonAsserts(data, error);
362
+ }
363
+ done();
364
+ } catch (err) {
365
+ log.error(`Test Failure: ${err}`);
366
+ done(err);
367
+ }
368
+ });
369
+ } catch (error) {
370
+ log.error(`Adapter Exception: ${error}`);
371
+ done(error);
372
+ }
373
+ }).timeout(attemptTimeout);
374
+ });
375
+
376
+ describe('#iapGetDeviceCount - errors', () => {
377
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
378
+ try {
379
+ const opts = {
380
+ filter: {
381
+ name: 'deviceName'
382
+ }
383
+ };
384
+ a.iapGetDeviceCount((data, error) => {
385
+ try {
386
+ if (stub) {
387
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
388
+ assert.equal(null, error);
389
+ assert.notEqual(undefined, data);
390
+ assert.notEqual(null, data);
391
+ assert.equal(0, data.count);
392
+ } else {
393
+ const displayE = 'Error 400 received on request';
394
+ runErrorAsserts(data, error, 'AD.500', 'Test-aws_cloudformation-connectorRest-handleEndResponse', displayE);
395
+ }
396
+ } else {
397
+ runCommonAsserts(data, error);
398
+ }
399
+ done();
400
+ } catch (err) {
401
+ log.error(`Test Failure: ${err}`);
402
+ done(err);
403
+ }
404
+ });
405
+ } catch (error) {
406
+ log.error(`Adapter Exception: ${error}`);
407
+ done(error);
408
+ }
409
+ }).timeout(attemptTimeout);
410
+ });
411
+
412
+ // exposed cache tests
413
+ describe('#iapPopulateEntityCache - errors', () => {
414
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
415
+ try {
416
+ a.iapPopulateEntityCache('Device', (data, error) => {
417
+ try {
418
+ if (stub) {
419
+ assert.equal(null, data);
420
+ assert.notEqual(undefined, error);
421
+ assert.notEqual(null, error);
422
+ done();
423
+ } else {
424
+ assert.equal(undefined, error);
425
+ assert.equal('success', data[0]);
426
+ done();
427
+ }
428
+ } catch (err) {
429
+ log.error(`Test Failure: ${err}`);
430
+ done(err);
431
+ }
432
+ });
433
+ } catch (error) {
434
+ log.error(`Adapter Exception: ${error}`);
435
+ done(error);
436
+ }
437
+ }).timeout(attemptTimeout);
438
+ });
439
+
440
+ describe('#iapRetrieveEntitiesCache - errors', () => {
441
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
442
+ try {
443
+ a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
444
+ try {
445
+ if (stub) {
446
+ assert.equal(null, data);
447
+ assert.notEqual(null, error);
448
+ assert.notEqual(undefined, error);
449
+ } else {
450
+ assert.equal(undefined, error);
451
+ assert.notEqual(null, data);
452
+ assert.notEqual(undefined, data);
453
+ }
454
+ done();
455
+ } catch (err) {
456
+ log.error(`Test Failure: ${err}`);
457
+ done(err);
458
+ }
459
+ });
460
+ } catch (error) {
461
+ log.error(`Adapter Exception: ${error}`);
462
+ done(error);
463
+ }
464
+ }).timeout(attemptTimeout);
465
+ });
410
466
  /*
411
467
  -----------------------------------------------------------------------
412
468
  -----------------------------------------------------------------------
@@ -2131,5 +2187,387 @@ describe('[integration] AwsCloudFormation Adapter Test', () => {
2131
2187
  }
2132
2188
  }).timeout(attemptTimeout);
2133
2189
  });
2190
+
2191
+ describe('#activateOrganizationsAccess', () => {
2192
+ it('should work if integrated or standalone with mockdata', (done) => {
2193
+ try {
2194
+ a.activateOrganizationsAccess((data, error) => {
2195
+ try {
2196
+ runCommonAsserts(data, error);
2197
+ if (stub) {
2198
+ assert.equal('success', data.response);
2199
+ } else {
2200
+ assert.equal('success', data.response);
2201
+ }
2202
+ saveMockData('Organization', 'activateOrganizationsAccess', 'default', data);
2203
+ done();
2204
+ } catch (err) {
2205
+ log.error(`Test Failure: ${err}`);
2206
+ done(err);
2207
+ }
2208
+ });
2209
+ } catch (error) {
2210
+ log.error(`Adapter Exception: ${error}`);
2211
+ done(error);
2212
+ }
2213
+ }).timeout(attemptTimeout);
2214
+ });
2215
+
2216
+ describe('#activateType', () => {
2217
+ it('should work if integrated or standalone with mockdata', (done) => {
2218
+ try {
2219
+ a.activateType(null, null, null, null, null, null, null, null, null, null, (data, error) => {
2220
+ try {
2221
+ runCommonAsserts(data, error);
2222
+ if (stub) {
2223
+ assert.equal('success', data.response);
2224
+ } else {
2225
+ assert.equal('success', data.response);
2226
+ }
2227
+ saveMockData('Type', 'activateType', 'default', data);
2228
+ done();
2229
+ } catch (err) {
2230
+ log.error(`Test Failure: ${err}`);
2231
+ done(err);
2232
+ }
2233
+ });
2234
+ } catch (error) {
2235
+ log.error(`Adapter Exception: ${error}`);
2236
+ done(error);
2237
+ }
2238
+ }).timeout(attemptTimeout);
2239
+ });
2240
+
2241
+ const typeConfigurationIdentifiers = [{ fakedata: 'fakedata' }];
2242
+ describe('#batchDescribeTypeConfigurations', () => {
2243
+ it('should work if integrated or standalone with mockdata', (done) => {
2244
+ try {
2245
+ a.batchDescribeTypeConfigurations(typeConfigurationIdentifiers, (data, error) => {
2246
+ try {
2247
+ runCommonAsserts(data, error);
2248
+ if (stub) {
2249
+ assert.equal('success', data.response);
2250
+ } else {
2251
+ assert.equal('success', data.response);
2252
+ }
2253
+ saveMockData('Type', 'batchDescribeTypeConfigurations', 'default', data);
2254
+ done();
2255
+ } catch (err) {
2256
+ log.error(`Test Failure: ${err}`);
2257
+ done(err);
2258
+ }
2259
+ });
2260
+ } catch (error) {
2261
+ log.error(`Adapter Exception: ${error}`);
2262
+ done(error);
2263
+ }
2264
+ }).timeout(attemptTimeout);
2265
+ });
2266
+
2267
+ describe('#deactivateOrganizationsAccess', () => {
2268
+ it('should work if integrated or standalone with mockdata', (done) => {
2269
+ try {
2270
+ a.deactivateOrganizationsAccess((data, error) => {
2271
+ try {
2272
+ runCommonAsserts(data, error);
2273
+ if (stub) {
2274
+ assert.equal('success', data.response);
2275
+ } else {
2276
+ assert.equal('success', data.response);
2277
+ }
2278
+ saveMockData('Organization', 'deactivateOrganizationsAccess', 'default', data);
2279
+ done();
2280
+ } catch (err) {
2281
+ log.error(`Test Failure: ${err}`);
2282
+ done(err);
2283
+ }
2284
+ });
2285
+ } catch (error) {
2286
+ log.error(`Adapter Exception: ${error}`);
2287
+ done(error);
2288
+ }
2289
+ }).timeout(attemptTimeout);
2290
+ });
2291
+
2292
+ describe('#deactivateType', () => {
2293
+ it('should work if integrated or standalone with mockdata', (done) => {
2294
+ try {
2295
+ a.deactivateType(null, null, null, (data, error) => {
2296
+ try {
2297
+ runCommonAsserts(data, error);
2298
+ if (stub) {
2299
+ assert.equal('success', data.response);
2300
+ } else {
2301
+ assert.equal('success', data.response);
2302
+ }
2303
+ saveMockData('Type', 'deactivateType', 'default', data);
2304
+ done();
2305
+ } catch (err) {
2306
+ log.error(`Test Failure: ${err}`);
2307
+ done(err);
2308
+ }
2309
+ });
2310
+ } catch (error) {
2311
+ log.error(`Adapter Exception: ${error}`);
2312
+ done(error);
2313
+ }
2314
+ }).timeout(attemptTimeout);
2315
+ });
2316
+
2317
+ const changeSetName = 'fakedata';
2318
+ describe('#describeChangeSetHooks', () => {
2319
+ it('should work if integrated or standalone with mockdata', (done) => {
2320
+ try {
2321
+ a.describeChangeSetHooks(changeSetName, null, null, null, (data, error) => {
2322
+ try {
2323
+ runCommonAsserts(data, error);
2324
+ if (stub) {
2325
+ assert.equal('success', data.response);
2326
+ } else {
2327
+ assert.equal('success', data.response);
2328
+ }
2329
+ saveMockData('ChangeSet', 'describeChangeSetHooks', 'default', data);
2330
+ done();
2331
+ } catch (err) {
2332
+ log.error(`Test Failure: ${err}`);
2333
+ done(err);
2334
+ }
2335
+ });
2336
+ } catch (error) {
2337
+ log.error(`Adapter Exception: ${error}`);
2338
+ done(error);
2339
+ }
2340
+ }).timeout(attemptTimeout);
2341
+ });
2342
+
2343
+ describe('#describeOrganizationsAccess', () => {
2344
+ it('should work if integrated or standalone with mockdata', (done) => {
2345
+ try {
2346
+ a.describeOrganizationsAccess(null, (data, error) => {
2347
+ try {
2348
+ runCommonAsserts(data, error);
2349
+ if (stub) {
2350
+ assert.equal('success', data.response);
2351
+ } else {
2352
+ assert.equal('success', data.response);
2353
+ }
2354
+ saveMockData('Organization', 'describeOrganizationsAccess', 'default', data);
2355
+ done();
2356
+ } catch (err) {
2357
+ log.error(`Test Failure: ${err}`);
2358
+ done(err);
2359
+ }
2360
+ });
2361
+ } catch (error) {
2362
+ log.error(`Adapter Exception: ${error}`);
2363
+ done(error);
2364
+ }
2365
+ }).timeout(attemptTimeout);
2366
+ });
2367
+
2368
+ describe('#describePublisher', () => {
2369
+ it('should work if integrated or standalone with mockdata', (done) => {
2370
+ try {
2371
+ a.describePublisher(null, (data, error) => {
2372
+ try {
2373
+ runCommonAsserts(data, error);
2374
+ if (stub) {
2375
+ assert.equal('success', data.response);
2376
+ } else {
2377
+ assert.equal('success', data.response);
2378
+ }
2379
+ saveMockData('Account', 'describePublisher', 'default', data);
2380
+ done();
2381
+ } catch (err) {
2382
+ log.error(`Test Failure: ${err}`);
2383
+ done(err);
2384
+ }
2385
+ });
2386
+ } catch (error) {
2387
+ log.error(`Adapter Exception: ${error}`);
2388
+ done(error);
2389
+ }
2390
+ }).timeout(attemptTimeout);
2391
+ });
2392
+
2393
+ const stackSetName = 'fakedata';
2394
+ describe('#importStacksToStackSet', () => {
2395
+ it('should work if integrated or standalone with mockdata', (done) => {
2396
+ try {
2397
+ a.importStacksToStackSet(null, null, null, null, null, null, stackSetName, (data, error) => {
2398
+ try {
2399
+ runCommonAsserts(data, error);
2400
+ if (stub) {
2401
+ assert.equal('success', data.response);
2402
+ } else {
2403
+ assert.equal('success', data.response);
2404
+ }
2405
+ saveMockData('Stack', 'importStacksToStackSet', 'default', data);
2406
+ done();
2407
+ } catch (err) {
2408
+ log.error(`Test Failure: ${err}`);
2409
+ done(err);
2410
+ }
2411
+ });
2412
+ } catch (error) {
2413
+ log.error(`Adapter Exception: ${error}`);
2414
+ done(error);
2415
+ }
2416
+ }).timeout(attemptTimeout);
2417
+ });
2418
+
2419
+ describe('#publishType', () => {
2420
+ it('should work if integrated or standalone with mockdata', (done) => {
2421
+ try {
2422
+ a.publishType(null, null, null, null, (data, error) => {
2423
+ try {
2424
+ runCommonAsserts(data, error);
2425
+ if (stub) {
2426
+ assert.equal('success', data.response);
2427
+ } else {
2428
+ assert.equal('success', data.response);
2429
+ }
2430
+ saveMockData('Type', 'publishType', 'default', data);
2431
+ done();
2432
+ } catch (err) {
2433
+ log.error(`Test Failure: ${err}`);
2434
+ done(err);
2435
+ }
2436
+ });
2437
+ } catch (error) {
2438
+ log.error(`Adapter Exception: ${error}`);
2439
+ done(error);
2440
+ }
2441
+ }).timeout(attemptTimeout);
2442
+ });
2443
+
2444
+ const bearerToken = 'fakedata';
2445
+ const operationStatus = 'fakedata';
2446
+ describe('#recordHandlerProgress', () => {
2447
+ it('should work if integrated or standalone with mockdata', (done) => {
2448
+ try {
2449
+ a.recordHandlerProgress(bearerToken, null, null, null, operationStatus, null, null, (data, error) => {
2450
+ try {
2451
+ runCommonAsserts(data, error);
2452
+ if (stub) {
2453
+ assert.equal('success', data.response);
2454
+ } else {
2455
+ assert.equal('success', data.response);
2456
+ }
2457
+ saveMockData('Resource', 'recordHandlerProgress', 'default', data);
2458
+ done();
2459
+ } catch (err) {
2460
+ log.error(`Test Failure: ${err}`);
2461
+ done(err);
2462
+ }
2463
+ });
2464
+ } catch (error) {
2465
+ log.error(`Adapter Exception: ${error}`);
2466
+ done(error);
2467
+ }
2468
+ }).timeout(attemptTimeout);
2469
+ });
2470
+
2471
+ describe('#registerPublisher', () => {
2472
+ it('should work if integrated or standalone with mockdata', (done) => {
2473
+ try {
2474
+ a.registerPublisher(null, null, (data, error) => {
2475
+ try {
2476
+ runCommonAsserts(data, error);
2477
+ if (stub) {
2478
+ assert.equal('success', data.response);
2479
+ } else {
2480
+ assert.equal('success', data.response);
2481
+ }
2482
+ saveMockData('Account', 'registerPublisher', 'default', data);
2483
+ done();
2484
+ } catch (err) {
2485
+ log.error(`Test Failure: ${err}`);
2486
+ done(err);
2487
+ }
2488
+ });
2489
+ } catch (error) {
2490
+ log.error(`Adapter Exception: ${error}`);
2491
+ done(error);
2492
+ }
2493
+ }).timeout(attemptTimeout);
2494
+ });
2495
+
2496
+ const stackName = 'fakedata';
2497
+ describe('#rollbackStack', () => {
2498
+ it('should work if integrated or standalone with mockdata', (done) => {
2499
+ try {
2500
+ a.rollbackStack(null, null, stackName, (data, error) => {
2501
+ try {
2502
+ runCommonAsserts(data, error);
2503
+ if (stub) {
2504
+ assert.equal('success', data.response);
2505
+ } else {
2506
+ assert.equal('success', data.response);
2507
+ }
2508
+ saveMockData('Stack', 'rollbackStack', 'default', data);
2509
+ done();
2510
+ } catch (err) {
2511
+ log.error(`Test Failure: ${err}`);
2512
+ done(err);
2513
+ }
2514
+ });
2515
+ } catch (error) {
2516
+ log.error(`Adapter Exception: ${error}`);
2517
+ done(error);
2518
+ }
2519
+ }).timeout(attemptTimeout);
2520
+ });
2521
+
2522
+ const configuration = 'fakedata';
2523
+ describe('#setTypeConfiguration', () => {
2524
+ it('should work if integrated or standalone with mockdata', (done) => {
2525
+ try {
2526
+ a.setTypeConfiguration(configuration, null, null, null, null, (data, error) => {
2527
+ try {
2528
+ runCommonAsserts(data, error);
2529
+ if (stub) {
2530
+ assert.equal('success', data.response);
2531
+ } else {
2532
+ assert.equal('success', data.response);
2533
+ }
2534
+ saveMockData('Type', 'setTypeConfiguration', 'default', data);
2535
+ done();
2536
+ } catch (err) {
2537
+ log.error(`Test Failure: ${err}`);
2538
+ done(err);
2539
+ }
2540
+ });
2541
+ } catch (error) {
2542
+ log.error(`Adapter Exception: ${error}`);
2543
+ done(error);
2544
+ }
2545
+ }).timeout(attemptTimeout);
2546
+ });
2547
+
2548
+ describe('#testType', () => {
2549
+ it('should work if integrated or standalone with mockdata', (done) => {
2550
+ try {
2551
+ a.testType(null, null, null, null, null, (data, error) => {
2552
+ try {
2553
+ runCommonAsserts(data, error);
2554
+ if (stub) {
2555
+ assert.equal('success', data.response);
2556
+ } else {
2557
+ assert.equal('success', data.response);
2558
+ }
2559
+ saveMockData('Type', 'testType', 'default', data);
2560
+ done();
2561
+ } catch (err) {
2562
+ log.error(`Test Failure: ${err}`);
2563
+ done(err);
2564
+ }
2565
+ });
2566
+ } catch (error) {
2567
+ log.error(`Adapter Exception: ${error}`);
2568
+ done(error);
2569
+ }
2570
+ }).timeout(attemptTimeout);
2571
+ });
2134
2572
  });
2135
2573
  });