Search in sources :

Example 6 with ClientBuilder

use of io.etcd.jetcd.ClientBuilder in project jetcd by coreos.

the class ClientBuilderTest method testMaxInboundMessageSize.

@Test
public void testMaxInboundMessageSize() throws URISyntaxException {
    final int value = 1024 + new Random().nextInt(10);
    final ClientBuilder builder = Client.builder().endpoints(new URI("http://127.0.0.1:2379")).maxInboundMessageSize(value);
    final VertxChannelBuilder channelBuilder = (VertxChannelBuilder) new ClientConnectionManager(builder).defaultChannelBuilder();
    assertThat(channelBuilder.nettyBuilder()).hasFieldOrPropertyWithValue("maxInboundMessageSize", value);
}
Also used : Random(java.util.Random) VertxChannelBuilder(io.vertx.grpc.VertxChannelBuilder) URI(java.net.URI) ClientBuilder(io.etcd.jetcd.ClientBuilder) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with ClientBuilder

use of io.etcd.jetcd.ClientBuilder in project jetcd by coreos.

the class ClientBuilderTest method testDefaultNamespace.

@Test
public void testDefaultNamespace() throws URISyntaxException {
    // test default namespace setting
    final ClientBuilder builder = Client.builder().endpoints(new URI("http://127.0.0.1:2379"));
    final ClientConnectionManager connectionManager = new ClientConnectionManager(builder);
    assertThat(connectionManager.getNamespace()).isEqualTo(ByteSequence.EMPTY);
}
Also used : URI(java.net.URI) ClientBuilder(io.etcd.jetcd.ClientBuilder) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with ClientBuilder

use of io.etcd.jetcd.ClientBuilder in project dubbo by alibaba.

the class JEtcdClientWrapper method prepareClient.

private Client prepareClient(URL url) {
    int maxInboundSize = DEFAULT_INBOUND_SIZE;
    if (StringUtils.isNotEmpty(System.getProperty(GRPC_MAX_INBOUND_SIZE_KEY))) {
        maxInboundSize = Integer.valueOf(System.getProperty(GRPC_MAX_INBOUND_SIZE_KEY));
    }
    // TODO, uses default pick-first round robin.
    ClientBuilder clientBuilder = Client.builder().endpoints(endPoints(url.getBackupAddress())).maxInboundMessageSize(maxInboundSize);
    return clientBuilder.build();
}
Also used : ClientBuilder(io.etcd.jetcd.ClientBuilder)

Aggregations

ClientBuilder (io.etcd.jetcd.ClientBuilder)8 Test (org.junit.jupiter.api.Test)6 URI (java.net.URI)5 Client (io.etcd.jetcd.Client)4 PutResponse (io.etcd.jetcd.kv.PutResponse)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 KV (io.etcd.jetcd.KV)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 Auth (io.etcd.jetcd.Auth)1 ByteSequence (io.etcd.jetcd.ByteSequence)1 Response (io.etcd.jetcd.Response)1 AuthDisableResponse (io.etcd.jetcd.auth.AuthDisableResponse)1 CallOptions (io.grpc.CallOptions)1 Channel (io.grpc.Channel)1 ClientCall (io.grpc.ClientCall)1 ClientInterceptor (io.grpc.ClientInterceptor)1 ForwardingClientCall (io.grpc.ForwardingClientCall)1 Metadata (io.grpc.Metadata)1 VertxChannelBuilder (io.vertx.grpc.VertxChannelBuilder)1 Random (java.util.Random)1