@itentialopensource/adapter-onap_blueprint_processor 0.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 (94) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +37 -0
  5. package/BROKER.md +211 -0
  6. package/CALLS.md +476 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +13 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +646 -0
  13. package/README.md +343 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +19 -0
  16. package/TAB1.md +11 -0
  17. package/TAB2.md +319 -0
  18. package/TROUBLESHOOT.md +47 -0
  19. package/adapter.js +4563 -0
  20. package/adapterBase.js +1452 -0
  21. package/changelogs/CHANGELOG.md +0 -0
  22. package/entities/.generic/action.json +214 -0
  23. package/entities/.generic/schema.json +28 -0
  24. package/entities/.system/action.json +50 -0
  25. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  26. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  27. package/entities/.system/schema.json +19 -0
  28. package/entities/.system/schemaTokenReq.json +53 -0
  29. package/entities/.system/schemaTokenResp.json +53 -0
  30. package/entities/BlueprintModelCatalog/action.json +374 -0
  31. package/entities/BlueprintModelCatalog/mockdatafiles/getAllBlueprintModels-default.json +41 -0
  32. package/entities/BlueprintModelCatalog/mockdatafiles/getAllBlueprintModelsByKeyword-default.json +28 -0
  33. package/entities/BlueprintModelCatalog/mockdatafiles/searchBlueprintModelsByTags-default.json +28 -0
  34. package/entities/BlueprintModelCatalog/schema.json +36 -0
  35. package/entities/ExecutionServiceCatalog/action.json +24 -0
  36. package/entities/ExecutionServiceCatalog/schema.json +19 -0
  37. package/entities/ModelTypeCatalog/action.json +87 -0
  38. package/entities/ModelTypeCatalog/mockdatafiles/getModelTypeByDefinitionType-default.json +68 -0
  39. package/entities/ModelTypeCatalog/mockdatafiles/searchModelTypesByTags-default.json +68 -0
  40. package/entities/ModelTypeCatalog/schema.json +22 -0
  41. package/entities/ResourceConfiguration/action.json +107 -0
  42. package/entities/ResourceConfiguration/mockdatafiles/getAllConfigSnapshotsByID-default.json +26 -0
  43. package/entities/ResourceConfiguration/mockdatafiles/getAllConfigSnapshotsByType-default.json +18 -0
  44. package/entities/ResourceConfiguration/schema.json +23 -0
  45. package/entities/ResourceDictionary/action.json +209 -0
  46. package/entities/ResourceDictionary/mockdatafiles/getAllResourceDictionaryGroups-default.json +6 -0
  47. package/entities/ResourceDictionary/mockdatafiles/searchResourceDictionaryByNames-default.json +14609 -0
  48. package/entities/ResourceDictionary/mockdatafiles/searchResourceDictionaryByTags-default.json +5329 -0
  49. package/entities/ResourceDictionary/schema.json +28 -0
  50. package/entities/ResourceTemplate/action.json +65 -0
  51. package/entities/ResourceTemplate/mockdatafiles/getTemplatesWithOccurrences-default.json +26 -0
  52. package/entities/ResourceTemplate/schema.json +21 -0
  53. package/entities/Resources/action.json +87 -0
  54. package/entities/Resources/mockdatafiles/getAllResourcesUsingResolutionKey-default.json +70 -0
  55. package/entities/Resources/mockdatafiles/getResourcesWithOccurrences-default.json +70 -0
  56. package/entities/Resources/schema.json +22 -0
  57. package/error.json +190 -0
  58. package/metadata.json +89 -0
  59. package/package.json +80 -0
  60. package/pronghorn.json +22633 -0
  61. package/propertiesDecorators.json +14 -0
  62. package/propertiesSchema.json +1658 -0
  63. package/refs?service=git-upload-pack +0 -0
  64. package/report/adapter-openapi.json +3789 -0
  65. package/report/adapter-openapi.yaml +2624 -0
  66. package/report/adapterInfo.json +10 -0
  67. package/report/cds-bp-processor-api-swagger.json +3203 -0
  68. package/report/creationReport.json +460 -0
  69. package/report/updateReport1727443189469.json +120 -0
  70. package/sampleProperties.json +268 -0
  71. package/test/integration/adapterTestBasicGet.js +83 -0
  72. package/test/integration/adapterTestConnectivity.js +142 -0
  73. package/test/integration/adapterTestIntegration.js +1693 -0
  74. package/test/unit/adapterBaseTestUnit.js +1024 -0
  75. package/test/unit/adapterTestUnit.js +3287 -0
  76. package/utils/adapterInfo.js +206 -0
  77. package/utils/addAuth.js +94 -0
  78. package/utils/artifactize.js +146 -0
  79. package/utils/basicGet.js +50 -0
  80. package/utils/checkMigrate.js +63 -0
  81. package/utils/entitiesToDB.js +179 -0
  82. package/utils/findPath.js +74 -0
  83. package/utils/methodDocumentor.js +273 -0
  84. package/utils/modify.js +152 -0
  85. package/utils/packModificationScript.js +35 -0
  86. package/utils/patches2bundledDeps.js +90 -0
  87. package/utils/pre-commit.sh +32 -0
  88. package/utils/removeHooks.js +20 -0
  89. package/utils/setup.js +33 -0
  90. package/utils/taskMover.js +309 -0
  91. package/utils/tbScript.js +239 -0
  92. package/utils/tbUtils.js +489 -0
  93. package/utils/testRunner.js +298 -0
  94. package/utils/troubleshootingAdapter.js +193 -0
@@ -0,0 +1,1693 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ // Set globals
4
+ /* global describe it log pronghornProps */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
8
+
9
+ // include required items for testing & logging
10
+ const assert = require('assert');
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const util = require('util');
14
+ const mocha = require('mocha');
15
+ const winston = require('winston');
16
+ const { expect } = require('chai');
17
+ const { use } = require('chai');
18
+ const td = require('testdouble');
19
+
20
+ const anything = td.matchers.anything();
21
+
22
+ // stub and attemptTimeout are used throughout the code so set them here
23
+ let logLevel = 'none';
24
+ const isRapidFail = false;
25
+ const isSaveMockData = false;
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;
35
+
36
+ // these variables can be changed to run in integrated mode so easier to set them here
37
+ // always check these in with bogus data!!!
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
+ samProps.devicebroker.enabled = true;
50
+ const attemptTimeout = samProps.request.attempt_timeout;
51
+ const { stub } = samProps;
52
+
53
+ // these are the adapter properties. You generally should not need to alter
54
+ // any of these after they are initially set up
55
+ global.pronghornProps = {
56
+ pathProps: {
57
+ encrypted: false
58
+ },
59
+ adapterProps: {
60
+ adapters: [{
61
+ id: 'Test-onap_blueprint_processor',
62
+ type: 'OnapBlueprintProcessor',
63
+ properties: samProps
64
+ }]
65
+ }
66
+ };
67
+
68
+ global.$HOME = `${__dirname}/../..`;
69
+
70
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
71
+ // this you may error on log.trace calls.
72
+ const myCustomLevels = {
73
+ levels: {
74
+ spam: 6,
75
+ trace: 5,
76
+ debug: 4,
77
+ info: 3,
78
+ warn: 2,
79
+ error: 1,
80
+ none: 0
81
+ }
82
+ };
83
+
84
+ // need to see if there is a log level passed in
85
+ process.argv.forEach((val) => {
86
+ // is there a log level defined to be passed in?
87
+ if (val.indexOf('--LOG') === 0) {
88
+ // get the desired log level
89
+ const inputVal = val.split('=')[1];
90
+
91
+ // validate the log level is supported, if so set it
92
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
93
+ logLevel = inputVal;
94
+ }
95
+ }
96
+ });
97
+
98
+ // need to set global logging
99
+ global.log = winston.createLogger({
100
+ level: logLevel,
101
+ levels: myCustomLevels.levels,
102
+ transports: [
103
+ new winston.transports.Console()
104
+ ]
105
+ });
106
+
107
+ /**
108
+ * Runs the common asserts for test
109
+ */
110
+ function runCommonAsserts(data, error) {
111
+ assert.equal(undefined, error);
112
+ assert.notEqual(undefined, data);
113
+ assert.notEqual(null, data);
114
+ assert.notEqual(undefined, data.response);
115
+ assert.notEqual(null, data.response);
116
+ }
117
+
118
+ /**
119
+ * Runs the error asserts for the test
120
+ */
121
+ function runErrorAsserts(data, error, code, origin, displayStr) {
122
+ assert.equal(null, data);
123
+ assert.notEqual(undefined, error);
124
+ assert.notEqual(null, error);
125
+ assert.notEqual(undefined, error.IAPerror);
126
+ assert.notEqual(null, error.IAPerror);
127
+ assert.notEqual(undefined, error.IAPerror.displayString);
128
+ assert.notEqual(null, error.IAPerror.displayString);
129
+ assert.equal(code, error.icode);
130
+ assert.equal(origin, error.IAPerror.origin);
131
+ assert.equal(displayStr, error.IAPerror.displayString);
132
+ }
133
+
134
+ /**
135
+ * @function saveMockData
136
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
137
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
138
+ * @param {string} entityName - Name of the entity saving mock data for
139
+ * @param {string} actionName - Name of the action saving mock data for
140
+ * @param {string} descriptor - Something to describe this test (used as a type)
141
+ * @param {string or object} responseData - The data to put in the mock file.
142
+ */
143
+ function saveMockData(entityName, actionName, descriptor, responseData) {
144
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
145
+ if (stub || !isSaveMockData) {
146
+ return false;
147
+ }
148
+
149
+ // must have a response in order to store the response
150
+ if (responseData && responseData.response) {
151
+ let data = responseData.response;
152
+
153
+ // if there was a raw response that one is better as it is untranslated
154
+ if (responseData.raw) {
155
+ data = responseData.raw;
156
+
157
+ try {
158
+ const temp = JSON.parse(data);
159
+ data = temp;
160
+ } catch (pex) {
161
+ // do not care if it did not parse as we will just use data
162
+ }
163
+ }
164
+
165
+ try {
166
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
167
+ const mockdatafolder = 'mockdatafiles';
168
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
169
+
170
+ if (!fs.existsSync(base + mockdatafolder)) {
171
+ fs.mkdirSync(base + mockdatafolder);
172
+ }
173
+
174
+ // write the data we retrieved
175
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
176
+ if (errWritingMock) throw errWritingMock;
177
+
178
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
179
+ fs.readFile(`${base}action.json`, (errRead, content) => {
180
+ if (errRead) throw errRead;
181
+
182
+ // parse the action file into JSON
183
+ const parsedJson = JSON.parse(content);
184
+
185
+ // The object update we'll write in.
186
+ const responseObj = {
187
+ type: descriptor,
188
+ key: '',
189
+ mockFile: filename
190
+ };
191
+
192
+ // get the object for method we're trying to change.
193
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
194
+
195
+ // if the method was not found - should never happen but...
196
+ if (!currentMethodAction) {
197
+ throw Error('Can\'t find an action for this method in the provided entity.');
198
+ }
199
+
200
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
201
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
202
+
203
+ // Add the action responseObj back into the array of response objects.
204
+ if (!actionResponseObj) {
205
+ // if there is a default response object, we want to get the key.
206
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
207
+
208
+ // save the default key into the new response object
209
+ if (defaultResponseObj) {
210
+ responseObj.key = defaultResponseObj.key;
211
+ }
212
+
213
+ // save the new response object
214
+ currentMethodAction.responseObjects = [responseObj];
215
+ } else {
216
+ // update the location of the mock data file
217
+ actionResponseObj.mockFile = responseObj.mockFile;
218
+ }
219
+
220
+ // Save results
221
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
222
+ if (err) throw err;
223
+ });
224
+ });
225
+ });
226
+ } catch (e) {
227
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
228
+ return false;
229
+ }
230
+ }
231
+
232
+ // no response to save
233
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
234
+ return false;
235
+ }
236
+
237
+ // require the adapter that we are going to be using
238
+ const OnapBlueprintProcessor = require('../../adapter');
239
+
240
+ // begin the testing - these should be pretty well defined between the describe and the it!
241
+ describe('[integration] Onap_blueprint_processor Adapter Test', () => {
242
+ describe('OnapBlueprintProcessor Class Tests', () => {
243
+ const a = new OnapBlueprintProcessor(
244
+ pronghornProps.adapterProps.adapters[0].id,
245
+ pronghornProps.adapterProps.adapters[0].properties
246
+ );
247
+
248
+ if (isRapidFail) {
249
+ const state = {};
250
+ state.passed = true;
251
+
252
+ mocha.afterEach(function x() {
253
+ state.passed = state.passed
254
+ && (this.currentTest.state === 'passed');
255
+ });
256
+ mocha.beforeEach(function x() {
257
+ if (!state.passed) {
258
+ return this.currentTest.skip();
259
+ }
260
+ return true;
261
+ });
262
+ }
263
+
264
+ describe('#class instance created', () => {
265
+ it('should be a class with properties', (done) => {
266
+ try {
267
+ assert.notEqual(null, a);
268
+ assert.notEqual(undefined, a);
269
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
270
+ assert.equal(checkId, a.id);
271
+ assert.notEqual(null, a.allProps);
272
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
273
+ assert.equal(check, a.healthcheckType);
274
+ done();
275
+ } catch (error) {
276
+ log.error(`Test Failure: ${error}`);
277
+ done(error);
278
+ }
279
+ }).timeout(attemptTimeout);
280
+ });
281
+
282
+ describe('#connect', () => {
283
+ it('should get connected - no healthcheck', (done) => {
284
+ try {
285
+ a.healthcheckType = 'none';
286
+ a.connect();
287
+
288
+ try {
289
+ assert.equal(true, a.alive);
290
+ done();
291
+ } catch (error) {
292
+ log.error(`Test Failure: ${error}`);
293
+ done(error);
294
+ }
295
+ } catch (error) {
296
+ log.error(`Adapter Exception: ${error}`);
297
+ done(error);
298
+ }
299
+ });
300
+ it('should get connected - startup healthcheck', (done) => {
301
+ try {
302
+ a.healthcheckType = 'startup';
303
+ a.connect();
304
+
305
+ try {
306
+ assert.equal(true, a.alive);
307
+ done();
308
+ } catch (error) {
309
+ log.error(`Test Failure: ${error}`);
310
+ done(error);
311
+ }
312
+ } catch (error) {
313
+ log.error(`Adapter Exception: ${error}`);
314
+ done(error);
315
+ }
316
+ });
317
+ });
318
+
319
+ describe('#healthCheck', () => {
320
+ it('should be healthy', (done) => {
321
+ try {
322
+ a.healthCheck(null, (data) => {
323
+ try {
324
+ assert.equal(true, a.healthy);
325
+ saveMockData('system', 'healthcheck', 'default', data);
326
+ done();
327
+ } catch (err) {
328
+ log.error(`Test Failure: ${err}`);
329
+ done(err);
330
+ }
331
+ });
332
+ } catch (error) {
333
+ log.error(`Adapter Exception: ${error}`);
334
+ done(error);
335
+ }
336
+ }).timeout(attemptTimeout);
337
+ });
338
+
339
+ // broker tests
340
+ describe('#getDevicesFiltered - errors', () => {
341
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
342
+ try {
343
+ const opts = {
344
+ filter: {
345
+ name: 'deviceName'
346
+ }
347
+ };
348
+ a.getDevicesFiltered(opts, (data, error) => {
349
+ try {
350
+ if (stub) {
351
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
352
+ assert.equal(null, error);
353
+ assert.notEqual(undefined, data);
354
+ assert.notEqual(null, data);
355
+ assert.equal(0, data.total);
356
+ assert.equal(0, data.list.length);
357
+ } else {
358
+ const displayE = 'Error 400 received on request';
359
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
360
+ }
361
+ } else {
362
+ runCommonAsserts(data, error);
363
+ }
364
+ done();
365
+ } catch (err) {
366
+ log.error(`Test Failure: ${err}`);
367
+ done(err);
368
+ }
369
+ });
370
+ } catch (error) {
371
+ log.error(`Adapter Exception: ${error}`);
372
+ done(error);
373
+ }
374
+ }).timeout(attemptTimeout);
375
+ });
376
+
377
+ describe('#iapGetDeviceCount - errors', () => {
378
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
379
+ try {
380
+ const opts = {
381
+ filter: {
382
+ name: 'deviceName'
383
+ }
384
+ };
385
+ a.iapGetDeviceCount((data, error) => {
386
+ try {
387
+ if (stub) {
388
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
389
+ assert.equal(null, error);
390
+ assert.notEqual(undefined, data);
391
+ assert.notEqual(null, data);
392
+ assert.equal(0, data.count);
393
+ } else {
394
+ const displayE = 'Error 400 received on request';
395
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
396
+ }
397
+ } else {
398
+ runCommonAsserts(data, error);
399
+ }
400
+ done();
401
+ } catch (err) {
402
+ log.error(`Test Failure: ${err}`);
403
+ done(err);
404
+ }
405
+ });
406
+ } catch (error) {
407
+ log.error(`Adapter Exception: ${error}`);
408
+ done(error);
409
+ }
410
+ }).timeout(attemptTimeout);
411
+ });
412
+
413
+ // exposed cache tests
414
+ describe('#iapPopulateEntityCache - errors', () => {
415
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
416
+ try {
417
+ a.iapPopulateEntityCache('Device', (data, error) => {
418
+ try {
419
+ if (stub) {
420
+ assert.equal(null, data);
421
+ assert.notEqual(undefined, error);
422
+ assert.notEqual(null, error);
423
+ done();
424
+ } else {
425
+ assert.equal(undefined, error);
426
+ assert.equal('success', data[0]);
427
+ done();
428
+ }
429
+ } catch (err) {
430
+ log.error(`Test Failure: ${err}`);
431
+ done(err);
432
+ }
433
+ });
434
+ } catch (error) {
435
+ log.error(`Adapter Exception: ${error}`);
436
+ done(error);
437
+ }
438
+ }).timeout(attemptTimeout);
439
+ });
440
+
441
+ describe('#iapRetrieveEntitiesCache - errors', () => {
442
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
443
+ try {
444
+ a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
445
+ try {
446
+ if (stub) {
447
+ assert.equal(null, data);
448
+ assert.notEqual(null, error);
449
+ assert.notEqual(undefined, error);
450
+ } else {
451
+ assert.equal(undefined, error);
452
+ assert.notEqual(null, data);
453
+ assert.notEqual(undefined, data);
454
+ }
455
+ done();
456
+ } catch (err) {
457
+ log.error(`Test Failure: ${err}`);
458
+ done(err);
459
+ }
460
+ });
461
+ } catch (error) {
462
+ log.error(`Adapter Exception: ${error}`);
463
+ done(error);
464
+ }
465
+ }).timeout(attemptTimeout);
466
+ });
467
+ /*
468
+ -----------------------------------------------------------------------
469
+ -----------------------------------------------------------------------
470
+ *** All code above this comment will be replaced during a migration ***
471
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
472
+ -----------------------------------------------------------------------
473
+ -----------------------------------------------------------------------
474
+ */
475
+
476
+ const blueprintModelCatalogSaveBlueprintModelBodyParam = {};
477
+ describe('#saveBlueprintModel - errors', () => {
478
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
479
+ try {
480
+ a.saveBlueprintModel(blueprintModelCatalogSaveBlueprintModelBodyParam, (data, error) => {
481
+ try {
482
+ if (stub) {
483
+ const displayE = 'Error 400 received on request';
484
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
485
+ } else {
486
+ runCommonAsserts(data, error);
487
+ }
488
+ saveMockData('BlueprintModelCatalog', 'saveBlueprintModel', 'default', data);
489
+ done();
490
+ } catch (err) {
491
+ log.error(`Test Failure: ${err}`);
492
+ done(err);
493
+ }
494
+ });
495
+ } catch (error) {
496
+ log.error(`Adapter Exception: ${error}`);
497
+ done(error);
498
+ }
499
+ }).timeout(attemptTimeout);
500
+ });
501
+
502
+ const blueprintModelCatalogBootstrapCDSBodyParam = {
503
+ loadModelType: true,
504
+ loadResourceDictionary: true,
505
+ loadCBA: true
506
+ };
507
+ describe('#bootstrapCDS - errors', () => {
508
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
509
+ try {
510
+ a.bootstrapCDS(blueprintModelCatalogBootstrapCDSBodyParam, (data, error) => {
511
+ try {
512
+ if (stub) {
513
+ const displayE = 'Error 400 received on request';
514
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
515
+ } else {
516
+ runCommonAsserts(data, error);
517
+ }
518
+ saveMockData('BlueprintModelCatalog', 'bootstrapCDS', 'default', data);
519
+ done();
520
+ } catch (err) {
521
+ log.error(`Test Failure: ${err}`);
522
+ done(err);
523
+ }
524
+ });
525
+ } catch (error) {
526
+ log.error(`Adapter Exception: ${error}`);
527
+ done(error);
528
+ }
529
+ }).timeout(attemptTimeout);
530
+ });
531
+
532
+ const blueprintModelCatalogEnrichBlueprintModelBodyParam = {};
533
+ describe('#enrichBlueprintModel - errors', () => {
534
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
535
+ try {
536
+ a.enrichBlueprintModel(blueprintModelCatalogEnrichBlueprintModelBodyParam, (data, error) => {
537
+ try {
538
+ if (stub) {
539
+ const displayE = 'Error 400 received on request';
540
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
541
+ } else {
542
+ runCommonAsserts(data, error);
543
+ }
544
+ saveMockData('BlueprintModelCatalog', 'enrichBlueprintModel', 'default', data);
545
+ done();
546
+ } catch (err) {
547
+ log.error(`Test Failure: ${err}`);
548
+ done(err);
549
+ }
550
+ });
551
+ } catch (error) {
552
+ log.error(`Adapter Exception: ${error}`);
553
+ done(error);
554
+ }
555
+ }).timeout(attemptTimeout);
556
+ });
557
+
558
+ const blueprintModelCatalogEnrichAndPublishBlueprintModelBodyParam = {};
559
+ describe('#enrichAndPublishBlueprintModel - errors', () => {
560
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
561
+ try {
562
+ a.enrichAndPublishBlueprintModel(blueprintModelCatalogEnrichAndPublishBlueprintModelBodyParam, (data, error) => {
563
+ try {
564
+ if (stub) {
565
+ const displayE = 'Error 400 received on request';
566
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
567
+ } else {
568
+ runCommonAsserts(data, error);
569
+ }
570
+ saveMockData('BlueprintModelCatalog', 'enrichAndPublishBlueprintModel', 'default', data);
571
+ done();
572
+ } catch (err) {
573
+ log.error(`Test Failure: ${err}`);
574
+ done(err);
575
+ }
576
+ });
577
+ } catch (error) {
578
+ log.error(`Adapter Exception: ${error}`);
579
+ done(error);
580
+ }
581
+ }).timeout(attemptTimeout);
582
+ });
583
+
584
+ const blueprintModelCatalogPublishBlueprintModelBodyParam = {};
585
+ describe('#publishBlueprintModel - errors', () => {
586
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
587
+ try {
588
+ a.publishBlueprintModel(blueprintModelCatalogPublishBlueprintModelBodyParam, (data, error) => {
589
+ try {
590
+ if (stub) {
591
+ const displayE = 'Error 400 received on request';
592
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
593
+ } else {
594
+ runCommonAsserts(data, error);
595
+ }
596
+ saveMockData('BlueprintModelCatalog', 'publishBlueprintModel', 'default', data);
597
+ done();
598
+ } catch (err) {
599
+ log.error(`Test Failure: ${err}`);
600
+ done(err);
601
+ }
602
+ });
603
+ } catch (error) {
604
+ log.error(`Adapter Exception: ${error}`);
605
+ done(error);
606
+ }
607
+ }).timeout(attemptTimeout);
608
+ });
609
+
610
+ const blueprintModelCatalogGetWorkflowSpecificationBodyParam = {
611
+ blueprintName: 'pnf_netconf',
612
+ workflowName: 'config-assign'
613
+ };
614
+ describe('#getWorkflowSpecification - errors', () => {
615
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
616
+ try {
617
+ a.getWorkflowSpecification(blueprintModelCatalogGetWorkflowSpecificationBodyParam, (data, error) => {
618
+ try {
619
+ if (stub) {
620
+ const displayE = 'Error 400 received on request';
621
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
622
+ } else {
623
+ runCommonAsserts(data, error);
624
+ }
625
+ saveMockData('BlueprintModelCatalog', 'getWorkflowSpecification', 'default', data);
626
+ done();
627
+ } catch (err) {
628
+ log.error(`Test Failure: ${err}`);
629
+ done(err);
630
+ }
631
+ });
632
+ } catch (error) {
633
+ log.error(`Adapter Exception: ${error}`);
634
+ done(error);
635
+ }
636
+ }).timeout(attemptTimeout);
637
+ });
638
+
639
+ describe('#getAllBlueprintModels - errors', () => {
640
+ it('should work if integrated or standalone with mockdata', (done) => {
641
+ try {
642
+ a.getAllBlueprintModels((data, error) => {
643
+ try {
644
+ if (stub) {
645
+ runCommonAsserts(data, error);
646
+ assert.equal('object', typeof data.response[0]);
647
+ assert.equal('object', typeof data.response[1]);
648
+ assert.equal('object', typeof data.response[2]);
649
+ } else {
650
+ runCommonAsserts(data, error);
651
+ }
652
+ saveMockData('BlueprintModelCatalog', 'getAllBlueprintModels', 'default', data);
653
+ done();
654
+ } catch (err) {
655
+ log.error(`Test Failure: ${err}`);
656
+ done(err);
657
+ }
658
+ });
659
+ } catch (error) {
660
+ log.error(`Adapter Exception: ${error}`);
661
+ done(error);
662
+ }
663
+ }).timeout(attemptTimeout);
664
+ });
665
+
666
+ const blueprintModelCatalogName = 'fakedata';
667
+ const blueprintModelCatalogVersion = 'fakedata';
668
+ describe('#getBlueprintModelByNameAndVersion - errors', () => {
669
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
670
+ try {
671
+ a.getBlueprintModelByNameAndVersion(blueprintModelCatalogName, blueprintModelCatalogVersion, (data, error) => {
672
+ try {
673
+ if (stub) {
674
+ const displayE = 'Error 400 received on request';
675
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
676
+ } else {
677
+ runCommonAsserts(data, error);
678
+ }
679
+ saveMockData('BlueprintModelCatalog', 'getBlueprintModelByNameAndVersion', 'default', data);
680
+ done();
681
+ } catch (err) {
682
+ log.error(`Test Failure: ${err}`);
683
+ done(err);
684
+ }
685
+ });
686
+ } catch (error) {
687
+ log.error(`Adapter Exception: ${error}`);
688
+ done(error);
689
+ }
690
+ }).timeout(attemptTimeout);
691
+ });
692
+
693
+ describe('#downloadBlueprintModelByNameAndVersion - errors', () => {
694
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
695
+ try {
696
+ a.downloadBlueprintModelByNameAndVersion(blueprintModelCatalogName, blueprintModelCatalogVersion, (data, error) => {
697
+ try {
698
+ if (stub) {
699
+ const displayE = 'Error 400 received on request';
700
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
701
+ } else {
702
+ runCommonAsserts(data, error);
703
+ }
704
+ saveMockData('BlueprintModelCatalog', 'downloadBlueprintModelByNameAndVersion', 'default', data);
705
+ done();
706
+ } catch (err) {
707
+ log.error(`Test Failure: ${err}`);
708
+ done(err);
709
+ }
710
+ });
711
+ } catch (error) {
712
+ log.error(`Adapter Exception: ${error}`);
713
+ done(error);
714
+ }
715
+ }).timeout(attemptTimeout);
716
+ });
717
+
718
+ const blueprintModelCatalogId = 'fakedata';
719
+ describe('#downloadBlueprintModelByID - errors', () => {
720
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
721
+ try {
722
+ a.downloadBlueprintModelByID(blueprintModelCatalogId, (data, error) => {
723
+ try {
724
+ if (stub) {
725
+ const displayE = 'Error 400 received on request';
726
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
727
+ } else {
728
+ runCommonAsserts(data, error);
729
+ }
730
+ saveMockData('BlueprintModelCatalog', 'downloadBlueprintModelByID', 'default', data);
731
+ done();
732
+ } catch (err) {
733
+ log.error(`Test Failure: ${err}`);
734
+ done(err);
735
+ }
736
+ });
737
+ } catch (error) {
738
+ log.error(`Adapter Exception: ${error}`);
739
+ done(error);
740
+ }
741
+ }).timeout(attemptTimeout);
742
+ });
743
+
744
+ const blueprintModelCatalogKeyword = 'fakedata';
745
+ describe('#getAllBlueprintModelsByKeyword - errors', () => {
746
+ it('should work if integrated or standalone with mockdata', (done) => {
747
+ try {
748
+ a.getAllBlueprintModelsByKeyword(blueprintModelCatalogKeyword, (data, error) => {
749
+ try {
750
+ if (stub) {
751
+ runCommonAsserts(data, error);
752
+ assert.equal('object', typeof data.response[0]);
753
+ assert.equal('object', typeof data.response[1]);
754
+ } else {
755
+ runCommonAsserts(data, error);
756
+ }
757
+ saveMockData('BlueprintModelCatalog', 'getAllBlueprintModelsByKeyword', 'default', data);
758
+ done();
759
+ } catch (err) {
760
+ log.error(`Test Failure: ${err}`);
761
+ done(err);
762
+ }
763
+ });
764
+ } catch (error) {
765
+ log.error(`Adapter Exception: ${error}`);
766
+ done(error);
767
+ }
768
+ }).timeout(attemptTimeout);
769
+ });
770
+
771
+ describe('#getAllBlueprintModelPaged - errors', () => {
772
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
773
+ try {
774
+ a.getAllBlueprintModelPaged(null, null, null, null, (data, error) => {
775
+ try {
776
+ if (stub) {
777
+ const displayE = 'Error 400 received on request';
778
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
779
+ } else {
780
+ runCommonAsserts(data, error);
781
+ }
782
+ saveMockData('BlueprintModelCatalog', 'getAllBlueprintModelPaged', 'default', data);
783
+ done();
784
+ } catch (err) {
785
+ log.error(`Test Failure: ${err}`);
786
+ done(err);
787
+ }
788
+ });
789
+ } catch (error) {
790
+ log.error(`Adapter Exception: ${error}`);
791
+ done(error);
792
+ }
793
+ }).timeout(attemptTimeout);
794
+ });
795
+
796
+ describe('#getAllBlueprintModelsPagedByKeyword - errors', () => {
797
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
798
+ try {
799
+ a.getAllBlueprintModelsPagedByKeyword(blueprintModelCatalogKeyword, null, null, null, null, (data, error) => {
800
+ try {
801
+ if (stub) {
802
+ const displayE = 'Error 400 received on request';
803
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
804
+ } else {
805
+ runCommonAsserts(data, error);
806
+ }
807
+ saveMockData('BlueprintModelCatalog', 'getAllBlueprintModelsPagedByKeyword', 'default', data);
808
+ done();
809
+ } catch (err) {
810
+ log.error(`Test Failure: ${err}`);
811
+ done(err);
812
+ }
813
+ });
814
+ } catch (error) {
815
+ log.error(`Adapter Exception: ${error}`);
816
+ done(error);
817
+ }
818
+ }).timeout(attemptTimeout);
819
+ });
820
+
821
+ const blueprintModelCatalogTags = 'fakedata';
822
+ describe('#searchBlueprintModelsByTags - errors', () => {
823
+ it('should work if integrated or standalone with mockdata', (done) => {
824
+ try {
825
+ a.searchBlueprintModelsByTags(blueprintModelCatalogTags, (data, error) => {
826
+ try {
827
+ if (stub) {
828
+ runCommonAsserts(data, error);
829
+ assert.equal('object', typeof data.response[0]);
830
+ assert.equal('object', typeof data.response[1]);
831
+ } else {
832
+ runCommonAsserts(data, error);
833
+ }
834
+ saveMockData('BlueprintModelCatalog', 'searchBlueprintModelsByTags', 'default', data);
835
+ done();
836
+ } catch (err) {
837
+ log.error(`Test Failure: ${err}`);
838
+ done(err);
839
+ }
840
+ });
841
+ } catch (error) {
842
+ log.error(`Adapter Exception: ${error}`);
843
+ done(error);
844
+ }
845
+ }).timeout(attemptTimeout);
846
+ });
847
+
848
+ describe('#getBlueprintWorkflowsByNameAndVersion - errors', () => {
849
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
850
+ try {
851
+ a.getBlueprintWorkflowsByNameAndVersion(blueprintModelCatalogName, blueprintModelCatalogVersion, (data, error) => {
852
+ try {
853
+ if (stub) {
854
+ const displayE = 'Error 400 received on request';
855
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
856
+ } else {
857
+ runCommonAsserts(data, error);
858
+ }
859
+ saveMockData('BlueprintModelCatalog', 'getBlueprintWorkflowsByNameAndVersion', 'default', data);
860
+ done();
861
+ } catch (err) {
862
+ log.error(`Test Failure: ${err}`);
863
+ done(err);
864
+ }
865
+ });
866
+ } catch (error) {
867
+ log.error(`Adapter Exception: ${error}`);
868
+ done(error);
869
+ }
870
+ }).timeout(attemptTimeout);
871
+ });
872
+
873
+ describe('#getBlueprintModelByID - errors', () => {
874
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
875
+ try {
876
+ a.getBlueprintModelByID(blueprintModelCatalogId, (data, error) => {
877
+ try {
878
+ if (stub) {
879
+ const displayE = 'Error 400 received on request';
880
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
881
+ } else {
882
+ runCommonAsserts(data, error);
883
+ }
884
+ saveMockData('BlueprintModelCatalog', 'getBlueprintModelByID', 'default', data);
885
+ done();
886
+ } catch (err) {
887
+ log.error(`Test Failure: ${err}`);
888
+ done(err);
889
+ }
890
+ });
891
+ } catch (error) {
892
+ log.error(`Adapter Exception: ${error}`);
893
+ done(error);
894
+ }
895
+ }).timeout(attemptTimeout);
896
+ });
897
+
898
+ const resourceConfigurationResourceType = 'fakedata';
899
+ const resourceConfigurationResourceId = 'fakedata';
900
+ const resourceConfigurationStatus = 'fakedata';
901
+ const resourceConfigurationStoreConfigSnapshotByResourceIdAndResourceTypeBodyParam = {};
902
+ describe('#storeConfigSnapshotByResourceIdAndResourceType - errors', () => {
903
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
904
+ try {
905
+ a.storeConfigSnapshotByResourceIdAndResourceType(resourceConfigurationResourceType, resourceConfigurationResourceId, resourceConfigurationStatus, resourceConfigurationStoreConfigSnapshotByResourceIdAndResourceTypeBodyParam, (data, error) => {
906
+ try {
907
+ if (stub) {
908
+ const displayE = 'Error 400 received on request';
909
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
910
+ } else {
911
+ runCommonAsserts(data, error);
912
+ }
913
+ saveMockData('ResourceConfiguration', 'storeConfigSnapshotByResourceIdAndResourceType', 'default', data);
914
+ done();
915
+ } catch (err) {
916
+ log.error(`Test Failure: ${err}`);
917
+ done(err);
918
+ }
919
+ });
920
+ } catch (error) {
921
+ log.error(`Adapter Exception: ${error}`);
922
+ done(error);
923
+ }
924
+ }).timeout(attemptTimeout);
925
+ });
926
+
927
+ describe('#getResourceConfigSnapshot - errors', () => {
928
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
929
+ try {
930
+ a.getResourceConfigSnapshot(resourceConfigurationResourceType, resourceConfigurationResourceId, resourceConfigurationStatus, null, (data, error) => {
931
+ try {
932
+ if (stub) {
933
+ const displayE = 'Error 400 received on request';
934
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
935
+ } else {
936
+ runCommonAsserts(data, error);
937
+ }
938
+ saveMockData('ResourceConfiguration', 'getResourceConfigSnapshot', 'default', data);
939
+ done();
940
+ } catch (err) {
941
+ log.error(`Test Failure: ${err}`);
942
+ done(err);
943
+ }
944
+ });
945
+ } catch (error) {
946
+ log.error(`Adapter Exception: ${error}`);
947
+ done(error);
948
+ }
949
+ }).timeout(attemptTimeout);
950
+ });
951
+
952
+ describe('#getAllConfigSnapshotsByID - errors', () => {
953
+ it('should work if integrated or standalone with mockdata', (done) => {
954
+ try {
955
+ a.getAllConfigSnapshotsByID(resourceConfigurationResourceId, resourceConfigurationStatus, (data, error) => {
956
+ try {
957
+ if (stub) {
958
+ runCommonAsserts(data, error);
959
+ assert.equal('object', typeof data.response[0]);
960
+ assert.equal('object', typeof data.response[1]);
961
+ assert.equal('object', typeof data.response[2]);
962
+ } else {
963
+ runCommonAsserts(data, error);
964
+ }
965
+ saveMockData('ResourceConfiguration', 'getAllConfigSnapshotsByID', 'default', data);
966
+ done();
967
+ } catch (err) {
968
+ log.error(`Test Failure: ${err}`);
969
+ done(err);
970
+ }
971
+ });
972
+ } catch (error) {
973
+ log.error(`Adapter Exception: ${error}`);
974
+ done(error);
975
+ }
976
+ }).timeout(attemptTimeout);
977
+ });
978
+
979
+ describe('#getAllConfigSnapshotsByType - errors', () => {
980
+ it('should work if integrated or standalone with mockdata', (done) => {
981
+ try {
982
+ a.getAllConfigSnapshotsByType(resourceConfigurationResourceType, resourceConfigurationStatus, (data, error) => {
983
+ try {
984
+ if (stub) {
985
+ runCommonAsserts(data, error);
986
+ assert.equal('object', typeof data.response[0]);
987
+ assert.equal('object', typeof data.response[1]);
988
+ } else {
989
+ runCommonAsserts(data, error);
990
+ }
991
+ saveMockData('ResourceConfiguration', 'getAllConfigSnapshotsByType', 'default', data);
992
+ done();
993
+ } catch (err) {
994
+ log.error(`Test Failure: ${err}`);
995
+ done(err);
996
+ }
997
+ });
998
+ } catch (error) {
999
+ log.error(`Adapter Exception: ${error}`);
1000
+ done(error);
1001
+ }
1002
+ }).timeout(attemptTimeout);
1003
+ });
1004
+
1005
+ const resourceDictionarySaveResourceDictionaryBodyParam = {
1006
+ name: 'sample-db-source',
1007
+ dataType: 'string',
1008
+ entrySchema: 'dt-license-key',
1009
+ resourceDictionaryGroup: 'default',
1010
+ definition: {
1011
+ tags: 'string',
1012
+ name: 'default-source'
1013
+ },
1014
+ description: 'demo_artifacts_version',
1015
+ tags: 'hostname',
1016
+ updatedBy: 'username'
1017
+ };
1018
+ describe('#saveResourceDictionary - errors', () => {
1019
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1020
+ try {
1021
+ a.saveResourceDictionary(resourceDictionarySaveResourceDictionaryBodyParam, (data, error) => {
1022
+ try {
1023
+ if (stub) {
1024
+ const displayE = 'Error 400 received on request';
1025
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1026
+ } else {
1027
+ runCommonAsserts(data, error);
1028
+ }
1029
+ saveMockData('ResourceDictionary', 'saveResourceDictionary', 'default', data);
1030
+ done();
1031
+ } catch (err) {
1032
+ log.error(`Test Failure: ${err}`);
1033
+ done(err);
1034
+ }
1035
+ });
1036
+ } catch (error) {
1037
+ log.error(`Adapter Exception: ${error}`);
1038
+ done(error);
1039
+ }
1040
+ }).timeout(attemptTimeout);
1041
+ });
1042
+
1043
+ const resourceDictionarySearchResourceDictionaryByNamesBodyParam = [
1044
+ 'string'
1045
+ ];
1046
+ describe('#searchResourceDictionaryByNames - errors', () => {
1047
+ it('should work if integrated or standalone with mockdata', (done) => {
1048
+ try {
1049
+ a.searchResourceDictionaryByNames(resourceDictionarySearchResourceDictionaryByNamesBodyParam, (data, error) => {
1050
+ try {
1051
+ if (stub) {
1052
+ runCommonAsserts(data, error);
1053
+ assert.equal('object', typeof data.response[0]);
1054
+ assert.equal('object', typeof data.response[1]);
1055
+ assert.equal('object', typeof data.response[2]);
1056
+ } else {
1057
+ runCommonAsserts(data, error);
1058
+ }
1059
+ saveMockData('ResourceDictionary', 'searchResourceDictionaryByNames', 'default', data);
1060
+ done();
1061
+ } catch (err) {
1062
+ log.error(`Test Failure: ${err}`);
1063
+ done(err);
1064
+ }
1065
+ });
1066
+ } catch (error) {
1067
+ log.error(`Adapter Exception: ${error}`);
1068
+ done(error);
1069
+ }
1070
+ }).timeout(attemptTimeout);
1071
+ });
1072
+
1073
+ const resourceDictionarySaveResourceDictionaryByDefinitionBodyParam = {
1074
+ name: 'default-source',
1075
+ property: {},
1076
+ group: 'default',
1077
+ 'updated-by': 'example@onap.com',
1078
+ sources: 'sources'
1079
+ };
1080
+ describe('#saveResourceDictionaryByDefinition - errors', () => {
1081
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1082
+ try {
1083
+ a.saveResourceDictionaryByDefinition(resourceDictionarySaveResourceDictionaryByDefinitionBodyParam, (data, error) => {
1084
+ try {
1085
+ if (stub) {
1086
+ const displayE = 'Error 400 received on request';
1087
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1088
+ } else {
1089
+ runCommonAsserts(data, error);
1090
+ }
1091
+ saveMockData('ResourceDictionary', 'saveResourceDictionaryByDefinition', 'default', data);
1092
+ done();
1093
+ } catch (err) {
1094
+ log.error(`Test Failure: ${err}`);
1095
+ done(err);
1096
+ }
1097
+ });
1098
+ } catch (error) {
1099
+ log.error(`Adapter Exception: ${error}`);
1100
+ done(error);
1101
+ }
1102
+ }).timeout(attemptTimeout);
1103
+ });
1104
+
1105
+ const resourceDictionarySaveMultipleDictionariesByDefinitionBodyParam = [
1106
+ {}
1107
+ ];
1108
+ describe('#saveMultipleDictionariesByDefinition - errors', () => {
1109
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1110
+ try {
1111
+ a.saveMultipleDictionariesByDefinition(resourceDictionarySaveMultipleDictionariesByDefinitionBodyParam, (data, error) => {
1112
+ try {
1113
+ if (stub) {
1114
+ const displayE = 'Error 400 received on request';
1115
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1116
+ } else {
1117
+ runCommonAsserts(data, error);
1118
+ }
1119
+ saveMockData('ResourceDictionary', 'saveMultipleDictionariesByDefinition', 'default', data);
1120
+ done();
1121
+ } catch (err) {
1122
+ log.error(`Test Failure: ${err}`);
1123
+ done(err);
1124
+ }
1125
+ });
1126
+ } catch (error) {
1127
+ log.error(`Adapter Exception: ${error}`);
1128
+ done(error);
1129
+ }
1130
+ }).timeout(attemptTimeout);
1131
+ });
1132
+
1133
+ describe('#getAllBlueprintDictionaryPaged - errors', () => {
1134
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1135
+ try {
1136
+ a.getAllBlueprintDictionaryPaged(null, null, null, null, (data, error) => {
1137
+ try {
1138
+ if (stub) {
1139
+ const displayE = 'Error 400 received on request';
1140
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1141
+ } else {
1142
+ runCommonAsserts(data, error);
1143
+ }
1144
+ saveMockData('ResourceDictionary', 'getAllBlueprintDictionaryPaged', 'default', data);
1145
+ done();
1146
+ } catch (err) {
1147
+ log.error(`Test Failure: ${err}`);
1148
+ done(err);
1149
+ }
1150
+ });
1151
+ } catch (error) {
1152
+ log.error(`Adapter Exception: ${error}`);
1153
+ done(error);
1154
+ }
1155
+ }).timeout(attemptTimeout);
1156
+ });
1157
+
1158
+ describe('#getAllResourceDictionaryGroups - errors', () => {
1159
+ it('should work if integrated or standalone with mockdata', (done) => {
1160
+ try {
1161
+ a.getAllResourceDictionaryGroups((data, error) => {
1162
+ try {
1163
+ if (stub) {
1164
+ runCommonAsserts(data, error);
1165
+ assert.equal('string', data.response[0]);
1166
+ assert.equal('string', data.response[1]);
1167
+ assert.equal('string', data.response[2]);
1168
+ assert.equal('string', data.response[3]);
1169
+ } else {
1170
+ runCommonAsserts(data, error);
1171
+ }
1172
+ saveMockData('ResourceDictionary', 'getAllResourceDictionaryGroups', 'default', data);
1173
+ done();
1174
+ } catch (err) {
1175
+ log.error(`Test Failure: ${err}`);
1176
+ done(err);
1177
+ }
1178
+ });
1179
+ } catch (error) {
1180
+ log.error(`Adapter Exception: ${error}`);
1181
+ done(error);
1182
+ }
1183
+ }).timeout(attemptTimeout);
1184
+ });
1185
+
1186
+ const resourceDictionaryTags = 'fakedata';
1187
+ describe('#searchResourceDictionaryByTags - errors', () => {
1188
+ it('should work if integrated or standalone with mockdata', (done) => {
1189
+ try {
1190
+ a.searchResourceDictionaryByTags(resourceDictionaryTags, (data, error) => {
1191
+ try {
1192
+ if (stub) {
1193
+ runCommonAsserts(data, error);
1194
+ assert.equal('object', typeof data.response[0]);
1195
+ } else {
1196
+ runCommonAsserts(data, error);
1197
+ }
1198
+ saveMockData('ResourceDictionary', 'searchResourceDictionaryByTags', 'default', data);
1199
+ done();
1200
+ } catch (err) {
1201
+ log.error(`Test Failure: ${err}`);
1202
+ done(err);
1203
+ }
1204
+ });
1205
+ } catch (error) {
1206
+ log.error(`Adapter Exception: ${error}`);
1207
+ done(error);
1208
+ }
1209
+ }).timeout(attemptTimeout);
1210
+ });
1211
+
1212
+ describe('#getSourceMapping - errors', () => {
1213
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1214
+ try {
1215
+ a.getSourceMapping((data, error) => {
1216
+ try {
1217
+ if (stub) {
1218
+ const displayE = 'Error 400 received on request';
1219
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1220
+ } else {
1221
+ runCommonAsserts(data, error);
1222
+ }
1223
+ saveMockData('ResourceDictionary', 'getSourceMapping', 'default', data);
1224
+ done();
1225
+ } catch (err) {
1226
+ log.error(`Test Failure: ${err}`);
1227
+ done(err);
1228
+ }
1229
+ });
1230
+ } catch (error) {
1231
+ log.error(`Adapter Exception: ${error}`);
1232
+ done(error);
1233
+ }
1234
+ }).timeout(attemptTimeout);
1235
+ });
1236
+
1237
+ const resourceDictionaryName = 'fakedata';
1238
+ describe('#getResourceDictionaryByName - errors', () => {
1239
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1240
+ try {
1241
+ a.getResourceDictionaryByName(resourceDictionaryName, (data, error) => {
1242
+ try {
1243
+ if (stub) {
1244
+ const displayE = 'Error 400 received on request';
1245
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1246
+ } else {
1247
+ runCommonAsserts(data, error);
1248
+ }
1249
+ saveMockData('ResourceDictionary', 'getResourceDictionaryByName', 'default', data);
1250
+ done();
1251
+ } catch (err) {
1252
+ log.error(`Test Failure: ${err}`);
1253
+ done(err);
1254
+ }
1255
+ });
1256
+ } catch (error) {
1257
+ log.error(`Adapter Exception: ${error}`);
1258
+ done(error);
1259
+ }
1260
+ }).timeout(attemptTimeout);
1261
+ });
1262
+
1263
+ const executionServiceCatalogExecuteCBAWorkflowActionBodyParam = {
1264
+ commonHeader: {},
1265
+ actionIdentifiers: {},
1266
+ payload: {}
1267
+ };
1268
+ describe('#executeCBAWorkflowAction - errors', () => {
1269
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1270
+ try {
1271
+ a.executeCBAWorkflowAction(executionServiceCatalogExecuteCBAWorkflowActionBodyParam, (data, error) => {
1272
+ try {
1273
+ if (stub) {
1274
+ const displayE = 'Error 400 received on request';
1275
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1276
+ } else {
1277
+ runCommonAsserts(data, error);
1278
+ }
1279
+ saveMockData('ExecutionServiceCatalog', 'executeCBAWorkflowAction', 'default', data);
1280
+ done();
1281
+ } catch (err) {
1282
+ log.error(`Test Failure: ${err}`);
1283
+ done(err);
1284
+ }
1285
+ });
1286
+ } catch (error) {
1287
+ log.error(`Adapter Exception: ${error}`);
1288
+ done(error);
1289
+ }
1290
+ }).timeout(attemptTimeout);
1291
+ });
1292
+
1293
+ const modelTypeCatalogDefinitionType = 'fakedata';
1294
+ describe('#getModelTypeByDefinitionType - errors', () => {
1295
+ it('should work if integrated or standalone with mockdata', (done) => {
1296
+ try {
1297
+ a.getModelTypeByDefinitionType(modelTypeCatalogDefinitionType, (data, error) => {
1298
+ try {
1299
+ if (stub) {
1300
+ runCommonAsserts(data, error);
1301
+ assert.equal('object', typeof data.response[0]);
1302
+ assert.equal('object', typeof data.response[1]);
1303
+ } else {
1304
+ runCommonAsserts(data, error);
1305
+ }
1306
+ saveMockData('ModelTypeCatalog', 'getModelTypeByDefinitionType', 'default', data);
1307
+ done();
1308
+ } catch (err) {
1309
+ log.error(`Test Failure: ${err}`);
1310
+ done(err);
1311
+ }
1312
+ });
1313
+ } catch (error) {
1314
+ log.error(`Adapter Exception: ${error}`);
1315
+ done(error);
1316
+ }
1317
+ }).timeout(attemptTimeout);
1318
+ });
1319
+
1320
+ const modelTypeCatalogTags = 'fakedata';
1321
+ describe('#searchModelTypesByTags - errors', () => {
1322
+ it('should work if integrated or standalone with mockdata', (done) => {
1323
+ try {
1324
+ a.searchModelTypesByTags(modelTypeCatalogTags, (data, error) => {
1325
+ try {
1326
+ if (stub) {
1327
+ runCommonAsserts(data, error);
1328
+ assert.equal('object', typeof data.response[0]);
1329
+ assert.equal('object', typeof data.response[1]);
1330
+ } else {
1331
+ runCommonAsserts(data, error);
1332
+ }
1333
+ saveMockData('ModelTypeCatalog', 'searchModelTypesByTags', 'default', data);
1334
+ done();
1335
+ } catch (err) {
1336
+ log.error(`Test Failure: ${err}`);
1337
+ done(err);
1338
+ }
1339
+ });
1340
+ } catch (error) {
1341
+ log.error(`Adapter Exception: ${error}`);
1342
+ done(error);
1343
+ }
1344
+ }).timeout(attemptTimeout);
1345
+ });
1346
+
1347
+ const modelTypeCatalogName = 'fakedata';
1348
+ describe('#getModelTypeByName - errors', () => {
1349
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1350
+ try {
1351
+ a.getModelTypeByName(modelTypeCatalogName, (data, error) => {
1352
+ try {
1353
+ if (stub) {
1354
+ const displayE = 'Error 400 received on request';
1355
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1356
+ } else {
1357
+ runCommonAsserts(data, error);
1358
+ }
1359
+ saveMockData('ModelTypeCatalog', 'getModelTypeByName', 'default', data);
1360
+ done();
1361
+ } catch (err) {
1362
+ log.error(`Test Failure: ${err}`);
1363
+ done(err);
1364
+ }
1365
+ });
1366
+ } catch (error) {
1367
+ log.error(`Adapter Exception: ${error}`);
1368
+ done(error);
1369
+ }
1370
+ }).timeout(attemptTimeout);
1371
+ });
1372
+
1373
+ const resourcesBpName = 'fakedata';
1374
+ const resourcesBpVersion = 'fakedata';
1375
+ const resourcesArtifactName = 'fakedata';
1376
+ const resourcesResolutionKey = 'fakedata';
1377
+ describe('#getAllResourcesUsingResolutionKey - errors', () => {
1378
+ it('should work if integrated or standalone with mockdata', (done) => {
1379
+ try {
1380
+ a.getAllResourcesUsingResolutionKey(resourcesBpName, resourcesBpVersion, resourcesArtifactName, resourcesResolutionKey, null, null, (data, error) => {
1381
+ try {
1382
+ if (stub) {
1383
+ runCommonAsserts(data, error);
1384
+ assert.equal('object', typeof data.response[0]);
1385
+ assert.equal('object', typeof data.response[1]);
1386
+ assert.equal('object', typeof data.response[2]);
1387
+ assert.equal('object', typeof data.response[3]);
1388
+ } else {
1389
+ runCommonAsserts(data, error);
1390
+ }
1391
+ saveMockData('Resources', 'getAllResourcesUsingResolutionKey', 'default', data);
1392
+ done();
1393
+ } catch (err) {
1394
+ log.error(`Test Failure: ${err}`);
1395
+ done(err);
1396
+ }
1397
+ });
1398
+ } catch (error) {
1399
+ log.error(`Adapter Exception: ${error}`);
1400
+ done(error);
1401
+ }
1402
+ }).timeout(attemptTimeout);
1403
+ });
1404
+
1405
+ describe('#getResourcesWithOccurrences - errors', () => {
1406
+ it('should work if integrated or standalone with mockdata', (done) => {
1407
+ try {
1408
+ a.getResourcesWithOccurrences(resourcesBpName, resourcesBpVersion, resourcesArtifactName, resourcesResolutionKey, null, null, null, null, (data, error) => {
1409
+ try {
1410
+ if (stub) {
1411
+ runCommonAsserts(data, error);
1412
+ assert.equal('object', typeof data.response[0]);
1413
+ assert.equal('object', typeof data.response[1]);
1414
+ assert.equal('object', typeof data.response[2]);
1415
+ assert.equal('object', typeof data.response[3]);
1416
+ } else {
1417
+ runCommonAsserts(data, error);
1418
+ }
1419
+ saveMockData('Resources', 'getResourcesWithOccurrences', 'default', data);
1420
+ done();
1421
+ } catch (err) {
1422
+ log.error(`Test Failure: ${err}`);
1423
+ done(err);
1424
+ }
1425
+ });
1426
+ } catch (error) {
1427
+ log.error(`Adapter Exception: ${error}`);
1428
+ done(error);
1429
+ }
1430
+ }).timeout(attemptTimeout);
1431
+ });
1432
+
1433
+ const resourcesName = 'fakedata';
1434
+ describe('#getResourceValueUsingResolutionKey - errors', () => {
1435
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1436
+ try {
1437
+ a.getResourceValueUsingResolutionKey(resourcesBpName, resourcesBpVersion, resourcesArtifactName, resourcesResolutionKey, resourcesName, (data, error) => {
1438
+ try {
1439
+ if (stub) {
1440
+ const displayE = 'Error 400 received on request';
1441
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1442
+ } else {
1443
+ runCommonAsserts(data, error);
1444
+ }
1445
+ saveMockData('Resources', 'getResourceValueUsingResolutionKey', 'default', data);
1446
+ done();
1447
+ } catch (err) {
1448
+ log.error(`Test Failure: ${err}`);
1449
+ done(err);
1450
+ }
1451
+ });
1452
+ } catch (error) {
1453
+ log.error(`Adapter Exception: ${error}`);
1454
+ done(error);
1455
+ }
1456
+ }).timeout(attemptTimeout);
1457
+ });
1458
+
1459
+ const resourceTemplateBpName = 'fakedata';
1460
+ const resourceTemplateBpVersion = 'fakedata';
1461
+ const resourceTemplateArtifactName = 'fakedata';
1462
+ const resourceTemplateResolutionKey = 'fakedata';
1463
+ const resourceTemplateStoreTemplateWithResolutionKeyBodyParam = {};
1464
+ describe('#storeTemplateWithResolutionKey - errors', () => {
1465
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1466
+ try {
1467
+ a.storeTemplateWithResolutionKey(resourceTemplateBpName, resourceTemplateBpVersion, resourceTemplateArtifactName, resourceTemplateResolutionKey, resourceTemplateStoreTemplateWithResolutionKeyBodyParam, (data, error) => {
1468
+ try {
1469
+ if (stub) {
1470
+ const displayE = 'Error 400 received on request';
1471
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1472
+ } else {
1473
+ runCommonAsserts(data, error);
1474
+ }
1475
+ saveMockData('ResourceTemplate', 'storeTemplateWithResolutionKey', 'default', data);
1476
+ done();
1477
+ } catch (err) {
1478
+ log.error(`Test Failure: ${err}`);
1479
+ done(err);
1480
+ }
1481
+ });
1482
+ } catch (error) {
1483
+ log.error(`Adapter Exception: ${error}`);
1484
+ done(error);
1485
+ }
1486
+ }).timeout(attemptTimeout);
1487
+ });
1488
+
1489
+ const resourceTemplateResourceType = 'fakedata';
1490
+ const resourceTemplateResourceId = 'fakedata';
1491
+ const resourceTemplateStoreTemplateWithResourceIdAndResourceTypeBodyParam = {};
1492
+ describe('#storeTemplateWithResourceIdAndResourceType - errors', () => {
1493
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1494
+ try {
1495
+ a.storeTemplateWithResourceIdAndResourceType(resourceTemplateBpName, resourceTemplateBpVersion, resourceTemplateArtifactName, resourceTemplateResourceType, resourceTemplateResourceId, resourceTemplateStoreTemplateWithResourceIdAndResourceTypeBodyParam, (data, error) => {
1496
+ try {
1497
+ if (stub) {
1498
+ const displayE = 'Error 400 received on request';
1499
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1500
+ } else {
1501
+ runCommonAsserts(data, error);
1502
+ }
1503
+ saveMockData('ResourceTemplate', 'storeTemplateWithResourceIdAndResourceType', 'default', data);
1504
+ done();
1505
+ } catch (err) {
1506
+ log.error(`Test Failure: ${err}`);
1507
+ done(err);
1508
+ }
1509
+ });
1510
+ } catch (error) {
1511
+ log.error(`Adapter Exception: ${error}`);
1512
+ done(error);
1513
+ }
1514
+ }).timeout(attemptTimeout);
1515
+ });
1516
+
1517
+ describe('#getTemplatesWithOccurrences - errors', () => {
1518
+ it('should work if integrated or standalone with mockdata', (done) => {
1519
+ try {
1520
+ a.getTemplatesWithOccurrences(resourceTemplateBpName, resourceTemplateBpVersion, resourceTemplateArtifactName, resourceTemplateResolutionKey, null, null, null, null, (data, error) => {
1521
+ try {
1522
+ if (stub) {
1523
+ runCommonAsserts(data, error);
1524
+ assert.equal('object', typeof data.response[0]);
1525
+ assert.equal('object', typeof data.response[1]);
1526
+ } else {
1527
+ runCommonAsserts(data, error);
1528
+ }
1529
+ saveMockData('ResourceTemplate', 'getTemplatesWithOccurrences', 'default', data);
1530
+ done();
1531
+ } catch (err) {
1532
+ log.error(`Test Failure: ${err}`);
1533
+ done(err);
1534
+ }
1535
+ });
1536
+ } catch (error) {
1537
+ log.error(`Adapter Exception: ${error}`);
1538
+ done(error);
1539
+ }
1540
+ }).timeout(attemptTimeout);
1541
+ });
1542
+
1543
+ describe('#deleteBlueprintModelByNameAndVersion - errors', () => {
1544
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1545
+ try {
1546
+ a.deleteBlueprintModelByNameAndVersion(blueprintModelCatalogName, blueprintModelCatalogVersion, (data, error) => {
1547
+ try {
1548
+ if (stub) {
1549
+ const displayE = 'Error 400 received on request';
1550
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1551
+ } else {
1552
+ runCommonAsserts(data, error);
1553
+ }
1554
+ saveMockData('BlueprintModelCatalog', 'deleteBlueprintModelByNameAndVersion', 'default', data);
1555
+ done();
1556
+ } catch (err) {
1557
+ log.error(`Test Failure: ${err}`);
1558
+ done(err);
1559
+ }
1560
+ });
1561
+ } catch (error) {
1562
+ log.error(`Adapter Exception: ${error}`);
1563
+ done(error);
1564
+ }
1565
+ }).timeout(attemptTimeout);
1566
+ });
1567
+
1568
+ describe('#deleteBlueprintModelByID - errors', () => {
1569
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1570
+ try {
1571
+ a.deleteBlueprintModelByID(blueprintModelCatalogId, (data, error) => {
1572
+ try {
1573
+ if (stub) {
1574
+ const displayE = 'Error 400 received on request';
1575
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1576
+ } else {
1577
+ runCommonAsserts(data, error);
1578
+ }
1579
+ saveMockData('BlueprintModelCatalog', 'deleteBlueprintModelByID', 'default', data);
1580
+ done();
1581
+ } catch (err) {
1582
+ log.error(`Test Failure: ${err}`);
1583
+ done(err);
1584
+ }
1585
+ });
1586
+ } catch (error) {
1587
+ log.error(`Adapter Exception: ${error}`);
1588
+ done(error);
1589
+ }
1590
+ }).timeout(attemptTimeout);
1591
+ });
1592
+
1593
+ describe('#deleteConfigSnapshotByResourceIdAndResourceType - errors', () => {
1594
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1595
+ try {
1596
+ a.deleteConfigSnapshotByResourceIdAndResourceType(resourceConfigurationResourceType, resourceConfigurationResourceId, resourceConfigurationStatus, (data, error) => {
1597
+ try {
1598
+ if (stub) {
1599
+ const displayE = 'Error 400 received on request';
1600
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1601
+ } else {
1602
+ runCommonAsserts(data, error);
1603
+ }
1604
+ saveMockData('ResourceConfiguration', 'deleteConfigSnapshotByResourceIdAndResourceType', 'default', data);
1605
+ done();
1606
+ } catch (err) {
1607
+ log.error(`Test Failure: ${err}`);
1608
+ done(err);
1609
+ }
1610
+ });
1611
+ } catch (error) {
1612
+ log.error(`Adapter Exception: ${error}`);
1613
+ done(error);
1614
+ }
1615
+ }).timeout(attemptTimeout);
1616
+ });
1617
+
1618
+ describe('#deleteResourceDictionaryByName - errors', () => {
1619
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1620
+ try {
1621
+ a.deleteResourceDictionaryByName(resourceDictionaryName, (data, error) => {
1622
+ try {
1623
+ if (stub) {
1624
+ const displayE = 'Error 400 received on request';
1625
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1626
+ } else {
1627
+ runCommonAsserts(data, error);
1628
+ }
1629
+ saveMockData('ResourceDictionary', 'deleteResourceDictionaryByName', 'default', data);
1630
+ done();
1631
+ } catch (err) {
1632
+ log.error(`Test Failure: ${err}`);
1633
+ done(err);
1634
+ }
1635
+ });
1636
+ } catch (error) {
1637
+ log.error(`Adapter Exception: ${error}`);
1638
+ done(error);
1639
+ }
1640
+ }).timeout(attemptTimeout);
1641
+ });
1642
+
1643
+ describe('#deleteModelTypeByName - errors', () => {
1644
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1645
+ try {
1646
+ a.deleteModelTypeByName(modelTypeCatalogName, (data, error) => {
1647
+ try {
1648
+ if (stub) {
1649
+ const displayE = 'Error 400 received on request';
1650
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1651
+ } else {
1652
+ runCommonAsserts(data, error);
1653
+ }
1654
+ saveMockData('ModelTypeCatalog', 'deleteModelTypeByName', 'default', data);
1655
+ done();
1656
+ } catch (err) {
1657
+ log.error(`Test Failure: ${err}`);
1658
+ done(err);
1659
+ }
1660
+ });
1661
+ } catch (error) {
1662
+ log.error(`Adapter Exception: ${error}`);
1663
+ done(error);
1664
+ }
1665
+ }).timeout(attemptTimeout);
1666
+ });
1667
+
1668
+ describe('#deleteAllResourcesUsingResolutionKey - errors', () => {
1669
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1670
+ try {
1671
+ a.deleteAllResourcesUsingResolutionKey(resourcesBpName, resourcesBpVersion, resourcesArtifactName, resourcesResolutionKey, null, null, null, (data, error) => {
1672
+ try {
1673
+ if (stub) {
1674
+ const displayE = 'Error 400 received on request';
1675
+ runErrorAsserts(data, error, 'AD.500', 'Test-onap_blueprint_processor-connectorRest-handleEndResponse', displayE);
1676
+ } else {
1677
+ runCommonAsserts(data, error);
1678
+ }
1679
+ saveMockData('Resources', 'deleteAllResourcesUsingResolutionKey', 'default', data);
1680
+ done();
1681
+ } catch (err) {
1682
+ log.error(`Test Failure: ${err}`);
1683
+ done(err);
1684
+ }
1685
+ });
1686
+ } catch (error) {
1687
+ log.error(`Adapter Exception: ${error}`);
1688
+ done(error);
1689
+ }
1690
+ }).timeout(attemptTimeout);
1691
+ });
1692
+ });
1693
+ });