@gatling.io/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -0
- package/target/assertions.d.ts +214 -0
- package/target/assertions.js +63 -0
- package/target/body.d.ts +150 -0
- package/target/body.js +33 -0
- package/target/checks/builder.d.ts +10 -0
- package/target/checks/builder.js +7 -0
- package/target/checks/captureGroup.d.ts +15 -0
- package/target/checks/captureGroup.js +9 -0
- package/target/checks/condition.d.ts +19 -0
- package/target/checks/condition.js +7 -0
- package/target/checks/final.d.ts +23 -0
- package/target/checks/final.js +10 -0
- package/target/checks/find.d.ts +17 -0
- package/target/checks/find.js +9 -0
- package/target/checks/index.d.ts +408 -0
- package/target/checks/index.js +181 -0
- package/target/checks/jsonOfTypeFind.d.ts +56 -0
- package/target/checks/jsonOfTypeFind.js +16 -0
- package/target/checks/jsonOfTypeMultipleFind.d.ts +56 -0
- package/target/checks/jsonOfTypeMultipleFind.js +16 -0
- package/target/checks/multipleFind.d.ts +57 -0
- package/target/checks/multipleFind.js +26 -0
- package/target/checks/validate.d.ts +242 -0
- package/target/checks/validate.js +50 -0
- package/target/closedInjection.d.ts +33 -0
- package/target/closedInjection.js +38 -0
- package/target/common.d.ts +3 -0
- package/target/common.js +2 -0
- package/target/feeders.d.ts +203 -0
- package/target/feeders.js +74 -0
- package/target/filters.d.ts +31 -0
- package/target/filters.js +32 -0
- package/target/gatlingJvm/app.d.ts +4 -0
- package/target/gatlingJvm/app.js +2 -0
- package/target/gatlingJvm/callbacks.d.ts +9 -0
- package/target/gatlingJvm/callbacks.js +14 -0
- package/target/gatlingJvm/collections.d.ts +1 -0
- package/target/gatlingJvm/collections.js +31 -0
- package/target/index.d.ts +115 -0
- package/target/index.js +56 -0
- package/target/openInjection.d.ts +51 -0
- package/target/openInjection.js +62 -0
- package/target/population.d.ts +82 -0
- package/target/population.js +22 -0
- package/target/protocol.d.ts +5 -0
- package/target/protocol.js +3 -0
- package/target/scenario.d.ts +10 -0
- package/target/scenario.js +17 -0
- package/target/session.d.ts +28 -0
- package/target/session.js +42 -0
- package/target/structure/asLongAs.d.ts +74 -0
- package/target/structure/asLongAs.js +47 -0
- package/target/structure/asLongAsDuring.d.ts +221 -0
- package/target/structure/asLongAsDuring.js +92 -0
- package/target/structure/choices.d.ts +18 -0
- package/target/structure/choices.js +21 -0
- package/target/structure/doIf.d.ts +83 -0
- package/target/structure/doIf.js +39 -0
- package/target/structure/doIfOrElse.d.ts +86 -0
- package/target/structure/doIfOrElse.js +42 -0
- package/target/structure/doSwitch.d.ts +27 -0
- package/target/structure/doSwitch.js +13 -0
- package/target/structure/doSwitchOrElse.d.ts +34 -0
- package/target/structure/doSwitchOrElse.js +16 -0
- package/target/structure/doWhile.d.ts +28 -0
- package/target/structure/doWhile.js +28 -0
- package/target/structure/doWhileDuring.d.ts +225 -0
- package/target/structure/doWhileDuring.js +92 -0
- package/target/structure/during.d.ts +123 -0
- package/target/structure/during.js +60 -0
- package/target/structure/errors.d.ts +121 -0
- package/target/structure/errors.js +42 -0
- package/target/structure/execs.d.ts +46 -0
- package/target/structure/execs.js +15 -0
- package/target/structure/feeds.d.ts +42 -0
- package/target/structure/feeds.js +21 -0
- package/target/structure/forEach.d.ts +38 -0
- package/target/structure/forEach.js +34 -0
- package/target/structure/forever.d.ts +16 -0
- package/target/structure/forever.js +7 -0
- package/target/structure/groups.d.ts +17 -0
- package/target/structure/groups.js +9 -0
- package/target/structure/index.d.ts +64 -0
- package/target/structure/index.js +97 -0
- package/target/structure/jvmStructureBuilder.d.ts +28 -0
- package/target/structure/jvmStructureBuilder.js +3 -0
- package/target/structure/on.d.ts +12 -0
- package/target/structure/on.js +7 -0
- package/target/structure/paces.d.ts +101 -0
- package/target/structure/paces.js +58 -0
- package/target/structure/pauses.d.ts +127 -0
- package/target/structure/pauses.js +92 -0
- package/target/structure/randomSwitch.d.ts +19 -0
- package/target/structure/randomSwitch.js +9 -0
- package/target/structure/randomSwitchOrElse.d.ts +23 -0
- package/target/structure/randomSwitchOrElse.js +12 -0
- package/target/structure/rendezVous.d.ts +15 -0
- package/target/structure/rendezVous.js +6 -0
- package/target/structure/repeat.d.ts +34 -0
- package/target/structure/repeat.js +34 -0
- package/target/structure/roundRobinSwitch.d.ts +18 -0
- package/target/structure/roundRobinSwitch.js +9 -0
- package/target/structure/uniformRandomSwitch.d.ts +18 -0
- package/target/structure/uniformRandomSwitch.js +9 -0
- package/target/throttling.d.ts +43 -0
- package/target/throttling.js +36 -0
- package/target/utils/duration.d.ts +7 -0
- package/target/utils/duration.js +21 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import JvmFeederBuilder = io.gatling.javaapi.core.FeederBuilder;
|
|
2
|
+
import JvmFeederBuilderFileBased = io.gatling.javaapi.core.FeederBuilder$FileBased;
|
|
3
|
+
import { Wrapper } from "./common";
|
|
4
|
+
export interface FeederBuilder<T> extends Wrapper<JvmFeederBuilder<T>> {
|
|
5
|
+
/**
|
|
6
|
+
* Set a queue strategy. Records will be provided in the same order as defined in the underlying
|
|
7
|
+
* source. A given record will only be provided once. The run will be immediately stopped if the
|
|
8
|
+
* feeder runs out of records.
|
|
9
|
+
*
|
|
10
|
+
* @returns a new FeederBuilder
|
|
11
|
+
*/
|
|
12
|
+
queue(): FeederBuilder<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Set a random strategy. Records will be provided in a random order, unrelated to the order in
|
|
15
|
+
* the underlying source. A given record can be provided multiple times. Such feeder will never
|
|
16
|
+
* run out of records.
|
|
17
|
+
*
|
|
18
|
+
* @returns a new FeederBuilder
|
|
19
|
+
*/
|
|
20
|
+
random(): FeederBuilder<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Set a shuffle strategy. Records will be provided in a random order, unrelated to the order in
|
|
23
|
+
* the underlying source. A given record will only be provided once. The run will be immediately
|
|
24
|
+
* stopped if the feeder runs out of records.
|
|
25
|
+
*
|
|
26
|
+
* @returns a new FeederBuilder
|
|
27
|
+
*/
|
|
28
|
+
shuffle(): FeederBuilder<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Set a circular strategy. Records will be provided in the same order as defined in the
|
|
31
|
+
* underlying source. Once the last record of the underlying source is reached, the feeder will go
|
|
32
|
+
* back to the first record. A given record can be provided multiple times. Such feeder will never
|
|
33
|
+
* run out of records.
|
|
34
|
+
*
|
|
35
|
+
* @returns a new FeederBuilder
|
|
36
|
+
*/
|
|
37
|
+
circular(): FeederBuilder<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Provide a function to transform records as defined in the underlying source
|
|
40
|
+
*
|
|
41
|
+
* @param f - the transformation function
|
|
42
|
+
* @returns a new FeederBuilder
|
|
43
|
+
*/
|
|
44
|
+
transform(f: (name: string, value: T) => unknown): FeederBuilder<unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Return the number of records more efficiantly than readRecords().size().
|
|
47
|
+
*
|
|
48
|
+
* @returns the number of recordss
|
|
49
|
+
*/
|
|
50
|
+
recordsCount(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Distribute data evenly amongst all the injectors of a Gatling Enterprise cluster. Only
|
|
53
|
+
* effective when the test is running with Gatling Enterprise, noop otherwise.
|
|
54
|
+
*
|
|
55
|
+
* @returns a new FeederBuilder
|
|
56
|
+
*/
|
|
57
|
+
shard(): FeederBuilder<T>;
|
|
58
|
+
}
|
|
59
|
+
export interface FileBasedFeederBuilder<T> extends FeederBuilder<T> {
|
|
60
|
+
queue(): FileBasedFeederBuilder<T>;
|
|
61
|
+
random(): FileBasedFeederBuilder<T>;
|
|
62
|
+
shuffle(): FileBasedFeederBuilder<T>;
|
|
63
|
+
circular(): FileBasedFeederBuilder<T>;
|
|
64
|
+
shard(): FileBasedFeederBuilder<T>;
|
|
65
|
+
/**
|
|
66
|
+
* Advice to unzip the underlying source because it's a zip or tar file
|
|
67
|
+
*
|
|
68
|
+
* @returns a new FileBased
|
|
69
|
+
*/
|
|
70
|
+
unzip(): FileBasedFeederBuilder<T>;
|
|
71
|
+
}
|
|
72
|
+
export declare const wrapFileBasedFeederBuilder: <T>(_underlying: JvmFeederBuilderFileBased<T>) => FileBasedFeederBuilder<T>;
|
|
73
|
+
export interface BatchableFeederBuilder<T> extends FileBasedFeederBuilder<T> {
|
|
74
|
+
queue(): BatchableFeederBuilder<T>;
|
|
75
|
+
random(): BatchableFeederBuilder<T>;
|
|
76
|
+
shuffle(): BatchableFeederBuilder<T>;
|
|
77
|
+
circular(): BatchableFeederBuilder<T>;
|
|
78
|
+
shard(): BatchableFeederBuilder<T>;
|
|
79
|
+
unzip(): BatchableFeederBuilder<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Force loading the whole data in memory from the underlying source at once. Faster runtime but
|
|
82
|
+
* slower boot time and higher heap usage.
|
|
83
|
+
*
|
|
84
|
+
* @returns a new Batchable
|
|
85
|
+
*/
|
|
86
|
+
eager(): BatchableFeederBuilder<T>;
|
|
87
|
+
/**
|
|
88
|
+
* Force loading small chunks of data from the underlying source one by one. Slower runtime but
|
|
89
|
+
* faster boot time and lower memory consumption.
|
|
90
|
+
*
|
|
91
|
+
* @returns a new Batchable
|
|
92
|
+
*/
|
|
93
|
+
batch(): BatchableFeederBuilder<T>;
|
|
94
|
+
/**
|
|
95
|
+
* Force loading small chunks of data from the underlying source one by one Slower runtime but
|
|
96
|
+
* faster boot time and lower memory consumption.
|
|
97
|
+
*
|
|
98
|
+
* @param lines - the number of buffered lines
|
|
99
|
+
* @returns a new Batchable
|
|
100
|
+
*/
|
|
101
|
+
batch(lines: number): BatchableFeederBuilder<T>;
|
|
102
|
+
}
|
|
103
|
+
export interface CsvFunction {
|
|
104
|
+
/**
|
|
105
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder
|
|
106
|
+
*
|
|
107
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
108
|
+
* @returns a new feeder
|
|
109
|
+
*/
|
|
110
|
+
(filePath: string): BatchableFeederBuilder<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder
|
|
113
|
+
*
|
|
114
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
115
|
+
* @param quoteChar - the quote char to wrap values containing special characters
|
|
116
|
+
* @returns a new feeder
|
|
117
|
+
*/
|
|
118
|
+
(filePath: string, quoteChar: string): BatchableFeederBuilder<string>;
|
|
119
|
+
}
|
|
120
|
+
export declare const csv: CsvFunction;
|
|
121
|
+
export interface SsvFunction {
|
|
122
|
+
/**
|
|
123
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
124
|
+
* is a semi-colon
|
|
125
|
+
*
|
|
126
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
127
|
+
* @returns a new feeder
|
|
128
|
+
*/
|
|
129
|
+
(filePath: string): BatchableFeederBuilder<string>;
|
|
130
|
+
/**
|
|
131
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
132
|
+
* is a semi-colon
|
|
133
|
+
*
|
|
134
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
135
|
+
* @param quoteChar - the quote char to wrap values containing special characters (must be a single character)
|
|
136
|
+
* @returns a new feeder
|
|
137
|
+
*/
|
|
138
|
+
(filePath: string, quoteChar: string): BatchableFeederBuilder<string>;
|
|
139
|
+
}
|
|
140
|
+
export declare const ssv: SsvFunction;
|
|
141
|
+
export interface TsvFunction {
|
|
142
|
+
/**
|
|
143
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
144
|
+
* is a tab
|
|
145
|
+
*
|
|
146
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
147
|
+
* @returns a new feeder
|
|
148
|
+
*/
|
|
149
|
+
(filePath: string): BatchableFeederBuilder<string>;
|
|
150
|
+
/**
|
|
151
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
152
|
+
* is a tab
|
|
153
|
+
*
|
|
154
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
155
|
+
* @param quoteChar - the quote char to wrap values containing special characters (must be a single character)
|
|
156
|
+
* @returns a new feeder
|
|
157
|
+
*/
|
|
158
|
+
(filePath: string, quoteChar: string): BatchableFeederBuilder<string>;
|
|
159
|
+
}
|
|
160
|
+
export declare const tsv: TsvFunction;
|
|
161
|
+
export interface SeparatedValuesFunction {
|
|
162
|
+
/**
|
|
163
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
164
|
+
* is a tab
|
|
165
|
+
*
|
|
166
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
167
|
+
* @param separator - the provided separator char (must be a single character)
|
|
168
|
+
* @returns a new feeder
|
|
169
|
+
*/
|
|
170
|
+
(filePath: string, separator: string): BatchableFeederBuilder<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Bootstrap a new {@link https://datatracker.ietf.org/doc/html/rfc4180 | CSV file} based feeder, where the separator
|
|
173
|
+
* is a tab
|
|
174
|
+
*
|
|
175
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
176
|
+
* @param separator - the provided separator char (must be a single character)
|
|
177
|
+
* @param quoteChar - the quote char to wrap values containing special characters (must be a single character)
|
|
178
|
+
* @returns a new feeder
|
|
179
|
+
*/
|
|
180
|
+
(filePath: string, separator: string, quoteChar: string): BatchableFeederBuilder<string>;
|
|
181
|
+
}
|
|
182
|
+
export declare const separatedValues: SeparatedValuesFunction;
|
|
183
|
+
/**
|
|
184
|
+
* Bootstrap a new JSON file based feeder
|
|
185
|
+
*
|
|
186
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
187
|
+
* @returns a new feeder
|
|
188
|
+
*/
|
|
189
|
+
export declare const jsonFile: (filePath: string) => FileBasedFeederBuilder<any>;
|
|
190
|
+
/**
|
|
191
|
+
* Bootstrap a new JSON API based feeder
|
|
192
|
+
*
|
|
193
|
+
* @param url - the url of the API
|
|
194
|
+
* @returns a new feeder
|
|
195
|
+
*/
|
|
196
|
+
export declare const jsonUrl: (url: string) => FeederBuilder<any>;
|
|
197
|
+
/**
|
|
198
|
+
* Bootstrap a new in-memory array of Maps based feeder
|
|
199
|
+
*
|
|
200
|
+
* @param data - the in-memory data
|
|
201
|
+
* @returns a new feeder
|
|
202
|
+
*/
|
|
203
|
+
export declare const arrayFeeder: (data: Array<Record<string, unknown>>) => FeederBuilder<unknown>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayFeeder = exports.jsonUrl = exports.jsonFile = exports.separatedValues = exports.tsv = exports.ssv = exports.csv = exports.wrapFileBasedFeederBuilder = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const callbacks_1 = require("./gatlingJvm/callbacks");
|
|
6
|
+
const wrapFeederBuilder = (_underlying) => ({
|
|
7
|
+
_underlying,
|
|
8
|
+
queue: () => wrapFeederBuilder(_underlying.queue()),
|
|
9
|
+
random: () => wrapFeederBuilder(_underlying.random()),
|
|
10
|
+
shuffle: () => wrapFeederBuilder(_underlying.shuffle()),
|
|
11
|
+
circular: () => wrapFeederBuilder(_underlying.circular()),
|
|
12
|
+
transform: (f) => wrapFeederBuilder(_underlying.transform((0, callbacks_1.wrapBiCallback)(f))),
|
|
13
|
+
recordsCount: () => _underlying.recordsCount(),
|
|
14
|
+
shard: () => wrapFeederBuilder(_underlying.shard())
|
|
15
|
+
});
|
|
16
|
+
const wrapFileBasedFeederBuilder = (_underlying) => ({
|
|
17
|
+
_underlying,
|
|
18
|
+
queue: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.queue()),
|
|
19
|
+
random: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.random()),
|
|
20
|
+
shuffle: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.shuffle()),
|
|
21
|
+
circular: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.circular()),
|
|
22
|
+
transform: (f) => wrapFeederBuilder(_underlying.transform((0, callbacks_1.wrapBiCallback)(f))),
|
|
23
|
+
recordsCount: () => _underlying.recordsCount(),
|
|
24
|
+
shard: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.shard()),
|
|
25
|
+
unzip: () => (0, exports.wrapFileBasedFeederBuilder)(_underlying.unzip())
|
|
26
|
+
});
|
|
27
|
+
exports.wrapFileBasedFeederBuilder = wrapFileBasedFeederBuilder;
|
|
28
|
+
const wrapBatchableFeederBuilder = (_underlying) => ({
|
|
29
|
+
_underlying,
|
|
30
|
+
queue: () => wrapBatchableFeederBuilder(_underlying.queue()),
|
|
31
|
+
random: () => wrapBatchableFeederBuilder(_underlying.random()),
|
|
32
|
+
shuffle: () => wrapBatchableFeederBuilder(_underlying.shuffle()),
|
|
33
|
+
circular: () => wrapBatchableFeederBuilder(_underlying.circular()),
|
|
34
|
+
transform: (f) => wrapFeederBuilder(_underlying.transform((0, callbacks_1.wrapBiCallback)(f))),
|
|
35
|
+
recordsCount: () => _underlying.recordsCount(),
|
|
36
|
+
shard: () => wrapBatchableFeederBuilder(_underlying.shard()),
|
|
37
|
+
unzip: () => wrapBatchableFeederBuilder(_underlying.unzip()),
|
|
38
|
+
eager: () => wrapBatchableFeederBuilder(_underlying.eager()),
|
|
39
|
+
batch: (lines) => wrapBatchableFeederBuilder(lines !== undefined ? _underlying.batch(lines) : _underlying.batch())
|
|
40
|
+
});
|
|
41
|
+
const csv = (filePath, quoteChar) => wrapBatchableFeederBuilder(quoteChar !== undefined ? jvm_types_1.CoreDsl.csv(filePath, quoteChar) : jvm_types_1.CoreDsl.csv(filePath));
|
|
42
|
+
exports.csv = csv;
|
|
43
|
+
const ssv = (filePath, quoteChar) => wrapBatchableFeederBuilder(quoteChar !== undefined ? jvm_types_1.CoreDsl.ssv(filePath, quoteChar) : jvm_types_1.CoreDsl.ssv(filePath));
|
|
44
|
+
exports.ssv = ssv;
|
|
45
|
+
const tsv = (filePath, quoteChar) => wrapBatchableFeederBuilder(quoteChar !== undefined ? jvm_types_1.CoreDsl.tsv(filePath, quoteChar) : jvm_types_1.CoreDsl.tsv(filePath));
|
|
46
|
+
exports.tsv = tsv;
|
|
47
|
+
const separatedValues = (filePath, separator, quoteChar) => wrapBatchableFeederBuilder(quoteChar !== undefined
|
|
48
|
+
? jvm_types_1.CoreDsl.separatedValues(filePath, separator, quoteChar)
|
|
49
|
+
: jvm_types_1.CoreDsl.separatedValues(filePath, separator));
|
|
50
|
+
exports.separatedValues = separatedValues;
|
|
51
|
+
/**
|
|
52
|
+
* Bootstrap a new JSON file based feeder
|
|
53
|
+
*
|
|
54
|
+
* @param filePath - the path of the file, relative to the root of the resources folder
|
|
55
|
+
* @returns a new feeder
|
|
56
|
+
*/
|
|
57
|
+
const jsonFile = (filePath) => (0, exports.wrapFileBasedFeederBuilder)(jvm_types_1.CoreDsl.jsonFile(filePath));
|
|
58
|
+
exports.jsonFile = jsonFile;
|
|
59
|
+
/**
|
|
60
|
+
* Bootstrap a new JSON API based feeder
|
|
61
|
+
*
|
|
62
|
+
* @param url - the url of the API
|
|
63
|
+
* @returns a new feeder
|
|
64
|
+
*/
|
|
65
|
+
const jsonUrl = (url) => wrapFeederBuilder(jvm_types_1.CoreDsl.jsonUrl(url));
|
|
66
|
+
exports.jsonUrl = jsonUrl;
|
|
67
|
+
/**
|
|
68
|
+
* Bootstrap a new in-memory array of Maps based feeder
|
|
69
|
+
*
|
|
70
|
+
* @param data - the in-memory data
|
|
71
|
+
* @returns a new feeder
|
|
72
|
+
*/
|
|
73
|
+
const arrayFeeder = (data) => wrapFeederBuilder(jvm_types_1.CoreDsl.arrayFeeder(data));
|
|
74
|
+
exports.arrayFeeder = arrayFeeder;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import JvmFilter = io.gatling.javaapi.core.Filter;
|
|
2
|
+
import JvmFilterAllowList = io.gatling.javaapi.core.Filter$AllowList;
|
|
3
|
+
import JvmFilterDenyList = io.gatling.javaapi.core.Filter$DenyList;
|
|
4
|
+
import { Wrapper } from "./common";
|
|
5
|
+
export interface Filter<T extends JvmFilter<unknown>> extends Wrapper<T> {
|
|
6
|
+
type: "allow" | "deny";
|
|
7
|
+
}
|
|
8
|
+
export interface AllowListFilter extends Filter<JvmFilterAllowList> {
|
|
9
|
+
type: "allow";
|
|
10
|
+
}
|
|
11
|
+
export interface DenyListFilter extends Filter<JvmFilterDenyList> {
|
|
12
|
+
type: "deny";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a new AllowList based on some <a
|
|
16
|
+
* href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">Java regular
|
|
17
|
+
* expression patterns</a>. Typically used to filter HTTP resources.
|
|
18
|
+
*
|
|
19
|
+
* @param patterns some Java regex patterns
|
|
20
|
+
* @return a new AllowList
|
|
21
|
+
*/
|
|
22
|
+
export declare const AllowList: (...patterns: string[]) => AllowListFilter;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new DenyList based on some <a
|
|
25
|
+
* href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">Java regular
|
|
26
|
+
* expression patterns</a> Typically used to filter HTTP resources.
|
|
27
|
+
*
|
|
28
|
+
* @param patterns some Java regex patterns
|
|
29
|
+
* @return a new DenyList
|
|
30
|
+
*/
|
|
31
|
+
export declare const DenyList: (...patterns: string[]) => DenyListFilter;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DenyList = exports.AllowList = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapAllowListFilter = (_underlying) => ({
|
|
6
|
+
_underlying,
|
|
7
|
+
type: "allow"
|
|
8
|
+
});
|
|
9
|
+
const wrapDenyListFilter = (_underlying) => ({
|
|
10
|
+
_underlying,
|
|
11
|
+
type: "deny"
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Create a new AllowList based on some <a
|
|
15
|
+
* href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">Java regular
|
|
16
|
+
* expression patterns</a>. Typically used to filter HTTP resources.
|
|
17
|
+
*
|
|
18
|
+
* @param patterns some Java regex patterns
|
|
19
|
+
* @return a new AllowList
|
|
20
|
+
*/
|
|
21
|
+
const AllowList = (...patterns) => wrapAllowListFilter(jvm_types_1.CoreDsl.AllowList(patterns));
|
|
22
|
+
exports.AllowList = AllowList;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new DenyList based on some <a
|
|
25
|
+
* href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">Java regular
|
|
26
|
+
* expression patterns</a> Typically used to filter HTTP resources.
|
|
27
|
+
*
|
|
28
|
+
* @param patterns some Java regex patterns
|
|
29
|
+
* @return a new DenyList
|
|
30
|
+
*/
|
|
31
|
+
const DenyList = (...patterns) => wrapDenyListFilter(jvm_types_1.CoreDsl.DenyList(patterns));
|
|
32
|
+
exports.DenyList = DenyList;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import JvmPopulationBuilder = io.gatling.javaapi.core.PopulationBuilder;
|
|
2
|
+
import JvmSetUp = io.gatling.javaapi.core.Simulation$SetUp;
|
|
3
|
+
export type SetUpFunction = (populationBuilders: JvmPopulationBuilder[]) => JvmSetUp;
|
|
4
|
+
export type Simulation = (setUp: SetUpFunction) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import JvmSession = io.gatling.javaapi.core.Session;
|
|
2
|
+
type JvmExpression<T> = (arg: JvmSession) => T;
|
|
3
|
+
type Callback<T, R> = (arg: T) => R;
|
|
4
|
+
type BiCallback<T, U, R> = (arg0: T, arg1: U) => R;
|
|
5
|
+
export declare const wrapByteArray: (v: number[]) => number[];
|
|
6
|
+
export declare const wrapByteArrayCallback: (f: JvmExpression<number[]>) => JvmExpression<number[]>;
|
|
7
|
+
export declare const wrapCallback: <T, R>(f: Callback<T, R>) => Callback<T, R>;
|
|
8
|
+
export declare const wrapBiCallback: <T, U, R>(f: BiCallback<T, U, R>) => BiCallback<T, U, R>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapBiCallback = exports.wrapCallback = exports.wrapByteArrayCallback = exports.wrapByteArray = void 0;
|
|
4
|
+
const CallbackWrapper = Java.type("io.gatling.js.callbacks.CallbackWrapper");
|
|
5
|
+
// Byte arrays
|
|
6
|
+
const wrapByteArray = (v) => CallbackWrapper.wrapByteArray(v);
|
|
7
|
+
exports.wrapByteArray = wrapByteArray;
|
|
8
|
+
const wrapByteArrayCallback = (f) => CallbackWrapper.wrapByteArrayFunction(f);
|
|
9
|
+
exports.wrapByteArrayCallback = wrapByteArrayCallback;
|
|
10
|
+
// Generic functions
|
|
11
|
+
const wrapCallback = (f) => CallbackWrapper.wrapFunction(f);
|
|
12
|
+
exports.wrapCallback = wrapCallback;
|
|
13
|
+
const wrapBiCallback = (f) => CallbackWrapper.wrapBiFunction(f);
|
|
14
|
+
exports.wrapBiCallback = wrapBiCallback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const asJava: (value: unknown) => unknown;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asJava = void 0;
|
|
4
|
+
const ArrayList = Java.type("java.util.ArrayList");
|
|
5
|
+
const HashMap = Java.type("java.util.HashMap");
|
|
6
|
+
const asJavaList = (elements) => {
|
|
7
|
+
const javaList = new ArrayList();
|
|
8
|
+
for (let i = 0; i < elements.length; i++) {
|
|
9
|
+
javaList.add((0, exports.asJava)(elements[i]));
|
|
10
|
+
}
|
|
11
|
+
return javaList;
|
|
12
|
+
};
|
|
13
|
+
const asJavaMap = (records) => {
|
|
14
|
+
const javaMap = new HashMap();
|
|
15
|
+
Object.entries(records).forEach(([key, value]) => {
|
|
16
|
+
javaMap.put(key, (0, exports.asJava)(value));
|
|
17
|
+
});
|
|
18
|
+
return javaMap;
|
|
19
|
+
};
|
|
20
|
+
const asJava = (value) => {
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return asJavaList(value);
|
|
23
|
+
}
|
|
24
|
+
else if (typeof value === "object" && value !== null) {
|
|
25
|
+
return asJavaMap(value);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.asJava = asJava;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as jvm from "./gatlingJvm/app";
|
|
2
|
+
import { PauseType } from "./structure/pauses";
|
|
3
|
+
import { Duration } from "./utils/duration";
|
|
4
|
+
import { SessionTo } from "./session";
|
|
5
|
+
import { Assertion } from "./assertions";
|
|
6
|
+
import { PopulationBuilder } from "./population";
|
|
7
|
+
import { ProtocolBuilder } from "./protocol";
|
|
8
|
+
import { ThrottleStep } from "./throttling";
|
|
9
|
+
export * from "./gatlingJvm/callbacks";
|
|
10
|
+
export * from "./utils/duration";
|
|
11
|
+
export * from "./assertions";
|
|
12
|
+
export * from "./body";
|
|
13
|
+
export * from "./checks";
|
|
14
|
+
export * from "./closedInjection";
|
|
15
|
+
export * from "./common";
|
|
16
|
+
export * from "./feeders";
|
|
17
|
+
export * from "./filters";
|
|
18
|
+
export * from "./openInjection";
|
|
19
|
+
export * from "./population";
|
|
20
|
+
export * from "./protocol";
|
|
21
|
+
export * from "./scenario";
|
|
22
|
+
export * from "./session";
|
|
23
|
+
export * from "./structure";
|
|
24
|
+
export * from "./throttling";
|
|
25
|
+
export interface SetUp {
|
|
26
|
+
/**
|
|
27
|
+
* Define the desired protocol configurations
|
|
28
|
+
*
|
|
29
|
+
* @param protocols - the protocols
|
|
30
|
+
* @returns the same mutated setup instance
|
|
31
|
+
*/
|
|
32
|
+
protocols(...protocols: ProtocolBuilder[]): SetUp;
|
|
33
|
+
/**
|
|
34
|
+
* Define the desired assertions
|
|
35
|
+
*
|
|
36
|
+
* @param assertions - the assertions
|
|
37
|
+
* @returns the same mutated setup instance
|
|
38
|
+
*/
|
|
39
|
+
assertions(...assertions: Assertion[]): SetUp;
|
|
40
|
+
/**
|
|
41
|
+
* Define the run max duration
|
|
42
|
+
*
|
|
43
|
+
* @param duration - the max duration
|
|
44
|
+
* @returns the same mutated setup instance
|
|
45
|
+
*/
|
|
46
|
+
maxDuration(duration: Duration): SetUp;
|
|
47
|
+
/**
|
|
48
|
+
* Define the throttling, meaning a maximum throughput over time
|
|
49
|
+
*
|
|
50
|
+
* @param throttleSteps - the throttling DSL steps
|
|
51
|
+
* @returns the same mutated setup instance
|
|
52
|
+
*/
|
|
53
|
+
throttle(...throttleSteps: ThrottleStep[]): SetUp;
|
|
54
|
+
/**
|
|
55
|
+
* Disable the pauses
|
|
56
|
+
*
|
|
57
|
+
* @returns the same mutated setup instance
|
|
58
|
+
*/
|
|
59
|
+
disablePauses(): SetUp;
|
|
60
|
+
/**
|
|
61
|
+
* Apply constant pauses
|
|
62
|
+
*
|
|
63
|
+
* @returns the same mutated setup instance
|
|
64
|
+
*/
|
|
65
|
+
constantPauses(): SetUp;
|
|
66
|
+
/**
|
|
67
|
+
* Apply exponential pauses
|
|
68
|
+
*
|
|
69
|
+
* @returns the same mutated setup instance
|
|
70
|
+
*/
|
|
71
|
+
exponentialPauses(): SetUp;
|
|
72
|
+
/**
|
|
73
|
+
* Apply custom pauses
|
|
74
|
+
*
|
|
75
|
+
* @returns the same mutated setup instance
|
|
76
|
+
*/
|
|
77
|
+
customPauses(f: SessionTo<number>): SetUp;
|
|
78
|
+
/**
|
|
79
|
+
* Apply uniform pauses with half-width defined as a percentage
|
|
80
|
+
*
|
|
81
|
+
* @returns the same mutated setup instance
|
|
82
|
+
*/
|
|
83
|
+
uniformPauses(plusOrMinus: number): SetUp;
|
|
84
|
+
/**
|
|
85
|
+
* Apply uniform pauses with half-width defined as an absolute value
|
|
86
|
+
*
|
|
87
|
+
* @returns the same mutated setup instance
|
|
88
|
+
*/
|
|
89
|
+
uniformPauses(plusOrMinus: Duration): SetUp;
|
|
90
|
+
/**
|
|
91
|
+
* Apply normal distribution pauses with the standard deviation defined as an absolute value
|
|
92
|
+
*
|
|
93
|
+
* @param stdDevDuration - the standard deviation of the distribution.
|
|
94
|
+
* @returns the same mutated setup instance
|
|
95
|
+
*/
|
|
96
|
+
normalPausesWithStdDevDuration(stdDevDuration: Duration): SetUp;
|
|
97
|
+
/**
|
|
98
|
+
* Apply normal distribution pauses with the standard deviation defined as a percentage of the
|
|
99
|
+
* value defined in the scenario
|
|
100
|
+
*
|
|
101
|
+
* @param stdDevPercent - the standard deviation of the distribution in percents.
|
|
102
|
+
* @returns the same mutated setup instance
|
|
103
|
+
*/
|
|
104
|
+
normalPausesWithPercentageDuration(stdDevPercent: number): SetUp;
|
|
105
|
+
/**
|
|
106
|
+
* Apply uniform pauses with a given strategy
|
|
107
|
+
*
|
|
108
|
+
* @param pauseType - the pause type
|
|
109
|
+
* @returns the same mutated setup instance
|
|
110
|
+
*/
|
|
111
|
+
pauses(pauseType: PauseType): SetUp;
|
|
112
|
+
}
|
|
113
|
+
export type SetUpFunction = (...populationBuilders: PopulationBuilder[]) => SetUp;
|
|
114
|
+
export type Simulation = (setUp: SetUpFunction) => void;
|
|
115
|
+
export declare const runSimulation: (simulation: Simulation) => jvm.Simulation;
|
package/target/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.runSimulation = void 0;
|
|
18
|
+
const callbacks_1 = require("./gatlingJvm/callbacks");
|
|
19
|
+
const pauses_1 = require("./structure/pauses");
|
|
20
|
+
const duration_1 = require("./utils/duration");
|
|
21
|
+
const session_1 = require("./session");
|
|
22
|
+
// FIXME no export *
|
|
23
|
+
__exportStar(require("./gatlingJvm/callbacks"), exports);
|
|
24
|
+
__exportStar(require("./utils/duration"), exports);
|
|
25
|
+
__exportStar(require("./assertions"), exports);
|
|
26
|
+
__exportStar(require("./body"), exports);
|
|
27
|
+
__exportStar(require("./checks"), exports);
|
|
28
|
+
__exportStar(require("./closedInjection"), exports);
|
|
29
|
+
__exportStar(require("./common"), exports);
|
|
30
|
+
__exportStar(require("./feeders"), exports);
|
|
31
|
+
__exportStar(require("./filters"), exports);
|
|
32
|
+
__exportStar(require("./openInjection"), exports);
|
|
33
|
+
__exportStar(require("./population"), exports);
|
|
34
|
+
__exportStar(require("./protocol"), exports);
|
|
35
|
+
__exportStar(require("./scenario"), exports);
|
|
36
|
+
__exportStar(require("./session"), exports);
|
|
37
|
+
__exportStar(require("./structure"), exports);
|
|
38
|
+
__exportStar(require("./throttling"), exports);
|
|
39
|
+
const wrapSetUp = (jvmSetUp) => ({
|
|
40
|
+
protocols: (...protocols) => wrapSetUp(jvmSetUp.protocols(protocols.map((p) => p._underlying))),
|
|
41
|
+
assertions: (...assertions) => wrapSetUp(jvmSetUp.assertions(assertions.map((p) => p._underlying))),
|
|
42
|
+
maxDuration: (duration) => wrapSetUp(jvmSetUp.maxDuration((0, duration_1.toJvmDuration)(duration))),
|
|
43
|
+
throttle: (...throttleSteps) => wrapSetUp(jvmSetUp.throttle(throttleSteps.map((t) => t._underlying))),
|
|
44
|
+
disablePauses: () => wrapSetUp(jvmSetUp.disablePauses()),
|
|
45
|
+
constantPauses: () => wrapSetUp(jvmSetUp.constantPauses()),
|
|
46
|
+
exponentialPauses: () => wrapSetUp(jvmSetUp.exponentialPauses()),
|
|
47
|
+
customPauses: (f) => wrapSetUp(jvmSetUp.customPauses((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(f)))),
|
|
48
|
+
uniformPauses: (plusOrMinus) => wrapSetUp(jvmSetUp.uniformPauses((0, duration_1.toJvmDuration)(plusOrMinus))),
|
|
49
|
+
normalPausesWithStdDevDuration: (stdDevDuration) => wrapSetUp(jvmSetUp.normalPausesWithStdDevDuration((0, duration_1.toJvmDuration)(stdDevDuration))),
|
|
50
|
+
normalPausesWithPercentageDuration: (stdDevPercent) => wrapSetUp(jvmSetUp.normalPausesWithPercentageDuration(stdDevPercent)),
|
|
51
|
+
pauses: (pauseType) => wrapSetUp(jvmSetUp.pauses((0, pauses_1.toJvmPauseType)(pauseType)))
|
|
52
|
+
});
|
|
53
|
+
const runSimulation = (simulation) => (jvmSetUp) => {
|
|
54
|
+
simulation((...populationBuilders) => wrapSetUp(jvmSetUp(populationBuilders.map((p) => p._underlying))));
|
|
55
|
+
};
|
|
56
|
+
exports.runSimulation = runSimulation;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import { Wrapper } from "./common";
|
|
3
|
+
import { Duration } from "./utils/duration";
|
|
4
|
+
import JvmOpenInjectionStep = io.gatling.javaapi.core.OpenInjectionStep;
|
|
5
|
+
import JvmOpenInjectionStepRamp = io.gatling.javaapi.core.OpenInjectionStep$Ramp;
|
|
6
|
+
import JvmOpenInjectionStepStressPeak = io.gatling.javaapi.core.OpenInjectionStep$StressPeak;
|
|
7
|
+
import JvmOpenInjectionStepConstantRate = io.gatling.javaapi.core.OpenInjectionStep$ConstantRate;
|
|
8
|
+
import JvmOpenInjectionStepRampRate = io.gatling.javaapi.core.OpenInjectionStep$RampRate;
|
|
9
|
+
import JvmOpenInjectionStepRampRateDuring = io.gatling.javaapi.core.RampRate$During;
|
|
10
|
+
import JvmOpenInjectionStepStairs = io.gatling.javaapi.core.OpenInjectionStep$Stairs;
|
|
11
|
+
import JvmOpenInjectionStepStairsTimes = io.gatling.javaapi.core.Stairs$Times;
|
|
12
|
+
export interface OpenInjectionStep extends Wrapper<JvmOpenInjectionStep> {
|
|
13
|
+
}
|
|
14
|
+
export interface ConstantRateOpenInjectionStep extends OpenInjectionStep {
|
|
15
|
+
randomized(): OpenInjectionStep;
|
|
16
|
+
}
|
|
17
|
+
export interface OpenInjectionStepRamp extends Wrapper<JvmOpenInjectionStepRamp> {
|
|
18
|
+
during(duration: Duration): OpenInjectionStep;
|
|
19
|
+
}
|
|
20
|
+
export interface OpenInjectionStepStressPeak extends Wrapper<JvmOpenInjectionStepStressPeak> {
|
|
21
|
+
during(duration: Duration): OpenInjectionStep;
|
|
22
|
+
}
|
|
23
|
+
export interface OpenInjectionStepConstantRate extends Wrapper<JvmOpenInjectionStepConstantRate> {
|
|
24
|
+
during(duration: Duration): ConstantRateOpenInjectionStep;
|
|
25
|
+
}
|
|
26
|
+
export interface OpenInjectionStepRampRate extends Wrapper<JvmOpenInjectionStepRampRate> {
|
|
27
|
+
to(to: number): OpenInjectionStepRampRateDuring;
|
|
28
|
+
}
|
|
29
|
+
export interface OpenInjectionStepRampRateDuring extends Wrapper<JvmOpenInjectionStepRampRateDuring> {
|
|
30
|
+
during(duration: Duration): RampRateOpenInjectionStep;
|
|
31
|
+
}
|
|
32
|
+
export interface RampRateOpenInjectionStep extends OpenInjectionStep {
|
|
33
|
+
randomized(): OpenInjectionStep;
|
|
34
|
+
}
|
|
35
|
+
export interface OpenInjectionStepStairs extends Wrapper<JvmOpenInjectionStepStairs> {
|
|
36
|
+
times(levels: number): OpenInjectionStepStairsTimes;
|
|
37
|
+
}
|
|
38
|
+
export interface OpenInjectionStepStairsTimes extends Wrapper<JvmOpenInjectionStepStairsTimes> {
|
|
39
|
+
eachLevelLasting(duration: Duration): OpenInjectionStepStairsComposite;
|
|
40
|
+
}
|
|
41
|
+
export interface OpenInjectionStepStairsComposite extends OpenInjectionStep {
|
|
42
|
+
startingFrom(startingRate: number): OpenInjectionStepStairsComposite;
|
|
43
|
+
separatedByRampsLasting(duration: Duration): OpenInjectionStepStairsComposite;
|
|
44
|
+
}
|
|
45
|
+
export declare const rampUsers: (users: number) => OpenInjectionStepRamp;
|
|
46
|
+
export declare const stressPeakUsers: (users: number) => OpenInjectionStepStressPeak;
|
|
47
|
+
export declare const atOnceUsers: (users: number) => OpenInjectionStep;
|
|
48
|
+
export declare const constantUsersPerSec: (rate: number) => OpenInjectionStepConstantRate;
|
|
49
|
+
export declare const rampUsersPerSec: (rate: number) => OpenInjectionStepRampRate;
|
|
50
|
+
export declare const nothingFor: (duration: Duration) => OpenInjectionStep;
|
|
51
|
+
export declare const incrementUsersPerSec: (rateIncrement: number) => OpenInjectionStepStairs;
|