@gatling.io/core 3.11.7 → 3.12.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/jest.config.js +5 -0
- package/package.json +3 -3
- package/src/assertions.ts +305 -0
- package/src/body.ts +211 -0
- package/src/checks/builder.ts +14 -0
- package/src/checks/captureGroup.ts +22 -0
- package/src/checks/condition.ts +24 -0
- package/src/checks/final.ts +31 -0
- package/src/checks/find.ts +23 -0
- package/src/checks/index.ts +540 -0
- package/src/checks/jsonOfTypeFind.ts +81 -0
- package/src/checks/jsonOfTypeMultipleFind.ts +84 -0
- package/src/checks/multipleFind.ts +87 -0
- package/src/checks/validate.ts +336 -0
- package/src/closedInjection.ts +182 -0
- package/src/common.ts +3 -0
- package/src/feeders.ts +279 -0
- package/src/filters.ts +49 -0
- package/src/gatlingJvm/app.ts +5 -0
- package/src/gatlingJvm/byteArrays.ts +14 -0
- package/src/gatlingJvm/collections.ts +28 -0
- package/src/globalStore.ts +104 -0
- package/src/index.test.ts +543 -0
- package/src/index.ts +158 -0
- package/src/openInjection.ts +286 -0
- package/src/parameters.ts +38 -0
- package/src/population.ts +105 -0
- package/src/protocol.ts +5 -0
- package/src/scenario.ts +37 -0
- package/src/session.ts +182 -0
- package/src/structure/asLongAs.ts +121 -0
- package/src/structure/asLongAsDuring.ts +337 -0
- package/src/structure/choices.ts +41 -0
- package/src/structure/doIf.ts +140 -0
- package/src/structure/doIfOrElse.ts +160 -0
- package/src/structure/doSwitch.ts +46 -0
- package/src/structure/doSwitchOrElse.ts +61 -0
- package/src/structure/doWhile.ts +53 -0
- package/src/structure/doWhileDuring.ts +337 -0
- package/src/structure/during.ts +182 -0
- package/src/structure/errors.ts +266 -0
- package/src/structure/execs.ts +66 -0
- package/src/structure/feeds.ts +62 -0
- package/src/structure/forEach.ts +68 -0
- package/src/structure/forever.ts +25 -0
- package/src/structure/groups.ts +23 -0
- package/src/structure/index.ts +130 -0
- package/src/structure/jvmStructureBuilder.ts +52 -0
- package/src/structure/on.ts +20 -0
- package/src/structure/paces.ts +156 -0
- package/src/structure/pauses.ts +211 -0
- package/src/structure/randomSwitch.ts +34 -0
- package/src/structure/randomSwitchOrElse.ts +45 -0
- package/src/structure/rendezVous.ts +23 -0
- package/src/structure/repeat.ts +64 -0
- package/src/structure/roundRobinSwitch.ts +34 -0
- package/src/structure/uniformRandomSwitch.ts +34 -0
- package/src/throttling.ts +67 -0
- package/src/utils/duration.ts +28 -0
- package/target/structure/errors.d.ts +70 -10
- package/target/structure/errors.js +29 -8
- package/target/structure/index.d.ts +4 -2
- package/target/structure/index.js +5 -3
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CheckBuilderMultipleFind, wrapCheckBuilderMultipleFind } from "./multipleFind";
|
|
2
|
+
|
|
3
|
+
import JvmCheckBuilderJsonOfTypeMultipleFind = io.gatling.javaapi.core.CheckBuilder$JsonOfTypeMultipleFind;
|
|
4
|
+
import JvmCheckBuilderMultipleFind = io.gatling.javaapi.core.CheckBuilder$MultipleFind;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A special {@link CheckBuilderFind<string>} that works on JSON
|
|
8
|
+
*/
|
|
9
|
+
export interface CheckBuilderJsonOfTypeMultipleFind extends CheckBuilderMultipleFind<string> {
|
|
10
|
+
/**
|
|
11
|
+
* Define that the extracted value is a String
|
|
12
|
+
*
|
|
13
|
+
* @returns a new MultipleFind
|
|
14
|
+
*/
|
|
15
|
+
ofString(): CheckBuilderMultipleFind<string>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Define that the extracted value is a Boolean
|
|
19
|
+
*
|
|
20
|
+
* @returns a new MultipleFind
|
|
21
|
+
*/
|
|
22
|
+
ofBoolean(): CheckBuilderMultipleFind<boolean>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Define that the extracted value is an Integer
|
|
26
|
+
*
|
|
27
|
+
* @returns a new MultipleFind
|
|
28
|
+
*/
|
|
29
|
+
ofInt(): CheckBuilderMultipleFind<number>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Define that the extracted value is a Long
|
|
33
|
+
*
|
|
34
|
+
* @returns a new MultipleFind
|
|
35
|
+
*/
|
|
36
|
+
ofLong(): CheckBuilderMultipleFind<number>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Define that the extracted value is a Double
|
|
40
|
+
*
|
|
41
|
+
* @returns a new MultipleFind
|
|
42
|
+
*/
|
|
43
|
+
ofDouble(): CheckBuilderMultipleFind<number>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Define that the extracted value is a List (a JSON array)
|
|
47
|
+
*
|
|
48
|
+
* @returns a new MultipleFind
|
|
49
|
+
*/
|
|
50
|
+
ofList(): CheckBuilderMultipleFind<unknown[]>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Define that the extracted value is a Map (a JSON object)
|
|
54
|
+
*
|
|
55
|
+
* @returns a new MultipleFind
|
|
56
|
+
*/
|
|
57
|
+
ofMap(): CheckBuilderMultipleFind<Record<string, unknown>>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Define that the extracted value is an untyped object
|
|
61
|
+
*
|
|
62
|
+
* @returns a new MultipleFind
|
|
63
|
+
*/
|
|
64
|
+
ofObject(): CheckBuilderMultipleFind<unknown>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const wrapCheckBuilderJsonOfTypeMultipleFind = (
|
|
68
|
+
_underlying: JvmCheckBuilderJsonOfTypeMultipleFind
|
|
69
|
+
): CheckBuilderJsonOfTypeMultipleFind => ({
|
|
70
|
+
...wrapCheckBuilderMultipleFind<string>(_underlying),
|
|
71
|
+
ofString: (): CheckBuilderMultipleFind<string> => wrapCheckBuilderMultipleFind(_underlying.ofString()),
|
|
72
|
+
ofBoolean: (): CheckBuilderMultipleFind<boolean> =>
|
|
73
|
+
wrapCheckBuilderMultipleFind(_underlying.ofBoolean() as JvmCheckBuilderMultipleFind<boolean>),
|
|
74
|
+
ofInt: (): CheckBuilderMultipleFind<number> =>
|
|
75
|
+
wrapCheckBuilderMultipleFind(_underlying.ofInt() as JvmCheckBuilderMultipleFind<number>),
|
|
76
|
+
ofLong: (): CheckBuilderMultipleFind<number> =>
|
|
77
|
+
wrapCheckBuilderMultipleFind(_underlying.ofLong() as JvmCheckBuilderMultipleFind<number>),
|
|
78
|
+
ofDouble: (): CheckBuilderMultipleFind<number> =>
|
|
79
|
+
wrapCheckBuilderMultipleFind(_underlying.ofDouble() as JvmCheckBuilderMultipleFind<number>),
|
|
80
|
+
ofList: (): CheckBuilderMultipleFind<unknown[]> => wrapCheckBuilderMultipleFind(_underlying.ofList()),
|
|
81
|
+
ofMap: (): CheckBuilderMultipleFind<Record<string, unknown>> =>
|
|
82
|
+
wrapCheckBuilderMultipleFind(_underlying.ofMap() as JvmCheckBuilderMultipleFind<any>),
|
|
83
|
+
ofObject: (): CheckBuilderMultipleFind<unknown> => wrapCheckBuilderMultipleFind(_underlying.ofObject())
|
|
84
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { CheckBuilderValidate, wrapCheckBuilderValidate } from "./validate";
|
|
2
|
+
|
|
3
|
+
import JvmCheckBuilderMultipleFind = io.gatling.javaapi.core.CheckBuilder$MultipleFind;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Step 1 of the Check DSL when the check can return multiple values Immutable, so all methods
|
|
7
|
+
* return a new occurrence and leave the original unmodified.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam X - the type of Java values the check can extract
|
|
10
|
+
*/
|
|
11
|
+
export interface CheckBuilderMultipleFind<X> extends CheckBuilderValidate<X> {
|
|
12
|
+
/**
|
|
13
|
+
* Target a single/first value
|
|
14
|
+
*
|
|
15
|
+
* @returns the next Check DSL step
|
|
16
|
+
*/
|
|
17
|
+
find(): CheckBuilderValidate<X>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Target the occurrence-th occurrence in the extracted values
|
|
21
|
+
*
|
|
22
|
+
* @param occurrence - the rank of the target value in the extracted values list
|
|
23
|
+
* @returns the next Check DSL step
|
|
24
|
+
*/
|
|
25
|
+
find(occurrence: number): CheckBuilderValidate<X>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Target all the occurrences of the extracted values
|
|
29
|
+
*
|
|
30
|
+
* @returns the next Check DSL step
|
|
31
|
+
*/
|
|
32
|
+
findAll(): CheckBuilderValidate<X[]>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Target a random occurrence in the extracted values
|
|
36
|
+
*
|
|
37
|
+
* @returns the next Check DSL step
|
|
38
|
+
*/
|
|
39
|
+
findRandom(): CheckBuilderValidate<X>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Target multiple random occurrences in the extracted values
|
|
43
|
+
*
|
|
44
|
+
* @param num - the number of occurrences to collect
|
|
45
|
+
* @returns the next Check DSL step
|
|
46
|
+
*/
|
|
47
|
+
findRandom(num: number): CheckBuilderValidate<X[]>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Target multiple random occurrences in the extracted values
|
|
51
|
+
*
|
|
52
|
+
* @param num - the number of occurrences to collect
|
|
53
|
+
* @param failIfLess - fail if num is greater than the number of extracted values
|
|
54
|
+
* @returns the next Check DSL step
|
|
55
|
+
*/
|
|
56
|
+
findRandom(num: number, failIfLess: boolean): CheckBuilderValidate<X[]>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Target the count of extracted values
|
|
60
|
+
*
|
|
61
|
+
* @returns the next Check DSL step
|
|
62
|
+
*/
|
|
63
|
+
count(): CheckBuilderValidate<number>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const wrapCheckBuilderMultipleFind = <X>(
|
|
67
|
+
_underlying: JvmCheckBuilderMultipleFind<X>
|
|
68
|
+
): CheckBuilderMultipleFind<X> => ({
|
|
69
|
+
...wrapCheckBuilderValidate<X>(_underlying),
|
|
70
|
+
find: (occurrence?: number) =>
|
|
71
|
+
wrapCheckBuilderValidate(occurrence !== undefined ? _underlying.find(occurrence) : _underlying.find()),
|
|
72
|
+
findAll: () => wrapCheckBuilderValidate(_underlying.findAll()),
|
|
73
|
+
findRandom: (num?: number, failIfLess?: boolean): any => {
|
|
74
|
+
if (num !== undefined) {
|
|
75
|
+
if (failIfLess !== undefined) {
|
|
76
|
+
return wrapCheckBuilderValidate(_underlying.findRandom(num, failIfLess));
|
|
77
|
+
} else {
|
|
78
|
+
return wrapCheckBuilderValidate(_underlying.findRandom(num));
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
return wrapCheckBuilderValidate(_underlying.findRandom());
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
count: function (): CheckBuilderValidate<number> {
|
|
85
|
+
throw new Error("Function not implemented.");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { Session, SessionTo, underlyingSessionTo, underlyingXWithSessionTo } from "../session";
|
|
2
|
+
import { CheckBuilderFinal, wrapCheckBuilderFinal } from "./final";
|
|
3
|
+
|
|
4
|
+
import JvmCheckBuilderValidate = io.gatling.javaapi.core.CheckBuilder$Validate;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Step 2 of the Check DSL where we define how to validate the extracted value. Immutable, so all
|
|
8
|
+
* methods return a new occurrence and leave the original unmodified.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam X - the type of the extracted value
|
|
11
|
+
*/
|
|
12
|
+
export interface CheckBuilderValidate<X> extends CheckBuilderFinal {
|
|
13
|
+
/**
|
|
14
|
+
* Transform the extracted value
|
|
15
|
+
*
|
|
16
|
+
* @param f - the transformation function
|
|
17
|
+
* @typeParam X2 - the transformed value
|
|
18
|
+
* @returns a new CheckBuilderValidate
|
|
19
|
+
*/
|
|
20
|
+
transform<X2>(f: (x: X) => X2): CheckBuilderValidate<X2>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Transform the extracted value, whith access to the current Session
|
|
24
|
+
*
|
|
25
|
+
* @param f - the transformation function
|
|
26
|
+
* @typeParam X2 - the transformed value
|
|
27
|
+
* @returns a new CheckBuilderValidate
|
|
28
|
+
*/
|
|
29
|
+
transformWithSession<X2>(f: (x: X, session: Session) => X2): CheckBuilderValidate<X2>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Provide a default value if the check wasn't able to extract anything
|
|
33
|
+
*
|
|
34
|
+
* @param value - the default value
|
|
35
|
+
* @returns a new Validate
|
|
36
|
+
*/
|
|
37
|
+
withDefault(value: X): CheckBuilderValidate<X>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Provide a default Gatling Expression Language value if the check wasn't able to extract
|
|
41
|
+
* anything
|
|
42
|
+
*
|
|
43
|
+
* @param value - the default value as a Gatling Expression Language String
|
|
44
|
+
* @returns a new Validate
|
|
45
|
+
*/
|
|
46
|
+
withDefaultEL(value: string): CheckBuilderValidate<X>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Provide a default value if the check wasn't able to extract anything
|
|
50
|
+
*
|
|
51
|
+
* @param value - the default value as a function
|
|
52
|
+
* @returns a new Validate
|
|
53
|
+
*/
|
|
54
|
+
withDefault(value: SessionTo<X>): CheckBuilderValidate<X>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Provide a custom validation strategy
|
|
58
|
+
*
|
|
59
|
+
* @param name - the name of the validation, in case of a failure
|
|
60
|
+
* @param f - the custom validation function, must throw to trigger a failure
|
|
61
|
+
* @returns a new CheckBuilderFinal
|
|
62
|
+
*/
|
|
63
|
+
validate(name: string, f: (x: X, session: Session) => X): CheckBuilderFinal;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validate the extracted value is equal to an expected value
|
|
67
|
+
*
|
|
68
|
+
* @param expected - the expected value
|
|
69
|
+
* @returns a new CheckBuilderFinal
|
|
70
|
+
*/
|
|
71
|
+
is(expected: X): CheckBuilderFinal;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Validate the extracted value is equal to an expected value, passed as a Gatling Expression
|
|
75
|
+
* Language String
|
|
76
|
+
*
|
|
77
|
+
* @param expected - the expected value as a Gatling Expression Language String
|
|
78
|
+
* @returns a new CheckBuilderFinal
|
|
79
|
+
*/
|
|
80
|
+
isEL(expected: string): CheckBuilderFinal;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Validate the extracted value is equal to an expected value, passed as a function
|
|
84
|
+
*
|
|
85
|
+
* @param expected - the expected value as a function
|
|
86
|
+
* @returns a new CheckBuilderFinal
|
|
87
|
+
*/
|
|
88
|
+
is(expected: SessionTo<X>): CheckBuilderFinal;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Validate the extracted value is null
|
|
92
|
+
*
|
|
93
|
+
* @returns a new CheckBuilderFinal
|
|
94
|
+
*/
|
|
95
|
+
isNull(): CheckBuilderFinal;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Validate the extracted value is not an expected value
|
|
99
|
+
*
|
|
100
|
+
* @param expected - the unexpected value
|
|
101
|
+
* @returns a new CheckBuilderFinal
|
|
102
|
+
*/
|
|
103
|
+
not(expected: X): CheckBuilderFinal;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Validate the extracted value is not an expected value, passed as a Gatling Expression
|
|
107
|
+
* Language String
|
|
108
|
+
*
|
|
109
|
+
* @param expected - the unexpected value as a Gatling Expression Language String
|
|
110
|
+
* @returns a new CheckBuilderFinal
|
|
111
|
+
*/
|
|
112
|
+
notEL(expected: string): CheckBuilderFinal;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Validate the extracted value is not an expected value, passed as a function
|
|
116
|
+
*
|
|
117
|
+
* @param expected - the unexpected value as a function
|
|
118
|
+
* @returns a new CheckBuilderFinal
|
|
119
|
+
*/
|
|
120
|
+
not(expected: SessionTo<X>): CheckBuilderFinal;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Validate the extracted value is not null
|
|
124
|
+
*
|
|
125
|
+
* @returns a new CheckBuilderFinal
|
|
126
|
+
*/
|
|
127
|
+
notNull(): CheckBuilderFinal;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Validate the extracted value belongs to an expected set
|
|
131
|
+
*
|
|
132
|
+
* @param expected - the set of possible values
|
|
133
|
+
* @returns a new Final
|
|
134
|
+
*/
|
|
135
|
+
in(...expected: X[]): CheckBuilderFinal;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Validate the extracted value belongs to an expected set, passed as a Gatling Expression
|
|
139
|
+
* Language String
|
|
140
|
+
*
|
|
141
|
+
* @param expected - the set of possible values, as a Gatling Expression Language String
|
|
142
|
+
* @returns a new CheckBuilderFinal
|
|
143
|
+
*/
|
|
144
|
+
inEL(expected: string): CheckBuilderFinal;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Validate the extracted value belongs to an expected set, passed as a function
|
|
148
|
+
*
|
|
149
|
+
* @param expected - the set of possible values, as a function
|
|
150
|
+
* @returns a new CheckBuilderFinal
|
|
151
|
+
*/
|
|
152
|
+
in(expected: SessionTo<X[]>): CheckBuilderFinal;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Validate the check was able to extract any value
|
|
156
|
+
*
|
|
157
|
+
* @returns a new CheckBuilderFinal
|
|
158
|
+
*/
|
|
159
|
+
exists(): CheckBuilderFinal;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Validate the check was not able to extract any value
|
|
163
|
+
*
|
|
164
|
+
* @returns a new CheckBuilderFinal
|
|
165
|
+
*/
|
|
166
|
+
notExists(): CheckBuilderFinal;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Make the check is successful whenever it was able to extract something or not
|
|
170
|
+
*
|
|
171
|
+
* @returns a new CheckBuilderFinal
|
|
172
|
+
*/
|
|
173
|
+
optional(): CheckBuilderFinal;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Validate the extracted value is less than a given value
|
|
177
|
+
*
|
|
178
|
+
* @param value - the value
|
|
179
|
+
* @returns a new CheckBuilderFinal
|
|
180
|
+
*/
|
|
181
|
+
lt(value: X): CheckBuilderFinal;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Validate the extracted value is less than a given value, passed as a Gatling Expression
|
|
185
|
+
* Language String
|
|
186
|
+
*
|
|
187
|
+
* @param value - the value, as a Gatling Expression Language String
|
|
188
|
+
* @returns a new CheckBuilderFinal
|
|
189
|
+
*/
|
|
190
|
+
ltEL(value: string): CheckBuilderFinal;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Validate the extracted value is less than a given value, passed as a function
|
|
194
|
+
*
|
|
195
|
+
* @param value - the value, as a function
|
|
196
|
+
* @returns a new CheckBuilderFinal
|
|
197
|
+
*/
|
|
198
|
+
lt(value: SessionTo<X>): CheckBuilderFinal;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Validate the extracted value is less than or equal to a given value
|
|
202
|
+
*
|
|
203
|
+
* @param value - the value
|
|
204
|
+
* @returns a new CheckBuilderFinal
|
|
205
|
+
*/
|
|
206
|
+
lte(value: X): CheckBuilderFinal;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Validate the extracted value is less than or equal to a given value, passed as a Gatling
|
|
210
|
+
* Expression Language String
|
|
211
|
+
*
|
|
212
|
+
* @param value - the value, as a Gatling Expression Language String
|
|
213
|
+
* @returns a new CheckBuilderFinal
|
|
214
|
+
*/
|
|
215
|
+
lteEL(value: string): CheckBuilderFinal;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Validate the extracted value is less than or equal to a given value, passed as a function
|
|
219
|
+
*
|
|
220
|
+
* @param value - the value, as a function
|
|
221
|
+
* @returns a new CheckBuilderFinal
|
|
222
|
+
*/
|
|
223
|
+
lte(value: SessionTo<X>): CheckBuilderFinal;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Validate the extracted value is greater than a given value
|
|
227
|
+
*
|
|
228
|
+
* @param value - the value
|
|
229
|
+
* @returns a new CheckBuilderFinal
|
|
230
|
+
*/
|
|
231
|
+
gt(value: X): CheckBuilderFinal;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Validate the extracted value is greater than a given value, passed as a Gatling Expression
|
|
235
|
+
* Language String
|
|
236
|
+
*
|
|
237
|
+
* @param value - the value, as a Gatling Expression Language String
|
|
238
|
+
* @returns a new CheckBuilderFinal
|
|
239
|
+
*/
|
|
240
|
+
gtEL(value: string): CheckBuilderFinal;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Validate the extracted value is greater than a given value, passed as a function
|
|
244
|
+
*
|
|
245
|
+
* @param value - the value, as a function
|
|
246
|
+
* @returns a new CheckBuilderFinal
|
|
247
|
+
*/
|
|
248
|
+
gt(value: SessionTo<X>): CheckBuilderFinal;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Validate the extracted value is greater than or equal to a given value
|
|
252
|
+
*
|
|
253
|
+
* @param value - the value
|
|
254
|
+
* @returns a new CheckBuilderFinal
|
|
255
|
+
*/
|
|
256
|
+
gte(value: X): CheckBuilderFinal;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Validate the extracted value is greater than or equal to a given value, passed as a Gatling
|
|
260
|
+
* Expression Language String
|
|
261
|
+
*
|
|
262
|
+
* @param value - the value, as a Gatling Expression Language String
|
|
263
|
+
* @returns a new CheckBuilderFinal
|
|
264
|
+
*/
|
|
265
|
+
gteEL(value: string): CheckBuilderFinal;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Validate the extracted value is greater than or equal to a given value, passed as a function
|
|
269
|
+
*
|
|
270
|
+
* @param value - the value, as a function
|
|
271
|
+
* @returns a new CheckBuilderFinal
|
|
272
|
+
*/
|
|
273
|
+
gte(value: SessionTo<X>): CheckBuilderFinal;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export const wrapCheckBuilderValidate = <X>(_underlying: JvmCheckBuilderValidate<X>): CheckBuilderValidate<X> => ({
|
|
277
|
+
...wrapCheckBuilderFinal(_underlying),
|
|
278
|
+
transform: <X2>(f: (x: X) => X2) => wrapCheckBuilderValidate(_underlying.transform(f)),
|
|
279
|
+
transformWithSession: <X2>(f: (x: X, session: Session) => X2) =>
|
|
280
|
+
wrapCheckBuilderValidate(_underlying.transformWithSession(underlyingXWithSessionTo(f))),
|
|
281
|
+
withDefault: (value: X | SessionTo<X>) =>
|
|
282
|
+
wrapCheckBuilderValidate(
|
|
283
|
+
typeof value === "function"
|
|
284
|
+
? _underlying.withDefault(underlyingSessionTo(value as SessionTo<X>))
|
|
285
|
+
: _underlying.withDefault(value)
|
|
286
|
+
),
|
|
287
|
+
withDefaultEL: (value: string) => wrapCheckBuilderValidate(_underlying.withDefaultEl(value)),
|
|
288
|
+
validate: (name: string, f: (x: X, session: Session) => X) =>
|
|
289
|
+
wrapCheckBuilderFinal(_underlying.validate(name, underlyingXWithSessionTo(f))),
|
|
290
|
+
is: (expected: X | SessionTo<X>) =>
|
|
291
|
+
wrapCheckBuilderFinal(
|
|
292
|
+
typeof expected === "function"
|
|
293
|
+
? _underlying.is(underlyingSessionTo(expected as SessionTo<X>))
|
|
294
|
+
: _underlying.is(expected)
|
|
295
|
+
),
|
|
296
|
+
isEL: (expected: string) => wrapCheckBuilderFinal(_underlying.isEL(expected)),
|
|
297
|
+
isNull: (): CheckBuilderFinal => wrapCheckBuilderFinal(_underlying.isNull()),
|
|
298
|
+
not: (expected: X | SessionTo<X>) =>
|
|
299
|
+
wrapCheckBuilderFinal(
|
|
300
|
+
typeof expected === "function"
|
|
301
|
+
? _underlying.not(underlyingSessionTo(expected as SessionTo<X>))
|
|
302
|
+
: _underlying.not(expected)
|
|
303
|
+
),
|
|
304
|
+
notEL: (expected: string) => wrapCheckBuilderFinal(_underlying.notEL(expected)),
|
|
305
|
+
notNull: (): CheckBuilderFinal => wrapCheckBuilderFinal(_underlying.notNull()),
|
|
306
|
+
in: (expected: X | SessionTo<X[]>, ...rest: X[]) =>
|
|
307
|
+
wrapCheckBuilderFinal(
|
|
308
|
+
typeof expected === "function"
|
|
309
|
+
? _underlying.in(underlyingSessionTo(expected as SessionTo<X[]>))
|
|
310
|
+
: _underlying.in([expected, ...rest])
|
|
311
|
+
),
|
|
312
|
+
inEL: (expected: string) => wrapCheckBuilderFinal(_underlying.inEL(expected)),
|
|
313
|
+
exists: () => wrapCheckBuilderFinal(_underlying.exists()),
|
|
314
|
+
notExists: () => wrapCheckBuilderFinal(_underlying.notExists()),
|
|
315
|
+
optional: () => wrapCheckBuilderFinal(_underlying.optional()),
|
|
316
|
+
lt: (value: X | SessionTo<X>) =>
|
|
317
|
+
wrapCheckBuilderFinal(
|
|
318
|
+
typeof value === "function" ? _underlying.lt(underlyingSessionTo(value as SessionTo<X>)) : _underlying.lt(value)
|
|
319
|
+
),
|
|
320
|
+
ltEL: (value: string) => wrapCheckBuilderFinal(_underlying.ltEL(value)),
|
|
321
|
+
lte: (value: X | SessionTo<X>) =>
|
|
322
|
+
wrapCheckBuilderFinal(
|
|
323
|
+
typeof value === "function" ? _underlying.lte(underlyingSessionTo(value as SessionTo<X>)) : _underlying.lte(value)
|
|
324
|
+
),
|
|
325
|
+
lteEL: (value: string) => wrapCheckBuilderFinal(_underlying.lteEL(value)),
|
|
326
|
+
gt: (value: X | SessionTo<X>) =>
|
|
327
|
+
wrapCheckBuilderFinal(
|
|
328
|
+
typeof value === "function" ? _underlying.gt(underlyingSessionTo(value as SessionTo<X>)) : _underlying.gt(value)
|
|
329
|
+
),
|
|
330
|
+
gtEL: (value: string) => wrapCheckBuilderFinal(_underlying.gtEL(value)),
|
|
331
|
+
gte: (value: X | SessionTo<X>) =>
|
|
332
|
+
wrapCheckBuilderFinal(
|
|
333
|
+
typeof value === "function" ? _underlying.gte(underlyingSessionTo(value as SessionTo<X>)) : _underlying.gte(value)
|
|
334
|
+
),
|
|
335
|
+
gteEL: (value: string) => wrapCheckBuilderFinal(_underlying.gteEL(value))
|
|
336
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { CoreDsl as JvmCoreDsl } from "@gatling.io/jvm-types";
|
|
2
|
+
|
|
3
|
+
import { Wrapper } from "./common";
|
|
4
|
+
import { Duration, toJvmDuration } from "./utils/duration";
|
|
5
|
+
|
|
6
|
+
import JvmClosedInjectionStep = io.gatling.javaapi.core.ClosedInjectionStep;
|
|
7
|
+
import JvmClosedInjectionStepConstant = io.gatling.javaapi.core.ClosedInjectionStep$Constant;
|
|
8
|
+
import JvmClosedInjectionStepRamp = io.gatling.javaapi.core.ClosedInjectionStep$Ramp;
|
|
9
|
+
import JvmClosedInjectionStepRampTo = io.gatling.javaapi.core.ClosedInjectionStep$RampTo;
|
|
10
|
+
import JvmClosedInjectionStepStairs = io.gatling.javaapi.core.ClosedInjectionStep$Stairs;
|
|
11
|
+
import JvmClosedInjectionStepStairsWithTime = io.gatling.javaapi.core.ClosedInjectionStep$StairsWithTime;
|
|
12
|
+
import JvmClosedInjectionStepComposite = io.gatling.javaapi.core.ClosedInjectionStep$Composite;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An injection profile step for using a closed workload model where you control the concurrent
|
|
16
|
+
* number of users. Only use if your system has a queue limiting entry. Don't use otherwise or your
|
|
17
|
+
* test will not match any production use case.
|
|
18
|
+
*
|
|
19
|
+
* <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
|
|
20
|
+
*/
|
|
21
|
+
export interface ClosedInjectionStep extends Wrapper<JvmClosedInjectionStep> {}
|
|
22
|
+
|
|
23
|
+
const wrapClosedInjectionStep = (_underlying: JvmClosedInjectionStep): ClosedInjectionStep => ({ _underlying });
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* DSL component for building a {@link ClosedInjectionStep} that will inject new users in a way to
|
|
27
|
+
* maintain a constant number of concurrent users for a given duration.
|
|
28
|
+
*/
|
|
29
|
+
export interface ClosedInjectionStepConstant extends Wrapper<JvmClosedInjectionStepConstant> {
|
|
30
|
+
/**
|
|
31
|
+
* Define the duration of the step
|
|
32
|
+
*
|
|
33
|
+
* @param duration - the duration
|
|
34
|
+
* @returns a new ClosedInjectionStep
|
|
35
|
+
*/
|
|
36
|
+
during(duration: Duration): ClosedInjectionStep;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const wrapClosedInjectionStepConstant = (_underlying: JvmClosedInjectionStepConstant): ClosedInjectionStepConstant => ({
|
|
40
|
+
_underlying,
|
|
41
|
+
during: (duration: Duration) => wrapClosedInjectionStep(_underlying.during(toJvmDuration(duration)))
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* DSL step for building a {@link ClosedInjectionStep} that will inject new users in a way to ramp
|
|
46
|
+
* the number of concurrent users for a given duration.
|
|
47
|
+
*/
|
|
48
|
+
export interface ClosedInjectionStepRamp extends Wrapper<JvmClosedInjectionStepRamp> {
|
|
49
|
+
/**
|
|
50
|
+
* Define the target number of concurrent users at the end of the ramp.
|
|
51
|
+
*
|
|
52
|
+
* @param t - the target number
|
|
53
|
+
* @returns a RampConcurrentUsersInjectionTo
|
|
54
|
+
*/
|
|
55
|
+
to(t: number): ClosedInjectionStepRampTo;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const wrapClosedInjectionStepRamp = (_underlying: JvmClosedInjectionStepRamp): ClosedInjectionStepRamp => ({
|
|
59
|
+
_underlying,
|
|
60
|
+
to: (t: number) => wrapClosedInjectionStepRampTo(_underlying.to(t))
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* DSL step for building a {@link ClosedInjectionStep} that will inject new users in a way to ramp
|
|
65
|
+
* the number of concurrent users for a given duration.
|
|
66
|
+
*/
|
|
67
|
+
export interface ClosedInjectionStepRampTo extends Wrapper<JvmClosedInjectionStepRampTo> {
|
|
68
|
+
/**
|
|
69
|
+
* Define the duration of the ramp.
|
|
70
|
+
*
|
|
71
|
+
* @param duration - the duration
|
|
72
|
+
* @returns a complete ClosedInjectionStep
|
|
73
|
+
*/
|
|
74
|
+
during(duration: Duration): ClosedInjectionStep;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const wrapClosedInjectionStepRampTo = (_underlying: JvmClosedInjectionStepRampTo): ClosedInjectionStepRampTo => ({
|
|
78
|
+
_underlying,
|
|
79
|
+
during: (duration: Duration) => wrapClosedInjectionStep(_underlying.during(toJvmDuration(duration)))
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* DSL step for building a {@link ClosedInjectionStep} that will inject new users in a way to ramp
|
|
84
|
+
* the number of concurrent users in a stairs fashion
|
|
85
|
+
*/
|
|
86
|
+
export interface ClosedInjectionStepStairs extends Wrapper<JvmClosedInjectionStepStairs> {
|
|
87
|
+
/**
|
|
88
|
+
* Define the number of levels
|
|
89
|
+
*
|
|
90
|
+
* @param levels - the number of levels in the stairs
|
|
91
|
+
* @returns the next DSL step
|
|
92
|
+
*/
|
|
93
|
+
times(levels: number): ClosedInjectionStepStairsWithTime;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const wrapClosedInjectionStepStairs = (_underlying: JvmClosedInjectionStepStairs): ClosedInjectionStepStairs => ({
|
|
97
|
+
_underlying,
|
|
98
|
+
times: (levels: number) => wrapClosedInjectionStepStairsWithTime(_underlying.times(levels))
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* DSL step for building a {@link ClosedInjectionStep} that will inject new users in a way to ramp
|
|
103
|
+
* the number of concurrent users in a stairs fashion
|
|
104
|
+
*/
|
|
105
|
+
export interface ClosedInjectionStepStairsWithTime extends Wrapper<JvmClosedInjectionStepStairsWithTime> {
|
|
106
|
+
/**
|
|
107
|
+
* Define the duration of each level
|
|
108
|
+
*
|
|
109
|
+
* @param duration - the duration
|
|
110
|
+
* @returns the next DSL step
|
|
111
|
+
*/
|
|
112
|
+
eachLevelLasting(duration: Duration): ClosedInjectionStepComposite;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const wrapClosedInjectionStepStairsWithTime = (
|
|
116
|
+
_underlying: JvmClosedInjectionStepStairsWithTime
|
|
117
|
+
): ClosedInjectionStepStairsWithTime => ({
|
|
118
|
+
_underlying,
|
|
119
|
+
eachLevelLasting: (duration: Duration) =>
|
|
120
|
+
wrapClosedInjectionStepComposite(_underlying.eachLevelLasting(toJvmDuration(duration)))
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* DSL step for building a {@link ClosedInjectionStep} that will inject new users in a way to ramp
|
|
125
|
+
* the number of concurrent users in a stairs fashion
|
|
126
|
+
*/
|
|
127
|
+
export interface ClosedInjectionStepComposite extends ClosedInjectionStep {
|
|
128
|
+
/**
|
|
129
|
+
* Define the initial number of concurrent users (optional)
|
|
130
|
+
*
|
|
131
|
+
* @param startingUsers - the initial number of concurrent users
|
|
132
|
+
* @returns a usable {@link ClosedInjectionStep}
|
|
133
|
+
*/
|
|
134
|
+
startingFrom(startingUsers: number): ClosedInjectionStepComposite;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Define ramps separating levels (optional)
|
|
138
|
+
*
|
|
139
|
+
* @param duration - the duration of the ramps
|
|
140
|
+
* @returns a usable {@link ClosedInjectionStep}
|
|
141
|
+
*/
|
|
142
|
+
separatedByRampsLasting(duration: Duration): ClosedInjectionStepComposite;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const wrapClosedInjectionStepComposite = (
|
|
146
|
+
_underlying: JvmClosedInjectionStepComposite
|
|
147
|
+
): ClosedInjectionStepComposite => ({
|
|
148
|
+
_underlying,
|
|
149
|
+
startingFrom: (startingUsers: number) => wrapClosedInjectionStepComposite(_underlying.startingFrom(startingUsers)),
|
|
150
|
+
separatedByRampsLasting: (duration: Duration) =>
|
|
151
|
+
wrapClosedInjectionStepComposite(_underlying.separatedByRampsLasting(toJvmDuration(duration)))
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Bootstrap a new closed workload constantConcurrentUsers injection profile, see {@link
|
|
156
|
+
* ClosedInjectionStepConstant}
|
|
157
|
+
*
|
|
158
|
+
* @param users - the number of concurrent users
|
|
159
|
+
* @returns the next DSL step
|
|
160
|
+
*/
|
|
161
|
+
export const constantConcurrentUsers = (users: number): ClosedInjectionStepConstant =>
|
|
162
|
+
wrapClosedInjectionStepConstant(JvmCoreDsl.constantConcurrentUsers(users));
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Bootstrap a new closed workload rampConcurrentUsers injection profile, see {@link
|
|
166
|
+
* ClosedInjectionStepRamp}
|
|
167
|
+
*
|
|
168
|
+
* @param from - the number of concurrent users at the start of the ramp
|
|
169
|
+
* @returns the next DSL step
|
|
170
|
+
*/
|
|
171
|
+
export const rampConcurrentUsers = (from: number): ClosedInjectionStepRamp =>
|
|
172
|
+
wrapClosedInjectionStepRamp(JvmCoreDsl.rampConcurrentUsers(from));
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Bootstrap a new closed workload incrementConcurrentUsers injection profile, see {@link
|
|
176
|
+
* ClosedInjectionStepStairs}
|
|
177
|
+
*
|
|
178
|
+
* @param usersIncrement - the difference of concurrent users between levels of the stairs
|
|
179
|
+
* @returns the next DSL step
|
|
180
|
+
*/
|
|
181
|
+
export const incrementConcurrentUsers = (usersIncrement: number): ClosedInjectionStepStairs =>
|
|
182
|
+
wrapClosedInjectionStepStairs(JvmCoreDsl.incrementConcurrentUsers(usersIncrement));
|
package/src/common.ts
ADDED