@itentialopensource/adapter-etsi_sol002 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +498 -0
  4. package/CHANGELOG.md +13 -5
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +3 -148
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +235 -576
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +291 -640
  14. package/adapterBase.js +843 -419
  15. package/changelogs/changelog.md +16 -0
  16. package/entities/.generic/action.json +105 -0
  17. package/entities/.generic/schema.json +6 -1
  18. package/error.json +6 -0
  19. package/metadata.json +49 -0
  20. package/package.json +24 -24
  21. package/pronghorn.json +527 -116
  22. package/propertiesDecorators.json +14 -0
  23. package/propertiesSchema.json +827 -6
  24. package/refs?service=git-upload-pack +0 -0
  25. package/report/adapter-openapi.json +3367 -0
  26. package/report/adapter-openapi.yaml +2548 -0
  27. package/report/adapterInfo.json +10 -0
  28. package/report/updateReport1653138361361.json +120 -0
  29. package/report/updateReport1691507414889.json +120 -0
  30. package/report/updateReport1692202448186.json +120 -0
  31. package/report/updateReport1694460767581.json +120 -0
  32. package/report/updateReport1698420537369.json +120 -0
  33. package/sampleProperties.json +153 -3
  34. package/test/integration/adapterTestBasicGet.js +3 -5
  35. package/test/integration/adapterTestConnectivity.js +91 -42
  36. package/test/integration/adapterTestIntegration.js +1299 -1569
  37. package/test/unit/adapterBaseTestUnit.js +388 -308
  38. package/test/unit/adapterTestUnit.js +399 -260
  39. package/utils/adapterInfo.js +206 -0
  40. package/utils/addAuth.js +1 -1
  41. package/utils/artifactize.js +1 -1
  42. package/utils/checkMigrate.js +1 -1
  43. package/utils/entitiesToDB.js +12 -57
  44. package/utils/findPath.js +1 -1
  45. package/utils/methodDocumentor.js +273 -0
  46. package/utils/modify.js +13 -15
  47. package/utils/packModificationScript.js +1 -1
  48. package/utils/pre-commit.sh +5 -0
  49. package/utils/taskMover.js +309 -0
  50. package/utils/tbScript.js +123 -53
  51. package/utils/tbUtils.js +87 -49
  52. package/utils/testRunner.js +17 -17
  53. package/utils/troubleshootingAdapter.js +9 -6
  54. package/workflows/README.md +0 -3
@@ -3,39 +3,51 @@
3
3
  // Set globals
4
4
  /* global describe it log pronghornProps */
5
5
  /* eslint no-unused-vars: warn */
6
- /* eslint no-underscore-dangle: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
7
8
 
8
9
  // include required items for testing & logging
9
10
  const assert = require('assert');
10
11
  const fs = require('fs');
11
- const mocha = require('mocha');
12
12
  const path = require('path');
13
+ const util = require('util');
14
+ const mocha = require('mocha');
13
15
  const winston = require('winston');
14
16
  const { expect } = require('chai');
15
17
  const { use } = require('chai');
16
18
  const td = require('testdouble');
17
- const util = require('util');
18
- const pronghorn = require('../../pronghorn.json');
19
19
 
20
- pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
21
20
  const anything = td.matchers.anything();
22
21
 
23
22
  // stub and attemptTimeout are used throughout the code so set them here
24
23
  let logLevel = 'none';
25
- const stub = true;
26
24
  const isRapidFail = false;
27
25
  const isSaveMockData = false;
28
- 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;
29
35
 
30
36
  // these variables can be changed to run in integrated mode so easier to set them here
31
37
  // always check these in with bogus data!!!
32
- const host = 'replace.hostorip.here';
33
- const username = 'username';
34
- const password = 'password';
35
- const protocol = 'http';
36
- const port = 80;
37
- const sslenable = false;
38
- 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;
39
51
 
40
52
  // these are the adapter properties. You generally should not need to alter
41
53
  // any of these after they are initially set up
@@ -47,102 +59,7 @@ global.pronghornProps = {
47
59
  adapters: [{
48
60
  id: 'Test-etsi_sol002',
49
61
  type: 'EtsiSol002',
50
- properties: {
51
- host,
52
- port,
53
- base_path: '/',
54
- version: '',
55
- cache_location: 'none',
56
- encode_pathvars: true,
57
- save_metric: false,
58
- stub,
59
- protocol,
60
- authentication: {
61
- auth_method: 'request_token',
62
- username,
63
- password,
64
- token: '',
65
- invalid_token_error: 401,
66
- token_timeout: 1800000,
67
- token_cache: 'local',
68
- auth_field: 'header.headers.Authorization',
69
- auth_field_format: 'Bearer {token}',
70
- auth_logging: false,
71
- client_id: '',
72
- client_secret: '',
73
- grant_type: ''
74
- },
75
- healthcheck: {
76
- type: 'none',
77
- frequency: 60000,
78
- query_object: {}
79
- },
80
- throttle: {
81
- throttle_enabled: false,
82
- number_pronghorns: 1,
83
- sync_async: 'sync',
84
- max_in_queue: 1000,
85
- concurrent_max: 1,
86
- expire_timeout: 0,
87
- avg_runtime: 200,
88
- priorities: [
89
- {
90
- value: 0,
91
- percent: 100
92
- }
93
- ]
94
- },
95
- request: {
96
- number_redirects: 0,
97
- number_retries: 3,
98
- limit_retry_error: [0],
99
- failover_codes: [],
100
- attempt_timeout: attemptTimeout,
101
- global_request: {
102
- payload: {},
103
- uriOptions: {},
104
- addlHeaders: {},
105
- authData: {}
106
- },
107
- healthcheck_on_timeout: true,
108
- return_raw: true,
109
- archiving: false,
110
- return_request: false
111
- },
112
- proxy: {
113
- enabled: false,
114
- host: '',
115
- port: 1,
116
- protocol: 'http',
117
- username: '',
118
- password: ''
119
- },
120
- ssl: {
121
- ecdhCurve: '',
122
- enabled: sslenable,
123
- accept_invalid_cert: sslinvalid,
124
- ca_file: '',
125
- key_file: '',
126
- cert_file: '',
127
- secure_protocol: '',
128
- ciphers: ''
129
- },
130
- mongo: {
131
- host: '',
132
- port: 0,
133
- database: '',
134
- username: '',
135
- password: '',
136
- replSet: '',
137
- db_ssl: {
138
- enabled: false,
139
- accept_invalid_cert: false,
140
- ca_file: '',
141
- key_file: '',
142
- cert_file: ''
143
- }
144
- }
145
- }
62
+ properties: samProps
146
63
  }]
147
64
  }
148
65
  };
@@ -418,6 +335,134 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
418
335
  }).timeout(attemptTimeout);
419
336
  });
420
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-etsi_sol002-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-etsi_sol002-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
+ });
421
466
  /*
422
467
  -----------------------------------------------------------------------
423
468
  -----------------------------------------------------------------------
@@ -426,37 +471,29 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
426
471
  -----------------------------------------------------------------------
427
472
  -----------------------------------------------------------------------
428
473
  */
429
- let skipCount = 0;
430
-
431
474
  describe('#getApiVersions - errors', () => {
432
475
  it('should work if integrated or standalone with mockdata', (done) => {
433
- if (pronghorn.methodsByName.getApiVersions.task) {
434
- try {
435
- a.getApiVersions((data, error) => {
436
- try {
437
- if (stub) {
438
- runCommonAsserts(data, error);
439
- assert.equal('string', data.response.uriPrefix);
440
- assert.equal(true, Array.isArray(data.response.apiVersions));
441
- } else {
442
- runCommonAsserts(data, error);
443
- }
444
- saveMockData('ApiVersions', 'getApiVersions', 'default', data);
445
- done();
446
- } catch (err) {
447
- log.error(`Test Failure: ${err}`);
448
- done(err);
476
+ try {
477
+ a.getApiVersions((data, error) => {
478
+ try {
479
+ if (stub) {
480
+ runCommonAsserts(data, error);
481
+ assert.equal('string', data.response.uriPrefix);
482
+ assert.equal(true, Array.isArray(data.response.apiVersions));
483
+ } else {
484
+ runCommonAsserts(data, error);
449
485
  }
450
- });
451
- } catch (error) {
452
- log.error(`Adapter Exception: ${error}`);
453
- done(error);
454
- }
455
- } else {
456
- log.error('getApiVersions task is false, skipping test');
457
- skipCount += 1;
458
- done();
459
- }// end if task
486
+ saveMockData('ApiVersions', 'getApiVersions', 'default', data);
487
+ done();
488
+ } catch (err) {
489
+ log.error(`Test Failure: ${err}`);
490
+ done(err);
491
+ }
492
+ });
493
+ } catch (error) {
494
+ log.error(`Adapter Exception: ${error}`);
495
+ done(error);
496
+ }
460
497
  }).timeout(attemptTimeout);
461
498
  });
462
499
 
@@ -510,196 +547,160 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
510
547
  };
511
548
  describe('#patchConfiguration - errors', () => {
512
549
  it('should work if integrated or standalone with mockdata', (done) => {
513
- if (pronghorn.methodsByName.patchConfiguration.task) {
514
- try {
515
- a.patchConfiguration(configurationPatchConfigurationBodyParam, (data, error) => {
516
- try {
517
- if (stub) {
518
- runCommonAsserts(data, error);
519
- assert.equal('success', data.response);
520
- } else {
521
- runCommonAsserts(data, error);
522
- }
523
- saveMockData('Configuration', 'patchConfiguration', 'default', data);
524
- done();
525
- } catch (err) {
526
- log.error(`Test Failure: ${err}`);
527
- done(err);
550
+ try {
551
+ a.patchConfiguration(configurationPatchConfigurationBodyParam, (data, error) => {
552
+ try {
553
+ if (stub) {
554
+ runCommonAsserts(data, error);
555
+ assert.equal('success', data.response);
556
+ } else {
557
+ runCommonAsserts(data, error);
528
558
  }
529
- });
530
- } catch (error) {
531
- log.error(`Adapter Exception: ${error}`);
532
- done(error);
533
- }
534
- } else {
535
- log.error('patchConfiguration task is false, skipping test');
536
- skipCount += 1;
537
- done();
538
- }// end if task
559
+ saveMockData('Configuration', 'patchConfiguration', 'default', data);
560
+ done();
561
+ } catch (err) {
562
+ log.error(`Test Failure: ${err}`);
563
+ done(err);
564
+ }
565
+ });
566
+ } catch (error) {
567
+ log.error(`Adapter Exception: ${error}`);
568
+ done(error);
569
+ }
539
570
  }).timeout(attemptTimeout);
540
571
  });
541
572
 
542
573
  describe('#getConfiguration - errors', () => {
543
574
  it('should work if integrated or standalone with mockdata', (done) => {
544
- if (pronghorn.methodsByName.getConfiguration.task) {
545
- try {
546
- a.getConfiguration((data, error) => {
547
- try {
548
- if (stub) {
549
- runCommonAsserts(data, error);
550
- assert.equal('object', typeof data.response.vnfConfigurationData);
551
- assert.equal(true, Array.isArray(data.response.vnfcConfigurationData));
552
- } else {
553
- runCommonAsserts(data, error);
554
- }
555
- saveMockData('Configuration', 'getConfiguration', 'default', data);
556
- done();
557
- } catch (err) {
558
- log.error(`Test Failure: ${err}`);
559
- done(err);
575
+ try {
576
+ a.getConfiguration((data, error) => {
577
+ try {
578
+ if (stub) {
579
+ runCommonAsserts(data, error);
580
+ assert.equal('object', typeof data.response.vnfConfigurationData);
581
+ assert.equal(true, Array.isArray(data.response.vnfcConfigurationData));
582
+ } else {
583
+ runCommonAsserts(data, error);
560
584
  }
561
- });
562
- } catch (error) {
563
- log.error(`Adapter Exception: ${error}`);
564
- done(error);
565
- }
566
- } else {
567
- log.error('getConfiguration task is false, skipping test');
568
- skipCount += 1;
569
- done();
570
- }// end if task
585
+ saveMockData('Configuration', 'getConfiguration', 'default', data);
586
+ done();
587
+ } catch (err) {
588
+ log.error(`Test Failure: ${err}`);
589
+ done(err);
590
+ }
591
+ });
592
+ } catch (error) {
593
+ log.error(`Adapter Exception: ${error}`);
594
+ done(error);
595
+ }
571
596
  }).timeout(attemptTimeout);
572
597
  });
573
598
 
574
599
  describe('#getIndicators - errors', () => {
575
600
  it('should work if integrated or standalone with mockdata', (done) => {
576
- if (pronghorn.methodsByName.getIndicators.task) {
577
- try {
578
- a.getIndicators(null, null, (data, error) => {
579
- try {
580
- if (stub) {
581
- runCommonAsserts(data, error);
582
- assert.equal('object', typeof data.response[0]);
583
- assert.equal('object', typeof data.response[1]);
584
- } else {
585
- runCommonAsserts(data, error);
586
- }
587
- saveMockData('Indicators', 'getIndicators', 'default', data);
588
- done();
589
- } catch (err) {
590
- log.error(`Test Failure: ${err}`);
591
- done(err);
601
+ try {
602
+ a.getIndicators(null, null, (data, error) => {
603
+ try {
604
+ if (stub) {
605
+ runCommonAsserts(data, error);
606
+ assert.equal('object', typeof data.response[0]);
607
+ assert.equal('object', typeof data.response[1]);
608
+ } else {
609
+ runCommonAsserts(data, error);
592
610
  }
593
- });
594
- } catch (error) {
595
- log.error(`Adapter Exception: ${error}`);
596
- done(error);
597
- }
598
- } else {
599
- log.error('getIndicators task is false, skipping test');
600
- skipCount += 1;
601
- done();
602
- }// end if task
611
+ saveMockData('Indicators', 'getIndicators', 'default', data);
612
+ done();
613
+ } catch (err) {
614
+ log.error(`Test Failure: ${err}`);
615
+ done(err);
616
+ }
617
+ });
618
+ } catch (error) {
619
+ log.error(`Adapter Exception: ${error}`);
620
+ done(error);
621
+ }
603
622
  }).timeout(attemptTimeout);
604
623
  });
605
624
 
606
625
  describe('#getIndicatorsVnfInstanceId - errors', () => {
607
626
  it('should work if integrated or standalone with mockdata', (done) => {
608
- if (pronghorn.methodsByName.getIndicatorsVnfInstanceId.task) {
609
- try {
610
- a.getIndicatorsVnfInstanceId('fakedata', null, null, (data, error) => {
611
- try {
612
- if (stub) {
613
- runCommonAsserts(data, error);
614
- assert.equal('object', typeof data.response[0]);
615
- assert.equal('object', typeof data.response[1]);
616
- assert.equal('object', typeof data.response[2]);
617
- assert.equal('object', typeof data.response[3]);
618
- } else {
619
- runCommonAsserts(data, error);
620
- }
621
- saveMockData('Indicators', 'getIndicatorsVnfInstanceId', 'default', data);
622
- done();
623
- } catch (err) {
624
- log.error(`Test Failure: ${err}`);
625
- done(err);
627
+ try {
628
+ a.getIndicatorsVnfInstanceId('fakedata', null, null, (data, error) => {
629
+ try {
630
+ if (stub) {
631
+ runCommonAsserts(data, error);
632
+ assert.equal('object', typeof data.response[0]);
633
+ assert.equal('object', typeof data.response[1]);
634
+ assert.equal('object', typeof data.response[2]);
635
+ assert.equal('object', typeof data.response[3]);
636
+ } else {
637
+ runCommonAsserts(data, error);
626
638
  }
627
- });
628
- } catch (error) {
629
- log.error(`Adapter Exception: ${error}`);
630
- done(error);
631
- }
632
- } else {
633
- log.error('getIndicatorsVnfInstanceId task is false, skipping test');
634
- skipCount += 1;
635
- done();
636
- }// end if task
639
+ saveMockData('Indicators', 'getIndicatorsVnfInstanceId', 'default', data);
640
+ done();
641
+ } catch (err) {
642
+ log.error(`Test Failure: ${err}`);
643
+ done(err);
644
+ }
645
+ });
646
+ } catch (error) {
647
+ log.error(`Adapter Exception: ${error}`);
648
+ done(error);
649
+ }
637
650
  }).timeout(attemptTimeout);
638
651
  });
639
652
 
640
653
  describe('#getIndicatorsVnfInstanceIdIndicatorId - errors', () => {
641
654
  it('should work if integrated or standalone with mockdata', (done) => {
642
- if (pronghorn.methodsByName.getIndicatorsVnfInstanceIdIndicatorId.task) {
643
- try {
644
- a.getIndicatorsVnfInstanceIdIndicatorId('fakedata', 'fakedata', (data, error) => {
645
- try {
646
- if (stub) {
647
- runCommonAsserts(data, error);
648
- assert.equal('string', data.response.id);
649
- assert.equal('string', data.response.name);
650
- assert.equal('object', typeof data.response.value);
651
- assert.equal('string', data.response.vnfInstanceId);
652
- assert.equal('object', typeof data.response._links);
653
- } else {
654
- runCommonAsserts(data, error);
655
- }
656
- saveMockData('Indicators', 'getIndicatorsVnfInstanceIdIndicatorId', 'default', data);
657
- done();
658
- } catch (err) {
659
- log.error(`Test Failure: ${err}`);
660
- done(err);
655
+ try {
656
+ a.getIndicatorsVnfInstanceIdIndicatorId('fakedata', 'fakedata', (data, error) => {
657
+ try {
658
+ if (stub) {
659
+ runCommonAsserts(data, error);
660
+ assert.equal('string', data.response.id);
661
+ assert.equal('string', data.response.name);
662
+ assert.equal('object', typeof data.response.value);
663
+ assert.equal('string', data.response.vnfInstanceId);
664
+ assert.equal('object', typeof data.response._links);
665
+ } else {
666
+ runCommonAsserts(data, error);
661
667
  }
662
- });
663
- } catch (error) {
664
- log.error(`Adapter Exception: ${error}`);
665
- done(error);
666
- }
667
- } else {
668
- log.error('getIndicatorsVnfInstanceIdIndicatorId task is false, skipping test');
669
- skipCount += 1;
670
- done();
671
- }// end if task
668
+ saveMockData('Indicators', 'getIndicatorsVnfInstanceIdIndicatorId', 'default', data);
669
+ done();
670
+ } catch (err) {
671
+ log.error(`Test Failure: ${err}`);
672
+ done(err);
673
+ }
674
+ });
675
+ } catch (error) {
676
+ log.error(`Adapter Exception: ${error}`);
677
+ done(error);
678
+ }
672
679
  }).timeout(attemptTimeout);
673
680
  });
674
681
 
675
682
  describe('#getSubscriptions - errors', () => {
676
683
  it('should work if integrated or standalone with mockdata', (done) => {
677
- if (pronghorn.methodsByName.getSubscriptions.task) {
678
- try {
679
- a.getSubscriptions(null, null, (data, error) => {
680
- try {
681
- if (stub) {
682
- runCommonAsserts(data, error);
683
- assert.equal('object', typeof data.response[0]);
684
- } else {
685
- runCommonAsserts(data, error);
686
- }
687
- saveMockData('Subscriptions', 'getSubscriptions', 'default', data);
688
- done();
689
- } catch (err) {
690
- log.error(`Test Failure: ${err}`);
691
- done(err);
684
+ try {
685
+ a.getSubscriptions(null, null, (data, error) => {
686
+ try {
687
+ if (stub) {
688
+ runCommonAsserts(data, error);
689
+ assert.equal('object', typeof data.response[0]);
690
+ } else {
691
+ runCommonAsserts(data, error);
692
692
  }
693
- });
694
- } catch (error) {
695
- log.error(`Adapter Exception: ${error}`);
696
- done(error);
697
- }
698
- } else {
699
- log.error('getSubscriptions task is false, skipping test');
700
- skipCount += 1;
701
- done();
702
- }// end if task
693
+ saveMockData('Subscriptions', 'getSubscriptions', 'default', data);
694
+ done();
695
+ } catch (err) {
696
+ log.error(`Test Failure: ${err}`);
697
+ done(err);
698
+ }
699
+ });
700
+ } catch (error) {
701
+ log.error(`Adapter Exception: ${error}`);
702
+ done(error);
703
+ }
703
704
  }).timeout(attemptTimeout);
704
705
  });
705
706
 
@@ -708,194 +709,164 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
708
709
  };
709
710
  describe('#postSubscriptions - errors', () => {
710
711
  it('should work if integrated or standalone with mockdata', (done) => {
711
- if (pronghorn.methodsByName.postSubscriptions.task) {
712
- try {
713
- a.postSubscriptions(subscriptionsPostSubscriptionsBodyParam, (data, error) => {
714
- try {
715
- if (stub) {
716
- runCommonAsserts(data, error);
717
- assert.equal('object', typeof data.response[0]);
718
- assert.equal('object', typeof data.response[1]);
719
- } else {
720
- runCommonAsserts(data, error);
721
- }
722
- saveMockData('Subscriptions', 'postSubscriptions', 'default', data);
723
- done();
724
- } catch (err) {
725
- log.error(`Test Failure: ${err}`);
726
- done(err);
712
+ try {
713
+ a.postSubscriptions(subscriptionsPostSubscriptionsBodyParam, (data, error) => {
714
+ try {
715
+ if (stub) {
716
+ runCommonAsserts(data, error);
717
+ assert.equal('object', typeof data.response[0]);
718
+ assert.equal('object', typeof data.response[1]);
719
+ } else {
720
+ runCommonAsserts(data, error);
727
721
  }
728
- });
729
- } catch (error) {
730
- log.error(`Adapter Exception: ${error}`);
731
- done(error);
732
- }
733
- } else {
734
- log.error('postSubscriptions task is false, skipping test');
735
- skipCount += 1;
736
- done();
737
- }// end if task
738
- }).timeout(attemptTimeout);
739
- });
740
-
741
- describe('#getSubscriptionsSubscriptionId - errors', () => {
742
- it('should work if integrated or standalone with mockdata', (done) => {
743
- if (pronghorn.methodsByName.getSubscriptionsSubscriptionId.task) {
744
- try {
745
- a.getSubscriptionsSubscriptionId('fakedata', (data, error) => {
746
- try {
747
- if (stub) {
748
- runCommonAsserts(data, error);
749
- assert.equal('string', data.response.id);
750
- assert.equal('object', typeof data.response.filter);
751
- assert.equal('string', data.response.callbackUri);
752
- assert.equal('object', typeof data.response._links);
753
- } else {
754
- runCommonAsserts(data, error);
755
- }
756
- saveMockData('Subscriptions', 'getSubscriptionsSubscriptionId', 'default', data);
757
- done();
758
- } catch (err) {
759
- log.error(`Test Failure: ${err}`);
760
- done(err);
722
+ saveMockData('Subscriptions', 'postSubscriptions', 'default', data);
723
+ done();
724
+ } catch (err) {
725
+ log.error(`Test Failure: ${err}`);
726
+ done(err);
727
+ }
728
+ });
729
+ } catch (error) {
730
+ log.error(`Adapter Exception: ${error}`);
731
+ done(error);
732
+ }
733
+ }).timeout(attemptTimeout);
734
+ });
735
+
736
+ describe('#getSubscriptionsSubscriptionId - errors', () => {
737
+ it('should work if integrated or standalone with mockdata', (done) => {
738
+ try {
739
+ a.getSubscriptionsSubscriptionId('fakedata', (data, error) => {
740
+ try {
741
+ if (stub) {
742
+ runCommonAsserts(data, error);
743
+ assert.equal('string', data.response.id);
744
+ assert.equal('object', typeof data.response.filter);
745
+ assert.equal('string', data.response.callbackUri);
746
+ assert.equal('object', typeof data.response._links);
747
+ } else {
748
+ runCommonAsserts(data, error);
761
749
  }
762
- });
763
- } catch (error) {
764
- log.error(`Adapter Exception: ${error}`);
765
- done(error);
766
- }
767
- } else {
768
- log.error('getSubscriptionsSubscriptionId task is false, skipping test');
769
- skipCount += 1;
770
- done();
771
- }// end if task
750
+ saveMockData('Subscriptions', 'getSubscriptionsSubscriptionId', 'default', data);
751
+ done();
752
+ } catch (err) {
753
+ log.error(`Test Failure: ${err}`);
754
+ done(err);
755
+ }
756
+ });
757
+ } catch (error) {
758
+ log.error(`Adapter Exception: ${error}`);
759
+ done(error);
760
+ }
772
761
  }).timeout(attemptTimeout);
773
762
  });
774
763
 
775
764
  describe('#deleteSubscriptionsSubscriptionId - errors', () => {
776
765
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
777
- if (pronghorn.methodsByName.deleteSubscriptionsSubscriptionId.task) {
778
- try {
779
- a.deleteSubscriptionsSubscriptionId('fakedata', (data, error) => {
780
- try {
781
- if (stub) {
782
- const displayE = 'Error 400 received on request';
783
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
784
- } else {
785
- runCommonAsserts(data, error);
786
- }
787
- saveMockData('Subscriptions', 'deleteSubscriptionsSubscriptionId', 'default', data);
788
- done();
789
- } catch (err) {
790
- log.error(`Test Failure: ${err}`);
791
- done(err);
766
+ try {
767
+ a.deleteSubscriptionsSubscriptionId('fakedata', (data, error) => {
768
+ try {
769
+ if (stub) {
770
+ const displayE = 'Error 400 received on request';
771
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
772
+ } else {
773
+ runCommonAsserts(data, error);
792
774
  }
793
- });
794
- } catch (error) {
795
- log.error(`Adapter Exception: ${error}`);
796
- done(error);
797
- }
798
- } else {
799
- log.error('deleteSubscriptionsSubscriptionId task is false, skipping test');
800
- skipCount += 1;
801
- done();
802
- }// end if task
775
+ saveMockData('Subscriptions', 'deleteSubscriptionsSubscriptionId', 'default', data);
776
+ done();
777
+ } catch (err) {
778
+ log.error(`Test Failure: ${err}`);
779
+ done(err);
780
+ }
781
+ });
782
+ } catch (error) {
783
+ log.error(`Adapter Exception: ${error}`);
784
+ done(error);
785
+ }
803
786
  }).timeout(attemptTimeout);
804
787
  });
805
788
 
806
789
  describe('#getAlarms - errors', () => {
807
790
  it('should work if integrated or standalone with mockdata', (done) => {
808
- if (pronghorn.methodsByName.getAlarms.task) {
809
- try {
810
- a.getAlarms(null, null, (data, error) => {
811
- try {
812
- if (stub) {
813
- runCommonAsserts(data, error);
814
- assert.equal('string', data.response.id);
815
- assert.equal('string', data.response.managedObjectId);
816
- assert.equal(true, Array.isArray(data.response.vnfcInstanceIds));
817
- assert.equal('object', typeof data.response.rootCauseFaultyResource);
818
- assert.equal('string', data.response.alarmRaisedTime);
819
- assert.equal('string', data.response.alarmChangedTime);
820
- assert.equal('string', data.response.alarmClearedTime);
821
- assert.equal('string', data.response.alarmAcknowledgedTime);
822
- assert.equal('ACKNOWLEDGED', data.response.ackState);
823
- assert.equal('CLEARED', data.response.perceivedSeverity);
824
- assert.equal('string', data.response.eventTime);
825
- assert.equal('COMMUNICATIONS_ALARM', data.response.eventType);
826
- assert.equal('string', data.response.faultType);
827
- assert.equal('string', data.response.probableCause);
828
- assert.equal(false, data.response.isRootCause);
829
- assert.equal(true, Array.isArray(data.response.correlatedAlarmIds));
830
- assert.equal(true, Array.isArray(data.response.faultDetails));
831
- assert.equal('object', typeof data.response._links);
832
- } else {
833
- runCommonAsserts(data, error);
834
- }
835
- saveMockData('Alarms', 'getAlarms', 'default', data);
836
- done();
837
- } catch (err) {
838
- log.error(`Test Failure: ${err}`);
839
- done(err);
791
+ try {
792
+ a.getAlarms(null, null, (data, error) => {
793
+ try {
794
+ if (stub) {
795
+ runCommonAsserts(data, error);
796
+ assert.equal('string', data.response.id);
797
+ assert.equal('string', data.response.managedObjectId);
798
+ assert.equal(true, Array.isArray(data.response.vnfcInstanceIds));
799
+ assert.equal('object', typeof data.response.rootCauseFaultyResource);
800
+ assert.equal('string', data.response.alarmRaisedTime);
801
+ assert.equal('string', data.response.alarmChangedTime);
802
+ assert.equal('string', data.response.alarmClearedTime);
803
+ assert.equal('string', data.response.alarmAcknowledgedTime);
804
+ assert.equal('ACKNOWLEDGED', data.response.ackState);
805
+ assert.equal('CLEARED', data.response.perceivedSeverity);
806
+ assert.equal('string', data.response.eventTime);
807
+ assert.equal('COMMUNICATIONS_ALARM', data.response.eventType);
808
+ assert.equal('string', data.response.faultType);
809
+ assert.equal('string', data.response.probableCause);
810
+ assert.equal(false, data.response.isRootCause);
811
+ assert.equal(true, Array.isArray(data.response.correlatedAlarmIds));
812
+ assert.equal(true, Array.isArray(data.response.faultDetails));
813
+ assert.equal('object', typeof data.response._links);
814
+ } else {
815
+ runCommonAsserts(data, error);
840
816
  }
841
- });
842
- } catch (error) {
843
- log.error(`Adapter Exception: ${error}`);
844
- done(error);
845
- }
846
- } else {
847
- log.error('getAlarms task is false, skipping test');
848
- skipCount += 1;
849
- done();
850
- }// end if task
817
+ saveMockData('Alarms', 'getAlarms', 'default', data);
818
+ done();
819
+ } catch (err) {
820
+ log.error(`Test Failure: ${err}`);
821
+ done(err);
822
+ }
823
+ });
824
+ } catch (error) {
825
+ log.error(`Adapter Exception: ${error}`);
826
+ done(error);
827
+ }
851
828
  }).timeout(attemptTimeout);
852
829
  });
853
830
 
854
831
  describe('#getAlarmsAlarmId - errors', () => {
855
832
  it('should work if integrated or standalone with mockdata', (done) => {
856
- if (pronghorn.methodsByName.getAlarmsAlarmId.task) {
857
- try {
858
- a.getAlarmsAlarmId('fakedata', (data, error) => {
859
- try {
860
- if (stub) {
861
- runCommonAsserts(data, error);
862
- assert.equal('string', data.response.id);
863
- assert.equal('string', data.response.managedObjectId);
864
- assert.equal(true, Array.isArray(data.response.vnfcInstanceIds));
865
- assert.equal('object', typeof data.response.rootCauseFaultyResource);
866
- assert.equal('string', data.response.alarmRaisedTime);
867
- assert.equal('string', data.response.alarmChangedTime);
868
- assert.equal('string', data.response.alarmClearedTime);
869
- assert.equal('string', data.response.alarmAcknowledgedTime);
870
- assert.equal('ACKNOWLEDGED', data.response.ackState);
871
- assert.equal('MINOR', data.response.perceivedSeverity);
872
- assert.equal('string', data.response.eventTime);
873
- assert.equal('PROCESSING_ERROR_ALARM', data.response.eventType);
874
- assert.equal('string', data.response.faultType);
875
- assert.equal('string', data.response.probableCause);
876
- assert.equal(true, data.response.isRootCause);
877
- assert.equal(true, Array.isArray(data.response.correlatedAlarmIds));
878
- assert.equal(true, Array.isArray(data.response.faultDetails));
879
- assert.equal('object', typeof data.response._links);
880
- } else {
881
- runCommonAsserts(data, error);
882
- }
883
- saveMockData('Alarms', 'getAlarmsAlarmId', 'default', data);
884
- done();
885
- } catch (err) {
886
- log.error(`Test Failure: ${err}`);
887
- done(err);
833
+ try {
834
+ a.getAlarmsAlarmId('fakedata', (data, error) => {
835
+ try {
836
+ if (stub) {
837
+ runCommonAsserts(data, error);
838
+ assert.equal('string', data.response.id);
839
+ assert.equal('string', data.response.managedObjectId);
840
+ assert.equal(true, Array.isArray(data.response.vnfcInstanceIds));
841
+ assert.equal('object', typeof data.response.rootCauseFaultyResource);
842
+ assert.equal('string', data.response.alarmRaisedTime);
843
+ assert.equal('string', data.response.alarmChangedTime);
844
+ assert.equal('string', data.response.alarmClearedTime);
845
+ assert.equal('string', data.response.alarmAcknowledgedTime);
846
+ assert.equal('ACKNOWLEDGED', data.response.ackState);
847
+ assert.equal('MINOR', data.response.perceivedSeverity);
848
+ assert.equal('string', data.response.eventTime);
849
+ assert.equal('PROCESSING_ERROR_ALARM', data.response.eventType);
850
+ assert.equal('string', data.response.faultType);
851
+ assert.equal('string', data.response.probableCause);
852
+ assert.equal(true, data.response.isRootCause);
853
+ assert.equal(true, Array.isArray(data.response.correlatedAlarmIds));
854
+ assert.equal(true, Array.isArray(data.response.faultDetails));
855
+ assert.equal('object', typeof data.response._links);
856
+ } else {
857
+ runCommonAsserts(data, error);
888
858
  }
889
- });
890
- } catch (error) {
891
- log.error(`Adapter Exception: ${error}`);
892
- done(error);
893
- }
894
- } else {
895
- log.error('getAlarmsAlarmId task is false, skipping test');
896
- skipCount += 1;
897
- done();
898
- }// end if task
859
+ saveMockData('Alarms', 'getAlarmsAlarmId', '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
+ }
899
870
  }).timeout(attemptTimeout);
900
871
  });
901
872
 
@@ -904,32 +875,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
904
875
  };
905
876
  describe('#patchAlarmsAlarmId - errors', () => {
906
877
  it('should work if integrated or standalone with mockdata', (done) => {
907
- if (pronghorn.methodsByName.patchAlarmsAlarmId.task) {
908
- try {
909
- a.patchAlarmsAlarmId('fakedata', alarmsPatchAlarmsAlarmIdBodyParam, (data, error) => {
910
- try {
911
- if (stub) {
912
- runCommonAsserts(data, error);
913
- assert.equal('success', data.response);
914
- } else {
915
- runCommonAsserts(data, error);
916
- }
917
- saveMockData('Alarms', 'patchAlarmsAlarmId', 'default', data);
918
- done();
919
- } catch (err) {
920
- log.error(`Test Failure: ${err}`);
921
- done(err);
878
+ try {
879
+ a.patchAlarmsAlarmId('fakedata', alarmsPatchAlarmsAlarmIdBodyParam, (data, error) => {
880
+ try {
881
+ if (stub) {
882
+ runCommonAsserts(data, error);
883
+ assert.equal('success', data.response);
884
+ } else {
885
+ runCommonAsserts(data, error);
922
886
  }
923
- });
924
- } catch (error) {
925
- log.error(`Adapter Exception: ${error}`);
926
- done(error);
927
- }
928
- } else {
929
- log.error('patchAlarmsAlarmId task is false, skipping test');
930
- skipCount += 1;
931
- done();
932
- }// end if task
887
+ saveMockData('Alarms', 'patchAlarmsAlarmId', 'default', data);
888
+ done();
889
+ } catch (err) {
890
+ log.error(`Test Failure: ${err}`);
891
+ done(err);
892
+ }
893
+ });
894
+ } catch (error) {
895
+ log.error(`Adapter Exception: ${error}`);
896
+ done(error);
897
+ }
933
898
  }).timeout(attemptTimeout);
934
899
  });
935
900
 
@@ -938,65 +903,53 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
938
903
  };
939
904
  describe('#postAlarmsAlarmIdEscalate - errors', () => {
940
905
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
941
- if (pronghorn.methodsByName.postAlarmsAlarmIdEscalate.task) {
942
- try {
943
- a.postAlarmsAlarmIdEscalate('fakedata', alarmsPostAlarmsAlarmIdEscalateBodyParam, (data, error) => {
944
- try {
945
- if (stub) {
946
- const displayE = 'Error 400 received on request';
947
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
948
- } else {
949
- runCommonAsserts(data, error);
950
- }
951
- saveMockData('Alarms', 'postAlarmsAlarmIdEscalate', 'default', data);
952
- done();
953
- } catch (err) {
954
- log.error(`Test Failure: ${err}`);
955
- done(err);
906
+ try {
907
+ a.postAlarmsAlarmIdEscalate('fakedata', alarmsPostAlarmsAlarmIdEscalateBodyParam, (data, error) => {
908
+ try {
909
+ if (stub) {
910
+ const displayE = 'Error 400 received on request';
911
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
912
+ } else {
913
+ runCommonAsserts(data, error);
956
914
  }
957
- });
958
- } catch (error) {
959
- log.error(`Adapter Exception: ${error}`);
960
- done(error);
961
- }
962
- } else {
963
- log.error('postAlarmsAlarmIdEscalate task is false, skipping test');
964
- skipCount += 1;
965
- done();
966
- }// end if task
915
+ saveMockData('Alarms', 'postAlarmsAlarmIdEscalate', 'default', data);
916
+ done();
917
+ } catch (err) {
918
+ log.error(`Test Failure: ${err}`);
919
+ done(err);
920
+ }
921
+ });
922
+ } catch (error) {
923
+ log.error(`Adapter Exception: ${error}`);
924
+ done(error);
925
+ }
967
926
  }).timeout(attemptTimeout);
968
927
  });
969
928
 
970
929
  describe('#getVnfInstances - errors', () => {
971
930
  it('should work if integrated or standalone with mockdata', (done) => {
972
- if (pronghorn.methodsByName.getVnfInstances.task) {
973
- try {
974
- a.getVnfInstances(null, null, null, null, null, null, (data, error) => {
975
- try {
976
- if (stub) {
977
- runCommonAsserts(data, error);
978
- assert.equal('object', typeof data.response[0]);
979
- assert.equal('object', typeof data.response[1]);
980
- assert.equal('object', typeof data.response[2]);
981
- } else {
982
- runCommonAsserts(data, error);
983
- }
984
- saveMockData('VnfInstances', 'getVnfInstances', 'default', data);
985
- done();
986
- } catch (err) {
987
- log.error(`Test Failure: ${err}`);
988
- done(err);
931
+ try {
932
+ a.getVnfInstances(null, null, null, null, null, null, (data, error) => {
933
+ try {
934
+ if (stub) {
935
+ runCommonAsserts(data, error);
936
+ assert.equal('object', typeof data.response[0]);
937
+ assert.equal('object', typeof data.response[1]);
938
+ assert.equal('object', typeof data.response[2]);
939
+ } else {
940
+ runCommonAsserts(data, error);
989
941
  }
990
- });
991
- } catch (error) {
992
- log.error(`Adapter Exception: ${error}`);
993
- done(error);
994
- }
995
- } else {
996
- log.error('getVnfInstances task is false, skipping test');
997
- skipCount += 1;
998
- done();
999
- }// end if task
942
+ saveMockData('VnfInstances', 'getVnfInstances', 'default', data);
943
+ done();
944
+ } catch (err) {
945
+ log.error(`Test Failure: ${err}`);
946
+ done(err);
947
+ }
948
+ });
949
+ } catch (error) {
950
+ log.error(`Adapter Exception: ${error}`);
951
+ done(error);
952
+ }
1000
953
  }).timeout(attemptTimeout);
1001
954
  });
1002
955
 
@@ -1005,120 +958,102 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1005
958
  };
1006
959
  describe('#postVnfInstances - errors', () => {
1007
960
  it('should work if integrated or standalone with mockdata', (done) => {
1008
- if (pronghorn.methodsByName.postVnfInstances.task) {
1009
- try {
1010
- a.postVnfInstances(vnfInstancesPostVnfInstancesBodyParam, (data, error) => {
1011
- try {
1012
- if (stub) {
1013
- runCommonAsserts(data, error);
1014
- assert.equal('string', data.response.id);
1015
- assert.equal('string', data.response.vnfInstanceName);
1016
- assert.equal('string', data.response.vnfInstanceDescription);
1017
- assert.equal('string', data.response.vnfdId);
1018
- assert.equal('string', data.response.vnfProvider);
1019
- assert.equal('string', data.response.vnfProductName);
1020
- assert.equal('string', data.response.vnfSoftwareVersion);
1021
- assert.equal('string', data.response.vnfdVersion);
1022
- assert.equal('object', typeof data.response.vnfConfigurableProperties);
1023
- assert.equal('INSTANTIATED', data.response.instantiationState);
1024
- assert.equal('object', typeof data.response.instantiatedVnfInfo);
1025
- assert.equal('object', typeof data.response.metadata);
1026
- assert.equal('object', typeof data.response.extensions);
1027
- assert.equal('object', typeof data.response._links);
1028
- } else {
1029
- runCommonAsserts(data, error);
1030
- }
1031
- saveMockData('VnfInstances', 'postVnfInstances', 'default', data);
1032
- done();
1033
- } catch (err) {
1034
- log.error(`Test Failure: ${err}`);
1035
- done(err);
961
+ try {
962
+ a.postVnfInstances(vnfInstancesPostVnfInstancesBodyParam, (data, error) => {
963
+ try {
964
+ if (stub) {
965
+ runCommonAsserts(data, error);
966
+ assert.equal('string', data.response.id);
967
+ assert.equal('string', data.response.vnfInstanceName);
968
+ assert.equal('string', data.response.vnfInstanceDescription);
969
+ assert.equal('string', data.response.vnfdId);
970
+ assert.equal('string', data.response.vnfProvider);
971
+ assert.equal('string', data.response.vnfProductName);
972
+ assert.equal('string', data.response.vnfSoftwareVersion);
973
+ assert.equal('string', data.response.vnfdVersion);
974
+ assert.equal('object', typeof data.response.vnfConfigurableProperties);
975
+ assert.equal('INSTANTIATED', data.response.instantiationState);
976
+ assert.equal('object', typeof data.response.instantiatedVnfInfo);
977
+ assert.equal('object', typeof data.response.metadata);
978
+ assert.equal('object', typeof data.response.extensions);
979
+ assert.equal('object', typeof data.response._links);
980
+ } else {
981
+ runCommonAsserts(data, error);
1036
982
  }
1037
- });
1038
- } catch (error) {
1039
- log.error(`Adapter Exception: ${error}`);
1040
- done(error);
1041
- }
1042
- } else {
1043
- log.error('postVnfInstances task is false, skipping test');
1044
- skipCount += 1;
1045
- done();
1046
- }// end if task
983
+ saveMockData('VnfInstances', 'postVnfInstances', 'default', data);
984
+ done();
985
+ } catch (err) {
986
+ log.error(`Test Failure: ${err}`);
987
+ done(err);
988
+ }
989
+ });
990
+ } catch (error) {
991
+ log.error(`Adapter Exception: ${error}`);
992
+ done(error);
993
+ }
1047
994
  }).timeout(attemptTimeout);
1048
995
  });
1049
996
 
1050
997
  describe('#getVnfInstancesVnfInstanceId - errors', () => {
1051
998
  it('should work if integrated or standalone with mockdata', (done) => {
1052
- if (pronghorn.methodsByName.getVnfInstancesVnfInstanceId.task) {
1053
- try {
1054
- a.getVnfInstancesVnfInstanceId('fakedata', (data, error) => {
1055
- try {
1056
- if (stub) {
1057
- runCommonAsserts(data, error);
1058
- assert.equal('string', data.response.id);
1059
- assert.equal('string', data.response.vnfInstanceName);
1060
- assert.equal('string', data.response.vnfInstanceDescription);
1061
- assert.equal('string', data.response.vnfdId);
1062
- assert.equal('string', data.response.vnfProvider);
1063
- assert.equal('string', data.response.vnfProductName);
1064
- assert.equal('string', data.response.vnfSoftwareVersion);
1065
- assert.equal('string', data.response.vnfdVersion);
1066
- assert.equal('object', typeof data.response.vnfConfigurableProperties);
1067
- assert.equal('NOT_INSTANTIATED', data.response.instantiationState);
1068
- assert.equal('object', typeof data.response.instantiatedVnfInfo);
1069
- assert.equal('object', typeof data.response.metadata);
1070
- assert.equal('object', typeof data.response.extensions);
1071
- assert.equal('object', typeof data.response._links);
1072
- } else {
1073
- runCommonAsserts(data, error);
1074
- }
1075
- saveMockData('VnfInstances', 'getVnfInstancesVnfInstanceId', 'default', data);
1076
- done();
1077
- } catch (err) {
1078
- log.error(`Test Failure: ${err}`);
1079
- done(err);
999
+ try {
1000
+ a.getVnfInstancesVnfInstanceId('fakedata', (data, error) => {
1001
+ try {
1002
+ if (stub) {
1003
+ runCommonAsserts(data, error);
1004
+ assert.equal('string', data.response.id);
1005
+ assert.equal('string', data.response.vnfInstanceName);
1006
+ assert.equal('string', data.response.vnfInstanceDescription);
1007
+ assert.equal('string', data.response.vnfdId);
1008
+ assert.equal('string', data.response.vnfProvider);
1009
+ assert.equal('string', data.response.vnfProductName);
1010
+ assert.equal('string', data.response.vnfSoftwareVersion);
1011
+ assert.equal('string', data.response.vnfdVersion);
1012
+ assert.equal('object', typeof data.response.vnfConfigurableProperties);
1013
+ assert.equal('NOT_INSTANTIATED', data.response.instantiationState);
1014
+ assert.equal('object', typeof data.response.instantiatedVnfInfo);
1015
+ assert.equal('object', typeof data.response.metadata);
1016
+ assert.equal('object', typeof data.response.extensions);
1017
+ assert.equal('object', typeof data.response._links);
1018
+ } else {
1019
+ runCommonAsserts(data, error);
1080
1020
  }
1081
- });
1082
- } catch (error) {
1083
- log.error(`Adapter Exception: ${error}`);
1084
- done(error);
1085
- }
1086
- } else {
1087
- log.error('getVnfInstancesVnfInstanceId task is false, skipping test');
1088
- skipCount += 1;
1089
- done();
1090
- }// end if task
1021
+ saveMockData('VnfInstances', 'getVnfInstancesVnfInstanceId', 'default', data);
1022
+ done();
1023
+ } catch (err) {
1024
+ log.error(`Test Failure: ${err}`);
1025
+ done(err);
1026
+ }
1027
+ });
1028
+ } catch (error) {
1029
+ log.error(`Adapter Exception: ${error}`);
1030
+ done(error);
1031
+ }
1091
1032
  }).timeout(attemptTimeout);
1092
1033
  });
1093
1034
 
1094
1035
  describe('#deleteVnfInstancesVnfInstanceId - errors', () => {
1095
1036
  it('should work if integrated or standalone with mockdata', (done) => {
1096
- if (pronghorn.methodsByName.deleteVnfInstancesVnfInstanceId.task) {
1097
- try {
1098
- a.deleteVnfInstancesVnfInstanceId('fakedata', (data, error) => {
1099
- try {
1100
- if (stub) {
1101
- runCommonAsserts(data, error);
1102
- assert.equal('success', data.response);
1103
- } else {
1104
- runCommonAsserts(data, error);
1105
- }
1106
- saveMockData('VnfInstances', 'deleteVnfInstancesVnfInstanceId', 'default', data);
1107
- done();
1108
- } catch (err) {
1109
- log.error(`Test Failure: ${err}`);
1110
- done(err);
1037
+ try {
1038
+ a.deleteVnfInstancesVnfInstanceId('fakedata', (data, error) => {
1039
+ try {
1040
+ if (stub) {
1041
+ runCommonAsserts(data, error);
1042
+ assert.equal('success', data.response);
1043
+ } else {
1044
+ runCommonAsserts(data, error);
1111
1045
  }
1112
- });
1113
- } catch (error) {
1114
- log.error(`Adapter Exception: ${error}`);
1115
- done(error);
1116
- }
1117
- } else {
1118
- log.error('deleteVnfInstancesVnfInstanceId task is false, skipping test');
1119
- skipCount += 1;
1120
- done();
1121
- }// end if task
1046
+ saveMockData('VnfInstances', 'deleteVnfInstancesVnfInstanceId', 'default', data);
1047
+ done();
1048
+ } catch (err) {
1049
+ log.error(`Test Failure: ${err}`);
1050
+ done(err);
1051
+ }
1052
+ });
1053
+ } catch (error) {
1054
+ log.error(`Adapter Exception: ${error}`);
1055
+ done(error);
1056
+ }
1122
1057
  }).timeout(attemptTimeout);
1123
1058
  });
1124
1059
 
@@ -1141,32 +1076,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1141
1076
  };
1142
1077
  describe('#patchVnfInstancesVnfInstanceId - errors', () => {
1143
1078
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1144
- if (pronghorn.methodsByName.patchVnfInstancesVnfInstanceId.task) {
1145
- try {
1146
- a.patchVnfInstancesVnfInstanceId('fakedata', vnfInstancesPatchVnfInstancesVnfInstanceIdBodyParam, (data, error) => {
1147
- try {
1148
- if (stub) {
1149
- const displayE = 'Error 400 received on request';
1150
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1151
- } else {
1152
- runCommonAsserts(data, error);
1153
- }
1154
- saveMockData('VnfInstances', 'patchVnfInstancesVnfInstanceId', 'default', data);
1155
- done();
1156
- } catch (err) {
1157
- log.error(`Test Failure: ${err}`);
1158
- done(err);
1079
+ try {
1080
+ a.patchVnfInstancesVnfInstanceId('fakedata', vnfInstancesPatchVnfInstancesVnfInstanceIdBodyParam, (data, error) => {
1081
+ try {
1082
+ if (stub) {
1083
+ const displayE = 'Error 400 received on request';
1084
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1085
+ } else {
1086
+ runCommonAsserts(data, error);
1159
1087
  }
1160
- });
1161
- } catch (error) {
1162
- log.error(`Adapter Exception: ${error}`);
1163
- done(error);
1164
- }
1165
- } else {
1166
- log.error('patchVnfInstancesVnfInstanceId task is false, skipping test');
1167
- skipCount += 1;
1168
- done();
1169
- }// end if task
1088
+ saveMockData('VnfInstances', 'patchVnfInstancesVnfInstanceId', 'default', data);
1089
+ done();
1090
+ } catch (err) {
1091
+ log.error(`Test Failure: ${err}`);
1092
+ done(err);
1093
+ }
1094
+ });
1095
+ } catch (error) {
1096
+ log.error(`Adapter Exception: ${error}`);
1097
+ done(error);
1098
+ }
1170
1099
  }).timeout(attemptTimeout);
1171
1100
  });
1172
1101
 
@@ -1175,67 +1104,55 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1175
1104
  };
1176
1105
  describe('#postVnfInstancesVnfInstanceIdInstantiate - errors', () => {
1177
1106
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1178
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdInstantiate.task) {
1179
- try {
1180
- a.postVnfInstancesVnfInstanceIdInstantiate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdInstantiateBodyParam, (data, error) => {
1181
- try {
1182
- if (stub) {
1183
- const displayE = 'Error 400 received on request';
1184
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1185
- } else {
1186
- runCommonAsserts(data, error);
1187
- }
1188
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdInstantiate', 'default', data);
1189
- done();
1190
- } catch (err) {
1191
- log.error(`Test Failure: ${err}`);
1192
- done(err);
1107
+ try {
1108
+ a.postVnfInstancesVnfInstanceIdInstantiate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdInstantiateBodyParam, (data, error) => {
1109
+ try {
1110
+ if (stub) {
1111
+ const displayE = 'Error 400 received on request';
1112
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1113
+ } else {
1114
+ runCommonAsserts(data, error);
1193
1115
  }
1194
- });
1195
- } catch (error) {
1196
- log.error(`Adapter Exception: ${error}`);
1197
- done(error);
1198
- }
1199
- } else {
1200
- log.error('postVnfInstancesVnfInstanceIdInstantiate task is false, skipping test');
1201
- skipCount += 1;
1202
- done();
1203
- }// end if task
1204
- }).timeout(attemptTimeout);
1205
- });
1206
-
1207
- const vnfInstancesPostVnfInstancesVnfInstanceIdScaleBodyParam = {
1208
- type: 'SCALE_OUT',
1116
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdInstantiate', 'default', data);
1117
+ done();
1118
+ } catch (err) {
1119
+ log.error(`Test Failure: ${err}`);
1120
+ done(err);
1121
+ }
1122
+ });
1123
+ } catch (error) {
1124
+ log.error(`Adapter Exception: ${error}`);
1125
+ done(error);
1126
+ }
1127
+ }).timeout(attemptTimeout);
1128
+ });
1129
+
1130
+ const vnfInstancesPostVnfInstancesVnfInstanceIdScaleBodyParam = {
1131
+ type: 'SCALE_OUT',
1209
1132
  aspectId: 'string'
1210
1133
  };
1211
1134
  describe('#postVnfInstancesVnfInstanceIdScale - errors', () => {
1212
1135
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1213
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdScale.task) {
1214
- try {
1215
- a.postVnfInstancesVnfInstanceIdScale('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdScaleBodyParam, (data, error) => {
1216
- try {
1217
- if (stub) {
1218
- const displayE = 'Error 400 received on request';
1219
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1220
- } else {
1221
- runCommonAsserts(data, error);
1222
- }
1223
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdScale', 'default', data);
1224
- done();
1225
- } catch (err) {
1226
- log.error(`Test Failure: ${err}`);
1227
- done(err);
1136
+ try {
1137
+ a.postVnfInstancesVnfInstanceIdScale('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdScaleBodyParam, (data, error) => {
1138
+ try {
1139
+ if (stub) {
1140
+ const displayE = 'Error 400 received on request';
1141
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1142
+ } else {
1143
+ runCommonAsserts(data, error);
1228
1144
  }
1229
- });
1230
- } catch (error) {
1231
- log.error(`Adapter Exception: ${error}`);
1232
- done(error);
1233
- }
1234
- } else {
1235
- log.error('postVnfInstancesVnfInstanceIdScale task is false, skipping test');
1236
- skipCount += 1;
1237
- done();
1238
- }// end if task
1145
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdScale', 'default', data);
1146
+ done();
1147
+ } catch (err) {
1148
+ log.error(`Test Failure: ${err}`);
1149
+ done(err);
1150
+ }
1151
+ });
1152
+ } catch (error) {
1153
+ log.error(`Adapter Exception: ${error}`);
1154
+ done(error);
1155
+ }
1239
1156
  }).timeout(attemptTimeout);
1240
1157
  });
1241
1158
 
@@ -1252,32 +1169,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1252
1169
  };
1253
1170
  describe('#postVnfInstancesVnfInstanceIdScaleToLevel - errors', () => {
1254
1171
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1255
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdScaleToLevel.task) {
1256
- try {
1257
- a.postVnfInstancesVnfInstanceIdScaleToLevel('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdScaleToLevelBodyParam, (data, error) => {
1258
- try {
1259
- if (stub) {
1260
- const displayE = 'Error 400 received on request';
1261
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1262
- } else {
1263
- runCommonAsserts(data, error);
1264
- }
1265
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdScaleToLevel', 'default', data);
1266
- done();
1267
- } catch (err) {
1268
- log.error(`Test Failure: ${err}`);
1269
- done(err);
1172
+ try {
1173
+ a.postVnfInstancesVnfInstanceIdScaleToLevel('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdScaleToLevelBodyParam, (data, error) => {
1174
+ try {
1175
+ if (stub) {
1176
+ const displayE = 'Error 400 received on request';
1177
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1178
+ } else {
1179
+ runCommonAsserts(data, error);
1270
1180
  }
1271
- });
1272
- } catch (error) {
1273
- log.error(`Adapter Exception: ${error}`);
1274
- done(error);
1275
- }
1276
- } else {
1277
- log.error('postVnfInstancesVnfInstanceIdScaleToLevel task is false, skipping test');
1278
- skipCount += 1;
1279
- done();
1280
- }// end if task
1181
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdScaleToLevel', 'default', data);
1182
+ done();
1183
+ } catch (err) {
1184
+ log.error(`Test Failure: ${err}`);
1185
+ done(err);
1186
+ }
1187
+ });
1188
+ } catch (error) {
1189
+ log.error(`Adapter Exception: ${error}`);
1190
+ done(error);
1191
+ }
1281
1192
  }).timeout(attemptTimeout);
1282
1193
  });
1283
1194
 
@@ -1286,32 +1197,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1286
1197
  };
1287
1198
  describe('#postVnfInstancesVnfInstanceIdChangeFlavour - errors', () => {
1288
1199
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1289
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdChangeFlavour.task) {
1290
- try {
1291
- a.postVnfInstancesVnfInstanceIdChangeFlavour('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeFlavourBodyParam, (data, error) => {
1292
- try {
1293
- if (stub) {
1294
- const displayE = 'Error 400 received on request';
1295
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1296
- } else {
1297
- runCommonAsserts(data, error);
1298
- }
1299
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeFlavour', 'default', data);
1300
- done();
1301
- } catch (err) {
1302
- log.error(`Test Failure: ${err}`);
1303
- done(err);
1200
+ try {
1201
+ a.postVnfInstancesVnfInstanceIdChangeFlavour('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeFlavourBodyParam, (data, error) => {
1202
+ try {
1203
+ if (stub) {
1204
+ const displayE = 'Error 400 received on request';
1205
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1206
+ } else {
1207
+ runCommonAsserts(data, error);
1304
1208
  }
1305
- });
1306
- } catch (error) {
1307
- log.error(`Adapter Exception: ${error}`);
1308
- done(error);
1309
- }
1310
- } else {
1311
- log.error('postVnfInstancesVnfInstanceIdChangeFlavour task is false, skipping test');
1312
- skipCount += 1;
1313
- done();
1314
- }// end if task
1209
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeFlavour', 'default', data);
1210
+ done();
1211
+ } catch (err) {
1212
+ log.error(`Test Failure: ${err}`);
1213
+ done(err);
1214
+ }
1215
+ });
1216
+ } catch (error) {
1217
+ log.error(`Adapter Exception: ${error}`);
1218
+ done(error);
1219
+ }
1315
1220
  }).timeout(attemptTimeout);
1316
1221
  });
1317
1222
 
@@ -1320,32 +1225,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1320
1225
  };
1321
1226
  describe('#postVnfInstancesVnfInstanceIdTerminate - errors', () => {
1322
1227
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1323
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdTerminate.task) {
1324
- try {
1325
- a.postVnfInstancesVnfInstanceIdTerminate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdTerminateBodyParam, (data, error) => {
1326
- try {
1327
- if (stub) {
1328
- const displayE = 'Error 400 received on request';
1329
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1330
- } else {
1331
- runCommonAsserts(data, error);
1332
- }
1333
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdTerminate', 'default', data);
1334
- done();
1335
- } catch (err) {
1336
- log.error(`Test Failure: ${err}`);
1337
- done(err);
1228
+ try {
1229
+ a.postVnfInstancesVnfInstanceIdTerminate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdTerminateBodyParam, (data, error) => {
1230
+ try {
1231
+ if (stub) {
1232
+ const displayE = 'Error 400 received on request';
1233
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1234
+ } else {
1235
+ runCommonAsserts(data, error);
1338
1236
  }
1339
- });
1340
- } catch (error) {
1341
- log.error(`Adapter Exception: ${error}`);
1342
- done(error);
1343
- }
1344
- } else {
1345
- log.error('postVnfInstancesVnfInstanceIdTerminate task is false, skipping test');
1346
- skipCount += 1;
1347
- done();
1348
- }// end if task
1237
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdTerminate', 'default', data);
1238
+ done();
1239
+ } catch (err) {
1240
+ log.error(`Test Failure: ${err}`);
1241
+ done(err);
1242
+ }
1243
+ });
1244
+ } catch (error) {
1245
+ log.error(`Adapter Exception: ${error}`);
1246
+ done(error);
1247
+ }
1349
1248
  }).timeout(attemptTimeout);
1350
1249
  });
1351
1250
 
@@ -1359,32 +1258,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1359
1258
  };
1360
1259
  describe('#postVnfInstancesVnfInstanceIdHeal - errors', () => {
1361
1260
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1362
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdHeal.task) {
1363
- try {
1364
- a.postVnfInstancesVnfInstanceIdHeal('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdHealBodyParam, (data, error) => {
1365
- try {
1366
- if (stub) {
1367
- const displayE = 'Error 400 received on request';
1368
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1369
- } else {
1370
- runCommonAsserts(data, error);
1371
- }
1372
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdHeal', 'default', data);
1373
- done();
1374
- } catch (err) {
1375
- log.error(`Test Failure: ${err}`);
1376
- done(err);
1261
+ try {
1262
+ a.postVnfInstancesVnfInstanceIdHeal('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdHealBodyParam, (data, error) => {
1263
+ try {
1264
+ if (stub) {
1265
+ const displayE = 'Error 400 received on request';
1266
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1267
+ } else {
1268
+ runCommonAsserts(data, error);
1377
1269
  }
1378
- });
1379
- } catch (error) {
1380
- log.error(`Adapter Exception: ${error}`);
1381
- done(error);
1382
- }
1383
- } else {
1384
- log.error('postVnfInstancesVnfInstanceIdHeal task is false, skipping test');
1385
- skipCount += 1;
1386
- done();
1387
- }// end if task
1270
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdHeal', 'default', data);
1271
+ done();
1272
+ } catch (err) {
1273
+ log.error(`Test Failure: ${err}`);
1274
+ done(err);
1275
+ }
1276
+ });
1277
+ } catch (error) {
1278
+ log.error(`Adapter Exception: ${error}`);
1279
+ done(error);
1280
+ }
1388
1281
  }).timeout(attemptTimeout);
1389
1282
  });
1390
1283
 
@@ -1393,32 +1286,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1393
1286
  };
1394
1287
  describe('#postVnfInstancesVnfInstanceIdOperate - errors', () => {
1395
1288
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1396
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdOperate.task) {
1397
- try {
1398
- a.postVnfInstancesVnfInstanceIdOperate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdOperateBodyParam, (data, error) => {
1399
- try {
1400
- if (stub) {
1401
- const displayE = 'Error 400 received on request';
1402
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1403
- } else {
1404
- runCommonAsserts(data, error);
1405
- }
1406
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdOperate', 'default', data);
1407
- done();
1408
- } catch (err) {
1409
- log.error(`Test Failure: ${err}`);
1410
- done(err);
1289
+ try {
1290
+ a.postVnfInstancesVnfInstanceIdOperate('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdOperateBodyParam, (data, error) => {
1291
+ try {
1292
+ if (stub) {
1293
+ const displayE = 'Error 400 received on request';
1294
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1295
+ } else {
1296
+ runCommonAsserts(data, error);
1411
1297
  }
1412
- });
1413
- } catch (error) {
1414
- log.error(`Adapter Exception: ${error}`);
1415
- done(error);
1416
- }
1417
- } else {
1418
- log.error('postVnfInstancesVnfInstanceIdOperate task is false, skipping test');
1419
- skipCount += 1;
1420
- done();
1421
- }// end if task
1298
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdOperate', 'default', data);
1299
+ done();
1300
+ } catch (err) {
1301
+ log.error(`Test Failure: ${err}`);
1302
+ done(err);
1303
+ }
1304
+ });
1305
+ } catch (error) {
1306
+ log.error(`Adapter Exception: ${error}`);
1307
+ done(error);
1308
+ }
1422
1309
  }).timeout(attemptTimeout);
1423
1310
  });
1424
1311
 
@@ -1429,32 +1316,26 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1429
1316
  };
1430
1317
  describe('#postVnfInstancesVnfInstanceIdChangeExtConn - errors', () => {
1431
1318
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1432
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdChangeExtConn.task) {
1433
- try {
1434
- a.postVnfInstancesVnfInstanceIdChangeExtConn('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeExtConnBodyParam, (data, error) => {
1435
- try {
1436
- if (stub) {
1437
- const displayE = 'Error 400 received on request';
1438
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1439
- } else {
1440
- runCommonAsserts(data, error);
1441
- }
1442
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeExtConn', 'default', data);
1443
- done();
1444
- } catch (err) {
1445
- log.error(`Test Failure: ${err}`);
1446
- done(err);
1319
+ try {
1320
+ a.postVnfInstancesVnfInstanceIdChangeExtConn('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeExtConnBodyParam, (data, error) => {
1321
+ try {
1322
+ if (stub) {
1323
+ const displayE = 'Error 400 received on request';
1324
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1325
+ } else {
1326
+ runCommonAsserts(data, error);
1447
1327
  }
1448
- });
1449
- } catch (error) {
1450
- log.error(`Adapter Exception: ${error}`);
1451
- done(error);
1452
- }
1453
- } else {
1454
- log.error('postVnfInstancesVnfInstanceIdChangeExtConn task is false, skipping test');
1455
- skipCount += 1;
1456
- done();
1457
- }// end if task
1328
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeExtConn', 'default', data);
1329
+ done();
1330
+ } catch (err) {
1331
+ log.error(`Test Failure: ${err}`);
1332
+ done(err);
1333
+ }
1334
+ });
1335
+ } catch (error) {
1336
+ log.error(`Adapter Exception: ${error}`);
1337
+ done(error);
1338
+ }
1458
1339
  }).timeout(attemptTimeout);
1459
1340
  });
1460
1341
 
@@ -1463,64 +1344,52 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1463
1344
  };
1464
1345
  describe('#postVnfInstancesVnfInstanceIdChangeVnfpkg - errors', () => {
1465
1346
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1466
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdChangeVnfpkg.task) {
1467
- try {
1468
- a.postVnfInstancesVnfInstanceIdChangeVnfpkg('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeVnfpkgBodyParam, (data, error) => {
1469
- try {
1470
- if (stub) {
1471
- const displayE = 'Error 400 received on request';
1472
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1473
- } else {
1474
- runCommonAsserts(data, error);
1475
- }
1476
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeVnfpkg', 'default', data);
1477
- done();
1478
- } catch (err) {
1479
- log.error(`Test Failure: ${err}`);
1480
- done(err);
1347
+ try {
1348
+ a.postVnfInstancesVnfInstanceIdChangeVnfpkg('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdChangeVnfpkgBodyParam, (data, error) => {
1349
+ try {
1350
+ if (stub) {
1351
+ const displayE = 'Error 400 received on request';
1352
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1353
+ } else {
1354
+ runCommonAsserts(data, error);
1481
1355
  }
1482
- });
1483
- } catch (error) {
1484
- log.error(`Adapter Exception: ${error}`);
1485
- done(error);
1486
- }
1487
- } else {
1488
- log.error('postVnfInstancesVnfInstanceIdChangeVnfpkg task is false, skipping test');
1489
- skipCount += 1;
1490
- done();
1491
- }// end if task
1356
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdChangeVnfpkg', 'default', data);
1357
+ done();
1358
+ } catch (err) {
1359
+ log.error(`Test Failure: ${err}`);
1360
+ done(err);
1361
+ }
1362
+ });
1363
+ } catch (error) {
1364
+ log.error(`Adapter Exception: ${error}`);
1365
+ done(error);
1366
+ }
1492
1367
  }).timeout(attemptTimeout);
1493
1368
  });
1494
1369
 
1495
1370
  const vnfInstancesPostVnfInstancesVnfInstanceIdCreateSnapshotBodyParam = {};
1496
1371
  describe('#postVnfInstancesVnfInstanceIdCreateSnapshot - errors', () => {
1497
1372
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1498
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdCreateSnapshot.task) {
1499
- try {
1500
- a.postVnfInstancesVnfInstanceIdCreateSnapshot('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdCreateSnapshotBodyParam, (data, error) => {
1501
- try {
1502
- if (stub) {
1503
- const displayE = 'Error 400 received on request';
1504
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1505
- } else {
1506
- runCommonAsserts(data, error);
1507
- }
1508
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdCreateSnapshot', 'default', data);
1509
- done();
1510
- } catch (err) {
1511
- log.error(`Test Failure: ${err}`);
1512
- done(err);
1373
+ try {
1374
+ a.postVnfInstancesVnfInstanceIdCreateSnapshot('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdCreateSnapshotBodyParam, (data, error) => {
1375
+ try {
1376
+ if (stub) {
1377
+ const displayE = 'Error 400 received on request';
1378
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1379
+ } else {
1380
+ runCommonAsserts(data, error);
1513
1381
  }
1514
- });
1515
- } catch (error) {
1516
- log.error(`Adapter Exception: ${error}`);
1517
- done(error);
1518
- }
1519
- } else {
1520
- log.error('postVnfInstancesVnfInstanceIdCreateSnapshot task is false, skipping test');
1521
- skipCount += 1;
1522
- done();
1523
- }// end if task
1382
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdCreateSnapshot', 'default', data);
1383
+ done();
1384
+ } catch (err) {
1385
+ log.error(`Test Failure: ${err}`);
1386
+ done(err);
1387
+ }
1388
+ });
1389
+ } catch (error) {
1390
+ log.error(`Adapter Exception: ${error}`);
1391
+ done(error);
1392
+ }
1524
1393
  }).timeout(attemptTimeout);
1525
1394
  });
1526
1395
 
@@ -1532,269 +1401,227 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1532
1401
  };
1533
1402
  describe('#postVnfInstancesVnfInstanceIdRevertToSnapshot - errors', () => {
1534
1403
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1535
- if (pronghorn.methodsByName.postVnfInstancesVnfInstanceIdRevertToSnapshot.task) {
1536
- try {
1537
- a.postVnfInstancesVnfInstanceIdRevertToSnapshot('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdRevertToSnapshotBodyParam, (data, error) => {
1538
- try {
1539
- if (stub) {
1540
- const displayE = 'Error 400 received on request';
1541
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1542
- } else {
1543
- runCommonAsserts(data, error);
1544
- }
1545
- saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdRevertToSnapshot', 'default', data);
1546
- done();
1547
- } catch (err) {
1548
- log.error(`Test Failure: ${err}`);
1549
- done(err);
1404
+ try {
1405
+ a.postVnfInstancesVnfInstanceIdRevertToSnapshot('fakedata', vnfInstancesPostVnfInstancesVnfInstanceIdRevertToSnapshotBodyParam, (data, error) => {
1406
+ try {
1407
+ if (stub) {
1408
+ const displayE = 'Error 400 received on request';
1409
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1410
+ } else {
1411
+ runCommonAsserts(data, error);
1550
1412
  }
1551
- });
1552
- } catch (error) {
1553
- log.error(`Adapter Exception: ${error}`);
1554
- done(error);
1555
- }
1556
- } else {
1557
- log.error('postVnfInstancesVnfInstanceIdRevertToSnapshot task is false, skipping test');
1558
- skipCount += 1;
1559
- done();
1560
- }// end if task
1413
+ saveMockData('VnfInstances', 'postVnfInstancesVnfInstanceIdRevertToSnapshot', 'default', data);
1414
+ done();
1415
+ } catch (err) {
1416
+ log.error(`Test Failure: ${err}`);
1417
+ done(err);
1418
+ }
1419
+ });
1420
+ } catch (error) {
1421
+ log.error(`Adapter Exception: ${error}`);
1422
+ done(error);
1423
+ }
1561
1424
  }).timeout(attemptTimeout);
1562
1425
  });
1563
1426
 
1564
1427
  describe('#getVnfLcmOpOccs - errors', () => {
1565
1428
  it('should work if integrated or standalone with mockdata', (done) => {
1566
- if (pronghorn.methodsByName.getVnfLcmOpOccs.task) {
1567
- try {
1568
- a.getVnfLcmOpOccs(null, null, null, null, null, null, (data, error) => {
1569
- try {
1570
- if (stub) {
1571
- runCommonAsserts(data, error);
1572
- assert.equal('string', data.response.id);
1573
- assert.equal('COMPLETED', data.response.operationState);
1574
- assert.equal('string', data.response.stateEnteredTime);
1575
- assert.equal('string', data.response.startTime);
1576
- assert.equal('string', data.response.vnfInstanceId);
1577
- assert.equal('string', data.response.grantId);
1578
- assert.equal('INSTANTIATE', data.response.operation);
1579
- assert.equal(false, data.response.isAutomaticInvocation);
1580
- assert.equal('object', typeof data.response.operationParams);
1581
- assert.equal(true, data.response.isCancelPending);
1582
- assert.equal('GRACEFUL', data.response.cancelMode);
1583
- assert.equal('object', typeof data.response.error);
1584
- assert.equal('object', typeof data.response.resourceChanges);
1585
- assert.equal('object', typeof data.response.changedInfo);
1586
- assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1587
- assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1588
- assert.equal('string', data.response.vnfSnapshotInfoId);
1589
- assert.equal('object', typeof data.response._links);
1590
- } else {
1591
- runCommonAsserts(data, error);
1592
- }
1593
- saveMockData('VnfLcmOpOccs', 'getVnfLcmOpOccs', 'default', data);
1594
- done();
1595
- } catch (err) {
1596
- log.error(`Test Failure: ${err}`);
1597
- done(err);
1429
+ try {
1430
+ a.getVnfLcmOpOccs(null, null, null, null, null, null, (data, error) => {
1431
+ try {
1432
+ if (stub) {
1433
+ runCommonAsserts(data, error);
1434
+ assert.equal('string', data.response.id);
1435
+ assert.equal('COMPLETED', data.response.operationState);
1436
+ assert.equal('string', data.response.stateEnteredTime);
1437
+ assert.equal('string', data.response.startTime);
1438
+ assert.equal('string', data.response.vnfInstanceId);
1439
+ assert.equal('string', data.response.grantId);
1440
+ assert.equal('INSTANTIATE', data.response.operation);
1441
+ assert.equal(false, data.response.isAutomaticInvocation);
1442
+ assert.equal('object', typeof data.response.operationParams);
1443
+ assert.equal(true, data.response.isCancelPending);
1444
+ assert.equal('GRACEFUL', data.response.cancelMode);
1445
+ assert.equal('object', typeof data.response.error);
1446
+ assert.equal('object', typeof data.response.resourceChanges);
1447
+ assert.equal('object', typeof data.response.changedInfo);
1448
+ assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1449
+ assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1450
+ assert.equal('string', data.response.vnfSnapshotInfoId);
1451
+ assert.equal('object', typeof data.response._links);
1452
+ } else {
1453
+ runCommonAsserts(data, error);
1598
1454
  }
1599
- });
1600
- } catch (error) {
1601
- log.error(`Adapter Exception: ${error}`);
1602
- done(error);
1603
- }
1604
- } else {
1605
- log.error('getVnfLcmOpOccs task is false, skipping test');
1606
- skipCount += 1;
1607
- done();
1608
- }// end if task
1455
+ saveMockData('VnfLcmOpOccs', 'getVnfLcmOpOccs', 'default', data);
1456
+ done();
1457
+ } catch (err) {
1458
+ log.error(`Test Failure: ${err}`);
1459
+ done(err);
1460
+ }
1461
+ });
1462
+ } catch (error) {
1463
+ log.error(`Adapter Exception: ${error}`);
1464
+ done(error);
1465
+ }
1609
1466
  }).timeout(attemptTimeout);
1610
1467
  });
1611
1468
 
1612
1469
  describe('#getVnfLcmOpOccsVnfLcmOpOccId - errors', () => {
1613
1470
  it('should work if integrated or standalone with mockdata', (done) => {
1614
- if (pronghorn.methodsByName.getVnfLcmOpOccsVnfLcmOpOccId.task) {
1615
- try {
1616
- a.getVnfLcmOpOccsVnfLcmOpOccId('fakedata', (data, error) => {
1617
- try {
1618
- if (stub) {
1619
- runCommonAsserts(data, error);
1620
- assert.equal('string', data.response.id);
1621
- assert.equal('ROLLING_BACK', data.response.operationState);
1622
- assert.equal('string', data.response.stateEnteredTime);
1623
- assert.equal('string', data.response.startTime);
1624
- assert.equal('string', data.response.vnfInstanceId);
1625
- assert.equal('string', data.response.grantId);
1626
- assert.equal('SCALE_TO_LEVEL', data.response.operation);
1627
- assert.equal(true, data.response.isAutomaticInvocation);
1628
- assert.equal('object', typeof data.response.operationParams);
1629
- assert.equal(false, data.response.isCancelPending);
1630
- assert.equal('FORCEFUL', data.response.cancelMode);
1631
- assert.equal('object', typeof data.response.error);
1632
- assert.equal('object', typeof data.response.resourceChanges);
1633
- assert.equal('object', typeof data.response.changedInfo);
1634
- assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1635
- assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1636
- assert.equal('string', data.response.vnfSnapshotInfoId);
1637
- assert.equal('object', typeof data.response._links);
1638
- } else {
1639
- runCommonAsserts(data, error);
1640
- }
1641
- saveMockData('VnfLcmOpOccs', 'getVnfLcmOpOccsVnfLcmOpOccId', 'default', data);
1642
- done();
1643
- } catch (err) {
1644
- log.error(`Test Failure: ${err}`);
1645
- done(err);
1471
+ try {
1472
+ a.getVnfLcmOpOccsVnfLcmOpOccId('fakedata', (data, error) => {
1473
+ try {
1474
+ if (stub) {
1475
+ runCommonAsserts(data, error);
1476
+ assert.equal('string', data.response.id);
1477
+ assert.equal('ROLLING_BACK', data.response.operationState);
1478
+ assert.equal('string', data.response.stateEnteredTime);
1479
+ assert.equal('string', data.response.startTime);
1480
+ assert.equal('string', data.response.vnfInstanceId);
1481
+ assert.equal('string', data.response.grantId);
1482
+ assert.equal('SCALE_TO_LEVEL', data.response.operation);
1483
+ assert.equal(true, data.response.isAutomaticInvocation);
1484
+ assert.equal('object', typeof data.response.operationParams);
1485
+ assert.equal(false, data.response.isCancelPending);
1486
+ assert.equal('FORCEFUL', data.response.cancelMode);
1487
+ assert.equal('object', typeof data.response.error);
1488
+ assert.equal('object', typeof data.response.resourceChanges);
1489
+ assert.equal('object', typeof data.response.changedInfo);
1490
+ assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1491
+ assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1492
+ assert.equal('string', data.response.vnfSnapshotInfoId);
1493
+ assert.equal('object', typeof data.response._links);
1494
+ } else {
1495
+ runCommonAsserts(data, error);
1646
1496
  }
1647
- });
1648
- } catch (error) {
1649
- log.error(`Adapter Exception: ${error}`);
1650
- done(error);
1651
- }
1652
- } else {
1653
- log.error('getVnfLcmOpOccsVnfLcmOpOccId task is false, skipping test');
1654
- skipCount += 1;
1655
- done();
1656
- }// end if task
1497
+ saveMockData('VnfLcmOpOccs', 'getVnfLcmOpOccsVnfLcmOpOccId', 'default', data);
1498
+ done();
1499
+ } catch (err) {
1500
+ log.error(`Test Failure: ${err}`);
1501
+ done(err);
1502
+ }
1503
+ });
1504
+ } catch (error) {
1505
+ log.error(`Adapter Exception: ${error}`);
1506
+ done(error);
1507
+ }
1657
1508
  }).timeout(attemptTimeout);
1658
1509
  });
1659
1510
 
1660
1511
  describe('#postVnfLcmOpOccsVnfLcmOpOccIdRetry - errors', () => {
1661
1512
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1662
- if (pronghorn.methodsByName.postVnfLcmOpOccsVnfLcmOpOccIdRetry.task) {
1663
- try {
1664
- a.postVnfLcmOpOccsVnfLcmOpOccIdRetry('fakedata', (data, error) => {
1665
- try {
1666
- if (stub) {
1667
- const displayE = 'Error 400 received on request';
1668
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1669
- } else {
1670
- runCommonAsserts(data, error);
1671
- }
1672
- saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdRetry', 'default', data);
1673
- done();
1674
- } catch (err) {
1675
- log.error(`Test Failure: ${err}`);
1676
- done(err);
1513
+ try {
1514
+ a.postVnfLcmOpOccsVnfLcmOpOccIdRetry('fakedata', (data, error) => {
1515
+ try {
1516
+ if (stub) {
1517
+ const displayE = 'Error 400 received on request';
1518
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1519
+ } else {
1520
+ runCommonAsserts(data, error);
1677
1521
  }
1678
- });
1679
- } catch (error) {
1680
- log.error(`Adapter Exception: ${error}`);
1681
- done(error);
1682
- }
1683
- } else {
1684
- log.error('postVnfLcmOpOccsVnfLcmOpOccIdRetry task is false, skipping test');
1685
- skipCount += 1;
1686
- done();
1687
- }// end if task
1522
+ saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdRetry', 'default', data);
1523
+ done();
1524
+ } catch (err) {
1525
+ log.error(`Test Failure: ${err}`);
1526
+ done(err);
1527
+ }
1528
+ });
1529
+ } catch (error) {
1530
+ log.error(`Adapter Exception: ${error}`);
1531
+ done(error);
1532
+ }
1688
1533
  }).timeout(attemptTimeout);
1689
1534
  });
1690
1535
 
1691
1536
  describe('#postVnfLcmOpOccsVnfLcmOpOccIdRollback - errors', () => {
1692
1537
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1693
- if (pronghorn.methodsByName.postVnfLcmOpOccsVnfLcmOpOccIdRollback.task) {
1694
- try {
1695
- a.postVnfLcmOpOccsVnfLcmOpOccIdRollback('fakedata', (data, error) => {
1696
- try {
1697
- if (stub) {
1698
- const displayE = 'Error 400 received on request';
1699
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1700
- } else {
1701
- runCommonAsserts(data, error);
1702
- }
1703
- saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdRollback', 'default', data);
1704
- done();
1705
- } catch (err) {
1706
- log.error(`Test Failure: ${err}`);
1707
- done(err);
1538
+ try {
1539
+ a.postVnfLcmOpOccsVnfLcmOpOccIdRollback('fakedata', (data, error) => {
1540
+ try {
1541
+ if (stub) {
1542
+ const displayE = 'Error 400 received on request';
1543
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1544
+ } else {
1545
+ runCommonAsserts(data, error);
1708
1546
  }
1709
- });
1710
- } catch (error) {
1711
- log.error(`Adapter Exception: ${error}`);
1712
- done(error);
1713
- }
1714
- } else {
1715
- log.error('postVnfLcmOpOccsVnfLcmOpOccIdRollback task is false, skipping test');
1716
- skipCount += 1;
1717
- done();
1718
- }// end if task
1547
+ saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdRollback', 'default', data);
1548
+ done();
1549
+ } catch (err) {
1550
+ log.error(`Test Failure: ${err}`);
1551
+ done(err);
1552
+ }
1553
+ });
1554
+ } catch (error) {
1555
+ log.error(`Adapter Exception: ${error}`);
1556
+ done(error);
1557
+ }
1719
1558
  }).timeout(attemptTimeout);
1720
1559
  });
1721
1560
 
1722
1561
  describe('#postVnfLcmOpOccsVnfLcmOpOccIdFail - errors', () => {
1723
1562
  it('should work if integrated or standalone with mockdata', (done) => {
1724
- if (pronghorn.methodsByName.postVnfLcmOpOccsVnfLcmOpOccIdFail.task) {
1725
- try {
1726
- a.postVnfLcmOpOccsVnfLcmOpOccIdFail('fakedata', (data, error) => {
1727
- try {
1728
- if (stub) {
1729
- runCommonAsserts(data, error);
1730
- assert.equal('string', data.response.id);
1731
- assert.equal('STARTING', data.response.operationState);
1732
- assert.equal('string', data.response.stateEnteredTime);
1733
- assert.equal('string', data.response.startTime);
1734
- assert.equal('string', data.response.vnfInstanceId);
1735
- assert.equal('string', data.response.grantId);
1736
- assert.equal('REVERT_TO_SNAPSHOT', data.response.operation);
1737
- assert.equal(false, data.response.isAutomaticInvocation);
1738
- assert.equal('object', typeof data.response.operationParams);
1739
- assert.equal(false, data.response.isCancelPending);
1740
- assert.equal('GRACEFUL', data.response.cancelMode);
1741
- assert.equal('object', typeof data.response.error);
1742
- assert.equal('object', typeof data.response.resourceChanges);
1743
- assert.equal('object', typeof data.response.changedInfo);
1744
- assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1745
- assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1746
- assert.equal('string', data.response.vnfSnapshotInfoId);
1747
- assert.equal('object', typeof data.response._links);
1748
- } else {
1749
- runCommonAsserts(data, error);
1750
- }
1751
- saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdFail', 'default', data);
1752
- done();
1753
- } catch (err) {
1754
- log.error(`Test Failure: ${err}`);
1755
- done(err);
1563
+ try {
1564
+ a.postVnfLcmOpOccsVnfLcmOpOccIdFail('fakedata', (data, error) => {
1565
+ try {
1566
+ if (stub) {
1567
+ runCommonAsserts(data, error);
1568
+ assert.equal('string', data.response.id);
1569
+ assert.equal('STARTING', data.response.operationState);
1570
+ assert.equal('string', data.response.stateEnteredTime);
1571
+ assert.equal('string', data.response.startTime);
1572
+ assert.equal('string', data.response.vnfInstanceId);
1573
+ assert.equal('string', data.response.grantId);
1574
+ assert.equal('REVERT_TO_SNAPSHOT', data.response.operation);
1575
+ assert.equal(false, data.response.isAutomaticInvocation);
1576
+ assert.equal('object', typeof data.response.operationParams);
1577
+ assert.equal(false, data.response.isCancelPending);
1578
+ assert.equal('GRACEFUL', data.response.cancelMode);
1579
+ assert.equal('object', typeof data.response.error);
1580
+ assert.equal('object', typeof data.response.resourceChanges);
1581
+ assert.equal('object', typeof data.response.changedInfo);
1582
+ assert.equal(true, Array.isArray(data.response.changedExtConnectivity));
1583
+ assert.equal('object', typeof data.response.modificationsTriggeredByVnfPkgChange);
1584
+ assert.equal('string', data.response.vnfSnapshotInfoId);
1585
+ assert.equal('object', typeof data.response._links);
1586
+ } else {
1587
+ runCommonAsserts(data, error);
1756
1588
  }
1757
- });
1758
- } catch (error) {
1759
- log.error(`Adapter Exception: ${error}`);
1760
- done(error);
1761
- }
1762
- } else {
1763
- log.error('postVnfLcmOpOccsVnfLcmOpOccIdFail task is false, skipping test');
1764
- skipCount += 1;
1765
- done();
1766
- }// end if task
1589
+ saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdFail', 'default', data);
1590
+ done();
1591
+ } catch (err) {
1592
+ log.error(`Test Failure: ${err}`);
1593
+ done(err);
1594
+ }
1595
+ });
1596
+ } catch (error) {
1597
+ log.error(`Adapter Exception: ${error}`);
1598
+ done(error);
1599
+ }
1767
1600
  }).timeout(attemptTimeout);
1768
1601
  });
1769
1602
 
1770
1603
  describe('#postVnfLcmOpOccsVnfLcmOpOccIdCancel - errors', () => {
1771
1604
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1772
- if (pronghorn.methodsByName.postVnfLcmOpOccsVnfLcmOpOccIdCancel.task) {
1773
- try {
1774
- a.postVnfLcmOpOccsVnfLcmOpOccIdCancel('fakedata', (data, error) => {
1775
- try {
1776
- if (stub) {
1777
- const displayE = 'Error 400 received on request';
1778
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1779
- } else {
1780
- runCommonAsserts(data, error);
1781
- }
1782
- saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdCancel', 'default', data);
1783
- done();
1784
- } catch (err) {
1785
- log.error(`Test Failure: ${err}`);
1786
- done(err);
1605
+ try {
1606
+ a.postVnfLcmOpOccsVnfLcmOpOccIdCancel('fakedata', (data, error) => {
1607
+ try {
1608
+ if (stub) {
1609
+ const displayE = 'Error 400 received on request';
1610
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1611
+ } else {
1612
+ runCommonAsserts(data, error);
1787
1613
  }
1788
- });
1789
- } catch (error) {
1790
- log.error(`Adapter Exception: ${error}`);
1791
- done(error);
1792
- }
1793
- } else {
1794
- log.error('postVnfLcmOpOccsVnfLcmOpOccIdCancel task is false, skipping test');
1795
- skipCount += 1;
1796
- done();
1797
- }// end if task
1614
+ saveMockData('VnfLcmOpOccs', 'postVnfLcmOpOccsVnfLcmOpOccIdCancel', 'default', data);
1615
+ done();
1616
+ } catch (err) {
1617
+ log.error(`Test Failure: ${err}`);
1618
+ done(err);
1619
+ }
1620
+ });
1621
+ } catch (error) {
1622
+ log.error(`Adapter Exception: ${error}`);
1623
+ done(error);
1624
+ }
1798
1625
  }).timeout(attemptTimeout);
1799
1626
  });
1800
1627
 
@@ -1803,168 +1630,138 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1803
1630
  };
1804
1631
  describe('#postVnfSnapshots - errors', () => {
1805
1632
  it('should work if integrated or standalone with mockdata', (done) => {
1806
- if (pronghorn.methodsByName.postVnfSnapshots.task) {
1807
- try {
1808
- a.postVnfSnapshots(vnfSnapshotsPostVnfSnapshotsBodyParam, (data, error) => {
1809
- try {
1810
- if (stub) {
1811
- runCommonAsserts(data, error);
1812
- assert.equal('string', data.response.id);
1813
- assert.equal('string', data.response.vnfSnapshotPkgId);
1814
- assert.equal('object', typeof data.response.vnfSnapshot);
1815
- assert.equal('object', typeof data.response._links);
1816
- } else {
1817
- runCommonAsserts(data, error);
1818
- }
1819
- saveMockData('VnfSnapshots', 'postVnfSnapshots', 'default', data);
1820
- done();
1821
- } catch (err) {
1822
- log.error(`Test Failure: ${err}`);
1823
- done(err);
1633
+ try {
1634
+ a.postVnfSnapshots(vnfSnapshotsPostVnfSnapshotsBodyParam, (data, error) => {
1635
+ try {
1636
+ if (stub) {
1637
+ runCommonAsserts(data, error);
1638
+ assert.equal('string', data.response.id);
1639
+ assert.equal('string', data.response.vnfSnapshotPkgId);
1640
+ assert.equal('object', typeof data.response.vnfSnapshot);
1641
+ assert.equal('object', typeof data.response._links);
1642
+ } else {
1643
+ runCommonAsserts(data, error);
1824
1644
  }
1825
- });
1826
- } catch (error) {
1827
- log.error(`Adapter Exception: ${error}`);
1828
- done(error);
1829
- }
1830
- } else {
1831
- log.error('postVnfSnapshots task is false, skipping test');
1832
- skipCount += 1;
1833
- done();
1834
- }// end if task
1645
+ saveMockData('VnfSnapshots', 'postVnfSnapshots', 'default', data);
1646
+ done();
1647
+ } catch (err) {
1648
+ log.error(`Test Failure: ${err}`);
1649
+ done(err);
1650
+ }
1651
+ });
1652
+ } catch (error) {
1653
+ log.error(`Adapter Exception: ${error}`);
1654
+ done(error);
1655
+ }
1835
1656
  }).timeout(attemptTimeout);
1836
1657
  });
1837
1658
 
1838
1659
  describe('#getVnfSnapshots - errors', () => {
1839
1660
  it('should work if integrated or standalone with mockdata', (done) => {
1840
- if (pronghorn.methodsByName.getVnfSnapshots.task) {
1841
- try {
1842
- a.getVnfSnapshots(null, null, null, null, null, null, (data, error) => {
1843
- try {
1844
- if (stub) {
1845
- runCommonAsserts(data, error);
1846
- assert.equal('object', typeof data.response[0]);
1847
- assert.equal('object', typeof data.response[1]);
1848
- assert.equal('object', typeof data.response[2]);
1849
- assert.equal('object', typeof data.response[3]);
1850
- } else {
1851
- runCommonAsserts(data, error);
1852
- }
1853
- saveMockData('VnfSnapshots', 'getVnfSnapshots', 'default', data);
1854
- done();
1855
- } catch (err) {
1856
- log.error(`Test Failure: ${err}`);
1857
- done(err);
1661
+ try {
1662
+ a.getVnfSnapshots(null, null, null, null, null, null, (data, error) => {
1663
+ try {
1664
+ if (stub) {
1665
+ runCommonAsserts(data, error);
1666
+ assert.equal('object', typeof data.response[0]);
1667
+ assert.equal('object', typeof data.response[1]);
1668
+ assert.equal('object', typeof data.response[2]);
1669
+ assert.equal('object', typeof data.response[3]);
1670
+ } else {
1671
+ runCommonAsserts(data, error);
1858
1672
  }
1859
- });
1860
- } catch (error) {
1861
- log.error(`Adapter Exception: ${error}`);
1862
- done(error);
1863
- }
1864
- } else {
1865
- log.error('getVnfSnapshots task is false, skipping test');
1866
- skipCount += 1;
1867
- done();
1868
- }// end if task
1673
+ saveMockData('VnfSnapshots', 'getVnfSnapshots', 'default', data);
1674
+ done();
1675
+ } catch (err) {
1676
+ log.error(`Test Failure: ${err}`);
1677
+ done(err);
1678
+ }
1679
+ });
1680
+ } catch (error) {
1681
+ log.error(`Adapter Exception: ${error}`);
1682
+ done(error);
1683
+ }
1869
1684
  }).timeout(attemptTimeout);
1870
1685
  });
1871
1686
 
1872
1687
  describe('#getVnfSnapshotsVnfSnapshotInfoId - errors', () => {
1873
1688
  it('should work if integrated or standalone with mockdata', (done) => {
1874
- if (pronghorn.methodsByName.getVnfSnapshotsVnfSnapshotInfoId.task) {
1875
- try {
1876
- a.getVnfSnapshotsVnfSnapshotInfoId('fakedata', (data, error) => {
1877
- try {
1878
- if (stub) {
1879
- runCommonAsserts(data, error);
1880
- assert.equal('string', data.response.id);
1881
- assert.equal('string', data.response.vnfSnapshotPkgId);
1882
- assert.equal('object', typeof data.response.vnfSnapshot);
1883
- assert.equal('object', typeof data.response._links);
1884
- } else {
1885
- runCommonAsserts(data, error);
1886
- }
1887
- saveMockData('VnfSnapshots', 'getVnfSnapshotsVnfSnapshotInfoId', 'default', data);
1888
- done();
1889
- } catch (err) {
1890
- log.error(`Test Failure: ${err}`);
1891
- done(err);
1689
+ try {
1690
+ a.getVnfSnapshotsVnfSnapshotInfoId('fakedata', (data, error) => {
1691
+ try {
1692
+ if (stub) {
1693
+ runCommonAsserts(data, error);
1694
+ assert.equal('string', data.response.id);
1695
+ assert.equal('string', data.response.vnfSnapshotPkgId);
1696
+ assert.equal('object', typeof data.response.vnfSnapshot);
1697
+ assert.equal('object', typeof data.response._links);
1698
+ } else {
1699
+ runCommonAsserts(data, error);
1892
1700
  }
1893
- });
1894
- } catch (error) {
1895
- log.error(`Adapter Exception: ${error}`);
1896
- done(error);
1897
- }
1898
- } else {
1899
- log.error('getVnfSnapshotsVnfSnapshotInfoId task is false, skipping test');
1900
- skipCount += 1;
1901
- done();
1902
- }// end if task
1701
+ saveMockData('VnfSnapshots', 'getVnfSnapshotsVnfSnapshotInfoId', 'default', data);
1702
+ done();
1703
+ } catch (err) {
1704
+ log.error(`Test Failure: ${err}`);
1705
+ done(err);
1706
+ }
1707
+ });
1708
+ } catch (error) {
1709
+ log.error(`Adapter Exception: ${error}`);
1710
+ done(error);
1711
+ }
1903
1712
  }).timeout(attemptTimeout);
1904
1713
  });
1905
1714
 
1906
1715
  describe('#deleteVnfSnapshotsVnfSnapshotInfoId - errors', () => {
1907
1716
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1908
- if (pronghorn.methodsByName.deleteVnfSnapshotsVnfSnapshotInfoId.task) {
1909
- try {
1910
- a.deleteVnfSnapshotsVnfSnapshotInfoId('fakedata', (data, error) => {
1911
- try {
1912
- if (stub) {
1913
- const displayE = 'Error 400 received on request';
1914
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1915
- } else {
1916
- runCommonAsserts(data, error);
1917
- }
1918
- saveMockData('VnfSnapshots', 'deleteVnfSnapshotsVnfSnapshotInfoId', 'default', data);
1919
- done();
1920
- } catch (err) {
1921
- log.error(`Test Failure: ${err}`);
1922
- done(err);
1717
+ try {
1718
+ a.deleteVnfSnapshotsVnfSnapshotInfoId('fakedata', (data, error) => {
1719
+ try {
1720
+ if (stub) {
1721
+ const displayE = 'Error 400 received on request';
1722
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1723
+ } else {
1724
+ runCommonAsserts(data, error);
1923
1725
  }
1924
- });
1925
- } catch (error) {
1926
- log.error(`Adapter Exception: ${error}`);
1927
- done(error);
1928
- }
1929
- } else {
1930
- log.error('deleteVnfSnapshotsVnfSnapshotInfoId task is false, skipping test');
1931
- skipCount += 1;
1932
- done();
1933
- }// end if task
1726
+ saveMockData('VnfSnapshots', 'deleteVnfSnapshotsVnfSnapshotInfoId', 'default', data);
1727
+ done();
1728
+ } catch (err) {
1729
+ log.error(`Test Failure: ${err}`);
1730
+ done(err);
1731
+ }
1732
+ });
1733
+ } catch (error) {
1734
+ log.error(`Adapter Exception: ${error}`);
1735
+ done(error);
1736
+ }
1934
1737
  }).timeout(attemptTimeout);
1935
1738
  });
1936
1739
 
1937
1740
  describe('#getPmJobs - errors', () => {
1938
1741
  it('should work if integrated or standalone with mockdata', (done) => {
1939
- if (pronghorn.methodsByName.getPmJobs.task) {
1940
- try {
1941
- a.getPmJobs(null, null, null, null, null, null, (data, error) => {
1942
- try {
1943
- if (stub) {
1944
- runCommonAsserts(data, error);
1945
- assert.equal('object', typeof data.response[0]);
1946
- assert.equal('object', typeof data.response[1]);
1947
- assert.equal('object', typeof data.response[2]);
1948
- assert.equal('object', typeof data.response[3]);
1949
- } else {
1950
- runCommonAsserts(data, error);
1951
- }
1952
- saveMockData('PmJobs', 'getPmJobs', 'default', data);
1953
- done();
1954
- } catch (err) {
1955
- log.error(`Test Failure: ${err}`);
1956
- done(err);
1742
+ try {
1743
+ a.getPmJobs(null, null, null, null, null, null, (data, error) => {
1744
+ try {
1745
+ if (stub) {
1746
+ runCommonAsserts(data, error);
1747
+ assert.equal('object', typeof data.response[0]);
1748
+ assert.equal('object', typeof data.response[1]);
1749
+ assert.equal('object', typeof data.response[2]);
1750
+ assert.equal('object', typeof data.response[3]);
1751
+ } else {
1752
+ runCommonAsserts(data, error);
1957
1753
  }
1958
- });
1959
- } catch (error) {
1960
- log.error(`Adapter Exception: ${error}`);
1961
- done(error);
1962
- }
1963
- } else {
1964
- log.error('getPmJobs task is false, skipping test');
1965
- skipCount += 1;
1966
- done();
1967
- }// end if task
1754
+ saveMockData('PmJobs', 'getPmJobs', 'default', data);
1755
+ done();
1756
+ } catch (err) {
1757
+ log.error(`Test Failure: ${err}`);
1758
+ done(err);
1759
+ }
1760
+ });
1761
+ } catch (error) {
1762
+ log.error(`Adapter Exception: ${error}`);
1763
+ done(error);
1764
+ }
1968
1765
  }).timeout(attemptTimeout);
1969
1766
  });
1970
1767
 
@@ -1978,108 +1775,90 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
1978
1775
  };
1979
1776
  describe('#postPmJobs - errors', () => {
1980
1777
  it('should work if integrated or standalone with mockdata', (done) => {
1981
- if (pronghorn.methodsByName.postPmJobs.task) {
1982
- try {
1983
- a.postPmJobs(pmJobsPostPmJobsBodyParam, (data, error) => {
1984
- try {
1985
- if (stub) {
1986
- runCommonAsserts(data, error);
1987
- assert.equal('string', data.response.id);
1988
- assert.equal('string', data.response.objectType);
1989
- assert.equal(true, Array.isArray(data.response.objectInstanceIds));
1990
- assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
1991
- assert.equal('object', typeof data.response.criteria);
1992
- assert.equal('string', data.response.callbackUri);
1993
- assert.equal('object', typeof data.response.reports);
1994
- assert.equal('object', typeof data.response._links);
1995
- } else {
1996
- runCommonAsserts(data, error);
1997
- }
1998
- saveMockData('PmJobs', 'postPmJobs', 'default', data);
1999
- done();
2000
- } catch (err) {
2001
- log.error(`Test Failure: ${err}`);
2002
- done(err);
1778
+ try {
1779
+ a.postPmJobs(pmJobsPostPmJobsBodyParam, (data, error) => {
1780
+ try {
1781
+ if (stub) {
1782
+ runCommonAsserts(data, error);
1783
+ assert.equal('string', data.response.id);
1784
+ assert.equal('string', data.response.objectType);
1785
+ assert.equal(true, Array.isArray(data.response.objectInstanceIds));
1786
+ assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
1787
+ assert.equal('object', typeof data.response.criteria);
1788
+ assert.equal('string', data.response.callbackUri);
1789
+ assert.equal('object', typeof data.response.reports);
1790
+ assert.equal('object', typeof data.response._links);
1791
+ } else {
1792
+ runCommonAsserts(data, error);
2003
1793
  }
2004
- });
2005
- } catch (error) {
2006
- log.error(`Adapter Exception: ${error}`);
2007
- done(error);
2008
- }
2009
- } else {
2010
- log.error('postPmJobs task is false, skipping test');
2011
- skipCount += 1;
2012
- done();
2013
- }// end if task
1794
+ saveMockData('PmJobs', 'postPmJobs', 'default', data);
1795
+ done();
1796
+ } catch (err) {
1797
+ log.error(`Test Failure: ${err}`);
1798
+ done(err);
1799
+ }
1800
+ });
1801
+ } catch (error) {
1802
+ log.error(`Adapter Exception: ${error}`);
1803
+ done(error);
1804
+ }
2014
1805
  }).timeout(attemptTimeout);
2015
1806
  });
2016
1807
 
2017
1808
  describe('#getPmJobsPmJobId - errors', () => {
2018
1809
  it('should work if integrated or standalone with mockdata', (done) => {
2019
- if (pronghorn.methodsByName.getPmJobsPmJobId.task) {
2020
- try {
2021
- a.getPmJobsPmJobId('fakedata', (data, error) => {
2022
- try {
2023
- if (stub) {
2024
- runCommonAsserts(data, error);
2025
- assert.equal('string', data.response.id);
2026
- assert.equal('string', data.response.objectType);
2027
- assert.equal(true, Array.isArray(data.response.objectInstanceIds));
2028
- assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
2029
- assert.equal('object', typeof data.response.criteria);
2030
- assert.equal('string', data.response.callbackUri);
2031
- assert.equal('object', typeof data.response.reports);
2032
- assert.equal('object', typeof data.response._links);
2033
- } else {
2034
- runCommonAsserts(data, error);
2035
- }
2036
- saveMockData('PmJobs', 'getPmJobsPmJobId', 'default', data);
2037
- done();
2038
- } catch (err) {
2039
- log.error(`Test Failure: ${err}`);
2040
- done(err);
1810
+ try {
1811
+ a.getPmJobsPmJobId('fakedata', (data, error) => {
1812
+ try {
1813
+ if (stub) {
1814
+ runCommonAsserts(data, error);
1815
+ assert.equal('string', data.response.id);
1816
+ assert.equal('string', data.response.objectType);
1817
+ assert.equal(true, Array.isArray(data.response.objectInstanceIds));
1818
+ assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
1819
+ assert.equal('object', typeof data.response.criteria);
1820
+ assert.equal('string', data.response.callbackUri);
1821
+ assert.equal('object', typeof data.response.reports);
1822
+ assert.equal('object', typeof data.response._links);
1823
+ } else {
1824
+ runCommonAsserts(data, error);
2041
1825
  }
2042
- });
2043
- } catch (error) {
2044
- log.error(`Adapter Exception: ${error}`);
2045
- done(error);
2046
- }
2047
- } else {
2048
- log.error('getPmJobsPmJobId task is false, skipping test');
2049
- skipCount += 1;
2050
- done();
2051
- }// end if task
1826
+ saveMockData('PmJobs', 'getPmJobsPmJobId', 'default', data);
1827
+ done();
1828
+ } catch (err) {
1829
+ log.error(`Test Failure: ${err}`);
1830
+ done(err);
1831
+ }
1832
+ });
1833
+ } catch (error) {
1834
+ log.error(`Adapter Exception: ${error}`);
1835
+ done(error);
1836
+ }
2052
1837
  }).timeout(attemptTimeout);
2053
1838
  });
2054
1839
 
2055
1840
  describe('#deletePmJobsPmJobId - errors', () => {
2056
1841
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2057
- if (pronghorn.methodsByName.deletePmJobsPmJobId.task) {
2058
- try {
2059
- a.deletePmJobsPmJobId('fakedata', (data, error) => {
2060
- try {
2061
- if (stub) {
2062
- const displayE = 'Error 400 received on request';
2063
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
2064
- } else {
2065
- runCommonAsserts(data, error);
2066
- }
2067
- saveMockData('PmJobs', 'deletePmJobsPmJobId', 'default', data);
2068
- done();
2069
- } catch (err) {
2070
- log.error(`Test Failure: ${err}`);
2071
- done(err);
1842
+ try {
1843
+ a.deletePmJobsPmJobId('fakedata', (data, error) => {
1844
+ try {
1845
+ if (stub) {
1846
+ const displayE = 'Error 400 received on request';
1847
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
1848
+ } else {
1849
+ runCommonAsserts(data, error);
2072
1850
  }
2073
- });
2074
- } catch (error) {
2075
- log.error(`Adapter Exception: ${error}`);
2076
- done(error);
2077
- }
2078
- } else {
2079
- log.error('deletePmJobsPmJobId task is false, skipping test');
2080
- skipCount += 1;
2081
- done();
2082
- }// end if task
1851
+ saveMockData('PmJobs', 'deletePmJobsPmJobId', 'default', data);
1852
+ done();
1853
+ } catch (err) {
1854
+ log.error(`Test Failure: ${err}`);
1855
+ done(err);
1856
+ }
1857
+ });
1858
+ } catch (error) {
1859
+ log.error(`Adapter Exception: ${error}`);
1860
+ done(error);
1861
+ }
2083
1862
  }).timeout(attemptTimeout);
2084
1863
  });
2085
1864
 
@@ -2102,94 +1881,76 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
2102
1881
  };
2103
1882
  describe('#patchPmJobsPmJobId - errors', () => {
2104
1883
  it('should work if integrated or standalone with mockdata', (done) => {
2105
- if (pronghorn.methodsByName.patchPmJobsPmJobId.task) {
2106
- try {
2107
- a.patchPmJobsPmJobId('fakedata', pmJobsPatchPmJobsPmJobIdBodyParam, (data, error) => {
2108
- try {
2109
- if (stub) {
2110
- runCommonAsserts(data, error);
2111
- assert.equal('success', data.response);
2112
- } else {
2113
- runCommonAsserts(data, error);
2114
- }
2115
- saveMockData('PmJobs', 'patchPmJobsPmJobId', 'default', data);
2116
- done();
2117
- } catch (err) {
2118
- log.error(`Test Failure: ${err}`);
2119
- done(err);
1884
+ try {
1885
+ a.patchPmJobsPmJobId('fakedata', pmJobsPatchPmJobsPmJobIdBodyParam, (data, error) => {
1886
+ try {
1887
+ if (stub) {
1888
+ runCommonAsserts(data, error);
1889
+ assert.equal('success', data.response);
1890
+ } else {
1891
+ runCommonAsserts(data, error);
2120
1892
  }
2121
- });
2122
- } catch (error) {
2123
- log.error(`Adapter Exception: ${error}`);
2124
- done(error);
2125
- }
2126
- } else {
2127
- log.error('patchPmJobsPmJobId task is false, skipping test');
2128
- skipCount += 1;
2129
- done();
2130
- }// end if task
1893
+ saveMockData('PmJobs', 'patchPmJobsPmJobId', 'default', data);
1894
+ done();
1895
+ } catch (err) {
1896
+ log.error(`Test Failure: ${err}`);
1897
+ done(err);
1898
+ }
1899
+ });
1900
+ } catch (error) {
1901
+ log.error(`Adapter Exception: ${error}`);
1902
+ done(error);
1903
+ }
2131
1904
  }).timeout(attemptTimeout);
2132
1905
  });
2133
1906
 
2134
1907
  describe('#getPmJobsPmJobIdReportsReportId - errors', () => {
2135
1908
  it('should work if integrated or standalone with mockdata', (done) => {
2136
- if (pronghorn.methodsByName.getPmJobsPmJobIdReportsReportId.task) {
2137
- try {
2138
- a.getPmJobsPmJobIdReportsReportId('fakedata', 'fakedata', (data, error) => {
2139
- try {
2140
- if (stub) {
2141
- runCommonAsserts(data, error);
2142
- assert.equal(true, Array.isArray(data.response.entries));
2143
- } else {
2144
- runCommonAsserts(data, error);
2145
- }
2146
- saveMockData('PmJobs', 'getPmJobsPmJobIdReportsReportId', 'default', data);
2147
- done();
2148
- } catch (err) {
2149
- log.error(`Test Failure: ${err}`);
2150
- done(err);
1909
+ try {
1910
+ a.getPmJobsPmJobIdReportsReportId('fakedata', 'fakedata', (data, error) => {
1911
+ try {
1912
+ if (stub) {
1913
+ runCommonAsserts(data, error);
1914
+ assert.equal(true, Array.isArray(data.response.entries));
1915
+ } else {
1916
+ runCommonAsserts(data, error);
2151
1917
  }
2152
- });
2153
- } catch (error) {
2154
- log.error(`Adapter Exception: ${error}`);
2155
- done(error);
2156
- }
2157
- } else {
2158
- log.error('getPmJobsPmJobIdReportsReportId task is false, skipping test');
2159
- skipCount += 1;
2160
- done();
2161
- }// end if task
1918
+ saveMockData('PmJobs', 'getPmJobsPmJobIdReportsReportId', 'default', data);
1919
+ done();
1920
+ } catch (err) {
1921
+ log.error(`Test Failure: ${err}`);
1922
+ done(err);
1923
+ }
1924
+ });
1925
+ } catch (error) {
1926
+ log.error(`Adapter Exception: ${error}`);
1927
+ done(error);
1928
+ }
2162
1929
  }).timeout(attemptTimeout);
2163
1930
  });
2164
1931
 
2165
1932
  describe('#getThresholds - errors', () => {
2166
1933
  it('should work if integrated or standalone with mockdata', (done) => {
2167
- if (pronghorn.methodsByName.getThresholds.task) {
2168
- try {
2169
- a.getThresholds(null, null, (data, error) => {
2170
- try {
2171
- if (stub) {
2172
- runCommonAsserts(data, error);
2173
- assert.equal('object', typeof data.response[0]);
2174
- } else {
2175
- runCommonAsserts(data, error);
2176
- }
2177
- saveMockData('Thresholds', 'getThresholds', 'default', data);
2178
- done();
2179
- } catch (err) {
2180
- log.error(`Test Failure: ${err}`);
2181
- done(err);
1934
+ try {
1935
+ a.getThresholds(null, null, (data, error) => {
1936
+ try {
1937
+ if (stub) {
1938
+ runCommonAsserts(data, error);
1939
+ assert.equal('object', typeof data.response[0]);
1940
+ } else {
1941
+ runCommonAsserts(data, error);
2182
1942
  }
2183
- });
2184
- } catch (error) {
2185
- log.error(`Adapter Exception: ${error}`);
2186
- done(error);
2187
- }
2188
- } else {
2189
- log.error('getThresholds task is false, skipping test');
2190
- skipCount += 1;
2191
- done();
2192
- }// end if task
1943
+ saveMockData('Thresholds', 'getThresholds', 'default', data);
1944
+ done();
1945
+ } catch (err) {
1946
+ log.error(`Test Failure: ${err}`);
1947
+ done(err);
1948
+ }
1949
+ });
1950
+ } catch (error) {
1951
+ log.error(`Adapter Exception: ${error}`);
1952
+ done(error);
1953
+ }
2193
1954
  }).timeout(attemptTimeout);
2194
1955
  });
2195
1956
 
@@ -2201,106 +1962,88 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
2201
1962
  };
2202
1963
  describe('#postThresholds - errors', () => {
2203
1964
  it('should work if integrated or standalone with mockdata', (done) => {
2204
- if (pronghorn.methodsByName.postThresholds.task) {
2205
- try {
2206
- a.postThresholds(thresholdsPostThresholdsBodyParam, (data, error) => {
2207
- try {
2208
- if (stub) {
2209
- runCommonAsserts(data, error);
2210
- assert.equal('string', data.response.id);
2211
- assert.equal('string', data.response.objectType);
2212
- assert.equal('string', data.response.objectInstanceId);
2213
- assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
2214
- assert.equal('object', typeof data.response.criteria);
2215
- assert.equal('string', data.response.callbackUri);
2216
- assert.equal('object', typeof data.response._links);
2217
- } else {
2218
- runCommonAsserts(data, error);
2219
- }
2220
- saveMockData('Thresholds', 'postThresholds', 'default', data);
2221
- done();
2222
- } catch (err) {
2223
- log.error(`Test Failure: ${err}`);
2224
- done(err);
1965
+ try {
1966
+ a.postThresholds(thresholdsPostThresholdsBodyParam, (data, error) => {
1967
+ try {
1968
+ if (stub) {
1969
+ runCommonAsserts(data, error);
1970
+ assert.equal('string', data.response.id);
1971
+ assert.equal('string', data.response.objectType);
1972
+ assert.equal('string', data.response.objectInstanceId);
1973
+ assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
1974
+ assert.equal('object', typeof data.response.criteria);
1975
+ assert.equal('string', data.response.callbackUri);
1976
+ assert.equal('object', typeof data.response._links);
1977
+ } else {
1978
+ runCommonAsserts(data, error);
2225
1979
  }
2226
- });
2227
- } catch (error) {
2228
- log.error(`Adapter Exception: ${error}`);
2229
- done(error);
2230
- }
2231
- } else {
2232
- log.error('postThresholds task is false, skipping test');
2233
- skipCount += 1;
2234
- done();
2235
- }// end if task
1980
+ saveMockData('Thresholds', 'postThresholds', 'default', data);
1981
+ done();
1982
+ } catch (err) {
1983
+ log.error(`Test Failure: ${err}`);
1984
+ done(err);
1985
+ }
1986
+ });
1987
+ } catch (error) {
1988
+ log.error(`Adapter Exception: ${error}`);
1989
+ done(error);
1990
+ }
2236
1991
  }).timeout(attemptTimeout);
2237
1992
  });
2238
1993
 
2239
1994
  describe('#getThresholdsThresholdId - errors', () => {
2240
1995
  it('should work if integrated or standalone with mockdata', (done) => {
2241
- if (pronghorn.methodsByName.getThresholdsThresholdId.task) {
2242
- try {
2243
- a.getThresholdsThresholdId('fakedata', (data, error) => {
2244
- try {
2245
- if (stub) {
2246
- runCommonAsserts(data, error);
2247
- assert.equal('string', data.response.id);
2248
- assert.equal('string', data.response.objectType);
2249
- assert.equal('string', data.response.objectInstanceId);
2250
- assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
2251
- assert.equal('object', typeof data.response.criteria);
2252
- assert.equal('string', data.response.callbackUri);
2253
- assert.equal('object', typeof data.response._links);
2254
- } else {
2255
- runCommonAsserts(data, error);
2256
- }
2257
- saveMockData('Thresholds', 'getThresholdsThresholdId', 'default', data);
2258
- done();
2259
- } catch (err) {
2260
- log.error(`Test Failure: ${err}`);
2261
- done(err);
1996
+ try {
1997
+ a.getThresholdsThresholdId('fakedata', (data, error) => {
1998
+ try {
1999
+ if (stub) {
2000
+ runCommonAsserts(data, error);
2001
+ assert.equal('string', data.response.id);
2002
+ assert.equal('string', data.response.objectType);
2003
+ assert.equal('string', data.response.objectInstanceId);
2004
+ assert.equal(true, Array.isArray(data.response.subObjectInstanceIds));
2005
+ assert.equal('object', typeof data.response.criteria);
2006
+ assert.equal('string', data.response.callbackUri);
2007
+ assert.equal('object', typeof data.response._links);
2008
+ } else {
2009
+ runCommonAsserts(data, error);
2262
2010
  }
2263
- });
2264
- } catch (error) {
2265
- log.error(`Adapter Exception: ${error}`);
2266
- done(error);
2267
- }
2268
- } else {
2269
- log.error('getThresholdsThresholdId task is false, skipping test');
2270
- skipCount += 1;
2271
- done();
2272
- }// end if task
2011
+ saveMockData('Thresholds', 'getThresholdsThresholdId', 'default', data);
2012
+ done();
2013
+ } catch (err) {
2014
+ log.error(`Test Failure: ${err}`);
2015
+ done(err);
2016
+ }
2017
+ });
2018
+ } catch (error) {
2019
+ log.error(`Adapter Exception: ${error}`);
2020
+ done(error);
2021
+ }
2273
2022
  }).timeout(attemptTimeout);
2274
2023
  });
2275
2024
 
2276
2025
  describe('#deleteThresholdsThresholdId - errors', () => {
2277
2026
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2278
- if (pronghorn.methodsByName.deleteThresholdsThresholdId.task) {
2279
- try {
2280
- a.deleteThresholdsThresholdId('fakedata', (data, error) => {
2281
- try {
2282
- if (stub) {
2283
- const displayE = 'Error 400 received on request';
2284
- runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
2285
- } else {
2286
- runCommonAsserts(data, error);
2287
- }
2288
- saveMockData('Thresholds', 'deleteThresholdsThresholdId', 'default', data);
2289
- done();
2290
- } catch (err) {
2291
- log.error(`Test Failure: ${err}`);
2292
- done(err);
2027
+ try {
2028
+ a.deleteThresholdsThresholdId('fakedata', (data, error) => {
2029
+ try {
2030
+ if (stub) {
2031
+ const displayE = 'Error 400 received on request';
2032
+ runErrorAsserts(data, error, 'AD.500', 'Test-etsi_sol002-connectorRest-handleEndResponse', displayE);
2033
+ } else {
2034
+ runCommonAsserts(data, error);
2293
2035
  }
2294
- });
2295
- } catch (error) {
2296
- log.error(`Adapter Exception: ${error}`);
2297
- done(error);
2298
- }
2299
- } else {
2300
- log.error('deleteThresholdsThresholdId task is false, skipping test');
2301
- skipCount += 1;
2302
- done();
2303
- }// end if task
2036
+ saveMockData('Thresholds', 'deleteThresholdsThresholdId', 'default', data);
2037
+ done();
2038
+ } catch (err) {
2039
+ log.error(`Test Failure: ${err}`);
2040
+ done(err);
2041
+ }
2042
+ });
2043
+ } catch (error) {
2044
+ log.error(`Adapter Exception: ${error}`);
2045
+ done(error);
2046
+ }
2304
2047
  }).timeout(attemptTimeout);
2305
2048
  });
2306
2049
 
@@ -2323,40 +2066,27 @@ describe('[integration] Etsi_sol002 Adapter Test', () => {
2323
2066
  };
2324
2067
  describe('#patchThresholdsThresholdId - errors', () => {
2325
2068
  it('should work if integrated or standalone with mockdata', (done) => {
2326
- if (pronghorn.methodsByName.patchThresholdsThresholdId.task) {
2327
- try {
2328
- a.patchThresholdsThresholdId('fakedata', thresholdsPatchThresholdsThresholdIdBodyParam, (data, error) => {
2329
- try {
2330
- if (stub) {
2331
- runCommonAsserts(data, error);
2332
- assert.equal('success', data.response);
2333
- } else {
2334
- runCommonAsserts(data, error);
2335
- }
2336
- saveMockData('Thresholds', 'patchThresholdsThresholdId', 'default', data);
2337
- done();
2338
- } catch (err) {
2339
- log.error(`Test Failure: ${err}`);
2340
- done(err);
2069
+ try {
2070
+ a.patchThresholdsThresholdId('fakedata', thresholdsPatchThresholdsThresholdIdBodyParam, (data, error) => {
2071
+ try {
2072
+ if (stub) {
2073
+ runCommonAsserts(data, error);
2074
+ assert.equal('success', data.response);
2075
+ } else {
2076
+ runCommonAsserts(data, error);
2341
2077
  }
2342
- });
2343
- } catch (error) {
2344
- log.error(`Adapter Exception: ${error}`);
2345
- done(error);
2346
- }
2347
- } else {
2348
- log.error('patchThresholdsThresholdId task is false, skipping test');
2349
- skipCount += 1;
2350
- done();
2351
- }// end if task
2078
+ saveMockData('Thresholds', 'patchThresholdsThresholdId', 'default', data);
2079
+ done();
2080
+ } catch (err) {
2081
+ log.error(`Test Failure: ${err}`);
2082
+ done(err);
2083
+ }
2084
+ });
2085
+ } catch (error) {
2086
+ log.error(`Adapter Exception: ${error}`);
2087
+ done(error);
2088
+ }
2352
2089
  }).timeout(attemptTimeout);
2353
2090
  });
2354
-
2355
- describe('#Skipped test count', () => {
2356
- it('count skipped tests', (done) => {
2357
- console.log(`skipped ${skipCount} tests because \x1b[33mtask: false\x1b[0m`);
2358
- done();
2359
- });
2360
- });
2361
2091
  });
2362
2092
  });