asLonsAs conditions

i am new in gettling
i have this code

import io.gatling.javaapi.core.FeederBuilder;
import io.gatling.javaapi.core.ScenarioBuilder;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;

public class FileExport extends BaseIntegrationSimulation {
    private final FeederBuilder.FileBased<Object> credentialsFeeder = jsonFile("path/to/credentials.json").circular();
    private static final String baseUrl = "";
    private static final String postEndpoint = "/api/v1/upload";
    private static final String getEndpoint = "/api/v1/download";
    private static final String postRequestBody = "{\"param1\":\"value1\",\"param2\":\"value2\"}";

    private final ScenarioBuilder scenarioBuilder = scenario("Test upload file ")
            .exec(http("Call API")
                    .header("accept", "application/json")
                    .header("content-type", "application/json")
                    .header("authorization", "Bearer ${jwtToken}")
            .asLongAs(session -> session("fileId").asOption(String.class).isEmpty(),
                    exec(http("Get Data Request")
                            .get(baseUrl + getEndpoint)
                            .header("authorization", "Bearer ${jwtToken}")
                            .queryParam("timestamp", System.currentTimeMillis())


i have two calls 1 for pot and second for get
i am trying to create test that call 1 time to the post call and them keep calling the get cal till in the response the filepath will not be empty

i receiving errors in .aslonsAs call: Cannot resolve method 'asLongAs(<lambda expression>, ChainBuilder)'.

and i dont understand what i miss
can someone assist ?

The compiler is telling you that you’re trying to use a method that doesn’t exist.

Please check the proper syntax for asLongAs in Java: Gatling - Scenario.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.