@itentialopensource/adapter-splunk 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.jshintrc +0 -0
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +170 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +172 -0
- package/ENHANCE.md +69 -0
- package/LICENSE +201 -0
- package/PROPERTIES.md +641 -0
- package/README.md +337 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +4945 -0
- package/adapterBase.js +1787 -0
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +50 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +53 -0
- package/entities/.system/schemaTokenResp.json +53 -0
- package/entities/Services/action.json +891 -0
- package/entities/Services/schema.json +215 -0
- package/error.json +190 -0
- package/package.json +87 -0
- package/pronghorn.json +2826 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1248 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/SplunkAdapter.json +2131 -0
- package/report/creationReport.json +425 -0
- package/sampleProperties.json +195 -0
- package/test/integration/adapterTestBasicGet.js +83 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +1465 -0
- package/test/unit/adapterBaseTestUnit.js +949 -0
- package/test/unit/adapterTestUnit.js +3595 -0
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +178 -0
- package/utils/findPath.js +74 -0
- package/utils/methodDocumentor.js +225 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +32 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +246 -0
- package/utils/tbUtils.js +490 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +195 -0
- package/workflows/README.md +3 -0
|
@@ -0,0 +1,3595 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
// Set globals
|
|
4
|
+
/* global describe it log pronghornProps */
|
|
5
|
+
/* eslint global-require: warn */
|
|
6
|
+
/* eslint no-unused-vars: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
8
|
+
|
|
9
|
+
// include required items for testing & logging
|
|
10
|
+
const assert = require('assert');
|
|
11
|
+
const fs = require('fs-extra');
|
|
12
|
+
const mocha = require('mocha');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const util = require('util');
|
|
15
|
+
const winston = require('winston');
|
|
16
|
+
const execute = require('child_process').execSync;
|
|
17
|
+
const { expect } = require('chai');
|
|
18
|
+
const { use } = require('chai');
|
|
19
|
+
const td = require('testdouble');
|
|
20
|
+
const Ajv = require('ajv');
|
|
21
|
+
|
|
22
|
+
const ajv = new Ajv({ allErrors: true, unknownFormats: 'ignore' });
|
|
23
|
+
const anything = td.matchers.anything();
|
|
24
|
+
let logLevel = 'none';
|
|
25
|
+
const isRapidFail = false;
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
35
|
+
|
|
36
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
37
|
+
// always check these in with bogus data!!!
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
samProps.request.attempt_timeout = 1200000;
|
|
47
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
48
|
+
const { stub } = samProps;
|
|
49
|
+
|
|
50
|
+
// these are the adapter properties. You generally should not need to alter
|
|
51
|
+
// any of these after they are initially set up
|
|
52
|
+
global.pronghornProps = {
|
|
53
|
+
pathProps: {
|
|
54
|
+
encrypted: false
|
|
55
|
+
},
|
|
56
|
+
adapterProps: {
|
|
57
|
+
adapters: [{
|
|
58
|
+
id: 'Test-splunk',
|
|
59
|
+
type: 'Splunk',
|
|
60
|
+
properties: samProps
|
|
61
|
+
}]
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
global.$HOME = `${__dirname}/../..`;
|
|
66
|
+
|
|
67
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
68
|
+
// this you may error on log.trace calls.
|
|
69
|
+
const myCustomLevels = {
|
|
70
|
+
levels: {
|
|
71
|
+
spam: 6,
|
|
72
|
+
trace: 5,
|
|
73
|
+
debug: 4,
|
|
74
|
+
info: 3,
|
|
75
|
+
warn: 2,
|
|
76
|
+
error: 1,
|
|
77
|
+
none: 0
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// need to see if there is a log level passed in
|
|
82
|
+
process.argv.forEach((val) => {
|
|
83
|
+
// is there a log level defined to be passed in?
|
|
84
|
+
if (val.indexOf('--LOG') === 0) {
|
|
85
|
+
// get the desired log level
|
|
86
|
+
const inputVal = val.split('=')[1];
|
|
87
|
+
|
|
88
|
+
// validate the log level is supported, if so set it
|
|
89
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
90
|
+
logLevel = inputVal;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// need to set global logging
|
|
96
|
+
global.log = winston.createLogger({
|
|
97
|
+
level: logLevel,
|
|
98
|
+
levels: myCustomLevels.levels,
|
|
99
|
+
transports: [
|
|
100
|
+
new winston.transports.Console()
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Runs the error asserts for the test
|
|
106
|
+
*/
|
|
107
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
108
|
+
assert.equal(null, data);
|
|
109
|
+
assert.notEqual(undefined, error);
|
|
110
|
+
assert.notEqual(null, error);
|
|
111
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
112
|
+
assert.notEqual(null, error.IAPerror);
|
|
113
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
114
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
115
|
+
assert.equal(code, error.icode);
|
|
116
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
117
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// require the adapter that we are going to be using
|
|
121
|
+
const Splunk = require('../../adapter');
|
|
122
|
+
|
|
123
|
+
// delete the .DS_Store directory in entities -- otherwise this will cause errors
|
|
124
|
+
const dirPath = path.join(__dirname, '../../entities/.DS_Store');
|
|
125
|
+
if (fs.existsSync(dirPath)) {
|
|
126
|
+
try {
|
|
127
|
+
fs.removeSync(dirPath);
|
|
128
|
+
console.log('.DS_Store deleted');
|
|
129
|
+
} catch (e) {
|
|
130
|
+
console.log('Error when deleting .DS_Store:', e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
135
|
+
describe('[unit] Splunk Adapter Test', () => {
|
|
136
|
+
describe('Splunk Class Tests', () => {
|
|
137
|
+
const a = new Splunk(
|
|
138
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
139
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
if (isRapidFail) {
|
|
143
|
+
const state = {};
|
|
144
|
+
state.passed = true;
|
|
145
|
+
|
|
146
|
+
mocha.afterEach(function x() {
|
|
147
|
+
state.passed = state.passed
|
|
148
|
+
&& (this.currentTest.state === 'passed');
|
|
149
|
+
});
|
|
150
|
+
mocha.beforeEach(function x() {
|
|
151
|
+
if (!state.passed) {
|
|
152
|
+
return this.currentTest.skip();
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
describe('#class instance created', () => {
|
|
159
|
+
it('should be a class with properties', (done) => {
|
|
160
|
+
try {
|
|
161
|
+
assert.notEqual(null, a);
|
|
162
|
+
assert.notEqual(undefined, a);
|
|
163
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
164
|
+
assert.equal(checkId, a.id);
|
|
165
|
+
assert.notEqual(null, a.allProps);
|
|
166
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
167
|
+
assert.equal(check, a.healthcheckType);
|
|
168
|
+
done();
|
|
169
|
+
} catch (error) {
|
|
170
|
+
log.error(`Test Failure: ${error}`);
|
|
171
|
+
done(error);
|
|
172
|
+
}
|
|
173
|
+
}).timeout(attemptTimeout);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe('adapterBase.js', () => {
|
|
177
|
+
it('should have an adapterBase.js', (done) => {
|
|
178
|
+
try {
|
|
179
|
+
fs.exists('adapterBase.js', (val) => {
|
|
180
|
+
assert.equal(true, val);
|
|
181
|
+
done();
|
|
182
|
+
});
|
|
183
|
+
} catch (error) {
|
|
184
|
+
log.error(`Test Failure: ${error}`);
|
|
185
|
+
done(error);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
let wffunctions = [];
|
|
191
|
+
describe('#iapGetAdapterWorkflowFunctions', () => {
|
|
192
|
+
it('should retrieve workflow functions', (done) => {
|
|
193
|
+
try {
|
|
194
|
+
wffunctions = a.iapGetAdapterWorkflowFunctions([]);
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
assert.notEqual(0, wffunctions.length);
|
|
198
|
+
done();
|
|
199
|
+
} catch (err) {
|
|
200
|
+
log.error(`Test Failure: ${err}`);
|
|
201
|
+
done(err);
|
|
202
|
+
}
|
|
203
|
+
} catch (error) {
|
|
204
|
+
log.error(`Adapter Exception: ${error}`);
|
|
205
|
+
done(error);
|
|
206
|
+
}
|
|
207
|
+
}).timeout(attemptTimeout);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('package.json', () => {
|
|
211
|
+
it('should have a package.json', (done) => {
|
|
212
|
+
try {
|
|
213
|
+
fs.exists('package.json', (val) => {
|
|
214
|
+
assert.equal(true, val);
|
|
215
|
+
done();
|
|
216
|
+
});
|
|
217
|
+
} catch (error) {
|
|
218
|
+
log.error(`Test Failure: ${error}`);
|
|
219
|
+
done(error);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
it('package.json should be validated', (done) => {
|
|
223
|
+
try {
|
|
224
|
+
const packageDotJson = require('../../package.json');
|
|
225
|
+
const { PJV } = require('package-json-validator');
|
|
226
|
+
const options = {
|
|
227
|
+
warnings: true, // show warnings
|
|
228
|
+
recommendations: true // show recommendations
|
|
229
|
+
};
|
|
230
|
+
const results = PJV.validate(JSON.stringify(packageDotJson), 'npm', options);
|
|
231
|
+
|
|
232
|
+
if (results.valid === false) {
|
|
233
|
+
log.error('The package.json contains the following errors: ');
|
|
234
|
+
log.error(util.inspect(results));
|
|
235
|
+
assert.equal(true, results.valid);
|
|
236
|
+
} else {
|
|
237
|
+
assert.equal(true, results.valid);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
done();
|
|
241
|
+
} catch (error) {
|
|
242
|
+
log.error(`Test Failure: ${error}`);
|
|
243
|
+
done(error);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
it('package.json standard fields should be customized', (done) => {
|
|
247
|
+
try {
|
|
248
|
+
const packageDotJson = require('../../package.json');
|
|
249
|
+
assert.notEqual(-1, packageDotJson.name.indexOf('splunk'));
|
|
250
|
+
assert.notEqual(undefined, packageDotJson.version);
|
|
251
|
+
assert.notEqual(null, packageDotJson.version);
|
|
252
|
+
assert.notEqual('', packageDotJson.version);
|
|
253
|
+
assert.notEqual(undefined, packageDotJson.description);
|
|
254
|
+
assert.notEqual(null, packageDotJson.description);
|
|
255
|
+
assert.notEqual('', packageDotJson.description);
|
|
256
|
+
assert.equal('adapter.js', packageDotJson.main);
|
|
257
|
+
assert.notEqual(undefined, packageDotJson.wizardVersion);
|
|
258
|
+
assert.notEqual(null, packageDotJson.wizardVersion);
|
|
259
|
+
assert.notEqual('', packageDotJson.wizardVersion);
|
|
260
|
+
assert.notEqual(undefined, packageDotJson.engineVersion);
|
|
261
|
+
assert.notEqual(null, packageDotJson.engineVersion);
|
|
262
|
+
assert.notEqual('', packageDotJson.engineVersion);
|
|
263
|
+
assert.equal('http', packageDotJson.adapterType);
|
|
264
|
+
done();
|
|
265
|
+
} catch (error) {
|
|
266
|
+
log.error(`Test Failure: ${error}`);
|
|
267
|
+
done(error);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
it('package.json proper scripts should be provided', (done) => {
|
|
271
|
+
try {
|
|
272
|
+
const packageDotJson = require('../../package.json');
|
|
273
|
+
assert.notEqual(undefined, packageDotJson.scripts);
|
|
274
|
+
assert.notEqual(null, packageDotJson.scripts);
|
|
275
|
+
assert.notEqual('', packageDotJson.scripts);
|
|
276
|
+
assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
|
|
277
|
+
assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
|
|
278
|
+
assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
|
|
279
|
+
assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
|
|
280
|
+
assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
|
|
281
|
+
assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
|
|
282
|
+
assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
|
|
283
|
+
done();
|
|
284
|
+
} catch (error) {
|
|
285
|
+
log.error(`Test Failure: ${error}`);
|
|
286
|
+
done(error);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
it('package.json proper directories should be provided', (done) => {
|
|
290
|
+
try {
|
|
291
|
+
const packageDotJson = require('../../package.json');
|
|
292
|
+
assert.notEqual(undefined, packageDotJson.repository);
|
|
293
|
+
assert.notEqual(null, packageDotJson.repository);
|
|
294
|
+
assert.notEqual('', packageDotJson.repository);
|
|
295
|
+
done();
|
|
296
|
+
} catch (error) {
|
|
297
|
+
log.error(`Test Failure: ${error}`);
|
|
298
|
+
done(error);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
it('package.json proper dependencies should be provided', (done) => {
|
|
302
|
+
try {
|
|
303
|
+
const packageDotJson = require('../../package.json');
|
|
304
|
+
assert.notEqual(undefined, packageDotJson.dependencies);
|
|
305
|
+
assert.notEqual(null, packageDotJson.dependencies);
|
|
306
|
+
assert.notEqual('', packageDotJson.dependencies);
|
|
307
|
+
assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
|
|
308
|
+
assert.equal('^0.21.0', packageDotJson.dependencies.axios);
|
|
309
|
+
assert.equal('^2.20.0', packageDotJson.dependencies.commander);
|
|
310
|
+
assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
|
|
311
|
+
assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
|
|
312
|
+
assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
|
|
313
|
+
assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
|
|
314
|
+
assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
|
|
315
|
+
assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
|
|
316
|
+
assert.equal('^7.3.2', packageDotJson.dependencies.semver);
|
|
317
|
+
assert.equal('^3.3.3', packageDotJson.dependencies.winston);
|
|
318
|
+
done();
|
|
319
|
+
} catch (error) {
|
|
320
|
+
log.error(`Test Failure: ${error}`);
|
|
321
|
+
done(error);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
it('package.json proper dev dependencies should be provided', (done) => {
|
|
325
|
+
try {
|
|
326
|
+
const packageDotJson = require('../../package.json');
|
|
327
|
+
assert.notEqual(undefined, packageDotJson.devDependencies);
|
|
328
|
+
assert.notEqual(null, packageDotJson.devDependencies);
|
|
329
|
+
assert.notEqual('', packageDotJson.devDependencies);
|
|
330
|
+
assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
|
|
331
|
+
assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
|
|
332
|
+
assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
|
|
333
|
+
assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
|
|
334
|
+
assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
|
|
335
|
+
assert.equal('^0.6.3', packageDotJson.devDependencies['package-json-validator']);
|
|
336
|
+
assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
|
|
337
|
+
done();
|
|
338
|
+
} catch (error) {
|
|
339
|
+
log.error(`Test Failure: ${error}`);
|
|
340
|
+
done(error);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
describe('pronghorn.json', () => {
|
|
346
|
+
it('should have a pronghorn.json', (done) => {
|
|
347
|
+
try {
|
|
348
|
+
fs.exists('pronghorn.json', (val) => {
|
|
349
|
+
assert.equal(true, val);
|
|
350
|
+
done();
|
|
351
|
+
});
|
|
352
|
+
} catch (error) {
|
|
353
|
+
log.error(`Test Failure: ${error}`);
|
|
354
|
+
done(error);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
it('pronghorn.json should be customized', (done) => {
|
|
358
|
+
try {
|
|
359
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
360
|
+
assert.notEqual(-1, pronghornDotJson.id.indexOf('splunk'));
|
|
361
|
+
assert.equal('Adapter', pronghornDotJson.type);
|
|
362
|
+
assert.equal('Splunk', pronghornDotJson.export);
|
|
363
|
+
assert.equal('Splunk', pronghornDotJson.title);
|
|
364
|
+
assert.equal('adapter.js', pronghornDotJson.src);
|
|
365
|
+
done();
|
|
366
|
+
} catch (error) {
|
|
367
|
+
log.error(`Test Failure: ${error}`);
|
|
368
|
+
done(error);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
it('pronghorn.json should contain generic adapter methods', (done) => {
|
|
372
|
+
try {
|
|
373
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
374
|
+
assert.notEqual(undefined, pronghornDotJson.methods);
|
|
375
|
+
assert.notEqual(null, pronghornDotJson.methods);
|
|
376
|
+
assert.notEqual('', pronghornDotJson.methods);
|
|
377
|
+
assert.equal(true, Array.isArray(pronghornDotJson.methods));
|
|
378
|
+
assert.notEqual(0, pronghornDotJson.methods.length);
|
|
379
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
|
|
380
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
|
|
381
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
|
|
382
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
|
|
383
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
|
|
384
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
|
|
385
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapSuspendAdapter'));
|
|
386
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
|
|
387
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
|
|
388
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
|
|
389
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
|
|
390
|
+
done();
|
|
391
|
+
} catch (error) {
|
|
392
|
+
log.error(`Test Failure: ${error}`);
|
|
393
|
+
done(error);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
it('pronghorn.json should only expose workflow functions', (done) => {
|
|
397
|
+
try {
|
|
398
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
399
|
+
|
|
400
|
+
for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
|
|
401
|
+
let found = false;
|
|
402
|
+
let paramissue = false;
|
|
403
|
+
|
|
404
|
+
for (let w = 0; w < wffunctions.length; w += 1) {
|
|
405
|
+
if (pronghornDotJson.methods[m].name === wffunctions[w]) {
|
|
406
|
+
found = true;
|
|
407
|
+
const methLine = execute(`grep " ${wffunctions[w]}(" adapter.js | grep "callback) {"`).toString();
|
|
408
|
+
let wfparams = [];
|
|
409
|
+
|
|
410
|
+
if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
|
|
411
|
+
const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
|
|
412
|
+
wfparams = temp.split(',');
|
|
413
|
+
|
|
414
|
+
for (let t = 0; t < wfparams.length; t += 1) {
|
|
415
|
+
// remove default value from the parameter name
|
|
416
|
+
wfparams[t] = wfparams[t].substring(0, wfparams[t].search(/=/) > 0 ? wfparams[t].search(/#|\?|=/) : wfparams[t].length);
|
|
417
|
+
// remove spaces
|
|
418
|
+
wfparams[t] = wfparams[t].trim();
|
|
419
|
+
|
|
420
|
+
if (wfparams[t] === 'callback') {
|
|
421
|
+
wfparams.splice(t, 1);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// if there are inputs defined but not on the method line
|
|
427
|
+
if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
|
|
428
|
+
&& pronghornDotJson.methods[m].input.length > 0)) {
|
|
429
|
+
paramissue = true;
|
|
430
|
+
} else if (wfparams.length > 0 && (!pronghornDotJson.methods[m].input
|
|
431
|
+
|| pronghornDotJson.methods[m].input.length === 0)) {
|
|
432
|
+
// if there are no inputs defined but there are on the method line
|
|
433
|
+
paramissue = true;
|
|
434
|
+
} else {
|
|
435
|
+
for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
|
|
436
|
+
let pfound = false;
|
|
437
|
+
for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
|
|
438
|
+
if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
|
|
439
|
+
pfound = true;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (!pfound) {
|
|
444
|
+
paramissue = true;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
|
|
448
|
+
let pfound = false;
|
|
449
|
+
for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
|
|
450
|
+
if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
|
|
451
|
+
pfound = true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (!pfound) {
|
|
456
|
+
paramissue = true;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (!found) {
|
|
466
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
467
|
+
// they can be worked
|
|
468
|
+
log.error(`${pronghornDotJson.methods[m].name} not found in workflow functions`);
|
|
469
|
+
}
|
|
470
|
+
if (paramissue) {
|
|
471
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
472
|
+
// they can be worked
|
|
473
|
+
log.error(`${pronghornDotJson.methods[m].name} has a parameter mismatch`);
|
|
474
|
+
}
|
|
475
|
+
assert.equal(true, found);
|
|
476
|
+
assert.equal(false, paramissue);
|
|
477
|
+
}
|
|
478
|
+
done();
|
|
479
|
+
} catch (error) {
|
|
480
|
+
log.error(`Adapter Exception: ${error}`);
|
|
481
|
+
done(error);
|
|
482
|
+
}
|
|
483
|
+
}).timeout(attemptTimeout);
|
|
484
|
+
it('pronghorn.json should expose all workflow functions', (done) => {
|
|
485
|
+
try {
|
|
486
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
487
|
+
for (let w = 0; w < wffunctions.length; w += 1) {
|
|
488
|
+
let found = false;
|
|
489
|
+
|
|
490
|
+
for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
|
|
491
|
+
if (pronghornDotJson.methods[m].name === wffunctions[w]) {
|
|
492
|
+
found = true;
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (!found) {
|
|
498
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
499
|
+
// they can be worked
|
|
500
|
+
log.error(`${wffunctions[w]} not found in pronghorn.json`);
|
|
501
|
+
}
|
|
502
|
+
assert.equal(true, found);
|
|
503
|
+
}
|
|
504
|
+
done();
|
|
505
|
+
} catch (error) {
|
|
506
|
+
log.error(`Adapter Exception: ${error}`);
|
|
507
|
+
done(error);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
it('pronghorn.json verify input/output schema objects', (done) => {
|
|
511
|
+
const verifySchema = (methodName, schema) => {
|
|
512
|
+
try {
|
|
513
|
+
ajv.compile(schema);
|
|
514
|
+
} catch (error) {
|
|
515
|
+
const errorMessage = `Invalid schema found in '${methodName}' method.
|
|
516
|
+
Schema => ${JSON.stringify(schema)}.
|
|
517
|
+
Details => ${error.message}`;
|
|
518
|
+
throw new Error(errorMessage);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
try {
|
|
523
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
524
|
+
const { methods } = pronghornDotJson;
|
|
525
|
+
for (let i = 0; i < methods.length; i += 1) {
|
|
526
|
+
for (let j = 0; j < methods[i].input.length; j += 1) {
|
|
527
|
+
const inputSchema = methods[i].input[j].schema;
|
|
528
|
+
if (inputSchema) {
|
|
529
|
+
verifySchema(methods[i].name, inputSchema);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
const outputSchema = methods[i].output.schema;
|
|
533
|
+
if (outputSchema) {
|
|
534
|
+
verifySchema(methods[i].name, outputSchema);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
done();
|
|
538
|
+
} catch (error) {
|
|
539
|
+
log.error(`Adapter Exception: ${error}`);
|
|
540
|
+
done(error);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
describe('propertiesSchema.json', () => {
|
|
546
|
+
it('should have a propertiesSchema.json', (done) => {
|
|
547
|
+
try {
|
|
548
|
+
fs.exists('propertiesSchema.json', (val) => {
|
|
549
|
+
assert.equal(true, val);
|
|
550
|
+
done();
|
|
551
|
+
});
|
|
552
|
+
} catch (error) {
|
|
553
|
+
log.error(`Test Failure: ${error}`);
|
|
554
|
+
done(error);
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
it('propertiesSchema.json should be customized', (done) => {
|
|
558
|
+
try {
|
|
559
|
+
const propertiesDotJson = require('../../propertiesSchema.json');
|
|
560
|
+
assert.equal('adapter-splunk', propertiesDotJson.$id);
|
|
561
|
+
assert.equal('object', propertiesDotJson.type);
|
|
562
|
+
assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
|
|
563
|
+
done();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
log.error(`Test Failure: ${error}`);
|
|
566
|
+
done(error);
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
it('propertiesSchema.json should contain generic adapter properties', (done) => {
|
|
570
|
+
try {
|
|
571
|
+
const propertiesDotJson = require('../../propertiesSchema.json');
|
|
572
|
+
assert.notEqual(undefined, propertiesDotJson.properties);
|
|
573
|
+
assert.notEqual(null, propertiesDotJson.properties);
|
|
574
|
+
assert.notEqual('', propertiesDotJson.properties);
|
|
575
|
+
assert.equal('string', propertiesDotJson.properties.host.type);
|
|
576
|
+
assert.equal('integer', propertiesDotJson.properties.port.type);
|
|
577
|
+
assert.equal('boolean', propertiesDotJson.properties.stub.type);
|
|
578
|
+
assert.equal('string', propertiesDotJson.properties.protocol.type);
|
|
579
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
|
|
580
|
+
assert.notEqual(null, propertiesDotJson.definitions.authentication);
|
|
581
|
+
assert.notEqual('', propertiesDotJson.definitions.authentication);
|
|
582
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
|
|
583
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
|
|
584
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
|
|
585
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
|
|
586
|
+
assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
|
|
587
|
+
assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
|
|
588
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
|
|
589
|
+
assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
|
|
590
|
+
assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
|
|
591
|
+
assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
|
|
592
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
|
|
593
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
|
|
594
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
|
|
595
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
596
|
+
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
597
|
+
assert.notEqual('', propertiesDotJson.definitions.ssl);
|
|
598
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
|
|
599
|
+
assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
|
|
600
|
+
assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
|
|
601
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
|
|
602
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
|
|
603
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
|
|
604
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
|
|
605
|
+
assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
|
|
606
|
+
assert.equal('string', propertiesDotJson.properties.base_path.type);
|
|
607
|
+
assert.equal('string', propertiesDotJson.properties.version.type);
|
|
608
|
+
assert.equal('string', propertiesDotJson.properties.cache_location.type);
|
|
609
|
+
assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
|
|
610
|
+
assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
|
|
611
|
+
assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
|
|
612
|
+
assert.notEqual(undefined, propertiesDotJson.definitions);
|
|
613
|
+
assert.notEqual(null, propertiesDotJson.definitions);
|
|
614
|
+
assert.notEqual('', propertiesDotJson.definitions);
|
|
615
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
|
|
616
|
+
assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
|
|
617
|
+
assert.notEqual('', propertiesDotJson.definitions.healthcheck);
|
|
618
|
+
assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
|
|
619
|
+
assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
|
|
620
|
+
assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
|
|
621
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
|
|
622
|
+
assert.notEqual(null, propertiesDotJson.definitions.throttle);
|
|
623
|
+
assert.notEqual('', propertiesDotJson.definitions.throttle);
|
|
624
|
+
assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
|
|
625
|
+
assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
|
|
626
|
+
assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
|
|
627
|
+
assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
|
|
628
|
+
assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
|
|
629
|
+
assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
|
|
630
|
+
assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
|
|
631
|
+
assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
|
|
632
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.request);
|
|
633
|
+
assert.notEqual(null, propertiesDotJson.definitions.request);
|
|
634
|
+
assert.notEqual('', propertiesDotJson.definitions.request);
|
|
635
|
+
assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
|
|
636
|
+
assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
|
|
637
|
+
assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
|
|
638
|
+
assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
|
|
639
|
+
assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
|
|
640
|
+
assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
|
|
641
|
+
assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
|
|
642
|
+
assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
|
|
643
|
+
assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
|
|
644
|
+
assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
|
|
645
|
+
assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
|
|
646
|
+
assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
|
|
647
|
+
assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
|
|
648
|
+
assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
|
|
649
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
|
|
650
|
+
assert.notEqual(null, propertiesDotJson.definitions.proxy);
|
|
651
|
+
assert.notEqual('', propertiesDotJson.definitions.proxy);
|
|
652
|
+
assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
|
|
653
|
+
assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
|
|
654
|
+
assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
|
|
655
|
+
assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
|
|
656
|
+
assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
|
|
657
|
+
assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
|
|
658
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
|
|
659
|
+
assert.notEqual(null, propertiesDotJson.definitions.mongo);
|
|
660
|
+
assert.notEqual('', propertiesDotJson.definitions.mongo);
|
|
661
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
|
|
662
|
+
assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
|
|
663
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
|
|
664
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
|
|
665
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
|
|
666
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
|
|
667
|
+
assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
|
|
668
|
+
assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
|
|
669
|
+
assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
|
|
670
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
|
|
671
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
|
|
672
|
+
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
|
|
673
|
+
assert.notEqual('', propertiesDotJson.definitions.devicebroker);
|
|
674
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
|
|
675
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
|
|
676
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
|
|
677
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
|
|
678
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
|
|
679
|
+
done();
|
|
680
|
+
} catch (error) {
|
|
681
|
+
log.error(`Test Failure: ${error}`);
|
|
682
|
+
done(error);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
describe('error.json', () => {
|
|
688
|
+
it('should have an error.json', (done) => {
|
|
689
|
+
try {
|
|
690
|
+
fs.exists('error.json', (val) => {
|
|
691
|
+
assert.equal(true, val);
|
|
692
|
+
done();
|
|
693
|
+
});
|
|
694
|
+
} catch (error) {
|
|
695
|
+
log.error(`Test Failure: ${error}`);
|
|
696
|
+
done(error);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
it('error.json should have standard adapter errors', (done) => {
|
|
700
|
+
try {
|
|
701
|
+
const errorDotJson = require('../../error.json');
|
|
702
|
+
assert.notEqual(undefined, errorDotJson.errors);
|
|
703
|
+
assert.notEqual(null, errorDotJson.errors);
|
|
704
|
+
assert.notEqual('', errorDotJson.errors);
|
|
705
|
+
assert.equal(true, Array.isArray(errorDotJson.errors));
|
|
706
|
+
assert.notEqual(0, errorDotJson.errors.length);
|
|
707
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
|
|
708
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
|
|
709
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
|
|
710
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
|
|
711
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
|
|
712
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
|
|
713
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
|
|
714
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
|
|
715
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
|
|
716
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
|
|
717
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
|
|
718
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
|
|
719
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
|
|
720
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
|
|
721
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
|
|
722
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
|
|
723
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
|
|
724
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
|
|
725
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
|
|
726
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
|
|
727
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
|
|
728
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
|
|
729
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
|
|
730
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
|
|
731
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
|
|
732
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
|
|
733
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
|
|
734
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
|
|
735
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
|
|
736
|
+
assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
|
|
737
|
+
done();
|
|
738
|
+
} catch (error) {
|
|
739
|
+
log.error(`Test Failure: ${error}`);
|
|
740
|
+
done(error);
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
describe('sampleProperties.json', () => {
|
|
746
|
+
it('should have a sampleProperties.json', (done) => {
|
|
747
|
+
try {
|
|
748
|
+
fs.exists('sampleProperties.json', (val) => {
|
|
749
|
+
assert.equal(true, val);
|
|
750
|
+
done();
|
|
751
|
+
});
|
|
752
|
+
} catch (error) {
|
|
753
|
+
log.error(`Test Failure: ${error}`);
|
|
754
|
+
done(error);
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
it('sampleProperties.json should contain generic adapter properties', (done) => {
|
|
758
|
+
try {
|
|
759
|
+
const sampleDotJson = require('../../sampleProperties.json');
|
|
760
|
+
assert.notEqual(-1, sampleDotJson.id.indexOf('splunk'));
|
|
761
|
+
assert.equal('Splunk', sampleDotJson.type);
|
|
762
|
+
assert.notEqual(undefined, sampleDotJson.properties);
|
|
763
|
+
assert.notEqual(null, sampleDotJson.properties);
|
|
764
|
+
assert.notEqual('', sampleDotJson.properties);
|
|
765
|
+
assert.notEqual(undefined, sampleDotJson.properties.host);
|
|
766
|
+
assert.notEqual(undefined, sampleDotJson.properties.port);
|
|
767
|
+
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
768
|
+
assert.notEqual(undefined, sampleDotJson.properties.protocol);
|
|
769
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication);
|
|
770
|
+
assert.notEqual(null, sampleDotJson.properties.authentication);
|
|
771
|
+
assert.notEqual('', sampleDotJson.properties.authentication);
|
|
772
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
|
|
773
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
|
|
774
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
|
|
775
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
|
|
776
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
|
|
777
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
|
|
778
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
|
|
779
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
|
|
780
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
|
|
781
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
|
|
782
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
|
|
783
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
|
|
784
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
|
|
785
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl);
|
|
786
|
+
assert.notEqual(null, sampleDotJson.properties.ssl);
|
|
787
|
+
assert.notEqual('', sampleDotJson.properties.ssl);
|
|
788
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
|
|
789
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
|
|
790
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
|
|
791
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
|
|
792
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
|
|
793
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
|
|
794
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
|
|
795
|
+
assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
|
|
796
|
+
assert.notEqual(undefined, sampleDotJson.properties.base_path);
|
|
797
|
+
assert.notEqual(undefined, sampleDotJson.properties.version);
|
|
798
|
+
assert.notEqual(undefined, sampleDotJson.properties.cache_location);
|
|
799
|
+
assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
|
|
800
|
+
assert.notEqual(undefined, sampleDotJson.properties.encode_queryvars);
|
|
801
|
+
assert.notEqual(undefined, sampleDotJson.properties.save_metric);
|
|
802
|
+
assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
|
|
803
|
+
assert.notEqual(null, sampleDotJson.properties.healthcheck);
|
|
804
|
+
assert.notEqual('', sampleDotJson.properties.healthcheck);
|
|
805
|
+
assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
|
|
806
|
+
assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
|
|
807
|
+
assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
|
|
808
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle);
|
|
809
|
+
assert.notEqual(null, sampleDotJson.properties.throttle);
|
|
810
|
+
assert.notEqual('', sampleDotJson.properties.throttle);
|
|
811
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
|
|
812
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
|
|
813
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
|
|
814
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
|
|
815
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
|
|
816
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
|
|
817
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
|
|
818
|
+
assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
|
|
819
|
+
assert.notEqual(undefined, sampleDotJson.properties.request);
|
|
820
|
+
assert.notEqual(null, sampleDotJson.properties.request);
|
|
821
|
+
assert.notEqual('', sampleDotJson.properties.request);
|
|
822
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
|
|
823
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
|
|
824
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
|
|
825
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
|
|
826
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
|
|
827
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
|
|
828
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
|
|
829
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
|
|
830
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
|
|
831
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
|
|
832
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
|
|
833
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
|
|
834
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
|
|
835
|
+
assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
|
|
836
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy);
|
|
837
|
+
assert.notEqual(null, sampleDotJson.properties.proxy);
|
|
838
|
+
assert.notEqual('', sampleDotJson.properties.proxy);
|
|
839
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
|
|
840
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
|
|
841
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
|
|
842
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
|
|
843
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
|
|
844
|
+
assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
|
|
845
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo);
|
|
846
|
+
assert.notEqual(null, sampleDotJson.properties.mongo);
|
|
847
|
+
assert.notEqual('', sampleDotJson.properties.mongo);
|
|
848
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
|
|
849
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
|
|
850
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
|
|
851
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
|
|
852
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
|
|
853
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
|
|
854
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
|
|
855
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
|
|
856
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
|
|
857
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
|
|
858
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
|
|
859
|
+
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
|
|
860
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker);
|
|
861
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevice);
|
|
862
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevicesFiltered);
|
|
863
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.isAlive);
|
|
864
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getConfig);
|
|
865
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getCount);
|
|
866
|
+
done();
|
|
867
|
+
} catch (error) {
|
|
868
|
+
log.error(`Test Failure: ${error}`);
|
|
869
|
+
done(error);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
describe('#checkProperties', () => {
|
|
875
|
+
it('should have a checkProperties function', (done) => {
|
|
876
|
+
try {
|
|
877
|
+
assert.equal(true, typeof a.checkProperties === 'function');
|
|
878
|
+
done();
|
|
879
|
+
} catch (error) {
|
|
880
|
+
log.error(`Test Failure: ${error}`);
|
|
881
|
+
done(error);
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
it('the sample properties should be good - if failure change the log level', (done) => {
|
|
885
|
+
try {
|
|
886
|
+
const samplePropsJson = require('../../sampleProperties.json');
|
|
887
|
+
const clean = a.checkProperties(samplePropsJson.properties);
|
|
888
|
+
|
|
889
|
+
try {
|
|
890
|
+
assert.notEqual(0, Object.keys(clean));
|
|
891
|
+
assert.equal(undefined, clean.exception);
|
|
892
|
+
assert.notEqual(undefined, clean.host);
|
|
893
|
+
assert.notEqual(null, clean.host);
|
|
894
|
+
assert.notEqual('', clean.host);
|
|
895
|
+
done();
|
|
896
|
+
} catch (err) {
|
|
897
|
+
log.error(`Test Failure: ${err}`);
|
|
898
|
+
done(err);
|
|
899
|
+
}
|
|
900
|
+
} catch (error) {
|
|
901
|
+
log.error(`Adapter Exception: ${error}`);
|
|
902
|
+
done(error);
|
|
903
|
+
}
|
|
904
|
+
}).timeout(attemptTimeout);
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
describe('README.md', () => {
|
|
908
|
+
it('should have a README', (done) => {
|
|
909
|
+
try {
|
|
910
|
+
fs.exists('README.md', (val) => {
|
|
911
|
+
assert.equal(true, val);
|
|
912
|
+
done();
|
|
913
|
+
});
|
|
914
|
+
} catch (error) {
|
|
915
|
+
log.error(`Test Failure: ${error}`);
|
|
916
|
+
done(error);
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
it('README.md should be customized', (done) => {
|
|
920
|
+
try {
|
|
921
|
+
fs.readFile('README.md', 'utf8', (err, data) => {
|
|
922
|
+
assert.equal(-1, data.indexOf('[System]'));
|
|
923
|
+
assert.equal(-1, data.indexOf('[system]'));
|
|
924
|
+
assert.equal(-1, data.indexOf('[version]'));
|
|
925
|
+
assert.equal(-1, data.indexOf('[namespace]'));
|
|
926
|
+
done();
|
|
927
|
+
});
|
|
928
|
+
} catch (error) {
|
|
929
|
+
log.error(`Test Failure: ${error}`);
|
|
930
|
+
done(error);
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
describe('#connect', () => {
|
|
936
|
+
it('should have a connect function', (done) => {
|
|
937
|
+
try {
|
|
938
|
+
assert.equal(true, typeof a.connect === 'function');
|
|
939
|
+
done();
|
|
940
|
+
} catch (error) {
|
|
941
|
+
log.error(`Test Failure: ${error}`);
|
|
942
|
+
done(error);
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
describe('#healthCheck', () => {
|
|
948
|
+
it('should have a healthCheck function', (done) => {
|
|
949
|
+
try {
|
|
950
|
+
assert.equal(true, typeof a.healthCheck === 'function');
|
|
951
|
+
done();
|
|
952
|
+
} catch (error) {
|
|
953
|
+
log.error(`Test Failure: ${error}`);
|
|
954
|
+
done(error);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
describe('#iapUpdateAdapterConfiguration', () => {
|
|
960
|
+
it('should have a iapUpdateAdapterConfiguration function', (done) => {
|
|
961
|
+
try {
|
|
962
|
+
assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
|
|
963
|
+
done();
|
|
964
|
+
} catch (error) {
|
|
965
|
+
log.error(`Test Failure: ${error}`);
|
|
966
|
+
done(error);
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
describe('#iapFindAdapterPath', () => {
|
|
972
|
+
it('should have a iapFindAdapterPath function', (done) => {
|
|
973
|
+
try {
|
|
974
|
+
assert.equal(true, typeof a.iapFindAdapterPath === 'function');
|
|
975
|
+
done();
|
|
976
|
+
} catch (error) {
|
|
977
|
+
log.error(`Test Failure: ${error}`);
|
|
978
|
+
done(error);
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
it('iapFindAdapterPath should find atleast one path that matches', (done) => {
|
|
982
|
+
try {
|
|
983
|
+
a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
|
|
984
|
+
try {
|
|
985
|
+
assert.equal(undefined, error);
|
|
986
|
+
assert.notEqual(undefined, data);
|
|
987
|
+
assert.notEqual(null, data);
|
|
988
|
+
assert.equal(true, data.found);
|
|
989
|
+
assert.notEqual(undefined, data.foundIn);
|
|
990
|
+
assert.notEqual(null, data.foundIn);
|
|
991
|
+
assert.notEqual(0, data.foundIn.length);
|
|
992
|
+
done();
|
|
993
|
+
} catch (err) {
|
|
994
|
+
log.error(`Test Failure: ${err}`);
|
|
995
|
+
done(err);
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
} catch (error) {
|
|
999
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1000
|
+
done(error);
|
|
1001
|
+
}
|
|
1002
|
+
}).timeout(attemptTimeout);
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
describe('#iapSuspendAdapter', () => {
|
|
1006
|
+
it('should have a iapSuspendAdapter function', (done) => {
|
|
1007
|
+
try {
|
|
1008
|
+
assert.equal(true, typeof a.iapSuspendAdapter === 'function');
|
|
1009
|
+
done();
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
log.error(`Test Failure: ${error}`);
|
|
1012
|
+
done(error);
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
describe('#iapUnsuspendAdapter', () => {
|
|
1018
|
+
it('should have a iapUnsuspendAdapter function', (done) => {
|
|
1019
|
+
try {
|
|
1020
|
+
assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
|
|
1021
|
+
done();
|
|
1022
|
+
} catch (error) {
|
|
1023
|
+
log.error(`Test Failure: ${error}`);
|
|
1024
|
+
done(error);
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
describe('#iapGetAdapterQueue', () => {
|
|
1030
|
+
it('should have a iapGetAdapterQueue function', (done) => {
|
|
1031
|
+
try {
|
|
1032
|
+
assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
|
|
1033
|
+
done();
|
|
1034
|
+
} catch (error) {
|
|
1035
|
+
log.error(`Test Failure: ${error}`);
|
|
1036
|
+
done(error);
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
describe('#iapTroubleshootAdapter', () => {
|
|
1042
|
+
it('should have a iapTroubleshootAdapter function', (done) => {
|
|
1043
|
+
try {
|
|
1044
|
+
assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
|
|
1045
|
+
done();
|
|
1046
|
+
} catch (error) {
|
|
1047
|
+
log.error(`Test Failure: ${error}`);
|
|
1048
|
+
done(error);
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
describe('#iapRunAdapterHealthcheck', () => {
|
|
1054
|
+
it('should have a iapRunAdapterHealthcheck function', (done) => {
|
|
1055
|
+
try {
|
|
1056
|
+
assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
|
|
1057
|
+
done();
|
|
1058
|
+
} catch (error) {
|
|
1059
|
+
log.error(`Test Failure: ${error}`);
|
|
1060
|
+
done(error);
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
describe('#iapRunAdapterConnectivity', () => {
|
|
1066
|
+
it('should have a iapRunAdapterConnectivity function', (done) => {
|
|
1067
|
+
try {
|
|
1068
|
+
assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
|
|
1069
|
+
done();
|
|
1070
|
+
} catch (error) {
|
|
1071
|
+
log.error(`Test Failure: ${error}`);
|
|
1072
|
+
done(error);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
describe('#iapRunAdapterBasicGet', () => {
|
|
1078
|
+
it('should have a iapRunAdapterBasicGet function', (done) => {
|
|
1079
|
+
try {
|
|
1080
|
+
assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
|
|
1081
|
+
done();
|
|
1082
|
+
} catch (error) {
|
|
1083
|
+
log.error(`Test Failure: ${error}`);
|
|
1084
|
+
done(error);
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
describe('#iapMoveAdapterEntitiesToDB', () => {
|
|
1090
|
+
it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
|
|
1091
|
+
try {
|
|
1092
|
+
assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
|
|
1093
|
+
done();
|
|
1094
|
+
} catch (error) {
|
|
1095
|
+
log.error(`Test Failure: ${error}`);
|
|
1096
|
+
done(error);
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
describe('#checkActionFiles', () => {
|
|
1102
|
+
it('should have a checkActionFiles function', (done) => {
|
|
1103
|
+
try {
|
|
1104
|
+
assert.equal(true, typeof a.checkActionFiles === 'function');
|
|
1105
|
+
done();
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
log.error(`Test Failure: ${error}`);
|
|
1108
|
+
done(error);
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
it('the action files should be good - if failure change the log level as most issues are warnings', (done) => {
|
|
1112
|
+
try {
|
|
1113
|
+
const clean = a.checkActionFiles();
|
|
1114
|
+
|
|
1115
|
+
try {
|
|
1116
|
+
for (let c = 0; c < clean.length; c += 1) {
|
|
1117
|
+
log.error(clean[c]);
|
|
1118
|
+
}
|
|
1119
|
+
assert.equal(0, clean.length);
|
|
1120
|
+
done();
|
|
1121
|
+
} catch (err) {
|
|
1122
|
+
log.error(`Test Failure: ${err}`);
|
|
1123
|
+
done(err);
|
|
1124
|
+
}
|
|
1125
|
+
} catch (error) {
|
|
1126
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1127
|
+
done(error);
|
|
1128
|
+
}
|
|
1129
|
+
}).timeout(attemptTimeout);
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
describe('#encryptProperty', () => {
|
|
1133
|
+
it('should have a encryptProperty function', (done) => {
|
|
1134
|
+
try {
|
|
1135
|
+
assert.equal(true, typeof a.encryptProperty === 'function');
|
|
1136
|
+
done();
|
|
1137
|
+
} catch (error) {
|
|
1138
|
+
log.error(`Test Failure: ${error}`);
|
|
1139
|
+
done(error);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
it('should get base64 encoded property', (done) => {
|
|
1143
|
+
try {
|
|
1144
|
+
a.encryptProperty('testing', 'base64', (data, error) => {
|
|
1145
|
+
try {
|
|
1146
|
+
assert.equal(undefined, error);
|
|
1147
|
+
assert.notEqual(undefined, data);
|
|
1148
|
+
assert.notEqual(null, data);
|
|
1149
|
+
assert.notEqual(undefined, data.response);
|
|
1150
|
+
assert.notEqual(null, data.response);
|
|
1151
|
+
assert.equal(0, data.response.indexOf('{code}'));
|
|
1152
|
+
done();
|
|
1153
|
+
} catch (err) {
|
|
1154
|
+
log.error(`Test Failure: ${err}`);
|
|
1155
|
+
done(err);
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
} catch (error) {
|
|
1159
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1160
|
+
done(error);
|
|
1161
|
+
}
|
|
1162
|
+
}).timeout(attemptTimeout);
|
|
1163
|
+
it('should get encrypted property', (done) => {
|
|
1164
|
+
try {
|
|
1165
|
+
a.encryptProperty('testing', 'encrypt', (data, error) => {
|
|
1166
|
+
try {
|
|
1167
|
+
assert.equal(undefined, error);
|
|
1168
|
+
assert.notEqual(undefined, data);
|
|
1169
|
+
assert.notEqual(null, data);
|
|
1170
|
+
assert.notEqual(undefined, data.response);
|
|
1171
|
+
assert.notEqual(null, data.response);
|
|
1172
|
+
assert.equal(0, data.response.indexOf('{crypt}'));
|
|
1173
|
+
done();
|
|
1174
|
+
} catch (err) {
|
|
1175
|
+
log.error(`Test Failure: ${err}`);
|
|
1176
|
+
done(err);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
} catch (error) {
|
|
1180
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1181
|
+
done(error);
|
|
1182
|
+
}
|
|
1183
|
+
}).timeout(attemptTimeout);
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
// describe('#iapHasAdapterEntity', () => {
|
|
1187
|
+
// it('should have a iapHasAdapterEntity function', (done) => {
|
|
1188
|
+
// try {
|
|
1189
|
+
// assert.equal(true, typeof a.iapHasAdapterEntity === 'function');
|
|
1190
|
+
// done();
|
|
1191
|
+
// } catch (error) {
|
|
1192
|
+
// log.error(`Test Failure: ${error}`);
|
|
1193
|
+
// done(error);
|
|
1194
|
+
// }
|
|
1195
|
+
// });
|
|
1196
|
+
// it('should find entity', (done) => {
|
|
1197
|
+
// try {
|
|
1198
|
+
// a.iapHasAdapterEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
|
|
1199
|
+
// try {
|
|
1200
|
+
// assert.equal(true, data[0]);
|
|
1201
|
+
// done();
|
|
1202
|
+
// } catch (err) {
|
|
1203
|
+
// log.error(`Test Failure: ${err}`);
|
|
1204
|
+
// done(err);
|
|
1205
|
+
// }
|
|
1206
|
+
// });
|
|
1207
|
+
// } catch (error) {
|
|
1208
|
+
// log.error(`Adapter Exception: ${error}`);
|
|
1209
|
+
// done(error);
|
|
1210
|
+
// }
|
|
1211
|
+
// }).timeout(attemptTimeout);
|
|
1212
|
+
// it('should not find entity', (done) => {
|
|
1213
|
+
// try {
|
|
1214
|
+
// a.iapHasAdapterEntity('template_entity', 'blah', (data) => {
|
|
1215
|
+
// try {
|
|
1216
|
+
// assert.equal(false, data[0]);
|
|
1217
|
+
// done();
|
|
1218
|
+
// } catch (err) {
|
|
1219
|
+
// log.error(`Test Failure: ${err}`);
|
|
1220
|
+
// done(err);
|
|
1221
|
+
// }
|
|
1222
|
+
// });
|
|
1223
|
+
// } catch (error) {
|
|
1224
|
+
// log.error(`Adapter Exception: ${error}`);
|
|
1225
|
+
// done(error);
|
|
1226
|
+
// }
|
|
1227
|
+
// }).timeout(attemptTimeout);
|
|
1228
|
+
// });
|
|
1229
|
+
|
|
1230
|
+
describe('#hasEntities', () => {
|
|
1231
|
+
it('should have a hasEntities function', (done) => {
|
|
1232
|
+
try {
|
|
1233
|
+
assert.equal(true, typeof a.hasEntities === 'function');
|
|
1234
|
+
done();
|
|
1235
|
+
} catch (error) {
|
|
1236
|
+
log.error(`Test Failure: ${error}`);
|
|
1237
|
+
done(error);
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
describe('#getDevice', () => {
|
|
1243
|
+
it('should have a getDevice function', (done) => {
|
|
1244
|
+
try {
|
|
1245
|
+
assert.equal(true, typeof a.getDevice === 'function');
|
|
1246
|
+
done();
|
|
1247
|
+
} catch (error) {
|
|
1248
|
+
log.error(`Test Failure: ${error}`);
|
|
1249
|
+
done(error);
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
describe('#getDevicesFiltered', () => {
|
|
1255
|
+
it('should have a getDevicesFiltered function', (done) => {
|
|
1256
|
+
try {
|
|
1257
|
+
assert.equal(true, typeof a.getDevicesFiltered === 'function');
|
|
1258
|
+
done();
|
|
1259
|
+
} catch (error) {
|
|
1260
|
+
log.error(`Test Failure: ${error}`);
|
|
1261
|
+
done(error);
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
describe('#isAlive', () => {
|
|
1267
|
+
it('should have a isAlive function', (done) => {
|
|
1268
|
+
try {
|
|
1269
|
+
assert.equal(true, typeof a.isAlive === 'function');
|
|
1270
|
+
done();
|
|
1271
|
+
} catch (error) {
|
|
1272
|
+
log.error(`Test Failure: ${error}`);
|
|
1273
|
+
done(error);
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
describe('#getConfig', () => {
|
|
1279
|
+
it('should have a getConfig function', (done) => {
|
|
1280
|
+
try {
|
|
1281
|
+
assert.equal(true, typeof a.getConfig === 'function');
|
|
1282
|
+
done();
|
|
1283
|
+
} catch (error) {
|
|
1284
|
+
log.error(`Test Failure: ${error}`);
|
|
1285
|
+
done(error);
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
|
|
1290
|
+
describe('#iapGetDeviceCount', () => {
|
|
1291
|
+
it('should have a iapGetDeviceCount function', (done) => {
|
|
1292
|
+
try {
|
|
1293
|
+
assert.equal(true, typeof a.iapGetDeviceCount === 'function');
|
|
1294
|
+
done();
|
|
1295
|
+
} catch (error) {
|
|
1296
|
+
log.error(`Test Failure: ${error}`);
|
|
1297
|
+
done(error);
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
});
|
|
1301
|
+
|
|
1302
|
+
/*
|
|
1303
|
+
-----------------------------------------------------------------------
|
|
1304
|
+
-----------------------------------------------------------------------
|
|
1305
|
+
*** All code above this comment will be replaced during a migration ***
|
|
1306
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
1307
|
+
-----------------------------------------------------------------------
|
|
1308
|
+
-----------------------------------------------------------------------
|
|
1309
|
+
*/
|
|
1310
|
+
|
|
1311
|
+
describe('#getDataCommandsByName - errors', () => {
|
|
1312
|
+
it('should have a getDataCommandsByName function', (done) => {
|
|
1313
|
+
try {
|
|
1314
|
+
assert.equal(true, typeof a.getDataCommandsByName === 'function');
|
|
1315
|
+
done();
|
|
1316
|
+
} catch (error) {
|
|
1317
|
+
log.error(`Test Failure: ${error}`);
|
|
1318
|
+
done(error);
|
|
1319
|
+
}
|
|
1320
|
+
}).timeout(attemptTimeout);
|
|
1321
|
+
it('should error if - missing name', (done) => {
|
|
1322
|
+
try {
|
|
1323
|
+
a.getDataCommandsByName(null, (data, error) => {
|
|
1324
|
+
try {
|
|
1325
|
+
const displayE = 'name is required';
|
|
1326
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getDataCommandsByName', displayE);
|
|
1327
|
+
done();
|
|
1328
|
+
} catch (err) {
|
|
1329
|
+
log.error(`Test Failure: ${err}`);
|
|
1330
|
+
done(err);
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
} catch (error) {
|
|
1334
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1335
|
+
done(error);
|
|
1336
|
+
}
|
|
1337
|
+
}).timeout(attemptTimeout);
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
describe('#getSavedSearches - errors', () => {
|
|
1341
|
+
it('should have a getSavedSearches function', (done) => {
|
|
1342
|
+
try {
|
|
1343
|
+
assert.equal(true, typeof a.getSavedSearches === 'function');
|
|
1344
|
+
done();
|
|
1345
|
+
} catch (error) {
|
|
1346
|
+
log.error(`Test Failure: ${error}`);
|
|
1347
|
+
done(error);
|
|
1348
|
+
}
|
|
1349
|
+
}).timeout(attemptTimeout);
|
|
1350
|
+
it('should error if - missing earliestTime10202022', (done) => {
|
|
1351
|
+
try {
|
|
1352
|
+
a.getSavedSearches(null, null, null, null, (data, error) => {
|
|
1353
|
+
try {
|
|
1354
|
+
const displayE = 'earliestTime10202022 is required';
|
|
1355
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearches', displayE);
|
|
1356
|
+
done();
|
|
1357
|
+
} catch (err) {
|
|
1358
|
+
log.error(`Test Failure: ${err}`);
|
|
1359
|
+
done(err);
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
} catch (error) {
|
|
1363
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1364
|
+
done(error);
|
|
1365
|
+
}
|
|
1366
|
+
}).timeout(attemptTimeout);
|
|
1367
|
+
it('should error if - missing latestTime', (done) => {
|
|
1368
|
+
try {
|
|
1369
|
+
a.getSavedSearches('fakeparam', null, null, null, (data, error) => {
|
|
1370
|
+
try {
|
|
1371
|
+
const displayE = 'latestTime is required';
|
|
1372
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearches', displayE);
|
|
1373
|
+
done();
|
|
1374
|
+
} catch (err) {
|
|
1375
|
+
log.error(`Test Failure: ${err}`);
|
|
1376
|
+
done(err);
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
} catch (error) {
|
|
1380
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1381
|
+
done(error);
|
|
1382
|
+
}
|
|
1383
|
+
}).timeout(attemptTimeout);
|
|
1384
|
+
it('should error if - missing listDefaultActionArgs', (done) => {
|
|
1385
|
+
try {
|
|
1386
|
+
a.getSavedSearches('fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
1387
|
+
try {
|
|
1388
|
+
const displayE = 'listDefaultActionArgs is required';
|
|
1389
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearches', displayE);
|
|
1390
|
+
done();
|
|
1391
|
+
} catch (err) {
|
|
1392
|
+
log.error(`Test Failure: ${err}`);
|
|
1393
|
+
done(err);
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
} catch (error) {
|
|
1397
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1398
|
+
done(error);
|
|
1399
|
+
}
|
|
1400
|
+
}).timeout(attemptTimeout);
|
|
1401
|
+
it('should error if - missing addOrphanField', (done) => {
|
|
1402
|
+
try {
|
|
1403
|
+
a.getSavedSearches('fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
1404
|
+
try {
|
|
1405
|
+
const displayE = 'addOrphanField is required';
|
|
1406
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearches', displayE);
|
|
1407
|
+
done();
|
|
1408
|
+
} catch (err) {
|
|
1409
|
+
log.error(`Test Failure: ${err}`);
|
|
1410
|
+
done(err);
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1415
|
+
done(error);
|
|
1416
|
+
}
|
|
1417
|
+
}).timeout(attemptTimeout);
|
|
1418
|
+
});
|
|
1419
|
+
|
|
1420
|
+
describe('#deleteSavedSearchesByName - errors', () => {
|
|
1421
|
+
it('should have a deleteSavedSearchesByName function', (done) => {
|
|
1422
|
+
try {
|
|
1423
|
+
assert.equal(true, typeof a.deleteSavedSearchesByName === 'function');
|
|
1424
|
+
done();
|
|
1425
|
+
} catch (error) {
|
|
1426
|
+
log.error(`Test Failure: ${error}`);
|
|
1427
|
+
done(error);
|
|
1428
|
+
}
|
|
1429
|
+
}).timeout(attemptTimeout);
|
|
1430
|
+
it('should error if - missing name', (done) => {
|
|
1431
|
+
try {
|
|
1432
|
+
a.deleteSavedSearchesByName(null, null, (data, error) => {
|
|
1433
|
+
try {
|
|
1434
|
+
const displayE = 'name is required';
|
|
1435
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-deleteSavedSearchesByName', displayE);
|
|
1436
|
+
done();
|
|
1437
|
+
} catch (err) {
|
|
1438
|
+
log.error(`Test Failure: ${err}`);
|
|
1439
|
+
done(err);
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
} catch (error) {
|
|
1443
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1444
|
+
done(error);
|
|
1445
|
+
}
|
|
1446
|
+
}).timeout(attemptTimeout);
|
|
1447
|
+
});
|
|
1448
|
+
|
|
1449
|
+
describe('#getSavedSearchesByName - errors', () => {
|
|
1450
|
+
it('should have a getSavedSearchesByName function', (done) => {
|
|
1451
|
+
try {
|
|
1452
|
+
assert.equal(true, typeof a.getSavedSearchesByName === 'function');
|
|
1453
|
+
done();
|
|
1454
|
+
} catch (error) {
|
|
1455
|
+
log.error(`Test Failure: ${error}`);
|
|
1456
|
+
done(error);
|
|
1457
|
+
}
|
|
1458
|
+
}).timeout(attemptTimeout);
|
|
1459
|
+
it('should error if - missing name', (done) => {
|
|
1460
|
+
try {
|
|
1461
|
+
a.getSavedSearchesByName(null, null, null, null, null, (data, error) => {
|
|
1462
|
+
try {
|
|
1463
|
+
const displayE = 'name is required';
|
|
1464
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesByName', displayE);
|
|
1465
|
+
done();
|
|
1466
|
+
} catch (err) {
|
|
1467
|
+
log.error(`Test Failure: ${err}`);
|
|
1468
|
+
done(err);
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
} catch (error) {
|
|
1472
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1473
|
+
done(error);
|
|
1474
|
+
}
|
|
1475
|
+
}).timeout(attemptTimeout);
|
|
1476
|
+
it('should error if - missing earliestTime10202022', (done) => {
|
|
1477
|
+
try {
|
|
1478
|
+
a.getSavedSearchesByName('fakeparam', null, null, null, null, (data, error) => {
|
|
1479
|
+
try {
|
|
1480
|
+
const displayE = 'earliestTime10202022 is required';
|
|
1481
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesByName', displayE);
|
|
1482
|
+
done();
|
|
1483
|
+
} catch (err) {
|
|
1484
|
+
log.error(`Test Failure: ${err}`);
|
|
1485
|
+
done(err);
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
} catch (error) {
|
|
1489
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1490
|
+
done(error);
|
|
1491
|
+
}
|
|
1492
|
+
}).timeout(attemptTimeout);
|
|
1493
|
+
it('should error if - missing latestTime', (done) => {
|
|
1494
|
+
try {
|
|
1495
|
+
a.getSavedSearchesByName('fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
1496
|
+
try {
|
|
1497
|
+
const displayE = 'latestTime is required';
|
|
1498
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesByName', displayE);
|
|
1499
|
+
done();
|
|
1500
|
+
} catch (err) {
|
|
1501
|
+
log.error(`Test Failure: ${err}`);
|
|
1502
|
+
done(err);
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
} catch (error) {
|
|
1506
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1507
|
+
done(error);
|
|
1508
|
+
}
|
|
1509
|
+
}).timeout(attemptTimeout);
|
|
1510
|
+
it('should error if - missing listDefaultActionArgs', (done) => {
|
|
1511
|
+
try {
|
|
1512
|
+
a.getSavedSearchesByName('fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
1513
|
+
try {
|
|
1514
|
+
const displayE = 'listDefaultActionArgs is required';
|
|
1515
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesByName', displayE);
|
|
1516
|
+
done();
|
|
1517
|
+
} catch (err) {
|
|
1518
|
+
log.error(`Test Failure: ${err}`);
|
|
1519
|
+
done(err);
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
} catch (error) {
|
|
1523
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1524
|
+
done(error);
|
|
1525
|
+
}
|
|
1526
|
+
}).timeout(attemptTimeout);
|
|
1527
|
+
it('should error if - missing addOrphanField', (done) => {
|
|
1528
|
+
try {
|
|
1529
|
+
a.getSavedSearchesByName('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
1530
|
+
try {
|
|
1531
|
+
const displayE = 'addOrphanField is required';
|
|
1532
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesByName', displayE);
|
|
1533
|
+
done();
|
|
1534
|
+
} catch (err) {
|
|
1535
|
+
log.error(`Test Failure: ${err}`);
|
|
1536
|
+
done(err);
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
} catch (error) {
|
|
1540
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1541
|
+
done(error);
|
|
1542
|
+
}
|
|
1543
|
+
}).timeout(attemptTimeout);
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
describe('#postSavedSearches - errors', () => {
|
|
1547
|
+
it('should have a postSavedSearches function', (done) => {
|
|
1548
|
+
try {
|
|
1549
|
+
assert.equal(true, typeof a.postSavedSearches === 'function');
|
|
1550
|
+
done();
|
|
1551
|
+
} catch (error) {
|
|
1552
|
+
log.error(`Test Failure: ${error}`);
|
|
1553
|
+
done(error);
|
|
1554
|
+
}
|
|
1555
|
+
}).timeout(attemptTimeout);
|
|
1556
|
+
it('should error if - missing name', (done) => {
|
|
1557
|
+
try {
|
|
1558
|
+
a.postSavedSearches(null, null, (data, error) => {
|
|
1559
|
+
try {
|
|
1560
|
+
const displayE = 'name is required';
|
|
1561
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearches', displayE);
|
|
1562
|
+
done();
|
|
1563
|
+
} catch (err) {
|
|
1564
|
+
log.error(`Test Failure: ${err}`);
|
|
1565
|
+
done(err);
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
} catch (error) {
|
|
1569
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1570
|
+
done(error);
|
|
1571
|
+
}
|
|
1572
|
+
}).timeout(attemptTimeout);
|
|
1573
|
+
it('should error if - missing body', (done) => {
|
|
1574
|
+
try {
|
|
1575
|
+
a.postSavedSearches('fakeparam', null, (data, error) => {
|
|
1576
|
+
try {
|
|
1577
|
+
const displayE = 'body is required';
|
|
1578
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearches', displayE);
|
|
1579
|
+
done();
|
|
1580
|
+
} catch (err) {
|
|
1581
|
+
log.error(`Test Failure: ${err}`);
|
|
1582
|
+
done(err);
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
} catch (error) {
|
|
1586
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1587
|
+
done(error);
|
|
1588
|
+
}
|
|
1589
|
+
}).timeout(attemptTimeout);
|
|
1590
|
+
});
|
|
1591
|
+
|
|
1592
|
+
describe('#postSavedSearchesAcknowledge - errors', () => {
|
|
1593
|
+
it('should have a postSavedSearchesAcknowledge function', (done) => {
|
|
1594
|
+
try {
|
|
1595
|
+
assert.equal(true, typeof a.postSavedSearchesAcknowledge === 'function');
|
|
1596
|
+
done();
|
|
1597
|
+
} catch (error) {
|
|
1598
|
+
log.error(`Test Failure: ${error}`);
|
|
1599
|
+
done(error);
|
|
1600
|
+
}
|
|
1601
|
+
}).timeout(attemptTimeout);
|
|
1602
|
+
it('should error if - missing name', (done) => {
|
|
1603
|
+
try {
|
|
1604
|
+
a.postSavedSearchesAcknowledge(null, null, (data, error) => {
|
|
1605
|
+
try {
|
|
1606
|
+
const displayE = 'name is required';
|
|
1607
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesAcknowledge', displayE);
|
|
1608
|
+
done();
|
|
1609
|
+
} catch (err) {
|
|
1610
|
+
log.error(`Test Failure: ${err}`);
|
|
1611
|
+
done(err);
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
} catch (error) {
|
|
1615
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1616
|
+
done(error);
|
|
1617
|
+
}
|
|
1618
|
+
}).timeout(attemptTimeout);
|
|
1619
|
+
it('should error if - missing body', (done) => {
|
|
1620
|
+
try {
|
|
1621
|
+
a.postSavedSearchesAcknowledge('fakeparam', null, (data, error) => {
|
|
1622
|
+
try {
|
|
1623
|
+
const displayE = 'body is required';
|
|
1624
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesAcknowledge', displayE);
|
|
1625
|
+
done();
|
|
1626
|
+
} catch (err) {
|
|
1627
|
+
log.error(`Test Failure: ${err}`);
|
|
1628
|
+
done(err);
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
} catch (error) {
|
|
1632
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1633
|
+
done(error);
|
|
1634
|
+
}
|
|
1635
|
+
}).timeout(attemptTimeout);
|
|
1636
|
+
});
|
|
1637
|
+
|
|
1638
|
+
describe('#postSavedSearchesDispatchByName - errors', () => {
|
|
1639
|
+
it('should have a postSavedSearchesDispatchByName function', (done) => {
|
|
1640
|
+
try {
|
|
1641
|
+
assert.equal(true, typeof a.postSavedSearchesDispatchByName === 'function');
|
|
1642
|
+
done();
|
|
1643
|
+
} catch (error) {
|
|
1644
|
+
log.error(`Test Failure: ${error}`);
|
|
1645
|
+
done(error);
|
|
1646
|
+
}
|
|
1647
|
+
}).timeout(attemptTimeout);
|
|
1648
|
+
it('should error if - missing name', (done) => {
|
|
1649
|
+
try {
|
|
1650
|
+
a.postSavedSearchesDispatchByName(null, null, (data, error) => {
|
|
1651
|
+
try {
|
|
1652
|
+
const displayE = 'name is required';
|
|
1653
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesDispatchByName', displayE);
|
|
1654
|
+
done();
|
|
1655
|
+
} catch (err) {
|
|
1656
|
+
log.error(`Test Failure: ${err}`);
|
|
1657
|
+
done(err);
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1662
|
+
done(error);
|
|
1663
|
+
}
|
|
1664
|
+
}).timeout(attemptTimeout);
|
|
1665
|
+
it('should error if - missing body', (done) => {
|
|
1666
|
+
try {
|
|
1667
|
+
a.postSavedSearchesDispatchByName('fakeparam', null, (data, error) => {
|
|
1668
|
+
try {
|
|
1669
|
+
const displayE = 'body is required';
|
|
1670
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesDispatchByName', displayE);
|
|
1671
|
+
done();
|
|
1672
|
+
} catch (err) {
|
|
1673
|
+
log.error(`Test Failure: ${err}`);
|
|
1674
|
+
done(err);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
} catch (error) {
|
|
1678
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1679
|
+
done(error);
|
|
1680
|
+
}
|
|
1681
|
+
}).timeout(attemptTimeout);
|
|
1682
|
+
});
|
|
1683
|
+
|
|
1684
|
+
describe('#getSavedSearchesHistoryByName - errors', () => {
|
|
1685
|
+
it('should have a getSavedSearchesHistoryByName function', (done) => {
|
|
1686
|
+
try {
|
|
1687
|
+
assert.equal(true, typeof a.getSavedSearchesHistoryByName === 'function');
|
|
1688
|
+
done();
|
|
1689
|
+
} catch (error) {
|
|
1690
|
+
log.error(`Test Failure: ${error}`);
|
|
1691
|
+
done(error);
|
|
1692
|
+
}
|
|
1693
|
+
}).timeout(attemptTimeout);
|
|
1694
|
+
it('should error if - missing name', (done) => {
|
|
1695
|
+
try {
|
|
1696
|
+
a.getSavedSearchesHistoryByName(null, null, (data, error) => {
|
|
1697
|
+
try {
|
|
1698
|
+
const displayE = 'name is required';
|
|
1699
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesHistoryByName', displayE);
|
|
1700
|
+
done();
|
|
1701
|
+
} catch (err) {
|
|
1702
|
+
log.error(`Test Failure: ${err}`);
|
|
1703
|
+
done(err);
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
} catch (error) {
|
|
1707
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1708
|
+
done(error);
|
|
1709
|
+
}
|
|
1710
|
+
}).timeout(attemptTimeout);
|
|
1711
|
+
it('should error if - missing savedsearch', (done) => {
|
|
1712
|
+
try {
|
|
1713
|
+
a.getSavedSearchesHistoryByName('fakeparam', null, (data, error) => {
|
|
1714
|
+
try {
|
|
1715
|
+
const displayE = 'savedsearch is required';
|
|
1716
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesHistoryByName', displayE);
|
|
1717
|
+
done();
|
|
1718
|
+
} catch (err) {
|
|
1719
|
+
log.error(`Test Failure: ${err}`);
|
|
1720
|
+
done(err);
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
} catch (error) {
|
|
1724
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1725
|
+
done(error);
|
|
1726
|
+
}
|
|
1727
|
+
}).timeout(attemptTimeout);
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
describe('#postSavedSearchesReschedule - errors', () => {
|
|
1731
|
+
it('should have a postSavedSearchesReschedule function', (done) => {
|
|
1732
|
+
try {
|
|
1733
|
+
assert.equal(true, typeof a.postSavedSearchesReschedule === 'function');
|
|
1734
|
+
done();
|
|
1735
|
+
} catch (error) {
|
|
1736
|
+
log.error(`Test Failure: ${error}`);
|
|
1737
|
+
done(error);
|
|
1738
|
+
}
|
|
1739
|
+
}).timeout(attemptTimeout);
|
|
1740
|
+
it('should error if - missing name', (done) => {
|
|
1741
|
+
try {
|
|
1742
|
+
a.postSavedSearchesReschedule(null, null, (data, error) => {
|
|
1743
|
+
try {
|
|
1744
|
+
const displayE = 'name is required';
|
|
1745
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesReschedule', displayE);
|
|
1746
|
+
done();
|
|
1747
|
+
} catch (err) {
|
|
1748
|
+
log.error(`Test Failure: ${err}`);
|
|
1749
|
+
done(err);
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
} catch (error) {
|
|
1753
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1754
|
+
done(error);
|
|
1755
|
+
}
|
|
1756
|
+
}).timeout(attemptTimeout);
|
|
1757
|
+
it('should error if - missing body', (done) => {
|
|
1758
|
+
try {
|
|
1759
|
+
a.postSavedSearchesReschedule('fakeparam', null, (data, error) => {
|
|
1760
|
+
try {
|
|
1761
|
+
const displayE = 'body is required';
|
|
1762
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSavedSearchesReschedule', displayE);
|
|
1763
|
+
done();
|
|
1764
|
+
} catch (err) {
|
|
1765
|
+
log.error(`Test Failure: ${err}`);
|
|
1766
|
+
done(err);
|
|
1767
|
+
}
|
|
1768
|
+
});
|
|
1769
|
+
} catch (error) {
|
|
1770
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1771
|
+
done(error);
|
|
1772
|
+
}
|
|
1773
|
+
}).timeout(attemptTimeout);
|
|
1774
|
+
});
|
|
1775
|
+
|
|
1776
|
+
describe('#getSavedSearchesScheduledItemsByName - errors', () => {
|
|
1777
|
+
it('should have a getSavedSearchesScheduledItemsByName function', (done) => {
|
|
1778
|
+
try {
|
|
1779
|
+
assert.equal(true, typeof a.getSavedSearchesScheduledItemsByName === 'function');
|
|
1780
|
+
done();
|
|
1781
|
+
} catch (error) {
|
|
1782
|
+
log.error(`Test Failure: ${error}`);
|
|
1783
|
+
done(error);
|
|
1784
|
+
}
|
|
1785
|
+
}).timeout(attemptTimeout);
|
|
1786
|
+
it('should error if - missing name', (done) => {
|
|
1787
|
+
try {
|
|
1788
|
+
a.getSavedSearchesScheduledItemsByName(null, null, null, (data, error) => {
|
|
1789
|
+
try {
|
|
1790
|
+
const displayE = 'name is required';
|
|
1791
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesScheduledItemsByName', displayE);
|
|
1792
|
+
done();
|
|
1793
|
+
} catch (err) {
|
|
1794
|
+
log.error(`Test Failure: ${err}`);
|
|
1795
|
+
done(err);
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1798
|
+
} catch (error) {
|
|
1799
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1800
|
+
done(error);
|
|
1801
|
+
}
|
|
1802
|
+
}).timeout(attemptTimeout);
|
|
1803
|
+
it('should error if - missing earliestTime', (done) => {
|
|
1804
|
+
try {
|
|
1805
|
+
a.getSavedSearchesScheduledItemsByName('fakeparam', null, null, (data, error) => {
|
|
1806
|
+
try {
|
|
1807
|
+
const displayE = 'earliestTime is required';
|
|
1808
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesScheduledItemsByName', displayE);
|
|
1809
|
+
done();
|
|
1810
|
+
} catch (err) {
|
|
1811
|
+
log.error(`Test Failure: ${err}`);
|
|
1812
|
+
done(err);
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
} catch (error) {
|
|
1816
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1817
|
+
done(error);
|
|
1818
|
+
}
|
|
1819
|
+
}).timeout(attemptTimeout);
|
|
1820
|
+
it('should error if - missing latestTime', (done) => {
|
|
1821
|
+
try {
|
|
1822
|
+
a.getSavedSearchesScheduledItemsByName('fakeparam', 'fakeparam', null, (data, error) => {
|
|
1823
|
+
try {
|
|
1824
|
+
const displayE = 'latestTime is required';
|
|
1825
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesScheduledItemsByName', displayE);
|
|
1826
|
+
done();
|
|
1827
|
+
} catch (err) {
|
|
1828
|
+
log.error(`Test Failure: ${err}`);
|
|
1829
|
+
done(err);
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
} catch (error) {
|
|
1833
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1834
|
+
done(error);
|
|
1835
|
+
}
|
|
1836
|
+
}).timeout(attemptTimeout);
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1839
|
+
describe('#getSavedSearchesSupresssByName - errors', () => {
|
|
1840
|
+
it('should have a getSavedSearchesSupresssByName function', (done) => {
|
|
1841
|
+
try {
|
|
1842
|
+
assert.equal(true, typeof a.getSavedSearchesSupresssByName === 'function');
|
|
1843
|
+
done();
|
|
1844
|
+
} catch (error) {
|
|
1845
|
+
log.error(`Test Failure: ${error}`);
|
|
1846
|
+
done(error);
|
|
1847
|
+
}
|
|
1848
|
+
}).timeout(attemptTimeout);
|
|
1849
|
+
it('should error if - missing name', (done) => {
|
|
1850
|
+
try {
|
|
1851
|
+
a.getSavedSearchesSupresssByName(null, null, (data, error) => {
|
|
1852
|
+
try {
|
|
1853
|
+
const displayE = 'name is required';
|
|
1854
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesSupresssByName', displayE);
|
|
1855
|
+
done();
|
|
1856
|
+
} catch (err) {
|
|
1857
|
+
log.error(`Test Failure: ${err}`);
|
|
1858
|
+
done(err);
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
} catch (error) {
|
|
1862
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1863
|
+
done(error);
|
|
1864
|
+
}
|
|
1865
|
+
}).timeout(attemptTimeout);
|
|
1866
|
+
it('should error if - missing expiration', (done) => {
|
|
1867
|
+
try {
|
|
1868
|
+
a.getSavedSearchesSupresssByName('fakeparam', null, (data, error) => {
|
|
1869
|
+
try {
|
|
1870
|
+
const displayE = 'expiration is required';
|
|
1871
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSavedSearchesSupresssByName', displayE);
|
|
1872
|
+
done();
|
|
1873
|
+
} catch (err) {
|
|
1874
|
+
log.error(`Test Failure: ${err}`);
|
|
1875
|
+
done(err);
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
} catch (error) {
|
|
1879
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1880
|
+
done(error);
|
|
1881
|
+
}
|
|
1882
|
+
}).timeout(attemptTimeout);
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
describe('#getScheduledViews - errors', () => {
|
|
1886
|
+
it('should have a getScheduledViews function', (done) => {
|
|
1887
|
+
try {
|
|
1888
|
+
assert.equal(true, typeof a.getScheduledViews === 'function');
|
|
1889
|
+
done();
|
|
1890
|
+
} catch (error) {
|
|
1891
|
+
log.error(`Test Failure: ${error}`);
|
|
1892
|
+
done(error);
|
|
1893
|
+
}
|
|
1894
|
+
}).timeout(attemptTimeout);
|
|
1895
|
+
it('should error if - missing count', (done) => {
|
|
1896
|
+
try {
|
|
1897
|
+
a.getScheduledViews(null, null, null, null, null, null, null, null, (data, error) => {
|
|
1898
|
+
try {
|
|
1899
|
+
const displayE = 'count is required';
|
|
1900
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1901
|
+
done();
|
|
1902
|
+
} catch (err) {
|
|
1903
|
+
log.error(`Test Failure: ${err}`);
|
|
1904
|
+
done(err);
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
} catch (error) {
|
|
1908
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1909
|
+
done(error);
|
|
1910
|
+
}
|
|
1911
|
+
}).timeout(attemptTimeout);
|
|
1912
|
+
it('should error if - missing f', (done) => {
|
|
1913
|
+
try {
|
|
1914
|
+
a.getScheduledViews('fakeparam', null, null, null, null, null, null, null, (data, error) => {
|
|
1915
|
+
try {
|
|
1916
|
+
const displayE = 'f is required';
|
|
1917
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1918
|
+
done();
|
|
1919
|
+
} catch (err) {
|
|
1920
|
+
log.error(`Test Failure: ${err}`);
|
|
1921
|
+
done(err);
|
|
1922
|
+
}
|
|
1923
|
+
});
|
|
1924
|
+
} catch (error) {
|
|
1925
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1926
|
+
done(error);
|
|
1927
|
+
}
|
|
1928
|
+
}).timeout(attemptTimeout);
|
|
1929
|
+
it('should error if - missing offset', (done) => {
|
|
1930
|
+
try {
|
|
1931
|
+
a.getScheduledViews('fakeparam', 'fakeparam', null, null, null, null, null, null, (data, error) => {
|
|
1932
|
+
try {
|
|
1933
|
+
const displayE = 'offset is required';
|
|
1934
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1935
|
+
done();
|
|
1936
|
+
} catch (err) {
|
|
1937
|
+
log.error(`Test Failure: ${err}`);
|
|
1938
|
+
done(err);
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
} catch (error) {
|
|
1942
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1943
|
+
done(error);
|
|
1944
|
+
}
|
|
1945
|
+
}).timeout(attemptTimeout);
|
|
1946
|
+
it('should error if - missing search', (done) => {
|
|
1947
|
+
try {
|
|
1948
|
+
a.getScheduledViews('fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, null, (data, error) => {
|
|
1949
|
+
try {
|
|
1950
|
+
const displayE = 'search is required';
|
|
1951
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1952
|
+
done();
|
|
1953
|
+
} catch (err) {
|
|
1954
|
+
log.error(`Test Failure: ${err}`);
|
|
1955
|
+
done(err);
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
} catch (error) {
|
|
1959
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1960
|
+
done(error);
|
|
1961
|
+
}
|
|
1962
|
+
}).timeout(attemptTimeout);
|
|
1963
|
+
it('should error if - missing sortDir', (done) => {
|
|
1964
|
+
try {
|
|
1965
|
+
a.getScheduledViews('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, (data, error) => {
|
|
1966
|
+
try {
|
|
1967
|
+
const displayE = 'sortDir is required';
|
|
1968
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1969
|
+
done();
|
|
1970
|
+
} catch (err) {
|
|
1971
|
+
log.error(`Test Failure: ${err}`);
|
|
1972
|
+
done(err);
|
|
1973
|
+
}
|
|
1974
|
+
});
|
|
1975
|
+
} catch (error) {
|
|
1976
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1977
|
+
done(error);
|
|
1978
|
+
}
|
|
1979
|
+
}).timeout(attemptTimeout);
|
|
1980
|
+
it('should error if - missing sortKey', (done) => {
|
|
1981
|
+
try {
|
|
1982
|
+
a.getScheduledViews('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
1983
|
+
try {
|
|
1984
|
+
const displayE = 'sortKey is required';
|
|
1985
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
1986
|
+
done();
|
|
1987
|
+
} catch (err) {
|
|
1988
|
+
log.error(`Test Failure: ${err}`);
|
|
1989
|
+
done(err);
|
|
1990
|
+
}
|
|
1991
|
+
});
|
|
1992
|
+
} catch (error) {
|
|
1993
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1994
|
+
done(error);
|
|
1995
|
+
}
|
|
1996
|
+
}).timeout(attemptTimeout);
|
|
1997
|
+
it('should error if - missing sortMode', (done) => {
|
|
1998
|
+
try {
|
|
1999
|
+
a.getScheduledViews('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
2000
|
+
try {
|
|
2001
|
+
const displayE = 'sortMode is required';
|
|
2002
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
2003
|
+
done();
|
|
2004
|
+
} catch (err) {
|
|
2005
|
+
log.error(`Test Failure: ${err}`);
|
|
2006
|
+
done(err);
|
|
2007
|
+
}
|
|
2008
|
+
});
|
|
2009
|
+
} catch (error) {
|
|
2010
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2011
|
+
done(error);
|
|
2012
|
+
}
|
|
2013
|
+
}).timeout(attemptTimeout);
|
|
2014
|
+
it('should error if - missing summarize', (done) => {
|
|
2015
|
+
try {
|
|
2016
|
+
a.getScheduledViews('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
2017
|
+
try {
|
|
2018
|
+
const displayE = 'summarize is required';
|
|
2019
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViews', displayE);
|
|
2020
|
+
done();
|
|
2021
|
+
} catch (err) {
|
|
2022
|
+
log.error(`Test Failure: ${err}`);
|
|
2023
|
+
done(err);
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
} catch (error) {
|
|
2027
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2028
|
+
done(error);
|
|
2029
|
+
}
|
|
2030
|
+
}).timeout(attemptTimeout);
|
|
2031
|
+
});
|
|
2032
|
+
|
|
2033
|
+
describe('#deleteScheduledViewByName - errors', () => {
|
|
2034
|
+
it('should have a deleteScheduledViewByName function', (done) => {
|
|
2035
|
+
try {
|
|
2036
|
+
assert.equal(true, typeof a.deleteScheduledViewByName === 'function');
|
|
2037
|
+
done();
|
|
2038
|
+
} catch (error) {
|
|
2039
|
+
log.error(`Test Failure: ${error}`);
|
|
2040
|
+
done(error);
|
|
2041
|
+
}
|
|
2042
|
+
}).timeout(attemptTimeout);
|
|
2043
|
+
it('should error if - missing name', (done) => {
|
|
2044
|
+
try {
|
|
2045
|
+
a.deleteScheduledViewByName(null, null, (data, error) => {
|
|
2046
|
+
try {
|
|
2047
|
+
const displayE = 'name is required';
|
|
2048
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-deleteScheduledViewByName', displayE);
|
|
2049
|
+
done();
|
|
2050
|
+
} catch (err) {
|
|
2051
|
+
log.error(`Test Failure: ${err}`);
|
|
2052
|
+
done(err);
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2055
|
+
} catch (error) {
|
|
2056
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2057
|
+
done(error);
|
|
2058
|
+
}
|
|
2059
|
+
}).timeout(attemptTimeout);
|
|
2060
|
+
});
|
|
2061
|
+
|
|
2062
|
+
describe('#getScheduledViewByName - errors', () => {
|
|
2063
|
+
it('should have a getScheduledViewByName function', (done) => {
|
|
2064
|
+
try {
|
|
2065
|
+
assert.equal(true, typeof a.getScheduledViewByName === 'function');
|
|
2066
|
+
done();
|
|
2067
|
+
} catch (error) {
|
|
2068
|
+
log.error(`Test Failure: ${error}`);
|
|
2069
|
+
done(error);
|
|
2070
|
+
}
|
|
2071
|
+
}).timeout(attemptTimeout);
|
|
2072
|
+
it('should error if - missing name', (done) => {
|
|
2073
|
+
try {
|
|
2074
|
+
a.getScheduledViewByName(null, (data, error) => {
|
|
2075
|
+
try {
|
|
2076
|
+
const displayE = 'name is required';
|
|
2077
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViewByName', displayE);
|
|
2078
|
+
done();
|
|
2079
|
+
} catch (err) {
|
|
2080
|
+
log.error(`Test Failure: ${err}`);
|
|
2081
|
+
done(err);
|
|
2082
|
+
}
|
|
2083
|
+
});
|
|
2084
|
+
} catch (error) {
|
|
2085
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2086
|
+
done(error);
|
|
2087
|
+
}
|
|
2088
|
+
}).timeout(attemptTimeout);
|
|
2089
|
+
});
|
|
2090
|
+
|
|
2091
|
+
describe('#postScheduledViewByName - errors', () => {
|
|
2092
|
+
it('should have a postScheduledViewByName function', (done) => {
|
|
2093
|
+
try {
|
|
2094
|
+
assert.equal(true, typeof a.postScheduledViewByName === 'function');
|
|
2095
|
+
done();
|
|
2096
|
+
} catch (error) {
|
|
2097
|
+
log.error(`Test Failure: ${error}`);
|
|
2098
|
+
done(error);
|
|
2099
|
+
}
|
|
2100
|
+
}).timeout(attemptTimeout);
|
|
2101
|
+
it('should error if - missing name', (done) => {
|
|
2102
|
+
try {
|
|
2103
|
+
a.postScheduledViewByName(null, null, (data, error) => {
|
|
2104
|
+
try {
|
|
2105
|
+
const displayE = 'name is required';
|
|
2106
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewByName', displayE);
|
|
2107
|
+
done();
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
log.error(`Test Failure: ${err}`);
|
|
2110
|
+
done(err);
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
} catch (error) {
|
|
2114
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2115
|
+
done(error);
|
|
2116
|
+
}
|
|
2117
|
+
}).timeout(attemptTimeout);
|
|
2118
|
+
it('should error if - missing body', (done) => {
|
|
2119
|
+
try {
|
|
2120
|
+
a.postScheduledViewByName('fakeparam', null, (data, error) => {
|
|
2121
|
+
try {
|
|
2122
|
+
const displayE = 'body is required';
|
|
2123
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewByName', displayE);
|
|
2124
|
+
done();
|
|
2125
|
+
} catch (err) {
|
|
2126
|
+
log.error(`Test Failure: ${err}`);
|
|
2127
|
+
done(err);
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
} catch (error) {
|
|
2131
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2132
|
+
done(error);
|
|
2133
|
+
}
|
|
2134
|
+
}).timeout(attemptTimeout);
|
|
2135
|
+
});
|
|
2136
|
+
|
|
2137
|
+
describe('#postScheduledViewDispatch - errors', () => {
|
|
2138
|
+
it('should have a postScheduledViewDispatch function', (done) => {
|
|
2139
|
+
try {
|
|
2140
|
+
assert.equal(true, typeof a.postScheduledViewDispatch === 'function');
|
|
2141
|
+
done();
|
|
2142
|
+
} catch (error) {
|
|
2143
|
+
log.error(`Test Failure: ${error}`);
|
|
2144
|
+
done(error);
|
|
2145
|
+
}
|
|
2146
|
+
}).timeout(attemptTimeout);
|
|
2147
|
+
it('should error if - missing name', (done) => {
|
|
2148
|
+
try {
|
|
2149
|
+
a.postScheduledViewDispatch(null, null, (data, error) => {
|
|
2150
|
+
try {
|
|
2151
|
+
const displayE = 'name is required';
|
|
2152
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewDispatch', displayE);
|
|
2153
|
+
done();
|
|
2154
|
+
} catch (err) {
|
|
2155
|
+
log.error(`Test Failure: ${err}`);
|
|
2156
|
+
done(err);
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
} catch (error) {
|
|
2160
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2161
|
+
done(error);
|
|
2162
|
+
}
|
|
2163
|
+
}).timeout(attemptTimeout);
|
|
2164
|
+
it('should error if - missing body', (done) => {
|
|
2165
|
+
try {
|
|
2166
|
+
a.postScheduledViewDispatch('fakeparam', null, (data, error) => {
|
|
2167
|
+
try {
|
|
2168
|
+
const displayE = 'body is required';
|
|
2169
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewDispatch', displayE);
|
|
2170
|
+
done();
|
|
2171
|
+
} catch (err) {
|
|
2172
|
+
log.error(`Test Failure: ${err}`);
|
|
2173
|
+
done(err);
|
|
2174
|
+
}
|
|
2175
|
+
});
|
|
2176
|
+
} catch (error) {
|
|
2177
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2178
|
+
done(error);
|
|
2179
|
+
}
|
|
2180
|
+
}).timeout(attemptTimeout);
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
describe('#getScheduledViewHistory - errors', () => {
|
|
2184
|
+
it('should have a getScheduledViewHistory function', (done) => {
|
|
2185
|
+
try {
|
|
2186
|
+
assert.equal(true, typeof a.getScheduledViewHistory === 'function');
|
|
2187
|
+
done();
|
|
2188
|
+
} catch (error) {
|
|
2189
|
+
log.error(`Test Failure: ${error}`);
|
|
2190
|
+
done(error);
|
|
2191
|
+
}
|
|
2192
|
+
}).timeout(attemptTimeout);
|
|
2193
|
+
it('should error if - missing name', (done) => {
|
|
2194
|
+
try {
|
|
2195
|
+
a.getScheduledViewHistory(null, (data, error) => {
|
|
2196
|
+
try {
|
|
2197
|
+
const displayE = 'name is required';
|
|
2198
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViewHistory', displayE);
|
|
2199
|
+
done();
|
|
2200
|
+
} catch (err) {
|
|
2201
|
+
log.error(`Test Failure: ${err}`);
|
|
2202
|
+
done(err);
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
} catch (error) {
|
|
2206
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2207
|
+
done(error);
|
|
2208
|
+
}
|
|
2209
|
+
}).timeout(attemptTimeout);
|
|
2210
|
+
});
|
|
2211
|
+
|
|
2212
|
+
describe('#postScheduledViewHistory - errors', () => {
|
|
2213
|
+
it('should have a postScheduledViewHistory function', (done) => {
|
|
2214
|
+
try {
|
|
2215
|
+
assert.equal(true, typeof a.postScheduledViewHistory === 'function');
|
|
2216
|
+
done();
|
|
2217
|
+
} catch (error) {
|
|
2218
|
+
log.error(`Test Failure: ${error}`);
|
|
2219
|
+
done(error);
|
|
2220
|
+
}
|
|
2221
|
+
}).timeout(attemptTimeout);
|
|
2222
|
+
it('should error if - missing name', (done) => {
|
|
2223
|
+
try {
|
|
2224
|
+
a.postScheduledViewHistory(null, null, (data, error) => {
|
|
2225
|
+
try {
|
|
2226
|
+
const displayE = 'name is required';
|
|
2227
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewHistory', displayE);
|
|
2228
|
+
done();
|
|
2229
|
+
} catch (err) {
|
|
2230
|
+
log.error(`Test Failure: ${err}`);
|
|
2231
|
+
done(err);
|
|
2232
|
+
}
|
|
2233
|
+
});
|
|
2234
|
+
} catch (error) {
|
|
2235
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2236
|
+
done(error);
|
|
2237
|
+
}
|
|
2238
|
+
}).timeout(attemptTimeout);
|
|
2239
|
+
it('should error if - missing body', (done) => {
|
|
2240
|
+
try {
|
|
2241
|
+
a.postScheduledViewHistory('fakeparam', null, (data, error) => {
|
|
2242
|
+
try {
|
|
2243
|
+
const displayE = 'body is required';
|
|
2244
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postScheduledViewHistory', displayE);
|
|
2245
|
+
done();
|
|
2246
|
+
} catch (err) {
|
|
2247
|
+
log.error(`Test Failure: ${err}`);
|
|
2248
|
+
done(err);
|
|
2249
|
+
}
|
|
2250
|
+
});
|
|
2251
|
+
} catch (error) {
|
|
2252
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2253
|
+
done(error);
|
|
2254
|
+
}
|
|
2255
|
+
}).timeout(attemptTimeout);
|
|
2256
|
+
});
|
|
2257
|
+
|
|
2258
|
+
describe('#getScheduledViewScheduledTimes - errors', () => {
|
|
2259
|
+
it('should have a getScheduledViewScheduledTimes function', (done) => {
|
|
2260
|
+
try {
|
|
2261
|
+
assert.equal(true, typeof a.getScheduledViewScheduledTimes === 'function');
|
|
2262
|
+
done();
|
|
2263
|
+
} catch (error) {
|
|
2264
|
+
log.error(`Test Failure: ${error}`);
|
|
2265
|
+
done(error);
|
|
2266
|
+
}
|
|
2267
|
+
}).timeout(attemptTimeout);
|
|
2268
|
+
it('should error if - missing name', (done) => {
|
|
2269
|
+
try {
|
|
2270
|
+
a.getScheduledViewScheduledTimes(null, null, null, (data, error) => {
|
|
2271
|
+
try {
|
|
2272
|
+
const displayE = 'name is required';
|
|
2273
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViewScheduledTimes', displayE);
|
|
2274
|
+
done();
|
|
2275
|
+
} catch (err) {
|
|
2276
|
+
log.error(`Test Failure: ${err}`);
|
|
2277
|
+
done(err);
|
|
2278
|
+
}
|
|
2279
|
+
});
|
|
2280
|
+
} catch (error) {
|
|
2281
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2282
|
+
done(error);
|
|
2283
|
+
}
|
|
2284
|
+
}).timeout(attemptTimeout);
|
|
2285
|
+
it('should error if - missing earliestTime', (done) => {
|
|
2286
|
+
try {
|
|
2287
|
+
a.getScheduledViewScheduledTimes('fakeparam', null, null, (data, error) => {
|
|
2288
|
+
try {
|
|
2289
|
+
const displayE = 'earliestTime is required';
|
|
2290
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViewScheduledTimes', displayE);
|
|
2291
|
+
done();
|
|
2292
|
+
} catch (err) {
|
|
2293
|
+
log.error(`Test Failure: ${err}`);
|
|
2294
|
+
done(err);
|
|
2295
|
+
}
|
|
2296
|
+
});
|
|
2297
|
+
} catch (error) {
|
|
2298
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2299
|
+
done(error);
|
|
2300
|
+
}
|
|
2301
|
+
}).timeout(attemptTimeout);
|
|
2302
|
+
it('should error if - missing latestTime', (done) => {
|
|
2303
|
+
try {
|
|
2304
|
+
a.getScheduledViewScheduledTimes('fakeparam', 'fakeparam', null, (data, error) => {
|
|
2305
|
+
try {
|
|
2306
|
+
const displayE = 'latestTime is required';
|
|
2307
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getScheduledViewScheduledTimes', displayE);
|
|
2308
|
+
done();
|
|
2309
|
+
} catch (err) {
|
|
2310
|
+
log.error(`Test Failure: ${err}`);
|
|
2311
|
+
done(err);
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
2314
|
+
} catch (error) {
|
|
2315
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2316
|
+
done(error);
|
|
2317
|
+
}
|
|
2318
|
+
}).timeout(attemptTimeout);
|
|
2319
|
+
});
|
|
2320
|
+
|
|
2321
|
+
describe('#getSearchJobs - errors', () => {
|
|
2322
|
+
it('should have a getSearchJobs function', (done) => {
|
|
2323
|
+
try {
|
|
2324
|
+
assert.equal(true, typeof a.getSearchJobs === 'function');
|
|
2325
|
+
done();
|
|
2326
|
+
} catch (error) {
|
|
2327
|
+
log.error(`Test Failure: ${error}`);
|
|
2328
|
+
done(error);
|
|
2329
|
+
}
|
|
2330
|
+
}).timeout(attemptTimeout);
|
|
2331
|
+
it('should error if - missing count', (done) => {
|
|
2332
|
+
try {
|
|
2333
|
+
a.getSearchJobs(null, null, null, null, null, null, null, null, (data, error) => {
|
|
2334
|
+
try {
|
|
2335
|
+
const displayE = 'count is required';
|
|
2336
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2337
|
+
done();
|
|
2338
|
+
} catch (err) {
|
|
2339
|
+
log.error(`Test Failure: ${err}`);
|
|
2340
|
+
done(err);
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
} catch (error) {
|
|
2344
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2345
|
+
done(error);
|
|
2346
|
+
}
|
|
2347
|
+
}).timeout(attemptTimeout);
|
|
2348
|
+
it('should error if - missing f', (done) => {
|
|
2349
|
+
try {
|
|
2350
|
+
a.getSearchJobs('fakeparam', null, null, null, null, null, null, null, (data, error) => {
|
|
2351
|
+
try {
|
|
2352
|
+
const displayE = 'f is required';
|
|
2353
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2354
|
+
done();
|
|
2355
|
+
} catch (err) {
|
|
2356
|
+
log.error(`Test Failure: ${err}`);
|
|
2357
|
+
done(err);
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
2360
|
+
} catch (error) {
|
|
2361
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2362
|
+
done(error);
|
|
2363
|
+
}
|
|
2364
|
+
}).timeout(attemptTimeout);
|
|
2365
|
+
it('should error if - missing offset', (done) => {
|
|
2366
|
+
try {
|
|
2367
|
+
a.getSearchJobs('fakeparam', 'fakeparam', null, null, null, null, null, null, (data, error) => {
|
|
2368
|
+
try {
|
|
2369
|
+
const displayE = 'offset is required';
|
|
2370
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2371
|
+
done();
|
|
2372
|
+
} catch (err) {
|
|
2373
|
+
log.error(`Test Failure: ${err}`);
|
|
2374
|
+
done(err);
|
|
2375
|
+
}
|
|
2376
|
+
});
|
|
2377
|
+
} catch (error) {
|
|
2378
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2379
|
+
done(error);
|
|
2380
|
+
}
|
|
2381
|
+
}).timeout(attemptTimeout);
|
|
2382
|
+
it('should error if - missing search', (done) => {
|
|
2383
|
+
try {
|
|
2384
|
+
a.getSearchJobs('fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, null, (data, error) => {
|
|
2385
|
+
try {
|
|
2386
|
+
const displayE = 'search is required';
|
|
2387
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2388
|
+
done();
|
|
2389
|
+
} catch (err) {
|
|
2390
|
+
log.error(`Test Failure: ${err}`);
|
|
2391
|
+
done(err);
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
} catch (error) {
|
|
2395
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2396
|
+
done(error);
|
|
2397
|
+
}
|
|
2398
|
+
}).timeout(attemptTimeout);
|
|
2399
|
+
it('should error if - missing sortDir', (done) => {
|
|
2400
|
+
try {
|
|
2401
|
+
a.getSearchJobs('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, (data, error) => {
|
|
2402
|
+
try {
|
|
2403
|
+
const displayE = 'sortDir is required';
|
|
2404
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2405
|
+
done();
|
|
2406
|
+
} catch (err) {
|
|
2407
|
+
log.error(`Test Failure: ${err}`);
|
|
2408
|
+
done(err);
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
} catch (error) {
|
|
2412
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2413
|
+
done(error);
|
|
2414
|
+
}
|
|
2415
|
+
}).timeout(attemptTimeout);
|
|
2416
|
+
it('should error if - missing sortKey', (done) => {
|
|
2417
|
+
try {
|
|
2418
|
+
a.getSearchJobs('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
2419
|
+
try {
|
|
2420
|
+
const displayE = 'sortKey is required';
|
|
2421
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2422
|
+
done();
|
|
2423
|
+
} catch (err) {
|
|
2424
|
+
log.error(`Test Failure: ${err}`);
|
|
2425
|
+
done(err);
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
} catch (error) {
|
|
2429
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2430
|
+
done(error);
|
|
2431
|
+
}
|
|
2432
|
+
}).timeout(attemptTimeout);
|
|
2433
|
+
it('should error if - missing sortMode', (done) => {
|
|
2434
|
+
try {
|
|
2435
|
+
a.getSearchJobs('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
2436
|
+
try {
|
|
2437
|
+
const displayE = 'sortMode is required';
|
|
2438
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2439
|
+
done();
|
|
2440
|
+
} catch (err) {
|
|
2441
|
+
log.error(`Test Failure: ${err}`);
|
|
2442
|
+
done(err);
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
} catch (error) {
|
|
2446
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2447
|
+
done(error);
|
|
2448
|
+
}
|
|
2449
|
+
}).timeout(attemptTimeout);
|
|
2450
|
+
it('should error if - missing summarize', (done) => {
|
|
2451
|
+
try {
|
|
2452
|
+
a.getSearchJobs('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
2453
|
+
try {
|
|
2454
|
+
const displayE = 'summarize is required';
|
|
2455
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobs', displayE);
|
|
2456
|
+
done();
|
|
2457
|
+
} catch (err) {
|
|
2458
|
+
log.error(`Test Failure: ${err}`);
|
|
2459
|
+
done(err);
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
} catch (error) {
|
|
2463
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2464
|
+
done(error);
|
|
2465
|
+
}
|
|
2466
|
+
}).timeout(attemptTimeout);
|
|
2467
|
+
});
|
|
2468
|
+
|
|
2469
|
+
describe('#postSearchJobs - errors', () => {
|
|
2470
|
+
it('should have a postSearchJobs function', (done) => {
|
|
2471
|
+
try {
|
|
2472
|
+
assert.equal(true, typeof a.postSearchJobs === 'function');
|
|
2473
|
+
done();
|
|
2474
|
+
} catch (error) {
|
|
2475
|
+
log.error(`Test Failure: ${error}`);
|
|
2476
|
+
done(error);
|
|
2477
|
+
}
|
|
2478
|
+
}).timeout(attemptTimeout);
|
|
2479
|
+
it('should error if - missing body', (done) => {
|
|
2480
|
+
try {
|
|
2481
|
+
a.postSearchJobs(null, (data, error) => {
|
|
2482
|
+
try {
|
|
2483
|
+
const displayE = 'body is required';
|
|
2484
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobs', displayE);
|
|
2485
|
+
done();
|
|
2486
|
+
} catch (err) {
|
|
2487
|
+
log.error(`Test Failure: ${err}`);
|
|
2488
|
+
done(err);
|
|
2489
|
+
}
|
|
2490
|
+
});
|
|
2491
|
+
} catch (error) {
|
|
2492
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2493
|
+
done(error);
|
|
2494
|
+
}
|
|
2495
|
+
}).timeout(attemptTimeout);
|
|
2496
|
+
});
|
|
2497
|
+
|
|
2498
|
+
describe('#getSearchJobsExport - errors', () => {
|
|
2499
|
+
it('should have a getSearchJobsExport function', (done) => {
|
|
2500
|
+
try {
|
|
2501
|
+
assert.equal(true, typeof a.getSearchJobsExport === 'function');
|
|
2502
|
+
done();
|
|
2503
|
+
} catch (error) {
|
|
2504
|
+
log.error(`Test Failure: ${error}`);
|
|
2505
|
+
done(error);
|
|
2506
|
+
}
|
|
2507
|
+
}).timeout(attemptTimeout);
|
|
2508
|
+
});
|
|
2509
|
+
|
|
2510
|
+
describe('#postSearchJobsExport - errors', () => {
|
|
2511
|
+
it('should have a postSearchJobsExport function', (done) => {
|
|
2512
|
+
try {
|
|
2513
|
+
assert.equal(true, typeof a.postSearchJobsExport === 'function');
|
|
2514
|
+
done();
|
|
2515
|
+
} catch (error) {
|
|
2516
|
+
log.error(`Test Failure: ${error}`);
|
|
2517
|
+
done(error);
|
|
2518
|
+
}
|
|
2519
|
+
}).timeout(attemptTimeout);
|
|
2520
|
+
it('should error if - missing body', (done) => {
|
|
2521
|
+
try {
|
|
2522
|
+
a.postSearchJobsExport(null, (data, error) => {
|
|
2523
|
+
try {
|
|
2524
|
+
const displayE = 'body is required';
|
|
2525
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobsExport', displayE);
|
|
2526
|
+
done();
|
|
2527
|
+
} catch (err) {
|
|
2528
|
+
log.error(`Test Failure: ${err}`);
|
|
2529
|
+
done(err);
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
} catch (error) {
|
|
2533
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2534
|
+
done(error);
|
|
2535
|
+
}
|
|
2536
|
+
}).timeout(attemptTimeout);
|
|
2537
|
+
});
|
|
2538
|
+
|
|
2539
|
+
describe('#deleteSearchJobsById - errors', () => {
|
|
2540
|
+
it('should have a deleteSearchJobsById function', (done) => {
|
|
2541
|
+
try {
|
|
2542
|
+
assert.equal(true, typeof a.deleteSearchJobsById === 'function');
|
|
2543
|
+
done();
|
|
2544
|
+
} catch (error) {
|
|
2545
|
+
log.error(`Test Failure: ${error}`);
|
|
2546
|
+
done(error);
|
|
2547
|
+
}
|
|
2548
|
+
}).timeout(attemptTimeout);
|
|
2549
|
+
it('should error if - missing searchId', (done) => {
|
|
2550
|
+
try {
|
|
2551
|
+
a.deleteSearchJobsById(null, null, (data, error) => {
|
|
2552
|
+
try {
|
|
2553
|
+
const displayE = 'searchId is required';
|
|
2554
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-deleteSearchJobsById', displayE);
|
|
2555
|
+
done();
|
|
2556
|
+
} catch (err) {
|
|
2557
|
+
log.error(`Test Failure: ${err}`);
|
|
2558
|
+
done(err);
|
|
2559
|
+
}
|
|
2560
|
+
});
|
|
2561
|
+
} catch (error) {
|
|
2562
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2563
|
+
done(error);
|
|
2564
|
+
}
|
|
2565
|
+
}).timeout(attemptTimeout);
|
|
2566
|
+
});
|
|
2567
|
+
|
|
2568
|
+
describe('#getSearchJobsById - errors', () => {
|
|
2569
|
+
it('should have a getSearchJobsById function', (done) => {
|
|
2570
|
+
try {
|
|
2571
|
+
assert.equal(true, typeof a.getSearchJobsById === 'function');
|
|
2572
|
+
done();
|
|
2573
|
+
} catch (error) {
|
|
2574
|
+
log.error(`Test Failure: ${error}`);
|
|
2575
|
+
done(error);
|
|
2576
|
+
}
|
|
2577
|
+
}).timeout(attemptTimeout);
|
|
2578
|
+
it('should error if - missing searchId', (done) => {
|
|
2579
|
+
try {
|
|
2580
|
+
a.getSearchJobsById(null, (data, error) => {
|
|
2581
|
+
try {
|
|
2582
|
+
const displayE = 'searchId is required';
|
|
2583
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsById', displayE);
|
|
2584
|
+
done();
|
|
2585
|
+
} catch (err) {
|
|
2586
|
+
log.error(`Test Failure: ${err}`);
|
|
2587
|
+
done(err);
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
} catch (error) {
|
|
2591
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2592
|
+
done(error);
|
|
2593
|
+
}
|
|
2594
|
+
}).timeout(attemptTimeout);
|
|
2595
|
+
});
|
|
2596
|
+
|
|
2597
|
+
describe('#postSearchJobsById - errors', () => {
|
|
2598
|
+
it('should have a postSearchJobsById function', (done) => {
|
|
2599
|
+
try {
|
|
2600
|
+
assert.equal(true, typeof a.postSearchJobsById === 'function');
|
|
2601
|
+
done();
|
|
2602
|
+
} catch (error) {
|
|
2603
|
+
log.error(`Test Failure: ${error}`);
|
|
2604
|
+
done(error);
|
|
2605
|
+
}
|
|
2606
|
+
}).timeout(attemptTimeout);
|
|
2607
|
+
it('should error if - missing searchId', (done) => {
|
|
2608
|
+
try {
|
|
2609
|
+
a.postSearchJobsById(null, null, (data, error) => {
|
|
2610
|
+
try {
|
|
2611
|
+
const displayE = 'searchId is required';
|
|
2612
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobsById', displayE);
|
|
2613
|
+
done();
|
|
2614
|
+
} catch (err) {
|
|
2615
|
+
log.error(`Test Failure: ${err}`);
|
|
2616
|
+
done(err);
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2619
|
+
} catch (error) {
|
|
2620
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2621
|
+
done(error);
|
|
2622
|
+
}
|
|
2623
|
+
}).timeout(attemptTimeout);
|
|
2624
|
+
it('should error if - missing body', (done) => {
|
|
2625
|
+
try {
|
|
2626
|
+
a.postSearchJobsById('fakeparam', null, (data, error) => {
|
|
2627
|
+
try {
|
|
2628
|
+
const displayE = 'body is required';
|
|
2629
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobsById', displayE);
|
|
2630
|
+
done();
|
|
2631
|
+
} catch (err) {
|
|
2632
|
+
log.error(`Test Failure: ${err}`);
|
|
2633
|
+
done(err);
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2636
|
+
} catch (error) {
|
|
2637
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2638
|
+
done(error);
|
|
2639
|
+
}
|
|
2640
|
+
}).timeout(attemptTimeout);
|
|
2641
|
+
});
|
|
2642
|
+
|
|
2643
|
+
describe('#postSearchJobsByIdControl - errors', () => {
|
|
2644
|
+
it('should have a postSearchJobsByIdControl function', (done) => {
|
|
2645
|
+
try {
|
|
2646
|
+
assert.equal(true, typeof a.postSearchJobsByIdControl === 'function');
|
|
2647
|
+
done();
|
|
2648
|
+
} catch (error) {
|
|
2649
|
+
log.error(`Test Failure: ${error}`);
|
|
2650
|
+
done(error);
|
|
2651
|
+
}
|
|
2652
|
+
}).timeout(attemptTimeout);
|
|
2653
|
+
it('should error if - missing searchId', (done) => {
|
|
2654
|
+
try {
|
|
2655
|
+
a.postSearchJobsByIdControl(null, null, (data, error) => {
|
|
2656
|
+
try {
|
|
2657
|
+
const displayE = 'searchId is required';
|
|
2658
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobsByIdControl', displayE);
|
|
2659
|
+
done();
|
|
2660
|
+
} catch (err) {
|
|
2661
|
+
log.error(`Test Failure: ${err}`);
|
|
2662
|
+
done(err);
|
|
2663
|
+
}
|
|
2664
|
+
});
|
|
2665
|
+
} catch (error) {
|
|
2666
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2667
|
+
done(error);
|
|
2668
|
+
}
|
|
2669
|
+
}).timeout(attemptTimeout);
|
|
2670
|
+
it('should error if - missing body', (done) => {
|
|
2671
|
+
try {
|
|
2672
|
+
a.postSearchJobsByIdControl('fakeparam', null, (data, error) => {
|
|
2673
|
+
try {
|
|
2674
|
+
const displayE = 'body is required';
|
|
2675
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchJobsByIdControl', displayE);
|
|
2676
|
+
done();
|
|
2677
|
+
} catch (err) {
|
|
2678
|
+
log.error(`Test Failure: ${err}`);
|
|
2679
|
+
done(err);
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
} catch (error) {
|
|
2683
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2684
|
+
done(error);
|
|
2685
|
+
}
|
|
2686
|
+
}).timeout(attemptTimeout);
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2689
|
+
describe('#getSearchJobsByIdEvents - errors', () => {
|
|
2690
|
+
it('should have a getSearchJobsByIdEvents function', (done) => {
|
|
2691
|
+
try {
|
|
2692
|
+
assert.equal(true, typeof a.getSearchJobsByIdEvents === 'function');
|
|
2693
|
+
done();
|
|
2694
|
+
} catch (error) {
|
|
2695
|
+
log.error(`Test Failure: ${error}`);
|
|
2696
|
+
done(error);
|
|
2697
|
+
}
|
|
2698
|
+
}).timeout(attemptTimeout);
|
|
2699
|
+
it('should error if - missing searchId', (done) => {
|
|
2700
|
+
try {
|
|
2701
|
+
a.getSearchJobsByIdEvents(null, null, null, null, null, (data, error) => {
|
|
2702
|
+
try {
|
|
2703
|
+
const displayE = 'searchId is required';
|
|
2704
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdEvents', displayE);
|
|
2705
|
+
done();
|
|
2706
|
+
} catch (err) {
|
|
2707
|
+
log.error(`Test Failure: ${err}`);
|
|
2708
|
+
done(err);
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
} catch (error) {
|
|
2712
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2713
|
+
done(error);
|
|
2714
|
+
}
|
|
2715
|
+
}).timeout(attemptTimeout);
|
|
2716
|
+
it('should error if - missing count', (done) => {
|
|
2717
|
+
try {
|
|
2718
|
+
a.getSearchJobsByIdEvents('fakeparam', null, null, null, null, (data, error) => {
|
|
2719
|
+
try {
|
|
2720
|
+
const displayE = 'count is required';
|
|
2721
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdEvents', displayE);
|
|
2722
|
+
done();
|
|
2723
|
+
} catch (err) {
|
|
2724
|
+
log.error(`Test Failure: ${err}`);
|
|
2725
|
+
done(err);
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
} catch (error) {
|
|
2729
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2730
|
+
done(error);
|
|
2731
|
+
}
|
|
2732
|
+
}).timeout(attemptTimeout);
|
|
2733
|
+
it('should error if - missing maxLines', (done) => {
|
|
2734
|
+
try {
|
|
2735
|
+
a.getSearchJobsByIdEvents('fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
2736
|
+
try {
|
|
2737
|
+
const displayE = 'maxLines is required';
|
|
2738
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdEvents', displayE);
|
|
2739
|
+
done();
|
|
2740
|
+
} catch (err) {
|
|
2741
|
+
log.error(`Test Failure: ${err}`);
|
|
2742
|
+
done(err);
|
|
2743
|
+
}
|
|
2744
|
+
});
|
|
2745
|
+
} catch (error) {
|
|
2746
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2747
|
+
done(error);
|
|
2748
|
+
}
|
|
2749
|
+
}).timeout(attemptTimeout);
|
|
2750
|
+
it('should error if - missing outputMode', (done) => {
|
|
2751
|
+
try {
|
|
2752
|
+
a.getSearchJobsByIdEvents('fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
2753
|
+
try {
|
|
2754
|
+
const displayE = 'outputMode is required';
|
|
2755
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdEvents', displayE);
|
|
2756
|
+
done();
|
|
2757
|
+
} catch (err) {
|
|
2758
|
+
log.error(`Test Failure: ${err}`);
|
|
2759
|
+
done(err);
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
} catch (error) {
|
|
2763
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2764
|
+
done(error);
|
|
2765
|
+
}
|
|
2766
|
+
}).timeout(attemptTimeout);
|
|
2767
|
+
it('should error if - missing truncationMode', (done) => {
|
|
2768
|
+
try {
|
|
2769
|
+
a.getSearchJobsByIdEvents('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
2770
|
+
try {
|
|
2771
|
+
const displayE = 'truncationMode is required';
|
|
2772
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdEvents', displayE);
|
|
2773
|
+
done();
|
|
2774
|
+
} catch (err) {
|
|
2775
|
+
log.error(`Test Failure: ${err}`);
|
|
2776
|
+
done(err);
|
|
2777
|
+
}
|
|
2778
|
+
});
|
|
2779
|
+
} catch (error) {
|
|
2780
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2781
|
+
done(error);
|
|
2782
|
+
}
|
|
2783
|
+
}).timeout(attemptTimeout);
|
|
2784
|
+
});
|
|
2785
|
+
|
|
2786
|
+
describe('#getSearchJobsByIdResults - errors', () => {
|
|
2787
|
+
it('should have a getSearchJobsByIdResults function', (done) => {
|
|
2788
|
+
try {
|
|
2789
|
+
assert.equal(true, typeof a.getSearchJobsByIdResults === 'function');
|
|
2790
|
+
done();
|
|
2791
|
+
} catch (error) {
|
|
2792
|
+
log.error(`Test Failure: ${error}`);
|
|
2793
|
+
done(error);
|
|
2794
|
+
}
|
|
2795
|
+
}).timeout(attemptTimeout);
|
|
2796
|
+
it('should error if - missing searchId', (done) => {
|
|
2797
|
+
try {
|
|
2798
|
+
a.getSearchJobsByIdResults(null, null, null, null, (data, error) => {
|
|
2799
|
+
try {
|
|
2800
|
+
const displayE = 'searchId is required';
|
|
2801
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResults', displayE);
|
|
2802
|
+
done();
|
|
2803
|
+
} catch (err) {
|
|
2804
|
+
log.error(`Test Failure: ${err}`);
|
|
2805
|
+
done(err);
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
} catch (error) {
|
|
2809
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2810
|
+
done(error);
|
|
2811
|
+
}
|
|
2812
|
+
}).timeout(attemptTimeout);
|
|
2813
|
+
it('should error if - missing count', (done) => {
|
|
2814
|
+
try {
|
|
2815
|
+
a.getSearchJobsByIdResults('fakeparam', null, null, null, (data, error) => {
|
|
2816
|
+
try {
|
|
2817
|
+
const displayE = 'count is required';
|
|
2818
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResults', displayE);
|
|
2819
|
+
done();
|
|
2820
|
+
} catch (err) {
|
|
2821
|
+
log.error(`Test Failure: ${err}`);
|
|
2822
|
+
done(err);
|
|
2823
|
+
}
|
|
2824
|
+
});
|
|
2825
|
+
} catch (error) {
|
|
2826
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2827
|
+
done(error);
|
|
2828
|
+
}
|
|
2829
|
+
}).timeout(attemptTimeout);
|
|
2830
|
+
it('should error if - missing addSummaryToMetadata', (done) => {
|
|
2831
|
+
try {
|
|
2832
|
+
a.getSearchJobsByIdResults('fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
2833
|
+
try {
|
|
2834
|
+
const displayE = 'addSummaryToMetadata is required';
|
|
2835
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResults', displayE);
|
|
2836
|
+
done();
|
|
2837
|
+
} catch (err) {
|
|
2838
|
+
log.error(`Test Failure: ${err}`);
|
|
2839
|
+
done(err);
|
|
2840
|
+
}
|
|
2841
|
+
});
|
|
2842
|
+
} catch (error) {
|
|
2843
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2844
|
+
done(error);
|
|
2845
|
+
}
|
|
2846
|
+
}).timeout(attemptTimeout);
|
|
2847
|
+
it('should error if - missing search', (done) => {
|
|
2848
|
+
try {
|
|
2849
|
+
a.getSearchJobsByIdResults('fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
2850
|
+
try {
|
|
2851
|
+
const displayE = 'search is required';
|
|
2852
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResults', displayE);
|
|
2853
|
+
done();
|
|
2854
|
+
} catch (err) {
|
|
2855
|
+
log.error(`Test Failure: ${err}`);
|
|
2856
|
+
done(err);
|
|
2857
|
+
}
|
|
2858
|
+
});
|
|
2859
|
+
} catch (error) {
|
|
2860
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2861
|
+
done(error);
|
|
2862
|
+
}
|
|
2863
|
+
}).timeout(attemptTimeout);
|
|
2864
|
+
});
|
|
2865
|
+
|
|
2866
|
+
describe('#getSearchJobsByIdResultsPreview - errors', () => {
|
|
2867
|
+
it('should have a getSearchJobsByIdResultsPreview function', (done) => {
|
|
2868
|
+
try {
|
|
2869
|
+
assert.equal(true, typeof a.getSearchJobsByIdResultsPreview === 'function');
|
|
2870
|
+
done();
|
|
2871
|
+
} catch (error) {
|
|
2872
|
+
log.error(`Test Failure: ${error}`);
|
|
2873
|
+
done(error);
|
|
2874
|
+
}
|
|
2875
|
+
}).timeout(attemptTimeout);
|
|
2876
|
+
it('should error if - missing searchId', (done) => {
|
|
2877
|
+
try {
|
|
2878
|
+
a.getSearchJobsByIdResultsPreview(null, null, null, null, (data, error) => {
|
|
2879
|
+
try {
|
|
2880
|
+
const displayE = 'searchId is required';
|
|
2881
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResultsPreview', displayE);
|
|
2882
|
+
done();
|
|
2883
|
+
} catch (err) {
|
|
2884
|
+
log.error(`Test Failure: ${err}`);
|
|
2885
|
+
done(err);
|
|
2886
|
+
}
|
|
2887
|
+
});
|
|
2888
|
+
} catch (error) {
|
|
2889
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2890
|
+
done(error);
|
|
2891
|
+
}
|
|
2892
|
+
}).timeout(attemptTimeout);
|
|
2893
|
+
it('should error if - missing count', (done) => {
|
|
2894
|
+
try {
|
|
2895
|
+
a.getSearchJobsByIdResultsPreview('fakeparam', null, null, null, (data, error) => {
|
|
2896
|
+
try {
|
|
2897
|
+
const displayE = 'count is required';
|
|
2898
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResultsPreview', displayE);
|
|
2899
|
+
done();
|
|
2900
|
+
} catch (err) {
|
|
2901
|
+
log.error(`Test Failure: ${err}`);
|
|
2902
|
+
done(err);
|
|
2903
|
+
}
|
|
2904
|
+
});
|
|
2905
|
+
} catch (error) {
|
|
2906
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2907
|
+
done(error);
|
|
2908
|
+
}
|
|
2909
|
+
}).timeout(attemptTimeout);
|
|
2910
|
+
it('should error if - missing addSummaryToMetadata', (done) => {
|
|
2911
|
+
try {
|
|
2912
|
+
a.getSearchJobsByIdResultsPreview('fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
2913
|
+
try {
|
|
2914
|
+
const displayE = 'addSummaryToMetadata is required';
|
|
2915
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResultsPreview', displayE);
|
|
2916
|
+
done();
|
|
2917
|
+
} catch (err) {
|
|
2918
|
+
log.error(`Test Failure: ${err}`);
|
|
2919
|
+
done(err);
|
|
2920
|
+
}
|
|
2921
|
+
});
|
|
2922
|
+
} catch (error) {
|
|
2923
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2924
|
+
done(error);
|
|
2925
|
+
}
|
|
2926
|
+
}).timeout(attemptTimeout);
|
|
2927
|
+
it('should error if - missing search', (done) => {
|
|
2928
|
+
try {
|
|
2929
|
+
a.getSearchJobsByIdResultsPreview('fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
2930
|
+
try {
|
|
2931
|
+
const displayE = 'search is required';
|
|
2932
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdResultsPreview', displayE);
|
|
2933
|
+
done();
|
|
2934
|
+
} catch (err) {
|
|
2935
|
+
log.error(`Test Failure: ${err}`);
|
|
2936
|
+
done(err);
|
|
2937
|
+
}
|
|
2938
|
+
});
|
|
2939
|
+
} catch (error) {
|
|
2940
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2941
|
+
done(error);
|
|
2942
|
+
}
|
|
2943
|
+
}).timeout(attemptTimeout);
|
|
2944
|
+
});
|
|
2945
|
+
|
|
2946
|
+
describe('#getSearchJobsSearchLogs - errors', () => {
|
|
2947
|
+
it('should have a getSearchJobsSearchLogs function', (done) => {
|
|
2948
|
+
try {
|
|
2949
|
+
assert.equal(true, typeof a.getSearchJobsSearchLogs === 'function');
|
|
2950
|
+
done();
|
|
2951
|
+
} catch (error) {
|
|
2952
|
+
log.error(`Test Failure: ${error}`);
|
|
2953
|
+
done(error);
|
|
2954
|
+
}
|
|
2955
|
+
}).timeout(attemptTimeout);
|
|
2956
|
+
it('should error if - missing searchId', (done) => {
|
|
2957
|
+
try {
|
|
2958
|
+
a.getSearchJobsSearchLogs(null, null, (data, error) => {
|
|
2959
|
+
try {
|
|
2960
|
+
const displayE = 'searchId is required';
|
|
2961
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsSearchLogs', displayE);
|
|
2962
|
+
done();
|
|
2963
|
+
} catch (err) {
|
|
2964
|
+
log.error(`Test Failure: ${err}`);
|
|
2965
|
+
done(err);
|
|
2966
|
+
}
|
|
2967
|
+
});
|
|
2968
|
+
} catch (error) {
|
|
2969
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2970
|
+
done(error);
|
|
2971
|
+
}
|
|
2972
|
+
}).timeout(attemptTimeout);
|
|
2973
|
+
it('should error if - missing attachment', (done) => {
|
|
2974
|
+
try {
|
|
2975
|
+
a.getSearchJobsSearchLogs('fakeparam', null, (data, error) => {
|
|
2976
|
+
try {
|
|
2977
|
+
const displayE = 'attachment is required';
|
|
2978
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsSearchLogs', displayE);
|
|
2979
|
+
done();
|
|
2980
|
+
} catch (err) {
|
|
2981
|
+
log.error(`Test Failure: ${err}`);
|
|
2982
|
+
done(err);
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2985
|
+
} catch (error) {
|
|
2986
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2987
|
+
done(error);
|
|
2988
|
+
}
|
|
2989
|
+
}).timeout(attemptTimeout);
|
|
2990
|
+
});
|
|
2991
|
+
|
|
2992
|
+
describe('#getSearchJobsbyIdSummary - errors', () => {
|
|
2993
|
+
it('should have a getSearchJobsbyIdSummary function', (done) => {
|
|
2994
|
+
try {
|
|
2995
|
+
assert.equal(true, typeof a.getSearchJobsbyIdSummary === 'function');
|
|
2996
|
+
done();
|
|
2997
|
+
} catch (error) {
|
|
2998
|
+
log.error(`Test Failure: ${error}`);
|
|
2999
|
+
done(error);
|
|
3000
|
+
}
|
|
3001
|
+
}).timeout(attemptTimeout);
|
|
3002
|
+
it('should error if - missing searchId', (done) => {
|
|
3003
|
+
try {
|
|
3004
|
+
a.getSearchJobsbyIdSummary(null, (data, error) => {
|
|
3005
|
+
try {
|
|
3006
|
+
const displayE = 'searchId is required';
|
|
3007
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsbyIdSummary', displayE);
|
|
3008
|
+
done();
|
|
3009
|
+
} catch (err) {
|
|
3010
|
+
log.error(`Test Failure: ${err}`);
|
|
3011
|
+
done(err);
|
|
3012
|
+
}
|
|
3013
|
+
});
|
|
3014
|
+
} catch (error) {
|
|
3015
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3016
|
+
done(error);
|
|
3017
|
+
}
|
|
3018
|
+
}).timeout(attemptTimeout);
|
|
3019
|
+
});
|
|
3020
|
+
|
|
3021
|
+
describe('#getSearchJobsByIdTimeline - errors', () => {
|
|
3022
|
+
it('should have a getSearchJobsByIdTimeline function', (done) => {
|
|
3023
|
+
try {
|
|
3024
|
+
assert.equal(true, typeof a.getSearchJobsByIdTimeline === 'function');
|
|
3025
|
+
done();
|
|
3026
|
+
} catch (error) {
|
|
3027
|
+
log.error(`Test Failure: ${error}`);
|
|
3028
|
+
done(error);
|
|
3029
|
+
}
|
|
3030
|
+
}).timeout(attemptTimeout);
|
|
3031
|
+
it('should error if - missing searchId', (done) => {
|
|
3032
|
+
try {
|
|
3033
|
+
a.getSearchJobsByIdTimeline(null, null, null, (data, error) => {
|
|
3034
|
+
try {
|
|
3035
|
+
const displayE = 'searchId is required';
|
|
3036
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdTimeline', displayE);
|
|
3037
|
+
done();
|
|
3038
|
+
} catch (err) {
|
|
3039
|
+
log.error(`Test Failure: ${err}`);
|
|
3040
|
+
done(err);
|
|
3041
|
+
}
|
|
3042
|
+
});
|
|
3043
|
+
} catch (error) {
|
|
3044
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3045
|
+
done(error);
|
|
3046
|
+
}
|
|
3047
|
+
}).timeout(attemptTimeout);
|
|
3048
|
+
it('should error if - missing outputTimeFormat', (done) => {
|
|
3049
|
+
try {
|
|
3050
|
+
a.getSearchJobsByIdTimeline('fakeparam', null, null, (data, error) => {
|
|
3051
|
+
try {
|
|
3052
|
+
const displayE = 'outputTimeFormat is required';
|
|
3053
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdTimeline', displayE);
|
|
3054
|
+
done();
|
|
3055
|
+
} catch (err) {
|
|
3056
|
+
log.error(`Test Failure: ${err}`);
|
|
3057
|
+
done(err);
|
|
3058
|
+
}
|
|
3059
|
+
});
|
|
3060
|
+
} catch (error) {
|
|
3061
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3062
|
+
done(error);
|
|
3063
|
+
}
|
|
3064
|
+
}).timeout(attemptTimeout);
|
|
3065
|
+
it('should error if - missing timeFormat', (done) => {
|
|
3066
|
+
try {
|
|
3067
|
+
a.getSearchJobsByIdTimeline('fakeparam', 'fakeparam', null, (data, error) => {
|
|
3068
|
+
try {
|
|
3069
|
+
const displayE = 'timeFormat is required';
|
|
3070
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchJobsByIdTimeline', displayE);
|
|
3071
|
+
done();
|
|
3072
|
+
} catch (err) {
|
|
3073
|
+
log.error(`Test Failure: ${err}`);
|
|
3074
|
+
done(err);
|
|
3075
|
+
}
|
|
3076
|
+
});
|
|
3077
|
+
} catch (error) {
|
|
3078
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3079
|
+
done(error);
|
|
3080
|
+
}
|
|
3081
|
+
}).timeout(attemptTimeout);
|
|
3082
|
+
});
|
|
3083
|
+
|
|
3084
|
+
describe('#getSearchParser - errors', () => {
|
|
3085
|
+
it('should have a getSearchParser function', (done) => {
|
|
3086
|
+
try {
|
|
3087
|
+
assert.equal(true, typeof a.getSearchParser === 'function');
|
|
3088
|
+
done();
|
|
3089
|
+
} catch (error) {
|
|
3090
|
+
log.error(`Test Failure: ${error}`);
|
|
3091
|
+
done(error);
|
|
3092
|
+
}
|
|
3093
|
+
}).timeout(attemptTimeout);
|
|
3094
|
+
it('should error if - missing q', (done) => {
|
|
3095
|
+
try {
|
|
3096
|
+
a.getSearchParser(null, (data, error) => {
|
|
3097
|
+
try {
|
|
3098
|
+
const displayE = 'q is required';
|
|
3099
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchParser', displayE);
|
|
3100
|
+
done();
|
|
3101
|
+
} catch (err) {
|
|
3102
|
+
log.error(`Test Failure: ${err}`);
|
|
3103
|
+
done(err);
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
} catch (error) {
|
|
3107
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3108
|
+
done(error);
|
|
3109
|
+
}
|
|
3110
|
+
}).timeout(attemptTimeout);
|
|
3111
|
+
});
|
|
3112
|
+
|
|
3113
|
+
describe('#getSearchScheduler - errors', () => {
|
|
3114
|
+
it('should have a getSearchScheduler function', (done) => {
|
|
3115
|
+
try {
|
|
3116
|
+
assert.equal(true, typeof a.getSearchScheduler === 'function');
|
|
3117
|
+
done();
|
|
3118
|
+
} catch (error) {
|
|
3119
|
+
log.error(`Test Failure: ${error}`);
|
|
3120
|
+
done(error);
|
|
3121
|
+
}
|
|
3122
|
+
}).timeout(attemptTimeout);
|
|
3123
|
+
});
|
|
3124
|
+
|
|
3125
|
+
describe('#postSearchSchedulerStatus - errors', () => {
|
|
3126
|
+
it('should have a postSearchSchedulerStatus function', (done) => {
|
|
3127
|
+
try {
|
|
3128
|
+
assert.equal(true, typeof a.postSearchSchedulerStatus === 'function');
|
|
3129
|
+
done();
|
|
3130
|
+
} catch (error) {
|
|
3131
|
+
log.error(`Test Failure: ${error}`);
|
|
3132
|
+
done(error);
|
|
3133
|
+
}
|
|
3134
|
+
}).timeout(attemptTimeout);
|
|
3135
|
+
it('should error if - missing body', (done) => {
|
|
3136
|
+
try {
|
|
3137
|
+
a.postSearchSchedulerStatus(null, (data, error) => {
|
|
3138
|
+
try {
|
|
3139
|
+
const displayE = 'body is required';
|
|
3140
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-postSearchSchedulerStatus', displayE);
|
|
3141
|
+
done();
|
|
3142
|
+
} catch (err) {
|
|
3143
|
+
log.error(`Test Failure: ${err}`);
|
|
3144
|
+
done(err);
|
|
3145
|
+
}
|
|
3146
|
+
});
|
|
3147
|
+
} catch (error) {
|
|
3148
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3149
|
+
done(error);
|
|
3150
|
+
}
|
|
3151
|
+
}).timeout(attemptTimeout);
|
|
3152
|
+
});
|
|
3153
|
+
|
|
3154
|
+
describe('#getSearchTimerParser - errors', () => {
|
|
3155
|
+
it('should have a getSearchTimerParser function', (done) => {
|
|
3156
|
+
try {
|
|
3157
|
+
assert.equal(true, typeof a.getSearchTimerParser === 'function');
|
|
3158
|
+
done();
|
|
3159
|
+
} catch (error) {
|
|
3160
|
+
log.error(`Test Failure: ${error}`);
|
|
3161
|
+
done(error);
|
|
3162
|
+
}
|
|
3163
|
+
}).timeout(attemptTimeout);
|
|
3164
|
+
it('should error if - missing time', (done) => {
|
|
3165
|
+
try {
|
|
3166
|
+
a.getSearchTimerParser(null, (data, error) => {
|
|
3167
|
+
try {
|
|
3168
|
+
const displayE = 'time is required';
|
|
3169
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchTimerParser', displayE);
|
|
3170
|
+
done();
|
|
3171
|
+
} catch (err) {
|
|
3172
|
+
log.error(`Test Failure: ${err}`);
|
|
3173
|
+
done(err);
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
} catch (error) {
|
|
3177
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3178
|
+
done(error);
|
|
3179
|
+
}
|
|
3180
|
+
}).timeout(attemptTimeout);
|
|
3181
|
+
});
|
|
3182
|
+
|
|
3183
|
+
describe('#getSearchTypeHead - errors', () => {
|
|
3184
|
+
it('should have a getSearchTypeHead function', (done) => {
|
|
3185
|
+
try {
|
|
3186
|
+
assert.equal(true, typeof a.getSearchTypeHead === 'function');
|
|
3187
|
+
done();
|
|
3188
|
+
} catch (error) {
|
|
3189
|
+
log.error(`Test Failure: ${error}`);
|
|
3190
|
+
done(error);
|
|
3191
|
+
}
|
|
3192
|
+
}).timeout(attemptTimeout);
|
|
3193
|
+
it('should error if - missing count', (done) => {
|
|
3194
|
+
try {
|
|
3195
|
+
a.getSearchTypeHead(null, null, (data, error) => {
|
|
3196
|
+
try {
|
|
3197
|
+
const displayE = 'count is required';
|
|
3198
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchTypeHead', displayE);
|
|
3199
|
+
done();
|
|
3200
|
+
} catch (err) {
|
|
3201
|
+
log.error(`Test Failure: ${err}`);
|
|
3202
|
+
done(err);
|
|
3203
|
+
}
|
|
3204
|
+
});
|
|
3205
|
+
} catch (error) {
|
|
3206
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3207
|
+
done(error);
|
|
3208
|
+
}
|
|
3209
|
+
}).timeout(attemptTimeout);
|
|
3210
|
+
it('should error if - missing prefix', (done) => {
|
|
3211
|
+
try {
|
|
3212
|
+
a.getSearchTypeHead('fakeparam', null, (data, error) => {
|
|
3213
|
+
try {
|
|
3214
|
+
const displayE = 'prefix is required';
|
|
3215
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getSearchTypeHead', displayE);
|
|
3216
|
+
done();
|
|
3217
|
+
} catch (err) {
|
|
3218
|
+
log.error(`Test Failure: ${err}`);
|
|
3219
|
+
done(err);
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
} catch (error) {
|
|
3223
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3224
|
+
done(error);
|
|
3225
|
+
}
|
|
3226
|
+
}).timeout(attemptTimeout);
|
|
3227
|
+
});
|
|
3228
|
+
|
|
3229
|
+
describe('#getAlertActions - errors', () => {
|
|
3230
|
+
it('should have a getAlertActions function', (done) => {
|
|
3231
|
+
try {
|
|
3232
|
+
assert.equal(true, typeof a.getAlertActions === 'function');
|
|
3233
|
+
done();
|
|
3234
|
+
} catch (error) {
|
|
3235
|
+
log.error(`Test Failure: ${error}`);
|
|
3236
|
+
done(error);
|
|
3237
|
+
}
|
|
3238
|
+
}).timeout(attemptTimeout);
|
|
3239
|
+
it('should error if - missing count', (done) => {
|
|
3240
|
+
try {
|
|
3241
|
+
a.getAlertActions(null, null, null, null, null, null, null, null, (data, error) => {
|
|
3242
|
+
try {
|
|
3243
|
+
const displayE = 'count is required';
|
|
3244
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3245
|
+
done();
|
|
3246
|
+
} catch (err) {
|
|
3247
|
+
log.error(`Test Failure: ${err}`);
|
|
3248
|
+
done(err);
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
} catch (error) {
|
|
3252
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3253
|
+
done(error);
|
|
3254
|
+
}
|
|
3255
|
+
}).timeout(attemptTimeout);
|
|
3256
|
+
it('should error if - missing f', (done) => {
|
|
3257
|
+
try {
|
|
3258
|
+
a.getAlertActions('fakeparam', null, null, null, null, null, null, null, (data, error) => {
|
|
3259
|
+
try {
|
|
3260
|
+
const displayE = 'f is required';
|
|
3261
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3262
|
+
done();
|
|
3263
|
+
} catch (err) {
|
|
3264
|
+
log.error(`Test Failure: ${err}`);
|
|
3265
|
+
done(err);
|
|
3266
|
+
}
|
|
3267
|
+
});
|
|
3268
|
+
} catch (error) {
|
|
3269
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3270
|
+
done(error);
|
|
3271
|
+
}
|
|
3272
|
+
}).timeout(attemptTimeout);
|
|
3273
|
+
it('should error if - missing offset', (done) => {
|
|
3274
|
+
try {
|
|
3275
|
+
a.getAlertActions('fakeparam', 'fakeparam', null, null, null, null, null, null, (data, error) => {
|
|
3276
|
+
try {
|
|
3277
|
+
const displayE = 'offset is required';
|
|
3278
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3279
|
+
done();
|
|
3280
|
+
} catch (err) {
|
|
3281
|
+
log.error(`Test Failure: ${err}`);
|
|
3282
|
+
done(err);
|
|
3283
|
+
}
|
|
3284
|
+
});
|
|
3285
|
+
} catch (error) {
|
|
3286
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3287
|
+
done(error);
|
|
3288
|
+
}
|
|
3289
|
+
}).timeout(attemptTimeout);
|
|
3290
|
+
it('should error if - missing search', (done) => {
|
|
3291
|
+
try {
|
|
3292
|
+
a.getAlertActions('fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, null, (data, error) => {
|
|
3293
|
+
try {
|
|
3294
|
+
const displayE = 'search is required';
|
|
3295
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3296
|
+
done();
|
|
3297
|
+
} catch (err) {
|
|
3298
|
+
log.error(`Test Failure: ${err}`);
|
|
3299
|
+
done(err);
|
|
3300
|
+
}
|
|
3301
|
+
});
|
|
3302
|
+
} catch (error) {
|
|
3303
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3304
|
+
done(error);
|
|
3305
|
+
}
|
|
3306
|
+
}).timeout(attemptTimeout);
|
|
3307
|
+
it('should error if - missing sortDir', (done) => {
|
|
3308
|
+
try {
|
|
3309
|
+
a.getAlertActions('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, (data, error) => {
|
|
3310
|
+
try {
|
|
3311
|
+
const displayE = 'sortDir is required';
|
|
3312
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3313
|
+
done();
|
|
3314
|
+
} catch (err) {
|
|
3315
|
+
log.error(`Test Failure: ${err}`);
|
|
3316
|
+
done(err);
|
|
3317
|
+
}
|
|
3318
|
+
});
|
|
3319
|
+
} catch (error) {
|
|
3320
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3321
|
+
done(error);
|
|
3322
|
+
}
|
|
3323
|
+
}).timeout(attemptTimeout);
|
|
3324
|
+
it('should error if - missing sortKey', (done) => {
|
|
3325
|
+
try {
|
|
3326
|
+
a.getAlertActions('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
3327
|
+
try {
|
|
3328
|
+
const displayE = 'sortKey is required';
|
|
3329
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3330
|
+
done();
|
|
3331
|
+
} catch (err) {
|
|
3332
|
+
log.error(`Test Failure: ${err}`);
|
|
3333
|
+
done(err);
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
} catch (error) {
|
|
3337
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3338
|
+
done(error);
|
|
3339
|
+
}
|
|
3340
|
+
}).timeout(attemptTimeout);
|
|
3341
|
+
it('should error if - missing sortMode', (done) => {
|
|
3342
|
+
try {
|
|
3343
|
+
a.getAlertActions('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
3344
|
+
try {
|
|
3345
|
+
const displayE = 'sortMode is required';
|
|
3346
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3347
|
+
done();
|
|
3348
|
+
} catch (err) {
|
|
3349
|
+
log.error(`Test Failure: ${err}`);
|
|
3350
|
+
done(err);
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
} catch (error) {
|
|
3354
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3355
|
+
done(error);
|
|
3356
|
+
}
|
|
3357
|
+
}).timeout(attemptTimeout);
|
|
3358
|
+
it('should error if - missing summarize', (done) => {
|
|
3359
|
+
try {
|
|
3360
|
+
a.getAlertActions('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
3361
|
+
try {
|
|
3362
|
+
const displayE = 'summarize is required';
|
|
3363
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getAlertActions', displayE);
|
|
3364
|
+
done();
|
|
3365
|
+
} catch (err) {
|
|
3366
|
+
log.error(`Test Failure: ${err}`);
|
|
3367
|
+
done(err);
|
|
3368
|
+
}
|
|
3369
|
+
});
|
|
3370
|
+
} catch (error) {
|
|
3371
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3372
|
+
done(error);
|
|
3373
|
+
}
|
|
3374
|
+
}).timeout(attemptTimeout);
|
|
3375
|
+
});
|
|
3376
|
+
|
|
3377
|
+
describe('#getFiredAlerts - errors', () => {
|
|
3378
|
+
it('should have a getFiredAlerts function', (done) => {
|
|
3379
|
+
try {
|
|
3380
|
+
assert.equal(true, typeof a.getFiredAlerts === 'function');
|
|
3381
|
+
done();
|
|
3382
|
+
} catch (error) {
|
|
3383
|
+
log.error(`Test Failure: ${error}`);
|
|
3384
|
+
done(error);
|
|
3385
|
+
}
|
|
3386
|
+
}).timeout(attemptTimeout);
|
|
3387
|
+
it('should error if - missing count', (done) => {
|
|
3388
|
+
try {
|
|
3389
|
+
a.getFiredAlerts(null, null, null, null, null, null, null, null, (data, error) => {
|
|
3390
|
+
try {
|
|
3391
|
+
const displayE = 'count is required';
|
|
3392
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3393
|
+
done();
|
|
3394
|
+
} catch (err) {
|
|
3395
|
+
log.error(`Test Failure: ${err}`);
|
|
3396
|
+
done(err);
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3399
|
+
} catch (error) {
|
|
3400
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3401
|
+
done(error);
|
|
3402
|
+
}
|
|
3403
|
+
}).timeout(attemptTimeout);
|
|
3404
|
+
it('should error if - missing f', (done) => {
|
|
3405
|
+
try {
|
|
3406
|
+
a.getFiredAlerts('fakeparam', null, null, null, null, null, null, null, (data, error) => {
|
|
3407
|
+
try {
|
|
3408
|
+
const displayE = 'f is required';
|
|
3409
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3410
|
+
done();
|
|
3411
|
+
} catch (err) {
|
|
3412
|
+
log.error(`Test Failure: ${err}`);
|
|
3413
|
+
done(err);
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
} catch (error) {
|
|
3417
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3418
|
+
done(error);
|
|
3419
|
+
}
|
|
3420
|
+
}).timeout(attemptTimeout);
|
|
3421
|
+
it('should error if - missing offset', (done) => {
|
|
3422
|
+
try {
|
|
3423
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', null, null, null, null, null, null, (data, error) => {
|
|
3424
|
+
try {
|
|
3425
|
+
const displayE = 'offset is required';
|
|
3426
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3427
|
+
done();
|
|
3428
|
+
} catch (err) {
|
|
3429
|
+
log.error(`Test Failure: ${err}`);
|
|
3430
|
+
done(err);
|
|
3431
|
+
}
|
|
3432
|
+
});
|
|
3433
|
+
} catch (error) {
|
|
3434
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3435
|
+
done(error);
|
|
3436
|
+
}
|
|
3437
|
+
}).timeout(attemptTimeout);
|
|
3438
|
+
it('should error if - missing search', (done) => {
|
|
3439
|
+
try {
|
|
3440
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, null, (data, error) => {
|
|
3441
|
+
try {
|
|
3442
|
+
const displayE = 'search is required';
|
|
3443
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3444
|
+
done();
|
|
3445
|
+
} catch (err) {
|
|
3446
|
+
log.error(`Test Failure: ${err}`);
|
|
3447
|
+
done(err);
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
} catch (error) {
|
|
3451
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3452
|
+
done(error);
|
|
3453
|
+
}
|
|
3454
|
+
}).timeout(attemptTimeout);
|
|
3455
|
+
it('should error if - missing sortDir', (done) => {
|
|
3456
|
+
try {
|
|
3457
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, null, (data, error) => {
|
|
3458
|
+
try {
|
|
3459
|
+
const displayE = 'sortDir is required';
|
|
3460
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3461
|
+
done();
|
|
3462
|
+
} catch (err) {
|
|
3463
|
+
log.error(`Test Failure: ${err}`);
|
|
3464
|
+
done(err);
|
|
3465
|
+
}
|
|
3466
|
+
});
|
|
3467
|
+
} catch (error) {
|
|
3468
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3469
|
+
done(error);
|
|
3470
|
+
}
|
|
3471
|
+
}).timeout(attemptTimeout);
|
|
3472
|
+
it('should error if - missing sortKey', (done) => {
|
|
3473
|
+
try {
|
|
3474
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, null, (data, error) => {
|
|
3475
|
+
try {
|
|
3476
|
+
const displayE = 'sortKey is required';
|
|
3477
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3478
|
+
done();
|
|
3479
|
+
} catch (err) {
|
|
3480
|
+
log.error(`Test Failure: ${err}`);
|
|
3481
|
+
done(err);
|
|
3482
|
+
}
|
|
3483
|
+
});
|
|
3484
|
+
} catch (error) {
|
|
3485
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3486
|
+
done(error);
|
|
3487
|
+
}
|
|
3488
|
+
}).timeout(attemptTimeout);
|
|
3489
|
+
it('should error if - missing sortMode', (done) => {
|
|
3490
|
+
try {
|
|
3491
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
3492
|
+
try {
|
|
3493
|
+
const displayE = 'sortMode is required';
|
|
3494
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3495
|
+
done();
|
|
3496
|
+
} catch (err) {
|
|
3497
|
+
log.error(`Test Failure: ${err}`);
|
|
3498
|
+
done(err);
|
|
3499
|
+
}
|
|
3500
|
+
});
|
|
3501
|
+
} catch (error) {
|
|
3502
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3503
|
+
done(error);
|
|
3504
|
+
}
|
|
3505
|
+
}).timeout(attemptTimeout);
|
|
3506
|
+
it('should error if - missing summarize', (done) => {
|
|
3507
|
+
try {
|
|
3508
|
+
a.getFiredAlerts('fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
3509
|
+
try {
|
|
3510
|
+
const displayE = 'summarize is required';
|
|
3511
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlerts', displayE);
|
|
3512
|
+
done();
|
|
3513
|
+
} catch (err) {
|
|
3514
|
+
log.error(`Test Failure: ${err}`);
|
|
3515
|
+
done(err);
|
|
3516
|
+
}
|
|
3517
|
+
});
|
|
3518
|
+
} catch (error) {
|
|
3519
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3520
|
+
done(error);
|
|
3521
|
+
}
|
|
3522
|
+
}).timeout(attemptTimeout);
|
|
3523
|
+
});
|
|
3524
|
+
|
|
3525
|
+
describe('#getFiredAlertsbyName - errors', () => {
|
|
3526
|
+
it('should have a getFiredAlertsbyName function', (done) => {
|
|
3527
|
+
try {
|
|
3528
|
+
assert.equal(true, typeof a.getFiredAlertsbyName === 'function');
|
|
3529
|
+
done();
|
|
3530
|
+
} catch (error) {
|
|
3531
|
+
log.error(`Test Failure: ${error}`);
|
|
3532
|
+
done(error);
|
|
3533
|
+
}
|
|
3534
|
+
}).timeout(attemptTimeout);
|
|
3535
|
+
it('should error if - missing name', (done) => {
|
|
3536
|
+
try {
|
|
3537
|
+
a.getFiredAlertsbyName(null, (data, error) => {
|
|
3538
|
+
try {
|
|
3539
|
+
const displayE = 'name is required';
|
|
3540
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-getFiredAlertsbyName', displayE);
|
|
3541
|
+
done();
|
|
3542
|
+
} catch (err) {
|
|
3543
|
+
log.error(`Test Failure: ${err}`);
|
|
3544
|
+
done(err);
|
|
3545
|
+
}
|
|
3546
|
+
});
|
|
3547
|
+
} catch (error) {
|
|
3548
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3549
|
+
done(error);
|
|
3550
|
+
}
|
|
3551
|
+
}).timeout(attemptTimeout);
|
|
3552
|
+
});
|
|
3553
|
+
|
|
3554
|
+
describe('#deleteFiredAlertsByName - errors', () => {
|
|
3555
|
+
it('should have a deleteFiredAlertsByName function', (done) => {
|
|
3556
|
+
try {
|
|
3557
|
+
assert.equal(true, typeof a.deleteFiredAlertsByName === 'function');
|
|
3558
|
+
done();
|
|
3559
|
+
} catch (error) {
|
|
3560
|
+
log.error(`Test Failure: ${error}`);
|
|
3561
|
+
done(error);
|
|
3562
|
+
}
|
|
3563
|
+
}).timeout(attemptTimeout);
|
|
3564
|
+
it('should error if - missing name', (done) => {
|
|
3565
|
+
try {
|
|
3566
|
+
a.deleteFiredAlertsByName(null, null, (data, error) => {
|
|
3567
|
+
try {
|
|
3568
|
+
const displayE = 'name is required';
|
|
3569
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-splunk-adapter-deleteFiredAlertsByName', displayE);
|
|
3570
|
+
done();
|
|
3571
|
+
} catch (err) {
|
|
3572
|
+
log.error(`Test Failure: ${err}`);
|
|
3573
|
+
done(err);
|
|
3574
|
+
}
|
|
3575
|
+
});
|
|
3576
|
+
} catch (error) {
|
|
3577
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3578
|
+
done(error);
|
|
3579
|
+
}
|
|
3580
|
+
}).timeout(attemptTimeout);
|
|
3581
|
+
});
|
|
3582
|
+
|
|
3583
|
+
describe('#getDataCommands - errors', () => {
|
|
3584
|
+
it('should have a getDataCommands function', (done) => {
|
|
3585
|
+
try {
|
|
3586
|
+
assert.equal(true, typeof a.getDataCommands === 'function');
|
|
3587
|
+
done();
|
|
3588
|
+
} catch (error) {
|
|
3589
|
+
log.error(`Test Failure: ${error}`);
|
|
3590
|
+
done(error);
|
|
3591
|
+
}
|
|
3592
|
+
}).timeout(attemptTimeout);
|
|
3593
|
+
});
|
|
3594
|
+
});
|
|
3595
|
+
});
|