diff --git a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java index 5f4726e5..a2637d9b 100644 --- a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java @@ -30,7 +30,15 @@ import org.testcontainers.images.builder.Transferable; import org.testcontainers.utility.DockerImageName; -/** Manual runner for Restate. We recommend using {@link RestateRunner} with JUnit 5. */ +/** + * Manual runner for the Restate test infra, starting the Restate server container together with the + * provided services and automatically registering them. To start the infra use {@link #run()} and + * to stop it use {@link #stop()}. + * + *
Use {@link RestateRunnerBuilder#buildManualRunner()} to build an instance of this class. + * + *
If you use JUnit 5, we suggest using {@link RestateRunner} instead. + */ public class ManualRestateRunner implements AutoCloseable, ExtensionContext.Store.CloseableResource { @@ -75,6 +83,12 @@ public class ManualRestateRunner } /** Run restate, run the embedded service endpoint server, and register the services. */ + public void start() {} + + /** + * @deprecated Use {@link #start()} instead. + */ + @Deprecated(forRemoval = true) public void run() { // Start listening the local server try { diff --git a/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java index 10f7c3c3..e9d08213 100644 --- a/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java @@ -15,26 +15,29 @@ * Restate runner for JUnit 5. Example: * *
{@code - * {@literal @}RegisterExtension + * @RegisterExtension * private final static RestateRunner restateRunner = RestateRunnerBuilder.create() * .withService(new MyService()) * .buildRunner(); * }* - *
The runner will deploy the services locally, execute Restate as container using - * testcontainers, and register the services. + *
The runner will deploy the services locally, execute Restate as container using Testcontainers, and register the services. * *
This extension is scoped per test class, meaning that the restate runner will be shared among * test methods. * *
Use the annotations {@link RestateClient}, {@link RestateURL} and {@link RestateAdminClient} - * to interact with the deployed runtime: + * to interact with the deployed server: * *
{@code - * {@literal @}Test - * void testGreet({@literal @}RestateGrpcChannel ManagedChannel channel) { - * CounterGrpc.CounterBlockingStub client = CounterGrpc.newBlockingStub(channel); - * // Use client + * @Test + * void initialCountIsZero(@RestateClient Client client) { + * var client = CounterClient.fromClient(ingressClient, "my-counter"); + * + * // Use client as usual + * long response = client.get(); + * assertThat(response).isEqualTo(0L); * } * }*/ diff --git a/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java index 12d0b5fe..126943b4 100644 --- a/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java @@ -13,7 +13,11 @@ import java.util.HashMap; import java.util.Map; -/** Builder for {@link RestateRunner}. See {@link RestateRunner} for more details. */ +/** + * Builder for {@link RestateRunner}. + * + * @see RestateRunner + */ public class RestateRunnerBuilder { private static final String DEFAULT_RESTATE_CONTAINER = "docker.io/restatedev/restate"; @@ -73,6 +77,9 @@ public