@itentialopensource/adapter-dna_center 0.5.4 → 0.5.7
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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +12 -12
- package/CHANGELOG.md +24 -0
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +247 -0
- package/README.md +151 -379
- package/SUMMARY.md +9 -0
- package/TROUBLESHOOT.md +46 -0
- package/adapter.js +2212 -85
- package/adapterBase.js +848 -50
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +1 -1
- package/entities/Sites/action.json +42 -0
- package/entities/Sites/schema.json +2 -0
- package/error.json +12 -0
- package/package.json +45 -23
- package/pronghorn.json +780 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +451 -11
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1594147160686.json +95 -0
- package/report/updateReport1614887797185.json +95 -0
- package/report/updateReport1651598418513.json +114 -0
- package/sampleProperties.json +20 -5
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +87 -11
- package/test/unit/adapterBaseTestUnit.js +947 -0
- package/test/unit/adapterTestUnit.js +794 -18
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +9 -14
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +224 -0
- package/utils/findPath.js +74 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +1 -1
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +464 -0
- package/utils/troubleshootingAdapter.js +190 -0
- package/gl-code-quality-report.json +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 29
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 12
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 7
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 21
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^4.39.1"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 61
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "readmeMd",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 615
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "unitTestJS",
|
|
51
|
+
"description": "Number of lines of code in unit tests",
|
|
52
|
+
"value": 6506
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "unitTestJS",
|
|
56
|
+
"description": "Number of unit tests",
|
|
57
|
+
"value": 417
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "integrationTestJS",
|
|
61
|
+
"description": "Number of lines of code in integration tests",
|
|
62
|
+
"value": 5373
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "integrationTestJS",
|
|
66
|
+
"description": "Number of integration tests",
|
|
67
|
+
"value": 174
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "staticFile",
|
|
71
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
72
|
+
"value": 1007
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "staticFile",
|
|
76
|
+
"description": "Number of static files added",
|
|
77
|
+
"value": 30
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "Overall",
|
|
81
|
+
"description": "Total lines of Code",
|
|
82
|
+
"value": 12886
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "Overall",
|
|
86
|
+
"description": "Total Tests",
|
|
87
|
+
"value": 591
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "Overall",
|
|
91
|
+
"description": "Total Files",
|
|
92
|
+
"value": 6
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [
|
|
3
|
+
{
|
|
4
|
+
"propertiesSchemaJson": "propertiesSchema.json owner reporting - Create propertiesSchema caught: TypeError: Cannot read property 'properties' of undefined"
|
|
5
|
+
}
|
|
6
|
+
],
|
|
7
|
+
"statistics": [
|
|
8
|
+
{
|
|
9
|
+
"owner": "errorJson",
|
|
10
|
+
"description": "New adapter errors available for use",
|
|
11
|
+
"value": 0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"owner": "errorJson",
|
|
15
|
+
"description": "Adapter errors no longer available for use",
|
|
16
|
+
"value": 0
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"owner": "errorJson",
|
|
20
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
21
|
+
"value": 31
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"owner": "packageJson",
|
|
25
|
+
"description": "Number of production dependencies",
|
|
26
|
+
"value": 13
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"owner": "packageJson",
|
|
30
|
+
"description": "Number of development dependencies",
|
|
31
|
+
"value": 7
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"owner": "packageJson",
|
|
35
|
+
"description": "Number of npm scripts",
|
|
36
|
+
"value": 23
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"owner": "packageJson",
|
|
40
|
+
"description": "Runtime Library dependency",
|
|
41
|
+
"value": "^4.45.4"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"owner": "markdown",
|
|
45
|
+
"description": "Number of lines in the README.md",
|
|
46
|
+
"value": 258
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"owner": "markdown",
|
|
50
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
51
|
+
"value": 9
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"owner": "markdown",
|
|
55
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
56
|
+
"value": 248
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"owner": "markdown",
|
|
60
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
61
|
+
"value": 47
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"owner": "markdown",
|
|
65
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
66
|
+
"value": 70
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"owner": "unitTestJS",
|
|
70
|
+
"description": "Number of lines of code in unit tests",
|
|
71
|
+
"value": 7130
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"owner": "unitTestJS",
|
|
75
|
+
"description": "Number of unit tests",
|
|
76
|
+
"value": 443
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"owner": "integrationTestJS",
|
|
80
|
+
"description": "Number of lines of code in integration tests",
|
|
81
|
+
"value": 5384
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"owner": "integrationTestJS",
|
|
85
|
+
"description": "Number of integration tests",
|
|
86
|
+
"value": 174
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"owner": "staticFile",
|
|
90
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
91
|
+
"value": 1300
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"owner": "staticFile",
|
|
95
|
+
"description": "Number of static files added",
|
|
96
|
+
"value": 35
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"owner": "Overall",
|
|
100
|
+
"description": "Total lines of Code",
|
|
101
|
+
"value": 13814
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"owner": "Overall",
|
|
105
|
+
"description": "Total Tests",
|
|
106
|
+
"value": 617
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"owner": "Overall",
|
|
110
|
+
"description": "Total Files",
|
|
111
|
+
"value": 6
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"base_path": "/dna/intent/api",
|
|
8
8
|
"version": "v1",
|
|
9
9
|
"cache_location": "none",
|
|
10
|
+
"encode_pathvars": true,
|
|
10
11
|
"save_metric": true,
|
|
11
12
|
"stub": true,
|
|
12
13
|
"protocol": "https",
|
|
@@ -19,11 +20,16 @@
|
|
|
19
20
|
"token_cache": "local",
|
|
20
21
|
"invalid_token_error": 401,
|
|
21
22
|
"auth_field": "header.headers.X-Auth-Token",
|
|
22
|
-
"auth_field_format": "{token}"
|
|
23
|
+
"auth_field_format": "{token}",
|
|
24
|
+
"auth_logging": false,
|
|
25
|
+
"client_id": "",
|
|
26
|
+
"client_secret": "",
|
|
27
|
+
"grant_type": ""
|
|
23
28
|
},
|
|
24
29
|
"healthcheck": {
|
|
25
30
|
"type": "none",
|
|
26
|
-
"frequency": 60000
|
|
31
|
+
"frequency": 60000,
|
|
32
|
+
"query_object": {}
|
|
27
33
|
},
|
|
28
34
|
"throttle": {
|
|
29
35
|
"throttle_enabled": false,
|
|
@@ -32,7 +38,13 @@
|
|
|
32
38
|
"max_in_queue": 1000,
|
|
33
39
|
"concurrent_max": 1,
|
|
34
40
|
"expire_timeout": 0,
|
|
35
|
-
"avg_runtime": 200
|
|
41
|
+
"avg_runtime": 200,
|
|
42
|
+
"priorities": [
|
|
43
|
+
{
|
|
44
|
+
"value": 0,
|
|
45
|
+
"percent": 100
|
|
46
|
+
}
|
|
47
|
+
]
|
|
36
48
|
},
|
|
37
49
|
"request": {
|
|
38
50
|
"number_redirects": 0,
|
|
@@ -48,13 +60,16 @@
|
|
|
48
60
|
},
|
|
49
61
|
"healthcheck_on_timeout": false,
|
|
50
62
|
"return_raw": false,
|
|
51
|
-
"archiving": false
|
|
63
|
+
"archiving": false,
|
|
64
|
+
"return_request": false
|
|
52
65
|
},
|
|
53
66
|
"proxy": {
|
|
54
67
|
"enabled": false,
|
|
55
68
|
"host": "",
|
|
56
69
|
"port": 1,
|
|
57
|
-
"protocol": "http"
|
|
70
|
+
"protocol": "http",
|
|
71
|
+
"username": "",
|
|
72
|
+
"password": ""
|
|
58
73
|
},
|
|
59
74
|
"ssl": {
|
|
60
75
|
"ecdhCurve": "",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe context before after */
|
|
4
|
+
/* eslint global-require: warn */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint import/no-extraneous-dependencies: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require: warn */
|
|
8
|
+
/* eslint import/no-unresolved: warn */
|
|
9
|
+
|
|
10
|
+
const mocha = require('mocha');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const assert = require('assert');
|
|
13
|
+
const itParam = require('mocha-param');
|
|
14
|
+
|
|
15
|
+
const utils = require('../../utils/tbUtils');
|
|
16
|
+
const basicGet = require('../../utils/basicGet');
|
|
17
|
+
const { name } = require('../../package.json');
|
|
18
|
+
const { methods } = require('../../pronghorn.json');
|
|
19
|
+
|
|
20
|
+
const getPronghornProps = (iapDir) => {
|
|
21
|
+
const { Discovery } = require('@itential/itential-utils');
|
|
22
|
+
console.log('Retrieving properties.json file...');
|
|
23
|
+
const rawProps = require(path.join(iapDir, 'properties.json'));
|
|
24
|
+
console.log('Decrypting properties...');
|
|
25
|
+
const discovery = new Discovery();
|
|
26
|
+
const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
|
|
27
|
+
console.log('Found properties.\n');
|
|
28
|
+
return pronghornProps;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let a;
|
|
32
|
+
|
|
33
|
+
describe('[integration] Adapter BasicGET Test', () => {
|
|
34
|
+
context('Testing GET calls without query parameters', () => {
|
|
35
|
+
before(async () => {
|
|
36
|
+
const iapDir = path.join(__dirname, '../../../../../');
|
|
37
|
+
if (!utils.withinIAP(iapDir)) {
|
|
38
|
+
const sampleProperties = require('../../sampleProperties.json');
|
|
39
|
+
const adapter = { properties: sampleProperties };
|
|
40
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
41
|
+
} else {
|
|
42
|
+
const pronghornProps = getPronghornProps(iapDir);
|
|
43
|
+
console.log('Connecting to Database...');
|
|
44
|
+
const database = await basicGet.connect(pronghornProps);
|
|
45
|
+
console.log('Connection established.');
|
|
46
|
+
const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
|
|
47
|
+
{ model: name }
|
|
48
|
+
);
|
|
49
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
after((done) => {
|
|
54
|
+
done();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
|
|
58
|
+
if (basicGets.length === 0) {
|
|
59
|
+
console.log('No non-parameter GET calls found.');
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
const functionNames = basicGets.map((g) => g.name);
|
|
63
|
+
const request = function request(f, ad) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const getRespCode = (resp) => {
|
|
66
|
+
if (resp) {
|
|
67
|
+
if (resp.metrics.code !== 200) {
|
|
68
|
+
console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
|
|
69
|
+
}
|
|
70
|
+
resolve(resp.metrics.code);
|
|
71
|
+
} else {
|
|
72
|
+
console.log('\x1b[31m', `call ${f} results in failure`);
|
|
73
|
+
reject(new Error(`${f} failed`));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ad[f](getRespCode, console.log);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
itParam('GET call should return 200', functionNames, (fname) => {
|
|
81
|
+
console.log(`\t ${fname}`);
|
|
82
|
+
return request(fname, a).then((result) => assert.equal(result, 200));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe it context before after */
|
|
4
|
+
/* eslint no-unused-vars: warn */
|
|
5
|
+
|
|
6
|
+
const mocha = require('mocha');
|
|
7
|
+
const assert = require('assert');
|
|
8
|
+
const diagnostics = require('network-diagnostics');
|
|
9
|
+
|
|
10
|
+
let host;
|
|
11
|
+
process.argv.forEach((val) => {
|
|
12
|
+
if (val.indexOf('--HOST') === 0) {
|
|
13
|
+
[, host] = val.split('=');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('[integration] Adapter Test', () => {
|
|
18
|
+
context(`Testing network connection on ${host}`, () => {
|
|
19
|
+
before(() => {
|
|
20
|
+
diagnostics.setTestURL(host);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
after((done) => {
|
|
24
|
+
done();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('DNS resolve', (done) => {
|
|
28
|
+
diagnostics.haveDNS((result) => {
|
|
29
|
+
try {
|
|
30
|
+
assert.equal(result, true);
|
|
31
|
+
done();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
done(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('Responds to ping', (done) => {
|
|
39
|
+
diagnostics.havePing((result) => {
|
|
40
|
+
try {
|
|
41
|
+
assert.equal(result, true);
|
|
42
|
+
done();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
done(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('Support HTTP on port 80', (done) => {
|
|
50
|
+
diagnostics.haveHTTP((result) => {
|
|
51
|
+
try {
|
|
52
|
+
assert.equal(result, true);
|
|
53
|
+
done();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
done(error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('Support HTTPS on port 443', (done) => {
|
|
61
|
+
diagnostics.haveHTTPS((result) => {
|
|
62
|
+
try {
|
|
63
|
+
assert.equal(result, true);
|
|
64
|
+
done();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
done(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Support IPv4', (done) => {
|
|
72
|
+
diagnostics.haveIPv4Async((result) => {
|
|
73
|
+
try {
|
|
74
|
+
assert.equal(result, true);
|
|
75
|
+
done();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
done(error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('Support IPv6', (done) => {
|
|
83
|
+
diagnostics.haveIPv6Async((result) => {
|
|
84
|
+
try {
|
|
85
|
+
assert.equal(result, true);
|
|
86
|
+
done();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
done(error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -3,6 +3,7 @@
|
|
|
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
7
|
|
|
7
8
|
// include required items for testing & logging
|
|
8
9
|
const assert = require('assert');
|
|
@@ -13,7 +14,10 @@ const winston = require('winston');
|
|
|
13
14
|
const { expect } = require('chai');
|
|
14
15
|
const { use } = require('chai');
|
|
15
16
|
const td = require('testdouble');
|
|
17
|
+
const util = require('util');
|
|
18
|
+
const pronghorn = require('../../pronghorn.json');
|
|
16
19
|
|
|
20
|
+
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
17
21
|
const anything = td.matchers.anything();
|
|
18
22
|
|
|
19
23
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
@@ -49,6 +53,7 @@ global.pronghornProps = {
|
|
|
49
53
|
base_path: '',
|
|
50
54
|
version: '',
|
|
51
55
|
cache_location: '',
|
|
56
|
+
encode_pathvars: true,
|
|
52
57
|
save_metric: false,
|
|
53
58
|
protocol,
|
|
54
59
|
stub,
|
|
@@ -61,11 +66,16 @@ global.pronghornProps = {
|
|
|
61
66
|
token_cache: 'local',
|
|
62
67
|
invalid_token_error: 401,
|
|
63
68
|
auth_field: 'header.headers.Authorization',
|
|
64
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
|
|
69
|
+
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
70
|
+
auth_logging: false,
|
|
71
|
+
client_id: '',
|
|
72
|
+
client_secret: '',
|
|
73
|
+
grant_type: ''
|
|
65
74
|
},
|
|
66
75
|
healthcheck: {
|
|
67
76
|
type: 'startup',
|
|
68
|
-
frequency: 60000
|
|
77
|
+
frequency: 60000,
|
|
78
|
+
query_object: {}
|
|
69
79
|
},
|
|
70
80
|
throttle: {
|
|
71
81
|
throttle_enabled: false,
|
|
@@ -74,7 +84,13 @@ global.pronghornProps = {
|
|
|
74
84
|
max_in_queue: 1000,
|
|
75
85
|
concurrent_max: 1,
|
|
76
86
|
expire_timeout: 0,
|
|
77
|
-
avg_runtime: 200
|
|
87
|
+
avg_runtime: 200,
|
|
88
|
+
priorities: [
|
|
89
|
+
{
|
|
90
|
+
value: 0,
|
|
91
|
+
percent: 100
|
|
92
|
+
}
|
|
93
|
+
]
|
|
78
94
|
},
|
|
79
95
|
request: {
|
|
80
96
|
number_redirects: 0,
|
|
@@ -90,13 +106,16 @@ global.pronghornProps = {
|
|
|
90
106
|
},
|
|
91
107
|
healthcheck_on_timeout: false,
|
|
92
108
|
return_raw: true,
|
|
93
|
-
archiving: false
|
|
109
|
+
archiving: false,
|
|
110
|
+
return_request: false
|
|
94
111
|
},
|
|
95
112
|
proxy: {
|
|
96
113
|
enabled: false,
|
|
97
114
|
host: '',
|
|
98
115
|
port: 1,
|
|
99
|
-
protocol: 'http'
|
|
116
|
+
protocol: 'http',
|
|
117
|
+
username: '',
|
|
118
|
+
password: ''
|
|
100
119
|
},
|
|
101
120
|
ssl: {
|
|
102
121
|
ecdhCurve: '',
|
|
@@ -159,7 +178,7 @@ process.argv.forEach((val) => {
|
|
|
159
178
|
});
|
|
160
179
|
|
|
161
180
|
// need to set global logging
|
|
162
|
-
global.log =
|
|
181
|
+
global.log = winston.createLogger({
|
|
163
182
|
level: logLevel,
|
|
164
183
|
levels: myCustomLevels.levels,
|
|
165
184
|
transports: [
|
|
@@ -253,7 +272,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
253
272
|
};
|
|
254
273
|
|
|
255
274
|
// get the object for method we're trying to change.
|
|
256
|
-
const currentMethodAction = parsedJson.actions.find(obj => obj.name === actionName);
|
|
275
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
257
276
|
|
|
258
277
|
// if the method was not found - should never happen but...
|
|
259
278
|
if (!currentMethodAction) {
|
|
@@ -261,12 +280,12 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
261
280
|
}
|
|
262
281
|
|
|
263
282
|
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
264
|
-
const actionResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === descriptor);
|
|
283
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
265
284
|
|
|
266
285
|
// Add the action responseObj back into the array of response objects.
|
|
267
286
|
if (!actionResponseObj) {
|
|
268
287
|
// if there is a default response object, we want to get the key.
|
|
269
|
-
const defaultResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === 'default');
|
|
288
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
270
289
|
|
|
271
290
|
// save the default key into the new response object
|
|
272
291
|
if (defaultResponseObj) {
|
|
@@ -297,9 +316,8 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
297
316
|
return false;
|
|
298
317
|
}
|
|
299
318
|
|
|
300
|
-
|
|
301
319
|
// require the adapter that we are going to be using
|
|
302
|
-
const DnaCenter = require('../../adapter
|
|
320
|
+
const DnaCenter = require('../../adapter');
|
|
303
321
|
|
|
304
322
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
305
323
|
describe('[integration] Dna_center Adapter Test', () => {
|
|
@@ -330,6 +348,8 @@ describe('[integration] Dna_center Adapter Test', () => {
|
|
|
330
348
|
try {
|
|
331
349
|
assert.notEqual(null, a);
|
|
332
350
|
assert.notEqual(undefined, a);
|
|
351
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
352
|
+
assert.equal(checkId, a.id);
|
|
333
353
|
assert.notEqual(null, a.allProps);
|
|
334
354
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
335
355
|
assert.equal(check, a.healthcheckType);
|
|
@@ -2167,6 +2187,62 @@ describe('[integration] Dna_center Adapter Test', () => {
|
|
|
2167
2187
|
}).timeout(attemptTimeout);
|
|
2168
2188
|
});
|
|
2169
2189
|
|
|
2190
|
+
describe('#postDnasystemapiv1sitesiteIddevice - errors', () => {
|
|
2191
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2192
|
+
try {
|
|
2193
|
+
a.postDnasystemapiv1sitesiteIddevice('fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
|
|
2194
|
+
try {
|
|
2195
|
+
runCommonAsserts(data, error);
|
|
2196
|
+
|
|
2197
|
+
if (stub) {
|
|
2198
|
+
assert.equal('string', data.response.executionId);
|
|
2199
|
+
assert.equal('string', data.response.executionStatusUrl);
|
|
2200
|
+
assert.equal('string', data.response.message);
|
|
2201
|
+
} else {
|
|
2202
|
+
runCommonAsserts(data, error);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
done();
|
|
2206
|
+
} catch (err) {
|
|
2207
|
+
log.error(`Test Failure: ${err}`);
|
|
2208
|
+
done(err);
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
} catch (error) {
|
|
2212
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2213
|
+
done(error);
|
|
2214
|
+
}
|
|
2215
|
+
}).timeout(attemptTimeout);
|
|
2216
|
+
});
|
|
2217
|
+
|
|
2218
|
+
describe('#postDnaintentapiv1site - errors', () => {
|
|
2219
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2220
|
+
try {
|
|
2221
|
+
a.postDnaintentapiv1site('fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
|
|
2222
|
+
try {
|
|
2223
|
+
runCommonAsserts(data, error);
|
|
2224
|
+
|
|
2225
|
+
if (stub) {
|
|
2226
|
+
assert.equal('string', data.response.executionId);
|
|
2227
|
+
assert.equal('string', data.response.executionStatusUrl);
|
|
2228
|
+
assert.equal('string', data.response.message);
|
|
2229
|
+
} else {
|
|
2230
|
+
runCommonAsserts(data, error);
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
done();
|
|
2234
|
+
} catch (err) {
|
|
2235
|
+
log.error(`Test Failure: ${err}`);
|
|
2236
|
+
done(err);
|
|
2237
|
+
}
|
|
2238
|
+
});
|
|
2239
|
+
} catch (error) {
|
|
2240
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2241
|
+
done(error);
|
|
2242
|
+
}
|
|
2243
|
+
}).timeout(attemptTimeout);
|
|
2244
|
+
});
|
|
2245
|
+
|
|
2170
2246
|
describe('#postDnasystemapiv1site - errors', () => {
|
|
2171
2247
|
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2172
2248
|
try {
|