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 Object
implements org.junit.jupiter.api.extension.BeforeAllCallback
Restate 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 RestateClient
, RestateURL
and RestateAdminClient
to interact with the deployed runtime:
{@literal @}Test
void testGreet({@literal @}RestateGrpcChannel ManagedChannel channel) {
CounterGrpc.CounterBlockingStub client = CounterGrpc.newBlockingStub(channel);
// Use client
}
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeAll
(org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) boolean
supportsParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
Method Details
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeAll
in 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:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public 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:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-