@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,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asLongAsDuringImpl = void 0;
|
|
4
|
+
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 on_1 = require("./on");
|
|
9
|
+
const asLongAsDuringImpl = (jvmAsLongAsDuring, wrap) => (condition, duration, arg2, arg3) => {
|
|
10
|
+
if (arg3 !== undefined && typeof arg2 === "string") {
|
|
11
|
+
// asLongAsDuring(condition, duration, counterName, exitASAP)
|
|
12
|
+
if (typeof condition === "function") {
|
|
13
|
+
const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
|
|
14
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
15
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2, arg3), wrap);
|
|
16
|
+
}
|
|
17
|
+
else if (typeof duration === "function") {
|
|
18
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2, arg3), wrap);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
23
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2, arg3), wrap);
|
|
24
|
+
}
|
|
25
|
+
else if (typeof duration === "function") {
|
|
26
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2, arg3), wrap);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (typeof arg2 === "string") {
|
|
31
|
+
// asLongAsDuring(condition, duration, counterName)
|
|
32
|
+
if (typeof condition === "function") {
|
|
33
|
+
const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
|
|
34
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
35
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
|
|
36
|
+
}
|
|
37
|
+
else if (typeof duration === "function") {
|
|
38
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
43
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
|
|
44
|
+
}
|
|
45
|
+
else if (typeof duration === "function") {
|
|
46
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (typeof arg2 === "boolean") {
|
|
51
|
+
// asLongAsDuring(condition, duration, exitASAP)
|
|
52
|
+
if (typeof condition === "function") {
|
|
53
|
+
const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
|
|
54
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
55
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
|
|
56
|
+
}
|
|
57
|
+
else if (typeof duration === "function") {
|
|
58
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
63
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
|
|
64
|
+
}
|
|
65
|
+
else if (typeof duration === "function") {
|
|
66
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (arg2 === undefined) {
|
|
71
|
+
// asLongAsDuring(condition, duration)
|
|
72
|
+
if (typeof condition === "function") {
|
|
73
|
+
const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
|
|
74
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
75
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration)), wrap);
|
|
76
|
+
}
|
|
77
|
+
else if (typeof duration === "function") {
|
|
78
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration))), wrap);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if ((0, duration_1.isDuration)(duration)) {
|
|
83
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, duration_1.toJvmDuration)(duration)), wrap);
|
|
84
|
+
}
|
|
85
|
+
else if (typeof duration === "function") {
|
|
86
|
+
return (0, on_1.wrapOn)(jvmAsLongAsDuring.asLongAsDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration))), wrap);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
throw Error(`asLongAsDuring() called with invalid arguments ${condition}, ${duration}, ${arg2}, ${arg3}`);
|
|
91
|
+
};
|
|
92
|
+
exports.asLongAsDuringImpl = asLongAsDuringImpl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmChoiceWithKey = io.gatling.javaapi.core.Choice$WithKey;
|
|
3
|
+
import JvmChoiceWithWeight = io.gatling.javaapi.core.Choice$WithWeight;
|
|
4
|
+
import { Wrapper } from "../common";
|
|
5
|
+
import { Executable } from "./execs";
|
|
6
|
+
export interface ChoiceWithKey extends Wrapper<JvmChoiceWithKey> {
|
|
7
|
+
}
|
|
8
|
+
interface ChoiceWithKeyThen {
|
|
9
|
+
then(executable: Executable<any>, ...executables: Executable<any>[]): ChoiceWithKey;
|
|
10
|
+
}
|
|
11
|
+
export declare const onCase: (key: unknown) => ChoiceWithKeyThen;
|
|
12
|
+
export interface ChoiceWithWeight extends Wrapper<JvmChoiceWithWeight> {
|
|
13
|
+
}
|
|
14
|
+
interface ChoiceWithWeightThen {
|
|
15
|
+
then(executable: Executable<any>, ...executables: Executable<any>[]): ChoiceWithWeight;
|
|
16
|
+
}
|
|
17
|
+
export declare const percent: (percent: number) => ChoiceWithWeightThen;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.percent = exports.onCase = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
6
|
+
const wrapChoiceWithKey = (_underlying) => ({
|
|
7
|
+
_underlying
|
|
8
|
+
});
|
|
9
|
+
const wrapChoiceWithKeyThen = (jvmChoiceWithKeyThen) => ({
|
|
10
|
+
then: (executable, ...executables) => wrapChoiceWithKey(jvmChoiceWithKeyThen.then(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
11
|
+
});
|
|
12
|
+
const onCase = (key) => wrapChoiceWithKeyThen(jvm_types_1.CoreDsl.onCase(key));
|
|
13
|
+
exports.onCase = onCase;
|
|
14
|
+
const wrapChoiceWithWeight = (_underlying) => ({
|
|
15
|
+
_underlying
|
|
16
|
+
});
|
|
17
|
+
const wrapChoiceWithWeightThen = (jvmChoiceWithWeightThen) => ({
|
|
18
|
+
then: (executable, ...executables) => wrapChoiceWithWeight(jvmChoiceWithWeightThen.then(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
19
|
+
});
|
|
20
|
+
const percent = (percent) => wrapChoiceWithWeightThen(jvm_types_1.CoreDsl.percent(percent));
|
|
21
|
+
exports.percent = percent;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmDoIf = io.gatling.javaapi.core.condition.DoIf;
|
|
3
|
+
import JvmDoIfEquals = io.gatling.javaapi.core.condition.DoIfEquals;
|
|
4
|
+
import { SessionTo } from "../session";
|
|
5
|
+
import { Executable } from "./execs";
|
|
6
|
+
export interface Then<T> {
|
|
7
|
+
then(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
8
|
+
}
|
|
9
|
+
export interface DoIfFunction<T extends DoIf<T>> {
|
|
10
|
+
/**
|
|
11
|
+
* Execute the "then" block only if the condition is true
|
|
12
|
+
*
|
|
13
|
+
* @param condition - the condition expressed as a Gatling Expression Language String that must
|
|
14
|
+
* evaluate to a Boolean
|
|
15
|
+
* @returns a DSL component for defining the "then" block
|
|
16
|
+
*/
|
|
17
|
+
(condition: string): Then<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Execute the "then" block only if the condition is true
|
|
20
|
+
*
|
|
21
|
+
* @param condition - the condition expressed as a function
|
|
22
|
+
* @returns a DSL component for defining the "then" block
|
|
23
|
+
*/
|
|
24
|
+
(condition: SessionTo<boolean>): Then<T>;
|
|
25
|
+
}
|
|
26
|
+
export interface DoIf<T extends DoIf<T>> {
|
|
27
|
+
doIf: DoIfFunction<T>;
|
|
28
|
+
}
|
|
29
|
+
export declare const doIfImpl: <J2, J1 extends JvmDoIf<J2, any>, T extends DoIf<T>>(jvmDoIf: J1, wrap: (wrapped: J2) => T) => DoIfFunction<T>;
|
|
30
|
+
export interface DoIfEqualsFunction<T extends DoIfEquals<T>> {
|
|
31
|
+
/**
|
|
32
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
33
|
+
*
|
|
34
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
35
|
+
* @param expected - the expected value expressed as a Gatling Expression Language String
|
|
36
|
+
* @returns a DSL component for defining the "then" block
|
|
37
|
+
*/
|
|
38
|
+
(actual: string, expected: string): Then<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
41
|
+
*
|
|
42
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
43
|
+
* @param expected - the expected static value
|
|
44
|
+
* @returns a DSL component for defining the "then" block
|
|
45
|
+
*/
|
|
46
|
+
(actual: string, expected: unknown): Then<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
49
|
+
*
|
|
50
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
51
|
+
* @param expected - the expected value expressed as a function
|
|
52
|
+
* @returns a DSL component for defining the "then" block
|
|
53
|
+
*/
|
|
54
|
+
(actual: string, expected: SessionTo<unknown>): Then<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
57
|
+
*
|
|
58
|
+
* @param actual - the actual value expressed as a function
|
|
59
|
+
* @param expected - the expected value expressed as a Gatling Expression Language String
|
|
60
|
+
* @returns a DSL component for defining the "then" block
|
|
61
|
+
*/
|
|
62
|
+
(actual: SessionTo<unknown>, expected: string): Then<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
65
|
+
*
|
|
66
|
+
* @param actual - the actual value expressed as a function
|
|
67
|
+
* @param expected - the expected static value
|
|
68
|
+
* @returns a DSL component for defining the "then" block
|
|
69
|
+
*/
|
|
70
|
+
(actual: SessionTo<unknown>, expected: unknown): Then<T>;
|
|
71
|
+
/**
|
|
72
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
73
|
+
*
|
|
74
|
+
* @param actual - the actual value expressed as a function
|
|
75
|
+
* @param expected - the expected value expressed as a function
|
|
76
|
+
* @returns a DSL component for defining the "then" block
|
|
77
|
+
*/
|
|
78
|
+
(actual: SessionTo<unknown>, expected: SessionTo<unknown>): Then<T>;
|
|
79
|
+
}
|
|
80
|
+
export interface DoIfEquals<T extends DoIfEquals<T>> {
|
|
81
|
+
doIfEquals: DoIfEqualsFunction<T>;
|
|
82
|
+
}
|
|
83
|
+
export declare const doIfEqualsImpl: <J2, J1 extends JvmDoIfEquals<J2, any>, T extends DoIfEquals<T>>(jvmDoIfEquals: J1, wrap: (wrapped: J2) => T) => DoIfEqualsFunction<T>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doIfEqualsImpl = exports.doIfImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("../session");
|
|
6
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
7
|
+
const wrapThen = (jvmThen, wrap) => ({
|
|
8
|
+
then: (executable, ...executables) => wrap(jvmThen.then(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
9
|
+
});
|
|
10
|
+
const doIfImpl = (jvmDoIf, wrap) => (condition) => wrapThen(typeof condition === "function"
|
|
11
|
+
? jvmDoIf.doIf((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)))
|
|
12
|
+
: jvmDoIf.doIf(condition), wrap);
|
|
13
|
+
exports.doIfImpl = doIfImpl;
|
|
14
|
+
const doIfEqualsImpl = (jvmDoIfEquals, wrap) => (actual, expected) => {
|
|
15
|
+
if (typeof actual === "function") {
|
|
16
|
+
const wrappedActual = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(actual));
|
|
17
|
+
if (typeof expected === "function") {
|
|
18
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(expected))), wrap);
|
|
19
|
+
}
|
|
20
|
+
else if (typeof expected === "string") {
|
|
21
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, expected), wrap);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, expected), wrap);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (typeof expected === "function") {
|
|
29
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(actual, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(expected))), wrap);
|
|
30
|
+
}
|
|
31
|
+
else if (typeof expected === "string") {
|
|
32
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(actual, expected), wrap);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return wrapThen(jvmDoIfEquals.doIfEquals(actual, expected), wrap);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.doIfEqualsImpl = doIfEqualsImpl;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmDoIfOrElse = io.gatling.javaapi.core.condition.DoIfOrElse;
|
|
3
|
+
import JvmDoIfEqualsOrElse = io.gatling.javaapi.core.condition.DoIfEqualsOrElse;
|
|
4
|
+
import { SessionTo } from "../session";
|
|
5
|
+
import { Executable } from "./execs";
|
|
6
|
+
export interface Then<T> {
|
|
7
|
+
then(executable: Executable<any>, ...executables: Executable<any>[]): OrElse<T>;
|
|
8
|
+
}
|
|
9
|
+
export interface OrElse<T> {
|
|
10
|
+
orElse(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
11
|
+
}
|
|
12
|
+
export interface DoIfOrElseFunction<T extends DoIfOrElse<T>> {
|
|
13
|
+
/**
|
|
14
|
+
* Execute the "then" block only if the condition is true
|
|
15
|
+
*
|
|
16
|
+
* @param condition - the condition expressed as a Gatling Expression Language String that must
|
|
17
|
+
* evaluate to a Boolean
|
|
18
|
+
* @returns a DSL component for defining the "then" block
|
|
19
|
+
*/
|
|
20
|
+
(condition: string): Then<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Execute the "then" block only if the condition is true
|
|
23
|
+
*
|
|
24
|
+
* @param condition - the condition expressed as a function
|
|
25
|
+
* @returns a DSL component for defining the "then" block
|
|
26
|
+
*/
|
|
27
|
+
(condition: SessionTo<boolean>): Then<T>;
|
|
28
|
+
}
|
|
29
|
+
export interface DoIfOrElse<T extends DoIfOrElse<T>> {
|
|
30
|
+
doIfOrElse: DoIfOrElseFunction<T>;
|
|
31
|
+
}
|
|
32
|
+
export declare const doIfOrElseImpl: <J2, J1 extends JvmDoIfOrElse<J2, any>, T extends DoIfOrElse<T>>(jvmDoIfOrElse: J1, wrap: (wrapped: J2) => T) => DoIfOrElseFunction<T>;
|
|
33
|
+
export interface DoIfEqualsOrElseFunction<T extends DoIfEqualsOrElse<T>> {
|
|
34
|
+
/**
|
|
35
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
36
|
+
*
|
|
37
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
38
|
+
* @param expected - the expected value expressed as a Gatling Expression Language String
|
|
39
|
+
* @returns a DSL component for defining the "then" block
|
|
40
|
+
*/
|
|
41
|
+
(actual: string, expected: string): Then<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
44
|
+
*
|
|
45
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
46
|
+
* @param expected - the expected static value
|
|
47
|
+
* @returns a DSL component for defining the "then" block
|
|
48
|
+
*/
|
|
49
|
+
(actual: string, expected: unknown): Then<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
52
|
+
*
|
|
53
|
+
* @param actual - the actual value expressed as a function
|
|
54
|
+
* @param expected - the expected value expressed as a Gatling Expression Language String
|
|
55
|
+
* @returns a DSL component for defining the "then" block
|
|
56
|
+
*/
|
|
57
|
+
(actual: string, expected: SessionTo<unknown>): Then<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
60
|
+
*
|
|
61
|
+
* @param actual - the actual value expressed as a function
|
|
62
|
+
* @param expected - the expected value expressed as a Gatling Expression Language String
|
|
63
|
+
* @returns a DSL component for defining the "then" block
|
|
64
|
+
*/
|
|
65
|
+
(actual: SessionTo<unknown>, expected: string): Then<T>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
68
|
+
*
|
|
69
|
+
* @param actual - the actual value expressed as a function
|
|
70
|
+
* @param expected - the expected static value
|
|
71
|
+
* @returns a DSL component for defining the "then" block
|
|
72
|
+
*/
|
|
73
|
+
(actual: SessionTo<unknown>, expected: unknown): Then<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Execute the "then" block only if the actual value is equal to the expected one
|
|
76
|
+
*
|
|
77
|
+
* @param actual - the actual value expressed as a function
|
|
78
|
+
* @param expected - the expected value expressed as a function
|
|
79
|
+
* @returns a DSL component for defining the "then" block
|
|
80
|
+
*/
|
|
81
|
+
(actual: SessionTo<unknown>, expected: SessionTo<unknown>): Then<T>;
|
|
82
|
+
}
|
|
83
|
+
export interface DoIfEqualsOrElse<T extends DoIfEqualsOrElse<T>> {
|
|
84
|
+
doIfEqualsOrElse: DoIfEqualsOrElseFunction<T>;
|
|
85
|
+
}
|
|
86
|
+
export declare const doIfEqualsOrElseImpl: <J2, J1 extends JvmDoIfEqualsOrElse<J2, any>, T extends DoIfEqualsOrElse<T>>(jvmDoIfEqualsOrElse: J1, wrap: (wrapped: J2) => T) => DoIfEqualsOrElseFunction<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doIfEqualsOrElseImpl = exports.doIfOrElseImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("../session");
|
|
6
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
7
|
+
const wrapThen = (jvmThen, wrap) => ({
|
|
8
|
+
then: (executable, ...executables) => wrapOrElse(jvmThen.then(executable._underlying, ...executables.map((e) => e._underlying)), wrap)
|
|
9
|
+
});
|
|
10
|
+
const wrapOrElse = (jvmOrElse, wrap) => ({
|
|
11
|
+
orElse: (executable, ...executables) => wrap(jvmOrElse.orElse(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
12
|
+
});
|
|
13
|
+
const doIfOrElseImpl = (jvmDoIfOrElse, wrap) => (condition) => wrapThen(typeof condition === "function"
|
|
14
|
+
? jvmDoIfOrElse.doIfOrElse((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)))
|
|
15
|
+
: jvmDoIfOrElse.doIfOrElse(condition), wrap);
|
|
16
|
+
exports.doIfOrElseImpl = doIfOrElseImpl;
|
|
17
|
+
const doIfEqualsOrElseImpl = (jvmDoIfEqualsOrElse, wrap) => (actual, expected) => {
|
|
18
|
+
if (typeof actual === "function") {
|
|
19
|
+
const wrappedActual = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(actual));
|
|
20
|
+
if (typeof expected === "function") {
|
|
21
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(wrappedActual, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(expected))), wrap);
|
|
22
|
+
}
|
|
23
|
+
else if (typeof expected === "string") {
|
|
24
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(wrappedActual, expected), wrap);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(wrappedActual, expected), wrap);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (typeof expected === "function") {
|
|
32
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(actual, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(expected))), wrap);
|
|
33
|
+
}
|
|
34
|
+
else if (typeof expected === "string") {
|
|
35
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(actual, expected), wrap);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return wrapThen(jvmDoIfEqualsOrElse.doIfEqualsOrElse(actual, expected), wrap);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.doIfEqualsOrElseImpl = doIfEqualsOrElseImpl;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmDoSwitch = io.gatling.javaapi.core.condition.DoSwitch;
|
|
3
|
+
import { SessionTo } from "../session";
|
|
4
|
+
import { ChoiceWithKey } from "./choices";
|
|
5
|
+
export interface On<T> {
|
|
6
|
+
on(...choices: ChoiceWithKey[]): T;
|
|
7
|
+
}
|
|
8
|
+
export interface DoSwitchFunction<T extends DoSwitch<T>> {
|
|
9
|
+
/**
|
|
10
|
+
* Execute one of the "choices" when the actual value is equal to the possibility's one.
|
|
11
|
+
*
|
|
12
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
13
|
+
* @returns a DSL component for defining the "choices"
|
|
14
|
+
*/
|
|
15
|
+
(actual: string): On<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Execute one of the "choices" when the actual value is equal to the possibility's one.
|
|
18
|
+
*
|
|
19
|
+
* @param actual - the actual value expressed as a function
|
|
20
|
+
* @returns a DSL component for defining the "choices"
|
|
21
|
+
*/
|
|
22
|
+
(actual: SessionTo<unknown>): On<T>;
|
|
23
|
+
}
|
|
24
|
+
export interface DoSwitch<T extends DoSwitch<T>> {
|
|
25
|
+
doSwitch: DoSwitchFunction<T>;
|
|
26
|
+
}
|
|
27
|
+
export declare const doSwitchImpl: <J2, J1 extends JvmDoSwitch<J2, any>, T extends DoSwitch<T>>(jvmDoSwitch: J1, wrap: (wrapped: J2) => T) => DoSwitchFunction<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSwitchImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("../session");
|
|
6
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
7
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
8
|
+
on: (...choices) => wrap(jvmOn.on(choices.map((c) => c._underlying)))
|
|
9
|
+
});
|
|
10
|
+
const doSwitchImpl = (jvmDoSwitch, wrap) => (actual) => wrapOn(typeof actual === "function"
|
|
11
|
+
? jvmDoSwitch.doSwitch((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(actual)))
|
|
12
|
+
: jvmDoSwitch.doSwitch(actual), wrap);
|
|
13
|
+
exports.doSwitchImpl = doSwitchImpl;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmDoSwitchOrElse = io.gatling.javaapi.core.condition.DoSwitchOrElse;
|
|
3
|
+
import { SessionTo } from "../session";
|
|
4
|
+
import { ChoiceWithKey } from "./choices";
|
|
5
|
+
import { Executable } from "./execs";
|
|
6
|
+
export interface On<T> {
|
|
7
|
+
on(...choices: ChoiceWithKey[]): OrElse<T>;
|
|
8
|
+
}
|
|
9
|
+
interface OrElse<T> {
|
|
10
|
+
orElse(executable: Executable<any>, ...executables: Executable<any>[]): T;
|
|
11
|
+
}
|
|
12
|
+
export interface DoSwitchOrElseFunction<T extends DoSwitchOrElse<T>> {
|
|
13
|
+
/**
|
|
14
|
+
* Execute one of the "choices" when the actual value is equal to the possibility's one, otherwise execute the "else"
|
|
15
|
+
* block.
|
|
16
|
+
*
|
|
17
|
+
* @param actual - the actual value expressed as a Gatling Expression Language String
|
|
18
|
+
* @returns a DSL component for defining the "choices"
|
|
19
|
+
*/
|
|
20
|
+
(actual: string): On<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Execute one of the "choices" when the actual value is equal to the possibility's one, otherwise execute the "else"
|
|
23
|
+
* block.
|
|
24
|
+
*
|
|
25
|
+
* @param actual - the actual value expressed as a function
|
|
26
|
+
* @returns a DSL component for defining the "choices"
|
|
27
|
+
*/
|
|
28
|
+
(actual: SessionTo<unknown>): On<T>;
|
|
29
|
+
}
|
|
30
|
+
export interface DoSwitchOrElse<T extends DoSwitchOrElse<T>> {
|
|
31
|
+
doSwitchOrElse: DoSwitchOrElseFunction<T>;
|
|
32
|
+
}
|
|
33
|
+
export declare const doSwitchOrElseImpl: <J2, J1 extends JvmDoSwitchOrElse<J2, any>, T extends DoSwitchOrElse<T>>(jvmDoSwitchOrElse: J1, wrap: (wrapped: J2) => T) => DoSwitchOrElseFunction<T>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSwitchOrElseImpl = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("../session");
|
|
6
|
+
const callbacks_1 = require("../gatlingJvm/callbacks");
|
|
7
|
+
const wrapOn = (jvmOn, wrap) => ({
|
|
8
|
+
on: (...choices) => wrapOrElse(jvmOn.on(choices.map((c) => c._underlying)), wrap)
|
|
9
|
+
});
|
|
10
|
+
const wrapOrElse = (jvmOrElse, wrap) => ({
|
|
11
|
+
orElse: (executable, ...executables) => wrap(jvmOrElse.orElse(executable._underlying, ...executables.map((e) => e._underlying)))
|
|
12
|
+
});
|
|
13
|
+
const doSwitchOrElseImpl = (jvmDoSwitchOrElse, wrap) => (actual) => wrapOn(typeof actual === "function"
|
|
14
|
+
? jvmDoSwitchOrElse.doSwitchOrElse((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(actual)))
|
|
15
|
+
: jvmDoSwitchOrElse.doSwitchOrElse(actual), wrap);
|
|
16
|
+
exports.doSwitchOrElseImpl = doSwitchOrElseImpl;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmDoWhile = io.gatling.javaapi.core.loop.DoWhile;
|
|
3
|
+
import { SessionTo } from "../session";
|
|
4
|
+
import { On } from "./on";
|
|
5
|
+
export interface DoWhileFunction<T extends DoWhile<T>> {
|
|
6
|
+
/**
|
|
7
|
+
* Define a loop that will iterate as long as the condition holds true. The condition is evaluated
|
|
8
|
+
* at the end of the loop.
|
|
9
|
+
*
|
|
10
|
+
* @param condition the condition, expressed as a Gatling Expression Language String
|
|
11
|
+
* @param counterName the name of the loop counter, as stored in the Session
|
|
12
|
+
* @return a DSL component for defining the loop content
|
|
13
|
+
*/
|
|
14
|
+
(condition: string, counterName?: string): On<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Define a loop that will iterate as long as the condition holds true. The condition is evaluated
|
|
17
|
+
* at the end of the loop.
|
|
18
|
+
*
|
|
19
|
+
* @param condition the condition, expressed as a function
|
|
20
|
+
* @param counterName the name of the loop counter, as stored in the Session
|
|
21
|
+
* @return a DSL component for defining the loop content
|
|
22
|
+
*/
|
|
23
|
+
(condition: SessionTo<boolean>, counterName?: string): On<T>;
|
|
24
|
+
}
|
|
25
|
+
export interface DoWhile<T extends DoWhile<T>> {
|
|
26
|
+
doWhile: DoWhileFunction<T>;
|
|
27
|
+
}
|
|
28
|
+
export declare const doWhileImpl: <J2, J1 extends JvmDoWhile<J2, any>, T extends DoWhile<T>>(jvmDoWhile: J1, wrap: (wrapped: J2) => T) => DoWhileFunction<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doWhileImpl = 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 doWhileImpl = (jvmDoWhile, wrap) => (condition, counterName) => {
|
|
9
|
+
if (counterName !== undefined) {
|
|
10
|
+
// doWhile(condition, counterName)
|
|
11
|
+
if (typeof condition === "function") {
|
|
12
|
+
return (0, on_1.wrapOn)(jvmDoWhile.doWhile((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)), counterName), wrap);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return (0, on_1.wrapOn)(jvmDoWhile.doWhile(condition, counterName), wrap);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// doWhile(condition)
|
|
20
|
+
if (typeof condition === "function") {
|
|
21
|
+
return (0, on_1.wrapOn)(jvmDoWhile.doWhile((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition))), wrap);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return (0, on_1.wrapOn)(jvmDoWhile.doWhile(condition), wrap);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.doWhileImpl = doWhileImpl;
|