Package dev.restate.sdk.testing
Class RestateRunner
- java.lang.Object
-
- dev.restate.sdk.testing.RestateRunner
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.ParameterResolver
public class RestateRunner extends java.lang.Object implements org.junit.jupiter.api.extension.BeforeAllCallbackRestate runner for JUnit 5. Example:{@literal @}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.
This extension is scoped per test class, meaning that the restate runner will be shared among test methods.
Use the annotations
RestateGrpcChannel,RestateURLandRestateAdminClientto interact with the deployed runtime:{@literal @}Test void testGreet({@literal @}RestateGrpcChannel ManagedChannel channel) { CounterGrpc.CounterBlockingStub client = CounterGrpc.newBlockingStub(channel); // Use client }
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context)java.lang.ObjectresolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
-
-
Method Detail
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException- Specified by:
supportsParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException- Specified by:
resolveParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
-