Package io.etcd.jetcd.test
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) After the test has completed, clean up the channel and server.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) Before the test has started, create the server and channel.final GrpcServerExtensionReturnsthisconfigured to use a direct executor for theManagedChannelandServer.final io.grpc.ManagedChannelReturns aManagedChannelconnected to this service.final io.grpc.ServerReturns the underlying gRPCServerfor this service.final StringReturns the randomly generated server name for this service.final io.grpc.util.MutableHandlerRegistryReturns the service registry for this service.
-
Constructor Details
-
GrpcServerExtension
public GrpcServerExtension()
-
-
Method Details
-
directExecutor
Returnsthisconfigured to use a direct executor for theManagedChannelandServer. This can only be called at the rule instantiation.- Returns:
- a
GrpcServerExtension
-
getChannel
public final io.grpc.ManagedChannel getChannel()Returns aManagedChannelconnected to this service.- Returns:
- a
ManagedChannel
-
getServer
public final io.grpc.Server getServer()Returns the underlying gRPCServerfor this service.- Returns:
- a
Server
-
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.BindableServiceorServerServiceDefinitionto the server.- Returns:
- a
MutableHandlerRegistry
-
afterEach
After the test has completed, clean up the channel and server.- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
beforeEach
Before the test has started, create the server and channel.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-