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 java.lang.Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
-
-
Constructor Summary
Constructors Constructor Description GrpcServerExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEach(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.GrpcServerExtensiondirectExecutor()Returnsthisconfigured to use a direct executor for theManagedChannelandServer.io.grpc.ManagedChannelgetChannel()Returns aManagedChannelconnected to this service.io.grpc.ServergetServer()Returns the underlying gRPCServerfor this service.java.lang.StringgetServerName()Returns the randomly generated server name for this service.io.grpc.util.MutableHandlerRegistrygetServiceRegistry()Returns the service registry for this service.
-
-
-
Method Detail
-
directExecutor
public final GrpcServerExtension 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
public final java.lang.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.BindableServiceorServerServiceDefinitionto the server.- Returns:
- a
MutableHandlerRegistry
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.ExceptionAfter the test has completed, clean up the channel and server.- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
java.lang.Exception
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.ExceptionBefore the test has started, create the server and channel.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
java.lang.Exception
-
-