@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,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.incrementUsersPerSec = exports.nothingFor = exports.rampUsersPerSec = exports.constantUsersPerSec = exports.atOnceUsers = exports.stressPeakUsers = exports.rampUsers = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
6
|
+
const duration_1 = require("./utils/duration");
|
|
7
|
+
const wrapOpenInjectionStep = (_underlying) => ({ _underlying });
|
|
8
|
+
const wrapConstantRateOpenInjectionStep = (_underlying) => ({
|
|
9
|
+
_underlying,
|
|
10
|
+
randomized: () => wrapOpenInjectionStep(_underlying.randomized())
|
|
11
|
+
});
|
|
12
|
+
const wrapOpenInjectionStepRamp = (_underlying) => ({
|
|
13
|
+
_underlying,
|
|
14
|
+
during: (duration) => wrapOpenInjectionStep(_underlying.during((0, duration_1.toJvmDuration)(duration)))
|
|
15
|
+
});
|
|
16
|
+
const wrapOpenInjectionStepStressPeak = (_underlying) => ({
|
|
17
|
+
_underlying,
|
|
18
|
+
during: (duration) => wrapOpenInjectionStep(_underlying.during((0, duration_1.toJvmDuration)(duration)))
|
|
19
|
+
});
|
|
20
|
+
const wrapOpenInjectionStepConstantRate = (_underlying) => ({
|
|
21
|
+
_underlying,
|
|
22
|
+
during: (duration) => wrapConstantRateOpenInjectionStep(_underlying.during((0, duration_1.toJvmDuration)(duration)))
|
|
23
|
+
});
|
|
24
|
+
const wrapOpenInjectionStepRampRate = (_underlying) => ({
|
|
25
|
+
_underlying,
|
|
26
|
+
to: (to) => wrapOpenInjectionStepRampRateDuring(_underlying.to(to))
|
|
27
|
+
});
|
|
28
|
+
const wrapOpenInjectionStepRampRateDuring = (_underlying) => ({
|
|
29
|
+
_underlying,
|
|
30
|
+
during: (duration) => wrapRampRateOpenInjectionStep(_underlying.during((0, duration_1.toJvmDuration)(duration)))
|
|
31
|
+
});
|
|
32
|
+
const wrapRampRateOpenInjectionStep = (_underlying) => ({
|
|
33
|
+
_underlying,
|
|
34
|
+
randomized: () => wrapOpenInjectionStep(_underlying.randomized())
|
|
35
|
+
});
|
|
36
|
+
const wrapOpenInjectionStepStairs = (_underlying) => ({
|
|
37
|
+
_underlying,
|
|
38
|
+
times: (levels) => wrapOpenInjectionStepStairsTimes(_underlying.times(levels))
|
|
39
|
+
});
|
|
40
|
+
const wrapOpenInjectionStepStairsTimes = (_underlying) => ({
|
|
41
|
+
_underlying,
|
|
42
|
+
eachLevelLasting: (duration) => wrapOpenInjectionStepStairsComposite(_underlying.eachLevelLasting((0, duration_1.toJvmDuration)(duration)))
|
|
43
|
+
});
|
|
44
|
+
const wrapOpenInjectionStepStairsComposite = (_underlying) => ({
|
|
45
|
+
_underlying,
|
|
46
|
+
startingFrom: (startingRate) => wrapOpenInjectionStepStairsComposite(_underlying.startingFrom(startingRate)),
|
|
47
|
+
separatedByRampsLasting: (duration) => wrapOpenInjectionStepStairsComposite(_underlying.separatedByRampsLasting((0, duration_1.toJvmDuration)(duration)))
|
|
48
|
+
});
|
|
49
|
+
const rampUsers = (users) => wrapOpenInjectionStepRamp(jvm_types_1.CoreDsl.rampUsers(users));
|
|
50
|
+
exports.rampUsers = rampUsers;
|
|
51
|
+
const stressPeakUsers = (users) => wrapOpenInjectionStepStressPeak(jvm_types_1.CoreDsl.stressPeakUsers(users));
|
|
52
|
+
exports.stressPeakUsers = stressPeakUsers;
|
|
53
|
+
const atOnceUsers = (users) => wrapOpenInjectionStep(jvm_types_1.CoreDsl.atOnceUsers(users));
|
|
54
|
+
exports.atOnceUsers = atOnceUsers;
|
|
55
|
+
const constantUsersPerSec = (rate) => wrapOpenInjectionStepConstantRate(jvm_types_1.CoreDsl.constantUsersPerSec(rate));
|
|
56
|
+
exports.constantUsersPerSec = constantUsersPerSec;
|
|
57
|
+
const rampUsersPerSec = (rate) => wrapOpenInjectionStepRampRate(jvm_types_1.CoreDsl.rampUsersPerSec(rate));
|
|
58
|
+
exports.rampUsersPerSec = rampUsersPerSec;
|
|
59
|
+
const nothingFor = (duration) => wrapOpenInjectionStep(jvm_types_1.CoreDsl.nothingFor((0, duration_1.toJvmDuration)(duration)));
|
|
60
|
+
exports.nothingFor = nothingFor;
|
|
61
|
+
const incrementUsersPerSec = (rateIncrement) => wrapOpenInjectionStepStairs(jvm_types_1.CoreDsl.incrementUsersPerSec(rateIncrement));
|
|
62
|
+
exports.incrementUsersPerSec = incrementUsersPerSec;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmPopulationBuilder = io.gatling.javaapi.core.PopulationBuilder;
|
|
3
|
+
import { Wrapper } from "./common";
|
|
4
|
+
import { ProtocolBuilder } from "./protocol";
|
|
5
|
+
import { SessionTo } from "./session";
|
|
6
|
+
import { Duration } from "./utils/duration";
|
|
7
|
+
import { PauseType } from "./structure/pauses";
|
|
8
|
+
import { ThrottleStep } from "./throttling";
|
|
9
|
+
/**
|
|
10
|
+
* A builder for a Population = a Scenario + an injection profile.
|
|
11
|
+
*
|
|
12
|
+
* Immutable, meaning each method doesn't mutate the current instance but return a new one.
|
|
13
|
+
*/
|
|
14
|
+
export interface PopulationBuilder extends Wrapper<JvmPopulationBuilder> {
|
|
15
|
+
/**
|
|
16
|
+
* Define the optional protocols for this PopulationBuilder
|
|
17
|
+
*
|
|
18
|
+
* @param protocols - the protocols
|
|
19
|
+
* @returns a new PopulationBuilder
|
|
20
|
+
*/
|
|
21
|
+
protocols(...protocols: ProtocolBuilder[]): PopulationBuilder;
|
|
22
|
+
/**
|
|
23
|
+
* Define some other PopulationBuilder to be executed once all the users of this PopulationBuilder
|
|
24
|
+
* complete their Scenario.
|
|
25
|
+
*
|
|
26
|
+
* @param children - the children PopulationBuilder
|
|
27
|
+
* @returns a new PopulationBuilder
|
|
28
|
+
*/
|
|
29
|
+
andThen(...children: PopulationBuilder[]): PopulationBuilder;
|
|
30
|
+
/**
|
|
31
|
+
* Disable the pauses
|
|
32
|
+
*
|
|
33
|
+
* @return a new PopulationBuilder
|
|
34
|
+
*/
|
|
35
|
+
disablePauses(): PopulationBuilder;
|
|
36
|
+
/**
|
|
37
|
+
* Use constant pauses
|
|
38
|
+
*
|
|
39
|
+
* @return a new PopulationBuilder
|
|
40
|
+
*/
|
|
41
|
+
constantPauses(): PopulationBuilder;
|
|
42
|
+
/**
|
|
43
|
+
* Use exponential pauses
|
|
44
|
+
*
|
|
45
|
+
* @return a new PopulationBuilder
|
|
46
|
+
*/
|
|
47
|
+
exponentialPauses(): PopulationBuilder;
|
|
48
|
+
/**
|
|
49
|
+
* Use custom pauses
|
|
50
|
+
*
|
|
51
|
+
* @return a new PopulationBuilder
|
|
52
|
+
*/
|
|
53
|
+
customPauses(f: SessionTo<number>): PopulationBuilder;
|
|
54
|
+
/**
|
|
55
|
+
* Use uniform pauses with a standard deviation percentage
|
|
56
|
+
*
|
|
57
|
+
* @return a new PopulationBuilder
|
|
58
|
+
*/
|
|
59
|
+
uniformPauses(plusOrMinus: Duration): PopulationBuilder;
|
|
60
|
+
/**
|
|
61
|
+
* Use pauses configured with a given strategy
|
|
62
|
+
*
|
|
63
|
+
* @param pauseType the pause type
|
|
64
|
+
* @return a new PopulationBuilder
|
|
65
|
+
*/
|
|
66
|
+
pauses(pauseType: PauseType): PopulationBuilder;
|
|
67
|
+
/**
|
|
68
|
+
* Define the optional throttling profile
|
|
69
|
+
*
|
|
70
|
+
* @param throttleSteps the throttling profile steps
|
|
71
|
+
* @return a new PopulationBuilder
|
|
72
|
+
*/
|
|
73
|
+
throttle(...throttleSteps: ThrottleStep[]): PopulationBuilder;
|
|
74
|
+
/**
|
|
75
|
+
* Disable the injection profile sharding that happens normally when running with Gatling
|
|
76
|
+
* Enterprise. Only effective when the test is running with Gatling Enterprise, noop otherwise.
|
|
77
|
+
*
|
|
78
|
+
* @return a new PopulationBuilder
|
|
79
|
+
*/
|
|
80
|
+
noShard(): PopulationBuilder;
|
|
81
|
+
}
|
|
82
|
+
export declare const wrapPopulationBuilder: (_underlying: JvmPopulationBuilder) => PopulationBuilder;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapPopulationBuilder = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const session_1 = require("./session");
|
|
6
|
+
const duration_1 = require("./utils/duration");
|
|
7
|
+
const pauses_1 = require("./structure/pauses");
|
|
8
|
+
const callbacks_1 = require("./gatlingJvm/callbacks");
|
|
9
|
+
const wrapPopulationBuilder = (_underlying) => ({
|
|
10
|
+
_underlying,
|
|
11
|
+
protocols: (...protocols) => (0, exports.wrapPopulationBuilder)(_underlying.protocols(protocols.map((p) => p._underlying))),
|
|
12
|
+
andThen: (...children) => (0, exports.wrapPopulationBuilder)(_underlying.andThen(children.map((c) => c._underlying))),
|
|
13
|
+
disablePauses: () => (0, exports.wrapPopulationBuilder)(_underlying.disablePauses()),
|
|
14
|
+
constantPauses: () => (0, exports.wrapPopulationBuilder)(_underlying.constantPauses()),
|
|
15
|
+
exponentialPauses: () => (0, exports.wrapPopulationBuilder)(_underlying.exponentialPauses()),
|
|
16
|
+
customPauses: (f) => (0, exports.wrapPopulationBuilder)(_underlying.customPauses((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(f)))),
|
|
17
|
+
uniformPauses: (plusOrMinus) => (0, exports.wrapPopulationBuilder)(_underlying.uniformPauses((0, duration_1.toJvmDuration)(plusOrMinus))),
|
|
18
|
+
pauses: (pauseType) => (0, exports.wrapPopulationBuilder)(_underlying.pauses((0, pauses_1.toJvmPauseType)(pauseType))),
|
|
19
|
+
throttle: (...throttleSteps) => (0, exports.wrapPopulationBuilder)(_underlying.throttle(throttleSteps.map((t) => t._underlying))),
|
|
20
|
+
noShard: () => (0, exports.wrapPopulationBuilder)(_underlying.noShard())
|
|
21
|
+
});
|
|
22
|
+
exports.wrapPopulationBuilder = wrapPopulationBuilder;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import { StructureBuilder } from "./structure";
|
|
3
|
+
import { ClosedInjectionStep } from "./closedInjection";
|
|
4
|
+
import { OpenInjectionStep } from "./openInjection";
|
|
5
|
+
import { PopulationBuilder } from "./population";
|
|
6
|
+
export interface ScenarioBuilder extends StructureBuilder<ScenarioBuilder> {
|
|
7
|
+
injectOpen(...steps: OpenInjectionStep[]): PopulationBuilder;
|
|
8
|
+
injectClosed(...steps: ClosedInjectionStep[]): PopulationBuilder;
|
|
9
|
+
}
|
|
10
|
+
export declare const scenario: (name: string) => ScenarioBuilder;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scenario = void 0;
|
|
4
|
+
require("@gatling.io/jvm-types");
|
|
5
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
6
|
+
const structure_1 = require("./structure");
|
|
7
|
+
const population_1 = require("./population");
|
|
8
|
+
const wrapScenarioBuilder = (jvmScenarioBuilder) => ({
|
|
9
|
+
injectOpen: (...steps) => (0, population_1.wrapPopulationBuilder)(jvmScenarioBuilder.injectOpen(steps.map((s) => s._underlying))),
|
|
10
|
+
injectClosed: (...steps) => (0, population_1.wrapPopulationBuilder)(jvmScenarioBuilder.injectClosed(steps.map((s) => s._underlying))),
|
|
11
|
+
...(0, structure_1.structureBuilderImpl)(jvmScenarioBuilder, wrapScenarioBuilder)
|
|
12
|
+
});
|
|
13
|
+
const scenario = (name) => {
|
|
14
|
+
const jvmScenarioBuilder = jvm_types_1.CoreDsl.scenario(name);
|
|
15
|
+
return wrapScenarioBuilder(jvmScenarioBuilder);
|
|
16
|
+
};
|
|
17
|
+
exports.scenario = scenario;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Duration } from "./utils/duration";
|
|
2
|
+
import { Wrapper } from "./common";
|
|
3
|
+
import JvmSession = io.gatling.javaapi.core.Session;
|
|
4
|
+
export interface Session extends Wrapper<JvmSession> {
|
|
5
|
+
get<T>(key: string): T;
|
|
6
|
+
set(key: string, value: any): Session;
|
|
7
|
+
setByteArray(key: string, value: number[]): Session;
|
|
8
|
+
setAll(newAttributes: Record<string, any>): Session;
|
|
9
|
+
remove(key: string): Session;
|
|
10
|
+
reset(): Session;
|
|
11
|
+
removeAll(...keys: string[]): Session;
|
|
12
|
+
contains(key: string): boolean;
|
|
13
|
+
isFailed(): boolean;
|
|
14
|
+
markAsSucceeded(): Session;
|
|
15
|
+
markAsFailed(): Session;
|
|
16
|
+
scenario(): string;
|
|
17
|
+
groups(): string[];
|
|
18
|
+
userId(): number;
|
|
19
|
+
}
|
|
20
|
+
export declare const wrapSession: (_underlying: JvmSession) => Session;
|
|
21
|
+
export type Expression<T> = T | ((session: Session) => T);
|
|
22
|
+
export type SessionTransform = (session: Session) => Session;
|
|
23
|
+
export declare const underlyingSessionTransform: (f: SessionTransform) => ((jvmSession: JvmSession) => JvmSession);
|
|
24
|
+
export type SessionTo<T> = (session: Session) => T;
|
|
25
|
+
export declare const underlyingSessionTo: <T>(f: SessionTo<T>) => ((jvmSession: JvmSession) => T);
|
|
26
|
+
export declare const underlyingSessionToJava: <T>(f: SessionTo<T>) => ((jvmSession: JvmSession) => unknown);
|
|
27
|
+
export declare const underlyingSessionToDuration: (f: SessionTo<Duration>) => ((jvmSession: JvmSession) => java.time.Duration);
|
|
28
|
+
export declare const underlyingXWithSessionTo: <X, X2>(f: (x: X, session: Session) => X2) => ((x: X, jvmSession: JvmSession) => X2);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.underlyingXWithSessionTo = exports.underlyingSessionToDuration = exports.underlyingSessionToJava = exports.underlyingSessionTo = exports.underlyingSessionTransform = exports.wrapSession = void 0;
|
|
4
|
+
const callbacks_1 = require("./gatlingJvm/callbacks");
|
|
5
|
+
const collections_1 = require("./gatlingJvm/collections");
|
|
6
|
+
const duration_1 = require("./utils/duration");
|
|
7
|
+
const wrapSession = (_underlying) => ({
|
|
8
|
+
_underlying,
|
|
9
|
+
get: (key) => _underlying.get(key),
|
|
10
|
+
set: (key, value) => {
|
|
11
|
+
return (0, exports.wrapSession)(_underlying.set(key, (0, collections_1.asJava)(value)));
|
|
12
|
+
},
|
|
13
|
+
setByteArray: (key, value) => (0, exports.wrapSession)(_underlying.set(key, (0, callbacks_1.wrapByteArray)(value))),
|
|
14
|
+
setAll: (newAttributes) => {
|
|
15
|
+
let session = _underlying;
|
|
16
|
+
for (const key in newAttributes) {
|
|
17
|
+
session = session.set(key, (0, collections_1.asJava)(newAttributes[key]));
|
|
18
|
+
}
|
|
19
|
+
return (0, exports.wrapSession)(session);
|
|
20
|
+
},
|
|
21
|
+
remove: (key) => (0, exports.wrapSession)(_underlying.remove(key)),
|
|
22
|
+
reset: () => (0, exports.wrapSession)(_underlying.reset()),
|
|
23
|
+
removeAll: (...keys) => (0, exports.wrapSession)(_underlying.removeAll(...keys)),
|
|
24
|
+
contains: (key) => _underlying.contains(key),
|
|
25
|
+
isFailed: () => _underlying.isFailed(),
|
|
26
|
+
markAsSucceeded: () => (0, exports.wrapSession)(_underlying.markAsSucceeded()),
|
|
27
|
+
markAsFailed: () => (0, exports.wrapSession)(_underlying.markAsFailed()),
|
|
28
|
+
scenario: () => _underlying.scenario(),
|
|
29
|
+
groups: () => _underlying.groups(),
|
|
30
|
+
userId: () => _underlying.userId()
|
|
31
|
+
});
|
|
32
|
+
exports.wrapSession = wrapSession;
|
|
33
|
+
const underlyingSessionTransform = (f) => (jvmSession) => f((0, exports.wrapSession)(jvmSession))._underlying;
|
|
34
|
+
exports.underlyingSessionTransform = underlyingSessionTransform;
|
|
35
|
+
const underlyingSessionTo = (f) => (jvmSession) => f((0, exports.wrapSession)(jvmSession));
|
|
36
|
+
exports.underlyingSessionTo = underlyingSessionTo;
|
|
37
|
+
const underlyingSessionToJava = (f) => (jvmSession) => (0, collections_1.asJava)(f((0, exports.wrapSession)(jvmSession)));
|
|
38
|
+
exports.underlyingSessionToJava = underlyingSessionToJava;
|
|
39
|
+
const underlyingSessionToDuration = (f) => (jvmSession) => (0, duration_1.toJvmDuration)(f((0, exports.wrapSession)(jvmSession)));
|
|
40
|
+
exports.underlyingSessionToDuration = underlyingSessionToDuration;
|
|
41
|
+
const underlyingXWithSessionTo = (f) => (x, jvmSession) => f(x, (0, exports.wrapSession)(jvmSession));
|
|
42
|
+
exports.underlyingXWithSessionTo = underlyingXWithSessionTo;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmAsLongAs = io.gatling.javaapi.core.loop.AsLongAs;
|
|
3
|
+
import { SessionTo } from "../session";
|
|
4
|
+
import { On } from "./on";
|
|
5
|
+
export interface AsLongAsFunction<T extends AsLongAs<T>> {
|
|
6
|
+
/**
|
|
7
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
8
|
+
*
|
|
9
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
10
|
+
* @returns a DSL component for defining the loop content
|
|
11
|
+
*/
|
|
12
|
+
(condition: string): On<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
15
|
+
*
|
|
16
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
17
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false inside the loop
|
|
18
|
+
* @returns a DSL component for defining the loop content
|
|
19
|
+
*/
|
|
20
|
+
(condition: string, exitASAP: boolean): On<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
23
|
+
*
|
|
24
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
25
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
26
|
+
* @returns a DSL component for defining the loop content
|
|
27
|
+
*/
|
|
28
|
+
(condition: string, counterName: string): On<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
31
|
+
*
|
|
32
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
33
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
34
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false inside the loop
|
|
35
|
+
* @returns a DSL component for defining the loop content
|
|
36
|
+
*/
|
|
37
|
+
(condition: string, counterName: string, exitASAP: boolean): On<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
40
|
+
*
|
|
41
|
+
* @param condition - the condition, expressed as a function
|
|
42
|
+
* @returns a DSL component for defining the loop content
|
|
43
|
+
*/
|
|
44
|
+
(condition: SessionTo<boolean>): On<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
47
|
+
*
|
|
48
|
+
* @param condition - the condition, expressed as a function
|
|
49
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false inside the loop
|
|
50
|
+
* @returns a DSL component for defining the loop content
|
|
51
|
+
*/
|
|
52
|
+
(condition: SessionTo<boolean>, exitASAP: boolean): On<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
55
|
+
*
|
|
56
|
+
* @param condition - the condition, expressed as a function
|
|
57
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
58
|
+
* @returns a DSL component for defining the loop content
|
|
59
|
+
*/
|
|
60
|
+
(condition: SessionTo<boolean>, counterName: string): On<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Define a loop that will iterate as long as the condition holds true
|
|
63
|
+
*
|
|
64
|
+
* @param condition - the condition, expressed as a function
|
|
65
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
66
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false inside the loop
|
|
67
|
+
* @returns a DSL component for defining the loop content
|
|
68
|
+
*/
|
|
69
|
+
(condition: SessionTo<boolean>, counterName: string, exitASAP: boolean): On<T>;
|
|
70
|
+
}
|
|
71
|
+
export interface AsLongAs<T extends AsLongAs<T>> {
|
|
72
|
+
asLongAs: AsLongAsFunction<T>;
|
|
73
|
+
}
|
|
74
|
+
export declare const asLongAsImpl: <J2, J1 extends JvmAsLongAs<J2, any>, T extends AsLongAs<T>>(jvmAsLongAs: J1, wrap: (wrapped: J2) => T) => AsLongAsFunction<T>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asLongAsImpl = 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 asLongAsImpl = (jvmAsLongAs, wrap) => (condition, arg1, arg2) => {
|
|
9
|
+
if (arg2 !== undefined && typeof arg1 === "string") {
|
|
10
|
+
// asLongAs(condition, counterName, exitASAP)
|
|
11
|
+
if (typeof condition === "function") {
|
|
12
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)), arg1, arg2), wrap);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs(condition, arg1, arg2), wrap);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (typeof arg1 === "string") {
|
|
19
|
+
// asLongAs(condition, counterName)
|
|
20
|
+
if (typeof condition === "function") {
|
|
21
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)), arg1), wrap);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs(condition, arg1), wrap);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (typeof arg1 === "boolean") {
|
|
28
|
+
// asLongAs(condition, exitASAP)
|
|
29
|
+
if (typeof condition === "function") {
|
|
30
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)), arg1), wrap);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs(condition, arg1), wrap);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (arg1 === undefined) {
|
|
37
|
+
// asLongAs(condition)
|
|
38
|
+
if (typeof condition === "function") {
|
|
39
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition))), wrap);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return (0, on_1.wrapOn)(jvmAsLongAs.asLongAs(condition), wrap);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw Error(`asLongAs() called with invalid arguments ${condition}, ${arg1}, ${arg2}`);
|
|
46
|
+
};
|
|
47
|
+
exports.asLongAsImpl = asLongAsImpl;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import "@gatling.io/jvm-types";
|
|
2
|
+
import JvmAsLongAsDuring = io.gatling.javaapi.core.loop.AsLongAsDuring;
|
|
3
|
+
import { Duration } from "../utils/duration";
|
|
4
|
+
import { SessionTo } from "../session";
|
|
5
|
+
import { On } from "./on";
|
|
6
|
+
export interface AsLongAsDuringFunction<T extends AsLongAsDuring<T>> {
|
|
7
|
+
/**
|
|
8
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
9
|
+
* isn't reached
|
|
10
|
+
*
|
|
11
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
12
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
13
|
+
* @returns a DSL component for defining the loop content
|
|
14
|
+
*/
|
|
15
|
+
(condition: string, duration: Duration): On<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
18
|
+
* isn't reached
|
|
19
|
+
*
|
|
20
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
21
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
22
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
23
|
+
* @returns a DSL component for defining the loop content
|
|
24
|
+
*/
|
|
25
|
+
(condition: string, duration: Duration, counterName: string): On<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
28
|
+
* isn't reached
|
|
29
|
+
*
|
|
30
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
31
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
32
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
33
|
+
* inside the loop
|
|
34
|
+
* @returns a DSL component for defining the loop content
|
|
35
|
+
*/
|
|
36
|
+
(condition: string, duration: Duration, exitASAP: boolean): On<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
39
|
+
* isn't reached
|
|
40
|
+
*
|
|
41
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
42
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
43
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
44
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
45
|
+
* inside the loop
|
|
46
|
+
* @returns a DSL component for defining the loop content
|
|
47
|
+
*/
|
|
48
|
+
(condition: string, duration: Duration, counterName: string, exitASAP: boolean): On<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
51
|
+
* isn't reached
|
|
52
|
+
*
|
|
53
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
54
|
+
* @param duration - the maximum duration, expressed as a function
|
|
55
|
+
* @returns a DSL component for defining the loop content
|
|
56
|
+
*/
|
|
57
|
+
(condition: string, duration: SessionTo<Duration>): On<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
60
|
+
* isn't reached
|
|
61
|
+
*
|
|
62
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
63
|
+
* @param duration - the maximum duration, expressed as a function
|
|
64
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
65
|
+
* @returns a DSL component for defining the loop content
|
|
66
|
+
*/
|
|
67
|
+
(condition: string, duration: SessionTo<Duration>, counterName: string): On<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
70
|
+
* isn't reached
|
|
71
|
+
*
|
|
72
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
73
|
+
* @param duration - the maximum duration, expressed as a function
|
|
74
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
75
|
+
* inside the loop
|
|
76
|
+
* @returns a DSL component for defining the loop content
|
|
77
|
+
*/
|
|
78
|
+
(condition: string, duration: SessionTo<Duration>, exitASAP: boolean): On<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
81
|
+
* isn't reached
|
|
82
|
+
*
|
|
83
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
84
|
+
* @param duration - the maximum duration, expressed as a function
|
|
85
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
86
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
87
|
+
* inside the loop
|
|
88
|
+
* @returns a DSL component for defining the loop content
|
|
89
|
+
*/
|
|
90
|
+
(condition: string, duration: SessionTo<Duration>, counterName: string, exitASAP: boolean): On<T>;
|
|
91
|
+
/**
|
|
92
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
93
|
+
* isn't reached
|
|
94
|
+
*
|
|
95
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
96
|
+
* @param duration - the maximum duration, expressed as a Gatling Expression Language String
|
|
97
|
+
* @returns a DSL component for defining the loop content
|
|
98
|
+
*/
|
|
99
|
+
(condition: string, duration: string): On<T>;
|
|
100
|
+
/**
|
|
101
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
102
|
+
* isn't reached
|
|
103
|
+
*
|
|
104
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
105
|
+
* @param duration - the maximum duration, expressed as a Gatling Expression Language String
|
|
106
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
107
|
+
* @returns a DSL component for defining the loop content
|
|
108
|
+
*/
|
|
109
|
+
(condition: string, duration: string, counterName: string): On<T>;
|
|
110
|
+
/**
|
|
111
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
112
|
+
* isn't reached
|
|
113
|
+
*
|
|
114
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
115
|
+
* @param duration - the maximum duration, expressed as a Gatling Expression Language String
|
|
116
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
117
|
+
* inside the loop
|
|
118
|
+
* @returns a DSL component for defining the loop content
|
|
119
|
+
*/
|
|
120
|
+
(condition: string, duration: string, exitASAP: boolean): On<T>;
|
|
121
|
+
/**
|
|
122
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
123
|
+
* isn't reached
|
|
124
|
+
*
|
|
125
|
+
* @param condition - the condition, expressed as a Gatling Expression Language String
|
|
126
|
+
* @param duration - the maximum duration, expressed as a Gatling Expression Language String
|
|
127
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
128
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
129
|
+
* inside the loop
|
|
130
|
+
* @returns a DSL component for defining the loop content
|
|
131
|
+
*/
|
|
132
|
+
(condition: string, duration: string, counterName: string, exitASAP: boolean): On<T>;
|
|
133
|
+
/**
|
|
134
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
135
|
+
* isn't reached
|
|
136
|
+
*
|
|
137
|
+
* @param condition - the condition, expressed as a function
|
|
138
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
139
|
+
* @returns a DSL component for defining the loop content
|
|
140
|
+
*/
|
|
141
|
+
(condition: SessionTo<boolean>, duration: Duration): On<T>;
|
|
142
|
+
/**
|
|
143
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
144
|
+
* isn't reached
|
|
145
|
+
*
|
|
146
|
+
* @param condition - the condition, expressed as a function
|
|
147
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
148
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
149
|
+
* @returns a DSL component for defining the loop content
|
|
150
|
+
*/
|
|
151
|
+
(condition: SessionTo<boolean>, duration: Duration, counterName: string): On<T>;
|
|
152
|
+
/**
|
|
153
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
154
|
+
* isn't reached
|
|
155
|
+
*
|
|
156
|
+
* @param condition - the condition, expressed as a function
|
|
157
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
158
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
159
|
+
* inside the loop
|
|
160
|
+
* @returns a DSL component for defining the loop content
|
|
161
|
+
*/
|
|
162
|
+
(condition: SessionTo<boolean>, duration: Duration, exitASAP: boolean): On<T>;
|
|
163
|
+
/**
|
|
164
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
165
|
+
* isn't reached
|
|
166
|
+
*
|
|
167
|
+
* @param condition - the condition, expressed as a function
|
|
168
|
+
* @param duration - the maximum duration, in seconds or with an explicit time unit
|
|
169
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
170
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
171
|
+
* inside the loop
|
|
172
|
+
* @returns a DSL component for defining the loop content
|
|
173
|
+
*/
|
|
174
|
+
(condition: SessionTo<boolean>, duration: Duration, counterName: string, exitASAP: boolean): On<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
177
|
+
* isn't reached
|
|
178
|
+
*
|
|
179
|
+
* @param condition - the condition, expressed as a function
|
|
180
|
+
* @param duration - the maximum duration, expressed as a function
|
|
181
|
+
* @returns a DSL component for defining the loop content
|
|
182
|
+
*/
|
|
183
|
+
(condition: SessionTo<boolean>, duration: SessionTo<Duration>): On<T>;
|
|
184
|
+
/**
|
|
185
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
186
|
+
* isn't reached
|
|
187
|
+
*
|
|
188
|
+
* @param condition - the condition, expressed as a function
|
|
189
|
+
* @param duration - the maximum duration, expressed as a function
|
|
190
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
191
|
+
* @returns a DSL component for defining the loop content
|
|
192
|
+
*/
|
|
193
|
+
(condition: SessionTo<boolean>, duration: SessionTo<Duration>, counterName: string): On<T>;
|
|
194
|
+
/**
|
|
195
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
196
|
+
* isn't reached
|
|
197
|
+
*
|
|
198
|
+
* @param condition - the condition, expressed as a function
|
|
199
|
+
* @param duration - the maximum duration, expressed as a function
|
|
200
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
201
|
+
* inside the loop
|
|
202
|
+
* @returns a DSL component for defining the loop content
|
|
203
|
+
*/
|
|
204
|
+
(condition: SessionTo<boolean>, duration: SessionTo<Duration>, exitASAP: boolean): On<T>;
|
|
205
|
+
/**
|
|
206
|
+
* Define a loop that will iterate as long as the condition holds true and a maximum duration
|
|
207
|
+
* isn't reached
|
|
208
|
+
*
|
|
209
|
+
* @param condition - the condition, expressed as a function
|
|
210
|
+
* @param duration - the maximum duration, expressed as a function
|
|
211
|
+
* @param counterName - the name of the loop counter, as stored in the Session
|
|
212
|
+
* @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
|
|
213
|
+
* inside the loop
|
|
214
|
+
* @returns a DSL component for defining the loop content
|
|
215
|
+
*/
|
|
216
|
+
(condition: SessionTo<boolean>, duration: SessionTo<Duration>, counterName: string, exitASAP: boolean): On<T>;
|
|
217
|
+
}
|
|
218
|
+
export interface AsLongAsDuring<T extends AsLongAsDuring<T>> {
|
|
219
|
+
asLongAsDuring: AsLongAsDuringFunction<T>;
|
|
220
|
+
}
|
|
221
|
+
export declare const asLongAsDuringImpl: <J2, J1 extends JvmAsLongAsDuring<J2, any>, T extends AsLongAsDuring<T>>(jvmAsLongAsDuring: J1, wrap: (wrapped: J2) => T) => AsLongAsDuringFunction<T>;
|