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();
}
Aggregations