Search in sources :

Example 1 with MaintenanceImplBase

use of io.etcd.jetcd.api.MaintenanceGrpc.MaintenanceImplBase in project jetcd by etcd-io.

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)

Example 2 with MaintenanceImplBase

use of io.etcd.jetcd.api.MaintenanceGrpc.MaintenanceImplBase 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)2 SnapshotRequest (io.etcd.jetcd.api.SnapshotRequest)2 SnapshotResponse (io.etcd.jetcd.api.SnapshotResponse)2 MutableHandlerRegistry (io.grpc.util.MutableHandlerRegistry)2 URI (java.net.URI)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2