Search in sources :

Example 11 with WriteContext

use of com.twitter.distributedlog.thrift.service.WriteContext in project distributedlog by twitter.

the class TestDistributedLogService method testWriteOpChecksumBadStream.

@Test(timeout = 60000)
public void testWriteOpChecksumBadStream() throws Exception {
    DistributedLogServiceImpl localService = createConfiguredLocalService();
    WriteContext ctx = new WriteContext().setCrc32(ProtocolUtils.writeOpCRC32("test", getTestDataBuffer().array()));
    Future<WriteResponse> result = localService.writeWithContext("test1", getTestDataBuffer(), ctx);
    WriteResponse resp = Await.result(result);
    assertEquals(StatusCode.CHECKSUM_FAILED, resp.getHeader().getCode());
    localService.shutdown();
}
Also used : WriteResponse(com.twitter.distributedlog.thrift.service.WriteResponse) WriteContext(com.twitter.distributedlog.thrift.service.WriteContext) Test(org.junit.Test)

Aggregations

WriteContext (com.twitter.distributedlog.thrift.service.WriteContext)11 Test (org.junit.Test)11 WriteResponse (com.twitter.distributedlog.thrift.service.WriteResponse)10 ArrayList (java.util.ArrayList)3 DLSN (com.twitter.distributedlog.DLSN)2 DistributedLogConfiguration (com.twitter.distributedlog.DistributedLogConfiguration)2 StreamManagerImpl (com.twitter.distributedlog.service.stream.StreamManagerImpl)2 HeartbeatOptions (com.twitter.distributedlog.thrift.service.HeartbeatOptions)2 Future (com.twitter.util.Future)2 ByteBuffer (java.nio.ByteBuffer)2 List (java.util.List)2 Stream (com.twitter.distributedlog.service.stream.Stream)1 StreamImpl (com.twitter.distributedlog.service.stream.StreamImpl)1 BulkWriteResponse (com.twitter.distributedlog.thrift.service.BulkWriteResponse)1