Class InProcessGRPCServer


  • public class InProcessGRPCServer
    extends java.lang.Object
    Generates an in-process service and the channel for it. Useful for testing, usually with mock and spy services.
    • Constructor Summary

      Constructors 
      Constructor Description
      InProcessGRPCServer​(java.util.Collection<io.grpc.BindableService> services)
      Register the passed services in a new in-memory gRPC service with health service providing SERVING status for all of them.
      InProcessGRPCServer​(java.util.Collection<io.grpc.BindableService> services, boolean createChannel)
      Register the passed services in a new in-memory gRPC service with health service providing SERVING status for all of them.
    • Constructor Detail

      • InProcessGRPCServer

        public InProcessGRPCServer​(java.util.Collection<io.grpc.BindableService> services)
        Register the passed services in a new in-memory gRPC service with health service providing SERVING status for all of them. Also provides a channel to access the created server, see getChannel()
        Parameters:
        services - implementations of the gRPC services. For example, one of them can be an instance extending WorkflowServiceGrpc.WorkflowServiceImplBase
      • InProcessGRPCServer

        public InProcessGRPCServer​(java.util.Collection<io.grpc.BindableService> services,
                                   boolean createChannel)
        Register the passed services in a new in-memory gRPC service with health service providing SERVING status for all of them.
        Parameters:
        services - implementations of the gRPC services. For example, one of them can be an instance extending WorkflowServiceGrpc.WorkflowServiceImplBase
        createChannel - defines if a channel to access the created server should be created. If true, the created channel will be accessible using getChannel()
    • Method Detail

      • shutdown

        public void shutdown()
      • shutdownNow

        public void shutdownNow()
      • isShutdown

        public boolean isShutdown()
      • isTerminated

        public boolean isTerminated()
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
      • getServer

        public io.grpc.Server getServer()
      • getChannel

        @Nullable
        public io.grpc.ManagedChannel getChannel()