Search in sources :

Example 1 with SnapshotRequest

use of io.etcd.jetcd.api.SnapshotRequest in project jetcd by coreos.

the class MaintenanceUnitTest method setUp.

@BeforeEach
public void setUp() throws IOException, URISyntaxException {
    observerQueue = new LinkedBlockingQueue<>();
    executor = Executors.newFixedThreadPool(2);
    serviceRegistry = new MutableHandlerRegistry();
    serviceRegistry.addService(new MaintenanceImplBase() {

        @Override
        public void snapshot(SnapshotRequest request, StreamObserver<SnapshotResponse> observer) {
            try {
                observerQueue.put(observer);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    });
    fakeServer = NettyServerBuilder.forPort(TestUtil.findNextAvailablePort()).fallbackHandlerRegistry(serviceRegistry).directExecutor().build().start();
    client = Client.builder().endpoints(new URI("http://127.0.0.1:" + fakeServer.getPort())).build();
    maintenance = client.getMaintenanceClient();
}
Also used : MaintenanceImplBase(io.etcd.jetcd.api.MaintenanceGrpc.MaintenanceImplBase) SnapshotResponse(io.etcd.jetcd.api.SnapshotResponse) SnapshotRequest(io.etcd.jetcd.api.SnapshotRequest) MutableHandlerRegistry(io.grpc.util.MutableHandlerRegistry) URI(java.net.URI) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

MaintenanceImplBase (io.etcd.jetcd.api.MaintenanceGrpc.MaintenanceImplBase)1 SnapshotRequest (io.etcd.jetcd.api.SnapshotRequest)1 SnapshotResponse (io.etcd.jetcd.api.SnapshotResponse)1 MutableHandlerRegistry (io.grpc.util.MutableHandlerRegistry)1 URI (java.net.URI)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1