Class GrpcServerExtension

java.lang.Object
io.etcd.jetcd.test.GrpcServerExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension

public class GrpcServerExtension extends Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
    After the test has completed, clean up the channel and server.
    void
    beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
    Before the test has started, create the server and channel.
    Returns this configured to use a direct executor for the ManagedChannel and Server.
    final io.grpc.ManagedChannel
    Returns a ManagedChannel connected to this service.
    final io.grpc.Server
    Returns the underlying gRPC Server for this service.
    final String
    Returns the randomly generated server name for this service.
    final io.grpc.util.MutableHandlerRegistry
    Returns the service registry for this service.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GrpcServerExtension

      public GrpcServerExtension()
  • Method Details

    • directExecutor

      public final GrpcServerExtension directExecutor()
      Returns this configured to use a direct executor for the ManagedChannel and Server. This can only be called at the rule instantiation.
      Returns:
      a GrpcServerExtension
    • getChannel

      public final io.grpc.ManagedChannel getChannel()
      Returns a ManagedChannel connected to this service.
      Returns:
      a ManagedChannel
    • getServer

      public final io.grpc.Server getServer()
      Returns the underlying gRPC Server for this service.
      Returns:
      a Server
    • getServerName

      public final String getServerName()
      Returns the randomly generated server name for this service.
      Returns:
      the server name
    • getServiceRegistry

      public final io.grpc.util.MutableHandlerRegistry getServiceRegistry()
      Returns the service registry for this service. The registry is used to add service instances (e.g. BindableService or ServerServiceDefinition to the server.
      Returns:
      a MutableHandlerRegistry
    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      After the test has completed, clean up the channel and server.
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      Throws:
      Exception
    • beforeEach

      public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Before the test has started, create the server and channel.
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
      Throws:
      Exception