@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,127 @@
|
|
|
1
|
+
import JvmPauses = io.gatling.javaapi.core.pause.Pauses;
|
|
2
|
+
import JvmPauseType = io.gatling.javaapi.core.PauseType;
|
|
3
|
+
import { Duration } from "../utils/duration";
|
|
4
|
+
import { SessionTo } from "../session";
|
|
5
|
+
export type PauseType = "Disabled" | "Constant" | "Exponential" | {
|
|
6
|
+
type: "NormalWithPercentageDuration";
|
|
7
|
+
stdDev: number;
|
|
8
|
+
} | {
|
|
9
|
+
type: "NormalWithStdDevDuration";
|
|
10
|
+
stdDev: Duration;
|
|
11
|
+
} | {
|
|
12
|
+
type: "Custom";
|
|
13
|
+
f: SessionTo<number>;
|
|
14
|
+
} | {
|
|
15
|
+
type: "UniformPercentage";
|
|
16
|
+
plusOrMinus: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: "UniformDuration";
|
|
19
|
+
plusOrMinus: Duration;
|
|
20
|
+
};
|
|
21
|
+
export declare const toJvmPauseType: (pauseType: PauseType) => JvmPauseType;
|
|
22
|
+
export interface PauseFunction<T extends Pauses<T>> {
|
|
23
|
+
/**
|
|
24
|
+
* Attach a pause
|
|
25
|
+
*
|
|
26
|
+
* @param duration - the pause duration, in seconds or with an explicit time unit
|
|
27
|
+
* @returns a new StructureBuilder
|
|
28
|
+
*/
|
|
29
|
+
(duration: Duration): T;
|
|
30
|
+
/**
|
|
31
|
+
* Attach a pause as a Gatling Expression Language string. This expression must resolve to either a number, then the
|
|
32
|
+
* unit will be seconds, or an object with an explicit time unit.
|
|
33
|
+
*
|
|
34
|
+
* @param duration - the pause duration as a Gatling Expression Language string
|
|
35
|
+
* @returns a new StructureBuilder
|
|
36
|
+
*/
|
|
37
|
+
(duration: string): T;
|
|
38
|
+
/**
|
|
39
|
+
* Attach a pause
|
|
40
|
+
*
|
|
41
|
+
* @param duration - the pause duration as a function
|
|
42
|
+
* @returns a new StructureBuilder
|
|
43
|
+
*/
|
|
44
|
+
(duration: SessionTo<Duration>): T;
|
|
45
|
+
/**
|
|
46
|
+
* Attach a pause
|
|
47
|
+
*
|
|
48
|
+
* @param duration - the pause duration, in seconds or with an explicit time unit
|
|
49
|
+
* @param pauseType - the type of pause
|
|
50
|
+
* @returns a new StructureBuilder
|
|
51
|
+
*/
|
|
52
|
+
(duration: Duration, pauseType: PauseType): T;
|
|
53
|
+
/**
|
|
54
|
+
* Attach a pause as a Gatling Expression Language string. This expression must resolve to either a number, then the
|
|
55
|
+
* unit will be seconds, or an object with an explicit time unit.
|
|
56
|
+
*
|
|
57
|
+
* @param duration - the pause duration as a Gatling Expression Language string
|
|
58
|
+
* @param pauseType - the type of pause
|
|
59
|
+
* @returns a new StructureBuilder
|
|
60
|
+
*/
|
|
61
|
+
(duration: string, pauseType: PauseType): T;
|
|
62
|
+
/**
|
|
63
|
+
* Attach a pause
|
|
64
|
+
*
|
|
65
|
+
* @param duration - the pause duration as a function
|
|
66
|
+
* @param pauseType - the type of pause
|
|
67
|
+
* @returns a new StructureBuilder
|
|
68
|
+
*/
|
|
69
|
+
(duration: SessionTo<Duration>, pauseType: PauseType): T;
|
|
70
|
+
/**
|
|
71
|
+
* Attach a pause computed randomly between 2 values
|
|
72
|
+
*
|
|
73
|
+
* @param min the pause minimum, in seconds or with an explicit time unit
|
|
74
|
+
* @param max the pause maximum, in seconds or with an explicit time unit
|
|
75
|
+
* @return a new StructureBuilder
|
|
76
|
+
*/
|
|
77
|
+
(min: Duration, max: Duration): T;
|
|
78
|
+
/**
|
|
79
|
+
* Attach a pause computed randomly between 2 values as a Gatling Expression Language string. These expressions must
|
|
80
|
+
* resolve to either a number, then the unit will be seconds, or an object with an explicit time unit.
|
|
81
|
+
*
|
|
82
|
+
* @param min the pause minimum as a Gatling Expression Language string
|
|
83
|
+
* @param max the pause maximum as a Gatling Expression Language string
|
|
84
|
+
* @return a new StructureBuilder
|
|
85
|
+
*/
|
|
86
|
+
(min: string, max: string): T;
|
|
87
|
+
/**
|
|
88
|
+
* Attach a pause computed randomly between 2 values
|
|
89
|
+
*
|
|
90
|
+
* @param min the pause minimum as a function
|
|
91
|
+
* @param max the pause maximum as a function
|
|
92
|
+
* @return a new StructureBuilder
|
|
93
|
+
*/
|
|
94
|
+
(min: SessionTo<Duration>, max: SessionTo<Duration>): T;
|
|
95
|
+
/**
|
|
96
|
+
* Attach a pause computed randomly between 2 values
|
|
97
|
+
*
|
|
98
|
+
* @param min the pause minimum, in seconds or with an explicit time unit
|
|
99
|
+
* @param max the pause maximum, in seconds or with an explicit time unit
|
|
100
|
+
* @param pauseType - the type of pause
|
|
101
|
+
* @return a new StructureBuilder
|
|
102
|
+
*/
|
|
103
|
+
(min: Duration, max: Duration, pauseType: PauseType): T;
|
|
104
|
+
/**
|
|
105
|
+
* Attach a pause computed randomly between 2 values as a Gatling Expression Language string. These expressions must
|
|
106
|
+
* resolve to either a number, then the unit will be seconds, or an object with an explicit time unit.
|
|
107
|
+
*
|
|
108
|
+
* @param min the pause minimum as a Gatling Expression Language string
|
|
109
|
+
* @param max the pause maximum as a Gatling Expression Language string
|
|
110
|
+
* @param pauseType - the type of pause
|
|
111
|
+
* @return a new StructureBuilder
|
|
112
|
+
*/
|
|
113
|
+
(min: string, max: string, pauseType: PauseType): T;
|
|
114
|
+
/**
|
|
115
|
+
* Attach a pause computed randomly between 2 values
|
|
116
|
+
*
|
|
117
|
+
* @param min the pause minimum as a function
|
|
118
|
+
* @param max the pause maximum as a function
|
|
119
|
+
* @param pauseType - the type of pause
|
|
120
|
+
* @return a new StructureBuilder
|
|
121
|
+
*/
|
|
122
|
+
(min: SessionTo<Duration>, max: SessionTo<Duration>, pauseType: PauseType): T;
|
|
123
|
+
}
|
|
124
|
+
export interface Pauses<T extends Pauses<T>> {
|
|
125
|
+
pause: PauseFunction<T>;
|
|
126
|
+
}
|
|
127
|
+
export declare const pauseImpl: <J2, J1 extends JvmPauses<J2, any>, T extends Pauses<T>>(jvmGroups: J1, wrap: (wrapped: J2) => T) => PauseFunction<T>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pauseImpl = exports.toJvmPauseType = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const duration_1 = require("../utils/duration");
|
|
6
|
+
const session_1 = require("../session");
|
|
7
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
8
|
+
const isPauseType = (x) => x === "Disabled" || x === "Constant" || x === "Exponential" || typeof x.type === "string";
|
|
9
|
+
const toJvmPauseType = (pauseType) => {
|
|
10
|
+
if (pauseType === "Disabled") {
|
|
11
|
+
// FIXME find better solution for generating static field definitions in java2typescript (without conflicting
|
|
12
|
+
// with methods of the same name, e.g. 'JvmHttpDsl.http' vs. 'JvmHttpDsl.http(String)')
|
|
13
|
+
return jvm_types_1.CoreDsl.disabledPauses;
|
|
14
|
+
}
|
|
15
|
+
else if (pauseType === "Constant") {
|
|
16
|
+
return jvm_types_1.CoreDsl.constantPauses;
|
|
17
|
+
}
|
|
18
|
+
else if (pauseType === "Exponential") {
|
|
19
|
+
return jvm_types_1.CoreDsl.exponentialPauses;
|
|
20
|
+
}
|
|
21
|
+
else if (pauseType.type === "NormalWithPercentageDuration") {
|
|
22
|
+
return jvm_types_1.CoreDsl.normalPausesWithPercentageDuration(pauseType.stdDev);
|
|
23
|
+
}
|
|
24
|
+
else if (pauseType.type === "NormalWithStdDevDuration") {
|
|
25
|
+
return jvm_types_1.CoreDsl.normalPausesWithStdDevDuration((0, duration_1.toJvmDuration)(pauseType.stdDev));
|
|
26
|
+
}
|
|
27
|
+
else if (pauseType.type === "Custom") {
|
|
28
|
+
return jvm_types_1.CoreDsl.customPauses((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(pauseType.f)));
|
|
29
|
+
}
|
|
30
|
+
else if (pauseType.type === "UniformPercentage") {
|
|
31
|
+
return jvm_types_1.CoreDsl.uniformPausesPlusOrMinusPercentage(pauseType.plusOrMinus);
|
|
32
|
+
}
|
|
33
|
+
else if (pauseType.type === "UniformDuration") {
|
|
34
|
+
return jvm_types_1.CoreDsl.uniformPausesPlusOrMinusDuration((0, duration_1.toJvmDuration)(pauseType.plusOrMinus));
|
|
35
|
+
}
|
|
36
|
+
throw Error(`Unhandled pause type ${pauseType}`);
|
|
37
|
+
};
|
|
38
|
+
exports.toJvmPauseType = toJvmPauseType;
|
|
39
|
+
const pauseImpl = (jvmGroups, wrap) => (arg0, arg1, arg2) => {
|
|
40
|
+
if (arg2 !== undefined) {
|
|
41
|
+
// pause(min, max, pauseType)
|
|
42
|
+
if (typeof arg0 === "string" && typeof arg1 === "string") {
|
|
43
|
+
return wrap(jvmGroups.pause(arg0, arg1, (0, exports.toJvmPauseType)(arg2)));
|
|
44
|
+
}
|
|
45
|
+
else if (typeof arg0 === "function" && typeof arg1 === "function") {
|
|
46
|
+
return wrap(jvmGroups.pause((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg0)), (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg1)), (0, exports.toJvmPauseType)(arg2)));
|
|
47
|
+
}
|
|
48
|
+
else if ((0, duration_1.isDuration)(arg0) && (0, duration_1.isDuration)(arg1)) {
|
|
49
|
+
return wrap(jvmGroups.pause((0, duration_1.toJvmDuration)(arg0), (0, duration_1.toJvmDuration)(arg1), (0, exports.toJvmPauseType)(arg2)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (arg1 !== undefined) {
|
|
53
|
+
if (isPauseType(arg1)) {
|
|
54
|
+
// pause(duration, pauseType)
|
|
55
|
+
if (typeof arg0 === "string") {
|
|
56
|
+
return wrap(jvmGroups.pause(arg0, (0, exports.toJvmPauseType)(arg1)));
|
|
57
|
+
}
|
|
58
|
+
else if (typeof arg0 === "function") {
|
|
59
|
+
return wrap(jvmGroups.pause((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg0)), (0, exports.toJvmPauseType)(arg1)));
|
|
60
|
+
}
|
|
61
|
+
else if ((0, duration_1.isDuration)(arg0)) {
|
|
62
|
+
return wrap(jvmGroups.pause((0, duration_1.toJvmDuration)(arg0), (0, exports.toJvmPauseType)(arg1)));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// pause(min, max)
|
|
67
|
+
if (typeof arg0 === "string" && typeof arg1 === "string") {
|
|
68
|
+
return wrap(jvmGroups.pause(arg0, arg1));
|
|
69
|
+
}
|
|
70
|
+
else if (typeof arg0 === "function" && typeof arg1 === "function") {
|
|
71
|
+
return wrap(jvmGroups.pause((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg0)), (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg1))));
|
|
72
|
+
}
|
|
73
|
+
else if ((0, duration_1.isDuration)(arg0) && (0, duration_1.isDuration)(arg1)) {
|
|
74
|
+
return wrap(jvmGroups.pause((0, duration_1.toJvmDuration)(arg0), (0, duration_1.toJvmDuration)(arg1)));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// pause(duration)
|
|
80
|
+
if (typeof arg0 === "string") {
|
|
81
|
+
return wrap(jvmGroups.pause(arg0));
|
|
82
|
+
}
|
|
83
|
+
else if (typeof arg0 === "function") {
|
|
84
|
+
return wrap(jvmGroups.pause((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(arg0))));
|
|
85
|
+
}
|
|
86
|
+
else if ((0, duration_1.isDuration)(arg0)) {
|
|
87
|
+
return wrap(jvmGroups.pause((0, duration_1.toJvmDuration)(arg0)));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
throw Error(`pause() called with invalid arguments ${arg0}, ${arg1}, ${arg2}`);
|
|
91
|
+
};
|
|
92
|
+
exports.pauseImpl = pauseImpl;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmRandomSwitch = io.gatling.javaapi.core.condition.RandomSwitch;
|
|
3
|
+
import { ChoiceWithWeight } from "./choices";
|
|
4
|
+
export interface On<T> {
|
|
5
|
+
on(...choices: ChoiceWithWeight[]): T;
|
|
6
|
+
}
|
|
7
|
+
export interface RandomSwitchFunction<T extends RandomSwitch<T>> {
|
|
8
|
+
/**
|
|
9
|
+
* Execute one of the "choices" randomly based on their respective weight. Weights are expressed
|
|
10
|
+
* in percents so their sum must be <= 100%.
|
|
11
|
+
*
|
|
12
|
+
* @returns a DSL component for defining the "choices"
|
|
13
|
+
*/
|
|
14
|
+
(): On<T>;
|
|
15
|
+
}
|
|
16
|
+
export interface RandomSwitch<T extends RandomSwitch<T>> {
|
|
17
|
+
randomSwitch: RandomSwitchFunction<T>;
|
|
18
|
+
}
|
|
19
|
+
export declare const randomSwitchImpl: <J2, J1 extends JvmRandomSwitch<J2, any>, T extends RandomSwitch<T>>(jvmRandomSwitch: J1, wrap: (wrapped: J2) => T) => RandomSwitchFunction<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomSwitchImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
6
|
+
on: (...choices) => wrap(jvmOn.on(choices.map((c) => c._underlying)))
|
|
7
|
+
});
|
|
8
|
+
const randomSwitchImpl = (jvmRandomSwitch, wrap) => () => wrapOn(jvmRandomSwitch.randomSwitch(), wrap);
|
|
9
|
+
exports.randomSwitchImpl = randomSwitchImpl;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmRandomSwitchOrElse = io.gatling.javaapi.core.condition.RandomSwitchOrElse;
|
|
3
|
+
import { ChoiceWithWeight } from "./choices";
|
|
4
|
+
import { Executable } from "./execs";
|
|
5
|
+
export interface On<T> {
|
|
6
|
+
on(...choices: ChoiceWithWeight[]): OrElse<T>;
|
|
7
|
+
}
|
|
8
|
+
export interface OrElse<T> {
|
|
9
|
+
orElse(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
10
|
+
}
|
|
11
|
+
export interface RandomSwitchOrElseFunction<T extends RandomSwitchOrElse<T>> {
|
|
12
|
+
/**
|
|
13
|
+
* Execute one of the "choices" randomly based on their respective weight. Weights are expressed
|
|
14
|
+
* in percents so their sum must be <= 100%.
|
|
15
|
+
*
|
|
16
|
+
* @returns the DSL component for defining the "else" block
|
|
17
|
+
*/
|
|
18
|
+
(): On<T>;
|
|
19
|
+
}
|
|
20
|
+
export interface RandomSwitchOrElse<T extends RandomSwitchOrElse<T>> {
|
|
21
|
+
randomSwitchOrElse: RandomSwitchOrElseFunction<T>;
|
|
22
|
+
}
|
|
23
|
+
export declare const randomSwitchOrElseImpl: <J2, J1 extends JvmRandomSwitchOrElse<J2, any>, T extends RandomSwitchOrElse<T>>(jvmRandomSwitch: J1, wrap: (wrapped: J2) => T) => RandomSwitchOrElseFunction<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomSwitchOrElseImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
6
|
+
on: (...choices) => wrapOrElse(jvmOn.on(choices.map((c) => c._underlying)), wrap)
|
|
7
|
+
});
|
|
8
|
+
const wrapOrElse = (jvmOrElse, wrap) => ({
|
|
9
|
+
orElse: (executable, ...executables) => wrap(jvmOrElse.orElse(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
10
|
+
});
|
|
11
|
+
const randomSwitchOrElseImpl = (jvmRandomSwitch, wrap) => () => wrapOn(jvmRandomSwitch.randomSwitchOrElse(), wrap);
|
|
12
|
+
exports.randomSwitchOrElseImpl = randomSwitchOrElseImpl;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmRendezVous = io.gatling.javaapi.core.pause.RendezVous;
|
|
3
|
+
export interface RendezVousFunction<T extends RendezVous<T>> {
|
|
4
|
+
/**
|
|
5
|
+
* Make virtual users wait until enough of them reach this point
|
|
6
|
+
*
|
|
7
|
+
* @param users - the number of virtual users that must reach this point
|
|
8
|
+
* @returns a new StructureBuilder
|
|
9
|
+
*/
|
|
10
|
+
(users: number): T;
|
|
11
|
+
}
|
|
12
|
+
export interface RendezVous<T extends RendezVous<T>> {
|
|
13
|
+
rendezVous: RendezVousFunction<T>;
|
|
14
|
+
}
|
|
15
|
+
export declare const rendezVousImpl: <J2, J1 extends JvmRendezVous<J2, any>, T extends RendezVous<T>>(jvmRendezVous: J1, wrap: (wrapped: J2) => T) => RendezVousFunction<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rendezVousImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const rendezVousImpl = (jvmRendezVous, wrap) => (users) => wrap(jvmRendezVous.rendezVous(users));
|
|
6
|
+
exports.rendezVousImpl = rendezVousImpl;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmRepeat = io.gatling.javaapi.core.loop.Repeat;
|
|
3
|
+
import { SessionTo } from "../session";
|
|
4
|
+
import { On } from "./on";
|
|
5
|
+
export interface RepeatFunction<T extends Repeat<T>> {
|
|
6
|
+
/**
|
|
7
|
+
* Define a loop that will iterate for a given number of times.
|
|
8
|
+
*
|
|
9
|
+
* @param times - the number of iterations
|
|
10
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
11
|
+
* @returns a DSL component for defining the loop content
|
|
12
|
+
*/
|
|
13
|
+
(times: number, counterName?: string): On<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Define a loop that will iterate for a given number of times.
|
|
16
|
+
*
|
|
17
|
+
* @param times - the number of iterations, expressed as a Gatling Expression Language String that must evaluate to an integer
|
|
18
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
19
|
+
* @returns a DSL component for defining the loop content
|
|
20
|
+
*/
|
|
21
|
+
(times: string, counterName?: string): On<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Define a loop that will iterate for a given number of times.
|
|
24
|
+
*
|
|
25
|
+
* @param times - the number of iterations, expressed as a function
|
|
26
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
27
|
+
* @returns a DSL component for defining the loop content
|
|
28
|
+
*/
|
|
29
|
+
(times: SessionTo<number>, counterName?: string): On<T>;
|
|
30
|
+
}
|
|
31
|
+
export interface Repeat<T extends Repeat<T>> {
|
|
32
|
+
repeat: RepeatFunction<T>;
|
|
33
|
+
}
|
|
34
|
+
export declare const repeatImpl: <J2, J1 extends JvmRepeat<J2, any>, T extends Repeat<T>>(jvmRepeat: J1, wrap: (wrapped: J2) => T) => RepeatFunction<T>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repeatImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("../session");
|
|
6
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
7
|
+
const on_1 = require("./on");
|
|
8
|
+
const repeatImpl = (jvmRepeat, wrap) => (times, counterName) => {
|
|
9
|
+
if (counterName !== undefined) {
|
|
10
|
+
// repeat(times, counterName
|
|
11
|
+
if (typeof times === "number") {
|
|
12
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat(times, counterName), wrap);
|
|
13
|
+
}
|
|
14
|
+
else if (typeof times === "string") {
|
|
15
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat(times, counterName), wrap);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(times)), counterName), wrap);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// repeat(times)
|
|
23
|
+
if (typeof times === "number") {
|
|
24
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat(times), wrap);
|
|
25
|
+
}
|
|
26
|
+
else if (typeof times === "string") {
|
|
27
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat(times), wrap);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return (0, on_1.wrapOn)(jvmRepeat.repeat((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(times))), wrap);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.repeatImpl = repeatImpl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmRoundRobinSwitch = io.gatling.javaapi.core.condition.RoundRobinSwitch;
|
|
3
|
+
import { Executable } from "./execs";
|
|
4
|
+
export interface On<T> {
|
|
5
|
+
on(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
6
|
+
}
|
|
7
|
+
export interface RoundRobinSwitchFunction<T extends RoundRobinSwitch<T>> {
|
|
8
|
+
/**
|
|
9
|
+
* Execute one of the "choices" in a round-robin fashion. Round-robin is global, not per virtual user.
|
|
10
|
+
*
|
|
11
|
+
* @returns a new StructureBuilder
|
|
12
|
+
*/
|
|
13
|
+
(): On<T>;
|
|
14
|
+
}
|
|
15
|
+
export interface RoundRobinSwitch<T extends RoundRobinSwitch<T>> {
|
|
16
|
+
roundRobinSwitch: RoundRobinSwitchFunction<T>;
|
|
17
|
+
}
|
|
18
|
+
export declare const roundRobinSwitchImpl: <J2, J1 extends JvmRoundRobinSwitch<J2, any>, T extends RoundRobinSwitch<T>>(jvmRoundRobinSwitch: J1, wrap: (wrapped: J2) => T) => RoundRobinSwitchFunction<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.roundRobinSwitchImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
6
|
+
on: (executable, ...executables) => wrap(jvmOn.on(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
7
|
+
});
|
|
8
|
+
const roundRobinSwitchImpl = (jvmRoundRobinSwitch, wrap) => () => wrapOn(jvmRoundRobinSwitch.roundRobinSwitch(), wrap);
|
|
9
|
+
exports.roundRobinSwitchImpl = roundRobinSwitchImpl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmUniformRandomSwitch = io.gatling.javaapi.core.condition.UniformRandomSwitch;
|
|
3
|
+
import { Executable } from "./execs";
|
|
4
|
+
export interface On<T> {
|
|
5
|
+
on(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
6
|
+
}
|
|
7
|
+
export interface UniformRandomSwitchFunction<T extends UniformRandomSwitch<T>> {
|
|
8
|
+
/**
|
|
9
|
+
* Execute one of the "choices" in a random fashion, with each having even weights.
|
|
10
|
+
*
|
|
11
|
+
* @returns a DSL component for defining the "choices"
|
|
12
|
+
*/
|
|
13
|
+
(): On<T>;
|
|
14
|
+
}
|
|
15
|
+
export interface UniformRandomSwitch<T extends UniformRandomSwitch<T>> {
|
|
16
|
+
uniformRandomSwitch: UniformRandomSwitchFunction<T>;
|
|
17
|
+
}
|
|
18
|
+
export declare const uniformRandomSwitchImpl: <J2, J1 extends JvmUniformRandomSwitch<J2, any>, T extends UniformRandomSwitch<T>>(jvmUniformRandomSwitch: J1, wrap: (wrapped: J2) => T) => UniformRandomSwitchFunction<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uniformRandomSwitchImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
6
|
+
on: (executable, ...executables) => wrap(jvmOn.on(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
7
|
+
});
|
|
8
|
+
const uniformRandomSwitchImpl = (jvmUniformRandomSwitch, wrap) => () => wrapOn(jvmUniformRandomSwitch.uniformRandomSwitch(), wrap);
|
|
9
|
+
exports.uniformRandomSwitchImpl = uniformRandomSwitchImpl;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import JvmThrottleStep = io.gatling.javaapi.core.ThrottleStep;
|
|
2
|
+
import { Wrapper } from "./common";
|
|
3
|
+
import { Duration } from "./utils/duration";
|
|
4
|
+
/**
|
|
5
|
+
* Bootstrap a new reachRps throttling profile, see {@link ThrottleStepReachIntermediate}
|
|
6
|
+
*
|
|
7
|
+
* @param target - the target requests per second
|
|
8
|
+
* @returns the next DSL step
|
|
9
|
+
*/
|
|
10
|
+
export declare const reachRps: (target: number) => ThrottleStepReachIntermediate;
|
|
11
|
+
/**
|
|
12
|
+
* Bootstrap a new holdFor throttling profile that limits rps to its current value
|
|
13
|
+
*
|
|
14
|
+
* @param duration - the duration of the plateau in seconds
|
|
15
|
+
* @returns the next DSL step
|
|
16
|
+
*/
|
|
17
|
+
export declare const holdFor: (duration: Duration) => ThrottleStep;
|
|
18
|
+
/**
|
|
19
|
+
* Bootstrap a new jumpToRps throttling profile that change the rps limit to a new value
|
|
20
|
+
*
|
|
21
|
+
* @param target - the new limit
|
|
22
|
+
* @returns the next DSL step
|
|
23
|
+
*/
|
|
24
|
+
export declare const jumpToRps: (target: number) => ThrottleStep;
|
|
25
|
+
export interface ThrottleStep extends Wrapper<JvmThrottleStep> {
|
|
26
|
+
}
|
|
27
|
+
/** DSL step to define the duration of a throttling ramp. */
|
|
28
|
+
export interface ThrottleStepReachIntermediate {
|
|
29
|
+
/**
|
|
30
|
+
* Define the duration of a throttling ramp
|
|
31
|
+
*
|
|
32
|
+
* @param duration - the duration
|
|
33
|
+
* @returns a new ThrottleStep
|
|
34
|
+
*/
|
|
35
|
+
in(duration: Duration): ThrottleStep;
|
|
36
|
+
/**
|
|
37
|
+
* Alias for `in` that's a reserved keyword in Kotlin
|
|
38
|
+
*
|
|
39
|
+
* @param duration - the duration
|
|
40
|
+
* @returns a new ThrottleStep
|
|
41
|
+
*/
|
|
42
|
+
during(duration: Duration): ThrottleStep;
|
|
43
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jumpToRps = exports.holdFor = exports.reachRps = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const duration_1 = require("./utils/duration");
|
|
6
|
+
/**
|
|
7
|
+
* Bootstrap a new reachRps throttling profile, see {@link ThrottleStepReachIntermediate}
|
|
8
|
+
*
|
|
9
|
+
* @param target - the target requests per second
|
|
10
|
+
* @returns the next DSL step
|
|
11
|
+
*/
|
|
12
|
+
const reachRps = (target) => wrapThrottleStepReachIntermediate(jvm_types_1.CoreDsl.reachRps(target));
|
|
13
|
+
exports.reachRps = reachRps;
|
|
14
|
+
/**
|
|
15
|
+
* Bootstrap a new holdFor throttling profile that limits rps to its current value
|
|
16
|
+
*
|
|
17
|
+
* @param duration - the duration of the plateau in seconds
|
|
18
|
+
* @returns the next DSL step
|
|
19
|
+
*/
|
|
20
|
+
const holdFor = (duration) => wrapThrottleStep(jvm_types_1.CoreDsl.holdFor((0, duration_1.toJvmDuration)(duration)));
|
|
21
|
+
exports.holdFor = holdFor;
|
|
22
|
+
/**
|
|
23
|
+
* Bootstrap a new jumpToRps throttling profile that change the rps limit to a new value
|
|
24
|
+
*
|
|
25
|
+
* @param target - the new limit
|
|
26
|
+
* @returns the next DSL step
|
|
27
|
+
*/
|
|
28
|
+
const jumpToRps = (target) => wrapThrottleStep(jvm_types_1.CoreDsl.jumpToRps(target));
|
|
29
|
+
exports.jumpToRps = jumpToRps;
|
|
30
|
+
const wrapThrottleStep = (_underlying) => ({
|
|
31
|
+
_underlying
|
|
32
|
+
});
|
|
33
|
+
const wrapThrottleStepReachIntermediate = (_underlying) => ({
|
|
34
|
+
in: (duration) => wrapThrottleStep(_underlying.in((0, duration_1.toJvmDuration)(duration))),
|
|
35
|
+
during: (duration) => wrapThrottleStep(_underlying.during((0, duration_1.toJvmDuration)(duration)))
|
|
36
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type TimeUnit = "milliseconds" | "seconds" | "minutes";
|
|
2
|
+
export type Duration = number | {
|
|
3
|
+
amount: number;
|
|
4
|
+
unit: TimeUnit;
|
|
5
|
+
};
|
|
6
|
+
export declare const isDuration: (x: unknown) => x is Duration;
|
|
7
|
+
export declare const toJvmDuration: (duration: Duration) => java.time.Duration;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJvmDuration = exports.isDuration = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const isDuration = (x) => typeof x === "number" ||
|
|
6
|
+
(typeof x === "object" && typeof x.amount === "number" && typeof x.unit === "string");
|
|
7
|
+
exports.isDuration = isDuration;
|
|
8
|
+
const toJvmDuration = (duration) => {
|
|
9
|
+
const { amount, unit } = typeof duration === "number" ? { amount: duration, unit: "seconds" } : duration;
|
|
10
|
+
switch (unit) {
|
|
11
|
+
case "milliseconds":
|
|
12
|
+
return jvm_types_1.Duration.ofMillis(amount);
|
|
13
|
+
case "seconds":
|
|
14
|
+
return jvm_types_1.Duration.ofSeconds(amount);
|
|
15
|
+
case "minutes":
|
|
16
|
+
return jvm_types_1.Duration.ofMinutes(amount);
|
|
17
|
+
default:
|
|
18
|
+
return jvm_types_1.Duration.ofSeconds(amount);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.toJvmDuration = toJvmDuration;
|