@Target(value=TYPE) @Retention(value=RUNTIME) @Import(value=GrpcMockConfiguration.class) @PropertyMapping(value="grpcmock.server") @Inherited public @interface AutoConfigureGrpcMock
Annotation for test classes that want to start a gRPC Mock server as part of the Spring Application Context.
It is recommended to use 0 for gRPC Mock port, as a random free port will be
selected and used. Once a random port is selected it can be access via
${grpcmock.server.port} property and used in gRPC Channel creation.
Mapping stubs will be cleared after each test run and after each test class run. If test class was run with a fixed port, the test context will be marked as dirty to reinitialise a new one.
| Modifier and Type | Optional Element and Description |
|---|---|
String |
certChainFile
Defines the file path for the cert chain.
|
String |
executorBeanName
Defines executor bean to be used for the gRPC server.
|
int |
executorThreadCount
Defines executor thread count to be used for the server, which will create a
Executor via Executors.newFixedThreadPool(int). |
Class<? extends io.grpc.ServerInterceptor>[] |
interceptors
Defines
ServerInterceptor for the gRPC Mock server. |
int |
port
Defines the port value for the gRPC Mock server.
|
String |
privateKeyFile
Defines the file path for the private key.
|
public abstract int port
0 a random free port
will be picked.public abstract Class<? extends io.grpc.ServerInterceptor>[] interceptors
ServerInterceptor for the gRPC Mock server. Interceptors defined here must have
a default constructor without any arguments.public abstract int executorThreadCount
Defines executor thread count to be used for the server, which will create a Executor via Executors.newFixedThreadPool(int).
If executorBeanName() is defined it will take priority over this. If none of these
are defined a default Executor will be used from Server.
public abstract String executorBeanName
Defines executor bean to be used for the gRPC server.
This will take priority over executorThreadCount(). If none of these
are defined a default Executor will be used from ServerBuilder.
public abstract String certChainFile
privateKeyFile() must be
defined in order to configure server security via ServerBuilder.useTransportSecurity(java.io.File, java.io.File).public abstract String privateKeyFile
certChainFile() must be
defined in order to configure server security via ServerBuilder.useTransportSecurity(java.io.File, java.io.File).Copyright © 2021. All rights reserved.