public class GrpcServerExtension extends Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
| Constructor and Description |
|---|
GrpcServerExtension() |
| Modifier and Type | Method and 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.
|
GrpcServerExtension |
directExecutor()
Returns
this configured to use a direct executor for the ManagedChannel and
Server. |
io.grpc.ManagedChannel |
getChannel()
Returns a
ManagedChannel connected to this service. |
io.grpc.Server |
getServer()
Returns the underlying gRPC
Server for this service. |
String |
getServerName()
Returns the randomly generated server name for this service.
|
io.grpc.util.MutableHandlerRegistry |
getServiceRegistry()
Returns the service registry for this service.
|
public final GrpcServerExtension directExecutor()
this configured to use a direct executor for the ManagedChannel and
Server. This can only be called at the rule instantiation.public final io.grpc.ManagedChannel getChannel()
ManagedChannel connected to this service.public final io.grpc.Server getServer()
Server for this service.public final String getServerName()
public final io.grpc.util.MutableHandlerRegistry getServiceRegistry()
BindableService or ServerServiceDefinition to the server.public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
throws Exception
afterEach in interface org.junit.jupiter.api.extension.AfterEachCallbackExceptionCopyright © 2020. All rights reserved.