Class 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.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 RestateIngressClient, 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      java.lang.Object 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        beforeAll in interface org.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 interface org.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:
        resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver
        Throws:
        org.junit.jupiter.api.extension.ParameterResolutionException