Search in sources :

Example 1 with LocalRoutingService

use of com.twitter.distributedlog.client.routing.LocalRoutingService in project distributedlog by twitter.

the class TestDistributedLogServer method testChecksumFlag.

/**
     * Sanity check to make sure both checksum flag values work.
     */
@Test(timeout = 60000)
public void testChecksumFlag() throws Exception {
    String name = "dlserver-basic-write";
    LocalRoutingService routingService = LocalRoutingService.newBuilder().build();
    routingService.addHost(name, dlServer.getAddress());
    DistributedLogClientBuilder dlClientBuilder = DistributedLogClientBuilder.newBuilder().name(name).clientId(ClientId$.MODULE$.apply("test")).routingService(routingService).handshakeWithClientInfo(true).clientBuilder(ClientBuilder.get().hostConnectionLimit(1).connectionTimeout(Duration.fromSeconds(1)).requestTimeout(Duration.fromSeconds(60))).checksum(false);
    DistributedLogClient dlClient = (DistributedLogClientImpl) dlClientBuilder.build();
    Await.result(dlClient.write(name, ByteBuffer.wrap(("1").getBytes())));
    dlClient.close();
    dlClient = dlClientBuilder.checksum(true).build();
    Await.result(dlClient.write(name, ByteBuffer.wrap(("2").getBytes())));
    dlClient.close();
}
Also used : DistributedLogClientImpl(com.twitter.distributedlog.client.DistributedLogClientImpl) LocalRoutingService(com.twitter.distributedlog.client.routing.LocalRoutingService) Test(org.junit.Test)

Aggregations

DistributedLogClientImpl (com.twitter.distributedlog.client.DistributedLogClientImpl)1 LocalRoutingService (com.twitter.distributedlog.client.routing.LocalRoutingService)1 Test (org.junit.Test)1