@itentialopensource/adapter-moogsoft 0.1.1 → 0.2.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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +12 -12
- package/.jshintrc +0 -0
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +169 -0
- package/CHANGELOG.md +37 -2
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +88 -74
- package/ENHANCE.md +69 -0
- package/LICENSE +0 -0
- package/PROPERTIES.md +641 -0
- package/README.md +249 -418
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +1636 -35
- package/adapterBase.js +1331 -50
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +1 -0
- package/entities/Alerts/action.json +9 -0
- package/entities/Cookbooks/action.json +3 -0
- package/entities/Integrations/action.json +3 -0
- package/entities/Licenses/action.json +1 -0
- package/entities/MaintenanceWindows/action.json +4 -0
- package/entities/MergeGroups/action.json +4 -0
- package/entities/Processes/action.json +1 -0
- package/entities/Recipes/action.json +5 -0
- package/entities/SecurityRealms/action.json +2 -0
- package/entities/Services/action.json +1 -0
- package/entities/Situations/action.json +20 -0
- package/entities/Teams/action.json +3 -0
- package/entities/Tempus/action.json +3 -0
- package/entities/Threads/action.json +4 -0
- package/entities/Tools/action.json +2 -0
- package/entities/Users/action.json +2 -0
- package/entities/Workflows/action.json +4 -0
- package/error.json +12 -0
- package/package.json +51 -25
- package/pronghorn.json +642 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +487 -10
- package/refs?service=git-upload-pack +0 -0
- package/report/Moogsoft.OpenApi3Json.json +11552 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1594225130913.json +95 -0
- package/report/updateReport1615386555916.json +95 -0
- package/report/updateReport1653652218796.json +120 -0
- package/sampleProperties.json +103 -5
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +33 -102
- package/test/unit/adapterBaseTestUnit.js +949 -0
- package/test/unit/adapterTestUnit.js +643 -110
- package/utils/adapterInfo.js +206 -0
- 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 +179 -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 +4 -1
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +0 -0
- package/utils/tbScript.js +184 -0
- package/utils/tbUtils.js +469 -0
- package/utils/testRunner.js +16 -16
- package/utils/troubleshootingAdapter.js +190 -0
- package/workflows/README.md +0 -0
- package/gl-code-quality-report.json +0 -1
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// Set globals
|
|
4
4
|
/* global describe it log pronghornProps */
|
|
5
5
|
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint no-underscore-dangle: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
6
8
|
|
|
7
9
|
// include required items for testing & logging
|
|
8
10
|
const assert = require('assert');
|
|
@@ -13,25 +15,39 @@ const winston = require('winston');
|
|
|
13
15
|
const { expect } = require('chai');
|
|
14
16
|
const { use } = require('chai');
|
|
15
17
|
const td = require('testdouble');
|
|
18
|
+
const util = require('util');
|
|
16
19
|
|
|
17
20
|
const anything = td.matchers.anything();
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
20
23
|
let logLevel = 'none';
|
|
21
|
-
const stub = true;
|
|
22
24
|
const isRapidFail = false;
|
|
23
25
|
const isSaveMockData = false;
|
|
24
|
-
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
25
35
|
|
|
26
36
|
// these variables can be changed to run in integrated mode so easier to set them here
|
|
27
37
|
// always check these in with bogus data!!!
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
if (samProps.request.attempt_timeout < 30000) {
|
|
47
|
+
samProps.request.attempt_timeout = 30000;
|
|
48
|
+
}
|
|
49
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
50
|
+
const { stub } = samProps;
|
|
35
51
|
|
|
36
52
|
// these are the adapter properties. You generally should not need to alter
|
|
37
53
|
// any of these after they are initially set up
|
|
@@ -43,93 +59,7 @@ global.pronghornProps = {
|
|
|
43
59
|
adapters: [{
|
|
44
60
|
id: 'Test-moogsoft',
|
|
45
61
|
type: 'Moogsoft',
|
|
46
|
-
properties:
|
|
47
|
-
host,
|
|
48
|
-
port,
|
|
49
|
-
base_path: '/graze',
|
|
50
|
-
version: 'v1',
|
|
51
|
-
cache_location: 'none',
|
|
52
|
-
save_metric: false,
|
|
53
|
-
stub,
|
|
54
|
-
protocol,
|
|
55
|
-
authentication: {
|
|
56
|
-
auth_method: 'basic user_password',
|
|
57
|
-
username,
|
|
58
|
-
password,
|
|
59
|
-
token: '',
|
|
60
|
-
invalid_token_error: 401,
|
|
61
|
-
token_timeout: -1,
|
|
62
|
-
token_cache: 'local',
|
|
63
|
-
auth_field: 'header.headers.Authorization',
|
|
64
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
|
|
65
|
-
},
|
|
66
|
-
healthcheck: {
|
|
67
|
-
type: 'none',
|
|
68
|
-
frequency: 60000
|
|
69
|
-
},
|
|
70
|
-
throttle: {
|
|
71
|
-
throttle_enabled: false,
|
|
72
|
-
number_pronghorns: 1,
|
|
73
|
-
sync_async: 'sync',
|
|
74
|
-
max_in_queue: 1000,
|
|
75
|
-
concurrent_max: 1,
|
|
76
|
-
expire_timeout: 0,
|
|
77
|
-
avg_runtime: 200,
|
|
78
|
-
priorities: [
|
|
79
|
-
{
|
|
80
|
-
value: 0,
|
|
81
|
-
percent: 100
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
request: {
|
|
86
|
-
number_redirects: 0,
|
|
87
|
-
number_retries: 3,
|
|
88
|
-
limit_retry_error: [0],
|
|
89
|
-
failover_codes: [],
|
|
90
|
-
attempt_timeout: attemptTimeout,
|
|
91
|
-
global_request: {
|
|
92
|
-
payload: {},
|
|
93
|
-
uriOptions: {},
|
|
94
|
-
addlHeaders: {},
|
|
95
|
-
authData: {}
|
|
96
|
-
},
|
|
97
|
-
healthcheck_on_timeout: true,
|
|
98
|
-
return_raw: true,
|
|
99
|
-
archiving: false
|
|
100
|
-
},
|
|
101
|
-
proxy: {
|
|
102
|
-
enabled: false,
|
|
103
|
-
host: '',
|
|
104
|
-
port: 1,
|
|
105
|
-
protocol: 'http'
|
|
106
|
-
},
|
|
107
|
-
ssl: {
|
|
108
|
-
ecdhCurve: '',
|
|
109
|
-
enabled: sslenable,
|
|
110
|
-
accept_invalid_cert: sslinvalid,
|
|
111
|
-
ca_file: '',
|
|
112
|
-
key_file: '',
|
|
113
|
-
cert_file: '',
|
|
114
|
-
secure_protocol: '',
|
|
115
|
-
ciphers: ''
|
|
116
|
-
},
|
|
117
|
-
mongo: {
|
|
118
|
-
host: '',
|
|
119
|
-
port: 0,
|
|
120
|
-
database: '',
|
|
121
|
-
username: '',
|
|
122
|
-
password: '',
|
|
123
|
-
replSet: '',
|
|
124
|
-
db_ssl: {
|
|
125
|
-
enabled: false,
|
|
126
|
-
accept_invalid_cert: false,
|
|
127
|
-
ca_file: '',
|
|
128
|
-
key_file: '',
|
|
129
|
-
cert_file: ''
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
62
|
+
properties: samProps
|
|
133
63
|
}]
|
|
134
64
|
}
|
|
135
65
|
};
|
|
@@ -165,7 +95,7 @@ process.argv.forEach((val) => {
|
|
|
165
95
|
});
|
|
166
96
|
|
|
167
97
|
// need to set global logging
|
|
168
|
-
global.log =
|
|
98
|
+
global.log = winston.createLogger({
|
|
169
99
|
level: logLevel,
|
|
170
100
|
levels: myCustomLevels.levels,
|
|
171
101
|
transports: [
|
|
@@ -259,7 +189,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
259
189
|
};
|
|
260
190
|
|
|
261
191
|
// get the object for method we're trying to change.
|
|
262
|
-
const currentMethodAction = parsedJson.actions.find(obj => obj.name === actionName);
|
|
192
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
263
193
|
|
|
264
194
|
// if the method was not found - should never happen but...
|
|
265
195
|
if (!currentMethodAction) {
|
|
@@ -267,12 +197,12 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
267
197
|
}
|
|
268
198
|
|
|
269
199
|
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
270
|
-
const actionResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === descriptor);
|
|
200
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
271
201
|
|
|
272
202
|
// Add the action responseObj back into the array of response objects.
|
|
273
203
|
if (!actionResponseObj) {
|
|
274
204
|
// if there is a default response object, we want to get the key.
|
|
275
|
-
const defaultResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === 'default');
|
|
205
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
276
206
|
|
|
277
207
|
// save the default key into the new response object
|
|
278
208
|
if (defaultResponseObj) {
|
|
@@ -303,9 +233,8 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
303
233
|
return false;
|
|
304
234
|
}
|
|
305
235
|
|
|
306
|
-
|
|
307
236
|
// require the adapter that we are going to be using
|
|
308
|
-
const Moogsoft = require('../../adapter
|
|
237
|
+
const Moogsoft = require('../../adapter');
|
|
309
238
|
|
|
310
239
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
311
240
|
describe('[integration] Moogsoft Adapter Test', () => {
|
|
@@ -336,6 +265,8 @@ describe('[integration] Moogsoft Adapter Test', () => {
|
|
|
336
265
|
try {
|
|
337
266
|
assert.notEqual(null, a);
|
|
338
267
|
assert.notEqual(undefined, a);
|
|
268
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
269
|
+
assert.equal(checkId, a.id);
|
|
339
270
|
assert.notEqual(null, a.allProps);
|
|
340
271
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
341
272
|
assert.equal(check, a.healthcheckType);
|