All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.tinkoff.gatling.amqp.javaapi.request.RequestReplyDslBuilder Maven / Gradle / Ivy

The newest version!
package ru.tinkoff.gatling.amqp.javaapi.request;

import io.gatling.javaapi.core.ActionBuilder;
import ru.tinkoff.gatling.amqp.javaapi.check.AmqpChecks;
import scala.Tuple2;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static io.gatling.javaapi.core.internal.Expressions.*;

public class RequestReplyDslBuilder implements ActionBuilder {
    private ru.tinkoff.gatling.amqp.request.RequestReplyDslBuilder wrapped;

    public RequestReplyDslBuilder(ru.tinkoff.gatling.amqp.request.RequestReplyDslBuilder wrapped) {
        this.wrapped = wrapped;
    }

    public RequestReplyDslBuilder messageId(String value) {
        this.wrapped = wrapped.messageId(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder priority(Integer value) {
        this.wrapped = wrapped.priority(toIntExpression(value.toString()));
        return this;
    }

    public RequestReplyDslBuilder contentType(String value) {
        this.wrapped = wrapped.contentType(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder contentEncoding(String value) {
        this.wrapped = wrapped.contentEncoding(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder correlationId(String value) {
        this.wrapped = wrapped.correlationId(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder replyTo(String value) {
        this.wrapped = wrapped.replyTo(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder expiration(String value) {
        this.wrapped = wrapped.expiration(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder timestamp(String value) {
        this.wrapped = wrapped.timestamp(toExpression(value, java.util.Date.class));
        return this;
    }

    public RequestReplyDslBuilder amqpType(String value) {
        this.wrapped = wrapped.amqpType(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder userId(String value) {
        this.wrapped = wrapped.userId(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder appId(String value) {
        this.wrapped = wrapped.appId(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder clusterId(String value) {
        this.wrapped = wrapped.clusterId(toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder header(String key, String value) {
        this.wrapped = wrapped.header(key, toStringExpression(value));
        return this;
    }

    public RequestReplyDslBuilder headers(Map values) {
        var headersList = values
                .entrySet()
                .stream()
                .map(pair ->
                        Tuple2.apply(pair.getKey(), toStringExpression(pair.getValue()))
                ).toList();
        this.wrapped = wrapped.headers(scala.jdk.javaapi.CollectionConverters.asScala(headersList).toSeq());
        return this;
    }

    public RequestReplyDslBuilder check(Object... checks) {
        return check(Arrays.asList(checks));
    }
    public RequestReplyDslBuilder check(List checks) {
        this.wrapped = wrapped.check(AmqpChecks.toScalaChecks(checks));
        return this;
    }

    public io.gatling.core.action.builder.ActionBuilder asScala(){
        return wrapped.build();
    }

}